/* Self-hosted fonts — no CDN, matching the vendored-HTMX policy. Weights
   mirror theme.json: Playfair Display 600 for headings, Inter 400/500/600
   for body/UI. TTFs copied from mobile/assets/fonts/. */
@font-face { font-family: 'Playfair Display'; src: url('../fonts/PlayfairDisplay-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Regular.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Medium.ttf') format('truetype'); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-SemiBold.ttf') format('truetype'); font-weight: 600; font-style: normal; font-display: swap; }

/* =========================================================================
   BRAG Book web — light and dark, built on the tokens in theme.css.

   theme.css emits two token sets, --light-* and --dark-*; the dark set only
   exists under prefers-color-scheme: dark or [data-theme='dark']. Nothing
   below reads either set directly. Instead the semantic aliases in :root
   point at the light set and are re-pointed at the dark set in the two
   dark blocks, so every rule is written once. That is the whole theming
   mechanism — add a colour here, never inline.

   Same product as the phone and the admin: Playfair for headings (never
   below 18px), Inter for everything else; navy on cream; gold reserved for
   "current" (focus, the active nav link, the selected segment), never for
   a negative state. Controls are 44px at --radii-md. Flat: no shadows.

   Mobile-first: one column, the "BRAG It!" action pinned bottom-right as
   the phone's FAB is, then a reading measure on wider screens.
   ========================================================================= */

:root {
  --c-primary: var(--light-primary-base);
  --c-primary-hover: var(--light-primary-hover);
  --c-primary-subtle: var(--light-primary-subtle);
  --c-on-primary: var(--light-primary-on-primary);
  --c-gold: var(--light-accent-gold);
  --c-gold-soft: var(--light-accent-gold-soft);
  --c-gold-muted: var(--light-accent-gold-muted);
  --c-on-gold: var(--light-accent-on-gold);
  --c-achieve: var(--light-semantic-achieve);
  --c-achieve-soft: var(--light-semantic-achieve-soft);
  --c-reflect: var(--light-semantic-reflect);
  --c-reflect-soft: var(--light-semantic-reflect-soft);
  --c-danger: var(--light-semantic-danger);
  --c-warning: var(--light-semantic-warning);
  --c-bg: var(--light-surface-background);
  --c-card: var(--light-surface-card);
  --c-raised: var(--light-surface-raised);
  --c-inset: var(--light-surface-inset);
  --c-text: var(--light-text-primary);
  --c-text-2: var(--light-text-secondary);
  --c-text-3: var(--light-text-tertiary);
  --c-link: var(--light-text-link);
  --c-border: var(--light-border-default);
  --c-border-subtle: var(--light-border-subtle);
  --c-focus: var(--light-border-focus);

  --t-h1-size: 28px;      --t-h1-lh: 34px;
  --t-h2-size: 22px;      --t-h2-lh: 28px;
  --t-h3-size: 18px;      --t-h3-lh: 24px;
  --t-body-size: 15px;    --t-body-lh: 23px;
  --t-dense-size: 14px;   --t-dense-lh: 20px;
  --t-caption-size: 13px; --t-caption-lh: 18px;

  --container: 720px;
  --gutter: var(--spacing-lg);
  --measure-auth: 448px;
  --control-pad-y: 10px;
  --control-pad-x: 14px;
  --control-lh: 22px;
  --focus-ring: 0 0 0 3px var(--c-gold-muted);
  --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --c-primary: var(--dark-primary-base);
    --c-primary-hover: var(--dark-primary-hover);
    --c-primary-subtle: var(--dark-primary-subtle);
    --c-on-primary: var(--dark-primary-on-primary);
    --c-gold: var(--dark-accent-gold);
    --c-gold-soft: var(--dark-accent-gold-soft);
    --c-gold-muted: var(--dark-accent-gold-muted);
    --c-on-gold: var(--dark-accent-on-gold);
    --c-achieve: var(--dark-semantic-achieve);
    --c-achieve-soft: var(--dark-semantic-achieve-soft);
    --c-reflect: var(--dark-semantic-reflect);
    --c-reflect-soft: var(--dark-semantic-reflect-soft);
    --c-danger: var(--dark-semantic-danger);
    --c-warning: var(--dark-semantic-warning);
    --c-bg: var(--dark-surface-background);
    --c-card: var(--dark-surface-card);
    --c-raised: var(--dark-surface-raised);
    --c-inset: var(--dark-surface-inset);
    --c-text: var(--dark-text-primary);
    --c-text-2: var(--dark-text-secondary);
    --c-text-3: var(--dark-text-tertiary);
    --c-link: var(--dark-text-link);
    --c-border: var(--dark-border-default);
    --c-border-subtle: var(--dark-border-subtle);
    --c-focus: var(--dark-border-focus);
  }
}
:root[data-theme='dark'] {
  --c-primary: var(--dark-primary-base);
  --c-primary-hover: var(--dark-primary-hover);
  --c-primary-subtle: var(--dark-primary-subtle);
  --c-on-primary: var(--dark-primary-on-primary);
  --c-gold: var(--dark-accent-gold);
  --c-gold-soft: var(--dark-accent-gold-soft);
  --c-gold-muted: var(--dark-accent-gold-muted);
  --c-on-gold: var(--dark-accent-on-gold);
  --c-achieve: var(--dark-semantic-achieve);
  --c-achieve-soft: var(--dark-semantic-achieve-soft);
  --c-reflect: var(--dark-semantic-reflect);
  --c-reflect-soft: var(--dark-semantic-reflect-soft);
  --c-danger: var(--dark-semantic-danger);
  --c-warning: var(--dark-semantic-warning);
  --c-bg: var(--dark-surface-background);
  --c-card: var(--dark-surface-card);
  --c-raised: var(--dark-surface-raised);
  --c-inset: var(--dark-surface-inset);
  --c-text: var(--dark-text-primary);
  --c-text-2: var(--dark-text-secondary);
  --c-text-3: var(--dark-text-tertiary);
  --c-link: var(--dark-text-link);
  --c-border: var(--dark-border-default);
  --c-border-subtle: var(--dark-border-subtle);
  --c-focus: var(--dark-border-focus);
}

