/* ═══════════════════════════════════════════════════════════
   POLIS PUBLIC POLICY REGISTER — DESIGN SYSTEM
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --bg: #f5f4f0;
  --surface: #fff;
  --ink: #1a1d20;
  --muted: #6b7079;
  --line: #e8e6df;
  --line-dashed: #efede6;
  --accent-green: #d4f057;
  --accent-green-dark: #7fd99c;
  --adopt: #3d8b54;
  --adopt-bg: #e8f5e1;
  --adopt-text: #2d6b3f;
  --amend: #c4861f;
  --amend-bg: #fef0d4;
  --amend-text: #8a5a14;
  --reject: #c44545;
  --reject-bg: #fde0dd;
  --reject-text: #9b2c2c;
  --sidebar-bg: #1a1d20;
  --sidebar-hover: #26292d;
  --sidebar-muted: #6b7079;
  --sidebar-border: #2f3338;
  --shadow-card: 0 8px 28px rgba(26,29,32,.06);
  --shadow-subtle: 0 1px 2px rgba(0,0,0,.04);
  --radius-hero: 24px;
  --radius-pill: 20px;
  --radius-card: 18px;
  --radius-stat: 16px;
  --radius-search: 14px;
  --radius-chip: 12px;
  --radius-btn: 10px;
  --radius-brand: 9px;
  --radius-nav: 8px;
  --ease-out: cubic-bezier(.22,1,.36,1);
  --ease-in-out: cubic-bezier(.4,0,.2,1);
  --dur-fast: .15s;
  --dur-normal: .2s;
  --dur-slow: .3s;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ── Shell Layout ───────────────────────────────────────── */
