/* Compass Vault design system. One file, no dependencies, no external fonts or images.
   The Portal (wwwroot/css/compass.css) and the Gateway (wwwroot/assets/compass.css) ship IDENTICAL copies; a test enforces it.
   Dark is the default. Light applies when the visitor's system prefers it, or when data-theme="light" is set. data-theme="dark" forces dark.

   Colour roles:  indigo/blue = structure and navigation,  teal = actions and success only,  red/amber = danger/warning.
   Scales:        space 4 8 12 16 24 32 48 64 (--s1..--s8) · radius 8 12 18 (--r1..--r3) · type 12 14 16 18 22 30 40 (--t0..--t6). */

:root {
  color-scheme: dark;
  /* foundation */
  --bg: #070b18;
  --bg-2: #0a1022;
  --surface: #0f1730;
  --surface-2: #141e3d;
  --surface-3: #1a2548;
  --line: rgba(148, 163, 214, .16);
  --line-strong: rgba(148, 163, 214, .30);
  --fg: #eef2ff;
  --fg-2: #c5cdea;
  --muted: #8d99bd;
  /* roles */
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-fg: #021b18;
  --accent-soft: rgba(45, 212, 191, .12);
  --brand: #818cf8;
  --brand-soft: rgba(129, 140, 248, .14);
  --brand-line: rgba(129, 140, 248, .45);
  --danger: #f4525f;
  --danger-hover: #fb7a84;
  --danger-fg: #1d0508;
  --ok: #34d399;
  --warn: #fbbf24;
  --info: #7aa7ff;
  --ok-bg: rgba(52, 211, 153, .10);
  --warn-bg: rgba(251, 191, 36, .10);
  --err-bg: rgba(244, 82, 95, .11);
  --info-bg: rgba(122, 167, 255, .11);
  /* depth */
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015)), var(--surface);
  --card-edge: inset 0 1px 0 rgba(255, 255, 255, .06);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, .35), 0 12px 32px -8px rgba(0, 0, 0, .55);
  --glow: radial-gradient(900px 480px at 88% -8%, rgba(129, 140, 248, .20), transparent 62%),
          radial-gradient(760px 420px at -6% 4%, rgba(59, 130, 246, .14), transparent 60%);
  --brand-grad: linear-gradient(135deg, #6366f1 0%, #3b82f6 55%, #2dd4bf 130%);
  /* scales */
  --s1: .25rem; --s2: .5rem; --s3: .75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4rem;
  --r1: 8px; --r2: 12px; --r3: 18px;
  --t0: .75rem; --t1: .875rem; --t2: 1rem; --t3: 1.125rem; --t4: 1.375rem; --t5: 1.875rem; --t6: 2.5rem;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fc; --bg-2: #eceffa; --surface: #ffffff; --surface-2: #f5f7fd; --surface-3: #eaeefb;
  --line: rgba(40, 56, 110, .13); --line-strong: rgba(40, 56, 110, .26);
  --fg: #0c1330; --fg-2: #2b3560; --muted: #5a668f;
  --accent: #0f766e; --accent-hover: #115e59; --accent-fg: #ffffff; --accent-soft: rgba(15, 118, 110, .10);
  --brand: #4f46e5; --brand-soft: rgba(79, 70, 229, .09); --brand-line: rgba(79, 70, 229, .40);
  --danger: #c4283a; --danger-hover: #a01f2e; --danger-fg: #ffffff;
  --ok: #166534; --warn: #8a5206; --info: #2c5bd6;
  --ok-bg: #e6f6ec; --warn-bg: #fdf3d8; --err-bg: #fdeaec; --info-bg: #e8effd;
  --card-bg: var(--surface);
  --card-edge: inset 0 1px 0 rgba(255, 255, 255, .9);
  --shadow-1: 0 1px 2px rgba(20, 30, 80, .08);
  --shadow-2: 0 1px 2px rgba(20, 30, 80, .06), 0 14px 32px -10px rgba(20, 30, 80, .18);
  --glow: radial-gradient(900px 480px at 88% -8%, rgba(99, 102, 241, .14), transparent 62%),
          radial-gradient(760px 420px at -6% 4%, rgba(59, 130, 246, .10), transparent 60%);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f6fc; --bg-2: #eceffa; --surface: #ffffff; --surface-2: #f5f7fd; --surface-3: #eaeefb;
    --line: rgba(40, 56, 110, .13); --line-strong: rgba(40, 56, 110, .26);
    --fg: #0c1330; --fg-2: #2b3560; --muted: #5a668f;
    --accent: #0f766e; --accent-hover: #115e59; --accent-fg: #ffffff; --accent-soft: rgba(15, 118, 110, .10);
    --brand: #4f46e5; --brand-soft: rgba(79, 70, 229, .09); --brand-line: rgba(79, 70, 229, .40);
    --danger: #c4283a; --danger-hover: #a01f2e; --danger-fg: #ffffff;
    --ok: #166534; --warn: #8a5206; --info: #2c5bd6;
    --ok-bg: #e6f6ec; --warn-bg: #fdf3d8; --err-bg: #fdeaec; --info-bg: #e8effd;
    --card-bg: var(--surface);
    --card-edge: inset 0 1px 0 rgba(255, 255, 255, .9);
    --shadow-1: 0 1px 2px rgba(20, 30, 80, .08);
    --shadow-2: 0 1px 2px rgba(20, 30, 80, .06), 0 14px 32px -10px rgba(20, 30, 80, .18);
    --glow: radial-gradient(900px 480px at 88% -8%, rgba(99, 102, 241, .14), transparent 62%),
            radial-gradient(760px 420px at -6% 4%, rgba(59, 130, 246, .10), transparent 60%);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--t2)/1.6 var(--sans); background: var(--glow), var(--bg); background-attachment: fixed; color: var(--fg); min-height: 100vh; -webkit-font-smoothing: antialiased; }