/* --- Base ----------------------------------------------------------------- */

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  background-color: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  min-height: 100dvh;
}

a { color: var(--c-link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
strong { font-weight: 600; }
code { font-family: var(--font-mono); font-size: 0.92em; background-color: var(--c-inset); padding: 1px 6px; border-radius: var(--radii-sm); }
img { max-width: 100%; }

a:focus-visible, button:focus-visible, summary:focus-visible, select:focus-visible, label:focus-within > input[type="file"] {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Header --------------------------------------------------------------- */

/* Scoped to the page header: the event panel has a <header> of its own. */
body > header {
  background-color: var(--c-primary);
  position: sticky; top: 0; z-index: 10;
  padding-top: env(safe-area-inset-top);
}

body > header nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--spacing-md);
}

body > header .logo {
  display: inline-flex; align-items: center; gap: var(--spacing-sm);
  font-family: var(--font-heading);
  font-size: 20px; line-height: 24px; font-weight: 600; letter-spacing: -0.2px;
  color: var(--c-on-primary);
  text-decoration: none; white-space: nowrap;
}
body > header .logo-mark { height: 36px; width: auto; display: block; }

.nav-links { display: flex; align-items: stretch; gap: 2px; height: var(--header-h); }

body > header .nav-link {
  display: inline-flex; align-items: center;
  padding: 2px 8px 0;
  font-size: var(--t-dense-size); font-weight: 500;
  color: var(--c-on-primary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
body > header .nav-link:hover { color: var(--c-gold-soft); }
body > header .nav-link.active { border-bottom-color: var(--c-gold); }

/* The live-connection dot. Gold while connecting (the "current" colour,
   because something is in progress), green when live, danger-outlined
   when reconnecting. Words are in the title and the sr-only text. */
.conn { display: inline-flex; align-items: center; padding: 0 6px 0 10px; }
.conn-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-gold); border: 1.5px solid transparent; transition: background 0.3s; }
.conn[data-state='live'] .conn-dot { background: var(--c-achieve); }
.conn[data-state='reconnecting'] .conn-dot { background: transparent; border-color: var(--c-danger); }
.conn[data-state='connecting'] .conn-dot { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

@media (max-width: 480px) {
  body > header .logo span { display: none; }
  body > header .nav-link { padding: 2px 6px 0; font-size: var(--t-caption-size); }
}

/* --- Page ----------------------------------------------------------------- */

main {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--spacing-xl) var(--gutter) calc(var(--spacing-4xl) + 72px);
}

main h1 { font-family: var(--font-heading); font-size: var(--t-h1-size); line-height: var(--t-h1-lh); font-weight: 600; letter-spacing: -0.3px; color: var(--c-primary); margin-bottom: var(--spacing-xs); }
main h2 { font-family: var(--font-heading); font-size: var(--t-h2-size); line-height: var(--t-h2-lh); font-weight: 600; letter-spacing: -0.2px; color: var(--c-primary); margin: var(--spacing-2xl) 0 var(--spacing-md); }
main h3 { font-family: var(--font-heading); font-size: var(--t-h3-size); line-height: var(--t-h3-lh); font-weight: 600; color: var(--c-primary); margin: 0 0 var(--spacing-sm); }

.subtle { color: var(--c-text-2); }
.lede { color: var(--c-text-2); max-width: 60ch; margin: 0 0 var(--spacing-lg); }
.lede strong { color: var(--c-text); }
.hint { display: block; font-size: var(--t-caption-size); line-height: var(--t-caption-lh); color: var(--c-text-2); margin-top: 6px; }
.meta { font-size: var(--t-dense-size); line-height: var(--t-dense-lh); color: var(--c-text-2); margin: 0 0 var(--spacing-lg); }
.meta strong { color: var(--c-text); }
.back { margin-bottom: var(--spacing-md); font-size: var(--t-dense-size); }
.back a { text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.back a:hover { text-decoration: underline; }

/* --- Flashes and notices -------------------------------------------------- */

.flash, .notice {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radii-md);
  border-left: 3px solid var(--c-gold);
  background-color: var(--c-inset);
  margin: 0 0 var(--spacing-lg);
}
.flash-success { background-color: var(--c-achieve-soft); border-left-color: var(--c-achieve); color: var(--c-achieve); }
.flash-error, .notice-danger { border-left-color: var(--c-danger); color: var(--c-danger); }
.notice p + form, .notice form { margin-top: var(--spacing-sm); }
.notice-danger p { color: var(--c-text); }

.empty-state { padding: var(--spacing-xl) var(--spacing-lg); background-color: var(--c-inset); border-radius: var(--radii-md); color: var(--c-text-2); text-align: center; }
.empty-state h2 { margin-top: 0; }
.empty-state p + p { margin-top: var(--spacing-sm); }
.empty-timeline { margin-top: var(--spacing-2xl); }

.progress { display: flex; align-items: center; gap: var(--spacing-sm); color: var(--c-text-2); margin: var(--spacing-lg) 0; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--c-border); border-top-color: var(--c-primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Buttons -------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-sm);
  padding: var(--control-pad-y) 20px;
  border: 1.5px solid transparent; border-radius: var(--radii-md);
  font-family: var(--font-body); font-size: var(--t-body-size); line-height: var(--control-lh); font-weight: 500; letter-spacing: 0.2px;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  background: none; color: inherit;
}
.btn-primary { background-color: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.btn-primary:hover { background-color: var(--c-primary-hover); border-color: var(--c-primary-hover); }
.btn-secondary { background-color: var(--c-raised); border-color: var(--c-primary); color: var(--c-primary); }
.btn-secondary:hover { background-color: var(--c-gold-muted); }
.btn-danger { background-color: var(--c-raised); border-color: var(--c-danger); color: var(--c-danger); }
.btn-danger:hover { background-color: var(--c-danger); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-block { display: flex; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: var(--t-dense-size); line-height: var(--t-dense-lh); border-radius: var(--radii-sm); }

.btn-link {
  background: none; border: none; padding: 0;
  font-family: var(--font-body); font-size: var(--t-dense-size); line-height: var(--t-dense-lh); font-weight: 500;
  color: var(--c-link); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--c-danger); }

.actions { display: flex; justify-content: flex-end; align-items: center; gap: var(--spacing-md); margin-top: var(--spacing-lg); flex-wrap: wrap; }
.actions-left { justify-content: flex-start; }
.row-actions { display: flex; gap: var(--spacing-lg); margin-top: var(--spacing-md); flex-wrap: wrap; }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--spacing-md); align-items: center; }

