:root{
  --bg: #f6f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --radius: 16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", "Hiragino Sans", "Yu Gothic", sans-serif;
  color:var(--text);
  background: var(--bg);
}
footer{
  background: #eef2ff;
  text-align: center;
  padding: 1em;
}

.auth{
  min-height:100%;
  display:grid;
  gap: 24px;
  padding:32px 16px;
  max-width: 1040px;
  margin: 0 auto;
  align-items:center;
}

.req{
  color:#e11d48;
  margin-left:4px;
  font-size: 0.8em;
}

@media (min-width: 900px){
  .auth{
    padding:56px 24px;
  }
}

.auth__panel{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 28px 22px;
  width: 520px;
  margin: 0 auto;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  margin-bottom: 16px;
}
.brand__mark{
  width:42px;height:42px;
  border-radius: 12px;
  background: #2563eb;
  color:#fff;
  display:grid;
  place-items:center;
  font-weight:700;
  letter-spacing:.5px;
}
.brand__title{ font-weight: 650; line-height:1.1; }
.brand__subtitle{ font-size: 12px; color: var(--muted); margin-top:2px; }

.auth__title{
  font-size: 22px;
  margin: 8px 0 6px;
}
.auth__desc{
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.form{ display:flex; flex-direction:column; gap:14px; }

.field{ display:flex; flex-direction:column; gap:6px; }
.field__label{ font-size: 13px; color:#374151; font-weight: 600; }
.field__input{
  width:100%;
  padding: 12px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  background: #fff;
  outline: none;
}
.field__input:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.field__password{
  display:flex;
  align-items:center;
  gap:8px;
}
.field__password .field__input{ flex:1; }

.icon-btn{
  height:42px;
  width:42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  display:grid;
  place-items:center;
  cursor:pointer;
}
.icon-btn:hover{ background:#f9fafb; }
.icon-btn.is-active { color: var(--primary); }

.row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  margin-top:2px;
}

.check{
  display:flex;
  gap:8px;
  align-items:center;
  color:#374151;
  font-size: 13px;
}

.link{
  color: var(--primary);
  text-decoration:none;
  font-size: 13px;
  font-weight: 600;
}
.link:hover{ text-decoration: underline; }

.btn{
  color: var(--primary);
  width:100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:#fff;
  font-weight: 650;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}
.btn:hover{
  text-decoration: none;
}
.btn--primary{
  background: var(--primary);
  border-color: var(--primary);
  color:#fff;
}
.btn--primary:hover{ background: var(--primary-hover); border-color: var(--primary-hover); }
.btn--ghost:hover{ background:#f9fafb; }

.divider{
  position:relative;
  margin: 4px 0;
  text-align:center;
  color: var(--muted);
  font-size: 12px;
}
.divider:before{
  content:"";
  position:absolute;
  left:0; right:0;
  top:50%;
  border-top: 1px solid var(--line);
}
.divider span{
  position:relative;
  background: var(--panel);
  padding: 0 10px;
}

.footnote{
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height:1.6;
}

.auth__aside{ display:none; }
@media (min-width: 900px){
  .auth__aside{ display:block; }
}

.aside__card{
  border-radius: var(--radius);
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.7);
  box-shadow: 0 10px 30px rgba(17,24,39,.06);
}
.aside__title{ font-weight: 700; margin-bottom: 10px; }
.aside__list{
  margin:0;
  padding-left: 18px;
  color:#374151;
  line-height:1.8;
  font-size: 14px;
}

/* flash toast */
.toast{
  border:1px solid var(--line);
  background:#fff;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  margin:10px 0;
  box-shadow: 0 8px 20px rgba(0,0,0,.06);

  width: 90%;
  margin: 0 auto;
  padding: 0.5em 0.75em;
  border-radius: 0.5em;
  position: fixed;
  top: 0.5em;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8em;
  z-index: 999;
  color: #fff;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.is-hiding{
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}

.toast__message{line-height:1.4;}
.toast__close{
  border:none;
  background:transparent;
  cursor:pointer;
  font-weight:900;
  font-size:18px;
  line-height:1;
  color: #fff;
}
.toast--success{border-color:#000; background:rgba(0,0,0,0.7);}
.toast--danger{
  border-color: rgba(239,68,68,.85);
  background: rgba(239,68,68,.85);  /* 赤の透過 */
  color: #fff;
}

.toast--danger .toast__message{
  color:#fff;
  font-weight:700;
}

.toast--danger .toast__close{
  color:#fff;
}

.toast--danger .toast__close:hover{
  background: rgba(255,255,255,.12);
}
.toast--info{border-color:#000; background:rgba(0,0,0,0.7);}
.toast--warning{border-color:#000; background:rgba(0,0,0,0.7);}

/*.toast--success{border-color:#bbf7d0; background:#f0fdf4;}
.toast--danger{border-color:#fecaca; background:#fef2f2;}
.toast--info{border-color:#bae6fd; background:#eff6ff;}
.toast--warning{border-color:#fde68a; background:#fffbeb;}*/

.help{color:var(--muted); font-size:12px; margin-top:6px}

/* =========================
   devise errors (registration/login)
   ========================= */
.form-errors{
  border: 1px solid rgba(239,68,68,.28);
  background: rgba(239,68,68,.06);
  border-radius: 14px;
  padding: 14px 14px 12px;
  margin: 10px 0 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,.04);
  font-size: 0.8em;
}
.form-errors__title{
  font-weight: 750;
  color: #111827;
  margin-bottom: 8px;
  line-height: 1.5;
}
.form-errors__list{
  margin: 0;
  padding-left: 18px;
  color: #111827;
  line-height: 1.7;
  font-size: 14px;
}
.form-errors__list li{
  margin: 2px 0;
}
/* =========================
   field_with_errors (Rails/Devise)
   ========================= */

/* Railsが自動で付けるラッパー。レイアウト崩れを防ぐ */
.field_with_errors {
  display: contents; /* ラッパーを「見えない箱」にして崩れを回避 */
}

/* input/textarea/select のエラー状態（枠・背景・影） */
.field_with_errors .field__input,
.field_with_errors input.field__input,
.field_with_errors textarea.field__input,
.field_with_errors select.field__input {
  border-color: rgba(239, 68, 68, 0.55) !important;
  background: rgba(239, 68, 68, 0.04);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12);
}

/* focus時も赤系のまま */
.field_with_errors .field__input:focus,
.field_with_errors input.field__input:focus,
.field_with_errors textarea.field__input:focus,
.field_with_errors select.field__input:focus {
  outline: none;
  border-color: rgba(239, 68, 68, 0.75) !important;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.16);
}

/* ラベルもエラー色に寄せる（必要なら） */
.field_with_errors + .field__label,
.field_with_errors .field__label {
  color: #b91c1c;
}

/* フィールド下の説明(help)がある場合は控えめに赤へ */
.field_with_errors ~ .help,
.field_with_errors .help {
  color: rgba(185, 28, 28, 0.9);
}

/* deviseのインラインエラーが出る場合の見た目（任意） */
.field-error-text {
  margin-top: 6px;
  font-size: 13px;
  color: #b91c1c;
  line-height: 1.5;
}
