/* Dossier shell and shared components. Converted from the approved design
   (design/*.dc.html), which carries the exact values. Classes here replace the
   per-screen inline styles so the markup in js/views stays lean. */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font-ui);
  font-size: var(--body);
  line-height: 1.5;
  color: var(--text);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--text); text-underline-offset: 4px; }
a:hover { color: var(--red-text); }

:focus-visible { outline: 0; box-shadow: var(--focus); border-radius: var(--radius); }

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--inverse-bg); color: var(--inverse-text); font-weight: 600; text-decoration: none;
}
.skip-link:focus { left: 16px; }

/* Theme-swapped images */
:root[data-theme="dark"] .logo-light,
:root[data-theme="dark"] .tag-light { display: none !important; }
:root:not([data-theme="dark"]) .logo-dark,
:root:not([data-theme="dark"]) .tag-dark { display: none !important; }

/* ---- Layout ------------------------------------------------------------ */
#main { flex: 1 0 auto; display: block; }
/* The sign-in screen owns the whole page: hide the header and footer. */
:root.signin-route ds-header, :root.signin-route .footer { display: none; }
.page { flex: 1 0 auto; display: flex; flex-direction: column; }
.main {
  width: 100%; max-width: 1440px; margin: 0 auto;
  padding: 56px var(--margin) 64px;
  display: flex; flex-direction: column; gap: 28px;
}
.gutter { padding-inline: var(--margin); }

/* ---- Header (sticky frosted glass) ------------------------------------- */
.hdr {
  --text-quiet: var(--glass-text-2);
  position: sticky; top: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 24px;
  padding: 16px 0 14px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--rule);
  box-shadow: var(--glass-edge), 0 10px 24px -18px rgba(26,26,26,.22);
}
.hdr-row {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  width: 100%; padding-inline: var(--margin);
}
.hdr-logo { display: block; flex-shrink: 0; padding: 4px 0; }
.hdr-logo img { height: 21px; width: auto; display: block; }
.hdr-name {
  padding-left: 18px; border-left: 1px solid var(--rule);
  font-family: var(--font-display); font-style: italic; font-weight: 500;
  font-size: 28px; letter-spacing: .01em; line-height: 1; text-transform: uppercase;
  color: var(--red-text); text-decoration: none;
}
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.round-btn {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--tone-solid); color: var(--text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
}
.round-btn:hover { background: var(--tone-solid-hover); }

/* Account / sort menus */
.menu {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 40;
  min-width: 248px; padding: 8px; border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--menu-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--menu-shadow); color: var(--text);
}
.menu-head { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 12px; }
.menu-head b { font-size: 14px; font-weight: 600; }
.menu-head span { font-size: 12px; color: var(--text-2); }
.menu-sep { height: 1px; background: var(--rule); margin: 2px 6px 6px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px;
  padding: 0 12px; border: 0; background: transparent; border-radius: var(--radius);
  color: var(--text); font: inherit; font-size: 14px; text-align: left;
  text-decoration: none; cursor: pointer;
}
.menu-item:hover { background: var(--tone-1); color: var(--text); }

/* ---- File chip + tabs (second header row, inside a file) --------------- */
.file-row {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  width: 100%; padding-inline: var(--margin);
}
.file-chip {
  display: inline-flex; align-items: center; gap: 10px; height: 40px;
  padding: 0 12px 0 8px; border: 0; border-radius: var(--radius);
  background: var(--tone-1); color: var(--text); font: inherit; cursor: pointer;
}
.file-chip:hover { background: var(--tone-2); }
.file-badge {
  width: 26px; height: 26px; border-radius: 6px; flex: none;
  background: var(--red); color: var(--on-red);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.file-chip b { font-size: 15px; font-weight: 600; }
.tabs { display: flex; align-items: stretch; height: 48px; }
.apptab {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 0 16px;
  font-size: 15px; font-weight: 500; line-height: 1; color: var(--text-2);
  text-decoration: none; border-radius: 6px 6px 0 0; cursor: pointer;
  background: none; border: 0; font-family: inherit;
}
.apptab svg { color: var(--text-quiet); }
.apptab:hover { color: var(--text); background: var(--tone-1); }
.apptab:hover svg { color: var(--text); }
.apptab.is-on {
  color: var(--text); font-weight: 600; background: var(--tab-on);
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  box-shadow: var(--tab-on-edge);
}
.apptab.is-on svg { color: var(--red-text); }
.apptab-n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--tone-1); font-size: 12px; font-weight: 600; color: var(--text-2);
}
.apptab.is-on .apptab-n { background: var(--active-tint); color: var(--active-text); }
.apptab .tab-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--red-text); }

/* ---- Titles ------------------------------------------------------------ */
.titleblock { display: flex; flex-direction: column; gap: 12px; }
.eyebrow {
  margin: 0; font-size: 11px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--red-text);
}
.page-title {
  margin: 0; font-family: var(--font-display); font-weight: 900;
  font-size: var(--title); letter-spacing: -0.02em; line-height: 1.1;
}
.lede { margin: 0; max-width: 680px; font-size: 15px; line-height: 1.5; color: var(--text-2); }

