/* ============================================================
   Geneva — the reading room.
   Warm parchment, deep sash crimson, a teal gem for links.
   No external fonts or scripts: the CSP only allows this file.
   ============================================================ */

:root {
  color-scheme: light dark;

  --paper: #f6efe3;
  --paper-2: #efe5d4;
  --card: #fffaf1;
  --card-2: #fbf4e8;
  --ink: #2b2220;
  --ink-2: #5d514c;
  --ink-3: #8f827a;
  --line: #e2d6c2;
  --line-2: #cdbfa6;

  --sash: #8e2530;
  --sash-2: #6d1b25;
  --sash-3: #b4444f;
  --sash-wash: #f7e3e1;
  --gem: #1d746d;
  --gem-2: #145750;
  --gem-wash: #dfeeea;
  --gold: #a6711b;
  --gold-wash: #f6e9cc;
  --moss-wash: #e4ecdc;

  --rail: #2a1a1d;
  --rail-2: #3a2327;
  --rail-ink: #f3e6dc;
  --rail-ink-2: #c9b3ad;
  --rail-line: rgba(255, 255, 255, 0.08);

  --shadow: 0 1px 2px rgba(60, 40, 30, 0.06), 0 12px 32px -12px rgba(60, 40, 30, 0.22);
  --shadow-lg: 0 30px 60px -20px rgba(40, 20, 20, 0.45);
  --r: 12px;
  --r-sm: 8px;

  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino,
    Charter, Georgia, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1e1a19;
    --paper-2: #181514;
    --card: #2a2424;
    --card-2: #241f1f;
    --ink: #f0e7dc;
    --ink-2: #bfb1a6;
    --ink-3: #8d8078;
    --line: #3a3130;
    --line-2: #514542;

    --sash: #c7505b;
    --sash-2: #d9707a;
    --sash-3: #a63a45;
    --sash-wash: #3f2529;
    --gem: #5fbdb3;
    --gem-2: #8ad4cb;
    --gem-wash: #1f3532;
    --gold: #d9a24a;
    --gold-wash: #3c2f18;
    --moss-wash: #2b3327;

    --rail: #151011;
    --rail-2: #201617;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ---------- base ---------- */
* {
  box-sizing: border-box;
}
html {
  font: 15.5px/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
h1,
h2,
h3 {
  margin: 0;
}
h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 2.2rem;
  line-height: 1.12;
  letter-spacing: -0.012em;
}
h2 {
  font-size: 1.05rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-3);
}
p {
  margin: 0;
}
a {
  color: var(--gem);
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
code,
.mono {
  font-family: var(--mono);
  font-size: 0.84em;
}
:focus-visible {
  outline: 2px solid var(--gem);
  outline-offset: 2px;
}
.skip {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--card);
  padding: 6px 10px;
  z-index: 50;
}
.skip:focus {
  left: 8px;
}
.muted {
  color: var(--ink-2);
}
.faint {
  color: var(--ink-3);
}
.small {
  font-size: 0.86rem;
}
.serif {
  font-family: var(--serif);
}
.italic {
  font-style: italic;
}