/* The phone's FAB. Pinned so it is one thumb away on every page. */
.fab {
  position: fixed; right: max(var(--spacing-lg), env(safe-area-inset-right)); bottom: max(var(--spacing-lg), env(safe-area-inset-bottom));
  z-index: 9;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 20px 14px 16px;
  background: var(--c-gold); color: var(--c-on-gold);
  border-radius: 999px; text-decoration: none; font-weight: 600;
  border: 1.5px solid var(--c-gold);
}
.fab:hover { background: var(--c-gold-soft); }
.fab-plus { font-size: 22px; line-height: 1; }

/* --- Forms ---------------------------------------------------------------- */

.field { display: flex; flex-direction: column; margin-bottom: var(--spacing-lg); }
.field > label { font-size: var(--t-body-size); line-height: var(--t-body-lh); font-weight: 500; color: var(--c-text); margin-bottom: 6px; }

.field input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), .field select, .field textarea, .input {
  width: 100%;
  padding: var(--control-pad-y) var(--control-pad-x);
  border: 1px solid var(--c-border); border-radius: var(--radii-md);
  font-family: var(--font-body); font-size: 16px; line-height: var(--control-lh);
  color: var(--c-text); background-color: var(--c-card);
}
.field input::placeholder, .field textarea::placeholder { color: var(--c-text-3); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--c-focus); box-shadow: var(--focus-ring); }
.field textarea { min-height: 120px; resize: vertical; }
.field textarea.short { min-height: 96px; }
.input-sm, select.input-sm { padding: 6px 28px 6px 10px; font-size: var(--t-dense-size); line-height: var(--t-dense-lh); border-radius: var(--radii-sm); width: auto; }
.form { max-width: 560px; }

