/* ==========================================================================
   RCDT Board Portal — design system
   Colours sampled from the official RCDT logo: deep brown #5C200F,
   red #DA2128, orange #F05A22, gold #FAAE0A.
   Signature motif: the logo's rising-sun horizon, reused as a gradient
   keyline (gold -> orange -> red) beneath every masthead surface.
   ========================================================================== */

:root {
  --ink: #4a1a0c;          /* sidebar, slabs — deep brand brown */
  --ink-2: #5c200f;        /* the logo brown */
  --ink-3: #6f2c17;        /* dark hover */
  --surface: #faf6f3;      /* warm app ground */
  --card: #ffffff;
  --line: #ebe2db;
  --line-dark: rgba(255, 255, 255, 0.1);
  --text: #2a1c14;
  --muted: #7c6a5f;       /* 5.1:1 on white */
  --faint: #857062;       /* 4.7:1 on white — WCAG AA for small text */
  --hairline: #b3a294;    /* decorative strokes only, never text */
  --red: #da2128;          /* logo red — the action accent */
  --red-deep: #b01a20;
  --red-soft: #fdeced;
  --orange: #f05a22;       /* logo orange */
  --gold: #faae0a;         /* logo gold */
  --sunrise: linear-gradient(90deg, #faae0a 0%, #f05a22 52%, #da2128 100%);
  --green: #2f6f4f;
  --green-soft: #e8f2ec;
  --amber: #9a6206;
  --amber-soft: #fdf3e0;
  --blue: #2c5f8a;
  --blue-soft: #eaf1f7;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --shadow-1: 0 1px 2px rgba(74, 26, 12, 0.05), 0 1px 3px rgba(74, 26, 12, 0.07);
  --shadow-2: 0 4px 16px rgba(74, 26, 12, 0.11);
  --shadow-3: 0 12px 40px rgba(42, 16, 8, 0.26);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* One motion vocabulary, used everywhere: enter eases out, exit eases in,
     and exits run shorter than entrances so the UI feels responsive. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 380ms;
}

/* Figures line up in columns: dates, versions, counts, percentages. */
.row-sub, .agenda-time, .countdown-box .num, .stat-tile .v, .vote-legend,
.mini-track + *, table.data td, .pill, .post-head .t, .ring-text b {
  font-variant-numeric: tabular-nums;
}

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--surface);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

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

.sidebar {
  width: 244px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--ink) 0%, #3a1409 100%);
  color: #f2e7e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* The logo sits on its own white plate — the letterhead, carried into the app */
