/* DeckNotes — Google Workspace-native */

:root {
  /* Google neutrals */
  --surface:      #FFFFFF;
  --surface-2:    #F8F9FA;  /* app bg */
  --surface-3:    #F1F3F4;  /* sidebar, chips */
  --surface-4:    #E8EAED;  /* hover / dividers-ish */
  --border:       #DADCE0;
  --border-soft:  #E8EAED;

  --text:         #202124;
  --text-2:       #3C4043;
  --text-3:       #5F6368;
  --text-4:       #80868B;

  /* Slides yellow */
  --accent:       #FBBC04;
  --accent-2:     #F9AB00;
  --accent-ink:   #B07900;      /* legible yellow text on white */
  --accent-bg:    #FEF7E0;      /* soft wash */

  /* Supporting Google hues (used very sparingly) */
  --blue:         #1A73E8;
  --red:          #D93025;
  --green:        #188038;

  /* Elevation */
  --shadow-1:     0 1px 2px 0 rgba(60,64,67,0.08), 0 1px 3px 1px rgba(60,64,67,0.06);
  --shadow-2:     0 1px 2px 0 rgba(60,64,67,0.1), 0 2px 6px 2px rgba(60,64,67,0.08);
  --shadow-3:     0 4px 8px 3px rgba(60,64,67,0.1), 0 1px 3px 0 rgba(60,64,67,0.08);

  /* Type */
  --sans: 'Google Sans', 'Google Sans Text', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --sans-display: 'Google Sans', 'Google Sans Display', 'Inter', -apple-system, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, Menlo, monospace;

  /* Type scale (rem-based; root = 16px) */
  --fs-2xs:  0.625rem;     /* 10px */
  --fs-xs:   0.6875rem;    /* 11px */
  --fs-sm:   0.75rem;      /* 12px */
  --fs-base: 0.8125rem;    /* 13px */
  --fs-md:   0.875rem;     /* 14px = body */
  --fs-lg:   1rem;         /* 16px */
  --fs-xl:   1.125rem;     /* 18px */
  --fs-2xl:  1.25rem;      /* 20px */
  --fs-3xl:  1.5rem;       /* 24px */

  /* Spacing scale */
  --space-0-5: 0.125rem;   /* 2px  */
  --space-1:   0.25rem;    /* 4px  */
  --space-1-5: 0.375rem;   /* 6px  */
  --space-2:   0.5rem;     /* 8px  */
  --space-2-5: 0.625rem;   /* 10px */
  --space-3:   0.75rem;    /* 12px */
  --space-3-5: 0.875rem;   /* 14px */
  --space-4:   1rem;       /* 16px */
  --space-5:   1.25rem;    /* 20px */
  --space-6:   1.5rem;     /* 24px */
  --space-8:   2rem;       /* 32px */
  --space-10:  2.5rem;     /* 40px */
  --space-12:  3rem;       /* 48px */

  /* Radius scale */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 999px;

  /* Motion */
  --dur-fast:      0.12s;
  --dur-base:      0.2s;
  --dur-slow:      0.35s;
  --ease-standard: cubic-bezier(.4, 0, .2, 1);

  /* Z-index ladder */
  --z-base:           1;
  --z-sticky:         5;
  --z-mobile-shell:   30;
  --z-overlay-back:   55;
  --z-mobile-bar:     60;
  --z-mobile-trigger: 70;
  --z-modal:          1000;
  --z-toast:          1100;

  /* Surface variants & ink-on-accent */
  --surface-warm:  #FFFDF7;   /* yellow-tinted hover wash */
  --ink-on-accent: #3C3000;   /* dark text used on accent backgrounds */
  --green-bright:  #1E8E3E;   /* bright variant of --green */
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--surface-2); color: var(--text); }
body {
  font-family: var(--sans);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; text-align: left; }
em, i { font-style: normal; font-weight: 500; color: var(--text); }

/* ------- Layout shell ------- */
.dn-shell {
  display: grid;
  grid-template-columns: var(--dn-side-w, 280px) 1fr;
  height: 100vh;
  overflow: hidden;
  background: var(--surface-2);
  transition: grid-template-columns var(--dur-base) var(--ease-standard);
}
.dn-shell:has(.dn-sidebar.is-collapsed) {
  --dn-side-w: 64px;
}

/* =========== SIDEBAR =========== */
.dn-sidebar {
  background: var(--surface-3);
  border-right: 1px solid var(--border);
  box-shadow: 1px 0 0 var(--border-soft); /* subtle 2px seam so the divider reads as a heavier rule without getting solid */
  display: flex; flex-direction: column;
  overflow: hidden;
}
.dn-masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3-5) var(--space-4) var(--space-2-5);
}
.dn-logotype { display: flex; align-items: center; gap: var(--space-2-5); color: var(--text); }
.dn-mark {
  display: inline-flex;
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  align-items: center; justify-content: center;
  color: var(--text);
}
.dn-wordmark {
  font-family: var(--sans-display);
  font-size: var(--fs-xl);
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text);
}
.dn-iconbtn {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.dn-iconbtn:hover { background: var(--surface-4); color: var(--text); }

.dn-share {
  margin: var(--space-1) var(--space-3) var(--space-2-5);
  padding: var(--space-3) var(--space-3-5);
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-fast), background var(--dur-fast);
  cursor: pointer;
  text-align: left;
}
.dn-share:hover { box-shadow: var(--shadow-2); background: var(--surface-warm); }
.dn-share-plus {
  color: var(--accent-ink);
  font-size: var(--fs-2xl); line-height: 1;
  width: 20px; text-align: center;
  font-weight: 500;
}
.dn-share > span:nth-child(2),
.dn-share-labels {
  flex: 1;
  display: flex; flex-direction: column; align-items: flex-start;
  min-width: 0;
}
.dn-share-line1 {
  font-weight: 500; font-size: var(--fs-md); color: var(--text);
  line-height: 1.2;
}
.dn-share-line2 {
  font-family: var(--mono);
  font-size: var(--fs-xs); color: var(--text-4);
  letter-spacing: 0;
  margin-top: var(--space-0-5);
}
.dn-share-wrap.is-open .dn-share { box-shadow: var(--shadow-2); background: var(--surface-warm); }
.dn-share-panel {
  margin: var(--space-1-5) var(--space-2) 0;
  padding: var(--space-2-5) var(--space-3-5) var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  line-height: 1.45;
  color: var(--text-2);
}
.dn-share-steps {
  margin: 0;
  padding-left: 18px;
  display: flex; flex-direction: column; gap: var(--space-1);
}
.dn-share-steps code {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  background: rgba(0,0,0,0.04);
  padding: 0 var(--space-1);
  border-radius: var(--radius-sm);
}
.dn-share-copyrow {
  margin-top: var(--space-2);
  min-height: 1em;
}
.dn-share-copyhint {
  font-size: var(--fs-xs);
  color: var(--accent-ink);
  opacity: 0;
  transition: opacity var(--dur-base);
}
.dn-share-copyhint.is-visible { opacity: 1; }

/* Deck list */
.dn-decklist {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-2) var(--space-3);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.dn-deckgroup { margin-bottom: var(--space-2-5); }
.dn-groupheader {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-3);
  padding: var(--space-2-5) var(--space-3-5) var(--space-1-5);
  letter-spacing: 0.02em;
}
.dn-decklist ul { list-style: none; margin: 0; padding: 0; }

.dn-deckrow {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-3-5);
  border-radius: var(--radius-md);
  margin: 0 var(--space-2-5);
  color: var(--text);
  text-decoration: none;
  transition: background var(--dur-fast);
  position: relative;
}
.dn-deckrow:hover, .dn-deckrow:focus { text-decoration: none; }
.dn-deckrow:hover { background: var(--surface-4); }
.dn-deckrow.is-active {
  background: var(--accent-bg);
  box-shadow: inset 2px 0 0 var(--accent);
}
.dn-deckrow.is-active .dn-deck-title { color: var(--text); font-weight: 500; }

.dn-pulse {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(251,188,4,0.25);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
}
.dn-pulse::before {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(251,188,4,0.4);
  animation: dnPulse 1.8s ease-out infinite;
}
@keyframes dnPulse {
  0%   { transform: scale(1);   opacity: 0.7; }
  100% { transform: scale(2.2); opacity: 0; }
}

.dn-deck-main { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.dn-deck-title {
  font-size: var(--fs-md);
  font-weight: 400;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: 0;
  line-height: 1.35;
  text-wrap: balance;
}
.dn-deck-sub {
  font-size: var(--fs-sm);
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}

.dn-sidefoot {
  border-top: 1px solid var(--border-soft);
  padding: var(--space-2-5) var(--space-3);
  background: var(--surface-3);
}
.dn-account {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; padding: var(--space-1-5) var(--space-2); border-radius: var(--radius-xl);
}
.dn-account:hover { background: var(--surface-4); }
.dn-acc-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1A73E8; color: var(--surface);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: var(--fs-md); font-weight: 500;
}
.dn-acc-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.dn-acc-line1 { font-size: var(--fs-base); font-weight: 500; color: var(--text); }
.dn-acc-line2 { font-size: var(--fs-sm); color: var(--text-3); }

/* =========== MAIN AREA =========== */
.dn-main {
  overflow-y: auto;
  padding: 0;
  background: var(--surface-2);
}
.dn-main > * {
  max-width: none;
  margin-left: 0; margin-right: 0; /* take full available width */
  padding-left: var(--space-12); padding-right: var(--space-6);
}

/* ---- Deck header ---- */
.dn-deckhead {
  padding-top: var(--space-10);
  padding-bottom: var(--space-2);
}
/* ---- Quiet deck stats line ---- */
.dn-deckstats {
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin: 0;
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: baseline;
}
.dn-deckstats-dot { color: var(--text-4); }

/* Left rail: portrait, tab nav, divider, action buttons */
.dn-brief-rail {
  display: flex; flex-direction: column;
  padding-top: var(--space-0-5);
  border-right: 1px solid var(--border-soft);
  padding-right: 18px;
  margin-right: -14px; /* pulls right rule closer, tighten gap */
  min-height: 240px;
}
.dn-portrait-debbie .dn-portrait-initial {
  font-size: 40px;
  opacity: 0.95;
  margin-top: -12px;
}
.dn-portrait-debbie .dn-portrait-name {
  background: rgba(0,0,0,0.28);
  color: var(--surface);
  font-size: var(--fs-sm);
}

