/* Dossier web UI. One stylesheet, no frameworks. Tokens first, then the
   shell (sidebar, top bar), then components, then the module pages. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --surface-3: #f2f4f7;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #101828;
  --text-2: #344054;
  --text-3: #475467;
  --muted: #667085;
  --faint: #98a2b3;

  --accent: #2952cc;
  --accent-hover: #1f40a8;
  --accent-soft: #eef2fd;
  --accent-border: #c7d4f8;
  --ring: 0 0 0 4px rgba(41, 82, 204, 0.16);

  --green: #067647;
  --green-bg: #ecfdf3;
  --green-border: #abefc6;
  --amber: #b54708;
  --amber-bg: #fffaeb;
  --amber-border: #fedf89;
  --red: #b42318;
  --red-bg: #fef3f2;
  --red-border: #fecdca;
  --blue: #175cd3;
  --blue-bg: #eff8ff;
  --blue-border: #b2ddff;
  --purple: #5925dc;
  --purple-bg: #f4f3ff;
  --purple-border: #d9d6fe;
  --gray-bg: #f2f4f7;
  --gray-border: #e4e7ec;

  --side-bg: #0f1728;
  --side-bg-2: #172238;
  --side-text: #cfd6e2;
  --side-muted: #8592a8;
  --side-active: #1f2c46;
  --side-border: rgba(255, 255, 255, 0.07);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Charter", "Cambria", "Georgia", "Times New Roman", serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03);
  --side-w: 256px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; color: var(--text); letter-spacing: -0.01em; }
p { margin: 0 0 0.75rem; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
code { background: var(--surface-3); border: 1px solid var(--border); border-radius: 5px; padding: 0.05em 0.35em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
::selection { background: #d6e0fb; }
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i.sm { width: 16px; height: 16px; vertical-align: -3px; }
.i.xs { width: 14px; height: 14px; vertical-align: -2px; }
.i.lg { width: 22px; height: 22px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ shell */

