/* =====================================================================
   conf-utility — admin interface.
   Palette and type follow the IS'26 public site (deep academic navy,
   copper accent, warm paper) so the two read as one system. No external
   requests: the CSP blocks them and the tool must work on a venue Wi-Fi
   that may not reach anything.
   ===================================================================== */

:root {
  --ink:        #151a24;
  --ink-muted:  #4a5366;
  --ink-soft:   #7a8394;
  --paper:      #fbf9f4;
  --paper-alt:  #f5f1e7;
  --paper-deep: #ebe4d2;
  --surface:    #ffffff;
  --navy:       #0d2948;
  --navy-deep:  #07182c;
  --navy-soft:  #2a4a72;
  --copper:     #a94712;
  --copper-soft:#e89458;
  --rule:       #d7d0bd;
  --rule-soft:  #e8e2d0;
  --ok:         #1f6b45;
  --ok-bg:      #e4f1e9;
  --warn:       #8a5a06;
  --warn-bg:    #fbf0d8;
  --err:        #9b2c22;
  --err-bg:     #fbe6e2;

  --font-display: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'IBM Plex Sans', Roboto, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(13, 41, 72, .06), 0 1px 3px rgba(13, 41, 72, .04);
  --shadow-md: 0 2px 6px rgba(13, 41, 72, .08), 0 8px 24px rgba(13, 41, 72, .06);
  --sidebar-w: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e6e1; --ink-muted: #a8b0bd; --ink-soft: #7d8695;
    --paper: #10161f; --paper-alt: #161d28; --paper-deep: #1d2632;
    --surface: #161d28;
    --navy: #d8e2ee; --navy-deep: #f0f4f8; --navy-soft: #9fb3cc;
    --copper: #e89458; --copper-soft: #a94712;
    --rule: #2a3442; --rule-soft: #222b37;
    --ok: #6ec49a; --ok-bg: #14291f;
    --warn: #d9a441; --warn-bg: #2a2214;
    --err: #e78a80; --err-bg: #2c1917;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------------------------------------------------------- shell */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy-deep);
  color: #cfd9e5;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
@media (prefers-color-scheme: dark) {
  .sidebar { background: #0a1119; border-right: 1px solid var(--rule); }
}

.brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.brand .mark {
  font: bold 10px/1 var(--font-body);
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--copper-soft);
}
.brand .name {
  margin-top: 7px;
  font-family: var(--font-display);
  font-size: 20px;
  color: #fff;
  line-height: 1.2;
}
.brand .sub { margin-top: 3px; font-size: 11.5px; color: #8fa2b8; }

.nav { padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-label {
  padding: 14px 10px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: #6e829a;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 2px;
  border-radius: var(--radius);
  color: #cfd9e5; font-size: 14px; text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--copper); color: #fff; font-weight: 600; }
.nav a.active .pill { background: rgba(255,255,255,.25); color: #fff; }
.nav .ico { width: 17px; text-align: center; opacity: .85; flex: 0 0 17px; }
.nav .pill {
  margin-left: auto;
  background: rgba(255, 255, 255, .12);
  color: #cfd9e5;
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 10px;
}
.nav .pill.alert { background: var(--copper); color: #fff; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, .09);
  font-size: 12px; color: #8fa2b8;
}
.sidebar-foot .who { color: #fff; font-weight: 600; }
.sidebar-foot form { margin-top: 8px; }
.sidebar-foot button {
  background: none; border: 1px solid rgba(255,255,255,.22); color: #cfd9e5;
  padding: 4px 10px; border-radius: var(--radius); font-size: 12px; cursor: pointer;
  font-family: inherit;
}
.sidebar-foot button:hover { background: rgba(255,255,255,.09); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 25px; font-weight: 600; color: var(--navy); line-height: 1.2;
}
.topbar .lede { font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.topbar .spacer { flex: 1; }

.content { padding: 24px 28px 64px; max-width: 1400px; width: 100%; }

/* --------------------------------------------------------- banners */
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 15px; margin-bottom: 20px;
  border-radius: var(--radius); border-left: 3px solid var(--ok);
  background: var(--ok-bg); color: var(--ok); font-size: 14px;
}
.flash.warn { border-color: var(--warn); background: var(--warn-bg); color: var(--warn); }
.flash.err  { border-color: var(--err);  background: var(--err-bg);  color: var(--err); }

.testbanner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 15px; margin-bottom: 20px;
  background: var(--warn-bg); border: 1px dashed var(--warn);
  border-radius: var(--radius); color: var(--warn); font-size: 13.5px;
}
.testbanner strong { font-weight: 700; }

/* ----------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  overflow: hidden;
}
.card > header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-alt);
}
.card > header h2 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600; color: var(--navy);
}
.card > header .hint { font-size: 12.5px; color: var(--ink-muted); }
.card > header .spacer { flex: 1; }
.card .body { padding: 18px; }
.card .body > p + p { margin-top: 10px; }

/* ----------------------------------------------------------- stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
  box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.stat::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--navy-soft);
}
.stat.accent::before { background: var(--copper); }
.stat.good::before   { background: var(--ok); }
.stat .label {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-soft);
}
.stat .value {
  font-family: var(--font-display);
  font-size: 30px; line-height: 1.15; color: var(--navy); margin-top: 5px;
}
.stat .value small { font-size: 15px; color: var(--ink-soft); }
.stat .note { font-size: 12px; color: var(--ink-muted); margin-top: 3px; }

.meter {
  height: 5px; border-radius: 3px; background: var(--paper-deep);
  margin-top: 9px; overflow: hidden;
}
.meter span { display: block; height: 100%; background: var(--copper); border-radius: 3px; }
.meter.good span { background: var(--ok); }

/* ---------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  position: sticky; top: 0;
  text-align: left; padding: 9px 12px;
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); background: var(--paper-alt);
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
tbody td { padding: 10px 12px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--paper-alt); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--font-mono); font-size: 12.5px; }
td.tight { white-space: nowrap; }
.paper-id {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--navy-soft);
}
.title-cell { max-width: 520px; }
.title-cell .t { color: var(--ink); }
.title-cell .a { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* ---------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--paper-deep); color: var(--ink-muted);
}
.badge.ok    { background: var(--ok-bg);   color: var(--ok); }
.badge.warn  { background: var(--warn-bg); color: var(--warn); }
.badge.err   { background: var(--err-bg);  color: var(--err); }
.badge.info  { background: rgba(42,74,114,.1); color: var(--navy-soft); }
.badge.muted { background: var(--paper-deep); color: var(--ink-soft); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* --------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px;
  font: 600 13.5px/1.2 var(--font-body);
  border: 1px solid var(--navy); border-radius: var(--radius);
  background: var(--navy); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: var(--navy-soft); border-color: var(--navy-soft); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
@media (prefers-color-scheme: dark) { .btn { color: var(--paper); } }

.btn.ghost { background: transparent; color: var(--navy); border-color: var(--rule); }
.btn.ghost:hover { background: var(--paper-alt); border-color: var(--navy-soft); }
.btn.accent { background: var(--copper); border-color: var(--copper); color: #fff; }
.btn.accent:hover { background: #8f3c0f; border-color: #8f3c0f; }
.btn.danger { background: transparent; color: var(--err); border-color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------- forms */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-muted); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=email], input[type=date],
input[type=file], select, textarea {
  width: 100%; padding: 8px 11px;
  font: 400 14px/1.4 var(--font-body); color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { border-color: var(--navy-soft); outline-offset: 0; }
textarea { min-height: 78px; resize: vertical; }
.field { margin-bottom: 15px; }
.field .help { font-size: 12px; color: var(--ink-soft); margin-top: 4px; font-weight: 400; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field-row .field { flex: 1; min-width: 190px; }

.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; }
.check input { margin-top: 3px; width: 16px; height: 16px; flex: 0 0 16px; accent-color: var(--copper); }
.check label { margin: 0; font-weight: 500; color: var(--ink); }
.check .help { font-size: 12px; color: var(--ink-soft); }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
  padding: 14px 18px; border-bottom: 1px solid var(--rule-soft); background: var(--paper-alt);
}
.filters .field { margin: 0; }
.filters input[type=text] { min-width: 230px; }
.filters select { min-width: 140px; }

/* --------------------------------------------------- segmented toggle */
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.seg button {
  border: none; background: var(--surface); color: var(--ink-muted);
  padding: 4px 11px; font: 600 12px/1.4 var(--font-body); cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--rule); }
.seg button:hover { background: var(--paper-alt); }
.seg button.on { background: var(--navy); color: #fff; }
.seg button.on.yes { background: var(--ok); }
.seg button.on.no  { background: var(--ink-soft); }
.seg button.on.auto { background: var(--navy-soft); }

/* -------------------------------------------- conference-day chips */
.daybar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.daychip {
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 16px; min-width: 178px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--ink);
  transition: border-color .12s ease, transform .06s ease;
}
.daychip:hover { border-color: var(--navy-soft); text-decoration: none; }
.daychip.on { border-color: var(--copper); border-width: 2px; padding: 10px 15px; }
.daychip .d { font-family: var(--font-display); font-size: 16px; color: var(--navy); }
.daychip .n { font-size: 12px; color: var(--ink-soft); }
.daychip .bars { margin-top: 4px; }

/* ------------------------------------------------------------ misc */
.empty { padding: 44px 20px; text-align: center; color: var(--ink-soft); }
.empty .big { font-family: var(--font-display); font-size: 19px; color: var(--ink-muted); }
.empty p { margin-top: 6px; font-size: 14px; }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 16px; font-size: 14px; }
.kv dt { color: var(--ink-soft); font-size: 13px; }
.kv dd { color: var(--ink); }

.diff-add { color: var(--ok); }
.diff-del { color: var(--err); text-decoration: line-through; }
.diff-list { font-size: 13px; }
.diff-list li { margin-bottom: 7px; list-style: none; padding-left: 15px; position: relative; }
.diff-list li::before { content: '·'; position: absolute; left: 3px; color: var(--copper); }

.split { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }

/* Equal columns that collapse to one. The registration record has eight field
   groups; side by side they fit a laptop without endless scrolling. */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 1100px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------- the original form, on the review page
   A PDF frames directly; a .docx is rebuilt from its XML, because no browser
   renders Word. Both are kept collapsible — on a laptop the values being
   checked matter more than the document, so it must be possible to fold away. */
.viewer > summary {
  display: flex; align-items: baseline; gap: 12px; cursor: pointer;
  padding: 13px 18px; border-bottom: 1px solid var(--rule-soft);
  list-style: none;
}
.viewer > summary::-webkit-details-marker { display: none; }
.viewer > summary::before {
  content: '▸'; color: var(--ink-soft); font-size: 12px; transition: transform .12s;
}
.viewer[open] > summary::before { transform: rotate(90deg); }
.viewer > summary h2 { margin: 0; font-size: 15px; }

.viewer-frame {
  width: 100%; height: 620px; border: 1px solid var(--rule); border-radius: 4px;
  background: var(--paper-alt);
}

.viewer-doc {
  max-height: 620px; overflow-y: auto;
  border: 1px solid var(--rule); border-radius: 4px;
  padding: 16px 18px; background: var(--surface); font-size: 13px;
}
.viewer-doc h3 {
  margin: 18px 0 8px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--copper, #b06a2c);
}
.viewer-doc h3:first-child { margin-top: 0; }
.viewer-doc p { margin: 6px 0; color: var(--ink-soft); }

.viewer-table { width: 100%; border-collapse: collapse; margin: 6px 0 12px; }
.viewer-table td {
  border: 1px solid var(--rule-soft); padding: 4px 8px; vertical-align: top;
  font-size: 12.5px;
}
.viewer-table td:first-child { width: 42%; color: var(--ink-soft); }
.viewer-table td:not(:first-child) { font-weight: 600; }

.viewer-ticks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 6px 0 12px; }
.viewer-ticks span {
  font-size: 12.5px; color: var(--ink-soft);
  padding: 2px 8px; border: 1px solid var(--rule-soft); border-radius: 3px;
}
.viewer-ticks span.on {
  color: var(--ink); font-weight: 600;
  border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent);
}