/* ---- Reviewer filter chips ---- */
.dn-filterchips {
  display: flex; flex-wrap: wrap; gap: var(--space-1-5);
  margin-bottom: 18px;
}
.dn-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 5px var(--space-3-5) 5px 5px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-xl);
  font: inherit; font-size: var(--fs-base);
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  min-width: 128px;
  justify-content: flex-start;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.dn-chip:first-child {
  min-width: 88px;
  padding: 5px 11px;
  justify-content: center;
}
.dn-chip-config {
  margin-left: auto;
  min-width: 0;
  padding: 5px var(--space-3);
  background: transparent;
  border-color: transparent;
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.dn-chip-config:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-soft);
}
.dn-chip:hover:not(:disabled):not(.is-active) {
  background: var(--surface-2);
  border-color: var(--border);
}
.dn-chip:disabled { opacity: 0.4; cursor: not-allowed; }
.dn-chip.is-empty {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
  text-decoration: none;
}
a.dn-chip { text-decoration: none; }
.dn-chip.is-active {
  background: var(--accent-bg);
  border-color: var(--accent-2);
  color: var(--accent-ink);
  font-weight: 500;
}
.dn-chip-all {
  padding: 0 var(--space-1) 0 var(--space-2);
  display: inline-flex; align-items: center;
}
.dn-chip-av {
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 500;
  flex-shrink: 0;
}
.dn-chip-name { display: inline-flex; align-items: center; }
.dn-chip-count {
  font-family: var(--mono); font-size: var(--fs-xs);
  color: var(--text-3);
  background: var(--surface-3);
  padding: 1px var(--space-1-5); border-radius: var(--radius-md);
  min-width: 16px; text-align: center;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: auto;
}
.dn-chip.is-active .dn-chip-count {
  background: rgba(255,255,255,0.6);
  color: var(--accent-ink);
}

/* ---- Status pills (.dn-pill family) ----------------------------------- */
/* DISTINCT FROM .dn-chip. Status pills are non-interactive labels — small,
   uppercase, used to flag state on a parent row (e.g., a sidebar deck row
   that hasn't completed setup, a deck context row, etc.). The .dn-chip
   family above is the larger, interactive filter primitive; do not conflate.

   See test/components/previews/components/pill_preview.rb for the live
   gallery. */
.dn-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--space-1-5);
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-3);
  border: 1px solid var(--border-soft);
  white-space: nowrap;
  vertical-align: middle;
}
.dn-pill-new {
  background: var(--accent-bg);
  color: var(--accent-ink);
  border-color: var(--accent-2);
}
.dn-pill-context {
  /* Pill that labels the deck-context row at the top of the feedback page. */
  background: var(--surface-3);
  color: var(--text-2);
}

/* ---- Count bubble (.dn-count-bubble) ---------------------------------- */
/* Generalizes the existing .dn-chip-count idiom into a stand-alone numeric
   indicator that can sit in a sidebar header or any non-chip context. Same
   token palette as .dn-chip-count for visual consistency. */
.dn-count-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 var(--space-1);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  border-radius: 9px;
  background: var(--accent-2);
  color: var(--accent-ink);
}

/* Empty-state pattern is .dn-empty / .dn-empty-icon / .dn-empty-title /
   .dn-empty-body / .dn-empty-link — defined further down (lines ~1684+).
   New empty surfaces (deck list, fresh-deck pre-setup) reuse that family;
   do not introduce a parallel `.dn-empty-state` class. The preview at
   test/components/previews/components/empty_state_preview.rb shows
   how to apply the existing pattern to new copy. */

/* ---- Deck-context row (.dn-deck-context-row) -------------------------- */
/* The first row of the post-review feedback page. Visually echoes a
   finding row but earns "first among equals" weight via a thicker
   electric-lime left-border accent and a "deck context" pill label.
   Condensed by default (uses native <details>/<summary>); expandable
   to reveal the full markdown. Editable — clicking the body swaps to a
   <textarea> via the deck-context-edit Stimulus controller. */
.dn-deck-context-row {
  position: relative;
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  background: var(--surface-2);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}
.dn-deck-context-row > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--sans);
  font-weight: 500;
  color: var(--text);
}
.dn-deck-context-row > summary::-webkit-details-marker { display: none; }
.dn-deck-context-row[open] > summary {
  margin-bottom: var(--space-3);
}
.dn-deck-context-row .dn-deck-context-body {
  font-size: var(--fs-base);
  line-height: 1.55;
  color: var(--text);
}
.dn-deck-context-row .dn-deck-context-body p { margin: 0 0 var(--space-2); }
.dn-deck-context-row .dn-deck-context-body p:last-child { margin-bottom: 0; }
.dn-deck-context-row textarea.dn-deck-context-edit {
  width: 100%;
  min-height: 8rem;
  font: inherit;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.55;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.dn-deck-context-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
  font-weight: 400;
}
.dn-deck-context-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
}
.dn-deck-context-edit-btn {
  padding: 4px var(--space-2-5);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-2);
  cursor: pointer;
}
.dn-deck-context-edit-btn:hover { background: var(--surface-2); color: var(--text); }
.dn-deck-context-status { color: var(--text-3); }

/* ---- Notifications + ingest popover ----------------------------------- */
/* Lives in the page shell, fixed to the top-right (or bottom on mobile).
   IngestNudgeJob broadcasts new popover partials here via Turbo Streams.
   Each popover dismisses itself by removing its element on No or Yes. */
.dn-notifications {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast, 1000);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
  max-width: 360px;
}
.dn-ingest-popover {
  pointer-events: auto;
  animation: dn-ingest-popover-in 240ms ease-out;
}
@keyframes dn-ingest-popover-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dn-ingest-popover-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.dn-ingest-popover-title {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--text);
}
.dn-ingest-popover-prompt {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.dn-ingest-popover-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}
.dn-ingest-popover-yes,
.dn-ingest-popover-no {
  padding: 6px var(--space-3);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}
.dn-ingest-popover-yes {
  background: var(--accent-2);
  color: var(--accent-ink);
  border-color: var(--accent-2);
}
.dn-ingest-popover-yes:hover { filter: brightness(0.95); }
.dn-ingest-popover-no:hover { background: var(--surface-3); }

@media (max-width: 640px) {
  .dn-notifications {
    top: auto;
    bottom: var(--space-4);
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
}

/* ---- Wizard step header (.dn-wizard-step) ----------------------------- */
/* Shared header pattern for every wizard page — accent-color step number,
   page label, and a one-sentence intent line. Each page declares its own
   identity through this pattern so the wizard doesn't feel like the same
   form three times. */
.dn-wizard-step {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-5);
}
.dn-wizard-step-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-ink);
  background: var(--accent-bg);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius-md);
  padding: 1px var(--space-1-5);
  align-self: flex-start;
}
.dn-wizard-step-title {
  font-family: var(--sans);
  font-size: var(--fs-xl);
  font-weight: 500;
  color: var(--text);
  margin: 0;
}
.dn-wizard-step-intent {
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text-2);
  margin: 0;
}

/* ---- Wizard page surface ---------------------------------------------- */
.dn-wizard {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4);
}
.dn-wizard-body { font-size: var(--fs-base); }
.dn-wizard-form { display: flex; flex-direction: column; gap: var(--space-4); }
.dn-wizard-multiselect {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.dn-wizard-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.dn-wizard-option:hover { background: var(--surface-2); border-color: var(--border); }
.dn-wizard-option:has(input:checked) {
  background: var(--accent-bg);
  border-color: var(--accent-2);
  color: var(--accent-ink);
}
.dn-wizard-foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.dn-wizard-primary {
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-base);
  font-weight: 500;
  background: var(--accent-2);
  color: var(--accent-ink);
  border: 1px solid var(--accent-2);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.dn-wizard-primary:hover { filter: brightness(0.95); }
.dn-wizard-tbd {
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-3);
  font-style: italic;
}
.dn-wizard-secondary {
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-base);
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
}
.dn-wizard-secondary:hover { background: var(--surface-3); color: var(--text); }
.dn-wizard-error {
  padding: var(--space-2) var(--space-3);
  background: var(--surface-3);
  border-left: 3px solid var(--red, #c5221f);
  border-radius: var(--radius-md);
  color: var(--text);
  margin: 0 0 var(--space-3);
}
.dn-wizard-textarea {
  width: 100%;
  min-height: 8rem;
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: var(--fs-base);
  line-height: 1.55;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  resize: vertical;
}
.dn-wizard-hint {
  margin: var(--space-1) 0 0;
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.dn-wizard-panelists {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-2-5);
}
.dn-wizard-panelist {
  display: flex;
  gap: var(--space-2-5);
  padding: var(--space-3);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.dn-wizard-panelist:has(input:checked) {
  background: var(--accent-bg);
  border-color: var(--accent-2);
}
.dn-wizard-panelist.is-premium {
  opacity: 0.6;
  cursor: not-allowed;
}
.dn-wizard-panelist-portrait {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.dn-wizard-panelist-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--fs-sm);
}
.dn-wizard-panelist-lens {
  color: var(--text-2);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dn-wizard-panelist-blurb {
  color: var(--text-2);
  line-height: 1.4;
}
.dn-wizard-subhead {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
  margin: var(--space-4) 0 var(--space-2);
}
.dn-synthesis-status {
  margin-bottom: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-3);
  min-height: 1.4em;
}
.dn-synthesis-status.is-failed { color: var(--text-2); }
.dn-wizard-panelists-summary {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.dn-wizard-panelists-summary li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1-5) var(--space-2-5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.dn-decktitle {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-3-5);
  color: var(--text);
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2-5);
}
.dn-decktitle-text { letter-spacing: -0.015em; }
.dn-decktitle-ext {
  align-self: center;
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-4);
  text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast);
}
.dn-decktitle-ext:hover,
.dn-decktitle-ext:focus-visible {
  background: var(--accent-bg);
  color: var(--accent-ink);
  transform: translateY(-1px);
}
.dn-decktitle-ext:active {
  background: var(--accent);
  color: var(--ink-on-accent);
  transform: translateY(0);
}
@keyframes dnBreath {
  0%, 100% { box-shadow: 0 0 0 3px rgba(251,188,4,0.25); }
  50%      { box-shadow: 0 0 0 6px rgba(251,188,4,0.08); }
}
@keyframes dnTyping {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%      { transform: translateY(-2px); opacity: 1; }
}

/* ---- Findings table ---- */
.dn-table { display: block; padding-bottom: var(--space-10); }
turbo-frame { display: block; }
.dn-table-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-2-5);
}
.dn-table-title { display: flex; align-items: baseline; gap: var(--space-2-5); }
.dn-table-title h2 {
  font-family: var(--sans);
  font-weight: 500; font-size: var(--fs-2xl);
  margin: 0; letter-spacing: -0.005em;
}