/* ---------- boot ---------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--ink-3);
}
.boot-portrait {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 3px solid var(--card);
  box-shadow: 0 0 0 2px var(--sash);
}

/* ---------- controls ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
.btn:hover {
  border-color: var(--ink-3);
  background: var(--card-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
}
.btn.primary {
  background: linear-gradient(180deg, var(--sash-3), var(--sash));
  border-color: var(--sash-2);
  color: #fff;
  box-shadow: 0 6px 16px -8px var(--sash);
}
.btn.primary:hover {
  background: linear-gradient(180deg, var(--sash), var(--sash-2));
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--ink-2);
}
.btn.ghost:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.btn.wide {
  width: 100%;
}
.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--gem);
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--gem) 35%, transparent);
}
.link:hover {
  text-decoration-color: currentColor;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--card);
  transition: border-color 0.15s;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-3);
}
.input::placeholder {
  color: var(--ink-3);
}
.textarea {
  min-height: 130px;
  resize: vertical;
  line-height: 1.5;
}
.select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%),
    linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 55%,
    calc(100% - 13px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.field {
  display: grid;
  gap: 6px;
}
.field > label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-2);
}

/* ---------- tags & avatars ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--paper-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.tag.high,
.tag.open {
  background: var(--sash-wash);
  color: var(--sash);
}
.tag.medium,
.tag.in_review {
  background: var(--gold-wash);
  color: var(--gold);
}
.tag.low,
.tag.resolved {
  background: var(--moss-wash);
  color: var(--gem-2);
}
.tag.dismissed {
  background: var(--paper-2);
  color: var(--ink-3);
}
.ref {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex: none;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.avatar.sm {
  width: 28px;
  height: 28px;
  font-size: 0.64rem;
}
.hue-0 {
  background: linear-gradient(160deg, #b7454f, #8e2530);
}
.hue-1 {
  background: linear-gradient(160deg, #2f8d84, #1d5f59);
}
.hue-2 {
  background: linear-gradient(160deg, #c48a2c, #96651a);
}
.hue-3 {
  background: linear-gradient(160deg, #6f6aa8, #4d4886);
}
.hue-4 {
  background: linear-gradient(160deg, #6f8f4a, #4f6b30);
}
.hue-5 {
  background: linear-gradient(160deg, #b8626f, #8a3d4a);
}

/* ---------- login ---------- */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    var(--paper);
}
.login-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px;
  overflow: hidden;
  background:
    radial-gradient(700px 500px at 60% 40%, rgba(142, 37, 48, 0.28), transparent 65%),
    linear-gradient(160deg, var(--rail-2), var(--rail));
}
.login-stage::before,
.login-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.login-stage::before {
  background: repeating-linear-gradient(
    -35deg,
    transparent 0 22px,
    rgba(255, 255, 255, 0.025) 22px 23px
  );
}
.login-stage::after {
  background: radial-gradient(
    closest-side at 50% 58%,
    rgba(255, 224, 200, 0.16),
    transparent 70%
  );
}
.portrait {
  position: relative;
  z-index: 1;
  width: min(300px, 64%);
  aspect-ratio: 300 / 540;
  object-fit: cover;
  border-radius: 18px;
  border: 6px solid #fff8ec;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.25),
    var(--shadow-lg);
  transform: rotate(-2deg);
  transition: transform 0.4s ease;
}
.portrait:hover {
  transform: rotate(0deg) scale(1.02);
}
.login-caption {
  position: absolute;
  bottom: 28px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--rail-ink-2);
  font-style: italic;
  font-size: 0.98rem;
  z-index: 1;
}
.login-body {
  display: grid;
  align-content: center;
  gap: 22px;
  padding: 56px clamp(24px, 7vw, 88px);
  max-width: 620px;
}
.login-body h1 {
  font-size: clamp(2.3rem, 4.2vw, 3.2rem);
}
.login-body .lede {
  font-size: 1.1rem;
  color: var(--ink-2);
  line-height: 1.55;
}
.eyebrow {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--sash);
  font-weight: 700;
}
.command {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--card);
  box-shadow: 0 1px 0 var(--line-2);
}
.alert {
  padding: 12px 16px;
  border-left: 4px solid var(--sash);
  background: var(--sash-wash);
  color: var(--sash-2);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
@media (max-width: 860px) {
  .login {
    grid-template-columns: 1fr;
  }
  .login-stage {
    padding: 32px 24px 56px;
    min-height: 44vh;
  }
  .portrait {
    width: min(200px, 55%);
  }
  .login-body {
    padding: 36px 24px 56px;
  }
}

/* ---------- app shell ---------- */
.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  color: var(--rail-ink);
  background:
    radial-gradient(500px 300px at 0% 0%, rgba(180, 68, 79, 0.3), transparent 70%),
    linear-gradient(180deg, var(--rail-2), var(--rail));
  border-right: 1px solid var(--rail-line);
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  padding: 0 6px;
  margin-bottom: 26px;
}
.rail-brand img {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid #fff8ec;
  box-shadow: 0 0 0 2px var(--sash);
}
.rail-brand b {
  display: block;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.4rem;
  line-height: 1.1;
}
.rail-brand span {
  display: block;
  font-size: 0.78rem;
  color: var(--rail-ink-2);
  letter-spacing: 0.04em;
}
.rail-nav {
  display: grid;
  gap: 4px;
}
.rail-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--rail-ink-2);
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.rail-nav a svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.rail-nav a:hover {
  color: var(--rail-ink);
  background: rgba(255, 255, 255, 0.05);
}
.rail-nav a[aria-current="page"] {
  color: #fff;
  background: linear-gradient(90deg, rgba(180, 68, 79, 0.55), rgba(180, 68, 79, 0.18));
  box-shadow: inset 3px 0 0 var(--sash-3);
}
.rail-nav .n {
  margin-left: auto;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--sash);
  color: #fff;
}
.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
}
.rail-quote {
  color: var(--rail-ink-2);
  font-size: 0.88rem;
  line-height: 1.45;
  padding: 0 6px 12px;
  border-bottom: 1px solid var(--rail-line);
}
.rail-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}
.rail-user .who {
  min-width: 0;
  flex: 1;
}
.rail-user .who b {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-user .who span {
  font-size: 0.78rem;
  color: var(--rail-ink-2);
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6fd3c8;
  box-shadow: 0 0 0 3px rgba(111, 211, 200, 0.2);
  margin-right: 6px;
  vertical-align: 1px;
}
.dot.off {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(217, 162, 74, 0.25);
}
.rail .btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--rail-ink);
}
.rail .btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.page {
  padding: 44px 48px 80px;
  max-width: 1160px;
  width: 100%;
  display: grid;
  gap: 28px;
  animation: rise 0.3s ease both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .page,
  .portrait,
  .btn {
    animation: none;
    transition: none;
  }
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.page-head .lede {
  font-size: 1.02rem;
  color: var(--ink-2);
  margin-top: 6px;
  max-width: 64ch;
}
.page-head .kicker {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--sash);
  font-weight: 700;
  margin-bottom: 8px;
}
.crumbs {
  font-size: 0.88rem;
  color: var(--ink-3);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.crumbs a {
  color: var(--ink-2);
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* mobile chrome */
.mobile-bar {
  display: none;
}
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .rail {
    position: static;
    height: auto;
    padding: 14px 16px;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
  }
  .rail-brand {
    margin: 0;
  }
  .rail-brand img {
    width: 38px;
    height: 38px;
  }
  .rail-brand b {
    font-size: 1.2rem;
  }
  .rail-brand span {
    display: none;
  }
  .rail-nav {
    order: 3;
    width: 100%;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 2px;
    margin-top: 6px;
  }
  .rail-nav a {
    flex-direction: column;
    gap: 4px;
    padding: 8px 4px;
    font-size: 0.74rem;
    text-align: center;
  }
  .rail-nav .n {
    position: absolute;
    display: none;
  }
  .rail-foot {
    margin: 0 0 0 auto;
    grid-auto-flow: column;
    align-items: center;
    gap: 8px;
  }
  .rail-quote,
  .rail-user .who {
    display: none;
  }
  .rail-foot .btn.wide {
    width: auto;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.86rem;
  }
  .page {
    padding: 24px 16px 64px;
    gap: 20px;
  }
  h1 {
    font-size: 1.8rem;
  }
  .page-head .actions {
    width: 100%;
  }
  .page-head .actions .btn {
    flex: 1 1 auto;
  }
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
}
.card-body {
  padding: 22px;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
  color: var(--ink-2);
  background: var(--card-2);
}
.aside-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 18px;
  border-radius: var(--r);
  background: var(--gem-wash);
  color: var(--gem-2);
  font-size: 0.92rem;
  line-height: 1.5;
}
.aside-note svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-top: 2px;
}