.shell {
  width: 1440px;
  margin: 0 auto;
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}
.login-shell {
  width: 1440px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: 248px;
  background: var(--sidebar-bg);
  color: #cfd0d1;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-720px);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  z-index: 100;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; }
.brand-mark {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-green-dark));
  border-radius: var(--radius-brand);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); font-weight: 700; font-size: 13px;
}
.brand-mark-lg { width: 56px; height: 56px; font-size: 24px; border-radius: 14px; }
.brand-name { color: #fff; font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.brand-name small { display: block; color: var(--sidebar-muted); font-weight: 400; font-size: 11px; margin-top: 1px; }

.side-search { margin-bottom: 14px; position: relative; }
.side-search input {
  width: 100%; background: var(--sidebar-hover);
  border: 1px solid var(--sidebar-border); color: #fff;
  padding: 8px 10px 8px 32px; border-radius: var(--radius-nav);
  font-size: 12px; outline: none;
}
.side-search input::placeholder { color: var(--sidebar-muted); }
.side-search input:focus { border-color: #444; }
.side-search svg { position: absolute; left: 10px; top: 9px; width: 13px; height: 13px; color: var(--sidebar-muted); }

.side-nav { flex: 1; overflow-y: auto; }
.side-nav::-webkit-scrollbar { width: 0; }
.side-label {
  font-size: 10px; color: var(--sidebar-muted); text-transform: uppercase;
  letter-spacing: .08em; padding: 14px 8px 8px; font-weight: 600;
}
.side-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius-nav); color: #9ca0a6; font-size: 13px;
  cursor: pointer; font-weight: 500; transition: background var(--dur-fast) var(--ease-out);
}
.side-item:hover { background: var(--sidebar-hover); color: #fff; }
.side-item.active { background: var(--sidebar-hover); color: #fff; }
.side-item.active::before {
  content: ""; width: 3px; height: 14px;
  background: var(--accent-green); border-radius: 2px;
  margin-left: -7px; margin-right: 7px;
}
.side-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.side-item .num { margin-left: auto; font-size: 11px; color: var(--sidebar-muted); font-family: 'JetBrains Mono', monospace; }
.side-item.active .num { color: var(--accent-green); }

.side-footer {
  padding: 14px 10px; border-top: 1px solid var(--sidebar-hover);
  display: flex; align-items: center; gap: 10px;
}
.s-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-green-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--ink); flex-shrink: 0;
}
.s-name { font-size: 13px; color: #fff; font-weight: 500; }
.s-name small { display: block; color: var(--sidebar-muted); font-weight: 400; font-size: 11px; }
.side-logout svg { width: 16px; height: 16px; color: #9ca0a6; }
.side-logout:hover svg { color: #fff; }

/* ── Main Content ───────────────────────────────────────── */
.main {
  margin-left: 248px; flex: 1; width: 1192px;
  padding: 24px 32px 48px;
}

/* ── Top Bar ────────────────────────────────────────────── */
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.crumbs .sep { color: #c5c3bb; }
.crumbs .now { color: var(--ink); font-weight: 500; }
.crumb-link { cursor: pointer; transition: color var(--dur-fast); }
.crumb-link:hover { color: var(--ink); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tool {
  width: 34px; height: 34px; border-radius: var(--radius-btn);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); position: relative;
  transition: background var(--dur-fast);
}
.tool:hover { background: #fafaf7; }
.tool svg { width: 15px; height: 15px; }
.tool .dot {
  position: absolute; top: 8px; right: 8px;
  width: 6px; height: 6px; background: var(--accent-green);
  border-radius: 50%; border: 1.5px solid var(--surface);
}

/* ── Hero ───────────────────────────────────────────────── */
.hero {
  background: var(--ink); color: #fff; border-radius: var(--radius-hero);
  padding: 36px 40px; margin-bottom: 24px; position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -100px; top: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(212,240,87,.18) 0%, transparent 70%);
  animation: orbPulse 6s ease-in-out infinite alternate;
}
@keyframes orbPulse {
  0% { opacity: .7; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.08); }
}
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius-pill);
  font-size: 11px; color: #cfd0d1; margin-bottom: 18px; font-weight: 500;
}
.hero-tag .live {
  width: 6px; height: 6px; background: var(--accent-green); border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.hero h1 {
  font-family: 'Instrument Serif', serif; font-weight: 400;
  font-size: 48px; line-height: 1.05; letter-spacing: -.02em;
  margin-bottom: 14px; max-width: 680px; position: relative; z-index: 2;
}
.hero h1 em { font-style: italic; color: var(--accent-green); }
.hero p {
  font-size: 15px; color: #9ca0a6; max-width: 560px;
  line-height: 1.55; margin-bottom: 24px; position: relative; z-index: 2;
}
.hero-search {
  display: flex; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-search);
  padding: 6px; max-width: 600px; backdrop-filter: blur(10px);
  position: relative; z-index: 2;
}
.hero-search input {
  flex: 1; background: transparent; border: none; outline: none;
  color: #fff; font-size: 14px; padding: 10px 12px;
}
.hero-search input::placeholder { color: var(--sidebar-muted); }
.hero-search button {
  background: var(--accent-green); color: var(--ink); border: none;
  padding: 9px 18px; border-radius: var(--radius-brand);
  font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px;
  transition: transform var(--dur-fast);
}
.hero-search button:hover { transform: scale(1.02); }
.hero-chips {
  display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap;
  position: relative; z-index: 2;
}
.hero-chip {
  font-size: 12px; padding: 5px 11px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px; color: #cfd0d1; cursor: pointer;
  transition: background var(--dur-fast);
}
.hero-chip:hover { background: rgba(255,255,255,.1); }

/* ── Stats Strip ────────────────────────────────────────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-stat); padding: 18px 20px;
}
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.stat-icon {
  width: 32px; height: 32px; border-radius: var(--radius-btn);
  background: var(--bg); display: flex; align-items: center; justify-content: center;
  color: var(--ink);
}
.stat-icon svg { width: 15px; height: 15px; }
.stat-trend {
  font-size: 11px; color: var(--adopt); background: var(--adopt-bg);
  padding: 2px 8px; border-radius: var(--radius-chip); font-weight: 600;
  display: inline-flex; align-items: center; gap: 3px;
}
.stat-trend.flat { color: var(--muted); background: var(--bg); }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.stat-value {
  font-family: 'Instrument Serif', serif; font-size: 38px; font-weight: 400;
  line-height: 1; letter-spacing: -.02em; color: var(--ink);
}
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 8px; font-family: 'JetBrains Mono', monospace; }

/* ── Section Header ─────────────────────────────────────── */
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 18px; }
.section-head h2 {
  font-family: 'Instrument Serif', serif; font-weight: 400;
  font-size: 28px; letter-spacing: -.01em;
}
.section-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ── View Toggle ────────────────────────────────────────── */
.view-toggle {
  display: flex; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-btn); padding: 3px;
}
.view-toggle button {
  background: transparent; border: none; padding: 6px 12px;
  border-radius: 7px; font-size: 12px; color: var(--muted);
  font-weight: 500; display: flex; align-items: center; gap: 6px;
  transition: all var(--dur-fast);
}
.view-toggle button.on { background: var(--ink); color: #fff; }
.view-toggle button svg { width: 13px; height: 13px; }

/* ── Filters ────────────────────────────────────────────── */
.filters { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.fchip {
  padding: 7px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-pill); font-size: 12px; color: var(--ink);
  font-weight: 500; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  transition: background var(--dur-fast);
}
.fchip:hover { background: #fafaf7; }
.fchip svg { width: 11px; height: 11px; color: var(--muted); }
.fchip.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.fchip.dark svg { color: var(--accent-green); }
.fdivider { flex: 1; }
.sort-sel { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sort-sel select {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-pill); padding: 7px 28px 7px 12px;
  font-size: 12px; color: var(--ink); font-weight: 500; cursor: pointer;
  appearance: none; outline: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7079' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

/* ── Policy Cards ───────────────────────────────────────── */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pcard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 22px;
  cursor: pointer; transition: all var(--dur-normal) var(--ease-out);
}
.pcard:hover { box-shadow: var(--shadow-card); transform: translateY(-1px); }
.pcard.featured {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #fff 0%, #fafaf7 100%);
}
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.pc-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ptag {
  font-size: 11px; font-weight: 500; padding: 3px 9px;
  border-radius: var(--radius-chip); display: inline-flex;
  align-items: center; gap: 5px; letter-spacing: -.005em;
}
.ptag-adopt { background: var(--adopt-bg); color: var(--adopt-text); }
.ptag-adopt::before { content: ""; width: 5px; height: 5px; background: var(--adopt); border-radius: 50%; }
.ptag-amend { background: var(--amend-bg); color: var(--amend-text); }
.ptag-amend::before { content: ""; width: 5px; height: 5px; background: var(--amend); border-radius: 50%; }
.ptag-reject { background: var(--reject-bg); color: var(--reject-text); }
.ptag-reject::before { content: ""; width: 5px; height: 5px; background: var(--reject); border-radius: 50%; }
.ptag-area { background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.pc-id { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: #9ca0a6; }
.pc-title {
  font-family: 'Instrument Serif', serif; font-weight: 400;
  font-size: 24px; line-height: 1.2; letter-spacing: -.015em;
  margin: 6px 0 10px; color: var(--ink);
}
.featured .pc-title { font-size: 32px; max-width: 760px; }
.pc-desc { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 20px; }
.pc-meta-grid {
  display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 18px;
  padding-top: 18px; border-top: 1px solid var(--line-dashed); align-items: start;
}
.pc-mlabel {
  font-size: 10px; color: #9ca0a6; text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 6px; font-weight: 600;
}
.pc-mvalue { font-size: 13px; color: var(--ink); font-weight: 500; }
.pc-mvalue.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* Consensus bar */
.cbar { display: flex; height: 5px; border-radius: 3px; overflow: hidden; background: var(--bg); }
.cbar .a { background: var(--adopt); }
.cbar .b { background: var(--reject); }
.cbar .c { background: #c5c3bb; }
.cnum { display: flex; align-items: baseline; gap: 6px; margin-bottom: 8px; }
.cnum .big { font-family: 'Instrument Serif', serif; font-size: 24px; line-height: 1; color: var(--ink); }
.cnum .lbl { font-size: 11px; color: var(--muted); }
.cbreak { display: flex; gap: 14px; font-size: 10px; color: var(--muted); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }
.cbreak span b { color: var(--ink); font-weight: 500; }

.pc-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line-dashed);
}
.pc-audit { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pc-audit svg { width: 12px; height: 12px; }
.pc-arrow {
  width: 34px; height: 34px; border-radius: 50%; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); transition: all var(--dur-normal) var(--ease-out);
}
.pcard:hover .pc-arrow { background: var(--ink); color: var(--accent-green); transform: rotate(-45deg); }
.pc-arrow svg { width: 14px; height: 14px; }

/* ── Pagination ─────────────────────────────────────────── */
.pag { display: flex; justify-content: space-between; align-items: center; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.pag .info { font-size: 12px; color: var(--muted); }
.pag .info b { color: var(--ink); }
.pag-ctrl { display: flex; gap: 4px; align-items: center; }
.pag-btn {
  min-width: 34px; height: 34px; border-radius: var(--radius-btn);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 13px; color: var(--ink); font-weight: 500;
  transition: background var(--dur-fast);
}
.pag-btn:hover:not(:disabled) { background: #fafaf7; }
.pag-btn.on { background: var(--ink); color: var(--accent-green); border-color: var(--ink); }
.pag-btn:disabled { opacity: .4; cursor: default; }

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; font-size: 11px; color: var(--muted);
}
.footer a, .footer-link { color: var(--muted); margin-right: 16px; cursor: pointer; transition: color var(--dur-fast); }
.footer a:hover, .footer-link:hover { color: var(--ink); }

/* ── Login Screen ───────────────────────────────────────── */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 40px;
}
.login-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-hero); padding: 48px;
  max-width: 440px; width: 100%; text-align: center;
  box-shadow: var(--shadow-card);
  animation: fadeUp .4s var(--ease-out);
}
.login-brand { margin-bottom: 24px; }
.login-title {
  font-family: 'Instrument Serif', serif; font-size: 36px;
  font-weight: 400; margin-top: 16px; letter-spacing: -.02em;
}
.login-subtitle { color: var(--muted); font-size: 14px; margin-top: 4px; }
.login-divider { height: 1px; background: var(--line); margin: 24px 0; }
.login-desc { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 28px; }
.login-user-card {
  display: flex; align-items: center; gap: 14px; padding: 16px 20px;
  border: 1px solid var(--line); border-radius: var(--radius-card);
  cursor: pointer; transition: all var(--dur-normal) var(--ease-out);
  margin-bottom: 20px; text-align: left;
}
.login-user-card:hover { border-color: var(--accent-green); box-shadow: 0 0 0 2px rgba(212,240,87,.2); }
.login-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-green-dark));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; color: var(--ink); flex-shrink: 0;
}
.login-user-name { font-weight: 600; font-size: 15px; }
.login-user-role { color: var(--muted); font-size: 12px; margin-top: 2px; }
.login-btn {
  width: 100%; padding: 13px 24px; border: none;
  background: var(--ink); color: #fff; border-radius: var(--radius-btn);
  font-size: 14px; font-weight: 600;
  transition: all var(--dur-normal) var(--ease-out);
}
.login-btn:hover { background: #2a2d32; transform: translateY(-1px); }
.login-note { color: var(--muted); font-size: 11px; margin-top: 16px; }

/* ── Dropdown ───────────────────────────────────────────── */
.dropdown-menu {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-btn); box-shadow: var(--shadow-card);
  z-index: 1000; overflow: hidden;
  animation: fadeDown .15s var(--ease-out);
}
.dropdown-item {
  padding: 9px 14px; font-size: 13px; cursor: pointer;
  transition: background var(--dur-fast);
}
.dropdown-item:hover { background: var(--bg); }