h1 { font-size: var(--t5); line-height: 1.15; margin: 0 0 var(--s2); letter-spacing: -.025em; font-weight: 750; }
h2 { font-size: var(--t3); margin: 0 0 var(--s3); letter-spacing: -.01em; font-weight: 650; }
h3 { font-size: var(--t2); margin: 0 0 var(--s2); font-weight: 650; }
p { margin: 0 0 var(--s3); }
a { color: var(--accent); text-underline-offset: .18em; }
a:hover { color: var(--accent-hover); }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .05rem .35rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: .5rem; background: var(--accent); color: var(--accent-fg); padding: .5rem 1rem; border-radius: var(--r1); z-index: 100; font-weight: 600; }
.skip:focus { left: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: var(--s4); }
.eyebrow { font-size: var(--t0); font-weight: 650; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); margin: 0 0 var(--s2); }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 700; font-size: var(--t3); color: var(--fg); text-decoration: none; letter-spacing: -.015em; line-height: 1.1; }
.brand:hover { color: var(--fg); }
.brand-tile { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 11px; background: var(--brand-grad); color: #fff; box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .8), inset 0 1px 0 rgba(255, 255, 255, .35); flex: none; }
.brand-tile .brand-mark { width: 1.45rem; height: 1.45rem; color: #fff; }
.brand-mark { width: 1.9rem; height: 1.9rem; color: var(--accent); }
.brand small { display: block; font-weight: 600; font-size: .66rem; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; margin-top: .25rem; }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 17rem 1fr; min-height: 100vh; }
.sidebar { background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 40%), var(--bg-2); border-right: 1px solid var(--line); padding: var(--s5) var(--s4); display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 0 var(--s2); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: var(--t0); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: var(--s2) var(--s3); font-weight: 650; }
.nav-link { position: relative; display: flex; align-items: center; gap: .75rem; padding: .6rem var(--s3); border-radius: 10px; color: var(--fg-2); text-decoration: none; background: none; border: 0; font: inherit; font-size: .95rem; font-weight: 550; cursor: pointer; width: 100%; text-align: left; white-space: nowrap; }
.nav-link .icon { width: 1.25em; height: 1.25em; color: var(--muted); }
.nav-link:hover { background: var(--brand-soft); color: var(--fg); }
.nav-link:hover .icon { color: var(--brand); }
.nav-link[aria-current="page"] { background: var(--brand-soft); color: var(--fg); box-shadow: inset 0 0 0 1px var(--brand-line); }
.nav-link[aria-current="page"] .icon { color: var(--brand); }
.nav-cta { margin: 0 var(--s1); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); }
.who { display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r2); background: var(--surface); font-size: var(--t1); color: var(--fg-2); word-break: break-word; line-height: 1.3; }
.avatar { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; flex: none; border: 1px solid var(--brand-line); }
.content { min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: 72rem; margin: 0 auto; padding: var(--s6) var(--s6) var(--s7); flex: 1; }
.page:focus { outline: none; }
.page.narrow { max-width: 46rem; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.page-header h1 { margin: 0; }
.page-header p { color: var(--muted); margin: var(--s1) 0 0; max-width: 40rem; }
.foot { text-align: center; color: var(--muted); font-size: var(--t1); padding: var(--s4) var(--s5) var(--s5); }

.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 80%, transparent); backdrop-filter: blur(8px); }
.stage { min-height: 100vh; display: flex; flex-direction: column; }