.dn-sort { display: flex; gap: var(--space-0-5); background: var(--surface-3); border-radius: var(--radius-xl); padding: 3px; }
.dn-sort-btn {
  font-size: var(--fs-sm); font-weight: 500;
  padding: 5px var(--space-3); border-radius: 18px;
  white-space: nowrap;
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: var(--space-1-5);
  transition: background var(--dur-fast), color var(--dur-fast);
}
.dn-sort-btn:hover { color: var(--text); }
.dn-sort-btn.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

/* table — grouped structure (no card wrapper) */
.dn-table-body {
  display: flex; flex-direction: column;
}

/* Each group is its own card — flush-left, no inner inset */
.dn-group-rows {
  background: transparent;
  border: 0;
  border-radius: 0;
}

/* Slide-sort layout: thumbnail on left spanning all rows, findings on right.
   Sits inside the expanded slide-group card. */
.dn-group-slidelayout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-6);
  align-items: start;
}
.dn-group-slidethumb {
  position: sticky;
  top: 24px;
}
.dn-group-slidelayout .dn-group-rows {
  min-width: 0;
}

/* Slide thumbnail — stylized placeholder, NOT real slide content */
.dn-slideprev {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.dn-slideprev-frame {
  position: relative;
  display: block;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
  aspect-ratio: 16 / 9;
}
.dn-slideprev:hover .dn-slideprev-frame {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg), var(--shadow-2);
  transform: translateY(-1px);
}
.dn-slideprev-stage {
  position: absolute;
  inset: 0;
  padding: 10%;
  display: flex; flex-direction: column;
  gap: 6%;
  background: linear-gradient(180deg, #FEFEFC 0%, #FBFBF7 100%);
}
.dn-slideprev-tag {
  position: absolute;
  left: 8px; bottom: 8px;
  font-family: var(--mono);
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--accent-ink);
  background: rgba(255, 255, 255, 0.92);
  padding: var(--space-0-5) var(--space-1-5);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(2px);
}
.dn-slideprev-ext {
  position: absolute;
  right: 8px; bottom: 8px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  opacity: 1;
  transition: opacity var(--dur-fast);
}
.dn-slideprev:hover .dn-slideprev-ext {
  background: var(--accent);
  color: var(--surface);
  border-color: var(--accent);
}

/* Size variants */
.dn-slideprev-lg { width: 100%; }
.dn-slideprev-md { width: 160px; }
.dn-slideprev-sm { width: 160px; }

/* ---- Slide mock content primitives ---- */
.dn-slideprev-stage > * { display: block; }

/* Text bars, bullets, etc. — all use subtle neutral fills */
.dn-mock-brand {
  width: 18%; height: 4px; background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.dn-mock-h1 {
  width: 80%;
  font-family: var(--sans-display);
  font-size: var(--fs-xs); font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.01em;
  overflow: hidden;
}
.dn-mock-h2 {
  width: 70%;
  font-family: var(--sans-display);
  font-size: 9px; font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.005em;
  overflow: hidden;
  flex-shrink: 0;
}
.dn-mock-h2-center { text-align: center; width: 100%; }
.dn-mock-rule {
  width: 30%; height: 2px; background: var(--text-4); opacity: 0.4;
  border-radius: 1px;
  margin-top: auto;
}

/* Lines for plain text slides */
.dn-mock-lines { display: flex; flex-direction: column; gap: 3px; margin-top: var(--space-1); }
.dn-mock-lines > span {
  height: 3px; background: var(--text-4); opacity: 0.3; border-radius: 1px;
}

/* Bar chart */
.dn-mock-chart {
  flex: 1; display: flex; align-items: flex-end; gap: var(--space-1);
  padding: 0 2%; min-height: 0;
  border-bottom: 1px solid var(--border-soft);
}
.dn-mock-bar {
  flex: 1;
  background: var(--text-4);
  opacity: 0.55;
  border-radius: 1px 1px 0 0;
  min-width: 4px;
}
.dn-mock-bar:nth-child(3) { background: var(--accent); opacity: 0.9; }
.dn-mock-bar:nth-child(5) { background: var(--accent); opacity: 0.75; }

/* Logo grid */
.dn-mock-logos {
  flex: 1;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: var(--space-1);
}
.dn-mock-logo {
  background: var(--surface-3);
  border-radius: 2px;
  min-height: 10px;
}
.dn-mock-logo:nth-child(odd) { background: var(--text-4); opacity: 0.25; }

/* Three columns */
.dn-mock-cols {
  flex: 1;
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-1-5);
}
.dn-mock-col {
  display: flex; flex-direction: column; gap: 3px;
  padding: var(--space-1);
  background: var(--surface-3);
  border-radius: var(--radius-sm);
}
.dn-mock-col > span {
  height: 2px; background: var(--text-4); opacity: 0.4; border-radius: 1px;
}
.dn-mock-col > span:first-child { height: 4px; background: var(--text-2); opacity: 0.6; }

/* Bullets */
.dn-mock-bullets {
  flex: 1; display: flex; flex-direction: column; gap: 5px;
}
.dn-mock-bullets > span {
  display: flex; align-items: center; gap: 5px;
}
.dn-mock-bullets > span > b {
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.dn-mock-bullets > span > i {
  flex: 1; height: 2px; background: var(--text-4); opacity: 0.4; border-radius: 1px;
}
.dn-mock-bullets > span:nth-child(2) > i { width: 80%; flex: 0 0 80%; }
.dn-mock-bullets > span:nth-child(3) > i { width: 65%; flex: 0 0 65%; }
.dn-mock-bullets > span:nth-child(4) > i { width: 70%; flex: 0 0 70%; }

/* Table of contents */
.dn-mock-toc {
  flex: 1; display: flex; flex-direction: column; gap: var(--space-1);
}
.dn-mock-toc > span {
  display: flex; align-items: center; gap: var(--space-1-5);
  border-bottom: 1px dotted var(--border);
  padding-bottom: var(--space-0-5);
}
.dn-mock-toc > span > em {
  width: 10px; height: 6px;
  font-family: var(--mono); font-size: 6px;
  background: var(--accent-bg); border-radius: 1px;
  flex-shrink: 0;
}
.dn-mock-toc > span > i {
  height: 2px; background: var(--text-4); opacity: 0.4; border-radius: 1px;
}
.dn-mock-toc > span:nth-child(1) > i { width: 60%; }
.dn-mock-toc > span:nth-child(2) > i { width: 75%; }
.dn-mock-toc > span:nth-child(3) > i { width: 55%; }
.dn-mock-toc > span:nth-child(4) > i { width: 65%; }

/* Quote slide */
.dn-mock-quote {
  font-family: var(--serif, Georgia, serif);
  font-size: var(--fs-3xl); font-weight: 500;
  color: var(--accent);
  line-height: 0.8;
  margin: 0 auto var(--space-1);
}
.dn-slideprev-quote { align-items: center; justify-content: center; text-align: center; }

.dn-row {
  display: grid;
  grid-template-columns: 140px 40px 1fr;  /* thumb · portrait · body */
  column-gap: 18px;
  align-items: start;
  width: 100%;
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  font-size: var(--fs-base);
  transition: background var(--dur-fast);
  text-align: left;
  cursor: pointer;
  background: transparent;
}
/* no-thumb: drop the first column */
.dn-row--no-thumb { grid-template-columns: 40px 1fr; }
/* no-thumb + no-rev: just body */
.dn-row--no-thumb.dn-row--no-rev { grid-template-columns: 1fr; }
/* has-thumb + no-rev (unusual) */
.dn-row--with-thumb.dn-row--no-rev { grid-template-columns: 140px 1fr; }

.dn-row:last-child { border-bottom: 0; }
.dn-row:hover { background: var(--surface-3); }
.dn-row.is-open { background: var(--accent-bg); }

/* Per-row action clusters (feedback + decide) + resolved state */
.dn-row-actions {
  margin-top: -4px;
  display: flex;
  align-items: flex-start;
}
.dn-action-cluster {
  padding-left: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
  align-items: stretch;
  width: 100%;
  max-width: 320px;
}
/* When the action cluster sits inside cell-thumb (reviewer/theme grouping),
   it shares the 140px thumbnail column. No left padding; just stack under
   the thumbnail. */
.dn-cell-thumb .dn-row-actions {
  margin-top: var(--space-2);
}
.dn-cell-thumb .dn-action-cluster {
  padding-left: 0;
  max-width: 140px;
}
.dn-action-cluster .dn-vote {
  justify-content: flex-start;
  gap: var(--space-1-5);
}
.dn-action-cluster .dn-decide {
  width: 100%;
  justify-content: center;
}
.dn-action-cluster .dn-decide .dn-decide-btn {
  flex: 1;
  justify-content: center;
}
.dn-action-cluster .dn-decide-pair {
  display: flex;
  gap: var(--space-1-5);
  width: 100%;
}
.dn-action-cluster .dn-decide-pair .dn-decide-btn {
  flex: 1 1 50%;
  min-width: 0;
}
.dn-vote {
  display: inline-flex;
  gap: var(--space-1);
  padding: var(--space-0-5);
  border-radius: var(--radius-md);
  background: transparent;
}
.dn-vote-btn {
  height: 28px;
  padding: 0 var(--space-2-5) 0 var(--space-2);
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--text-3);
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.dn-vote-label { white-space: nowrap; }
.dn-vote-btn:hover { background: var(--surface-3); color: var(--text); }
.dn-vote-btn.is-on.is-up   { color: var(--green); background: rgba(30, 142, 62, 0.10); }
.dn-vote-btn.is-on.is-down { color: var(--red);   background: rgba(217, 48, 37, 0.10); }
/* button_to wraps buttons in <form> — keep the row layout intact */
.dn-vote form { display: inline; margin: 0; }
.dn-vote-btn.is-selected {
  font-weight: 600;
}
.dn-vote-btn[aria-label="Helpful"].is-selected {
  color: var(--blue);
  background: rgba(26, 115, 232, 0.10);
}
.dn-vote-btn[aria-label="Not helpful"].is-selected {
  color: #B5316B;
  background: rgba(217, 79, 138, 0.12);
}
.dn-vote-btn.is-muted { opacity: 0.6; filter: saturate(0.5); }
.dn-vote-btn.is-muted:hover { opacity: 1; filter: none; }

.dn-decide {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.dn-decide-btn {
  font-family: var(--sans);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 0;
  padding: 7px var(--space-3-5);
  display: inline-flex; align-items: center; gap: var(--space-1-5);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.dn-decide-btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.dn-decide-btn + .dn-decide-btn { border-left: 1px solid var(--border); }
.dn-decide-btn svg { color: currentColor; }

/* button_to emits a <form> wrapping the button; strip default form spacing
   so the Fix/Undo row sits flush under Reply in Slides. */
.dn-decide form { margin: 0; display: flex; width: 100%; }
.dn-decide form .dn-decide-btn { flex: 1; justify-content: center; }

/* Fix it — primary, encouraging blue. Undo — muted, reversible. */
.dn-decide-apply { color: var(--text); font-weight: 600; }
.dn-decide-apply:hover { background: rgba(26, 115, 232, 0.10); color: var(--blue); }
.dn-decide-undo { color: var(--text-3); }
.dn-decide-undo:hover { background: var(--surface-3); color: var(--text); }

/* In-flight state for Fix it / Undo: disable, desaturate, render a spinner.
   Turbo toggles [disabled] and replaces the button's innerHTML with the
   data-turbo-submits-with label during the request — which wipes out any
   child icon/spinner elements. So we use a ::before pseudo-element, which
   Turbo can't clobber, to render the spinner inline before the label. */
.dn-decide-btn:disabled,
.dn-decide-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.4);
  background: transparent !important;
}
.dn-decide-btn:disabled:hover,
.dn-decide-btn[disabled]:hover { background: transparent; }
.dn-decide-btn:disabled::before,
.dn-decide-btn[disabled]::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.8px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: dn-btn-spin 0.7s linear infinite;
  margin-right: var(--space-0-5);
  vertical-align: -1px;
}
@keyframes dn-btn-spin {
  to { transform: rotate(360deg); }
}

