/* StepLink ID — light frosted theme (§20.5), brand colours from the asset sheet. */

/* IBM Plex Sans Thai, self-hosted (see FONT_DIR in auth/app.ts). Only the subsets a page uses are fetched. */
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/ibm-plex-sans-thai-thai-400-normal.woff2) format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/ibm-plex-sans-thai-thai-500-normal.woff2) format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/ibm-plex-sans-thai-thai-600-normal.woff2) format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-display: swap; font-weight: 400; src: url(fonts/ibm-plex-sans-thai-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-display: swap; font-weight: 500; src: url(fonts/ibm-plex-sans-thai-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Sans Thai"; font-style: normal; font-display: swap; font-weight: 600; src: url(fonts/ibm-plex-sans-thai-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --brand-blue: #1d4ed8;
  --brand-teal: #14b8c4;
  --brand-green: #22c55e;

  --bg: #f4f6fa;
  --glow-1: rgba(20, 184, 196, 0.13);
  --glow-2: rgba(29, 78, 216, 0.10);
  --grid: rgba(15, 27, 45, 0.045);
  --card: rgba(255, 255, 255, 0.9);
  --card-edge: rgba(255, 255, 255, 1);
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --border: #e3e8f0;
  --border-strong: #cdd5e1;
  --text: #0b1324;
  --text-2: #33415a;
  --muted: #5a6880;
  --accent: #1d4ed8;            /* links, current nav item */
  --primary: #1d4ed8;           /* button fill — white text on it must pass 4.5:1 */
  --primary-2: #2a5ce8;
  --primary-hover: #1a43c0;
  --primary-text: #ffffff;
  --tint: rgba(29, 78, 216, 0.07);
  --ring: rgba(29, 78, 216, 0.18);
  --focus: #1d4ed8;             /* teal fails 3:1 against white, so focus uses the blue */

  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-line: #fbcdc8;
  --warn: #8a5300;
  --warn-bg: #fffaeb;
  --warn-line: #fde3a7;
  --info: #0b5d6b;
  --info-bg: #ecfbfd;
  --info-line: #b6eef4;
  --ok: #157f3c;
  --ok-bg: #ecfdf3;
  --ok-line: #b5ecc9;

  --radius: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -6px rgba(16, 24, 40, 0.08), 0 32px 64px -28px rgba(29, 78, 216, 0.18);
  --shadow-btn: 0 1px 2px rgba(16, 24, 40, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b14;
    --glow-1: rgba(20, 184, 196, 0.12);
    --glow-2: rgba(29, 78, 216, 0.18);
    --grid: rgba(232, 238, 248, 0.035);
    --card: rgba(14, 21, 35, 0.88);
    --card-edge: rgba(255, 255, 255, 0.07);
    --surface: #111a2b;
    --surface-2: #0f1727;
    --border: rgba(232, 238, 248, 0.09);
    --border-strong: rgba(232, 238, 248, 0.16);
    --text: #eef2f8;
    --text-2: #c7d1e0;
    --muted: #96a3b8;
    --accent: #84aaff;
    --primary: #2563eb;
    --primary-2: #2f6cf0;
    --primary-hover: #1f56d4;
    --tint: rgba(132, 170, 255, 0.10);
    --ring: rgba(132, 170, 255, 0.25);
    --focus: #84aaff;
    --danger: #fda29b;
    --danger-bg: rgba(180, 35, 24, 0.16);
    --danger-line: rgba(253, 162, 155, 0.28);
    --warn: #fcd34d;
    --warn-bg: rgba(138, 83, 0, 0.18);
    --warn-line: rgba(252, 211, 77, 0.25);
    --info: #8be3ee;
    --info-bg: rgba(11, 93, 107, 0.22);
    --info-line: rgba(139, 227, 238, 0.22);
    --ok: #6ee7a0;
    --ok-bg: rgba(21, 127, 60, 0.18);
    --ok-line: rgba(110, 231, 160, 0.22);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 24px 64px -24px rgba(0, 0, 0, 0.6);
    --shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    color-scheme: dark;
  }
}
/* chosen in the header toggle (theme.js) — same tokens as the media block above; keep the two in sync */
:root[data-theme="dark"] {
  --bg: #070b14;
  --glow-1: rgba(20, 184, 196, 0.12);
  --glow-2: rgba(29, 78, 216, 0.18);
  --grid: rgba(232, 238, 248, 0.035);
  --card: rgba(14, 21, 35, 0.88);
  --card-edge: rgba(255, 255, 255, 0.07);
  --surface: #111a2b;
  --surface-2: #0f1727;
  --border: rgba(232, 238, 248, 0.09);
  --border-strong: rgba(232, 238, 248, 0.16);
  --text: #eef2f8;
  --text-2: #c7d1e0;
  --muted: #96a3b8;
  --accent: #84aaff;
  --primary: #2563eb;
  --primary-2: #2f6cf0;
  --primary-hover: #1f56d4;
  --tint: rgba(132, 170, 255, 0.10);
  --ring: rgba(132, 170, 255, 0.25);
  --focus: #84aaff;
  --danger: #fda29b;
  --danger-bg: rgba(180, 35, 24, 0.16);
  --danger-line: rgba(253, 162, 155, 0.28);
  --warn: #fcd34d;
  --warn-bg: rgba(138, 83, 0, 0.18);
  --warn-line: rgba(252, 211, 77, 0.25);
  --info: #8be3ee;
  --info-bg: rgba(11, 93, 107, 0.22);
  --info-line: rgba(139, 227, 238, 0.22);
  --ok: #6ee7a0;
  --ok-bg: rgba(21, 127, 60, 0.18);
  --ok-line: rgba(110, 231, 160, 0.22);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 24px 64px -24px rgba(0, 0, 0, 0.6);
  --shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.10);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", "Sarabun", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 50% -8%, var(--glow-1), transparent 70%),
    radial-gradient(800px 480px at 100% 0%, var(--glow-2), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* faint grid that fades out from the top — texture without noise */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px), linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 55% at 50% 0%, #000 30%, transparent 100%);
}
a { color: var(--accent); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--ring); }

