/* ============================================================================
   SkyQon UI — shared design tokens + reusable components for the auth surfaces.
   Loaded by: index.html, signup.html, accept-invite.html, check.html.

   SINGLE SOURCE OF TRUTH for the palette. Pages must NOT redefine the :root /
   [data-theme="light"] token blocks inline — an inline :root in a page <style>
   comes after this <link> and would override it. Pages keep only their own
   page-specific *layout* CSS.

   Dark values are the production default and are kept identical to the previous
   per-page tokens (no dark-mode regression). The [data-theme="light"] block is
   the premium light palette: white cards, soft blue-gray borders, navy ink,
   WHITE inputs (never dark-gray), readable slate placeholders, gold focus rings.
   ============================================================================ */

:root {
  /* ── brand ─────────────────────────────────────────────────────────────── */
  --navy:        #0E1A2E;
  --navy-mid:    #15243E;
  --navy-deep:   #0A1322;
  --yellow:      #F5C518;
  --yellow-hi:   #FFD740;   /* brighter gold for gradient top / hover */
  --yellow-text: #0A1628;   /* ink on gold buttons */
  --yellow-soft: #B8860B;   /* accent text/links on light (bright gold fails AA on white) */
  --blue:        #5B9BFF;   /* secondary accent (dark) */

  /* ── text ──────────────────────────────────────────────────────────────── */
  --text-primary:   #E8EDF5;
  --text-secondary: #B6C3DD;
  --text-muted:     #8895AE;

  /* ── surfaces ──────────────────────────────────────────────────────────── */
  --card-bg:       #172B4A;
  --border:        rgba(255,255,255,.07);
  --border-bright: rgba(255,255,255,.14);

  /* ── inputs ────────────────────────────────────────────────────────────── */
  --input-bg:          rgba(14,26,46,.65);
  --input-border:      rgba(255,255,255,.14);
  --input-text:        #E8EDF5;
  --input-placeholder: #8895AE;
  --focus-ring:        rgba(245,197,24,.22);

  /* ── status ────────────────────────────────────────────────────────────── */
  --red:          #F87171;
  --red-bg:       rgba(220,60,60,.12);
  --amber:        #FBBF24;
  --green:        #34D399;
  --green-bright: #34D399;
  --green-bg:     rgba(52,211,153,.10);

  /* ── typography ────────────────────────────────────────────────────────── */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* ── shape + depth ─────────────────────────────────────────────────────── */
  --radius-card:    16px;
  --radius-control: 10px;
  --radius-pill:    100px;
  --shadow-card:    0 30px 80px -20px rgba(0,0,0,.5), 0 8px 24px -8px rgba(0,0,0,.4);
  --shadow-btn:     0 10px 28px -10px rgba(245,197,24,.5);
  --shadow-btn-hi:  0 14px 32px -10px rgba(245,197,24,.65);
  --frame-shadow:   0 30px 80px -20px rgba(0,0,0,.65), 0 8px 24px -8px rgba(0,0,0,.5);
  --chip-bg:        rgba(255,255,255,.05);

  /* ── spacing scale ─────────────────────────────────────────────────────── */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px;
}

/* ── PREMIUM LIGHT PALETTE ─────────────────────────────────────────────────
   Bright, confident, accessible. The headline fix: inputs are WHITE with soft
   blue-gray borders and readable slate placeholders — never dark gray. */