/* ---- Section heading (hairline + 56x2 red bar) ------------------------- */
.sec-head {
  position: relative; display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; padding-top: 20px; border-top: 1px solid var(--rule);
}
.sec-head::before {
  content: ""; position: absolute; left: 0; top: -1px; width: 56px; height: 2px; background: var(--red-text);
}
.sec-head h2 { margin: 0; font-size: var(--section); font-weight: 600; line-height: 1.3; }
.sec-head h2 .count { font-weight: 500; color: var(--text-quiet); }
.sec-note { font-size: 13px; color: var(--text-quiet); }
.sec-link { font-size: 14px; font-weight: 600; }
.section { display: flex; flex-direction: column; gap: 20px; padding-top: 12px; }

/* ---- Cards ------------------------------------------------------------- */
.card {
  display: flex; flex-direction: column; gap: 14px; padding: 24px;
  border-radius: var(--radius); background: var(--lead-on); box-shadow: 0 1px 2px rgba(26,26,26,.05);
}
.card--pad20 { padding: 20px; }
.card--off { background: var(--lead-off); box-shadow: none; }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  border: 0; border-radius: var(--radius); font: inherit; font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer; background: var(--tone-1); color: var(--text);
}
.btn:hover { background: var(--tone-2); }
.btn-primary { background: var(--red); color: var(--on-red); font-weight: 600; padding: 0 18px; }
.btn-primary:hover { background: var(--red-hover); color: var(--on-red); }
.btn-tonal { background: var(--tone-solid); color: var(--text); }
.btn-tonal:hover { background: var(--tone-solid-hover); }
.btn-ink { background: var(--inverse-bg); color: var(--inverse-text); font-weight: 600; height: 44px; padding: 0 18px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* back link (text, never a button) */
.back {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--text-2); text-decoration: none; cursor: pointer; padding: 2px 0;
}
.back:hover { color: var(--text); text-decoration: none; }
.back:hover span { text-decoration: underline; text-decoration-color: var(--red-text); text-decoration-thickness: 1px; text-underline-offset: 5px; }

/* ---- Fields ------------------------------------------------------------ */
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .req { color: var(--red-text); }
.field .help { font-size: 12px; color: var(--text-quiet); }
.input {
  width: 100%; height: 44px; padding: 0 12px; border: 0; border-radius: var(--radius);
  background: var(--tone-solid); color: var(--text); font: inherit; font-size: 14px;
  transition: background var(--t-hover) var(--ease-out);
}
.input:hover { background: var(--tone-solid-hover); }
.input:focus { background: var(--field-active); box-shadow: inset 0 0 0 2px var(--text); outline: 0; }
textarea.input { height: auto; min-height: 96px; padding: 12px; line-height: 1.5; resize: vertical; font-family: inherit; }