@media (max-width: 56rem) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4); border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; order: 3; gap: var(--s1); }
  .nav-label, .nav-cta { display: none; }
  .nav-link { width: auto; padding: .45rem .7rem; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .who { border: 0; background: none; padding: 0 var(--s1); }
  .who .name { display: none; }
  .page { padding: var(--s5) var(--s4) var(--s6); }
  h1 { font-size: 1.6rem; }
}

/* ---------- surfaces ---------- */
.card { background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r3); padding: var(--s5); box-shadow: var(--shadow-2), var(--card-edge); }
.card.tight { padding: var(--s4); }
.card + .card { margin-top: var(--s4); }
.card-title { display: flex; align-items: center; gap: var(--s2); font-weight: 650; margin-bottom: var(--s3); }
.card-title .icon { color: var(--brand); }
.grid { display: grid; gap: var(--s4); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.dash { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
@media (max-width: 70rem) { .dash { grid-template-columns: 1fr; } }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.section-head h2 { margin: 0; }
.section-head a { font-size: var(--t1); font-weight: 600; }
.section-title { margin: var(--s6) 0 var(--s3); }

/* compact summary cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: var(--s3); }
.stat { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r2); box-shadow: var(--shadow-1), var(--card-edge); }
.stat .chip { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand); flex: none; }
.stat .chip.ok { background: var(--ok-bg); color: var(--ok); }
.stat .chip.muted { background: var(--surface-3); color: var(--muted); }
.stat .num { font-size: var(--t4); font-weight: 750; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: var(--t0); margin-top: .2rem; font-weight: 550; }

/* type tiles: the three things you can share */
.tiles { display: grid; gap: var(--s3); }
.tile { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r2); border: 1px solid var(--line); background: var(--card-bg); text-decoration: none; color: var(--fg); box-shadow: var(--shadow-1), var(--card-edge); transition: border-color .15s, transform .15s, background .15s; }
.tile:hover { border-color: var(--brand-line); transform: translateY(-1px); color: var(--fg); background: var(--surface-2); }
.tile .chip { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; background: var(--accent-soft); color: var(--accent); flex: none; }
.tile strong { display: block; font-weight: 650; line-height: 1.25; }
.tile .d { color: var(--muted); font-size: var(--t1); line-height: 1.3; }
.tile .go { margin-left: auto; color: var(--muted); }
.tiles.row3 { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }

/* recent list */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: var(--s3); padding: .85rem var(--s4); border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .kicon { display: inline-grid; place-items: center; width: 2.2rem; height: 2.2rem; border-radius: 10px; background: var(--surface-3); color: var(--fg-2); flex: none; }
.list .main { min-width: 0; flex: 1; }
.list .t { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { color: var(--muted); font-size: var(--t1); }
.card.flush { padding: 0; overflow: hidden; }

.hero { text-align: center; padding: var(--s7) var(--s4) var(--s5); }
.hero .brand-tile { width: 4.2rem; height: 4.2rem; border-radius: 20px; margin-bottom: var(--s4); }
.hero .brand-tile .brand-mark { width: 2.6rem; height: 2.6rem; }
.hero h1 { font-size: var(--t6); letter-spacing: -.035em; }
.hero p { color: var(--muted); max-width: 34rem; margin-inline: auto; font-size: var(--t3); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); background: var(--accent); color: var(--accent-fg); border: 1px solid transparent; border-radius: 10px; padding: .62rem 1.1rem; font: inherit; font-size: .95rem; font-weight: 650; text-decoration: none; cursor: pointer; line-height: 1.2; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, var(--shadow-1); transition: background .12s, transform .12s; white-space: nowrap; }
.btn:hover { background: var(--accent-hover); color: var(--accent-fg); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface-2); color: var(--fg); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn.secondary:hover { background: var(--surface-3); color: var(--fg); }
.btn.danger { background: var(--danger); color: var(--danger-fg); }
.btn.danger:hover { background: var(--danger-hover); color: var(--danger-fg); }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: none; padding-inline: var(--s2); }
.btn.ghost:hover { background: var(--accent-soft); color: var(--accent-hover); }
.btn.small { padding: .38rem .75rem; font-size: var(--t1); border-radius: var(--r1); }
.btn.large { padding: .8rem 1.4rem; font-size: 1.02rem; border-radius: 12px; }
.btn:disabled, .btn[aria-busy="true"] { opacity: .55; cursor: progress; box-shadow: none; }
.btn.block { width: 100%; }
form.inline { display: inline; margin: 0; }