body.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--side-bg); color: var(--side-text); border-right: 1px solid #0b1220; overflow: hidden; }
.sidebar a { color: inherit; text-decoration: none; }
.side-top { padding: 18px 16px 10px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: #fff !important; letter-spacing: -0.01em; padding: 2px 6px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(140deg, #4c74f0 0%, #2448b8 100%); display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.brand-mark svg { width: 17px; height: 17px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--side-muted); letter-spacing: 0; margin-top: -2px; }

.switcher { position: relative; }
.switcher > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; background: var(--side-bg-2); border: 1px solid var(--side-border); cursor: pointer; }
.switcher > summary::-webkit-details-marker { display: none; }
.switcher > summary:hover { background: #1c2942; }
.switcher .case-avatar { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; font-weight: 650; font-size: 12px; color: #fff; background: #3b4b6b; flex: none; }
.switcher .case-name { flex: 1; min-width: 0; }
.switcher .case-name b { display: block; color: #fff; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switcher .case-name span { display: block; font-size: 11.5px; color: var(--side-muted); }
.switcher .i { color: var(--side-muted); }
.switcher-menu { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; color: var(--text); border-radius: 10px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); padding: 6px; z-index: 50; }
.switcher-menu a { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 7px; color: var(--text-2) !important; font-size: 13.5px; }
.switcher-menu a:hover { background: var(--surface-3); }
.switcher-menu a.current { font-weight: 600; color: var(--text) !important; }
.switcher-menu .sep { height: 1px; background: var(--border); margin: 6px 4px; }
.switcher-menu .case-avatar { width: 22px; height: 22px; font-size: 10.5px; border-radius: 6px; }
.switcher-menu .menu-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 6px 9px 4px; }

.side-nav { flex: 1; overflow-y: auto; padding: 6px 12px 16px; }
.nav-section { font-size: 11px; font-weight: 650; letter-spacing: 0.09em; text-transform: uppercase; color: var(--side-muted); padding: 18px 10px 7px; display: flex; align-items: center; gap: 8px; }
.nav-section small { font-weight: 500; letter-spacing: 0.02em; text-transform: none; color: #5d6a80; font-size: 11px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; margin: 1px 0; border-radius: 8px; color: var(--side-text); font-weight: 500; font-size: 13.75px; }
.nav-item .i { color: #8f9bb0; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }
.nav-item:hover .i { color: #c3cbd8; }
.nav-item.active { background: var(--side-active); color: #fff; }
.nav-item.active .i { color: #9db4ff; }
.nav-item.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #7d9bff; }
.nav-item .count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: #aab5c7; background: rgba(255, 255, 255, 0.07); padding: 1px 7px; border-radius: 999px; min-width: 22px; text-align: center; }
.nav-item .count.warn { background: rgba(253, 176, 34, 0.16); color: #fdc56b; }
.nav-item .count.bad { background: rgba(240, 68, 56, 0.18); color: #ff9a92; }
.nav-item .count.live { background: rgba(122, 90, 248, 0.22); color: #c4b5fd; }
.nav-sub { margin: 0 0 4px 21px; padding-left: 10px; border-left: 1px solid var(--side-border); }
.nav-sub .nav-item { font-size: 13px; padding: 6px 10px; }
.nav-sub .nav-item.active::before { display: none; }

.side-foot { border-top: 1px solid var(--side-border); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { display: block; color: var(--side-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot form { margin: 0; }
.side-foot button { background: none; border: 0; color: var(--side-muted); padding: 7px; border-radius: 7px; cursor: pointer; }
.side-foot button:hover { color: #fff; background: rgba(255, 255, 255, 0.07); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12px; color: #fff; background: #4f6bd8; flex: none; letter-spacing: 0.02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.agent { background: #7a5af8; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: 58px; display: flex; align-items: center; gap: 14px; padding: 0 28px; background: rgba(255, 255, 255, 0.92); backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { color: var(--faint); }
.crumbs .sep .i { width: 14px; height: 14px; vertical-align: -2px; }
.crumbs .here { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topsearch { position: relative; width: min(360px, 40vw); }
.topsearch .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.topsearch input { width: 100%; height: 36px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 40px 0 36px; font: inherit; font-size: 13.5px; color: var(--text); }
.topsearch input:focus { outline: none; border-color: var(--accent-border); background: #fff; box-shadow: var(--ring); }
.topsearch kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.nav-toggle, .nav-toggle-label { display: none; }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 72px; }
.content.wide { max-width: 1600px; }
.content.narrow { max-width: 860px; }

/* -------------------------------------------------------------- page head */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .titles { min-width: 0; }
.page-head h1 { font-size: 24px; font-weight: 650; line-height: 1.25; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin: 5px 0 0; font-size: 14px; }
.page-head .sub .dot-sep { margin: 0 6px; color: var(--faint); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- layout */

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack.tight { gap: 10px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.split.wide-aside { grid-template-columns: minmax(0, 1fr) 400px; }
.sticky { position: sticky; top: 78px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.strong { font-weight: 600; color: var(--text); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.hidden { display: none !important; }

/* ----------------------------------------------------------------- cards */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--muted); font-size: 13px; margin-top: 1px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 12px 16px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 12px 12px; display: flex; align-items: center; gap: 10px; }
.card > .table-wrap:last-child table tr:last-child td { border-bottom: 0; }
.card-section-title { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }

/* --------------------------------------------------------------- buttons */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); font: 600 13.5px/1 var(--font); cursor: pointer; box-shadow: var(--shadow-xs); white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn .i { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--red); border-color: var(--red-border); }
.btn.danger:hover { background: var(--red-bg); }
.btn.danger-solid { background: #d92d20; border-color: #d92d20; color: #fff; }
.btn.success { background: #079455; border-color: #079455; color: #fff; }
.btn.success:hover { background: #067647; }
.btn.ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-3); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; gap: 5px; }
.btn.sm .i { width: 15px; height: 15px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; border-radius: 6px; gap: 4px; }
.btn.xs .i { width: 13px; height: 13px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14.5px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
button.link:hover { text-decoration: underline; }
button.link.danger { color: var(--red); }
form.inline { display: inline; margin: 0; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.label .opt { font-weight: 400; color: var(--faint); }
.hint { font-size: 12.5px; color: var(--muted); }
.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text); font: 14px var(--font); box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; line-height: 1.55; resize: vertical; }
textarea.input.mono { font-family: var(--mono); font-size: 13px; }
textarea.input.serif { font-family: var(--serif); font-size: 15px; }
select.input { padding-right: 32px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus { outline: none; border-color: #8ea6ef; box-shadow: var(--ring); }
.input.sm { height: 32px; font-size: 13px; padding: 0 10px; }
select.input.sm { padding-right: 28px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice .box { display: block; border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px 14px; background: #fff; height: 100%; transition: border-color .12s, box-shadow .12s; }
.choice .box b { display: block; font-size: 13.5px; color: var(--text); }
.choice .box span { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.choice input:checked + .box { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.choice input:focus-visible + .box { box-shadow: var(--ring); }

/* ---------------------------------------------------------------- badges */

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--gray-border); background: var(--gray-bg); color: var(--text-2); line-height: 1; vertical-align: middle; }
.badge .i { width: 12px; height: 12px; stroke-width: 2.4; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.badge.amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.badge.red { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.badge.blue { background: var(--blue-bg); border-color: var(--blue-border); color: var(--blue); }
.badge.purple { background: var(--purple-bg); border-color: var(--purple-border); color: var(--purple); }
.badge.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge.outline { background: #fff; }
.badge.sm { height: 19px; font-size: 11px; padding: 0 6px; }
.badge.pulse .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.7); } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tag { display: inline-flex; vertical-align: middle; line-height: 1.5; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border); white-space: nowrap; }
.tag.counsel { background: #fff1f3; color: #c01048; border-color: #fecdd6; }
.tag.partner { background: #f0f9ff; color: #026aa2; border-color: #b9e6fe; }
.tag.own { background: #f9f5ff; color: #6941c6; border-color: #e9d7fe; }
.tag.work_product { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.kbd, kbd { display: inline-block; font: 600 11px/1 var(--mono); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; background: #fff; color: var(--text-3); }

/* ----------------------------------------------------------------- table */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 10px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th a { color: inherit; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-3); }
.table tr:hover td { background: #fbfcfd; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.tight, .table th.tight { width: 1%; white-space: nowrap; }
.table .title-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table .title-cell .t { min-width: 0; }
.table .title-cell .t > a, .table .title-cell .t > b { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 520px; }
.table .title-cell .t > a:hover { color: var(--accent); }
.table .title-cell .t > span { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 520px; }
.table tr.is-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 20px; }
.card > .table-wrap .table th:last-child, .card > .table-wrap .table td:last-child { padding-right: 20px; }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: 12px; }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: 12px; }

/* ------------------------------------------------------------ kind icons */

.kind { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; border: 1px solid transparent; }
.kind .i { width: 17px; height: 17px; }
.kind.sm { width: 26px; height: 26px; border-radius: 7px; }
.kind.sm .i { width: 14px; height: 14px; }
.kind.lg { width: 44px; height: 44px; border-radius: 11px; }
.kind.lg .i { width: 22px; height: 22px; }
.kind-email, .kind-mailbox { background: #eff4ff; color: #2952cc; border-color: #d6e0fb; }
.kind-chat_export, .kind-chat_message { background: #ecfdf3; color: #067647; border-color: #c4f0d6; }
.kind-document { background: #f4f3ff; color: #5925dc; border-color: #e0dcfe; }
.kind-sheet { background: #edfcf2; color: #087443; border-color: #c4f0d6; }
.kind-image { background: #fdf2fa; color: #c11574; border-color: #fbd3ec; }
.kind-log { background: #fffaeb; color: #b54708; border-color: #fde7b0; }
.kind-archive, .kind-dataset { background: #fdf6f0; color: #9c4221; border-color: #f6dcc7; }
.kind-binary { background: var(--surface-3); color: var(--muted); border-color: var(--border); }
.kind-draft { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }

/* ----------------------------------------------------------------- stats */

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow-xs); display: flex; gap: 14px; align-items: flex-start; text-decoration: none !important; color: inherit; transition: border-color .12s, box-shadow .12s; }
a.stat:hover { border-color: var(--accent-border); box-shadow: var(--shadow-sm); }
.stat .stat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-3); }
.stat .stat-icon.accent { background: var(--accent-soft); color: var(--accent); }
.stat .stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat .stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat .stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat .stat-icon.purple { background: var(--purple-bg); color: var(--purple); }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 650; color: var(--text); line-height: 1.2; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.meter { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; display: flex; margin-top: 8px; }
.meter > i { display: block; height: 100%; }
.meter > i.green { background: #17b26a; }
.meter > i.purple { background: #7a5af8; }
.meter > i.amber { background: #f79009; }
.meter > i.red { background: #f04438; }
.meter > i.gray { background: #d0d5dd; }

/* --------------------------------------------------------------- alerts */

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; border: 1px solid; margin-bottom: 18px; font-size: 13.5px; }
.alert .i { margin-top: 1px; }
.alert .body { flex: 1; min-width: 0; }
.alert .body b { display: block; margin-bottom: 2px; }
.alert.ok { background: var(--green-bg); border-color: var(--green-border); color: #085d3a; }
.alert.err { background: var(--red-bg); border-color: var(--red-border); color: #912018; }
.alert.warn { background: var(--amber-bg); border-color: var(--amber-border); color: #93370d; }
.alert.info { background: var(--blue-bg); border-color: var(--blue-border); color: #194185; }
.alert .close { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0; }
.alert .close:hover { opacity: 1; }
.secret { font-family: var(--mono); font-size: 13px; background: #fff; border: 1px dashed var(--amber-border); padding: 10px 12px; border-radius: 8px; word-break: break-all; color: var(--text); margin-top: 8px; display: flex; gap: 10px; align-items: center; }
.secret span { flex: 1; }

/* --------------------------------------------------------------- empty */

.empty { text-align: center; padding: 44px 24px; }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 14px; box-shadow: 0 0 0 8px var(--surface-2); }
.empty .empty-icon .i { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 18px; }
.empty .row { justify-content: center; }

/* ----------------------------------------------------------------- tabs */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .count { font-size: 11.5px; background: var(--surface-3); color: var(--text-3); border-radius: 999px; padding: 1px 7px; }
.tab.active .count { background: var(--accent-soft); color: var(--accent); }
.seg { display: inline-flex; background: var(--surface-3); padding: 3px; border-radius: 9px; gap: 2px; }
.seg a { padding: 5px 11px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.active { background: #fff; color: var(--text); box-shadow: var(--shadow-xs); }

/* ------------------------------------------------------------ lists/feed */

.list { margin: 0; padding: 0; list-style: none; }
.list > li, .list-row { display: flex; gap: 12px; align-items: flex-start; padding: 13px 20px; border-bottom: 1px solid var(--border); }
.list > li:last-child, .list-row:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; color: var(--text); display: block; }
.list a.title:hover { color: var(--accent); }
.list .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.feed { margin: 0; padding: 4px 0; list-style: none; }
.feed li { position: relative; display: flex; gap: 12px; padding: 10px 20px; font-size: 13.5px; color: var(--text-3); }
.feed li .avatar { margin-top: 1px; }
.feed li .grow { flex: 1; min-width: 0; }
.feed li .when { font-size: 12px; color: var(--faint); white-space: nowrap; }
.feed li a { color: var(--text-2); }
.feed li a:hover { color: var(--accent); }
.feed li.is-new::before { content: ""; position: absolute; left: 8px; top: 20px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 9px 14px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { display: flex; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.steps li:last-child { border-bottom: 0; }
.steps .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 13px; background: var(--surface-3); color: var(--text-3); flex: none; }
.steps li.done .num { background: var(--green-bg); color: var(--green); }
.steps .grow { flex: 1; }
.steps b { display: block; color: var(--text); }
.steps p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* ----------------------------------------------------------- pagination */

.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pager .row { gap: 6px; }

/* ------------------------------------------------------------- progress */

.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; display: flex; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .4s ease; }
.progress > i.green { background: #17b26a; }
.progress > i.red { background: #f04438; }
.progress > i.gray { background: #d0d5dd; }
.progress > i.active { background: repeating-linear-gradient(45deg, #9e77ed 0 8px, #b692f6 8px 16px); background-size: 200% 100%; animation: barber 1.2s linear infinite; }
@keyframes barber { to { background-position: -45px 0; } }
.progress.lg { height: 10px; }

/* ------------------------------------------------------------- dropzone */

.dropzone { position: relative; display: block; border: 2px dashed var(--border-strong); border-radius: 14px; background: var(--surface-2); padding: 40px 24px; text-align: center; transition: border-color .15s, background .15s; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { width: 54px; height: 54px; border-radius: 14px; display: inline-grid; place-items: center; background: #fff; border: 1px solid var(--border); color: var(--accent); box-shadow: var(--shadow-xs); margin-bottom: 14px; }
.dropzone .dz-icon .i { width: 26px; height: 26px; }
.dropzone h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.dropzone p { color: var(--muted); margin: 0 0 16px; }
.dropzone .row { justify-content: center; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .dz-or { color: var(--faint); font-size: 12.5px; }
.upload-list { margin-top: 18px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: #fff; max-height: 260px; overflow: auto; }
.upload-list div { display: flex; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.upload-list div:last-child { border-bottom: 0; }
.upload-list span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.upload-status { margin-top: 18px; text-align: left; }
.upload-status .row { justify-content: space-between; margin-bottom: 8px; font-size: 13px; color: var(--text-3); }

/* ------------------------------------------------------------- filters */

.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.filters .input-icon { flex: 1; min-width: 220px; }
.filters select.input { width: auto; min-width: 140px; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text-3); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-xs); }
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.chip .n { color: var(--faint); font-weight: 600; }
.chip.active .n { color: var(--accent); opacity: .7; }

/* ----------------------------------------------------- sources: item view */

.item-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.item-head .titles { flex: 1; min-width: 0; }
.item-head h1 { font-size: 22px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.item-head .sub { color: var(--muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13.5px; }
.email-head { border-bottom: 1px solid var(--border); padding: 16px 22px; font-size: 13.5px; }
.email-head .kv { grid-template-columns: 70px minmax(0, 1fr); gap: 5px 12px; }
.chunks { padding: 6px 0; }
.chunk { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 9px 22px; border-left: 3px solid transparent; }
.chunk:target, .chunk.hit { background: #fffbeb; border-left-color: #f5b83d; }
.chunk .loc { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; padding-top: 3px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chunk .loc a { color: var(--faint); }
.chunk .loc a:hover { color: var(--accent); }
.chunk .txt { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.chunk.quoted .txt { color: var(--muted); border-left: 2px solid var(--border-strong); padding-left: 12px; }
.chunks.serif .chunk .txt { font-family: var(--serif); font-size: 15.5px; }
.chunks.mono .chunk .txt { font-family: var(--mono); font-size: 12.5px; line-height: 1.55; }
mark, .hl { background: #fde68a; color: inherit; padding: 0 1px; border-radius: 2px; }
.preview-img { display: block; max-width: 100%; max-height: 640px; margin: 0 auto; border-radius: 8px; border: 1px solid var(--border); background: repeating-conic-gradient(#f2f4f7 0% 25%, #fff 0% 50%) 50% / 16px 16px; }
.chat { padding: 10px 22px 18px; display: flex; flex-direction: column; gap: 4px; }
.chat .msg { max-width: 78%; align-self: flex-start; background: var(--surface-3); border-radius: 12px 12px 12px 4px; padding: 7px 12px 6px; position: relative; }
.chat .msg.own { align-self: flex-end; background: #dcf8e6; border-radius: 12px 12px 4px 12px; }
.chat .msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 12.5px; font-style: italic; max-width: 90%; text-align: center; }
.chat .msg.hit, .chat .msg:target { box-shadow: 0 0 0 2px #f5b83d; }
.chat .msg .who { font-size: 12px; font-weight: 650; color: #087443; }
.chat .msg.own .who { color: #2952cc; }
.chat .msg .body { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 13.5px; }
.chat .msg .when { font-size: 11px; color: var(--faint); text-align: right; margin-top: 1px; }
.chat .msg .when a { color: var(--faint); }
.chat .day { align-self: center; font-size: 12px; font-weight: 600; color: var(--muted); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; margin: 10px 0 4px; }

/* -------------------------------------------------------- search, verify */

.searchbar { display: flex; gap: 10px; }
.searchbar .input-icon { flex: 1; }
.searchbar .input { height: 44px; font-size: 15px; border-radius: 10px; }
.searchbar .btn { height: 44px; }
.hits { list-style: none; margin: 0; padding: 0; }
.hit { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.hit:last-child { border-bottom: 0; }
.hit .grow { flex: 1; min-width: 0; }
.hit .hit-title { font-weight: 600; font-size: 14.5px; color: var(--text); }
.hit .hit-title:hover { color: var(--accent); }
.hit .hit-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hit .snip { margin-top: 8px; color: var(--text-3); font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; }
.hit .snip + .snip { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.hit .snip .loc { font-size: 11.5px; color: var(--faint); margin-right: 6px; }
.verdict { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: 12px; border: 1px solid; margin-bottom: 18px; }
.verdict .v-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.verdict h3 { font-size: 16px; margin-bottom: 3px; }
.verdict p { margin: 0; font-size: 13.5px; }
.verdict.ok { background: var(--green-bg); border-color: var(--green-border); color: #085d3a; }
.verdict.ok .v-icon { background: #d1fadf; color: var(--green); }
.verdict.warn { background: var(--amber-bg); border-color: var(--amber-border); color: #93370d; }
.verdict.warn .v-icon { background: #fef0c7; color: var(--amber); }
.verdict.bad { background: var(--red-bg); border-color: var(--red-border); color: #912018; }
.verdict.bad .v-icon { background: #fee4e2; color: var(--red); }
.verdict h3 { color: inherit; }
.quote-ctx { font-family: var(--serif); font-size: 15.5px; line-height: 1.65; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; overflow-wrap: anywhere; }
.quote-ctx mark { background: #d1fadf; color: #053321; padding: 1px 2px; }
.quote-ctx.fuzzy mark { background: #fef0c7; color: #4e1d09; }

/* ------------------------------------------------------- draft: the page */

.paper { background: #fff; border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12); padding: 40px 64px 52px 56px; min-height: 420px; }
.paper.empty-paper { display: grid; place-items: center; }
.doc { font-family: var(--serif); font-size: 16.5px; line-height: 1.68; color: #1d2433; max-width: 760px; margin: 0 auto; }
.doc .blk { position: relative; margin: 0 0 0.9em; padding: 2px 8px 2px 3.6em; border-radius: 4px; border-left: 3px solid transparent; scroll-margin-top: calc(74px + var(--pbar-h)); }
.doc .blk .lbl { position: absolute; left: 0; top: 2px; width: 3em; text-align: right; font-family: var(--font); font-size: 12.5px; font-weight: 600; color: var(--faint); padding-top: 0.3em; font-variant-numeric: tabular-nums; }
.doc .blk .lbl:hover { color: var(--accent); text-decoration: none; }
.doc .blk:hover { background: #fafbfc; }
.doc .blk:hover .lbl { color: var(--text-3); }
.doc .blk.sel { background: var(--accent-soft); border-left-color: var(--accent); }
.doc .blk.sel .lbl { color: var(--accent); }
.doc h2.blk { font-family: var(--font); font-size: 17px; font-weight: 700; margin-top: 1.6em; letter-spacing: -0.005em; }
.doc h3.blk { font-family: var(--font); font-size: 15.5px; font-weight: 650; margin-top: 1.2em; }
.doc h4.blk { font-family: var(--font); font-size: 14.5px; font-weight: 650; }
.doc h2.blk .lbl, .doc h3.blk .lbl { top: 3px; }
.doc > .blk:first-child, .doc > ul:first-child > li:first-child, .doc > ol:first-child > li:first-child { margin-top: 0 !important; }
.doc blockquote.blk { font-style: italic; color: #3d4556; }
.doc blockquote.blk::after { content: ""; position: absolute; left: 3.1em; top: 4px; bottom: 4px; width: 2px; background: var(--border-strong); }
.doc .cont { margin-left: 0; }
/* a numbered paragraph and the paragraphs that continue it are one paragraph: a line in the margin runs from its number through them */
.doc .blk.grp-lead::after, .doc .blk.grp::after { content: ""; position: absolute; left: 2.3em; width: 2px; border-radius: 1px; background: var(--border-strong); }
.doc .blk.grp-lead::after { top: 1.9em; bottom: -0.9em; }
.doc .blk.grp::after { top: -0.9em; bottom: -0.9em; }
.doc .blk.grp-end::after { bottom: 0.6em; }
.doc .blk .lbl.lbl-cont { top: 0; bottom: 0; padding: 0; }
.doc .blk.grp-sel { background: var(--accent-soft); }
.doc .blk.grp-sel::after, .doc .blk.sel.grp::after, .doc .blk.sel.grp-lead::after { background: var(--accent); }
/* live updates: notices of what others changed, the bar that offers a reload while typing, who else has the draft open */
.live-notes { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.live-note { display: block; pointer-events: auto; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12); font-size: 13px; line-height: 1.45; color: var(--text); transition: opacity 0.4s, transform 0.4s; }
a.live-note:hover { text-decoration: none; border-color: var(--accent-border); border-left-color: var(--accent); }
.live-note.out { opacity: 0; transform: translateY(6px); }
.live-bar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; width: max-content; max-width: calc(100vw - 32px); background: var(--text); color: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, 0.24); font-size: 13px; }
.presence { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-left: 12px; }
.presence[hidden] { display: none; }
.presence-label { color: var(--muted); }
.presence-chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; background: var(--green-bg); border: 1px solid var(--green-border); color: var(--green); font-size: 12px; font-weight: 600; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: #17b26a; }
.wb-num { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px 14px; border-bottom: 1px dashed var(--border); }
.wb-num form { margin: 0; }
.wb-num .on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.wb-num .on:disabled { opacity: 1; cursor: default; }
.doc ul, .doc ol { margin: 0 0 0.9em; padding: 0; list-style-position: inside; }
.doc li.blk { margin-bottom: 0.35em; }
.doc hr { margin: 1.6em 3.6em; }
.doc del { background: #fde4e1; color: #a1231a; text-decoration: line-through; text-decoration-thickness: 1px; border-radius: 2px; }
.doc ins { background: #dcfae6; color: #05603a; text-decoration: underline; text-decoration-color: #47cd89; text-underline-offset: 3px; border-radius: 2px; }
.doc .ref { font-weight: 600; }
.doc .ref.dangling { color: var(--red); }
/* an exhibit reference ([[E12]]): unknown or withdrawn as a dangling reference, one still to obtain in amber */
.doc .ref.exhibit.dangling { text-decoration: underline wavy; text-underline-offset: 3px; }
.doc .ref.exhibit.pending { color: var(--amber); }
/* a table in a draft: shown as a table (redline marks in its cells); the editor edits its Markdown */
.doc .tbl { overflow-x: auto; padding: 0.3em 0 0.2em; }
.doc table.dtable { border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.doc .dtable th, .doc .dtable td { border: 1px solid var(--border-strong); padding: 4px 10px; vertical-align: top; text-align: left; }
.doc .dtable th { font-family: var(--font); font-size: 13.5px; font-weight: 600; background: var(--surface-2); }
.doc .dtable .al-center { text-align: center; }
.doc .dtable .al-right { text-align: right; font-variant-numeric: tabular-nums; }
.redline-banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--accent-border); background: var(--accent-soft); color: #1d3a8a; border-radius: 10px; margin-bottom: 14px; font-size: 13.5px; }
.redline-banner .legend { display: inline-flex; gap: 8px; margin-left: auto; font-size: 12.5px; }
.redline-banner .legend del, .redline-banner .legend ins { padding: 0 4px; border-radius: 3px; }
.redline-banner .legend del { background: #fde4e1; color: #a1231a; }
.redline-banner .legend ins { background: #dcfae6; color: #05603a; text-decoration: none; }
.prop-list a.prop { display: flex; gap: 10px; align-items: flex-start; padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.prop-list a.prop:last-child { border-bottom: 0; }
.prop-list a.prop:hover { background: var(--surface-2); text-decoration: none; }
.prop-list a.prop.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.prop-list .seq { font-weight: 700; color: var(--text); font-size: 13px; min-width: 26px; }
.prop-list .grow { flex: 1; min-width: 0; }
.prop-list .msg { font-size: 13.5px; color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.prop-list .meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.thread { display: flex; flex-direction: column; gap: 12px; }
.thread .t-msg { display: flex; gap: 10px; }
.thread .t-msg .grow { flex: 1; min-width: 0; }
.thread .t-msg .t-meta { font-size: 12px; color: var(--muted); }
.thread .t-msg .t-meta b { color: var(--text); font-weight: 600; }
.thread .t-msg .t-body { margin-top: 3px; font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); padding: 8px 10px; border-radius: 4px 10px 10px 10px; }
.thread .t-msg.change_request .t-body { background: var(--amber-bg); border-color: var(--amber-border); }
.thread .t-msg.answer .t-body { background: var(--green-bg); border-color: var(--green-border); }
.thread .t-msg.system { font-size: 12.5px; color: var(--muted); align-items: center; }
.thread .t-msg.system .sys-dot { width: 24px; display: grid; place-items: center; color: var(--faint); }
.shortcuts { font-size: 12px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.diff-legend { display: inline-flex; gap: 8px; }
pre.code { white-space: pre-wrap; font: 12.5px/1.6 var(--mono); background: var(--surface-2); border: 1px solid var(--border); padding: 12px 14px; border-radius: 8px; margin: 0; overflow-wrap: anywhere; color: var(--text-2); }

/* ---------------------------------------------------------------- auth */

body.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; }
.auth-side { background: var(--side-bg); color: var(--side-text); padding: 48px 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -180px; bottom: -180px; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(76,116,240,.35), transparent 65%); }
.auth-side .brand { font-size: 18px; padding: 0; }
.auth-side .pitch { margin-top: auto; max-width: 440px; position: relative; z-index: 1; }
.auth-side .pitch h2 { color: #fff; font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -0.02em; margin-bottom: 14px; }
.auth-side .pitch p { color: #aab5c7; font-size: 15px; }
.auth-side .pillars { display: grid; gap: 14px; margin-top: 28px; }
.auth-side .pillar { display: flex; gap: 12px; align-items: flex-start; }
.auth-side .pillar .i { color: #9db4ff; margin-top: 2px; }
.auth-side .pillar b { color: #fff; display: block; font-weight: 600; }
.auth-side .pillar span { color: #95a1b5; font-size: 13.5px; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 26px; font-weight: 650; margin-bottom: 6px; letter-spacing: -0.02em; }
.auth-box .lead { color: var(--muted); margin-bottom: 26px; }
.auth-box .foot { margin-top: 22px; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------- responsive */

@media (max-width: 1280px) {
  .paper { padding: 40px 40px 48px 32px; }
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .split.wide-aside { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
}
@media (max-width: 860px) {
  body.app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; }
  .nav-toggle:checked ~ .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 40, .45); }
  .nav-toggle-label { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; color: var(--text-3); }
  .topbar { padding: 0 16px; }
  .topsearch { display: none; }
  .content { padding: 20px 16px 56px; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: minmax(0, 1fr); }
  body.auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .paper { padding: 24px 16px; }
  .chunk { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .chunk .loc { text-align: left; }
}

.date-file { color: var(--faint); }
input[type=search].input::-webkit-search-cancel-button { cursor: pointer; }
.cite { font-family: var(--mono); font-size: 0.9em; background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 5px; padding: 0 4px; color: var(--accent); white-space: nowrap; }
.cite:hover { text-decoration: none; background: #e0e8fc; }
.chip-row .spacer { min-width: 12px; }
/* how a person shows up: an address, a domain, a number, a chat name */
.hchip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 1px 8px; margin: 1px 3px 1px 0; border-radius: 999px; background: var(--surface-3); color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list.compact > li { padding-top: 8px; padding-bottom: 8px; }
.stat-row { display: flex; flex-wrap: wrap; gap: 12px 32px; margin-bottom: 14px; }
.stat-row > div { display: flex; flex-direction: column; min-width: 0; }
.stat-row b { font-size: 20px; font-weight: 650; color: var(--text); letter-spacing: -0.01em; }
.stat-row span { font-size: 12.5px; color: var(--muted); }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 6px 16px; }
/* finding people: search, tick, add */
.find-search { display: flex; gap: 8px; margin-bottom: 14px; max-width: 760px; }
.find-search .input { flex: 1; height: 42px; font-size: 15px; }
.find-search .btn { height: 42px; }
.domain-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.domain-row form { display: inline; margin: 0; }
.hchip.as-btn { border: 1px dashed var(--border-strong); background: #fff; cursor: pointer; font: inherit; font-size: 12px; }
.hchip.as-btn:hover { border-color: var(--accent); color: var(--accent); }
a.hchip:hover { text-decoration: none; color: var(--text); }
.find-table tr.is-match td { background: #fffdf2; }
.find-table td.tight input, .find-table th.tight input { width: 16px; height: 16px; }
.collect-bar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; border-top: 1px solid var(--border); background: rgba(255, 255, 255, 0.97); border-radius: 0 0 12px 12px; }
.collect-bar .check { font-size: 13px; }
.snippet { color: var(--text-3); margin-top: 2px; }
.snippet mark { background: #fff1c2; color: inherit; padding: 0 1px; border-radius: 2px; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; color: var(--text-3); }
/* a long chat: jump to a month */
.month-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 2px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.month-nav .yr { margin: 0 4px 0 12px; font-weight: 700; color: var(--text); }
.month-nav .yr:first-child { margin-left: 0; }
.month-nav a { padding: 2px 6px; border-radius: 6px; color: var(--text-3); }
.month-nav a:hover { background: var(--surface-3); text-decoration: none; }
.month-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.list form.row { gap: 6px; flex-wrap: nowrap; }
.list form.row select.input.sm { max-width: 170px; }

/* ------------------------------------------- draft: click to edit in place */

.doc .blk[data-select] { cursor: pointer; }
.doc .blk[data-select]:hover { background: #f5f8ff; }
.doc .blk.editing { background: #fff; border-left-color: var(--accent); padding-top: 6px; padding-bottom: 10px; cursor: default; }
.doc .blk.editing.after { margin-top: -0.5em; padding-left: 3.6em; }
.ie { font-family: var(--font); font-size: 14px; line-height: 1.5; }
.ie-text.input { font-family: var(--serif); font-size: 16.5px; line-height: 1.68; color: #1d2433; padding: 8px 12px; min-height: 0; resize: vertical; border-color: var(--accent-border); box-shadow: var(--ring); }
.ie-text.input.mono { font-family: var(--mono); font-size: 13.5px; line-height: 1.6; white-space: pre; overflow-x: auto; }
.ie-note { font-size: 12.5px; color: var(--blue); background: var(--blue-bg); border: 1px solid var(--blue-border); border-radius: 7px; padding: 5px 9px; margin-bottom: 8px; }
.ie-meta { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.ie-field { display: flex; flex-direction: column; gap: 4px; }
.ie-field > span { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ie-field em { font-style: normal; font-weight: 400; color: var(--faint); }
.ie-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ie-hint { font-size: 12px; color: var(--muted); max-width: 470px; }
.ie-hint kbd { font-size: 10px; padding: 2px 4px; }
@media (max-width: 860px) { .ie-meta { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------- draft: the review view */
/* The text in the middle. A changed paragraph carries its decisions in a bar
   under it (.chg-bar); the paragraph you click opens its work under it
   (.wb: comments, notes, sources). The proposals sit in the bar's switcher,
   and in a rail beside the text on wide screens. */

.review { display: grid; grid-template-columns: minmax(0, 920px) 300px; gap: 24px; align-items: start; justify-content: center; }
.review-main { min-width: 0; }
.doc { --gut: 59.4px; } /* 3.6em of the 16.5px text: where the text starts */
/* the height of the sticky bar (with its message), so a paragraph opened by
   its #fragment lands under it; the script measures it, this is the guess */
:root { --pbar-h: 96px; }

/* the bar: what is shown, where in it, and its decisions; it stays in view */
.pbar-wrap { position: sticky; top: 58px; z-index: 18; }
.pbar { position: relative; display: flex; align-items: center; gap: 8px 10px; min-height: 52px; padding: 7px 10px 7px 7px; background: rgba(255, 255, 255, 0.97); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.pbar > .who { padding: 0 8px; color: var(--text); }
.pbar .badges { display: inline-flex; gap: 6px; flex: none; }
.pbar .badges:empty { display: none; }
.pbar .acts { display: flex; gap: 6px; align-items: center; flex: none; }
.pbar .acts form, .pbar-flash form, .chg-bar form, .decide form { margin: 0; }
.pswitch { min-width: 0; flex: 0 1 auto; }
.pbar .who-btn { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; list-style: none; }
.pbar .who-btn::-webkit-details-marker { display: none; }
.pbar .who-btn:hover, .pswitch[open] .who-btn { background: var(--surface-3); border-color: var(--border); }
.pbar .who-btn .seq { font-weight: 700; color: var(--text); flex: none; }
.pbar .who-btn .msg { min-width: 0; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbar .who-btn .i { color: var(--muted); flex: none; }
.pnav { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; flex: none; }
.pnav summary { padding: 5px 8px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.pnav summary:hover, .pnav details[open] summary { background: var(--surface-3); color: var(--text); }
.pnav > a { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; color: var(--text-3); }
.pnav > a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }

.menu { position: relative; display: inline-block; margin: 0; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 240px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; }
.menu-pop a, .menu-pop button.item { display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 7px; font: 500 13px/1.35 var(--font); color: var(--text-2); background: none; border: 0; cursor: pointer; text-align: left; white-space: normal; }
.menu-pop a:hover, .menu-pop button.item:hover { background: var(--surface-3); text-decoration: none; }
.menu-pop form.inline { display: block; }
.pswitch .menu-pop { left: 0; right: auto; }
.pswitch .menu-pop { width: 400px; max-height: min(70vh, 560px); overflow-y: auto; }
.pnav .menu-pop { width: 360px; max-height: 60vh; overflow-y: auto; }
/* the list of changes hangs from the bar's right edge, wherever the step sits */
.pnav > details.menu { position: static; }
.pnav .menu-pop { left: auto; right: 0; top: 100%; }
.pnav .menu-pop a b { min-width: 36px; color: var(--text); }

/* a proposal in the switcher and in the rail */
.menu-pop a.p-row, .rail-list a.p-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 2px 6px; align-items: start; }
.p-row { padding: 8px 10px; border-radius: 8px; color: var(--text-2); }
.p-row:hover { background: var(--surface-2); text-decoration: none; }
.p-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.p-row .seq { font-weight: 700; color: var(--text); font-size: 13px; }
.p-row .msg { font-weight: 500; color: var(--text); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.p-row .meta { grid-column: 2; font-size: 11.5px; color: var(--muted); display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.p-closed > summary { padding: 8px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.p-closed > summary:hover { color: var(--text); }

/* a message in the bar, in view wherever the page was scrolled to */
.pbar-flash { display: flex; align-items: center; gap: 10px; padding: 7px 10px 7px 14px; font-size: 13px; background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); border-top: 0; }
.pbar-flash.err { background: var(--red-bg); color: var(--red); border-color: var(--red-border); }
.pbar-flash { flex-wrap: wrap; }
.pbar-flash .grow { flex: 1 1 220px; min-width: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pbar-flash .x { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: inherit; opacity: 0.75; }
.pbar-flash .x:hover { opacity: 1; background: rgba(16, 24, 40, 0.06); text-decoration: none; }

/* the cover of the proposal: who, on which version, why */
.p-head { display: flex; gap: 8px 14px; align-items: center; flex-wrap: wrap; padding: 10px 16px; font-size: 13px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-top: 0; }
.p-head .basis { color: var(--text-2); }
.p-head .legend { display: inline-flex; gap: 6px; margin-left: auto; font-size: 12px; }
.p-head .legend del { background: #fde4e1; color: #a1231a; padding: 0 4px; border-radius: 3px; }
.p-head .legend ins { background: #dcfae6; color: #05603a; padding: 0 4px; border-radius: 3px; text-decoration: none; }
.p-head.hint { gap: 6px; }
.p-alert { flex-basis: 100%; display: flex; gap: 6px; align-items: center; font-size: 12.5px; padding: 6px 10px; border-radius: 7px; background: var(--blue-bg); border: 1px solid var(--blue-border); color: var(--blue); }
.p-alert.amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }

.review-main .paper { border-top: 0; border-radius: 0 0 8px 8px; padding: 36px 48px 48px 40px; }
.review-main .paper.solo { border-top: 1px solid var(--border); border-radius: 8px; }
.review-main > .paper:first-child { border-top: 1px solid var(--border); border-radius: 8px; }
.doc .blk:target { animation: blk-flash 2.4s ease-out 1; }
@keyframes blk-flash { from { background-color: #fff1c2; } }

/* a changed paragraph: a stripe beside it, its bar under it */
.doc .blk.chg::before { content: ""; position: absolute; left: 3.1em; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: #84adff; }
.doc .blk.chg-added::before { background: #47cd89; }
.doc .blk.chg-removed::before { background: #f97066; }
.doc .blk.chg-accepted::before { background: #abefc6; }
.doc .blk.chg.sel::before { display: none; }
.chg-bar { display: flex; align-items: center; gap: 6px 8px; flex-wrap: wrap; margin: -0.3em 8px 1.2em calc(var(--gut) + 3px); padding: 5px 6px 5px 10px; font: 12.5px/1.4 var(--font); font-style: normal; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; cursor: auto; }
.chg-bar .what { flex: 1 1 220px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chg-bar .what b { color: var(--text); font-weight: 600; }
.chg-bar .talk, .chg-bar .done { display: inline-flex; gap: 4px; align-items: center; color: var(--muted); white-space: nowrap; }
.chg-bar .talk:hover { color: var(--text); text-decoration: none; }
.chg-bar .done { color: var(--green); font-weight: 600; }
.chg-bar .chg-marks { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chg-bar .acts { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.chg-bar .acts:empty { display: none; }
.chg-bar.is-focused { border-color: var(--accent); box-shadow: var(--ring); background: #fff; }
.chg-bar.accepted { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.chg-bar.requested { background: var(--amber-bg); border-color: var(--amber-border); }

/* what a paragraph carries: decisions, notes, comments, quotations to check */
.blk-marks { display: flex; flex-wrap: wrap; gap: 4px 6px; margin: -0.5em 8px 1em calc(var(--gut) + 3px); font: 12px/1.4 var(--font); font-style: normal; }
.mk { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px; border: 1px solid var(--gray-border); background: var(--gray-bg); color: var(--text-3); font: 500 11.5px/1 var(--font); white-space: nowrap; }
.mk:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.mk .i { width: 12px; height: 12px; }
.mk.amber { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.mk.red { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.mk.green { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }
.mk.blue { background: var(--blue-bg); border-color: var(--blue-border); color: var(--blue); }
.mk.purple { background: var(--purple-bg); border-color: var(--purple-border); color: var(--purple); }

/* "Show all notes": every paragraph's notes and comments under it, read only */
.annot { display: flex; flex-direction: column; gap: 2px; margin: -0.4em 8px 1em calc(var(--gut) + 3px); padding: 3px 0 3px 12px; border-left: 2px solid var(--amber-border); font: 12.5px/1.5 var(--font); font-style: normal; }
.annot > div { color: var(--text-3); overflow-wrap: anywhere; }
.annot > div > a { color: var(--text-3); }
.annot > div > a:hover { color: var(--text); }
.annot b { color: var(--text-2); font-weight: 600; }

/* inside a list item the boxes start at the text, not at the gutter */
.doc li.blk > .chg-bar, .doc li.blk > .blk-marks, .doc li.blk > .annot { margin-left: 0; margin-right: 0; margin-top: 6px; }
.doc li.blk > .blk.editing.after { padding-left: 0; }

/* the work on the selected paragraph, right under it */
.wb { margin: 4px -20px 1.4em; border: 1px solid var(--accent-border); border-radius: 12px; background: #fff; box-shadow: 0 8px 24px -14px rgba(16, 24, 40, 0.28), 0 1px 2px rgba(16, 24, 40, 0.05); font: 14px/1.5 var(--font); font-style: normal; color: var(--text-2); cursor: auto; scroll-margin-top: calc(74px + var(--pbar-h)); }
.doc li.blk > .wb { margin: 8px -28px 0.6em calc(-1 * var(--gut) - 23px); }
.wb-head { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; padding: 4px 8px 0 14px; border-bottom: 1px solid var(--border); background: linear-gradient(#f7f9ff, #fff); border-radius: 12px 12px 0 0; }
.wb-title { display: inline-flex; align-items: center; gap: 6px; padding: 8px 0 9px; font-size: 13px; font-weight: 650; color: var(--text); }
.wb-title .i { color: var(--accent); }
.wb-tabs { display: flex; gap: 2px; align-self: flex-end; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.wb-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px 9px; margin-bottom: -1px; border-bottom: 2px solid transparent; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.wb-tabs a:hover { color: var(--text); text-decoration: none; }
.wb-tabs a.amber { color: var(--amber); }
.wb-tabs a[aria-current] { color: var(--accent); border-bottom-color: var(--accent); }
.wb-tabs .n { font-size: 11px; font-weight: 600; background: var(--surface-3); color: var(--text-3); border-radius: 999px; padding: 1px 6px; }
.wb-tabs .dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.wb-tabs .dot.amber { background: #f79009; }
.wb-tabs .dot.red { background: #f04438; }
.wb-tabs .dot.green { background: #17b26a; }
.wb-end { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--faint); }
.wb-close { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--text-3); }
.wb-close:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.wb-pane { padding: 14px 16px 16px; }
.wb-pane[hidden] { display: none; }
.wb-label { margin: 0 0 8px; font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.wb-scroll { max-height: 340px; overflow-y: auto; margin-bottom: 12px; padding-right: 4px; }
.wb-form { margin-top: 6px; }
.wb-form textarea.input { min-height: 0; resize: vertical; }
.wb-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.wb-actions .hint { font-size: 12px; color: var(--muted); }
.decide { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.decide .decide-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.decide .decide-btn.on:disabled { opacity: 1; cursor: default; }

/* the discussion of the proposal and the notes left without a paragraph */
.card.discussion { margin-top: 18px; }
.card.discussion .wb-form { margin-top: 14px; }
.thread .t-msg.oneline { align-items: center; }

/* the full text */
.paper.fulltext { padding: 20px 24px 24px; min-height: 0; }
.fulltext textarea.input { width: 100%; min-height: 60vh; font: 13.5px/1.65 var(--mono); resize: vertical; }

/* the rail of proposals (wide screens) */
.p-rail { position: sticky; top: 74px; max-height: calc(100vh - 92px); overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.rail-list { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.rail-list h2 { display: flex; align-items: center; gap: 6px; margin: 0; padding: 12px 14px 8px; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rail-list a.p-row { border-radius: 0; border-top: 1px solid var(--border); padding: 9px 14px; }
.rail-list .p-closed > summary { border-top: 1px solid var(--border); padding: 9px 14px; }
.rail-tip { display: flex; flex-direction: column; gap: 8px; padding: 0 4px; font-size: 12px; color: var(--muted); }
.rail-tip span { line-height: 2; }

.ie-actions .ie-hint { flex: 1 1 280px; }
.ie-actions .btn { flex: none; }
.print-text { display: none; }

@media (max-width: 1399px) {
  .review { grid-template-columns: minmax(0, 920px); }
  .p-rail { display: none; }
}
@media (max-width: 1100px) {
  /* two rows: what is shown and where, then the decisions */
  .pbar { flex-wrap: wrap; }
  .pbar > .spacer { display: none; }
  .pbar .acts { width: 100%; justify-content: flex-end; }
  .pswitch { flex: 1 1 160px; }
  :root { --pbar-h: 136px; }
  .ie-actions .ie-hint { flex-basis: 100%; max-width: none; }
  .review-main .paper { padding: 28px 24px 40px 20px; }
  .wb { margin-inline: -8px; }
  .doc li.blk > .wb { margin-right: -16px; margin-left: calc(-1 * var(--gut) - 11px); }
  .ie-meta { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .pswitch .menu-pop { width: min(400px, calc(100vw - 40px)); min-width: 0; }
  .pnav .menu-pop { left: 8px; right: 8px; width: auto; min-width: 0; }
  .review-main .paper { padding: 20px 16px 32px 8px; }
  .doc { --gut: 42.9px; }
  .doc .blk { padding-left: 2.6em; }
  .doc .blk .lbl { width: 2.2em; }
  .doc .blk.chg::before, .doc blockquote.blk::after { left: 2.25em; }
  .doc .blk.grp-lead::after, .doc .blk.grp::after { left: 1.6em; }
  .doc .blk.editing.after { padding-left: 2.6em; }
  .chg-bar .what { flex-basis: 100%; white-space: normal; }
  .chg-bar .acts { margin-left: 0; }
  .wb { margin-inline: -4px; }
  .doc li.blk > .wb { margin-right: -12px; margin-left: calc(-1 * var(--gut) - 7px); }
  .wb-tabs { order: 3; flex: 1 1 100%; }
  .p-head .legend { margin-left: 0; }
}
@media (max-width: 600px) {
  .wb-end kbd { display: none; }
  .wb-actions .hint { flex-basis: 100%; }
  .wb-pane { padding: 12px; }
}
@media (pointer: coarse) {
  .chg-bar .btn, .wb .btn, .pbar .btn { min-height: 32px; }
}
@media (max-height: 700px) {
  .pbar-wrap { position: static; }
  :root { --pbar-h: 0px; }
}
@media print {
  .pbar-wrap, .p-head, .p-rail, .chg-bar, .blk-marks, .annot, .wb, .ie, #discussion, #orphans { display: none !important; }
  .doc .print-text { display: inline !important; }
  .doc div.print-text { display: block !important; }
}

/* ---------------------------------------------------- draft: the preview */
/* The letter's own typography comes from LETTER_CSS (packages/draftroom/src/style.ts),
   inlined on the page with the template's style; here only the screen around it. */

.center { text-align: center; }
.preview-bar { position: sticky; top: 58px; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 10px 14px; margin: -8px 0 18px; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs); }
.sheets { display: flex; flex-direction: column; align-items: stretch; gap: 22px; padding: 26px 16px 8px; background: #e9ebef; border-radius: 12px; border: 1px solid var(--border); overflow-x: auto; }
.sheets .sheet { margin: 0 auto; flex: none; box-shadow: 0 1px 3px rgba(16,24,40,.12), 0 10px 30px -12px rgba(16,24,40,.25); }
.sheets.paged .sheet { height: var(--lt-page-h); overflow: hidden; }
.sheets.paged .sheet.tall { height: auto; min-height: var(--lt-page-h); }
.sheet-foot { position: absolute; left: 0; right: 0; bottom: calc(var(--lt-mb) * 0.45); text-align: center; font: 8.5pt var(--font); color: #98a2b3; }
.print-only-js { display: none; }
.js .print-only-js { display: inline-flex; }

@media print {
  body.app { display: block; background: #fff; }
  .sidebar, .topbar, .nav-toggle, .nav-toggle-label, .alert, .page-actions, .tabs { display: none !important; }
  .content, .content.wide { max-width: none; }
  /* the preview: the page size and margins come from the template's style (inlined @page) */
  body.letter-print .preview-bar, body.letter-print .sheet-foot, body.letter-print .preview-note { display: none !important; }
  body.letter-print .content { padding: 0; }
  body.letter-print .sheets { display: block; padding: 0; background: none; border: 0; border-radius: 0; }
  /* one continuous flow: the browser paginates with the same rules as the screen */
  body.letter-print .sheets .sheet { width: auto; height: auto; min-height: 0; overflow: visible; box-shadow: none; margin: 0; padding-top: 0; padding-bottom: 0; }
}
.ie-error { font-size: 13px; color: var(--red); background: var(--red-bg); border: 1px solid var(--red-border); border-radius: 7px; padding: 6px 10px; margin-bottom: 8px; }
.doc li > .editing.after { margin: 8px 0 4px; padding: 8px 0 0; border-top: 1px dashed var(--border); list-style: none; }

/* --------------------------------------------------------- templates */

.tpl-grid { gap: 20px; }
.tpl-card { display: block; color: inherit; text-decoration: none !important; overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.tpl-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-sm); }
.tpl-thumb { position: relative; height: 230px; overflow: hidden; background: #e9ebef; border-bottom: 1px solid var(--border); }
.tpl-thumb-inner { position: absolute; left: 50%; top: 14px; width: 216mm; margin-left: -108mm; transform: scale(0.42); transform-origin: top center; pointer-events: none; }
.tpl-thumb .sheets { background: none; border: 0; padding: 0; overflow: visible; }
.tpl-editor { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 22px; align-items: start; }
.tpl-live { position: sticky; top: 78px; min-width: 0; }
.tpl-live .sheets { max-height: calc(100vh - 140px); overflow: auto; }
.tpl-form .form-grid { gap: 0 12px; }
.tpl-form .field { margin-bottom: 12px; }
@media (max-width: 1100px) { .tpl-editor { grid-template-columns: minmax(0, 1fr); } .tpl-live { position: static; } }
.tpl-live .sheets .sheet { zoom: 0.8; }

/* ------------------------------------------- layers: chronology, assertions, exhibits, ledger */

.layer-table td { vertical-align: top; }
.layer-table .cell-main { display: flex; align-items: center; gap: 6px; min-width: 0; }
.layer-table .cell-main > a { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.layer-table .cell-main > a:hover { color: var(--accent); }
.layer-table .cell-main > a.claim { font-family: var(--serif); font-weight: 400; font-size: 14.5px; line-height: 1.5; }
.layer-table .cell-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 3px; max-width: 620px; overflow-wrap: anywhere; }
.layer-table .cell-sub .kind { width: 20px; height: 20px; border-radius: 5px; }
.layer-table .cell-sub .kind .i { width: 12px; height: 12px; }
.layer-table tr.struck td { color: var(--faint); }
.layer-table tr.struck .cell-main > a, .layer-table tr.struck .strike { text-decoration: line-through; color: var(--faint); }
.layer-table tr.struck-soft td { background: var(--surface-2); }
.layer-table .truncate-cell { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.lock-mark { color: var(--faint); display: inline-flex; }
.amount { font-variant-numeric: tabular-nums; }
.pre-line { white-space: pre-line; }
.cite-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 240px; }
.cite-chips .cite { white-space: normal; overflow-wrap: break-word; }
.layer-table .cite-chips { min-width: 130px; }
.cite .i { margin-left: 3px; }
.cite.warn { background: var(--amber-bg); border-color: var(--amber-border); color: var(--amber); }
.cite.bad { background: var(--red-bg); border-color: var(--red-border); color: var(--red); }
.cite.gone { background: var(--surface-3); border-color: var(--border); color: var(--faint); text-decoration: line-through; }
.cite-list .dot-sep, .item-head .dot-sep { margin: 0 6px; color: var(--faint); }
.cite-list .meta code { font-size: 11.5px; }
.cite-quote { margin: 8px 0 6px; padding: 8px 14px; border-left: 3px solid var(--accent-border); background: var(--surface-2); border-radius: 0 8px 8px 0; font-family: var(--serif); font-size: 15px; line-height: 1.6; color: var(--text-2); overflow-wrap: anywhere; white-space: pre-line; }
.verify-line { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 4px; }
.verify-line > .small, .verify-line > div { flex-basis: 100%; }
.cite-edit { border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px 2px; margin: 4px 0 16px; min-width: 0; }
.cite-edit legend { font-size: 13.5px; font-weight: 600; color: var(--text-2); padding: 0 6px; }
.cite-edit > .hint { margin: 0 0 10px; }
.cite-row { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.6fr) minmax(0, 0.95fr); gap: 8px; margin-bottom: 8px; align-items: start; }
.cite-row.head { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.cite-row.head .opt { font-weight: 400; color: var(--faint); }
.cite-row textarea.input { min-height: 32px; height: 32px; padding: 6px 10px; font-size: 13px; line-height: 1.4; }
/* a citation with what it does for its row; a finding's search with its filters */
.cite-row.roles { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.6fr) minmax(0, 0.95fr) minmax(0, 0.5fr); }
.cite-row.query { grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 0.9fr) auto; }
.versions > li.here { background: var(--accent-soft); }
.bundle-grid { flex-direction: column; flex-wrap: nowrap; gap: 6px; max-height: 320px; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.bundle-pick { align-items: center; }
.bundle-pick.off { color: var(--faint); cursor: not-allowed; }
.compact-table th, .compact-table td { padding: 6px 10px; }
.prod-check { padding: 14px 20px; }
.prod-check + .prod-check { border-top: 1px solid var(--border); }
.prod-check .alert { margin: 10px 0 0; }
.prod-stats { margin: 10px 0 0; }
.prod-stats b { font-size: 17px; }
@media (max-width: 900px) {
  .cite-row, .cite-row.roles, .cite-row.query { grid-template-columns: minmax(0, 1fr); }
  .cite-row.head { display: none; }
}
