/* ABS Office sign-in page, Blue v4.
   The control room's tokens live in ui/src/styles/tokens.css and are bundled behind login, so the
   entries this page uses are mirrored here under the same names. Change them there first, then here. */
:root {
  color-scheme: dark;
  --blue-d60: #003566;
  --blue-d40: #005099;
  --blue-d20: #006acc;
  --blue-base-dark: #168fff;
  --blue-l20: #45a5ff;
  --blue-l40: #73bcff;
  --blue-l60: #a2d2ff;
  --bg-app: #0c111b;
  --bg-panel: #141d2b;
  --bg-card: #1d2a3d;
  --bg-inset: #0b1019;
  --text-primary: #f1f6ff;
  --text-secondary: #bdcce0;
  --text-muted: #9fb2cc;
  --border-subtle: rgba(189, 204, 224, 0.10);
  --border-default: rgba(189, 204, 224, 0.18);
  --border-input: #7a91ae;
  --action-primary: var(--blue-l20);
  --action-primary-ink: #0c111b;
  --action-hover: var(--blue-l40);
  --action-pressed: var(--blue-base-dark);
  --focus: var(--blue-l60);
  --status-error: #ffb0b0;
  --f-sign: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --f-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --control-h: 44px;
  --ease: 120ms ease-out;
  --ease-standard: 180ms ease-out;
}

/* Light: chosen in the control room, or "System" on a light OS. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-app: #f4f7fb;
  --bg-panel: #ffffff;
  --bg-card: #eaf1fa;
  --bg-inset: #ffffff;
  --text-primary: #14263e;
  --text-secondary: #415873;
  --text-muted: #5a6f88;
  --border-subtle: rgba(20, 38, 62, 0.08);
  --border-default: rgba(20, 38, 62, 0.15);
  --border-input: #71839a;
  --action-primary: var(--blue-d20);
  --action-primary-ink: #ffffff;
  --action-hover: var(--blue-d40);
  --action-pressed: var(--blue-d60);
  --focus: var(--blue-d20);
  --status-error: #b42318;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg-app: #f4f7fb;
    --bg-panel: #ffffff;
    --bg-card: #eaf1fa;
    --bg-inset: #ffffff;
    --text-primary: #14263e;
    --text-secondary: #415873;
    --text-muted: #5a6f88;
    --border-subtle: rgba(20, 38, 62, 0.08);
    --border-default: rgba(20, 38, 62, 0.15);
    --border-input: #71839a;
    --action-primary: var(--blue-d20);
    --action-primary-ink: #ffffff;
    --action-hover: var(--blue-d40);
    --action-pressed: var(--blue-d60);
    --focus: var(--blue-d20);
    --status-error: #b42318;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg-app); color: var(--text-primary); font: 16px/1.5 var(--f-body); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Layout: brand panel left, form right; the brand panel becomes a header strip on a phone. */
.auth { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--space-4); min-height: 100%; padding: var(--space-4); }

/* Brand panel: always the dark surfaces, whatever the theme, like the reference's left half. */
.auth-brand {
  --bg-app: #0c111b;
  --border-subtle: rgba(189, 204, 224, 0.10);
  --text-primary: #f1f6ff;
  --text-secondary: #bdcce0;
  --text-muted: #9fb2cc;
  --focus: var(--blue-l60);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--space-6); border-radius: var(--radius-lg); color: var(--text-primary);
  background:
    radial-gradient(90% 70% at 15% 0%, color-mix(in srgb, var(--blue-d40) 55%, transparent), transparent 70%),
    radial-gradient(80% 60% at 100% 100%, color-mix(in srgb, var(--blue-d60) 70%, transparent), transparent 70%),
    var(--bg-app);
  border: 1px solid var(--border-subtle);
}
.brand-name { font: 700 22px/1 var(--f-sign); letter-spacing: .1em; white-space: nowrap; }
.slides { margin-top: auto; max-width: 30rem; }
.slide-h { margin: 0; font: 700 32px/40px var(--f-body); }
.slide-p { margin: var(--space-2) 0 0; font-size: 16px; color: var(--text-secondary); }
.dots { display: flex; gap: var(--space-1); margin-top: var(--space-5); margin-left: calc(-1 * var(--space-3)); }
/* 44px target around an 8px dot */
.dot { width: var(--control-h); height: var(--control-h); padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: var(--radius-sm); }
.dot::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: var(--text-muted); transition: width var(--ease-standard), background var(--ease-standard); }
.dot[aria-current="true"]::before { width: 24px; background: var(--text-primary); }
.dot:hover::before { background: var(--text-secondary); }
.dot[aria-current="true"]:hover::before { background: var(--text-primary); }

/* Form side */
.auth-main { display: flex; flex-direction: column; min-width: 0; background: var(--bg-panel); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); }
.auth-form-wrap { flex: 1; display: grid; place-items: center; padding: var(--space-7) var(--space-5); }
#login-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; }
#login-form h1 { margin: 0; font: 700 32px/40px var(--f-body); }
.lede { margin: var(--space-2) 0 var(--space-6); font-size: 16px; color: var(--text-secondary); }

.field { display: block; margin: 0 0 var(--space-2); font: 600 14px/20px var(--f-body); color: var(--text-primary); }
.control {
  display: block; width: 100%; min-height: var(--control-h); margin: 0 0 var(--space-4); padding: 10px 12px;
  border: 1px solid var(--border-input); border-radius: var(--radius-sm);
  background: var(--bg-inset); color: var(--text-primary); font: 16px/1.4 var(--f-body);
  transition: border-color var(--ease);
}
.control[aria-invalid="true"] { border-color: var(--status-error); }

