/* AegisOne Open: "Quiet Vault" design system, ported from design/canvas.
   No inline styles anywhere (CSP style-src 'self'). Fonts use the system stack
   until Geist is self-hosted; nothing loads from third-party origins. */

:root {
  --ink: #17253a;
  --ink-2: #45566d;
  --ink-3: #8796a8;
  --canvas: #f4f7fa;
  --surface: #ffffff;
  --line: #dce3eb;
  --line-strong: #d5dde6;
  --muted-bg: #eef2f6;
  --track: #e6ecf2;
  --teal: #075e58;
  --teal-hover: #04403c;
  --teal-tint: #e3f0ee;
  --teal-on-navy: #5ec4b6;
  --on-navy-2: #b7c3d1;
  --on-navy-1: #d8e0e8;
  --high: #9a3412;
  --high-bg: #fdede3;
  --high-ink: #7c2d12;
  --medium: #7a4e00;
  --medium-bg: #fbf1d9;
  --low: #2f4a6b;
  --low-bg: #e6edf5;
  --ring: 0 1px 2px rgba(23, 37, 58, 0.05), 0 0 0 1px rgba(23, 37, 58, 0.05);
  --lift: 0 4px 12px rgba(23, 37, 58, 0.07), 0 0 0 1px rgba(23, 37, 58, 0.05);
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--canvas); color: var(--ink);
  font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
a { color: var(--teal); }
a:hover { color: var(--teal-hover); }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
a, button { transition: transform 120ms var(--ease-out), background-color 160ms ease, box-shadow 160ms ease; }
a:active, button:active { transform: scale(0.97); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }

/* --- Header and navigation ------------------------------------------------ */
.app-header {
  max-width: 1360px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center;
  gap: 12px 20px; padding: 16px clamp(16px, 2.5vw, 36px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand-name { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brand-name em { font-style: normal; font-weight: 400; color: var(--teal); }
.nav-wrap { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.nav-dock {
  display: flex; gap: 2px; padding: 4px; border-radius: 9999px; background: var(--surface);
  box-shadow: var(--ring); overflow-x: auto; scrollbar-width: none; max-width: 100%;
}
.nav-dock a, .nav-dock span {
  flex-shrink: 0; height: 40px; padding: 0 16px; display: flex; align-items: center; gap: 8px;
  border-radius: 9999px; color: var(--ink-2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav-dock a[aria-current="page"] { background: var(--teal); color: #fff; }
.nav-dock span[aria-disabled="true"] { color: var(--ink-3); }
.header-tools { display: flex; align-items: center; gap: 8px; }
.pill-control {
  height: 44px; padding: 0 14px; border: 0; border-radius: 9999px; background: var(--surface); box-shadow: var(--ring);
  color: var(--ink); font: inherit; font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex-shrink: 0; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; background: var(--ink); color: #fff; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar.sm { width: 36px; height: 36px; font-size: 12.5px; }
.avatar.alt { background: #ecebfd; color: #3f3da8; }
.avatar.pending { background: var(--surface); color: var(--ink-2); border: 1.5px dashed #b4c0cd; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 10; min-width: 260px; padding: 8px; border-radius: 18px;
  background: var(--surface); box-shadow: 0 12px 32px rgba(15, 26, 42, 0.16), 0 0 0 1px rgba(23, 37, 58, 0.06);
}
.menu-panel .who { padding: 10px 12px 12px; border-bottom: 1px solid var(--muted-bg); margin-bottom: 6px; }
.menu-panel .who strong { display: block; font-size: 14.5px; }
.menu-panel a, .menu-panel button {
  width: 100%; min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; text-align: left;
  display: flex; align-items: center; color: var(--ink); font: inherit; font-size: 14px; text-decoration: none; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--canvas); }
.menu-panel .danger { color: var(--high); }

/* --- Page layout ---------------------------------------------------------- */
.page { max-width: 1360px; margin: 0 auto; padding: 12px clamp(16px, 2.5vw, 36px) 56px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 1200px; }
.eyebrow { font-size: 13px; color: var(--ink-2); }
.page-title { margin-top: 4px; font-size: clamp(28px, 3vw, 40px); font-weight: 500; letter-spacing: -0.035em; line-height: 1.1; }
.row { display: flex; flex-wrap: wrap; gap: 20px; align-items: stretch; }
.card { border-radius: 24px; background: var(--surface); box-shadow: var(--ring); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.card.lift { box-shadow: var(--lift); }
.card h2 { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.card.navy { background: var(--ink); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 16px 40px rgba(23, 37, 58, 0.2); }
.card.navy .muted { color: var(--on-navy-1); }
.grow-3 { flex: 3 1 520px; min-width: 0; }
.grow-2 { flex: 2 1 340px; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 20px; }

/* --- Controls ------------------------------------------------------------- */
.btn {
  height: 44px; padding: 0 20px; border: 0; border-radius: 9999px; font: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.lg { height: 52px; padding: 0 26px; font-size: 15.5px; }
.btn.block { width: 100%; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-quiet { background: var(--canvas); color: var(--ink); }
.btn-danger-outline { background: var(--surface); color: var(--high); box-shadow: inset 0 0 0 1px #e8c8b8; }
.btn-danger { background: var(--high); color: #fff; }
.btn-accent { background: var(--teal-on-navy); color: #0f1a2a; }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--line-strong); color: var(--ink-2); box-shadow: none; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 600; }
.input {
  height: 52px; padding: 0 16px; border: 0; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  font: inherit; font-size: 16px; color: var(--ink); width: 100%;
}
.input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--teal), 0 0 0 4px rgba(7, 94, 88, 0.15); }
.input[aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--high); }
.input.code { font-family: var(--mono); font-size: 22px; letter-spacing: 0.3em; text-align: center; }
.help { font-size: 13px; color: var(--ink-2); }
.field-error { font-size: 13px; color: var(--high); }
.alert { display: flex; gap: 10px; padding: 14px 16px; border-radius: 14px; font-size: 14px; }
.alert-error { background: var(--high-bg); color: var(--high-ink); }
.alert-info { background: var(--low-bg); color: #1f3550; }
.alert-success { background: var(--teal-tint); color: #04403c; }
.alert-warn { background: var(--medium-bg); color: #4a3000; }
.chip { height: 26px; padding: 0 10px; border-radius: 9999px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; white-space: nowrap; }
.chip-owner { background: var(--ink); color: #fff; }
.chip-neutral { background: var(--muted-bg); color: var(--ink); }
.chip-teal { background: var(--teal-tint); color: var(--teal); }
.chip-amber { background: var(--medium-bg); color: var(--medium); }
.toast-stack { display: flex; flex-direction: column; gap: 8px; }

/* --- Auth split layout ---------------------------------------------------- */
.auth { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-brand {
  flex: 1 1 420px; min-height: 320px; background: var(--ink); color: #fff; padding: clamp(28px, 5vw, 64px);
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-brand .brand { color: #fff; }
.auth-brand h1 { font-size: clamp(34px, 4vw, 52px); font-weight: 400; letter-spacing: -0.045em; line-height: 1.02; }
.auth-brand h1 span { color: var(--teal-on-navy); }
.auth-brand p { margin-top: 18px; max-width: 460px; font-size: 16.5px; color: var(--on-navy-1); }
.auth-brand ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 14px; color: var(--on-navy-1); }
.auth-brand li::before { content: "✓"; color: var(--teal-on-navy); margin-right: 10px; font-weight: 700; }
.auth-main { flex: 1 1 480px; padding: clamp(28px, 5vw, 64px); display: flex; align-items: center; justify-content: center; }
.auth-panel { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 18px; }
.auth-panel h2 { font-size: 30px; font-weight: 500; letter-spacing: -0.03em; }
.auth-footer { font-size: 12.5px; color: var(--ink-2); }
.auth-footer a { color: var(--ink-2); }
.divider { height: 1px; background: var(--line); }
.qr { display: flex; gap: 16px; align-items: center; }
.qr svg { width: 148px; height: 148px; flex-shrink: 0; border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.codes { margin: 0; padding: 18px; list-style: none; border-radius: 18px; background: var(--canvas);
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; font-family: var(--mono); font-size: 15px; }
.center-state { text-align: center; align-items: center; }
.state-icon { width: 60px; height: 60px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.state-icon.teal { background: var(--teal-tint); color: var(--teal); }
.state-icon.amber { background: var(--medium-bg); color: var(--medium); }
.state-icon.red { background: var(--high-bg); color: var(--high); }

/* --- First run ------------------------------------------------------------ */
.hero h2 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 400; letter-spacing: -0.035em; line-height: 1.1; }
.hero .tag { align-self: flex-start; height: 28px; padding: 0 12px; border-radius: 9999px; background: rgba(94, 196, 182, 0.16); color: var(--teal-on-navy); font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; }
.hero .no-score { width: 168px; height: 168px; border-radius: 50%; border: 12px dashed rgba(255, 255, 255, 0.14); display: flex; align-items: center; justify-content: center; font-size: 44px; font-weight: 300; color: var(--on-navy-2); }
.hero-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.hero-layout > div:first-child { flex: 1 1 280px; display: flex; flex-direction: column; gap: 16px; }
.hero-layout > div:last-child { flex: 0 1 220px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; font-size: 13px; color: var(--on-navy-2); }
.checklist { margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--muted-bg); }
.checklist li:last-child { border-bottom: 0; }
.checklist a { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 14px; flex: 1; }
.step { width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; border: 1.5px solid #b4c0cd; color: var(--ink-2); }
.step.done { background: var(--teal); border-color: var(--teal); color: #fff; }
.step.current { border: 2px solid var(--teal); color: var(--teal); }
.checklist .title { font-size: 15px; font-weight: 500; display: block; }
.checklist .done-title { color: var(--ink-2); text-decoration: line-through; }
.feature-label { font-family: var(--mono); font-size: 12.5px; color: var(--teal); }

/* --- Settings ------------------------------------------------------------- */
.settings { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.settings-nav { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav h1 { margin: 0 0 12px 12px; font-size: 28px; font-weight: 500; letter-spacing: -0.03em; }
.settings-nav a, .settings-nav span { min-height: 44px; padding: 0 14px; border-radius: 12px; color: var(--ink-2); display: flex; align-items: center; font-size: 15px; font-weight: 500; text-decoration: none; }
.settings-nav a[aria-current="page"] { background: var(--surface); box-shadow: var(--ring); color: var(--ink); font-weight: 600; }
.settings-nav span[aria-disabled="true"] { color: var(--ink-3); }
.settings-body { flex: 4 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
.inline-form .field { flex: 1 1 280px; }
.inline-form .input { height: 48px; background: var(--canvas); }
.member-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.member { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 14px; border-radius: 16px; }
.member .who { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; }
.member .who strong { font-size: 15px; font-weight: 500; }
.member .who span { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.member .meta { width: 140px; font-size: 13px; color: var(--ink-2); }
.member .actions { display: flex; gap: 6px; min-width: 150px; justify-content: flex-end; }
.member .actions .btn { height: 40px; padding: 0 14px; font-size: 13.5px; }
.confirm { position: relative; }
.confirm > summary { list-style: none; }
.confirm > summary::-webkit-details-marker { display: none; }
.confirm[open] .confirm-panel { display: flex; }
.confirm-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 5; width: min(360px, 80vw); flex-direction: column; gap: 12px;
  padding: 16px; border-radius: 18px; background: var(--surface); box-shadow: 0 12px 32px rgba(15, 26, 42, 0.16), 0 0 0 1px #ebc9b6; font-size: 14px;
}
.confirm-panel .btns { display: flex; justify-content: flex-end; gap: 8px; }

/* --- Errors --------------------------------------------------------------- */
.error-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; }
.error-page .card { max-width: 460px; }
.big-code { font-size: 72px; font-weight: 300; letter-spacing: -0.06em; line-height: 1; color: #c9d3de; }