/* --------------------------------------------- spreadsheet-style grid
   The registration tracker, read the way the committee reads the workbook.

   The thing that makes it feel like a spreadsheet rather than a web table is
   `table-layout: fixed` plus a <colgroup> carrying the registry's own column
   widths: every cell then keeps one line and clips, so a row is one row high
   no matter how long the title is. Wrapping is what turns 39 columns into a
   wall of text. Full values are still there on hover, via title=.  */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 300px); }
.sheet {
  table-layout: fixed; border-collapse: separate; border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.sheet th, .sheet td {
  padding: 3px 7px; font-size: 12px; line-height: 1.45;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-right: 1px solid var(--rule-soft); border-bottom: 1px solid var(--rule-soft);
  background: var(--surface);
}
.sheet tbody tr:hover td { background: var(--paper-alt); }

/* Row 1: the group bands, matching the workbook's merges. Each band gets its
   own colour — across 39 columns it is the only quick way to know whether you
   are looking at money or at the camera-ready workflow. */
.sheet thead tr.bands th {
  position: sticky; top: 0; z-index: 3;
  height: 21px; box-sizing: border-box;
  color: #fff; background: var(--ink);
  font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  text-align: center; padding: 2px 8px;
  border-right: 1px solid rgba(255,255,255,.25); border-bottom: none;
}
.sheet .band-0 { background: #0d2948; }
.sheet .band-1 { background: #35618f; }
.sheet .band-2 { background: #b06a2c; }
.sheet .band-3 { background: #7d5a3c; }
.sheet .band-4 { background: #3d6b55; }
.sheet .band-5 { background: #55507d; }
.sheet .band-6 { background: #5f6570; }
.sheet .band-7 { background: #0d2948; }

/* Row 2: the column headers, directly under the bands. */
.sheet thead tr.heads th {
  position: sticky; top: 21px; z-index: 3;
  background: var(--paper-alt); color: var(--ink-soft);
  font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  text-align: left; padding: 5px 7px; border-bottom: 1px solid var(--rule);
}

/* The frozen Paper ID column. It must out-stack both the header rows it
   scrolls under and the body cells it scrolls over, so its z-index is set
   explicitly — at equal z-index, later cells in the DOM paint over it. */
.sheet .froze { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.sheet thead tr.bands th.froze,
.sheet thead tr.heads th.froze { z-index: 5; }
.sheet tbody tr:hover .froze { background: var(--paper-alt); }
/* A heavier rule where one group ends and the next begins. */
.sheet .group-edge { border-right: 2px solid var(--rule); }

/* Editable cells. The dotted underline is the whole affordance — a grid of
   4000 visible input boxes is unreadable, and an unmarked one is unfindable. */
.sheet td.cell-edit { cursor: cell; }
.sheet td.cell-edit:not(.cell-derived) {
  box-shadow: inset 0 -1px 0 0 var(--rule);
}
.sheet td.cell-edit:hover { background: var(--paper-deep, #eef1f5); }
.sheet td.cell-edit:focus {
  outline: 2px solid var(--copper, #b06a2c); outline-offset: -2px;
}
.sheet td.cell-derived { color: var(--ink-soft); background: var(--paper-alt); }
.sheet tbody tr:hover td.cell-derived { background: var(--paper-alt); }
.sheet td.cell-saving { opacity: .5; }
.sheet td.cell-saved { background: color-mix(in srgb, var(--ok) 18%, transparent); }

.sheet .cell-input {
  width: 100%; box-sizing: border-box;
  padding: 1px 3px; margin: -2px 0;
  font: inherit; font-size: 12px;
  border: 1px solid var(--copper, #b06a2c); border-radius: 2px;
  background: var(--surface); color: var(--ink);
}
.sheet .cell-input:focus { outline: none; }

.sheet td.cell-yes { color: var(--ok); font-weight: 600; }
.sheet td.cell-no  { color: var(--rule); }
.sheet td.cell-num { text-align: right; }
.sheet td.cell-id  { font-weight: 700; }
.sheet a { color: var(--ink); text-decoration: none; }
.sheet td.cell-id a, .sheet td.cell-title a { color: var(--link, #35618f); }
.sheet a:hover { text-decoration: underline; }

.scroll-y { max-height: 420px; overflow-y: auto; }

/* --------------------------------------------- centred auth pages */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px; background: var(--paper-alt);
}
.auth-card {
  width: 100%; max-width: 415px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md); overflow: hidden;
}
.auth-card .head { padding: 26px 28px 20px; background: var(--navy-deep); color: #fff; }
.auth-card .head .mark {
  font: bold 10px/1 var(--font-body); letter-spacing: .3em;
  text-transform: uppercase; color: var(--copper-soft);
}
.auth-card .head h1 { font-family: var(--font-display); font-size: 24px; margin-top: 9px; font-weight: 600; }
.auth-card .head p { font-size: 13px; color: #9fb3cc; margin-top: 5px; }
.auth-card .body { padding: 24px 28px 28px; }
.auth-card .btn { width: 100%; margin-top: 6px; }

.qr-box { text-align: center; padding: 16px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); }
.qr-box img { width: 190px; height: 190px; image-rendering: pixelated; }
.secret {
  font-family: var(--font-mono); font-size: 13px; letter-spacing: .06em;
  background: var(--paper-alt); padding: 8px 11px; border-radius: var(--radius);
  word-break: break-all; text-align: center; margin-top: 11px; color: var(--navy);
}

/* ------------------------------------------------- public verify page */
.verify-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px; background: var(--paper-alt);
}
.verify-card {
  max-width: 620px; width: 100%; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); overflow: hidden;
}
.verify-card .status { padding: 22px 28px; color: #fff; }
.verify-card .status.valid { background: var(--ok); }
.verify-card .status.invalid { background: var(--err); }
.verify-card .status.neutral { background: var(--navy-deep); }
.verify-card .status h1 { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.verify-card .status p { font-size: 13.5px; opacity: .92; margin-top: 3px; }
.verify-card .body { padding: 24px 28px 28px; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: static; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .nav a { flex: 1 1 auto; }
  .nav-label { display: none; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 14px 16px; }
}

@media print {
  .sidebar, .topbar, .btn, .filters { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ---------------------------------------------------------------- mailroom
   Conversation view. The only genuinely new shapes here are the message
   bubble, which has to distinguish what we sent from what arrived, and the
   classifier panel, which must read as an aside rather than as content. */
.msg { border: 1px solid var(--rule); border-radius: 8px; margin-bottom: 14px;
       background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.msg > header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px;
                padding: 11px 16px; border-bottom: 1px solid var(--rule-soft);
                background: var(--paper-alt); }
.msg > header .who { font-weight: 600; color: var(--ink); }
.msg > header .addr, .msg > header .when { font-size: 12.5px; color: var(--ink-soft); }
/* Our own replies are tinted so a conversation can be skimmed for who spoke. */
.msg.out > header { background: var(--navy-soft); }
.msg .to { padding: 9px 16px 0; font-size: 12.5px; color: var(--ink-soft); }
.msg .body { margin: 0; padding: 12px 16px 16px; font-family: var(--font-mono);
             font-size: 13px; line-height: 1.55; white-space: pre-wrap;
             word-break: break-word; color: var(--ink); }
.msg .strip { padding: 9px 16px; border-top: 1px solid var(--rule-soft);
              display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; }
.msg .strip .lbl { color: var(--ink-soft); }
.msg .llm { padding: 11px 16px; border-top: 1px solid var(--rule-soft);
            background: var(--paper-alt); font-size: 13px; }
.msg .llm .lbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
                 color: var(--ink-soft); margin-bottom: 4px; }
.msg .llm p { margin: 5px 0 0; color: var(--ink-soft); }
.msg .llm details { margin-top: 7px; }
.msg .llm summary { cursor: pointer; color: var(--navy); font-size: 12.5px; }
.msg .llm pre { margin: 7px 0 0; padding: 10px; border: 1px solid var(--rule-soft);
                border-radius: 6px; background: var(--surface); font-family: var(--font-mono);
                font-size: 12.5px; white-space: pre-wrap; }
/* Inline confirm/reject on a suggested link — a button that must not look like
   a button, because it sits mid-sentence. */
.linkbtn { background: none; border: 0; padding: 0 2px; cursor: pointer;
           color: var(--navy); font: inherit; font-size: 12.5px; text-decoration: underline; }
.linkbtn:hover { color: var(--copper); }
.compose textarea { width: 100%; font-family: var(--font-mono); font-size: 13px;
                    line-height: 1.55; resize: vertical; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover .subject { text-decoration: underline; }
/* Mail HTML lives in a sandboxed frame. Fixed height with its own scrollbar:
   the frame is cross-origin by virtue of the sandbox, so the page cannot
   measure its content to size it, and a very long newsletter must not push the
   reply box off the bottom of the screen. */
.msg .htmlbody { display: block; width: 100%; height: 460px; border: 0;
                 background: #fff; }
/* Unread conversations, marked the way a mail client does: weight for the eye
   scanning the column, a copper bar for the eye scanning the list, and a dot
   for anyone who reads neither. Three cheap signals beat one subtle badge. */
tr.unread td { background: var(--surface); }
tr.unread td:first-child { box-shadow: inset 3px 0 0 var(--copper); }
tr.unread .subject,
tr.unread td:first-child { font-weight: 600; color: var(--ink); }
.unread-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
              background: var(--copper); margin-right: 7px; vertical-align: 1px; }

/* ---------------------------------------------------------- mailroom v2
   A mail client's shape inside the app: a folder rail, a conversation list
   with sender / subject / preview on two lines, and a thread view with the
   messages on the left and the conversation's status on the right. */
.mailroom { display: flex; border: 1px solid var(--rule); border-radius: var(--radius-lg);
            background: var(--surface); overflow: hidden; min-height: 72vh; box-shadow: var(--shadow-sm); }

.mail-rail { width: 212px; flex: 0 0 212px; background: var(--paper-alt);
             border-right: 1px solid var(--rule-soft); padding: 12px 10px 16px; }
.rail-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
              color: var(--ink-soft); margin: 12px 10px 6px; }
.rail-label:first-child { margin-top: 2px; }
.rail-item { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: var(--radius);
             color: var(--ink-muted); text-decoration: none; font-size: 13.5px; }
.rail-item:hover { background: var(--paper-deep); color: var(--ink); text-decoration: none; }
.rail-item.active { background: var(--navy); color: #fff; }
.rail-item .ico { width: 16px; text-align: center; opacity: .85; }
.rail-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .cnt { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.rail-item .cnt.hot { font-weight: 700; color: var(--copper); }
.rail-item.active .cnt { color: rgba(255,255,255,.8); }
.rail-item.active .cnt.hot { color: var(--copper-soft); }
.rail-new { display: flex; gap: 6px; margin: 8px 6px 0; }
.rail-new input { flex: 1; min-width: 0; font-size: 12.5px; padding: 5px 8px; }

.mail-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mail-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); }
.mail-toolbar h2 { font-family: var(--font-display); font-size: 21px; margin: 0 6px 0 0; color: var(--navy); }
.mail-toolbar .search { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.mail-toolbar .search input[type=search] { min-width: 220px; }
.mail-toolbar .spacer { flex: 1; }
.mail-toolbar.select-row { background: var(--paper); padding: 8px 14px; min-height: 46px; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.checkall { display: flex; align-items: center; padding: 0 2px; }
.bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vsep { width: 1px; height: 22px; background: var(--rule); display: inline-block; }

/* the list */
.mlist { display: block; }
.mrow { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px 9px 12px;
        border-bottom: 1px solid var(--rule-soft); }
.mrow:last-child { border-bottom: none; }
.mrow:hover { background: var(--paper-alt); }
.mrow .row-check { margin-top: 11px; flex: 0 0 auto; }
.mrow-body { display: flex; gap: 12px; flex: 1; min-width: 0; color: inherit; text-decoration: none; }
.mrow-body:hover { text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-soft); color: #fff;
          display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12.5px;
          flex: 0 0 34px; letter-spacing: .02em; }
.mrow.out .avatar { background: var(--paper-deep); color: var(--ink-muted); }
.mrow-text { flex: 1; min-width: 0; }
.l1 { display: flex; align-items: baseline; gap: 8px; }
.l1 .who { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.l1 .count { font-size: 11.5px; color: var(--ink-soft); }
.l1 .when { margin-left: auto; font-size: 12px; color: var(--ink-soft); white-space: nowrap;
            font-variant-numeric: tabular-nums; }
.l2 { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; margin-top: 1px; }
.l2 .subj { color: var(--ink); }
.l2 .snip { color: var(--ink-soft); }
.l2 .snip em { font-style: normal; color: var(--ink-muted); }
.l3 { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.mrow.unread { box-shadow: inset 3px 0 0 var(--copper); }
.mrow.unread .who, .mrow.unread .subj { font-weight: 700; }
.mrow.unread .when { color: var(--copper); font-weight: 600; }
.flagicon { color: var(--copper); }

/* the thread */
.thread-tools form { display: inline; }
.thread-split { display: flex; flex: 1; min-height: 0; }
.thread-main { flex: 1; min-width: 0; padding: 16px 18px 24px; }
.thread-side { width: 290px; flex: 0 0 290px; border-left: 1px solid var(--rule-soft);
               background: var(--paper-alt); padding: 14px 16px 20px; font-size: 13px; }
.thread-side h4 { margin: 16px 0 7px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.thread-side h4:first-child { margin-top: 0; }
.thread-side .field { margin-bottom: 8px; }
.thread-side input[type=text], .thread-side select { width: 100%; }
.thread-side .kvline { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.thread-side .kvline > span:first-child { color: var(--ink-soft); }
.thread-side .fu { padding: 7px 0; border-top: 1px solid var(--rule-soft); display: flex; flex-direction: column; gap: 3px; }
.thread-side .fu form { display: inline; }

@media (max-width: 1180px) { .thread-side { display: none; } }
@media (max-width: 900px)  { .mail-rail { width: 168px; flex-basis: 168px; } .l1 .count { display: none; } }
.mrow-body { user-select: none; -webkit-user-select: none; }

/* ---- group mail --------------------------------------------------------- */
.rail-compose { display: block; text-align: center; margin: 2px 6px 10px; }
.compose-split { display: flex; flex: 1; min-height: 0; }
.compose-main { flex: 1; min-width: 0; padding: 16px 18px 24px; }
.compose-main h4, .compose-side h4 { margin: 14px 0 8px; font-size: 11px; letter-spacing: .08em;
                                     text-transform: uppercase; color: var(--ink-soft); }
.compose-main h4:first-child { margin-top: 0; }
.compose-side { width: 340px; flex: 0 0 340px; border-left: 1px solid var(--rule-soft);
                background: var(--paper-alt); padding: 14px 16px 20px; font-size: 13px;
                max-height: 82vh; overflow-y: auto; }
.compose-side h4 { display: flex; align-items: center; gap: 8px; margin-top: 0; }
.rlist { display: flex; flex-direction: column; }
.rrow { padding: 6px 0; border-top: 1px solid var(--rule-soft); line-height: 1.35; }
.rrow .muted { font-size: 12px; }
.sample { background: var(--surface); border: 1px solid var(--rule-soft); border-radius: var(--radius);
          padding: 8px 10px; margin-top: 6px; font-size: 12.5px; }
.sample pre { white-space: pre-wrap; font-family: var(--font-mono); font-size: 12px; margin: 6px 0 0; }
@media (max-width: 1100px) { .compose-side { display: none; } }
.picker { margin: -6px 0 14px; }
.picker > summary { cursor: pointer; font-size: 13.5px; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.picker-tools { display: flex; align-items: center; gap: 8px; margin: 8px 0 6px; }
.picker-tools input[type=search] { flex: 0 1 320px; }
.picker-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--surface); }
.pick-row { display: flex; align-items: flex-start; gap: 9px; padding: 6px 10px; border-bottom: 1px solid var(--rule-soft);
            font-size: 13px; cursor: pointer; margin: 0; }
.pick-row:last-child { border-bottom: none; }
.pick-row:hover { background: var(--paper-alt); }
.pick-row input { margin-top: 3px; flex: 0 0 auto; }
.pick-row .pick-id { width: 34px; flex: 0 0 34px; color: var(--ink-soft); font-size: 12px; padding-top: 1px; }
.pick-row .pick-title { flex: 1; min-width: 0; line-height: 1.35; }
.pick-row.dim .pick-title { color: var(--ink-soft); }
.pick-row[hidden] { display: none; }