/* ---------- page shell ---------- */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 28px;
  gap: 20px;
}
.card {
  width: 100%;
  max-width: 448px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card), inset 0 1px 0 var(--card-edge);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}
.card-body { padding: 8px 40px 40px; }
.card.wide { max-width: 1120px; }
.card.wide .card-body { padding: 0; }
.auth-visual { display: none; }
.auth-content { min-width: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px 40px 20px;
}
.card.wide .brand { padding: 16px 24px; border-bottom: 1px solid var(--border); }
.logo-mark { width: 34px; height: 34px; flex: none; }
.wordmark { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.wordmark b {
  font-weight: 600;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-teal) 60%, var(--brand-green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lang-switch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}
.lang-switch:hover { background: var(--surface-2); text-decoration: none; }
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun, [data-theme="dark"] .theme-toggle .i-moon { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
.lang-switch svg { width: 15px; height: 15px; }

/* ---------- type ---------- */
h1 { font-size: 1.625rem; line-height: 1.35; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 6px; }
h2 { font-size: 1.0625rem; line-height: 1.4; font-weight: 600; margin: 0; }
.subtitle { color: var(--muted); margin: 0 0 28px; }
.hint { color: var(--muted); font-size: 0.875rem; line-height: 1.55; display: block; margin: 0; }
.small { font-size: 0.9375rem; }
.center { text-align: center; }
p { margin: 0 0 12px; }

/* ---------- forms ---------- */
.stack { display: flex; flex-direction: column; gap: 6px; }
.stack > label { font-size: 0.9375rem; font-weight: 500; color: var(--text-2); }
.stack > label:not(:first-child), .stack > .row { margin-top: 10px; }
.stack > .row:first-child { margin-top: 0; }
.stack > .btn { margin-top: 18px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="url"], input:not([type]), select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 14px;
  min-height: 48px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--ring); }