/* ---------- forms ---------- */
.field { margin: 0 0 var(--s5); }
label, .label { display: block; font-weight: 600; margin-bottom: var(--s1); font-size: .95rem; }
.help { margin: 0 0 var(--s2); color: var(--muted); font-size: var(--t1); line-height: 1.45; }
.input, input[type=text], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--fg); background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: .65rem .8rem; transition: border-color .12s, box-shadow .12s; }
input[type=number] { max-width: 8rem; }
textarea, .mono-input { font-family: var(--mono); font-size: .92rem; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
input:hover, textarea:hover, select:hover { border-color: var(--brand-line); }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; }
.check { display: flex; align-items: center; gap: var(--s2); font-weight: 500; margin: 0; }
.check-row { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 var(--s5); }
/* Create form: the two controls sit on one row, each with its own help directly beneath, and the opt-in is its own quiet row. */
.rules-grid > .field { margin-bottom: var(--s4); }
.rules-grid .help { margin: var(--s2) 0 0; }
.opt-in { margin: var(--s2) 0 0; padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.opt-in .help { margin: var(--s1) 0 0 calc(1.05rem + var(--s2)); }

.form-section { padding: var(--s5) 0; border-top: 1px solid var(--line); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section > h2 { display: flex; align-items: center; gap: var(--s2); font-size: var(--t2); margin-bottom: var(--s4); }
.form-section > h2 .step { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: var(--t0); font-weight: 750; border: 1px solid var(--brand-line); }
.form-actions { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; padding-top: var(--s5); border-top: 1px solid var(--line); }
.form-actions .note { color: var(--muted); font-size: var(--t1); display: flex; align-items: center; gap: var(--s2); }

/* choice pills: radios drawn as segmented buttons */
.pills { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pill { position: relative; margin: 0; }
.pill input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.pill span { display: inline-flex; align-items: center; padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--fg-2); font-weight: 600; font-size: .92rem; }
.pill input:hover + span { border-color: var(--brand-line); }
.pill input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--fg); box-shadow: 0 0 0 1px var(--brand) inset; }
.pill input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }

/* type tabs (Text / File / Link) */
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: var(--s4); }
.segmented a, .segmented button { display: flex; align-items: center; justify-content: center; gap: var(--s2); padding: .7rem var(--s3); border-radius: 10px; color: var(--muted); text-decoration: none; font: inherit; font-weight: 650; background: none; border: 0; cursor: pointer; text-align: center; }
.segmented a:hover, .segmented button:hover { color: var(--fg); background: var(--surface-2); }
.segmented [aria-current="page"], .segmented [aria-pressed="true"] { background: var(--card-bg); color: var(--fg); box-shadow: var(--shadow-1), 0 0 0 1px var(--brand-line), var(--card-edge); }
.segmented [aria-current="page"] .icon { color: var(--accent); }
@media (max-width: 34rem) { .segmented a span.lbl-long { display: none; } .segmented a { padding-inline: var(--s2); } }