/* ---------- counters ---------- */
.counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.counter {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  color: inherit;
  transition:
    transform 0.15s,
    border-color 0.15s;
  overflow: hidden;
}
.counter::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--line-2);
}
.counter.sash::after {
  background: var(--sash);
}
.counter.gold::after {
  background: var(--gold);
}
.counter.gem::after {
  background: var(--gem);
}
.counter:not(:disabled):hover {
  transform: translateY(-2px);
  border-color: var(--line-2);
}
.counter:disabled {
  cursor: default;
}
.counter[aria-pressed="true"] {
  background: var(--card-2);
  border-color: var(--sash-3);
}
.counter b {
  font-family: var(--serif);
  font-size: 2.3rem;
  font-weight: 500;
  line-height: 1;
}
.counter span {
  font-size: 0.86rem;
  color: var(--ink-2);
}
@media (max-width: 900px) {
  .counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .counter b {
    font-size: 1.7rem;
  }
}

/* ---------- filters ---------- */
.segments {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 10px 14px 0;
}
.segments button {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 12px;
  color: var(--ink-2);
  cursor: pointer;
  font-weight: 500;
}
.segments button:hover {
  color: var(--ink);
}
.segments button[aria-pressed="true"] {
  color: var(--sash);
  border-bottom-color: var(--sash);
}
.segments .n {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--ink-3);
  margin-left: 6px;
}
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
}
.filters .input {
  flex: 1 1 260px;
}
.filters .select {
  width: auto;
  flex: 0 1 230px;
}
.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  padding: 22px;
}
.filter-grid .span-3 {
  grid-column: 1 / -1;
}
@media (max-width: 760px) {
  .filter-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- case list ---------- */
.cases {
  display: grid;
}
.case {
  display: grid;
  grid-template-columns: 4px minmax(0, 1fr) auto;
  gap: 0 18px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  transition: background 0.15s;
}
.case:last-child {
  border-bottom: 0;
}
.case:hover {
  background: var(--card-2);
}
.case .ribbon {
  align-self: stretch;
  background: var(--line-2);
}
.case.high .ribbon {
  background: var(--sash);
}
.case.medium .ribbon {
  background: var(--gold);
}
.case-main {
  padding: 16px 0;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.case-title {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.case-title:hover {
  color: var(--sash);
}
.case-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  color: var(--ink-2);
}
.case-meta .sep {
  color: var(--line-2);
}
.case-side {
  display: grid;
  justify-items: end;
  gap: 6px;
  padding: 16px 22px 16px 0;
  font-size: 0.86rem;
  color: var(--ink-3);
  text-align: right;
}
.case-side .tags {
  display: flex;
  gap: 6px;
}
@media (max-width: 640px) {
  .case {
    grid-template-columns: 4px minmax(0, 1fr);
  }
  .case-side {
    grid-column: 2;
    justify-items: start;
    text-align: left;
    padding: 0 16px 14px 0;
  }
  .case-main {
    padding: 14px 16px 8px 0;
  }
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  min-width: 600px;
  border-collapse: collapse;
}
th {
  text-align: left;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-3);
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--card-2);
  white-space: nowrap;
}
td {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--card-2);
}
td .sub {
  display: block;
  font-size: 0.84rem;
  color: var(--ink-3);
  margin-top: 2px;
}
.nowrap {
  white-space: nowrap;
}
.who-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------- empty ---------- */
.empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--ink-2);
  display: grid;
  justify-items: center;
  gap: 8px;
}
.empty svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 6px;
}
.empty h2 {
  color: var(--ink);
}
.empty p {
  max-width: 44ch;
}
.loading {
  padding: 48px;
  text-align: center;
  color: var(--ink-3);
}