/* While any Fix/Undo is in flight, lock all other Fix/Undo buttons across
   the page. Without this, a fast second click can land on a *different*
   finding after the Turbo Stream replacement shifts the visible buttons —
   silently editing a slide the user never targeted. */
body.is-fix-pending .dn-decide-apply,
body.is-fix-pending .dn-decide-undo {
  pointer-events: none;
  opacity: 0.55;
  filter: saturate(0.4);
}

/* Applied-fix state: body text fades, vivid "Updated" chip below it. */
.dn-finding-applied .dn-finding-body { color: var(--text-4); }
.dn-finding-applied .dn-finding-body p { opacity: 0.72; }
.dn-finding-updated-chip {
  margin-top: var(--space-2-5);
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-1-5);
  align-items: baseline;
  align-self: flex-start;
  max-width: 68ch;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(26, 115, 232, 0.10), rgba(26, 115, 232, 0.02));
  border: 1px solid rgba(26, 115, 232, 0.25);
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.4;
  color: var(--text);
}
.dn-finding-updated-label {
  font-weight: 700;
  color: var(--blue);
  letter-spacing: 0.01em;
}
.dn-finding-updated-detail { color: var(--text); }

/* Resolved state — row fades; action clusters swap for a tag + undo */
.dn-row.is-resolved .dn-finding-body { color: var(--text-3); }
.dn-row.is-resolved .dn-cell-portrait { opacity: 0.55; }

/* Per-row slide thumbnail cell (used in reviewer/theme sorts) */
.dn-cell-thumb {
  display: flex; align-items: flex-start;
}

/* Small reviewer avatar — circular, name hidden by default (group headers carry the name) */
.dn-cell-portrait {
  display: flex; align-items: flex-start;
  padding-top: var(--space-0-5);
}
/* First row in a slide group: pull up to align with the thumbnail's top edge.
   Round avatar gets a small negative margin so its filled pixels (which
   start just below the bounding box top because of the empty corner space)
   read aligned with the rectangular thumbnail's top edge. */