/* Segmented control, as on the phone's challenge screens. */
.segmented-legend { display: block; font-size: var(--t-body-size); font-weight: 500; margin-bottom: 6px; }
.segmented { display: inline-flex; border: 1px solid var(--c-text); border-radius: 999px; overflow: hidden; margin-bottom: var(--spacing-lg); }
.segmented label { display: inline-flex; align-items: center; padding: 8px 18px; cursor: pointer; font-weight: 500; color: var(--c-text); }
.segmented label + label { border-left: 1px solid var(--c-text); }
.segmented input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.segmented label:has(input:checked) { background: var(--c-gold); color: var(--c-on-gold); }
.segmented label:has(input:checked)::before { content: '✓ '; margin-right: 4px; }
.segmented label:hover:not(:has(input:checked)) { background: var(--c-inset); }
.segmented label:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* Sign-in pages: one narrow column. */
.auth { max-width: var(--measure-auth); margin: var(--spacing-xl) auto 0; }
.auth h1 { margin-bottom: var(--spacing-sm); }
.auth form + .btn-block { margin-top: var(--spacing-md); }
.auth-links { margin-top: var(--spacing-xl); text-align: center; color: var(--c-text-2); font-size: var(--t-dense-size); }
.auth-resend { margin-top: var(--spacing-sm); text-align: center; }