[data-theme="light"] {
  --navy:        #F4F8FC;   /* warm pale-sky page bg */
  --navy-mid:    #FFFFFF;
  --navy-deep:   #EEF3FA;
  --blue:        #1565C0;

  --text-primary:   #0E1A2E;   /* deep navy headings/ink */
  --text-secondary: #475569;   /* slate body */
  --text-muted:     #64748B;   /* secondary slate */

  --card-bg:       #FFFFFF;
  --border:        rgba(10,22,40,.10);
  --border-bright: #D9E2EF;    /* soft blue-gray card border */

  --input-bg:          #FFFFFF;
  --input-border:      #D6DEEA;
  --input-text:        #0F1B30;
  --input-placeholder: #7A8AA3;
  --focus-ring:        rgba(245,197,24,.28);

  --red:          #B71C1C;
  --red-bg:       rgba(183,28,28,.08);
  --amber:        #B45309;
  --green:        #1F7A34;
  --green-bright: #1F7A34;
  --green-bg:     rgba(31,122,52,.10);

  --shadow-card:   0 12px 40px -14px rgba(10,22,40,.14), 0 2px 6px -2px rgba(10,22,40,.06);
  --shadow-btn:    0 10px 26px -12px rgba(245,197,24,.55);
  --shadow-btn-hi: 0 14px 30px -12px rgba(217,164,6,.5);
  --frame-shadow:  0 30px 80px -20px rgba(10,22,40,.16), 0 8px 24px -8px rgba(10,22,40,.08);
  --chip-bg:       #F0F5FB;
}

/* ============================================================================
   REUSABLE COMPONENTS
   ============================================================================ */

/* ── Card ──────────────────────────────────────────────────────────────── */
.auth-card-v2 {
  background: var(--card-bg);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-card);
  padding: 36px 32px;
  width: 100%; max-width: 460px;
  box-shadow: var(--shadow-card);
}

/* ── Eyebrow + titles ──────────────────────────────────────────────────── */
.auth-eyebrow-v2 {
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--yellow); letter-spacing: .14em;
  margin-bottom: 12px; text-transform: uppercase;
}
[data-theme="light"] .auth-eyebrow-v2 { color: var(--yellow-soft); }
.auth-title-v2 {
  font-size: 25px; font-weight: 700;
  letter-spacing: -.02em; line-height: 1.2;
  margin-bottom: 8px; color: var(--text-primary);
}
.auth-sub-v2 {
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 26px; line-height: 1.6;
}

/* ── Fields: label / input / hint ──────────────────────────────────────── */
.field { margin-bottom: 18px; }
.field > label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 7px; letter-spacing: .005em;
}
.field > label .opt { color: var(--text-muted); font-weight: 400; }
.field > label .req { color: var(--yellow-soft); font-weight: 700; margin-left: 2px; }

.field input,
.field select {
  width: 100%; padding: 13px 15px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-control);
  color: var(--input-text);
  font-size: 14px; font-family: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input::placeholder { color: var(--input-placeholder); }
.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
.field-hint {
  display: block; margin-top: 6px;
  font-size: 12px; color: var(--text-muted); line-height: 1.45;
}

/* inline validation states */
.field.is-error input { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.field.is-ok    input { border-color: var(--green); }
.field-msg { display: none; margin-top: 6px; font-size: 12px; line-height: 1.4; }
.field.is-error .field-msg.err { display: block; color: var(--red); }
.field.is-ok    .field-msg.ok  { display: block; color: var(--green); }
.field-msg.ok::before  { content: "✓ "; font-weight: 700; }

/* ── Password input: show/hide toggle + live requirements ──────────────── */
.input-wrap { position: relative; }
.input-wrap input { padding-right: 66px; }
.pw-toggle {
  position: absolute; top: 7px; right: 7px;
  height: calc(100% - 14px);
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted); padding: 0 10px; border-radius: 7px;
  transition: color .15s, background .15s;
}
.pw-toggle:hover { color: var(--text-primary); background: rgba(127,127,127,.10); }

.pw-reqs { list-style: none; margin: 9px 0 0; padding: 0; display: grid; gap: 5px; }
.pw-reqs li {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted); line-height: 1.4;
  transition: color .15s;
}
.pw-reqs li::before {
  content: "○"; font-size: 11px; color: var(--text-muted);
  width: 12px; text-align: center;
}
.pw-reqs li.met { color: var(--green); }
.pw-reqs li.met::before { content: "✓"; color: var(--green); font-weight: 700; }