/* ── Toast ──────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 9999; pointer-events: none;
}
.toast {
  background: var(--ink); color: #fff; padding: 12px 20px;
  border-radius: var(--radius-btn); font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transform: translateY(12px); opacity: 0;
  transition: all var(--dur-slow) var(--ease-out);
  pointer-events: auto;
}
.toast-visible { transform: translateY(0); opacity: 1; }
.toast-exit { transform: translateY(-8px); opacity: 0; }
.toast-info { border-left: 3px solid var(--accent-green); }

/* ── Policy Viewer ──────────────────────────────────────── */
.viewer-back { margin-bottom: 20px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; color: var(--muted);
  font-size: 13px; font-weight: 500; padding: 6px 0;
  transition: color var(--dur-fast);
}
.back-btn:hover { color: var(--ink); }
.back-btn svg { width: 15px; height: 15px; }

.viewer-header {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 28px 32px; margin-bottom: 20px;
}
.viewer-header-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.viewer-header-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.viewer-header-actions { display: flex; gap: 8px; }
.viewer-action-btn {
  width: 36px; height: 36px; border-radius: var(--radius-btn);
  background: var(--bg); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink); transition: all var(--dur-fast);
}
.viewer-action-btn:hover { background: var(--ink); color: var(--accent-green); border-color: var(--ink); }
.viewer-action-btn svg { width: 16px; height: 16px; }
.viewer-header-id {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--muted); margin-bottom: 8px;
}
.viewer-title {
  font-family: 'Instrument Serif', serif; font-weight: 400;
  font-size: 32px; line-height: 1.15; letter-spacing: -.02em; margin-bottom: 12px;
}
.viewer-desc { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 16px; }
.viewer-header-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.meta-sep { color: var(--line); }