.copybox { display: flex; gap: var(--s2); align-items: stretch; }
.copybox input { flex: 1; min-width: 0; font-family: var(--mono); font-size: .88rem; }

/* ---------- messages ---------- */
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border-radius: var(--r2); border: 1px solid var(--line); background: var(--surface-2); margin-bottom: var(--s4); }
.alert .icon { margin-top: .22rem; flex: none; }
.alert p { margin: 0; }
.alert p + p { margin-top: var(--s2); }
.alert.info { background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.alert.success { background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.alert.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.alert.error { background: var(--err-bg); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.alert.info .icon { color: var(--info); } .alert.success .icon { color: var(--ok); }
.alert.warn .icon { color: var(--warn); } .alert.error .icon { color: var(--danger); }
.alert ul { margin: var(--s1) 0 0 1.1rem; padding: 0; }
.status { color: var(--muted); font-size: var(--t1); }

/* state panel: expired / consumed / revoked / locked / empty / success */
.state { text-align: center; padding: var(--s6) var(--s5); }
.state .state-icon { display: inline-grid; place-items: center; width: 4rem; height: 4rem; border-radius: 50%; background: var(--surface-3); color: var(--muted); margin-bottom: var(--s4); box-shadow: 0 0 0 8px color-mix(in srgb, var(--surface-3) 45%, transparent); }
.state .state-icon .icon { width: 1.7rem; height: 1.7rem; }
.state[data-state="revoked"] .state-icon, .state[data-state="locked"] .state-icon, .state[data-state="error"] .state-icon { color: var(--danger); background: var(--err-bg); box-shadow: 0 0 0 8px color-mix(in srgb, var(--danger) 8%, transparent); }
.state[data-state="expired"] .state-icon { color: var(--warn); background: var(--warn-bg); box-shadow: 0 0 0 8px color-mix(in srgb, var(--warn) 8%, transparent); }
.state[data-state="consumed"] .state-icon { color: var(--info); background: var(--info-bg); box-shadow: 0 0 0 8px color-mix(in srgb, var(--info) 8%, transparent); }
.state[data-state="ok"] .state-icon { color: var(--ok); background: var(--ok-bg); box-shadow: 0 0 0 8px color-mix(in srgb, var(--ok) 8%, transparent); }
.state[data-state="empty"] .state-icon { color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand) 6%, transparent); }
.state h1, .state h2 { margin-bottom: var(--s2); }
.state p { color: var(--muted); max-width: 30rem; margin-inline: auto; }
.empty { border-style: dashed; border-color: var(--line-strong); box-shadow: none; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .4rem; font-size: var(--t0); font-weight: 700; letter-spacing: .02em; padding: .18rem .65rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.badge-active { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.badge-revoked, .badge-locked { color: var(--danger); background: var(--err-bg); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.badge-expired { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge-consumed { color: var(--info); background: var(--info-bg); border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.kind { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: var(--t0); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- toolbar: search and filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; margin-bottom: var(--s4); }
.search { position: relative; flex: 1 1 14rem; max-width: 22rem; }
.search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 2.4rem; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-btn { font: inherit; font-size: var(--t1); font-weight: 600; padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--fg-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--brand-line); color: var(--fg); }
.chip-btn[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand); color: var(--fg); }
.no-match { text-align: center; padding: var(--s5); color: var(--muted); }

/* ---------- share list (responsive rows) ---------- */
.shares { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.share { display: grid; grid-template-columns: minmax(0, 2fr) 6.75rem 10rem 10rem 4.5rem 12.5rem; gap: var(--s2) var(--s4); align-items: center; background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s3) var(--s4); box-shadow: var(--shadow-1), var(--card-edge); }
.share:hover { border-color: var(--line-strong); }
.share-head { display: contents; }
.share-label { font-weight: 650; word-break: break-word; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.share-facts { display: contents; }
.share-facts div { min-width: 0; }
.share-facts dt { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.share-facts dd { margin: 0; font-size: var(--t1); font-variant-numeric: tabular-nums; }
.share-actions { display: flex; gap: var(--s2); justify-content: flex-end; }
@media (max-width: 78rem) {
  .share { grid-template-columns: 1fr auto; }
  .share-facts { display: grid; grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: var(--s2) var(--s4); }
  .share-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- activity timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 var(--s4); border-left: 2px solid var(--line); display: grid; gap: var(--s4); }
.timeline li { position: relative; }
.timeline li::before { content: ""; position: absolute; left: -1.5rem; top: .5rem; width: .7rem; height: .7rem; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--surface); }
.timeline li[data-tone="bad"]::before { background: var(--danger); }
.timeline li[data-tone="warn"]::before { background: var(--warn); }
.timeline li[data-tone="neutral"]::before { background: var(--line-strong); }
.timeline time { color: var(--muted); font-size: var(--t1); display: block; font-variant-numeric: tabular-nums; }

/* ---------- dialog ---------- */
dialog { background: var(--card-bg); color: var(--fg); border: 1px solid var(--line-strong); border-radius: var(--r3); max-width: 28rem; width: calc(100% - 2rem); padding: var(--s5); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .7), var(--card-edge); }
dialog::backdrop { background: rgba(4, 7, 18, .72); backdrop-filter: blur(3px); }
dialog h2 { font-size: var(--t4); }
.dialog-actions { display: flex; gap: var(--s3); justify-content: flex-end; margin: var(--s5) 0 0; }

/* ---------- secret display ---------- */
.secret-box { background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--r2); padding: var(--s4); white-space: pre-wrap; word-break: break-word; font-family: var(--mono); margin: 0 0 var(--s4); max-height: 22rem; overflow: auto; font-size: .95rem; line-height: 1.55; }

/* ---------- password generator ---------- */
.generator { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s4); margin: 0 0 var(--s5); }
.gen-output { display: flex; gap: var(--s2); align-items: stretch; margin-bottom: var(--s4); }
.gen-output input { flex: 1; min-width: 0; font-size: 1.05rem; letter-spacing: .02em; }
.len-row { display: flex; align-items: center; gap: var(--s3); }
.len-row output { min-width: 2.5rem; text-align: right; font-weight: 700; }

/* ---------- file drop zone ---------- */
.dropzone { position: relative; border: 2px dashed var(--line-strong); border-radius: var(--r3); background: var(--bg-2); padding: var(--s6) var(--s4); text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--fg); }
.dropzone:focus-within { outline: 3px solid var(--brand); outline-offset: 2px; }
.dropzone .dz-icon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; background: var(--brand-soft); color: var(--brand); margin-bottom: var(--s3); }
.dropzone .dz-icon .icon { width: 1.5rem; height: 1.5rem; }
.dropzone p { margin: 0 0 var(--s1); }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-chosen { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s3); padding: var(--s3) var(--s4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r2); word-break: break-all; }
progress { width: 100%; height: .6rem; accent-color: var(--accent); }