.steps { display: flex; gap: var(--spacing-md); list-style: none; margin: 0 0 var(--spacing-lg); font-size: var(--t-caption-size); color: var(--c-text-3); }
.steps li.done { color: var(--c-achieve); }
.steps li.current { color: var(--c-text); font-weight: 600; border-bottom: 2px solid var(--c-gold); }

/* --- Panels --------------------------------------------------------------- */

.panel { background: var(--c-card); border: 1px solid var(--c-border-subtle); border-radius: var(--radii-md); padding: var(--spacing-lg); margin-bottom: var(--spacing-md); }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; gap: var(--spacing-md); margin-bottom: var(--spacing-sm); flex-wrap: wrap; }
.panel-title h2, .panel-title h3 { margin: 0; }
.panel .actions { margin-top: var(--spacing-md); }
.signout { margin-top: var(--spacing-2xl); }

details.edit-block { margin-top: var(--spacing-sm); }
details.edit-block > summary { list-style: none; cursor: pointer; display: inline-block; }
details.edit-block > summary::-webkit-details-marker { display: none; }
details.edit-block[open] > summary { margin-bottom: var(--spacing-sm); }
details.edit-block .field { margin-bottom: 0; }

/* --- Timeline (the rail) -------------------------------------------------- */

.stats-line { color: var(--c-text-2); margin: 0 0 var(--spacing-md); font-size: var(--t-dense-size); }
.stats-line strong { color: var(--c-text); font-family: var(--font-heading); font-size: var(--t-h3-size); }
.stats-sep { margin: 0 6px; color: var(--c-text-3); }
.unlock-card { border-color: var(--c-gold); background: var(--c-gold-muted); color: var(--c-on-gold); }
.unlock-card h2 { margin-top: 0; color: var(--c-on-gold); }

.rail { list-style: none; --rail-time: 64px; --rail-glyph: 28px; }
.rail .day-header {
  position: sticky; top: calc(var(--header-h) + env(safe-area-inset-top)); z-index: 5;
  background: var(--c-bg);
  padding: var(--spacing-md) 0 var(--spacing-xs);
  font-family: var(--font-heading); font-size: var(--t-h3-size); color: var(--c-primary);
  border-bottom: 1px solid var(--c-border-subtle);
}
.rail .row { position: relative; }
.rail .row-link {
  display: grid; grid-template-columns: var(--rail-time) var(--rail-glyph) 1fr; gap: 0 var(--spacing-sm);
  padding: var(--spacing-md) 0;
  color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--c-border-subtle);
}
.rail .row-link:hover .row-text { color: var(--c-link); }
.row-time { font-size: var(--t-caption-size); color: var(--c-text-2); padding-top: 3px; white-space: nowrap; }
.row-glyph { position: relative; width: var(--rail-glyph); align-self: stretch; }
.row-glyph::before { content: ''; position: absolute; left: 50%; top: -12px; bottom: -13px; width: 1px; background: var(--c-border); }
.row-glyph::after {
  content: ''; position: absolute; left: 50%; top: 4px; transform: translateX(-50%);
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--c-card); border: 1.5px solid var(--c-primary);
  background-repeat: no-repeat; background-position: center; background-size: 10px;
}
/* Source glyphs, as one-colour data-URI SVGs — pen, mic, clipboard, sparkle. */
.glyph-text::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A2F52' stroke-width='3'%3E%3Cpath d='M4 20l4-1 11-11-3-3L5 16z'/%3E%3C/svg%3E"); }
.glyph-voice::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A2F52' stroke-width='3'%3E%3Crect x='9' y='3' width='6' height='11' rx='3'/%3E%3Cpath d='M5 11a7 7 0 0 0 14 0M12 18v3'/%3E%3C/svg%3E"); }
.glyph-paste::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A2F52' stroke-width='3'%3E%3Crect x='5' y='5' width='14' height='16' rx='2'/%3E%3Cpath d='M9 5V3h6v2'/%3E%3C/svg%3E"); }
.glyph-prompt::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%231A2F52'%3E%3Cpath d='M12 2l2.4 6.6L21 11l-6.6 2.4L12 20l-2.4-6.6L3 11l6.6-2.4z'/%3E%3C/svg%3E"); }
.rail .row.failed .row-glyph::after { border-color: var(--c-danger); }
.rail .row.in-flight .row-glyph::after { border-style: dashed; }
.row-body { min-width: 0; }
.row-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: var(--t-caption-size); color: var(--c-text-2); }
.row-status { font-style: italic; }
.row-status.is-failed { color: var(--c-danger); font-style: normal; }
.row-status.is-draft { color: var(--c-achieve); }
.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--c-reflect-soft); color: var(--c-reflect); font-size: var(--t-caption-size); line-height: var(--t-caption-lh); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.load-more { padding: var(--spacing-lg) 0; text-align: center; }