/* Big search bar */
.bigsearch {
  display: flex; align-items: center; gap: 16px; height: 72px; padding: 0 24px 0 28px;
  border-radius: var(--radius); background: var(--tone-solid);
}
.bigsearch input {
  flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 20px; color: var(--text); outline: none;
}
.bigsearch kbd {
  min-width: 26px; height: 26px; padding: 0 6px; border-radius: 4px; background: var(--tone-2);
  font: inherit; font-size: 13px; font-weight: 600; font-style: italic;
  display: inline-flex; align-items: center; justify-content: center;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Glass options (Where to look first, Assignment size) -------------- */
.gopt {
  position: relative; display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: var(--radius);
  background: rgba(250,249,246,.28);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 0 0 1px rgba(26,26,26,.06);
  color: var(--text-quiet); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, color .15s ease;
}
.gopt:hover { background: var(--glass); box-shadow: var(--glass-edge), 0 1px 3px rgba(26,26,26,.06); color: var(--text); }
.gopt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.gopt:has(input:checked) { color: var(--text); font-weight: 600; }
.gopt:has(input:checked)::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1.5px; border-radius: 1px; background: var(--red-text); }
.gopt:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.gcard { flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 20px 20px; }
.gcard .gsub { font-size: 13px; font-weight: 400; line-height: 1.5; color: inherit; }
.gcard:has(input:checked)::after { left: 20px; right: 20px; bottom: 0; }
:root[data-theme="dark"] .gopt { background: rgba(30,30,30,.28); box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
:root[data-theme="dark"] .gopt:hover { background: var(--glass); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }

/* ---- Lead actions (Exclude / Include again) --------------------------- */
.lead-act {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 0; border-radius: var(--radius); background: transparent; color: var(--text-2);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.lead-act:hover { background: var(--tone-1); color: var(--text); }
.lead-act.is-back { background: var(--tone-solid); color: var(--text); font-weight: 600; }
.lead-act.is-back:hover { background: var(--tone-solid-hover); }

/* ---- Small text tab switch (All / Included / Excluded, What we found) -- */
.switch { display: flex; align-items: center; gap: 20px; }
.switch-sep { width: 1px; height: 20px; background: var(--text-quiet); opacity: .4; }
.switch-tab {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 48px;
  padding: 0; border: 0; background: none; font: inherit; font-size: 15px; font-weight: 500;
  color: var(--text-quiet); cursor: pointer;
}
.switch-tab .n { font-size: 12px; font-weight: 500; color: var(--text-quiet); }
.switch-tab[aria-selected="true"] { font-weight: 600; color: var(--text); }
.switch-tab .sbar { position: absolute; left: 0; right: 0; bottom: 4px; height: 2px; border-radius: 1px; background: transparent; }
.switch-tab[aria-selected="true"] .sbar { background: var(--red-text); }

/* ---- Filters / Sort control row --------------------------------------- */
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls .status { margin: 0 auto 0 0; font-size: 14px; color: var(--text-quiet); }
.ctl-btn {
  height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius);
  display: flex; align-items: center; gap: 10px; font: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; background: var(--tone-1); color: var(--text);
}
.ctl-btn:hover { background: var(--tone-2); }
.ctl-btn.is-on { background: var(--inverse-bg); color: var(--inverse-text); }
.popover {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 25;
  display: flex; flex-direction: column; border-radius: 10px;
  background: var(--menu-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--menu-shadow); color: var(--text);
}
.popover--menu { width: 240px; padding: 6px; }
.popover--dialog { width: 460px; max-width: calc(100vw - 32px); overflow: hidden; }
.menu-radio {
  height: 42px; padding: 0 12px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--text); font: inherit; font-size: 15px; font-weight: 500;
  display: flex; align-items: center; justify-content: space-between; text-align: left; cursor: pointer;
}
.menu-radio[aria-checked="true"] { background: var(--tone-1); font-weight: 600; }
.chip-btn {
  height: 36px; padding: 0 12px; border: 0; border-radius: var(--radius);
  background: var(--tone-1); color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.chip-btn .n { color: var(--text-quiet); }
.chip-btn[aria-pressed="true"] { background: var(--active-tint); color: var(--active-text); font-weight: 600; }
.chip-btn[aria-pressed="true"] .n { color: var(--active-text); }

/* ---- Progress ---------------------------------------------------------- */
.bar { height: 4px; border-radius: 2px; background: var(--tone-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--red); }
.bar--thick { height: 6px; border-radius: 3px; }

/* ---- Pills / tags / badges -------------------------------------------- */
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--tone-1); color: var(--text); text-decoration: none;
}
.tag--inference { background: var(--active-tint); color: var(--active-text); }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px; border-radius: 4px;
  background: var(--tone-solid); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); }

/* ---- Media thumbnails (square, never rounded beyond 4px) --------------- */
.thumb { position: relative; aspect-ratio: 1; border-radius: 4px; background: var(--tone-2); overflow: hidden; }
.thumb .chip {
  position: absolute; left: 8px; top: 8px; padding: 3px 8px; border-radius: 4px;
  background: var(--media-chip); color: #fff; font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.thumb .len {
  position: absolute; right: 8px; bottom: 8px; padding: 3px 8px; border-radius: 4px;
  background: var(--media-chip); color: #fff; font-size: 11px; font-weight: 500;
}

/* ---- Grids ------------------------------------------------------------- */
.grid-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 24px; }
.grid-exhibits { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; }
.grid-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(300px, calc((100% - 32px) / 3))), 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, max(360px, calc((100% - 16px) / 2))), 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }

/* ---- Assignment grid (container query, 3 columns at 1100px) ------------ */
.asg-wrap { container-type: inline-size; padding-top: 12px; }
.asg {
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "steps" "limits" "stop" "leads";
  row-gap: 20px; align-items: start;
}
.asg > * { min-width: 0; }
.asg-head { grid-area: head; } .asg-steps { grid-area: steps; }
.asg-limits { grid-area: limits; } .asg-stop { grid-area: stop; justify-self: start; }
.asg-leads { grid-area: leads; margin-top: 28px; }
.asg-head, .asg-steps, .asg-limits { max-width: 520px; }
@container (min-width: 1100px) {
  .asg {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, .85fr) minmax(0, 1.7fr);
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "head head leads" "steps limits leads" "stop . leads" ". . leads";
    column-gap: 24px;
  }
  .asg-leads { margin-top: 0; margin-left: 24px; }
  .asg-head, .asg-steps, .asg-limits { max-width: none; }
}

/* ---- Footer ------------------------------------------------------------ */
.footer { flex: none; margin-top: auto; border-top: 1px solid var(--rule); }
.footer-row {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px var(--margin);
}
.footer-mark {
  font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -0.01em; line-height: 1;
}
.footer-mark i { font-style: italic; font-weight: 500; color: var(--red-text); }
.footer-row img { height: 20px; width: auto; display: block; }

/* ---- Icons ------------------------------------------------------------- */
.ic { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---- States ------------------------------------------------------------ */
.placeholder { padding: 48px 0; color: var(--text-2); }
.placeholder h2 { margin: 0 0 8px; font-family: var(--font-display); font-weight: 900; font-size: var(--section); }
.skeleton { background: var(--tone-1); border-radius: var(--radius); animation: shimmer 1.4s infinite; }
@keyframes shimmer { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
