/* ─────────────────────────────────────────────────────────────────────────
   KIRO Client Portal — login page
   Self-contained: no dependency on the auth-gated /main/brand tokens (the login
   page is the one unauthenticated surface). Tokens mirror kiro-tokens.css +
   portal-shared.css so it reads as the same product. Day/night via [data-theme].
   ───────────────────────────────────────────────────────────────────────── */

:root {
  --kiro:      #FF6400;   /* KIRO orange */
  --kiro-hi:   #ff7a26;   /* hover */
  --kiro-lo:   #e85a00;   /* active */
  --kiro-red:  #D9534F;

  /* night (default) */
  --bg:        #0b0b0d;
  --surface:   #151518;
  --surface-2: #1c1c21;
  --border:    #28282f;
  --border-2:  #34343d;
  --text:      #ffffff;
  --muted:     #9b9ba6;
  --muted-2:   #6c6c78;
  --plate:     #050506;          /* always-dark brand plate */
  --ring:      rgba(255,100,0,.45);
  --shadow:    0 24px 60px -20px rgba(0,0,0,.75), 0 4px 14px -6px rgba(0,0,0,.6);
  --radius:    14px;
  --radius-sm: 8px;
  color-scheme: dark;
}

:root[data-theme="day"] {
  --bg:        #f5f5f7;
  --surface:   #ffffff;
  --surface-2: #f3f3f6;
  --border:    #e2e2e8;
  --border-2:  #d2d2da;
  --text:      #16161a;
  --muted:     #54545c;
  --muted-2:   #8a8a93;
  --plate:     #0b0b0d;          /* still dark, by design — white KIRO logo reads on it */
  --ring:      rgba(255,100,0,.40);
  --shadow:    0 24px 50px -24px rgba(20,20,40,.28), 0 3px 10px -5px rgba(20,20,40,.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  min-height: 100svh;
  font-family: 'Roboto Condensed', 'Heebo', system-ui, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 84% -16%, rgba(255,100,0,.16), transparent 60%),
    radial-gradient(760px 560px at 8% 0%,   rgba(255,130,50,.05), transparent 55%),
    linear-gradient(180deg, #101015 0%, #0b0b0e 46%, #070709 100%);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
:root[data-theme="day"] body {
  background:
    radial-gradient(1100px 560px at 84% -16%, rgba(255,100,0,.10), transparent 58%),
    radial-gradient(820px 560px at 8% 0%, rgba(255,150,60,.06), transparent 55%),
    linear-gradient(180deg, #f8f8fb 0%, #f1f2f5 48%, #eceef2 100%);
  background-color: var(--bg);
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.wrap {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 5vw, 48px);
}

/* ── Theme toggle ────────────────────────────────────────────────────────── */
.theme-btn {
  position: absolute;
  top: clamp(16px, 4vw, 28px);
  right: clamp(16px, 4vw, 28px);
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--t, 150ms), border-color 150ms, background 150ms;
  backdrop-filter: blur(6px);
}
.theme-btn:hover { color: var(--text); border-color: var(--border-2); }
.theme-btn .i-moon { display: none; }
:root[data-theme="day"] .theme-btn .i-sun  { display: none; }
:root[data-theme="day"] .theme-btn .i-moon { display: block; }

/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Always-dark brand plate so the negative (white) KIRO logo always reads. */
.brand {
  background: var(--plate);
  border-bottom: 2px solid var(--kiro);
  padding: 26px 28px;
  display: flex;
  justify-content: center;
}
.brand-logo { height: 36px; width: auto; display: block; }

.card-body { padding: clamp(24px, 6vw, 34px); }

h1 {
  margin: 0;
  font-size: clamp(26px, 6vw, 30px);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  line-height: 1.05;
}
.sub {
  margin: 6px 0 24px;
  color: var(--muted);
  font-family: 'Heebo', system-ui, sans-serif;
  font-size: 14px;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
input[type="text"], input[type="password"] {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 16px;                 /* ≥16px: no iOS zoom-on-focus */
  font-family: 'Heebo', system-ui, sans-serif;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  transition: border-color 150ms, box-shadow 150ms;
}
input::placeholder { color: var(--muted-2); }
input:focus-visible {
  outline: none;
  border-color: var(--kiro);
  box-shadow: 0 0 0 3px var(--ring);
}

.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 52px; }
.toggle {
  position: absolute;
  top: 50%; right: 4px;
  transform: translateY(-50%);
  width: 44px; height: 44px;       /* ≥44px tap target */
  display: inline-grid; place-items: center;
  color: var(--muted);
  background: none; border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 150ms;
}
.toggle:hover { color: var(--text); }
.toggle .i-eye-off { display: none; }
.toggle[aria-pressed="true"] .i-eye     { display: none; }
.toggle[aria-pressed="true"] .i-eye-off { display: block; }

/* ── Error ───────────────────────────────────────────────────────────────── */
.error {
  margin: 0 0 16px;
  padding: 11px 14px;
  font-family: 'Heebo', system-ui, sans-serif;
  font-size: 14px;
  color: #fff;
  background: color-mix(in srgb, var(--kiro-red) 22%, var(--surface));
  border: 1px solid var(--kiro-red);
  border-radius: var(--radius-sm);
}
:root[data-theme="day"] .error { color: #7a1f1c; }
.error[hidden] { display: none; }

/* ── Submit ──────────────────────────────────────────────────────────────── */
.submit {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 4px;
  font-family: 'Roboto Condensed', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #0b0b0d;                  /* near-black on orange ≈ 7.6:1 — AA pass */
  background: var(--kiro);
  border: 0;
  border-radius: 4px;              /* KIRO = sharp/tactical */
  cursor: pointer;
  transition: background 150ms, transform 80ms;
}
.submit:hover  { background: var(--kiro-hi); }
.submit:active { background: var(--kiro-lo); transform: translateY(1px); }
.submit:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; }
.submit[disabled] { opacity: .7; cursor: progress; }
.submit.loading .submit-label { visibility: hidden; }
.submit.loading .spinner { display: block; }

.spinner {
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  width: 20px; height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(11,11,13,.35);
  border-top-color: #0b0b0d;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Footer co-brand ─────────────────────────────────────────────────────── */
.foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 60%, var(--bg));
  color: var(--muted-2);
  font-family: 'Heebo', system-ui, sans-serif;
  font-size: 12px;
}
.foot-logo { height: 18px; width: auto; opacity: .9; }
.i-lock { flex: none; }

/* ── Global focus + reduced motion ───────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--kiro); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .spinner { animation: none; }
}

/* ── Phone ───────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wrap { padding: 0; place-items: stretch; }
  .card {
    width: 100%;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .brand { padding-top: max(26px, env(safe-area-inset-top)); }
  .foot { margin-top: auto; }
}