/* At accessibility text sizes the fixed gutter squeezes the summary to a
   couple of words a line, so the rail is dropped (the phone does the same
   past a 1.6 text scale). */
@media (max-width: 380px) {
  .rail { --rail-time: 48px; --rail-glyph: 22px; }
}

/* --- Capture -------------------------------------------------------------- */

.capture .nudge { font-style: italic; color: var(--c-primary); margin: calc(-1 * var(--spacing-sm)) 0 var(--spacing-lg); }
.capture-text { min-height: 180px; font-size: 17px; line-height: 26px; }
.capture-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--spacing-sm); }
.file-label { cursor: pointer; position: relative; }
.pending-files { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--spacing-sm); }
.chip-file { background: var(--c-inset); color: var(--c-text); }
.chip-x { background: none; border: none; cursor: pointer; color: var(--c-text-2); font-size: 14px; margin-left: 4px; }
.capture-actions { position: sticky; bottom: 0; background: var(--c-bg); padding: var(--spacing-md) 0 max(var(--spacing-md), env(safe-area-inset-bottom)); }

/* --- Event detail --------------------------------------------------------- */

.event-head { margin-bottom: var(--spacing-md); }
.event-head h1 { font-size: var(--t-h2-size); line-height: var(--t-h2-lh); }
.event-head .meta { margin-bottom: 0; }
.raw-text, .output-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.output-tools { display: flex; align-items: center; gap: var(--spacing-md); }
.output-tools form { margin: 0; }
.survey { border-color: var(--c-gold); }
.confidence { display: flex; align-items: center; gap: var(--spacing-sm); }
.confidence-bar { display: inline-block; flex: 1 1 auto; max-width: 240px; height: 8px; border-radius: 999px; background: var(--c-inset); position: relative; overflow: hidden; }
.confidence-bar::after { content: ''; position: absolute; inset: 0; width: var(--pct, 0%); background: var(--c-achieve); border-radius: 999px; }

.attachments { list-style: none; display: flex; flex-wrap: wrap; gap: var(--spacing-md); margin-top: var(--spacing-md); }
.attachment { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.attachment img { width: 120px; height: 120px; object-fit: cover; border-radius: var(--radii-sm); border: 1px solid var(--c-border-subtle); display: block; }
.attachment-file { display: inline-block; padding: 8px 12px; background: var(--c-inset); border-radius: var(--radii-sm); text-decoration: none; }

/* --- Pulse ---------------------------------------------------------------- */

.pulse .panel h3 { color: var(--c-reflect); }

/* --- TOTP ----------------------------------------------------------------- */

.totp-qr { background: #fff; padding: var(--spacing-md); border-radius: var(--radii-md); display: inline-block; margin: var(--spacing-md) 0; }
.totp-qr svg { display: block; width: 200px; height: 200px; }
.totp-secret { display: flex; align-items: center; gap: var(--spacing-md); flex-wrap: wrap; margin-bottom: var(--spacing-lg); }
.totp-secret code { letter-spacing: 0.08em; }