.viewer-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

.viewer-text-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 28px 32px;
}
.viewer-text-title {
  font-family: 'Instrument Serif', serif; font-weight: 400;
  font-size: 22px; margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.viewer-section { margin-bottom: 4px; }
.viewer-section-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 0; cursor: pointer; border-bottom: 1px solid var(--line-dashed);
  transition: color var(--dur-fast);
}
.viewer-section-head:hover { color: var(--adopt); }
.viewer-section-head h3 { font-size: 15px; font-weight: 600; }
.section-toggle svg { width: 16px; height: 16px; color: var(--muted); transition: transform var(--dur-normal) var(--ease-out); }
.viewer-section-body {
  max-height: 0; overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease-in-out), padding var(--dur-slow) var(--ease-in-out);
  padding: 0 0;
}
.viewer-section-body.open { max-height: 600px; padding: 16px 0; }
.viewer-section-body p { font-size: 14px; line-height: 1.75; color: #3a3d42; }

.viewer-sidebar-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card); padding: 24px;
}
.sticky-sidebar { position: sticky; top: 24px; }
.sidebar-block { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line-dashed); }
.sidebar-block:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.sb-label {
  font-size: 10px; color: #9ca0a6; text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 10px; font-weight: 600;
}
.sb-value { font-size: 14px; font-weight: 500; color: var(--ink); }
.sb-notes { font-size: 13px; color: var(--muted); line-height: 1.6; }
.sb-audit-item {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink); margin-bottom: 8px;
}
.sb-audit-item:last-child { margin-bottom: 0; }
.sb-audit-item svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.sb-link {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--adopt); font-weight: 500;
  cursor: pointer; transition: opacity var(--dur-fast);
}
.sb-link:hover { opacity: .8; }
.sb-link svg { width: 14px; height: 14px; }
.sb-related-link {
  display: block; font-size: 13px; color: var(--adopt);
  font-weight: 500; cursor: pointer; transition: opacity var(--dur-fast);
}
.sb-related-link:hover { opacity: .8; }