/* ---------- QR ---------- */
.qr-wrap { display: inline-block; background: #fff; padding: var(--s3); border-radius: var(--r2); line-height: 0; box-shadow: var(--shadow-2); }
.qr-wrap svg { width: 14rem; height: 14rem; display: block; }

/* ---------- facts ---------- */
.facts { list-style: none; margin: 0 0 var(--s4); padding: 0; display: grid; gap: var(--s2); color: var(--fg-2); }
.facts li { display: flex; gap: var(--s2); align-items: flex-start; }
.facts .icon { margin-top: .25rem; color: var(--brand); }

.theme-toggle { background: var(--surface); border: 1px solid var(--line-strong); color: var(--fg-2); border-radius: var(--r1); padding: .45rem .7rem; cursor: pointer; display: inline-flex; align-items: center; gap: var(--s2); font: inherit; font-size: var(--t1); font-weight: 550; white-space: nowrap; }
.theme-toggle:hover { color: var(--fg); border-color: var(--brand-line); }

/* ---------- public (recipient) pages ---------- */
.public-hero { text-align: center; padding: var(--s6) 0 var(--s5); }
.public-hero h1 { font-size: var(--t6); letter-spacing: -.035em; margin-bottom: var(--s3); }
.public-hero p { color: var(--muted); font-size: var(--t3); max-width: 32rem; margin-inline: auto; }
.trust { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s4); list-style: none; margin: var(--s5) 0 0; padding: 0; color: var(--muted); font-size: var(--t1); }
.trust li { display: inline-flex; align-items: center; gap: var(--s2); }
.trust .icon { color: var(--accent); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s3); list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r2); padding: var(--s4); box-shadow: var(--shadow-1), var(--card-edge); }
.steps li::before { content: counter(s); display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 750; font-size: var(--t1); margin-bottom: var(--s3); border: 1px solid var(--brand-line); }
.steps strong { display: block; margin-bottom: var(--s1); }
.steps span { color: var(--muted); font-size: var(--t1); line-height: 1.45; display: block; }
.file-card { display: flex; align-items: center; gap: var(--s4); padding: var(--s4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r2); margin-bottom: var(--s4); }
.file-card .kicon { display: inline-grid; place-items: center; width: 3rem; height: 3rem; border-radius: 12px; background: var(--brand-soft); color: var(--brand); flex: none; }
.file-card .kicon .icon { width: 1.5rem; height: 1.5rem; }
.file-card .nm { font-weight: 650; word-break: break-all; line-height: 1.3; }