.pw { position: relative; }
.pw .control { padding-right: 52px; }
.pw-toggle {
  position: absolute; top: 0; right: 0; width: var(--control-h); height: var(--control-h);
  display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text-secondary); cursor: pointer;
}
.pw-toggle:hover { color: var(--text-primary); }
.pw-toggle[aria-pressed="false"] .eye-off { display: none; }

.field-err { margin: 0 0 var(--space-3); color: var(--status-error); font-size: 14px; }
.field-err:empty { display: none; }

.btn {
  min-height: var(--control-h); padding: 0 var(--space-4); border-radius: var(--radius-sm);
  font: 600 14px/1.2 var(--f-body); cursor: pointer; transition: background var(--ease);
}
.btn-primary { width: 100%; margin-top: var(--space-2); background: var(--action-primary); color: var(--action-primary-ink); border: 1px solid transparent; }
.btn-primary:hover:not(:disabled) { background: var(--action-hover); }
.btn-primary:active:not(:disabled) { background: var(--action-pressed); }
.btn-primary:disabled { opacity: .5; }
.btn[aria-busy="true"] { cursor: progress; }

.help { margin: var(--space-5) 0 0; text-align: center; font-size: 14px; color: var(--text-muted); }

.auth-foot { display: flex; justify-content: space-between; padding: var(--space-4) var(--space-5); font-size: 14px; color: var(--text-muted); }

/* Tablet: narrower brand panel */
@media (max-width: 1024px) {
  .auth { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); }
  .slide-h { font-size: 26px; line-height: 34px; }
}

/* Phone: brand becomes a header strip, form fills the screen */
@media (max-width: 767px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: var(--space-3); padding: var(--space-3); }
  .auth-brand { padding: var(--space-4) var(--space-5); }
  .slides, .dots { display: none; }
  .auth-form-wrap { place-items: start center; padding: var(--space-6) var(--space-4); }
  #login-form h1 { font-size: 26px; line-height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .dot::before, .control, .btn { transition: none; }
}

/* Sign in with Google (shown only when the office has a Google client id) */
.g-wrap { display: grid; gap: 14px; margin: 4px 0 2px; }
.g-wrap[hidden] { display: none; }
#g-btn { min-height: 44px; display: flex; justify-content: center; }
.or { margin: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; }
.or::before, .or::after { content: ""; height: 1px; background: var(--border-default); }

/* ===== Cream (UX audit W1, 2026-10-13): the sign-in has the office's island-floor look: cream paper,
   ink, the serif wordmark and the floor in miniature. Used by :4300 and the website (ui/src/remote). ===== */
:root[data-theme="light"] {
  --bg-app: #f3efe6; --bg-panel: #fffdf8; --bg-card: #f7f3ea; --bg-inset: #fffdf8;
  --text-primary: #1d1b17; --text-secondary: #5b564c; --text-muted: #6e685c;
  --border-subtle: rgba(29, 27, 23, 0.10); --border-default: rgba(29, 27, 23, 0.18); --border-input: #8a8374;
  --action-primary: #1d1b17; --action-primary-ink: #fffdf8; --action-hover: #3a362f; --action-pressed: #000000;
  --focus: #2f6fb3; --status-error: #b3261e;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-app: #f3efe6; --bg-panel: #fffdf8; --bg-card: #f7f3ea; --bg-inset: #fffdf8;
    --text-primary: #1d1b17; --text-secondary: #5b564c; --text-muted: #6e685c;
    --border-subtle: rgba(29, 27, 23, 0.10); --border-default: rgba(29, 27, 23, 0.18); --border-input: #8a8374;
    --action-primary: #1d1b17; --action-primary-ink: #fffdf8; --action-hover: #3a362f; --action-pressed: #000000;
    --focus: #2f6fb3; --status-error: #b3261e;
  }
}
:root { --f-display: "Instrument Serif", Georgia, "Times New Roman", serif; }
.brand-name { font: 400 40px/1 var(--f-display); letter-spacing: 0; }
.slide-h { font: 400 40px/1.1 var(--f-display); }
#login-form h1 { font: 400 44px/1.1 var(--f-display); }
.auth-floor { display: block; width: min(100%, 460px); height: auto; margin: auto; filter: drop-shadow(0 18px 30px rgba(60, 48, 30, 0.18)); }
/* The brand panel follows the theme: cream on light, the office's dark on dark. */
:root[data-theme="light"] .auth-brand {
  --bg-app: #ebe4d4; --border-subtle: rgba(29, 27, 23, 0.10); --text-primary: #1d1b17; --text-secondary: #5b564c; --text-muted: #6e685c; --focus: #2f6fb3;
  background: radial-gradient(90% 70% at 20% 0%, rgba(233, 180, 76, 0.18), transparent 70%), radial-gradient(80% 60% at 100% 100%, rgba(87, 83, 201, 0.10), transparent 70%), #ebe4d4;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .auth-brand {
    --bg-app: #ebe4d4; --border-subtle: rgba(29, 27, 23, 0.10); --text-primary: #1d1b17; --text-secondary: #5b564c; --text-muted: #6e685c; --focus: #2f6fb3;
    background: radial-gradient(90% 70% at 20% 0%, rgba(233, 180, 76, 0.18), transparent 70%), radial-gradient(80% 60% at 100% 100%, rgba(87, 83, 201, 0.10), transparent 70%), #ebe4d4;
  }
}
@media (max-width: 767px) { .auth-floor { display: none; } .brand-name { font-size: 32px; } #login-form h1 { font-size: 36px; } }