.dn-group-slidelayout .dn-group-rows > turbo-frame:first-of-type > .dn-row {
  padding-top: 0;
}
.dn-group-slidelayout .dn-group-rows > turbo-frame:first-of-type .dn-cell-portrait {
  padding-top: 0;
  margin-top: 0;
}
.dn-group-slidelayout .dn-group-rows > turbo-frame:first-of-type .dn-finding-body {
  margin-top: -2px;
}
.dn-portrait {
  position: relative;
  width: 40px; height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.dn-portrait-initial {
  font-family: var(--sans-display);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  opacity: 0.95;
}
/* Name pill is no longer displayed on the row avatar — group headers and hover tooltips carry identity */
.dn-portrait-name { display: none; }

/* Body prose — the finding itself, styled as body copy */
.dn-cell-body {
  display: flex; align-items: flex-start;
  min-width: 0;
  padding-top: var(--space-0-5);
}
.dn-finding-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dn-finding-body {
  margin: 0;
  font-family: var(--serif, Georgia, serif);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 68ch;
  text-wrap: pretty;
}
.dn-finding-body p { margin: 0; }
.dn-finding-body p + p { margin-top: 0.7em; }
.dn-row.is-open .dn-finding-body { color: var(--text); }

/* expanded row: aligned under the body column */
.dn-row-expand {
  padding: 18px 0 22px 0;
  background: var(--accent-bg);
  border-bottom: 1px solid var(--border-soft);
}
/* fallback: expanded block already sits under full row */
/* When reviewer cell is hidden (reviewer-sort), content is already col 1 */
/* expanded row sits full-width */
.dn-expand-main { max-width: 640px; }

.dn-thread {
  display: flex; flex-direction: column; gap: var(--space-2);
  margin-bottom: var(--space-3-5);
  padding-left: var(--space-3);
  border-left: 2px solid var(--border);
}
.dn-thread-msg {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: var(--space-2-5);
  font-size: var(--fs-sm);
  color: var(--text-2);
  line-height: 1.45;
}
.dn-thread-msg.is-mine .dn-thread-who { color: var(--text); font-weight: 500; }

.dn-empty {
  padding: var(--space-10) var(--space-5); text-align: center;
  font-size: var(--fs-base); color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
}

/* ---- Footer ---- */
.dn-footer {
  border-top: 1px solid var(--border-soft);
  padding-top: 18px !important; padding-bottom: var(--space-6) !important;
  display: flex; justify-content: space-between;
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-top: var(--space-10);
}
.dn-footer-right { display: flex; gap: var(--space-3); }
.dn-footer-right span { cursor: pointer; }
.dn-footer-right span:hover { color: var(--blue); }

/* ---- Scrollbar ---- */
.dn-main::-webkit-scrollbar, .dn-decklist::-webkit-scrollbar { width: 10px; }
.dn-main::-webkit-scrollbar-thumb, .dn-decklist::-webkit-scrollbar-thumb {
  background: transparent; border-radius: 5px;
  border: 3px solid transparent; background-clip: padding-box;
}
.dn-main:hover::-webkit-scrollbar-thumb, .dn-decklist:hover::-webkit-scrollbar-thumb {
  background: var(--border); background-clip: padding-box;
  border: 3px solid transparent;
}
.dn-main::-webkit-scrollbar-track, .dn-decklist::-webkit-scrollbar-track { background: transparent; }
@keyframes dnModalScrim { from { opacity: 0; } to { opacity: 1; } }

.dn-modal {
  position: relative;
  width: 100%; max-width: 520px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 64px rgba(32,33,36,0.24), 0 2px 8px rgba(32,33,36,0.08);
  padding: 36px var(--space-10) var(--space-8);
  animation: dnModalIn .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes dnModalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.dn-modal-inline-email {
  font-family: var(--mono);
  font-size: var(--fs-base);
  background: var(--surface-3);
  padding: 1px var(--space-1-5); border-radius: var(--radius-sm);
}

/* ===== Findings: grouped headers ====================================== */
.dn-group + .dn-group { margin-top: var(--space-4); }
.dn-group-slide + .dn-group-slide { margin-top: var(--space-2-5); }
.dn-group-slide.is-collapsed + .dn-group-slide.is-collapsed { margin-top: var(--space-1-5); }
.dn-groupheader-count {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--text-4);
  white-space: nowrap;
}

/* Reviewer group */
.dn-groupheader-rev {
  display: flex; align-items: center; gap: var(--space-2-5);
  padding: var(--space-2-5) 0 var(--space-2);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--border-soft);
}
.dn-groupheader-av {
  width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 600;
  flex-shrink: 0;
}
.dn-groupheader-name {
  font-family: var(--serif);
  font-size: var(--fs-lg); font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.dn-groupheader-lens {
  font-size: var(--fs-sm);
  color: var(--text-3);
  font-style: italic;
  flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}

/* Theme group */
.dn-groupheader-theme {
  display: flex; align-items: baseline; gap: var(--space-2-5);
  padding: var(--space-2-5) 0 var(--space-2);
  margin-bottom: var(--space-1);
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.dn-groupheader-themedot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-3);
  align-self: center;
  flex-shrink: 0;
}
.dn-theme-claim     .dn-groupheader-themedot { background: #D93025; }
.dn-theme-structure .dn-groupheader-themedot { background: #1A73E8; }
.dn-theme-copy      .dn-groupheader-themedot { background: #F9AB00; }
.dn-theme-design    .dn-groupheader-themedot { background: var(--green-bright); }
.dn-theme-audience  .dn-groupheader-themedot { background: #9334E6; }
/* "Other" / uncategorized has no theme color — hide the dot rather than
   render a stray gray bullet that reads as a list-style bug. */
.dn-theme-other     .dn-groupheader-themedot { display: none; }

.dn-groupheader-themename {
  font-family: var(--serif);
  font-size: var(--fs-lg); font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}
.dn-groupheader-themehint {
  font-size: var(--fs-sm);
  color: var(--text-3);
  font-style: italic;
  flex: 1;
  min-width: 140px;
  text-wrap: pretty;
}

/* Pulse when the findings group is scrolled into view */
@keyframes dn-group-pulse {
  0%   { background: transparent; }
  20%  { background: var(--accent-bg); }
  100% { background: transparent; }
}
.dn-group-pulse {
  animation: dn-group-pulse 1.4s ease-out;
  border-radius: var(--radius-md);
}

/* Slide-group header bar — always visible on slide-sort groups. Clicking
   toggles collapsed/expanded. When collapsed the group shows only this bar;
   when expanded the bar sits above the thumb + rows. Chevron stays pinned at
   the far right so the user can rapid-toggle in place. When every finding in
   the group is resolved the bar shifts to a muted green "done" tone. */
.dn-group-slidebar {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
  width: 100%;
  position: relative;
  padding: var(--space-2-5) var(--space-3-5) var(--space-2-5) var(--space-3-5);
  margin: 0 0 var(--space-3-5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-family: var(--sans);
  text-align: left;
  cursor: pointer;
  color: var(--text-2);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.dn-group-slidebar:hover {
  background: var(--surface-2);
  border-color: var(--border);
}
.dn-group-slidebar.is-allresolved {
  background: color-mix(in oklch, var(--surface), var(--green-bright) 4%);
}
.dn-group-slidebar.is-allresolved:hover {
  background: color-mix(in oklch, var(--surface), var(--green-bright) 7%);
}
.dn-group-slidebar.is-expanded {
  /* When expanded, meld the bar with the content below — no bottom rounding. */
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom: 0;
  margin-bottom: 0;
}
.dn-group-slidebar-check {
  color: var(--green);
  flex-shrink: 0;
}
.dn-group-slidebar-tag {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-3);
  padding: var(--space-0-5) var(--space-1-5);
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-left: auto;
}
.dn-group-slidebar-title {
  font-family: var(--serif, Georgia, serif);
  font-size: var(--fs-md);
  font-style: italic;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.dn-group-slidebar.is-allresolved .dn-group-slidebar-title {
  color: var(--text-2);
}
.dn-group-slidebar-count {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.dn-group-slidebar-chev {
  color: var(--text-4);
  flex-shrink: 0;
  transition: color var(--dur-fast), transform var(--dur-base) var(--ease-standard);
}
.dn-group-slidebar:hover .dn-group-slidebar-chev {
  color: var(--text-2);
}
.dn-group-slidebar:not(.is-expanded) .dn-group-slidebar-chev {
  transform: rotate(-90deg);
}

/* When expanded, the thumb + rows grid sits directly below the bar and shares
   its border — forming one cohesive card. */
.dn-group:not(.is-collapsed) .dn-group-slidelayout {
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  border-radius: 0;
  padding: 18px var(--space-5) 18px var(--space-3-5);
  margin-bottom: var(--space-3-5);
}

/* ---- Collapsed sidebar state ---- */
.dn-sidebar.is-collapsed .dn-wordmark,
.dn-sidebar.is-collapsed .dn-iconbtn,
.dn-sidebar.is-collapsed .dn-share-labels,
.dn-sidebar.is-collapsed .dn-deckgroup .dn-groupheader,
.dn-sidebar.is-collapsed .dn-deck-main,
.dn-sidebar.is-collapsed .dn-deck-sub,
.dn-sidebar.is-collapsed .dn-unread,
.dn-sidebar.is-collapsed .dn-acc-name,
.dn-sidebar.is-collapsed .dn-collapsebtn-label {
  display: none !important;
}

.dn-sidebar.is-collapsed .dn-masthead {
  justify-content: center;
  padding: var(--space-3-5) 0 var(--space-2-5);
}
.dn-sidebar.is-collapsed .dn-logotype { gap: 0; }

.dn-sidebar.is-collapsed .dn-share {
  justify-content: center;
  padding: var(--space-2);
  margin: var(--space-1-5) var(--space-2-5) var(--space-3);
  min-height: 38px;
}
.dn-sidebar.is-collapsed .dn-share-plus {
  margin: 0;
}

.dn-sidebar.is-collapsed .dn-deckrow {
  justify-content: center;
  padding: var(--space-2) 0;
  margin: var(--space-0-5) var(--space-2-5);
  gap: 0;
}
.dn-sidebar.is-collapsed .dn-state {
  margin: 0;
}
.dn-sidebar.is-collapsed .dn-deckrow.is-active {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.dn-sidebar.is-collapsed .dn-deckgroup {
  margin: var(--space-3-5) 0 0;
}
.dn-sidebar.is-collapsed .dn-deckgroup + .dn-deckgroup {
  border-top: 1px solid var(--border-soft);
  padding-top: var(--space-2-5);
}

.dn-sidebar.is-collapsed .dn-sidefoot {
  padding: var(--space-2) var(--space-1-5);
}
.dn-sidebar.is-collapsed .dn-collapsebtn {
  justify-content: center;
  padding: var(--space-2) 0;
}
.dn-sidebar.is-collapsed .dn-account {
  justify-content: center;
  padding: var(--space-1-5) 0;
  margin: 0;
}
.dn-portrait-lg .dn-portrait-initial {
  font-family: var(--sans-display);
  font-size: var(--fs-lg);
  font-weight: 600;
}

/* Narrow: Data grid stacks */
@media (max-width: 640px) {
  .dn-data { grid-template-columns: 1fr; }
}

/* =============================================================
   POLISH PASS — addressing five-persona review findings
   ============================================================= */

/* ---- Finding card hierarchy (finding #4) ----
   Title-equivalent role lives in the body's first paragraph; lift its weight
   and color so the eye lands there before the supporting text below. */
.dn-row:not(.dn-finding-applied) .dn-finding-body p:first-child {
  color: var(--text);
  font-weight: 500;
  font-size: var(--fs-md);
  line-height: 1.45;
}
.dn-row:not(.dn-finding-applied) .dn-finding-body p + p {
  color: var(--text-3);
  font-size: var(--fs-md);
  margin-top: 0.4em;
}

/* Slide-group peek: when a slide has 2+ findings, the first shows in full,
   the second shows a single faded line as a "more below" affordance, and any
   beyond that are hidden until the user clicks to expand. */
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(n+3) {
  display: none;
}
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) {
  cursor: pointer;
}
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-row {
  padding-bottom: var(--space-2);
}
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-finding-body {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-finding-body::after {
  content: "";
  position: absolute;
  inset: 0 0 0 30%;
  background: linear-gradient(90deg, transparent, var(--surface-2));
  pointer-events: none;
}
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-vote {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity var(--dur-fast) ease;
}
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-decide,
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-finding-updated-chip {
  display: none;
}

/* ---- Vote vs decide button treatment (finding #5) ----
   Make the difference legible and intentional: votes look quieter, sit in a
   loose row; the decide cluster is the bordered toolbar. A separator pushes
   them apart so they read as two distinct concerns. */
.dn-action-cluster .dn-vote {
  padding-bottom: var(--space-1);
  margin-bottom: var(--space-1);
}

/* ---- Sort tabs (finding #6) ----
   Tighten hover/focus so the segmented-control reads as buttons, not links. */
.dn-sort-btn {
  text-decoration: none;
  cursor: pointer;
}
.dn-sort-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.dn-sort-btn:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

/* ---- Inline confirmation pill (finding #2) ----
   Sits adjacent to the action cluster; fades in for ~1.6s then out. */
.dn-row-feedback {
  display: inline-flex;
  align-items: center;
  margin-left: var(--space-2-5);
  margin-top: var(--space-1);
  padding: var(--space-0-5) var(--space-2);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--green);
  background: rgba(30, 142, 62, 0.10);
  border-radius: var(--radius-md);
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity var(--dur-base) ease, transform var(--dur-base) ease;
  pointer-events: none;
}
.dn-row-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.dn-row-feedback.is-fading {
  opacity: 0;
  transition: opacity var(--dur-slow) ease;
}

/* ---- Empty state (finding #7) ----
   Centered, soft icon, kind copy, link affordance. */
.dn-empty {
  padding: 56px var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 14px;
  color: var(--text-3);
}
.dn-empty-icon {
  width: 56px; height: 56px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-4);
  margin-bottom: var(--space-1);
}
.dn-empty-title {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-2);
}
.dn-empty-body {
  font-size: var(--fs-base);
  max-width: 42ch;
  line-height: 1.5;
}
.dn-empty-link {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid rgba(26,115,232,0.4);
}
.dn-empty-link:hover { border-bottom-color: var(--blue); }

/* ---- Mobile pass (findings #10–#12) ---- */
.dn-mobile-trigger,
.dn-mobile-scrim { display: none; }

/* Chat label has two spans (full + short) — desktop shows full, mobile
   shows short. Declared HERE so the @media (max-width: 640px) rule
   below can flip them. */
.dn-decide-chat-full  { display: inline; }
.dn-decide-chat-short { display: none; }

/* Mobile-only inline slide thumbnail (above the comment body). Hidden
   everywhere except mobile, and even there only when the user toggles
   "See Slide". */
.dn-mobile-thumb { display: none; }
.dn-decide-seeslide { display: none; }

@media (max-width: 640px) {
  .dn-shell {
    grid-template-columns: 1fr;
  }
  .dn-shell:has(.dn-sidebar.is-collapsed) { --dn-side-w: 0; }

  .dn-sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: min(86vw, 320px);
    z-index: var(--z-mobile-bar);
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-standard);
    box-shadow: var(--shadow-3);
  }
  .dn-shell.dn-drawer-open .dn-sidebar { transform: translateX(0); }

  .dn-mobile-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(32, 33, 36, 0.4);
    z-index: var(--z-overlay-back);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-base) ease;
  }
  .dn-shell.dn-drawer-open .dn-mobile-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  /* Pad the main column under the floating trigger so headings clear it. */
  .dn-main { padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  .dn-main > * { padding-left: 18px; padding-right: 18px; }
  .dn-deckhead { padding-top: var(--space-4); }
  .dn-decktitle { font-size: var(--fs-3xl); }

  /* Collapse the slide-sort layout to a single column. The big left-side
     thumbnail hides; the user reveals a smaller inline thumbnail above
     the comment via the "See Slide" toggle. */
  .dn-group-slidelayout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .dn-group-slidethumb { display: none; }
  .dn-action-thumb { display: none; }
  /* Reveal the See Slide toggle button + show inline thumb when user opts in. */
  .dn-decide-seeslide { display: inline-flex; width: 100%; }
  .dn-row.is-slide-shown .dn-mobile-thumb {
    display: block;
    margin-bottom: 0.6rem;
    max-width: 100%;
  }
  /* Override the fixed-pixel .dn-slideprev-sm width so the mobile inline
     thumb scales with text size (~ 20rem). */
  .dn-mobile-thumb .dn-slideprev,
  .dn-mobile-thumb .dn-slideprev-sm {
    width: min(100%, 20rem);
  }
  .dn-group:not(.is-collapsed) .dn-group-slidelayout {
    padding: var(--space-3-5);
  }

  /* Stack each finding row: body on top, actions underneath. */
  .dn-row,
  .dn-row--no-thumb,
  .dn-row--with-thumb,
  .dn-row--no-thumb.dn-row--no-rev,
  .dn-row--with-thumb.dn-row--no-rev {
    grid-template-columns: 1fr;
    column-gap: 0;
    row-gap: var(--space-2-5);
    padding: var(--space-3-5) 0;
  }
  .dn-cell-thumb,
  .dn-cell-portrait { display: none; }

  .dn-row-actions { margin-top: 0.4rem; }
  .dn-action-cluster {
    padding-left: 0;
    max-width: 22rem;
    gap: 0.4rem;
  }

  /* Mobile touch target floor (Apple HIG 44pt / Material 48dp).
     Desktop keeps the tighter padding for mouse precision. */
  .dn-decide-btn,
  .dn-decide-seeslide,
  .dn-decide-chat { min-height: 44px; }
  /* Vote pair: half-width side-by-side, icon-only — matches the See
     Slide / Chat decide-btn styling for a cohesive column. button_to
     wraps each button in a <form>, so we have to size the forms (the
     real flex children) and stretch the buttons inside them. */
  .dn-action-cluster .dn-vote {
    display: flex;
    flex-direction: row;
    gap: 0.4rem;
    width: 100%;
  }
  .dn-action-cluster .dn-vote form {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    margin: 0;
  }
  .dn-action-cluster .dn-vote-btn {
    width: 100%;
    height: 2.5rem;
    padding: 0;
    justify-content: center;
  }
  .dn-vote-label { display: none; }

  .dn-action-cluster .dn-decide { width: 100%; }
  .dn-decide-btn { width: 100%; min-width: 0; justify-content: center; }
  /* Chat button: shrink the label to "Chat" / "Close" at this width. */
  .dn-decide-chat-full { display: none; }
  .dn-decide-chat-short { display: inline; }

  /* Reviewer chip strip scrolls horizontally rather than wrapping into 4 rows. */
  .dn-filterchips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--space-1-5);
    -webkit-overflow-scrolling: touch;
  }
  .dn-filterchips::-webkit-scrollbar { display: none; }

  .dn-row-feedback { margin-left: 0; }
}