input[aria-invalid="true"] { border-color: var(--danger); }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

.password-field { position: relative; }
.password-field input { padding-right: 84px; }
.password-field .btn-ghost {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  min-width: 64px;
  border: 0;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
}

.check { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0 0; cursor: pointer; font-size: 0.9375rem; }
.stack > label.check { font-weight: 400; color: var(--text); }
.check input { margin: 4px 0 0; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.check .hint { margin-top: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-primary {
  background: linear-gradient(180deg, var(--primary-2), var(--primary));
  color: var(--primary-text);
  box-shadow: var(--shadow-btn);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); border-color: var(--muted); }
.btn-secondary .icon { color: var(--accent); }
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn-ghost:hover { background: var(--tint); }
.btn-ghost.wide { width: 100%; min-height: 46px; margin-top: 8px; font-weight: 500; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger-line); width: auto; }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }
.btn-small { width: auto; min-height: 36px; padding: 4px 14px; font-size: 0.875rem; font-weight: 500; }
.icon { width: 20px; height: 20px; flex: none; }

.divider { display: flex; align-items: center; gap: 14px; color: var(--muted); margin: 24px 0; font-size: 0.8125rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-passkey + .hint { margin-top: 10px; }
.card-body > .center.small { margin: 28px 0 0; color: var(--muted); }
.signup-retry { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.signup-retry .hint { margin-bottom: 12px; }

/* ---------- feedback ---------- */
.alert { border: 1px solid; border-radius: 10px; padding: 11px 14px; margin: 0 0 18px; font-size: 0.9375rem; line-height: 1.5; }
.alert-error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }
.alert-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.keyboard-warning:not(:empty) { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: 10px; padding: 8px 12px; font-size: 0.875rem; }
.banner { width: 100%; max-width: 448px; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); border-radius: 12px; padding: 10px 16px; text-align: center; font-size: 0.9375rem; }

.identity-chip {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 6px 6px 6px 14px;
  margin: 0 0 24px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.identity-chip a { flex: none; font-size: 0.875rem; padding: 6px 12px; border-radius: 999px; }
.identity-chip a:hover { background: var(--tint); text-decoration: none; }
.trouble { margin-top: 20px; color: var(--muted); font-size: 0.9375rem; }
.trouble summary, .steps summary { list-style: none; }
.trouble summary::-webkit-details-marker, .steps summary::-webkit-details-marker { display: none; }
.trouble summary { cursor: pointer; color: var(--accent); font-weight: 500; text-align: center; }
.trouble p { margin-top: 10px; }

/* numbered steps (TOTP setup) */
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 24px; }
.steps > li { counter-increment: step; position: relative; padding-left: 44px; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--tint);
}
.steps .stack { margin-top: 10px; }
.qr { background: #fff; padding: 12px; border: 1px solid var(--border); border-radius: 12px; width: fit-content; margin: 12px 0; }
.qr svg { width: 184px; height: 184px; display: block; }
.steps summary { cursor: pointer; color: var(--accent); font-weight: 500; font-size: 0.9375rem; }
.secret { display: inline-block; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.9375rem; letter-spacing: 0.06em; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; overflow-wrap: anywhere; }
.codes { list-style: none; padding: 0; margin: 0 0 8px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { display: block; text-align: center; padding: 10px; background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.9375rem; letter-spacing: 0.04em; }

/* org picker */
.org-list { display: flex; flex-direction: column; gap: 10px; }
.org-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  text-align: left;
  padding: 12px 44px 12px 16px;
  position: relative;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.org-option::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-top: 2px solid var(--muted);
  border-right: 2px solid var(--muted);
  transform: translateY(-50%) rotate(45deg);
}
.org-option:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.org-option.is-last { border-color: var(--accent); }
.org-name { font-weight: 600; flex: 1; }
.scopes { list-style: none; padding: 0; margin: 0 0 24px; border: 1px solid var(--border); border-radius: var(--radius); }
.scopes li { padding: 12px 16px 12px 44px; position: relative; }
.scopes li + li { border-top: 1px solid var(--border); }
.scopes li::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 19px;
  width: 10px;
  height: 5px;
  border-left: 2px solid var(--ok);
  border-bottom: 2px solid var(--ok);
  transform: rotate(-45deg);
}
.row > .btn { margin-top: 0; }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 500; line-height: 1.4; padding: 3px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-muted { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); }