.logo-block {
  background: #fff;
  padding: 14px 18px 12px;
  border-bottom: 3px solid transparent;
  border-image: var(--sunrise) 1; /* the rising-sun horizon */
}
.logo-block img { width: 100%; max-width: 168px; height: auto; display: block; margin: 0 auto; }
.logo-sub {
  margin-top: 8px;
  font-size: 9.5px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: #b18f7d;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  margin-bottom: 2px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: #d6c2b7;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--ink-3); color: #fff; }
.nav-item.active {
  background: var(--ink-2);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}
.nav-badge {
  margin-left: auto;
  background: var(--red);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Self-labels any screenshot: the people are real, the papers are samples */
.demo-flag {
  margin: 0 12px 10px;
  padding: 6px 10px;
  border: 1px dashed rgba(250, 174, 10, 0.5);
  border-radius: var(--r-sm);
  color: var(--gold);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.1px;
  text-transform: uppercase;
  text-align: center;
  cursor: help;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--line-dark);
  display: flex;
  align-items: center;
  gap: 11px;
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who .n { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who .t { font-size: 11px; color: #b79c8d; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout-btn {
  background: none;
  border: none;
  color: #b18f7d;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.signout-btn:hover { color: #fff; background: var(--ink-3); }
.signout-btn svg { width: 17px; height: 17px; display: block; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; max-width: 1140px; width: 100%; margin: 0 auto; padding: 30px 36px 72px; }

.view-enter { animation: viewIn var(--dur-base) var(--ease-out) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   Skeletons — the shape of the content arrives before the content does,
   so navigation never flashes an empty page.
   ========================================================================== */
.sk {
  position: relative;
  overflow: hidden;
  background: #ece4dd;
  border-radius: 6px;
}
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  animation: shimmer 1.25s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 11px; margin-bottom: 9px; }
.sk-line.tall { height: 15px; }
.sk-line.w70 { width: 70%; }
.sk-line.w50 { width: 50%; }
.sk-line.w35 { width: 35%; }
.sk-title { height: 26px; width: 260px; border-radius: 7px; margin-bottom: 10px; }
.sk-slab { height: 148px; border-radius: var(--r-lg); background: #e6dcd4; }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: none; }
.sk-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.sk-row .grow { flex: 1; }
.sk-pill { width: 64px; height: 20px; border-radius: 999px; flex-shrink: 0; }

/* ==========================================================================
   Staggered entrance — lists assemble rather than snapping in.
   ========================================================================== */
.stagger > * { animation: riseIn var(--dur-base) var(--ease-out) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 35ms; }
.stagger > *:nth-child(3) { animation-delay: 70ms; }
.stagger > *:nth-child(4) { animation-delay: 105ms; }
.stagger > *:nth-child(5) { animation-delay: 140ms; }
.stagger > *:nth-child(6) { animation-delay: 175ms; }
.stagger > *:nth-child(7) { animation-delay: 210ms; }
.stagger > *:nth-child(8) { animation-delay: 245ms; }
.stagger > *:nth-child(n + 9) { animation-delay: 280ms; }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}

/* Skip link — keyboard users reach the content without tabbing the whole menu */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow-2);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ==========================================================================
   Typography & page furniture
   ========================================================================== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--serif); font-size: 27px; font-weight: 600; margin: 0; letter-spacing: -0.2px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--red);
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 26px 0 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ==========================================================================
   The boardroom slab (signature element)
   ========================================================================== */
.slab {
  position: relative;
  background: linear-gradient(135deg, var(--ink) 0%, #61240f 100%);
  border-radius: var(--r-lg);
  overflow: hidden;
  color: #fff;
  padding: 26px 30px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-2);
}
/* the rising-sun horizon, along the foot of the slab */
.slab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--sunrise);
}
.slab .grow { flex: 1; min-width: 260px; }
.slab .eyebrow { color: var(--gold); }
.slab h2 { font-family: var(--serif); font-size: 24px; font-weight: 600; margin: 6px 0 8px; line-height: 1.2; }
.slab .meta { color: #d3b6a7; font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; }
.slab .meta span { display: inline-flex; align-items: center; gap: 6px; }
.slab .meta svg { width: 14px; height: 14px; opacity: 0.7; }

.countdown-box { text-align: center; padding: 0 8px; }
.countdown-box .num { font-family: var(--serif); font-size: 40px; font-weight: 700; line-height: 1; color: var(--gold); }
.countdown-box .lbl { font-size: 10px; letter-spacing: 1.4px; text-transform: uppercase; color: #b79c8d; margin-top: 5px; }

.ring-wrap { display: flex; align-items: center; gap: 14px; }
.ring { width: 74px; height: 74px; transform: rotate(-90deg); }
.ring .track { stroke: rgba(255, 255, 255, 0.14); }
.ring .fill { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
.ring-text { font-size: 12px; color: #d3b6a7; }
.ring-text b { display: block; color: #fff; font-size: 14px; }

/* ==========================================================================
   Cards, grids
   ========================================================================== */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
/* Cards that hold clickable rows lift slightly under the cursor */
.card:has(.clickable):hover { box-shadow: var(--shadow-2); border-color: #ded2c8; }
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card-head .link-btn { font-size: 12.5px; }

.stat-row { display: flex; gap: 16px; flex-wrap: wrap; }
.stat-tile { flex: 1; min-width: 150px; }
.stat-tile .v { font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat-tile .k { color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ==========================================================================
   Buttons, badges, avatars
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--ink-3); box-shadow: var(--shadow-1); }
.btn:active { transform: scale(0.975); }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--red); border-color: var(--red); }
.btn.primary:hover { background: var(--red-deep); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface); border-color: #cdd3df; }
.btn.sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { background: var(--ink); }
.btn.primary:disabled:hover { background: var(--red); }

.link-btn {
  background: none;
  border: none;
  color: var(--red);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
/* Deeper red on the tint so small pill text clears 4.5:1 */
.pill.red { background: var(--red-soft); color: #b01a20; }
.pill.solid-red { background: var(--red); color: #fff; }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.gray { background: #eef0f4; color: var(--muted); }
.pill.outline { background: #fff; color: var(--muted); border: 1px solid var(--line); }

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -8px; border: 2px solid #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ==========================================================================
   Lists & tables
   ========================================================================== */
.row-list { display: flex; flex-direction: column; }
.row-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--line);
  transition: background var(--dur-fast) var(--ease-out);
}
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: #fbf8f6; }
/* A hairline of brand colour marks the row under the cursor */
.row-item.clickable::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sunrise);
  opacity: 0;
  transition: opacity var(--dur-fast) var(--ease-out);
}
.row-item.clickable:hover::before { opacity: 1; }
.row-item.clickable:active { background: #f6f0ec; }
.row-item .grow { flex: 1; min-width: 0; }
.row-title { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.row-item.clickable { cursor: pointer; }

table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #fafbfc; }
table.data th.center, table.data td.center { text-align: center; }

/* Any table wide enough to scroll gets its own scroller with a visible edge */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table.data { min-width: 520px; }

/* Keep the row label in view while the columns scroll under it */
@media (max-width: 900px) {
  .table-scroll table.data th:first-child,
  .table-scroll table.data td:first-child {
    position: sticky;
    left: 0;
    background: #fff;
    box-shadow: 1px 0 0 var(--line);
    min-width: 168px;
  }
  .table-scroll table.data th:first-child { background: #fafbfc; }
  .table-scroll table.data tr:hover td:first-child { background: #fafbfc; }
}
.scroll-hint {
  display: none;
  font-size: 11.5px;
  color: var(--muted);
  padding: 0 14px 10px;
}
@media (max-width: 900px) { .scroll-hint { display: block; } }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(218, 33, 40, 0.12);
}
.field textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 160px; }

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--red); border-bottom-color: var(--red); }
.tab .count { color: var(--faint); font-weight: 500; margin-left: 4px; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 21, 28, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--r-lg);
  border-top: 3px solid transparent;
  border-image: var(--sunrise) 1;
  box-shadow: var(--shadow-3);
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  animation: modalIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 0; }
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.modal-body { padding: 16px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-close { background: none; border: none; color: var(--faint); cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { color: var(--text); background: var(--surface); }
.modal-close svg { width: 18px; height: 18px; display: block; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }

/* ==========================================================================
   Toast
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 26px;
  right: 26px;
  transform: translateY(90px);
  opacity: 0;
  background: var(--ink);
  border-left: 3px solid var(--gold);
  color: #fff;
  padding: 13px 20px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow-3);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s;
  z-index: 90;
  max-width: 380px;
}
.toast.show { transform: none; opacity: 1; }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty {
  text-align: center;
  padding: 44px 20px;
  color: var(--muted);
}
.empty svg { width: 36px; height: 36px; color: var(--faint); margin-bottom: 10px; }
.empty .t { font-weight: 600; color: var(--text); font-size: 14px; }
.empty .s { font-size: 13px; margin-top: 3px; }

/* ==========================================================================
   Agenda
   ========================================================================== */
.agenda-item {
  display: flex;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}
.agenda-item:last-child { border-bottom: none; }
.agenda-no {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--faint);
  width: 26px;
  flex-shrink: 0;
  text-align: right;
  padding-top: 1px;
}
.agenda-time {
  width: 62px;
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  padding-top: 3px;
}
.agenda-body { flex: 1; min-width: 0; }
.agenda-title { font-weight: 600; font-size: 14px; }
.agenda-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-docs { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.doc-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.doc-chip:hover { border-color: #d8c9bd; background: #f6efe9; transform: translateX(2px); }
.doc-chip { transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.doc-chip:active { transform: translateX(2px) scale(0.99); }
.doc-chip svg { width: 16px; height: 16px; color: var(--red); flex-shrink: 0; }
.doc-chip .dt { flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.doc-chip .dm { font-size: 11.5px; color: var(--muted); }
.agenda-tools { display: flex; gap: 6px; align-items: flex-start; }
.icon-btn {
  background: none;
  border: none;
  color: var(--faint);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.icon-btn:hover { color: var(--text); background: var(--surface); }
.icon-btn svg { width: 15px; height: 15px; display: block; }

/* ==========================================================================
   Voting
   ========================================================================== */
/* The tally grows in from the left rather than appearing fully formed */
.vote-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #efe8e2;
  margin: 10px 0 6px;
  transform-origin: left center;
  animation: growX var(--dur-slow) var(--ease-out) both;
}
@keyframes growX {
  from { transform: scaleX(0); opacity: 0.4; }
  to { transform: scaleX(1); opacity: 1; }
}
.vote-bar .for { background: var(--green); }
.vote-bar .against { background: var(--red); }
.vote-bar .abstain { background: #c3c9d6; }
.vote-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.vote-legend b { color: var(--text); }
.vote-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.vote-choice {
  flex: 1;
  min-width: 110px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  padding: 12px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.vote-choice:hover { border-color: #c9cfdc; }
.vote-choice.sel-for { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.vote-choice.sel-against { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.vote-choice.sel-abstain { border-color: var(--muted); background: #eef0f4; color: var(--muted); }

/* ==========================================================================
   Messages
   ========================================================================== */
.post { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.post:last-child { border-bottom: none; }
.post .grow { flex: 1; min-width: 0; }
.post-head { display: flex; align-items: baseline; gap: 8px; }
.post-head .n { font-weight: 600; font-size: 13px; }
.post-head .t { color: var(--faint); font-size: 11.5px; }
.post-body { font-size: 13.5px; margin-top: 3px; white-space: pre-wrap; }

/* ==========================================================================
   Progress ring (small, tables)
   ========================================================================== */
.mini-track { height: 6px; background: #efe8e2; border-radius: 3px; overflow: hidden; min-width: 90px; }
.mini-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  transform-origin: left center;
  animation: growX var(--dur-slow) var(--ease-out) both;
}
.mini-fill.low { background: var(--amber); }
.mini-fill.zero { background: var(--red); }

.dot-yes { color: var(--green); font-weight: 700; }
.dot-view { color: var(--amber); font-weight: 700; }
.dot-no { color: #c7cdd9; }

.audit-action { font-weight: 700; font-size: 10.5px; letter-spacing: 0.6px; text-transform: uppercase; }
.audit-action.view, .audit-action.rsvp { color: var(--amber); }
.audit-action.login { color: var(--blue); }
.audit-action.login_failed, .audit-action.remove { color: var(--red); }
.audit-action.acknowledge, .audit-action.minutes_approved, .audit-action.vote { color: var(--green); }
.audit-action.upload, .audit-action.replace, .audit-action.agenda, .audit-action.minutes,
.audit-action.resolution, .audit-action.action, .audit-action.message, .audit-action.annotate { color: var(--muted); }

/* ==========================================================================
   Viewer
   ========================================================================== */
.viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 12, 5, 0.93);
  display: none;
  z-index: 70;
  flex-direction: column;
}
.viewer-overlay.open { display: flex; }
.viewer-bar {
  background: var(--ink);
  border-bottom: 3px solid transparent;
  border-image: var(--sunrise) 1;
  color: #fff;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.viewer-bar .vtitle { font-family: var(--serif); font-weight: 600; font-size: 15.5px; }
.viewer-bar .vsub { font-size: 11.5px; color: #c0a294; margin-top: 1px; }
.viewer-bar .vactions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.viewer-main { flex: 1; display: flex; overflow: hidden; }
.viewer-pages {
  flex: 1;
  overflow: auto;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.page-holder { position: relative; box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5); }
.page-holder canvas { display: block; max-width: 100%; height: auto; background: #fff; }
.page-holder.noting { cursor: crosshair; }
.ann-pin {
  position: absolute;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -100%);
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
}
.ann-pin svg { width: 100%; height: 100%; display: block; }

.notes-panel {
  width: 300px;
  flex-shrink: 0;
  background: #fff;
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.notes-panel .np-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.notes-panel .np-sub { font-size: 11px; color: var(--muted); font-weight: 500; }
.notes-list { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.note-card {
  background: #fffbeb;
  border: 1px solid #f1e3b0;
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.note-card:hover { border-color: #e3cf8a; }
.note-card .nc-meta { display: flex; justify-content: space-between; color: #9a8b55; font-size: 11px; margin-bottom: 3px; }
.note-card .nc-del { background: none; border: none; color: #b3a26a; cursor: pointer; font-size: 11px; padding: 0; }
.note-card .nc-del:hover { color: var(--red); }
.viewer-note { color: #c0a294; font-size: 11.5px; text-align: center; padding: 10px 16px 14px; }

/* Narrow screens: notes move below the pages rather than disappearing, so
   annotations stay usable on a tablet or phone. */
@media (max-width: 860px) {
  .viewer-main { flex-direction: column; }
  .notes-panel {
    width: 100%;
    max-height: 38vh;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .viewer-pages { padding: 16px 10px; }
  .viewer-bar { padding: 10px 14px; }
  .viewer-bar .vtitle { font-size: 14px; }
}

@media (max-width: 720px) {
  /* keep the title to one line so the bar does not eat the reading area */
  .viewer-bar > div:first-child { min-width: 0; flex: 1; }
  .viewer-bar .vtitle,
  .viewer-bar .vsub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .viewer-bar .vactions { gap: 6px; }
  .notes-panel { max-height: 30vh; }
  .viewer-note { padding: 8px 14px 10px; font-size: 11px; }
}

/* ==========================================================================
   Login
   ========================================================================== */
/* Rustenburg, photographed from above by the Trust, under a brand scrim.
   The card is centred in the viewport; the footer is lifted out of the flow
   so it cannot pull the card off centre. */
.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}
.login-page::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("/assets/rustenburg.jpg") center 42% / cover no-repeat;
  transform: scale(1.04);
}
/* Light enough that Rustenburg reads, dark enough for the footer text */
.login-page::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(34, 12, 5, 0.52) 0%, rgba(34, 12, 5, 0.3) 36%, rgba(30, 10, 4, 0.55) 76%, rgba(22, 7, 2, 0.82) 100%);
}
.login-card {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: var(--r-lg);
  border-top: 3px solid transparent;
  border-image: var(--sunrise) 1;
  padding: 34px 42px 30px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  /* Scale/fade only — never translate, so the card stays centred on every frame */
  animation: cardIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes cardIn {
  from { opacity: 0; transform: scale(0.975); }
  to { opacity: 1; transform: none; }
}
.login-card .logo { width: 100%; max-width: 240px; height: auto; display: block; margin: 0 auto 6px; }
.login-card .tagline { font-size: 10.5px; letter-spacing: 1.7px; text-transform: uppercase; color: var(--muted); font-weight: 700; text-align: center; }
.login-card .portal-line { color: var(--muted); font-size: 13.5px; margin: 20px 0 18px; line-height: 1.55; }
.login-card input {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 15px;
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-family: var(--mono);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgba(218, 33, 40, 0.14); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 14px; padding: 12px; font-size: 14px; }
.login-error { color: var(--red); font-size: 12.5px; margin-top: 10px; min-height: 18px; }
.demo-codes { margin-top: 20px; font-size: 12.5px; color: var(--muted); }
.demo-codes summary { cursor: pointer; font-weight: 600; color: var(--text); }
.demo-codes table { margin-top: 8px; border-collapse: collapse; width: 100%; }
.demo-codes td { padding: 4px 6px; border-bottom: 1px solid var(--surface); }
.demo-codes code { font-family: var(--mono); font-size: 11.5px; color: var(--red); }
.login-foot {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(680px, calc(100% - 48px));
  text-align: center;
  color: rgba(255, 235, 225, 0.62);
  font-size: 11.5px;
  line-height: 1.6;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  z-index: 1;
}
/* On short screens the footer would collide with the card — let it flow instead */
@media (max-height: 680px) {
  .login-foot { position: static; transform: none; width: auto; margin-top: 18px; }
  .login-page { padding-bottom: 32px; }
}

/* ==========================================================================
   Responsive shell
   ========================================================================== */
/* --- Collapsible sidebar --------------------------------------------------
   Driven by body[data-nav], which app.js sets from the saved preference or
   the window width. Never width-only, so the rail is never a dead end where
   you cannot read the menu names. */
.nav-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 12px 0;
  padding: 8px 12px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: #b18f7d;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-toggle:hover { background: var(--ink-3); color: #fff; }
.nav-toggle svg { flex-shrink: 0; transition: transform 0.2s ease; }

.sidebar { transition: width 0.18s ease; }

body[data-nav="collapsed"] .sidebar { width: 64px; }
body[data-nav="collapsed"] .logo-block { padding: 10px 6px 8px; }
body[data-nav="collapsed"] .logo-block img { max-width: 46px; }
body[data-nav="collapsed"] .logo-sub,
body[data-nav="collapsed"] .nav-label,
body[data-nav="collapsed"] .nav-text,
body[data-nav="collapsed"] .sidebar-user .who,
body[data-nav="collapsed"] .demo-flag { display: none; }
body[data-nav="collapsed"] .nav-item { justify-content: center; padding: 11px 0; }
body[data-nav="collapsed"] .nav-badge { position: absolute; top: 4px; right: 8px; margin: 0; }
body[data-nav="collapsed"] .sidebar-user { justify-content: center; }
body[data-nav="collapsed"] .nav-toggle { justify-content: center; padding: 8px 0; margin: 10px 8px 0; }
body[data-nav="collapsed"] .nav-toggle .chev { /* point the chevron outward */ }
body[data-nav="collapsed"] .nav-toggle svg { transform: rotate(180deg); }

.nav-item { position: relative; }

@media (max-width: 980px) {
  .content { padding: 22px 20px 64px; }
  .page-title { font-size: 24px; }
  .slab { padding: 22px 22px 24px; gap: 20px; }
}

/* --- Phone: top bar for identity, bottom tab bar for navigation -----------
   Also catches a phone forced into "Desktop site" mode, which reports a
   ~980px layout viewport but still has a coarse pointer. */
@media (max-width: 720px), (pointer: coarse) and (max-width: 1024px) {
  .shell { display: block; }
  .nav-toggle { display: none; }
  /* the collapse state is irrelevant once navigation moves to the tab bar */
  body[data-nav="collapsed"] .sidebar { width: auto; }
  body[data-nav="collapsed"] .nav-text { display: block; }
  body[data-nav="collapsed"] .demo-flag { display: block; }
  body[data-nav="collapsed"] .nav-item { padding: 7px 2px; }

  .sidebar {
    position: fixed;
    inset: 0 0 auto 0;
    width: auto;
    height: 54px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 12px;
    z-index: 40;
    background: linear-gradient(90deg, var(--ink) 0%, #3a1409 100%);
    border-bottom: 3px solid transparent;
    border-image: var(--sunrise) 1;
  }
  /* the wordmark keeps its own white plate so brand colours survive */
  .logo-block {
    padding: 4px 8px;
    border: none;
    border-radius: 6px;
    background: #fff;
    flex-shrink: 0;
  }
  .logo-block img { max-width: 92px; }
  .sidebar-user { border-top: none; padding: 0; gap: 8px; flex-shrink: 0; }
  .demo-flag {
    display: block;
    margin: 0;
    padding: 3px 8px;
    font-size: 8px;
    letter-spacing: 0.7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav {
    position: fixed;
    inset: auto 0 0 0;
    display: flex;
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
    background: var(--ink);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 40;
    overflow: visible;
  }
  .nav-item {
    flex: 1;
    flex-direction: column;
    gap: 3px;
    padding: 7px 2px;
    margin: 0;
    min-width: 0;
  }
  .nav-item span.nav-text {
    display: block;
    font-size: 9px;
    letter-spacing: 0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .nav-item.active { background: transparent; box-shadow: none; color: var(--gold); }
  .nav-badge { top: 2px; right: 50%; margin-right: -22px; }

  .main { padding-top: 54px; }
  .content { padding: 18px 14px 88px; max-width: none; }

  .page-title { font-size: 21px; }
  .page-head { margin-bottom: 16px; }
  .slab { padding: 18px 18px 20px; gap: 16px; border-radius: var(--r-md); }
  .slab h2 { font-size: 19px; }
  .slab .meta { gap: 10px; font-size: 12.5px; }
  .countdown-box { padding: 0; text-align: left; }
  .countdown-box .num { font-size: 30px; }
  .card-pad, .card-head { padding-left: 14px; padding-right: 14px; }
  .row-item { padding: 12px 14px; gap: 10px; }
  .modal { max-height: 92vh; }
  .modal-head { padding: 14px 16px 0; }
  .modal-body { padding: 14px 16px 18px; }
  .toast { left: 14px; right: 14px; bottom: 74px; max-width: none; }
}

/* Shown only when the app detects a phone rendering the desktop layout */
.dt-hint {
  position: fixed;
  left: 12px;
  right: 12px;
  top: 62px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  background: #fff8e6;
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.dt-hint span { flex: 1; min-width: 220px; }
.dt-hint button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: var(--r-sm);
  padding: 9px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.dt-hint button:hover { background: var(--surface); }

/* --- A phone in Chrome's "Desktop site" mode ------------------------------
   The layout viewport is ~980px while the screen is a third of that, so the
   browser scales the whole page down and everything reads tiny. Single
   column and larger type keep it usable until Desktop site is switched off. */
@media (pointer: coarse) and (min-width: 721px) and (max-width: 1024px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .content { padding-left: 20px; padding-right: 20px; }

  body { font-size: 17px; }
  .page-title { font-size: 30px; }
  .page-sub { font-size: 16px; }
  .section-label { font-size: 14px; }
  .card-head h3 { font-size: 18px; }
  .row-title { font-size: 17px; }
  .row-sub { font-size: 15px; }
  .slab h2 { font-size: 27px; }
  .slab .meta { font-size: 16px; }
  .slab .eyebrow { font-size: 13px; }
  .countdown-box .num { font-size: 44px; }
  .countdown-box .lbl { font-size: 12px; }
  .ring-text { font-size: 15px; }
  .stat-tile .v { font-size: 34px; }
  .stat-tile .k { font-size: 14px; }
  .btn { font-size: 16px; padding: 11px 18px; }
  .btn.sm { font-size: 15px; padding: 9px 15px; }
  .link-btn { font-size: 16px; }
  .pill { font-size: 13px; padding: 4px 11px; }
  .tab { font-size: 16px; padding: 12px 18px; }
  .agenda-title { font-size: 17px; }
  .agenda-meta { font-size: 15px; }
  .agenda-no { font-size: 20px; width: 30px; }
  .agenda-time { font-size: 14px; width: 72px; }
  .doc-chip .dt { font-size: 15px; }
  .post-body { font-size: 16px; }
  table.data { font-size: 15px; }
  table.data th { font-size: 13px; }
  .field label { font-size: 14px; }
  .nav-item .nav-text { font-size: 12px; }
  .empty .t { font-size: 17px; }
  .empty .s { font-size: 15px; }
}

/* --- Small phones: let dense rows wrap instead of squeezing --------------- */
@media (max-width: 560px) {
  .row-item { flex-wrap: wrap; }
  .row-item .grow { flex-basis: 100%; }
  .row-item > svg:last-child { display: none; }   /* decorative chevrons */
  .doc-actions, .agenda-tools { width: 100%; justify-content: flex-end; }
  .agenda-item { gap: 10px; padding: 14px; }
  .agenda-no { width: 18px; font-size: 15px; }
  .agenda-time { width: 46px; font-size: 11px; }
  .stat-tile { min-width: 120px; }
  .stat-tile .v { font-size: 24px; }
  .vote-choice { min-width: 0; }
  .tabs { gap: 0; }
  .tab { padding: 10px 12px; font-size: 13px; }
}

/* --- Touch: no tap target smaller than 36px ------------------------------- */
@media (pointer: coarse) {
  .btn.sm { min-height: 36px; padding: 7px 13px; }
  .btn { min-height: 40px; }
  .icon-btn, .signout-btn { min-width: 36px; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .link-btn { min-height: 32px; }
  .field input, .field select, .field textarea { font-size: 16px; }  /* stops iOS zoom-on-focus */
  select { min-height: 36px; }
}