/* Hide the desktop-only sidebar trigger above the breakpoint so layout
   doesn't shift when JS controllers attach. */
@media (min-width: 641px) {
  .dn-mobile-trigger,
  .dn-mobile-scrim { display: none !important; }
}

/* ---- Finding thread (M5: inline replies) ----
   A quiet doc-comment thread sitting beneath each finding's body. Not
   iMessage — no big bubbles, no heavy color. Reviewer messages echo
   the original finding's voice; user messages get a soft tinted
   container with a small initial avatar on the right. */
.dn-thread {
  margin-top: var(--space-3);
  padding-top: var(--space-2-5);
  border-top: 1px dashed var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-2-5);
  max-width: 72ch;
  /* Sit below the row's grid (avatar | body | actions) and span all
     columns so the thread claims the full row width once it extends
     below the action cluster. */
  grid-column: 1 / -1;
}
/* Chat compose box: blinds-style slide animation on open/close. Use
   max-height + opacity instead of display:none so we can transition. */
.dn-thread .dn-thread-compose {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  border-top-width: 0;
  border-bottom-width: 0;
  transition: max-height var(--dur-slow) ease,
    opacity var(--dur-base) ease 80ms,
    padding var(--dur-slow) ease,
    border-width var(--dur-slow) ease;
}
.dn-thread.is-chat-open .dn-thread-compose {
  max-height: 320px;
  opacity: 1;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
  border-top-width: 1px;
  border-bottom-width: 1px;
}

/* Hidden follow-ups: collapse with the same blinds animation. */
.dn-thread .dn-thread-list > .dn-thread-msg:not(:first-child) {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: max-height var(--dur-slow) ease,
    opacity var(--dur-base) ease 80ms,
    margin var(--dur-slow) ease;
}
.dn-thread.is-chat-open .dn-thread-list > .dn-thread-msg:not(:first-child) {
  max-height: 600px;
  opacity: 1;
}

/* Closed-but-has-messages: the first follow-up becomes a faded peek so the
   user remembers a chat happened. Click it (or the original finding body)
   to reopen. */
.dn-thread:not(.is-chat-open) .dn-thread-list > .dn-thread-msg:first-child {
  opacity: 0.5;
  cursor: pointer;
  transition: opacity var(--dur-base) ease;
}
.dn-thread:not(.is-chat-open) .dn-thread-list > .dn-thread-msg:first-child:hover {
  opacity: 0.75;
}
/* When there are no follow-ups and chat hasn't been opened, the whole
   thread container should leave no trace — no dashed top border, no
   stray padding/borders. */
.dn-thread:not(.is-chat-open):not(:has(.dn-thread-list)) {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
  gap: 0;
}
/* If there are existing follow-up messages, hide the dashed top border —
   the messages provide their own visual continuation. */
.dn-thread:has(.dn-thread-list) { border-top: 0; padding-top: 0; }

.dn-thread-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2-5);
  transition: gap var(--dur-slow) ease;
}
/* When closed, collapse the gap so the hidden (max-height:0) messages
   don't leave 9 × 10px of empty whitespace. */
.dn-thread:not(.is-chat-open) .dn-thread-list { gap: 0; }

.dn-thread-msg {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.dn-thread-msg--user {
  flex-direction: row-reverse;
  margin-left: var(--space-8);  /* leave the left edge for reviewer messages to dominate */
}
.dn-thread-msg--reviewer {
  margin-right: var(--space-8);
}

/* Avatar circles dropped — bubble background distinguishes user vs reviewer. */
.dn-thread-avatar { display: none; }
.dn-thread-avatar--user {
  background: var(--surface-3);
  color: var(--text-2);
}

.dn-thread-bubble {
  flex: 1 1 auto;
  min-width: 0;
  padding: var(--space-1-5) var(--space-2-5);
  border-radius: var(--radius-md);
  font-family: var(--serif, Georgia, serif);
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--text-2);
  position: relative;
}
.dn-thread-bubble--reviewer {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}
.dn-thread-bubble--user {
  background: var(--accent-bg);
  border: 1px solid #F2E5B0;
}

/* Inline Fix it on a reviewer thread message. Smaller / quieter than the
   original-finding Fix it (those live in the row's primary action cluster;
   these can fire many times per thread, so they shouldn't dominate). */
.dn-thread-fix-action {
  margin-top: var(--space-1-5);
}
.dn-thread-fix-action form { margin: 0; }
.dn-thread-fix-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px var(--space-2-5);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(26, 115, 232, 0.30);
  background: rgba(26, 115, 232, 0.06);
  color: var(--blue);
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast);
}
.dn-thread-fix-btn--apply:hover {
  background: rgba(26, 115, 232, 0.14);
  border-color: rgba(26, 115, 232, 0.50);
}
.dn-thread-fix-btn--undo {
  color: var(--text-3);
  border-color: var(--border);
  background: transparent;
  font-weight: 500;
}
.dn-thread-fix-btn--undo:hover {
  background: var(--surface-3);
  color: var(--text);
}
.dn-thread-fix-btn:disabled,
.dn-thread-fix-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  filter: saturate(0.4);
}
.dn-thread-fix-btn svg { color: currentColor; }

/* Compact "Updated: …" chip, scaled to fit inside a thread bubble. */
.dn-thread-updated-chip {
  margin-top: var(--space-1-5);
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: baseline;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, rgba(26, 115, 232, 0.10), rgba(26, 115, 232, 0.02));
  border: 1px solid rgba(26, 115, 232, 0.25);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  line-height: 1.4;
  color: var(--text);
}
.dn-thread-msg--fix-applied .dn-thread-body p { opacity: 0.72; color: var(--text-4); }

.dn-thread-body p {
  margin: 0 0 var(--space-1-5) 0;
}
.dn-thread-body p:last-child { margin-bottom: 0; }

/* "Jason is thinking…" — three dots that ease in and out. */
.dn-thread-thinking {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1-5);
  color: var(--text-3);
  font-size: var(--fs-sm);
}
.dn-thread-thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  animation: dn-thread-pulse 1.2s ease-in-out infinite;
}
.dn-thread-thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.dn-thread-thinking-dot:nth-child(3) { animation-delay: 0.30s; }
.dn-thread-thinking-label {
  margin-left: var(--space-1);
  font-style: italic;
}
@keyframes dn-thread-pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}

/* Compose box. Mirrors the user bubble's warm cream so the typing
   surface and the resulting message share one visual register — the
   reply lands in the bubble it visually came from. Lightens slightly
   on focus rather than flipping to a hard blue rectangle. */
.dn-thread-compose {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
  padding: var(--space-2) var(--space-2-5);
  background: var(--accent-bg);
  border: 1px solid #F2E5B0;
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.dn-thread-compose:focus-within {
  border-color: #E2CD7A;
  background: #FCF6DD;
}
.dn-thread-textarea {
  width: 100%;
  min-height: 28px;
  resize: none;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.45;
  color: var(--text);
  outline: none;
  padding: var(--space-0-5) 0;
}
.dn-thread-textarea:disabled {
  color: var(--text-3);
  cursor: progress;
}
.dn-thread-textarea::placeholder {
  color: var(--text-4);
}
.dn-thread-compose-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2-5);
}
.dn-thread-compose-hint {
  font-size: var(--fs-xs);
  color: var(--text-4);
  font-family: var(--sans);
}
.dn-thread-send {
  appearance: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--surface);
  padding: var(--space-1) var(--space-3);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background var(--dur-fast) ease, opacity var(--dur-fast) ease;
}
.dn-thread-send:hover { background: var(--text-2); }
.dn-thread-send:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* In peek state, hide the thread on the secondary finding — same
   policy as the action cluster. */
.dn-group-slide .dn-group-rows.is-peeking > turbo-frame:nth-of-type(2) .dn-thread {
  display: none;
}

@media (max-width: 640px) {
  .dn-thread-msg--user { margin-left: var(--space-3); }
  .dn-thread-msg--reviewer { margin-right: var(--space-3); }
}

/* ---- "Pick your review team" modal ---------------------------------- */
.dn-team-modal {
  position: fixed;
  inset: 0;
  z-index: 100 /* ad-hoc */;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dn-team-modal[hidden] { display: none; }
.dn-team-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 22, 26, 0.45);
}
.dn-team-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  padding: var(--space-6) 28px;
}
.dn-team-head { position: relative; margin-bottom: 18px; }
.dn-team-title {
  margin: 0 0 var(--space-1);
  font-family: var(--sans);
  font-size: var(--fs-2xl);
  font-weight: 500;
  letter-spacing: -0.005em;
}
.dn-team-count {
  margin-left: var(--space-2);
  font-size: var(--fs-base);
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0;
}
.dn-team-close {
  position: absolute;
  top: -6px; right: -6px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 0; background: transparent;
  font-size: var(--fs-2xl); line-height: 1;
  color: var(--text-3); cursor: pointer;
}
.dn-team-close:hover { background: var(--surface-2); color: var(--text); }

.dn-team-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2-5);
  margin-bottom: 18px;
}
.dn-team-card-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--space-3-5);
  padding: var(--space-3-5) var(--space-3-5) var(--space-3-5) var(--space-3-5);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast);
  align-items: start;
  position: relative;
}
.dn-team-card-item:hover { border-color: var(--border); background: var(--surface-2); }
.dn-team-card-item.is-on {
  border-color: var(--accent);
  background: var(--accent-bg);
}
.dn-team-card-item.is-premium {
  opacity: 0.55;
  cursor: not-allowed;
}
.dn-team-card-item.is-premium:hover { background: var(--surface); border-color: var(--border-soft); }
.dn-team-card-item.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}
.dn-team-card-item.is-locked:hover { background: var(--surface); border-color: var(--border-soft); }
/* Visually-hidden checkbox: stays in the tab order so keyboard users
   can toggle it, but the card border + .is-on background tint carry
   the visible affordance. The :has() rule below paints a focus ring
   on the parent label when the input is focused via keyboard. */