.footer { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); font-size: 0.8125rem; text-align: center; max-width: 448px; }
.domain-note { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.domain-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--border); color: var(--text-2); font-weight: 600; }
.domain-pill svg { width: 13px; height: 13px; color: var(--ok); }

/* ---------- account centre ---------- */
/* minmax(0,…) so long content can never widen the page beyond the viewport */
.account { display: grid; grid-template-columns: minmax(0, 1fr); }
.account-side { border-bottom: 1px solid var(--border); padding: 16px; min-width: 0; }
.account-user { display: none; }
.account-nav-label { margin: 0 0 8px 10px; color: var(--muted); font-size: .75rem; font-weight: 600; }
.nav { display: flex; flex-wrap: wrap; gap: 5px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--tint); color: var(--accent); font-weight: 600; }
.nav a[aria-current="page"] svg { color: var(--accent); }
.signout { display: none; }
.account-main { padding: 28px 20px 32px; min-width: 0; }
.account-heading { margin: 0 0 28px; }
.account-heading h1 { margin: 2px 0 0; overflow-wrap: anywhere; }
.account-heading .subtitle { margin: 6px 0 0; overflow-wrap: anywhere; }
.account-eyebrow { color: var(--accent); font-size: .75rem; font-weight: 600; letter-spacing: .04em; }
.account-heading-overview {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 148px;
  padding: 28px 30px;
  overflow: hidden;
  border-radius: 20px;
  color: #fff;
  background: radial-gradient(circle at 90% 15%, rgba(80, 233, 202, .4), transparent 40%),
    linear-gradient(120deg, #123f93, #126e9d 68%, #087d79);
  box-shadow: 0 16px 32px -22px rgba(18, 63, 147, .8);
}
.account-heading-copy { position: relative; z-index: 1; min-width: 0; }
.account-heading-overview .account-eyebrow { color: #c4f6ed; }
.account-heading-overview h1 { font-size: 1.8rem; }
.account-heading-overview .subtitle { color: rgba(255,255,255,.92); }
.account-heading-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  flex: none;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 24px;
  color: #fff;
  background: rgba(255,255,255,.14);
  transform: rotate(-8deg);
}
.account-heading-icon svg { width: 38px; height: 38px; transform: rotate(8deg); }
.account-shortcuts { margin: 0 0 26px; }
.account-shortcuts h2 { margin: 0 0 12px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.shortcut {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 8px 24px -24px rgba(29, 78, 216, .35);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.shortcut:hover { border-color: var(--accent); box-shadow: 0 12px 24px -18px rgba(29, 78, 216, .45); text-decoration: none; transform: translateY(-2px); }
.shortcut-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 12px; color: var(--accent); background: var(--tint); }
.shortcut-icon svg { width: 20px; height: 20px; }
.shortcut strong, .shortcut small { display: block; overflow-wrap: anywhere; }
.shortcut strong { font-size: .9375rem; font-weight: 600; }
.shortcut small { margin-top: 3px; color: var(--muted); font-size: .8125rem; line-height: 1.45; }
.signout-mobile { margin-top: 28px; }
.signout-mobile .btn-ghost { display: flex; align-items: center; justify-content: center; gap: 10px; border-color: var(--border); }
.signout-mobile svg { width: 18px; height: 18px; }
.panel-tip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.panel-tip .hint { flex: 1 1 240px; }
.btn .badge, .item-title .badge { font-weight: 500; }
.btn svg:not(.icon) { width: 18px; height: 18px; flex: none; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 20px; margin: 0 0 16px; box-shadow: 0 8px 24px -24px rgba(29, 78, 216, 0.35); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.panel-head .hint { margin-top: 2px; }
.panel-head:last-child { margin-bottom: 0; }
.panel .btn { width: auto; }
.panel .stack > .btn { align-self: flex-start; }
.panel .stack { max-width: 520px; }
.panel .codes { max-width: 420px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.panel-actions .btn, .panel-actions form { margin: 0; }
.panel > .list { margin-top: 4px; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; }
.list li + li { border-top: 1px solid var(--border); }
.list li:first-child { padding-top: 0; }
.list li:last-child { padding-bottom: 0; }
.item { display: flex; align-items: center; gap: 14px; min-width: 0; }
.item-icon { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); }
.item-icon svg { width: 20px; height: 20px; }
.item-title { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.list .meta { color: var(--muted); font-size: 0.8125rem; display: block; margin-top: 2px; overflow-wrap: anywhere; }
.ways li { justify-content: flex-start; }
.ways .item-icon { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-line); width: 32px; height: 32px; border-radius: 8px; }
.ways .item-icon svg { width: 16px; height: 16px; }
.empty { color: var(--muted); font-size: 0.9375rem; margin: 0; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
th { text-align: left; font-weight: 600; font-size: 0.8125rem; color: var(--muted); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.8125rem; color: var(--text-2); }
.inline-form { display: inline; margin: 0; }

@media (max-width: 779px) {
  .auth-card { overflow: hidden; }
  .auth-card::before {
    content: "";
    display: block;
    height: 5px;
    background: linear-gradient(90deg, var(--brand-blue), var(--brand-teal), var(--brand-green));
  }
  .auth-card .brand { background: linear-gradient(135deg, var(--tint), transparent 70%); }
}

@media (min-width: 780px) {
  .auth-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 1fr);
    max-width: 960px;
    min-height: 610px;
    overflow: hidden;
    border-radius: 24px;
  }
  .auth-content { display: flex; flex-direction: column; }
  .auth-content .brand { padding: 28px 36px 20px; }
  .auth-content .card-body { width: 100%; max-width: 448px; margin: auto; padding: 18px 36px 44px; }
  .auth-visual {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    padding: 44px;
    overflow: hidden;
    color: #fff;
    background: radial-gradient(circle at 85% 12%, rgba(80, 233, 202, 0.44), transparent 36%),
      radial-gradient(circle at 0% 85%, rgba(52, 161, 236, 0.55), transparent 45%),
      linear-gradient(145deg, #123f93 0%, #126e9d 58%, #087d79 100%);
  }
  .auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(to bottom, #000, transparent 90%);
  }
  .auth-visual-copy { position: relative; z-index: 1; }
  .auth-eyebrow {
    display: inline-flex;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
  }
  .auth-headline { max-width: 340px; margin: 24px 0 12px; font-size: 2.25rem; font-weight: 600; line-height: 1.3; letter-spacing: -.025em; }
  .auth-description { max-width: 310px; margin: 0; color: rgba(255,255,255,.88); font-size: 1rem; }
  .auth-illustration { position: relative; width: min(100%, 290px); aspect-ratio: 1; align-self: center; margin: 24px 0; }
  .auth-orbit { position: absolute; inset: 4%; border: 1px solid rgba(255,255,255,.26); border-radius: 50%; }
  .auth-orbit-inner { inset: 18%; border-style: dashed; border-color: rgba(255,255,255,.38); }
  .auth-orbit-dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: #a4ffdf; box-shadow: 0 0 0 7px rgba(164,255,223,.16); }
  .auth-orbit-dot-one { top: 16%; left: 17%; }
  .auth-orbit-dot-two { right: 12%; bottom: 23%; width: 7px; height: 7px; background: #b7d9ff; }
  .auth-shield {
    position: absolute;
    inset: 30%;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,.52);
    border-radius: 32px;
    background: linear-gradient(145deg, rgba(255,255,255,.34), rgba(255,255,255,.10));
    box-shadow: 0 20px 50px rgba(4,37,77,.24), inset 0 1px 0 rgba(255,255,255,.35);
    transform: rotate(-8deg);
  }
  .auth-shield svg { width: 54%; height: 54%; transform: rotate(8deg); }
  .auth-float {
    position: absolute;
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid rgba(255,255,255,.5);
    border-radius: 16px;
    background: rgba(255,255,255,.2);
    box-shadow: 0 10px 24px rgba(4,37,77,.18);
  }
  .auth-float svg { width: 23px; height: 23px; }
  .auth-float-key { right: 8%; top: 15%; transform: rotate(10deg); }
  .auth-float-check { left: 8%; bottom: 17%; transform: rotate(-10deg); }
  .auth-signature { color: rgba(255,255,255,.85); font-size: .875rem; font-weight: 600; letter-spacing: .02em; }
  .auth-signature span { margin-left: 4px; color: #a4ffdf; }
}

@media (min-width: 780px) and (max-height: 920px) {
  .auth-shell { padding-top: 12px; padding-bottom: 12px; gap: 8px; }
  .auth-card { min-height: 0; }
  .auth-content .brand { padding-top: 16px; padding-bottom: 8px; }
  .auth-content .card-body { padding-top: 8px; padding-bottom: 12px; }
  .auth-card .subtitle { margin-bottom: 16px; }
  .auth-card .stack > .btn { margin-top: 10px; }
  .auth-card .divider { margin: 12px 0; }
  .auth-card .btn-passkey + .hint { margin-top: 6px; }
  .auth-card .card-body > .center.small { margin-top: 10px; }
  .auth-visual { padding: 28px 36px; }
  .auth-illustration { width: min(100%, 230px); margin: 12px 0; }
}

@media (min-width: 860px) {
  .account { grid-template-columns: 248px minmax(0, 1fr); min-height: 560px; }
  .account-side { border-bottom: 0; border-right: 1px solid var(--border); padding: 24px 14px; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--tint), transparent 55%); }
  .account-nav-label { margin: 20px 0 8px 12px; }
  .account-user { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; border-bottom: 1px solid var(--border); min-width: 0; }
  .avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; background: linear-gradient(135deg, var(--brand-teal), var(--brand-blue)); }
  .account-user .name { font-weight: 600; font-size: 0.9375rem; line-height: 1.35; overflow-wrap: anywhere; }
  .account-user .meta { color: var(--muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
  .nav { flex-direction: column; flex-wrap: nowrap; }
  .signout { display: block; margin-top: auto; }
  .signout .btn-ghost { width: 100%; justify-content: flex-start; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; font-size: 0.9375rem; font-weight: 500; }
  .signout svg { width: 18px; height: 18px; color: var(--muted); }
  .signout-mobile { display: none; }
  .account-main { padding: 36px 40px 40px; }
  .panel { padding: 24px; }
}

@media (min-width: 860px) and (max-height: 920px) {
  .account-shell { padding-top: 12px; padding-bottom: 12px; gap: 8px; }
}

@media (max-width: 600px) {
  .shortcut-grid { grid-template-columns: 1fr; gap: 8px; }
  .shortcut { align-items: center; padding: 12px 14px; }
  .account-heading-overview { min-height: 120px; padding: 22px; }
  .account-heading-overview h1 { font-size: 1.5rem; }
  .account-heading-icon { width: 54px; height: 54px; border-radius: 18px; }
  .account-heading-icon svg { width: 28px; height: 28px; }
}

@media (max-width: 480px) {
  .shell { padding: 16px 12px 24px; justify-content: flex-start; }
  .brand { padding: 20px 20px 16px; }
  .card-body { padding: 4px 20px 28px; }
  .card { border-radius: 16px; }
  h1 { font-size: 1.4rem; }
  .codes { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .list li { flex-wrap: wrap; }
  .nav a { min-height: 36px; padding: 6px 10px; font-size: 0.875rem; gap: 8px; }
  .nav a svg { width: 16px; height: 16px; }
}
@media (max-width: 420px) {
  .brand, .card.wide .brand { gap: 6px; padding-left: 16px; padding-right: 16px; }
  .logo-mark { width: 28px; height: 28px; }
  .wordmark { font-size: .875rem; white-space: nowrap; }
  .lang-switch { gap: 4px; padding: 0 7px; font-size: .75rem; }
  .lang-switch svg { width: 13px; height: 13px; }
}
.theme-switching *, .theme-switching *::before, .theme-switching *::after { transition: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Public developer guide */
.developer-guide { max-width: 1080px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px) 2rem; }
.developer-hero { padding: 2rem 0 2.5rem; }
.developer-kicker { color: var(--accent); font-size: .75rem; font-weight: 600; letter-spacing: .12em; }
.developer-hero h1 { max-width: 18ch; margin: .7rem 0; font-size: clamp(2.1rem, 5vw, 3.8rem); line-height: 1.12; letter-spacing: -.035em; }
.developer-hero p { max-width: 60ch; color: var(--text-2); font-size: 1.1rem; }
.developer-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.developer-actions .btn { width: auto; }
.developer-app-list li { align-items: flex-start; flex-direction: column; gap: .4rem; overflow-wrap: anywhere; }
.developer-app-list li p { margin: 0; }
.developer-app-list li form { margin-top: .5rem; }
.developer-toc { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; padding: 1rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.developer-section { padding: 3rem 0; border-bottom: 1px solid var(--border); scroll-margin-top: 1rem; }
.developer-section h2 { margin: .45rem 0 .75rem; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.developer-section > p { color: var(--text-2); max-width: 80ch; }
.developer-flow { display: flex; align-items: stretch; gap: .7rem; margin: 1.75rem 0; }
.developer-node { position: relative; display: flex; flex: 1; min-width: 0; flex-direction: column; gap: .55rem; padding: 1.2rem; background: linear-gradient(145deg, var(--surface), var(--tint)); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.developer-node svg, .developer-card svg { width: 28px; height: 28px; color: var(--accent); }
.developer-node small { color: var(--muted); line-height: 1.5; }
.developer-step { position: absolute; top: 1rem; right: 1rem; color: var(--muted); font-size: .75rem; font-weight: 600; }
.developer-arrow { align-self: center; color: var(--accent); font-size: 1.4rem; }
.developer-steps { display: grid; gap: .8rem; padding-left: 1.4rem; color: var(--text-2); line-height: 1.7; }
.developer-callout { margin-top: 1.5rem; padding: 1rem 1.2rem; border: 1px solid var(--info-line); border-radius: var(--radius); background: var(--info-bg); color: var(--info); line-height: 1.65; }
.developer-endpoints { display: grid; gap: .75rem; padding: 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.developer-endpoints div { display: grid; gap: .25rem; }
.developer-endpoints span { font-size: .7rem; color: var(--muted); font-weight: 600; letter-spacing: .1em; }
.developer-endpoints a, .developer-endpoints code, .app-secret { overflow-wrap: anywhere; }
.developer-code { overflow-x: auto; padding: 1.2rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); line-height: 1.6; }
.developer-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin: 1.5rem 0; }
.developer-card { padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.developer-card h3 { margin: .75rem 0 .4rem; }
.developer-card p { margin: 0; color: var(--text-2); line-height: 1.65; }
@media (max-width: 640px) {
  .developer-flow { flex-direction: column; }
  .developer-arrow { transform: rotate(90deg); }
  .developer-cards { grid-template-columns: 1fr; }
}