/* Donut chart */
.donut-wrapper { position: relative; display: flex; justify-content: center; margin: 12px 0; }
.donut-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); text-align: center;
}
.donut-pct {
  font-family: 'Instrument Serif', serif; font-size: 28px;
  font-weight: 400; color: var(--ink);
}
.donut-arc { transition: stroke-dashoffset .8s var(--ease-out); }
.consensus-label {
  text-align: center; font-size: 12px; color: var(--muted);
  text-transform: capitalize; font-weight: 500;
}

/* Vote breakdown */
.vote-breakdown { margin-top: 4px; }
.vote-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--bg); margin-bottom: 10px; }
.vote-seg { transition: width var(--dur-slow) var(--ease-out); }
.vote-for { background: var(--adopt); }
.vote-against { background: var(--reject); }
.vote-abstain { background: #c5c3bb; }
.vote-counts { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.vote-count-item { display: flex; align-items: center; gap: 5px; }
.vote-count-item b { color: var(--ink); font-weight: 600; }
.vote-dot { width: 6px; height: 6px; border-radius: 50%; }
.vote-dot-for { background: var(--adopt); }
.vote-dot-against { background: var(--reject); }
.vote-dot-abstain { background: #c5c3bb; }
.vote-summary { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 40px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-card);
}
.empty-icon svg { width: 48px; height: 48px; color: var(--line); margin-bottom: 16px; }
.empty-title { font-family: 'Instrument Serif', serif; font-size: 22px; font-weight: 400; margin-bottom: 8px; }
.empty-msg { color: var(--muted); font-size: 14px; margin-bottom: 20px; }
.empty-action {
  background: var(--ink); color: #fff; border: none;
  padding: 10px 20px; border-radius: var(--radius-btn);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background var(--dur-fast);
}
.empty-action:hover { background: #2a2d32; }

/* ── Motion ─────────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-enter { animation: fadeUp .35s var(--ease-out); }
.page-content { min-height: calc(100vh - 100px); }

/* ── Topic Groups (By topic view) ──────────────────────── */
.topic-groups { display: flex; flex-direction: column; gap: 32px; }
.topic-group-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.topic-group-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: var(--radius-chip);
  margin-left: 8px;
}

/* ── Skeleton Loading ───────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg) 25%, #ece9e2 50%, var(--bg) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 6px;
}