.dn-team-check {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.dn-team-card-item:has(.dn-team-check:focus-visible) {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
/* Left column — narrow, tall portrait area: round avatar above name */
.dn-team-portrait {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1-5);
}
.dn-team-av {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans);
  font-size: var(--fs-2xl); font-weight: 600;
  flex-shrink: 0;
}
.dn-team-name {
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-2);
  text-align: center;
  letter-spacing: 0;
}
.dn-team-meta {
  grid-column: 2;
  display: flex; flex-direction: column;
  gap: 3px;
  min-width: 0;
  padding-right: 28px; /* leave room for the absolute-positioned checkbox */
}
.dn-team-name {
  font-family: var(--sans);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-2);
}
.dn-team-lens {
  font-family: var(--sans);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.005em;
}
.dn-team-blurb {
  font-family: var(--serif, Georgia, serif);
  font-size: var(--fs-base);
  line-height: 1.45;
  color: var(--text-3);
  margin-top: var(--space-1);
}
.dn-team-badge {
  display: inline-block;
  margin-top: var(--space-1-5);
  font-family: var(--mono);
  font-size: var(--fs-2xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.dn-team-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-2-5);
  border-top: 1px solid var(--border-soft);
  padding-top: var(--space-3-5);
}
.dn-team-run {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--surface);
  padding: 7px var(--space-3-5);
  border-radius: 7px;
  font-family: var(--sans);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
}
.dn-team-run:hover:not(:disabled) { filter: brightness(1.05); }
.dn-team-run:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--surface-3);
  color: var(--text-3);
  border-color: var(--border);
}
.dn-team-done {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 18px;
  border-radius: 7px;
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
}
.dn-team-done:hover { background: var(--surface-2); }
.dn-team-done.is-active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface);
}
.dn-team-done.is-active:hover {
  background: var(--accent);
  filter: brightness(1.05);
}

@media (max-width: 640px) {
  .dn-team-grid { grid-template-columns: 1fr; }
  /* Tighten the card chrome so persona descriptions have room to breathe
     instead of wrapping awkwardly inside an over-padded sheet. */
  .dn-team-card { padding: var(--space-5) var(--space-4); width: min(720px, calc(100vw - 16px)); }
  .dn-team-card-item { padding: var(--space-3); gap: var(--space-2-5); grid-template-columns: 56px 1fr; }
}
/* ===========================================================
   Review-running overlay — full-screen takeover during a run
   =========================================================== */
.dn-review-overlay-root[hidden] { display: none; }

.dn-review-overlay-root {
  position: fixed; inset: 0;
  z-index: var(--z-toast);
  background: rgba(20, 20, 22, 0.92);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-8) var(--space-4);
  opacity: 0;
  transition: opacity var(--dur-base) ease-out;
}
.dn-review-overlay-root.is-open  { opacity: 1; }
.dn-review-overlay-root.is-closing {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--dur-slow) ease-in, transform var(--dur-slow) cubic-bezier(.45,.05,.55,.95);
}

.dn-review-overlay {
  width: 100%; max-width: 620px;
  background: #1f1f22;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 22px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.55);
  padding: 36px 36px 28px;
  color: #f6f5ef;
  display: flex; flex-direction: column;
  gap: var(--space-5);
  max-height: 80vh;
}

.dn-review-overlay-head {
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
  gap: var(--space-2);
}
.dn-review-overlay-avatars {
  display: flex; gap: -6px;
  margin-bottom: var(--space-1);
}
.dn-overlay-av {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-lg); font-weight: 600;
  border: 2.5px solid #1f1f22;
  margin-left: -8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.dn-overlay-av:first-child { margin-left: 0; }

.dn-review-overlay-title {
  font-family: var(--serif);
  font-size: var(--fs-3xl); font-weight: 500;
  margin: var(--space-1) 0 0;
  letter-spacing: -0.01em;
  color: #fef7e0;
}
.dn-review-overlay-subtitle {
  font-size: var(--fs-base); color: #cfcdc5;
  margin: 0;
  text-wrap: pretty;
  max-width: 440px;
}

.dn-review-overlay-pulse {
  position: relative;
  width: 50px; height: 14px;
  margin: var(--space-2) 0 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.dn-pulse-ring {
  width: 8px; height: 8px; border-radius: 50%;
  background: #FBBC04;
  margin: 0 3px;
  animation: dnOverlayPulse 1.2s ease-in-out infinite;
}
.dn-pulse-ring:nth-child(2) { animation-delay: .15s; }
.dn-pulse-ring:nth-child(3) { animation-delay: .3s; }
@keyframes dnOverlayPulse {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.4; }
  40%           { transform: scale(1.0);  opacity: 1.0; }
}

.dn-review-overlay-counter {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: #b3b1a8;
  margin-top: var(--space-0-5);
  letter-spacing: 0.02em;
}

.dn-review-overlay-feed {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: var(--space-2);
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%);
}
/* Only the most recent few cards are visible — the overlay is a
   "something is happening" signal, not a reading view. */
.dn-review-overlay-feed > .dn-overlay-finding:nth-child(n+4) {
  display: none;
}

