@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Playfair+Display:ital,wght@0,500;0,600;0,700;1,600&display=swap');

/* Shared instrument-panel tokens/components — kept in sync with styles.css.
   See DESIGN.md for the system these values belong to. */
:root {
  --ink: #0a090b;
  --panel: #131116;
  --panel-raised: #19161b;
  --armed: #8c2f42;
  --armed-bright: #c9657c;
  --armed-deep: #5c1f2c;
  --paper: #eee9e6;
  --muted: #8f858a;
  --muted-dim: #625a5e;
  --line: rgba(238, 233, 230, 0.12);
  --line-strong: rgba(238, 233, 230, 0.22);
  --idle: #8f858a;
  --warn: #d7ac68;
  --max: 1120px;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; color: var(--paper); background: var(--ink); font-family: Manrope, Arial, sans-serif; }
a { color: inherit; }
button, input, textarea, select { font: inherit; }

/* ---- Shared components (status-chip / panel-head — see styles.css) ---- */

.status-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border: 1px solid var(--line-strong); border-radius: 999px; font: 11px "DM Mono", monospace; letter-spacing: .07em; text-transform: uppercase; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-armed { color: var(--armed-bright); border-color: rgba(201, 101, 124, .4); background: rgba(140, 47, 66, .12); }
.status-armed .status-dot { box-shadow: 0 0 4px 1px var(--armed); }
.status-idle { color: var(--idle); }
.status-warn { color: var(--warn); border-color: rgba(215, 172, 104, .38); background: rgba(173, 120, 45, .1); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-name { font: 11px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; color: var(--paper); }
.panel-readouts { display: grid; gap: 0; margin: 20px 0 0; border-top: 1px solid var(--line); }
.readout-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font: 12px Manrope, Arial, sans-serif; color: var(--muted); text-align: left; }
.readout-row strong { color: var(--paper); font: 11px "DM Mono", monospace; letter-spacing: .02em; overflow-wrap: anywhere; text-align: right; }

/* ---- Header ---- */

.portal-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 28px; max-width: var(--max); min-height: 112px; margin: 0 auto; padding: 0 28px; background: color-mix(in srgb, var(--ink) 92%, transparent); backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.wordmark { color: var(--paper); font-size: 18px; font-weight: 800; letter-spacing: -0.06em; text-decoration: none; }
.wordmark-logo { display: block; height: 92px; width: auto; }
.portal-header nav { display: flex; gap: 22px; margin-left: auto; }
.portal-header nav a, .portal-link { color: var(--muted); font: 11px "DM Mono", monospace; letter-spacing: .07em; text-decoration: none; text-transform: uppercase; transition: color 160ms ease; }
.portal-header nav a:hover, .portal-header nav .active, .portal-link:hover { color: var(--paper); }

main { max-width: var(--max); margin: 0 auto; padding: 68px 28px 90px; }

/* ---- Shell / copy ---- */