/* ---------- detail ---------- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}
.detail-main {
  display: grid;
  gap: 28px;
  min-width: 0;
}
.detail-side {
  display: grid;
  gap: 28px;
  position: sticky;
  top: 24px;
}
@media (max-width: 1080px) {
  .detail {
    grid-template-columns: 1fr;
  }
  .detail-side {
    position: static;
  }
}
.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 10px 18px;
  margin: 0;
}
.facts dt {
  font-size: 0.8rem;
  color: var(--ink-3);
  padding-top: 2px;
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.review-form {
  display: grid;
  gap: 16px;
}
.hint {
  font-size: 0.86rem;
  color: var(--ink-3);
  line-height: 1.5;
}

/* ---------- conversation ---------- */
.thread {
  display: grid;
  padding: 10px 0;
}
.msg {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 4px 14px;
  padding: 12px 22px;
  border-left: 4px solid transparent;
}
.msg.trigger {
  border-left-color: var(--sash);
  background: linear-gradient(90deg, var(--sash-wash), transparent 70%);
}
.msg-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}
.msg-head b {
  font-weight: 600;
  color: var(--ink);
}
.msg-head time {
  color: var(--ink-3);
}
.msg-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.msg-body.gone {
  color: var(--ink-3);
  font-style: italic;
}
.msg-meta {
  font-size: 0.76rem;
  color: var(--ink-3);
  font-family: var(--mono);
}
.msg .avatar {
  grid-row: 1 / span 3;
}

/* ---------- notes ---------- */
.note {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 2px 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.note:last-child {
  border-bottom: 0;
}
.note .avatar {
  grid-row: 1 / span 2;
}
.note-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 0.88rem;
}
.note-head b {
  font-weight: 600;
}
.note-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 12px);
  background: var(--rail);
  color: var(--rail-ink);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  max-width: calc(100vw - 32px);
  box-shadow: var(--shadow-lg);
  z-index: 40;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