/* ── Primary button ────────────────────────────────────────────────────── */
.btn-primary-v2 {
  width: 100%;
  background: linear-gradient(180deg, var(--yellow-hi), var(--yellow));
  color: var(--yellow-text);
  border: none; border-radius: var(--radius-control);
  padding: 14px 18px;
  font-size: 14.5px; font-weight: 700; font-family: inherit;
  cursor: pointer; letter-spacing: .01em;
  box-shadow: var(--shadow-btn);
  transition: transform .1s, box-shadow .15s, filter .15s;
}
.btn-primary-v2:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
  box-shadow: var(--shadow-btn-hi);
}
.btn-primary-v2:active:not(:disabled) { transform: translateY(0); }
.btn-primary-v2:disabled {
  opacity: .55; cursor: default;
  transform: none; box-shadow: none; filter: saturate(.65);
}

/* ── Alerts: error + success ───────────────────────────────────────────── */
.auth-error-v2 {
  display: none;
  background: var(--red-bg);
  border: 1px solid var(--red);
  border-left: 3px solid var(--red);
  color: var(--red); font-size: 13px;
  padding: 11px 14px; border-radius: var(--radius-control);
  margin-bottom: 18px; line-height: 1.5;
}
.success-v2 {
  display: none;
  background: var(--green-bg);
  border: 1px solid var(--green);
  border-left: 3px solid var(--green);
  color: var(--green); font-size: 13.5px;
  padding: 16px; border-radius: var(--radius-control);
  margin-bottom: 18px; line-height: 1.6;
}
.success-v2 strong { color: var(--green); font-size: 14.5px; }
.success-v2 p { margin-top: 6px; color: var(--text-secondary); }
.success-v2 .welcome-tag {
  display: block; font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  color: var(--yellow); letter-spacing: .14em;
  margin-bottom: 10px; text-transform: uppercase;
}
[data-theme="light"] .success-v2 .welcome-tag { color: var(--yellow-soft); }

/* ── Checkbox (clean bordered row) ─────────────────────────────────────── */
.checkbox-field {
  display: flex; align-items: flex-start; gap: 11px;
  margin-bottom: 16px; cursor: pointer;
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--chip-bg);
  transition: border-color .15s, background .15s;
}
.checkbox-field:hover { border-color: var(--border-bright); }
.checkbox-field input {
  width: 17px; height: 17px; margin-top: 1px;
  accent-color: var(--yellow); flex: none; cursor: pointer;
}

/* ── Trust-signal chips ────────────────────────────────────────────────── */
.trust-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.trust-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500;
  color: var(--text-secondary);
  background: var(--chip-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
}
.trust-chip::before { content: "✓"; color: var(--green); font-weight: 700; font-size: 11px; }

/* ── Theme toggle (shared widget) ──────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; gap: 2px; padding: 2px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 8px;
}
[data-theme="light"] .theme-toggle { background: rgba(10,22,40,.04); }
.theme-toggle button {
  background: transparent; border: none; padding: 4px 9px;
  font-size: 13px; color: var(--text-muted);
  cursor: pointer; border-radius: 6px; line-height: 1; font-family: inherit;
}
.theme-toggle button:hover { color: var(--text-primary); }
.theme-toggle button.active { background: rgba(245,197,24,.15); color: var(--yellow); }
[data-theme="light"] .theme-toggle button.active { color: var(--yellow-soft); background: rgba(245,197,24,.18); }

/* ── Brand wordmark fallback (shared) ──────────────────────────────────── */
.brand-fallback { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15.5px; }
.brand-fallback .tri {
  width: 0; height: 0;
  border-left: 7px solid transparent; border-right: 7px solid transparent;
  border-bottom: 12px solid var(--yellow);
}
.brand-fallback .q { color: var(--yellow); }
[data-theme="light"] .brand-fallback .q { color: var(--yellow-soft); }