.portal-shell { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 90px; align-items: center; min-height: 660px; }
.portal-copy h1, .account-head h1 { margin: 16px 0 0; font: 600 clamp(50px, 7vw, 84px)/.94 "Playfair Display", Georgia, serif; letter-spacing: -.045em; }
.portal-copy > p:last-child { max-width: 460px; margin: 27px 0 0; color: #c8bec1; font-size: 14px; line-height: 1.85; }

/* ---- Cards / panels ---- */

.auth-card, .account-panel { padding: 26px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--panel); box-shadow: inset 0 1px 0 rgba(238, 233, 230, .05), 0 25px 70px rgba(0, 0, 0, .22); }
.auth-card h2 { margin: 13px 0 25px; font: 600 32px/1 "Playfair Display", Georgia, serif; letter-spacing: -.04em; }
.auth-card form { display: grid; gap: 16px; }
.auth-card label, .reset-form label { display: grid; gap: 8px; color: #c9bfc3; font: 11px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; }

/* Roomier variant for the sign-in/sign-up page specifically — the shared .auth-card
   above stays tight for link.html's device-code card and 404's compact error card. */
.auth-page-card { padding: 46px 42px; }
.auth-page-card h2 { margin: 0 0 34px; font-size: 36px; }
.auth-page-card form { gap: 26px; }
.auth-page-card input { padding: 16px; }
.auth-page-card label { gap: 10px; }
.auth-page-card .primary-action { min-height: 50px; margin-top: 8px; }
.auth-page-card .auth-status { margin-top: 10px; }
.auth-page-card .auth-switch { margin-top: 28px; }

input, textarea, select { width: 100%; padding: 13px; border: 1px solid var(--line); border-radius: 2px; outline: none; color: var(--paper); background: #100e10; font: 12px Manrope, Arial, sans-serif; letter-spacing: 0; text-transform: none; transition: border-color 160ms ease, box-shadow 160ms ease, opacity 120ms ease; }
input.is-toggling { opacity: .3; }
input:focus, textarea:focus, select:focus { border-color: var(--armed-bright); box-shadow: 0 0 0 3px rgba(140, 47, 66, .12); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }

/* ---- Email domain suggestions ---- */

.input-wrap { position: relative; }
.input-wrap:has(.password-toggle) input { padding-right: 44px; }
.email-suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--panel-raised); box-shadow: 0 16px 34px rgba(0, 0, 0, .4); overflow: hidden; max-height: 0; opacity: 0; transform: translateY(-6px); transition: max-height 220ms cubic-bezier(.22,.8,.24,1), opacity 160ms ease, transform 220ms cubic-bezier(.22,.8,.24,1); }
.email-suggest.is-open { max-height: 240px; opacity: 1; transform: translateY(0); padding: 6px; }
.email-suggest li { display: block; }
.email-suggest button { display: block; width: 100%; padding: 10px 10px; border: 0; border-radius: 2px; color: var(--paper); background: none; font: 12px "DM Mono", monospace; letter-spacing: 0; text-transform: none; text-align: left; cursor: pointer; transition: background 120ms ease, color 120ms ease; }
.email-suggest button:hover, .email-suggest button:focus-visible { background: rgba(140, 47, 66, .16); color: var(--armed-bright); outline: none; }
.email-suggest button span { color: var(--muted); }
.email-suggest button:hover span, .email-suggest button:focus-visible span { color: inherit; }

/* ---- Password visibility toggle ---- */

.password-toggle { position: absolute; top: 50%; right: 5px; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 2px; background: none; color: var(--muted); cursor: pointer; transition: color 160ms ease; }
.password-toggle:hover, .password-toggle:focus-visible { color: var(--paper); outline: none; }
.password-toggle svg { width: 18px; height: 18px; }
.password-toggle svg[hidden] { display: none; }