.dn-overlay-finding {
  display: flex; gap: var(--space-3);
  padding: var(--space-3) var(--space-3-5);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-lg);
  animation: dnOverlayFindingIn .42s cubic-bezier(.2,.8,.2,1);
  transform-origin: top center;
}
@keyframes dnOverlayFindingIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.dn-overlay-finding-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); font-weight: 600;
  flex-shrink: 0;
}
.dn-overlay-finding-meta { flex: 1; min-width: 0; }
.dn-overlay-finding-head {
  display: flex; gap: var(--space-2-5); align-items: baseline;
  font-size: var(--fs-xs); color: #b3b1a8;
  font-family: var(--mono);
  margin-bottom: 3px;
}
.dn-overlay-finding-rev   { color: #fef7e0; font-weight: 500; letter-spacing: .02em; }
.dn-overlay-finding-slide { color: #b3b1a8; }
.dn-overlay-finding-title {
  font-size: var(--fs-base); font-weight: 500;
  color: #fef7e0;
  margin-bottom: var(--space-0-5);
  text-wrap: pretty;
}

.dn-review-overlay-status {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  text-align: center;
  color: #b3b1a8;
  min-height: 20px;
}
.dn-overlay-status-msg--ok { color: #6FCF7F; }
.dn-overlay-status-msg--err { color: #F49A8A; }

/* Thumbnail-loading progress indicator in the deckstats line. */
.dn-deckstats-thumbs {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.dn-deckstats-thumbs[hidden] { display: none !important; }
.dn-thumbs-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-soft);
  border-top-color: var(--accent);
  animation: dn-thumbs-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes dn-thumbs-spin {
  to { transform: rotate(360deg); }
}

/* Auto-narrow sidebar: 901–1279px collapses to icons only and floats over
   content on hover so the main column gets the breathing room.
   Below 901px the existing mobile drawer takes over. */
/* Defaults — declared BEFORE the narrow-sidebar media query so the
   media-query rules win inside its width range. */
.dn-action-thumb { display: none; }
.dn-finding-attrib {
  display: none;
  font-family: var(--sans);
  font-size: var(--fs-sm);
  color: var(--text-3);
  margin-bottom: var(--space-1);
  letter-spacing: 0.005em;
}
.dn-finding-attrib-name { font-weight: 600; }

/* Sidebar auto-collapses on narrow viewports. The upper bound used to be
   1279px which felt aggressive at common laptop widths; tightened to 899px
   so 900-1279 keeps the sidebar full-width. */
@media (min-width: 641px) and (max-width: 899px) {
  .dn-shell { --dn-side-w: 64px; }
  .dn-sidebar {
    position: absolute;
    left: 0; top: 0;
    width: 64px;
    height: 100%;
    z-index: var(--z-mobile-shell);
    transition: width var(--dur-base) var(--ease-standard), box-shadow var(--dur-base) ease;
  }
  /* Pin main to column 2 — when the sidebar leaves grid flow, auto
     placement was dropping main into the 64px first column. */
  .dn-shell > .dn-main { grid-column: 2; }
  .dn-sidebar:not(.is-collapsed) {
    width: 280px;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.18);
  }

  /* Slide-sort layout: hide the big left thumbnail, let the rows column
     take the full width. The per-row .dn-action-thumb shows up inside
     the action cluster instead, sitting above the buttons. Comment body
     gets a wider reading column. */
  .dn-group-slidelayout {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .dn-group-slidethumb { display: none; }
  .dn-action-thumb {
    display: block;
    margin-bottom: var(--space-1-5);
  }
  .dn-action-thumb .dn-slideprev { width: 100%; }

  /* Drop the avatar column to give the comment more room. The attribution
     line ("Melissa says…") sits above the comment body to keep author
     identity visible. */
  .dn-cell-portrait { display: none; }
  .dn-row { grid-template-columns: 1fr; }
  .dn-row--no-thumb { grid-template-columns: 1fr; }
  .dn-finding-attrib { display: block; }
}


/* Per-deck number indicator. Hidden in the expanded sidebar, revealed
   as the icon-only marker when the sidebar collapses to 64px. */
.dn-deck-num {
  display: none;
  font-family: var(--mono);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.dn-sidebar.is-collapsed .dn-deck-num {
  display: inline-block;
  color: var(--text-2);
}
.dn-sidebar.is-collapsed .dn-deckrow.is-active .dn-deck-num {
  color: var(--accent-ink);
  font-weight: 600;
}

/* ---- Mobile top bar (≤640px) ---- */
.dn-topbar { display: none; }

@media (max-width: 640px) {
  .dn-topbar {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    /* Notched-iOS standalone (PWA): extend the bar by safe-area-inset-top
       so content lives below the notch. .dn-main padding-top below
       picks up the same inset. */
    height: calc(52px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    z-index: var(--z-mobile-bar);
    padding-left: var(--space-3);
    padding-right: var(--space-3);
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-1);
  }
  .dn-topbar-decks-wrap {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
  }
  .dn-topbar-decks {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-1-5);
    background: transparent;
    border: 0;
    padding: var(--space-2) var(--space-1-5);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-align: left;
    cursor: pointer;
  }
  .dn-topbar-decks:hover { background: var(--surface-2); }
  .dn-topbar-chev { transition: transform var(--dur-base) ease; flex-shrink: 0; color: var(--text-3); }
  .dn-topbar-decks[aria-expanded="true"] .dn-topbar-chev { transform: rotate(180deg); }

  .dn-topbar-decklist[hidden] { display: none; }
  .dn-topbar-decklist {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    max-width: calc(100vw - 24px);
    max-height: 60vh;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    z-index: var(--z-mobile-trigger);
    padding: var(--space-1-5) 0;
  }
  .dn-topbar-deckitem {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    padding: 9px var(--space-3-5);
    color: var(--text);
    text-decoration: none;
    font-family: var(--sans);
    font-size: var(--fs-md);
  }
  .dn-topbar-deckitem:hover { background: var(--surface-2); }
  .dn-topbar-deckitem.is-active {
    background: var(--accent-bg);
    font-weight: 500;
  }
  .dn-topbar-deckitem-num {
    font-family: var(--mono);
    font-size: var(--fs-sm);
    color: var(--text-3);
    min-width: 18px;
    text-align: center;
  }
  .dn-topbar-deckitem-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .dn-topbar-deckempty {
    padding: var(--space-3-5);
    font-family: var(--sans);
    font-size: var(--fs-base);
    color: var(--text-3);
  }
  .dn-topbar-title {
    font-family: var(--sans);
    font-size: var(--fs-md);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dn-topbar-user { position: relative; flex-shrink: 0; }
  .dn-topbar-avatar {
    /* 36px visual circle inside a 44px hit area (HIG min). */
    width: 44px; height: 44px;
    padding: 4px;
    border-radius: 50%;
    background: var(--accent-bg);
    background-clip: content-box;
    color: var(--accent-ink);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: var(--fs-md);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .dn-topbar-avatar:hover { background: var(--accent-bg); filter: brightness(0.97); }

  .dn-topbar-usermenu[hidden] { display: none; }
  .dn-topbar-usermenu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    overflow: hidden;
    z-index: var(--z-mobile-trigger);
  }
  .dn-topbar-userhead {
    padding: var(--space-3) var(--space-3-5);
    border-bottom: 1px solid var(--border-soft);
  }
  .dn-topbar-username {
    font-family: var(--sans); font-size: var(--fs-md); font-weight: 600; color: var(--text);
  }
  .dn-topbar-useremail {
    font-family: var(--mono); font-size: var(--fs-xs); color: var(--text-3);
    margin-top: var(--space-0-5);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .dn-topbar-userbtn {
    display: block;
    width: 100%;
    padding: var(--space-2-5) var(--space-3-5);
    background: transparent;
    border: 0;
    text-align: left;
    font-family: var(--sans);
    font-size: var(--fs-base);
    color: var(--text);
    cursor: pointer;
  }
  .dn-topbar-userbtn:hover:not(:disabled) { background: var(--surface-2); }
  .dn-topbar-userbtn:disabled { color: var(--text-4); cursor: not-allowed; }

  /* Drop the in-page deck title since the top bar already shows it. */
  .dn-deckhead { display: none; }
  /* Push main content under the fixed top bar. */
  .dn-main { padding-top: calc(60px + env(safe-area-inset-top, 0px)); }
}

/* Mobile reviewer dropdown — hidden on desktop. */
.dn-revdrop { display: none; }

@media (max-width: 640px) {
  /* Hide the original chip row (All / Jason / Melissa / config) — replaced
     by the compact dropdown. Tighten the section's vertical padding. */
  .dn-filterchips > .dn-chip,
  .dn-filterchips > a.dn-chip,
  .dn-filterchips > span.dn-chip,
  .dn-filterchips > button.dn-chip,
  .dn-filterchips > .dn-chip-config { display: none; }
  .dn-filterchips {
    flex-wrap: nowrap;
    overflow: visible;
    padding-bottom: 0;
    margin-bottom: var(--space-2);
  }
  .dn-deckstats {
    margin-top: var(--space-1);
    margin-bottom: var(--space-3-5);
  }

  .dn-revdrop {
    display: block;
    position: relative;
    flex: 1 1 auto;
  }
  .dn-revdrop-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2-5) var(--space-3);
    min-height: 44px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    font-family: var(--sans);
    font-size: var(--fs-base);
    color: var(--text);
    cursor: pointer;
  }
  .dn-revdrop-trigger:hover { background: var(--surface-2); }
  .dn-revdrop-label { font-weight: 500; }
  .dn-revdrop-count {
    font-family: var(--mono);
    font-size: var(--fs-sm);
    color: var(--text-3);
  }
  .dn-revdrop-chev { color: var(--text-3); transition: transform var(--dur-base) ease; }
  .dn-revdrop-trigger[aria-expanded="true"] .dn-revdrop-chev { transform: rotate(180deg); }

  .dn-revdrop-menu[hidden] { display: none; }
  .dn-revdrop-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 240px;
    max-width: calc(100vw - 24px);
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    z-index: var(--z-mobile-bar);
    padding: var(--space-1-5) 0;
  }
  .dn-revdrop-item {
    display: flex;
    align-items: center;
    gap: var(--space-2-5);
    padding: var(--space-2) var(--space-3-5);
    font-family: var(--sans);
    font-size: var(--fs-md);
    color: var(--text);
    text-decoration: none;
  }
  .dn-revdrop-item:hover { background: var(--surface-2); }
  .dn-revdrop-item.is-active { background: var(--accent-bg); font-weight: 500; }
  .dn-revdrop-item-av {
    width: 22px; height: 22px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: var(--fs-xs); font-weight: 600;
    flex-shrink: 0;
  }
  .dn-revdrop-item-name { flex: 1; }
  .dn-revdrop-item-count {
    font-family: var(--mono);
    font-size: var(--fs-sm);
    color: var(--text-3);
    min-width: 22px;
    text-align: right;
  }
}

/* Mobile sort dropdown — hidden on desktop. */
.dn-sortdrop { display: none; }

@media (max-width: 640px) {
  .dn-filterchips {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
  }

  /* Hide the deckstats line + the desktop sort tab strip — both are
     replaced by the dropdown row above. */
  .dn-deckstats { display: none; }
  .dn-table-head .dn-sort { display: none; }
  .dn-table-head { padding: 0; min-height: 0; }

  .dn-sortdrop {
    display: inline-block;
    flex-shrink: 0;
    position: relative;
  }
  .dn-sortdrop > summary {
    list-style: none;
    cursor: pointer;
    padding: var(--space-1-5) var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    font-family: var(--sans);
    font-size: var(--fs-base);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1-5);
    user-select: none;
  }
  .dn-sortdrop > summary::-webkit-details-marker { display: none; }
  .dn-sortdrop > summary:hover { background: var(--surface-2); }
  .dn-sortdrop[open] > summary .dn-sortdrop-chev { transform: rotate(180deg); }
  .dn-sortdrop-chev { transition: transform var(--dur-base) ease; color: var(--text-3); }

  .dn-sortdrop-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-2);
    z-index: var(--z-mobile-bar);
    padding: var(--space-1-5) 0;
  }
  .dn-sortdrop-item {
    display: block;
    padding: var(--space-2) var(--space-3-5);
    font-family: var(--sans);
    font-size: var(--fs-md);
    color: var(--text);
    text-decoration: none;
  }
  .dn-sortdrop-item:hover { background: var(--surface-2); }
  .dn-sortdrop-item.is-active { background: var(--accent-bg); font-weight: 500; }
}

/* ------- Decks index list ------- */
.dn-deckrow { text-decoration: none; color: inherit; }
.dn-deckrow-title {
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--space-1);
}
.dn-deckrow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  font-size: var(--fs-sm);
  color: var(--text-3);
}
.dn-sidebar-empty {
  padding: var(--space-5) var(--space-4);
  color: var(--text-3);
  font-size: var(--fs-base);
  line-height: 1.5;
}

/* ============================================================
 * Login overlay — Phase 3 of multi-user.
 * Static / synthetic background only; no real deck content
 * leaks to the DOM while logged out (security requirement R12).
 * ============================================================ */
.dn-login-root {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  overflow: hidden;
  z-index: 1000;
  padding: var(--space-4);
}

.dn-login-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.dn-login-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
}
.dn-login-blob--a { width: 480px; height: 480px; left: -120px;  top: -140px; background: var(--accent-bg); }
.dn-login-blob--b { width: 360px; height: 360px; right: -80px;  bottom: -100px; background: #E8F0FE; }
.dn-login-blob--c { width: 280px; height: 280px; left: 38%; top: 60%; background: #E6F4EA; }

.dn-login-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2);
  padding: var(--space-7) var(--space-6);
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dn-login-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2-5);
}
.dn-login-wordmark {
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
  letter-spacing: 0.01em;
}

.dn-login-headline {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-xl, 1.5rem);
  line-height: 1.25;
  color: var(--text);
  font-weight: 600;
}
.dn-login-subhead {
  margin: 0;
  color: var(--text-3);
  line-height: 1.5;
}

.dn-btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--sans);
  font-weight: 500;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: background var(--dur-base) ease, box-shadow var(--dur-base) ease;
}
.dn-btn-google:hover {
  background: var(--surface-2);
  box-shadow: var(--shadow-1);
}
.dn-btn-google:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.dn-btn-google-mark { width: 18px; height: 18px; flex-shrink: 0; }

.dn-login-trouble {
  background: none;
  border: none;
  padding: var(--space-2) 0;
  color: var(--text-3);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  align-self: center;
}
.dn-login-trouble:hover { color: var(--text); }
.dn-login-trouble:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.dn-login-recovery {
  margin: 0;
  padding: var(--space-3) var(--space-3-5);
  background: var(--accent-bg);
  border-radius: var(--radius-md);
  color: var(--text-2);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.dn-login-recovery a { color: var(--accent-ink); }

.dn-login-error {
  margin: 0;
  padding: var(--space-3) var(--space-3-5);
  background: #FCE8E6;
  color: #B3261E;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
}

@media (max-width: 480px) {
  .dn-login-card {
    padding: var(--space-5) var(--space-4);
    border: none;
    box-shadow: none;
    background: transparent;
  }
}

/* Magic-link request form (Unit 10). Reuses dn-btn-google for the submit
 * action so the visual hierarchy matches the Google sign-in surface. */
.dn-magic-form { display: flex; flex-direction: column; gap: var(--space-2); }
.dn-magic-form-label {
  font-size: var(--fs-sm);
  color: var(--text-2);
  font-weight: 500;
}
.dn-magic-form-input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-3-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--sans);
  font-size: var(--fs-md);
  color: var(--text);
}
.dn-magic-form-input:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-color: var(--accent-2);
}