.nav-link, .theme-toggle, .btn { white-space: nowrap; }
.inline-label { display: inline; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 650; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.mt { margin-top: var(--s4); }
.state p strong, .help strong { color: var(--fg); }
.generator .check-row { margin-bottom: var(--s4); }
.share-actions { white-space: nowrap; }

/* ---------- refinements ---------- */
/* Buttons are flat at rest; a soft glow appears only on hover and keyboard focus. */
.btn:hover, .btn:focus-visible { box-shadow: 0 1px 0 rgba(255, 255, 255, .22) inset, 0 6px 18px -6px var(--accent); }
.btn.secondary:hover, .btn.secondary:focus-visible { box-shadow: var(--shadow-1), 0 0 0 3px var(--brand-soft); }
.btn.danger:hover, .btn.danger:focus-visible { box-shadow: 0 6px 18px -6px var(--danger); }
.btn.ghost:hover, .btn.ghost:focus-visible { box-shadow: none; }
.btn:disabled:hover, .btn[aria-busy="true"]:hover { box-shadow: none; }
.btn:disabled, .btn[aria-busy="true"] { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
a:not(.btn):not(.nav-link):not(.tile):not(.brand), .btn.ghost, .inline-label { color: var(--accent); }

/* Create form: wider, with the generator attached to the secret field */
.page.form { max-width: 54rem; }
.generator { border-left: 3px solid var(--brand); margin-top: calc(-1 * var(--s2)); }
.gen-output { flex-wrap: wrap; }
.gen-output input { flex: 1 1 12rem; }
@media (max-width: 34rem) { .gen-output .btn { flex: 1 1 auto; } .check-row { gap: var(--s2) var(--s4); } }

/* Recipient reveal */
.reveal { border-color: var(--brand-line); box-shadow: var(--shadow-2), 0 0 0 4px var(--brand-soft); }
.reveal .secret-box { border-left: 4px solid var(--accent); overflow-wrap: anywhere; word-break: break-all; }
.reveal-actions { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.reveal-actions .status { flex-basis: 100%; }
.public-note { text-align: center; color: var(--muted); max-width: 30rem; margin: var(--s5) auto 0; font-size: var(--t1); }
.compact-info { display: grid; gap: var(--s3); }
.compact-info .row { align-items: flex-start; flex-wrap: nowrap; }
.compact-info .icon { margin-top: .25rem; color: var(--brand); }
.compact-info p { margin: 0; color: var(--fg-2); }
time[title] { cursor: help; text-decoration: underline dotted var(--line-strong); text-underline-offset: .25em; }
.reveal h1 { margin-bottom: var(--s3); }
.share-facts time { white-space: nowrap; }