.primary-action, .quiet-button { min-height: 45px; padding: 0 16px; border: 1px solid; border-radius: 2px; font: 11px "DM Mono", monospace; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; transition: background 160ms ease, box-shadow 180ms ease, transform 160ms ease, border-color 160ms ease, color 160ms ease; }
.primary-action { color: #fff; border-color: var(--armed); background: var(--armed); }
.primary-action:hover { background: #77283a; box-shadow: 0 14px 28px rgba(140, 47, 66, .32); transform: translateY(-2px); }
.primary-action:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.quiet-button { color: var(--paper); border-color: var(--line); background: transparent; }
.quiet-button:hover { border-color: var(--armed-bright); color: var(--armed-bright); }

.password-rules { display: grid; gap: 4px; margin: -4px 0 2px; padding: 0; list-style: none; }
.password-rules[hidden] { display: none; }
.password-rules li { position: relative; padding-left: 16px; color: var(--muted); font-size: 12px; line-height: 1.6; transition: color 160ms ease; }
.password-rules li::before { position: absolute; top: 0; left: 0; font-size: 8px; content: '○'; }
.password-rules li.met { color: #9fd3ac; }
.password-rules li.met::before { color: #9fd3ac; content: '●'; }
.field-hint { display: block; margin-top: 6px; color: var(--armed-bright); font-size: 12px; text-transform: none; letter-spacing: 0; }
.field-hint[hidden] { display: none; }
.link-button { padding: 0; border: 0; color: var(--armed-bright); background: none; font: inherit; text-decoration: underline; cursor: pointer; }
.auth-switch { margin: 4px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-switch button { padding: 0; border: 0; color: var(--armed-bright); background: none; font: inherit; cursor: pointer; }
.auth-status, .config-state { min-height: 20px; margin: 2px 0 0; color: #e2bc7d; font: 11px "DM Mono", monospace; line-height: 1.6; }
.config-state { padding: 14px; border: 1px dashed var(--line); border-radius: 2px; color: var(--muted); }

/* ---- Account ---- */

.account-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 42px; }
.account-head h1 { font-size: clamp(46px, 6vw, 72px); }
.account-head p:last-child { max-width: 460px; margin: 17px 0 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.account-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; }
.account-panel { min-height: 236px; }
.account-panel h2 { margin: 12px 0 20px; font: 600 28px "Playfair Display", Georgia, serif; letter-spacing: -.035em; }
.license-list { display: grid; gap: 9px; }
.license-row { display: flex; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 2px; background: rgba(255, 255, 255, .02); }
.license-row strong { font: 11px "DM Mono", monospace; letter-spacing: .05em; }
.license-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.status { display: inline-flex; align-items: center; gap: 5px; min-height: 20px; padding: 0 8px; border: 1px solid rgba(201, 101, 124, .4); border-radius: 999px; color: var(--armed-bright); background: rgba(140, 47, 66, .1); font: 11px "DM Mono", monospace; letter-spacing: .05em; text-transform: uppercase; }
.status::before { width: 6px; height: 6px; border-radius: 50%; content: ''; background: currentColor; box-shadow: 0 0 4px 1px currentColor; }
.status.suspended { border-color: rgba(215, 172, 104, .36); color: #e2bc7d; background: rgba(173, 120, 45, .1); }
.status.suspended::before { box-shadow: none; }
.status.revoked { border-color: rgba(238, 233, 230, .16); color: #8f858a; background: rgba(255, 255, 255, .03); }
.status.revoked::before { box-shadow: none; }
.status.active::before { box-shadow: 0 0 4px 1px currentColor; }

.empty-state { color: var(--muted); font-size: 12px; line-height: 1.75; }
.reset-form { display: grid; gap: 13px; }
.reset-form textarea { min-height: 90px; resize: vertical; }
.account-status { margin-top: 12px; color: #9fd3ac; font: 12px "DM Mono", monospace; line-height: 1.6; }

@media (max-width: 760px) {
  .portal-header, main { padding-right: 20px; padding-left: 20px; }
  .portal-header nav { display: none; }
  .portal-shell, .account-grid { grid-template-columns: 1fr; gap: 38px; }
  .portal-shell { min-height: unset; }
  .account-head { display: block; }
  .account-head .quiet-button { margin-top: 20px; }
}

/* ---- Error / 404 ----
   The one place the ARMED glow motif gets to be the whole page: a lost signal reads as
   a giant status orb standing in for the middle digit, same LED language as
   .status-armed .status-dot, just scaled all the way up. No page-wide texture or new
   material — the orb is the entire departure from the rest of the system. */

.error-shell { display: grid; place-items: center; min-height: 74vh; padding: 40px 24px; text-align: center; }
.error-content { width: 100%; max-width: 460px; }

.error-figure { display: flex; align-items: center; justify-content: center; gap: 2px; margin: 0 0 8px; user-select: none; }
.error-figure span { font-family: "Playfair Display", Georgia, serif; font-weight: 600; font-size: clamp(84px, 15vw, 168px); line-height: 1; color: var(--paper); letter-spacing: -.02em; }
.error-orb { position: relative; flex: none; width: clamp(58px, 10.5vw, 118px); height: clamp(58px, 10.5vw, 118px); border-radius: 50%; margin: 0 clamp(-6px, -0.6vw, -2px); background: radial-gradient(circle at 34% 30%, var(--armed-bright) 0%, var(--armed) 45%, var(--armed-deep) 100%); box-shadow: 0 0 46px 6px rgba(140, 47, 66, .3), inset 0 -6px 10px rgba(0, 0, 0, .22), inset 0 4px 8px rgba(255, 255, 255, .28); }

.error-content h1 { margin: 0 0 12px; font: 600 32px/1.1 "Playfair Display", Georgia, serif; letter-spacing: -.04em; }
.error-content p { max-width: 380px; margin: 0 auto 4px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.error-content .panel-readouts { max-width: 380px; margin: 24px auto 0; text-align: left; }
.error-content .actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 11px; margin-top: 26px; }

@media (max-width: 460px) {
  .error-figure { gap: 0; }
  .error-orb { margin: 0 -8px; }
}

:focus-visible { outline: 2px solid var(--armed-bright); outline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
