/* threshold — a worktop with a manuscript on it.
   Two type families with distinct jobs: a serif for the documents (they are
   documents, so they should read like them), a sans for the tool around them.
   No webfonts: this runs locally and must work with the network off. */

:root {
  --desk:      #e4e2dc;
  --desk-deep: #d6d3cb;
  --paper:     #fcfcfb;
  --ink:       #1f2421;
  --ink-soft:  #5c6360;
  --ink-faint: #8a908c;
  --rule:      #cbc8c0;
  --accent:    #2d5c4d;
  --accent-lo: #e6ede9;
  --flag:      #9a3b2e;
  --flag-lo:   #f6e9e6;
  --warn:      #8a6516;
  --warn-lo:   #f7efdd;

  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --rail-w: 14rem;
  --list-w: 22rem;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
code, .mono { font-family: var(--mono); font-size: .92em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* `hidden` is how every panel, modal and empty state in app.js is shown and
   hidden, and the browser only implements it as a low-specificity
   `display: none` from its own stylesheet. Any author rule that sets `display`
   — `.modal { display: grid }`, `.panes { display: grid }` — silently beats it,
   which shows the element regardless of the attribute. This makes the attribute
   mean what the JS assumes it means. */
[hidden] { display: none !important; }

/* ── the gate ───────────────────────────────────────────────────────── */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--desk);
  z-index: 20;
  padding: 1.5rem;
  overflow-y: auto;
}

.gate-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 12px 30px -22px rgba(0, 0, 0, .5);
  padding: 1.8rem 1.9rem 1.6rem;
  width: min(26rem, 100%);
}

.gate-card h1 { font-size: 1.3rem; letter-spacing: -.01em; }
.gate-sub { margin: .4rem 0 1.2rem; color: var(--ink-soft); font-size: .88rem; }

.tabs { display: flex; gap: .3rem; margin-bottom: 1.1rem; }

.tab {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: .35rem .1rem;
  margin-right: .9rem;
  color: var(--ink-faint);
  cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

.gate-card label {
  display: block;
  font-size: .8rem;
  color: var(--ink-soft);
  margin: .8rem 0 .2rem;
}
.gate-card .opt { color: var(--ink-faint); font-weight: 400; }

.gate-card input {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .45rem .55rem;
}
.gate-card input:focus { border-color: var(--accent); }

.wide { width: 100%; }
#gate-submit { margin-top: 1.2rem; }

.gate-error {
  margin: .8rem 0 0;
  padding: .5rem .7rem;
  background: var(--flag-lo);
  border-left: 2px solid var(--flag);
  color: var(--flag);
  font-size: .85rem;
}

/* ── shell: projects | positions | the position ─────────────────────── */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) var(--list-w) minmax(0, 1fr);
  height: 100%;
}

/* ── rail ───────────────────────────────────────────────────────────── */
.rail {
  display: flex;
  flex-direction: column;
  background: var(--desk-deep);
  border-right: 1px solid var(--rule);
  min-height: 0;
}

.rail-head { padding: 1rem .9rem .75rem; border-bottom: 1px solid var(--rule); }
.rail-head h1 { font-size: 1.02rem; letter-spacing: -.01em; }
.rail-meta { margin: .2rem 0 0; font-size: .76rem; color: var(--ink-faint);
             overflow-wrap: anywhere; }

.rail-list { flex: 1; overflow-y: auto; padding: .35rem 0; min-height: 0; }
.rail-none { padding: .8rem .9rem; color: var(--ink-faint); font-size: .82rem; }

.rail-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  padding: .55rem .9rem .6rem .75rem;
  cursor: pointer;
}
.rail-item:hover { background: rgba(0, 0, 0, .035); }
.rail-item[aria-selected="true"] { background: var(--paper); border-left-color: var(--accent); }

.rail-item .r-title { display: block; font-weight: 550; line-height: 1.3; }
.rail-item .r-inst { display: block; font-size: .76rem; color: var(--ink-soft); margin-top: .1rem; }
.rail-item .r-state { display: block; font-size: .72rem; color: var(--ink-faint); margin-top: .2rem; }

.dot {
  display: inline-block; width: .45rem; height: .45rem; border-radius: 50%;
  margin-right: .3rem; vertical-align: .04rem;
}
.dot.busy { background: var(--accent); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.rail-foot-group { border-top: 1px solid var(--rule); padding: .6rem .7rem .7rem; }
.rail-tools { display: flex; gap: .25rem; margin-top: .45rem; flex-wrap: wrap; }
.rail-tools .ghost { flex: 1; text-align: center; padding: .28rem .3rem; }

/* ── the position list ──────────────────────────────────────────────── */
.listcol {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--desk-deep);
  border-right: 1px solid var(--rule);
}

.listcol-head {
  padding: .85rem .85rem .6rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.listcol-title h2 { font-size: .98rem; line-height: 1.3; }
.listcol-title { margin-bottom: .6rem; }

.fetch-controls { margin-bottom: .15rem; }
.fetch-limit-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: .4rem;
}
.fetch-limit-label input {
  width: 4.2rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .2rem .35rem;
  font-size: .84rem;
  text-align: center;
}
.fetch-limit-label input:disabled { opacity: .45; }

.listcol-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem;
  margin-top: .7rem;
}
.listcol-controls #search { grid-column: 1 / -1; }
.listcol-controls .check { grid-column: 1 / -1; margin-top: 0; }

.listcol-controls select, .listcol-controls input {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .28rem .4rem;
  min-width: 0;
  font-size: .84rem;
}

#listcol-count { margin: .5rem 0 0; }

.position-list { flex: 1; overflow-y: auto; min-height: 0; padding: .3rem 0; }

.pos-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid rgba(0, 0, 0, .05);
  padding: .55rem .85rem .55rem .7rem;
  cursor: pointer;
}
.pos-item:hover { background: rgba(0, 0, 0, .035); }
.pos-item[aria-selected="true"] { background: var(--paper); border-left-color: var(--accent); }

.pos-top { display: flex; gap: .55rem; align-items: flex-start; }
.pos-titles { min-width: 0; }

.pos-title {
  display: block;
  font-weight: 550;
  line-height: 1.32;
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.pos-org { display: block; font-size: .76rem; color: var(--ink-soft); margin-top: .1rem; }

.score-badge {
  flex: none;
  width: 2.1rem;
  text-align: center;
  padding: .1rem 0;
  border-radius: 3px;
  font-size: .82rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  background: var(--desk);
}
.score-badge.priority { background: var(--accent); border-color: var(--accent); color: #fff; }
.score-badge.solid    { background: var(--accent-lo); border-color: var(--accent); color: var(--accent); }
.score-badge.safety   { background: var(--warn-lo); border-color: var(--warn); color: var(--warn); }
.score-badge.drop     { background: var(--flag-lo); border-color: var(--flag); color: var(--flag); }

.pos-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin: .35rem 0 0 2.65rem;
  font-size: .74rem;
}

.pos-deadline { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.pos-deadline.urgent { color: var(--flag); font-weight: 600; }
.pos-deadline.soon   { color: var(--warn); }
.pos-deadline.gone   { color: var(--ink-faint); text-decoration: line-through; }

.ticks { display: flex; gap: .45rem; }

.tick { color: var(--ink-faint); white-space: nowrap; }
.tick.on { color: var(--accent); font-weight: 600; }
.tick-label { margin-left: .12rem; font-size: .68rem; }

.tick-state { font-size: .8rem; color: var(--ink-faint); }
.tick-state.on { color: var(--accent); }

/* A position on hold stays legible — it is kept, not hidden — but reads as
   set aside, which is what the sort order has already done with it. */
.pos-item.on-hold { background: repeating-linear-gradient(
    135deg, transparent, transparent 7px, rgba(0, 0, 0, .022) 7px,
    rgba(0, 0, 0, .022) 14px); }
.pos-item.on-hold .pos-title,
.pos-item.on-hold .pos-org { color: var(--ink-soft); }
.pos-item.on-hold .score-badge { opacity: .7; }
.pos-item.on-hold[aria-selected="true"] { background: var(--paper); }

.tick.hold.on { color: var(--warn); }

/* The row's own on-hold control: a real button, so it is reachable by keyboard
   and does not open the position it sits on. */
.tick.toggle {
  background: none;
  border: 0;
  padding: 0 .1rem;
  font: inherit;
  font-size: .74rem;
  cursor: pointer;
  border-radius: 2px;
}
.tick.toggle:hover { color: var(--warn); background: var(--warn-lo); }
.tick.toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pos-item .tick.toggle.off { opacity: 0; transition: opacity .12s; }
.pos-item:hover .tick.toggle.off,
.pos-item:focus-within .tick.toggle.off,
.pos-item[aria-selected="true"] .tick.toggle.off { opacity: 1; }
.tick.busy.on { color: var(--accent); animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

.tag.hold { border-color: var(--warn); background: var(--warn-lo); color: var(--warn); }

.hold-note-row { margin-top: .5rem; }
.hold-note-row input {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .35rem .5rem;
  font-size: .82rem;
}
.hold-note-row input:focus { border-color: var(--warn); }

/* Work happening on a position other than the one on screen. */
.jobs-elsewhere {
  margin: 0 0 .7rem;
  padding: .4rem .6rem;
  font-size: .8rem;
  color: var(--accent);
  background: var(--accent-lo);
  border-left: 2px solid var(--accent);
}

/* ── quota banner ───────────────────────────────────────────────────── */
.quota {
  margin-top: .6rem;
  padding: .6rem .7rem;
  font-size: .82rem;
  border-left: 2px solid var(--flag);
  background: var(--flag-lo);
}
.quota.warn { border-left-color: var(--warn); background: var(--warn-lo); }
.quota p { margin: .3rem 0 0; }
.quota-when { font-weight: 600; }

/* ── main ───────────────────────────────────────────────────────────── */
.main { min-width: 0; display: flex; flex-direction: column; }

.empty { margin: auto; max-width: 27rem; padding: 2rem; text-align: center; color: var(--ink-soft); }
.empty-sub { font-size: .85rem; color: var(--ink-faint); }

.workspace { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: .85rem 1.3rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.topbar h2 { font-size: 1rem; line-height: 1.32; }
.topbar-title p { margin: .15rem 0 0; font-size: .8rem; color: var(--ink-soft); }
.topbar-flags { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }

.tag {
  font-size: .73rem;
  padding: .12rem .45rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag.warn { border-color: var(--flag); background: var(--flag-lo); color: var(--flag); }
.tag.good { border-color: var(--accent); background: var(--accent-lo); color: var(--accent); }

/* ── panes ──────────────────────────────────────────────────────────── */
.panes {
  display: grid;
  grid-template-columns: minmax(0, 25rem) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.pane { min-width: 0; min-height: 0; display: flex; }
.pane-scroll { flex: 1; overflow-y: auto; padding: 1rem 1.2rem 4rem; min-height: 0; }
.pane-advert { border-right: 1px solid var(--rule); background: var(--desk-deep); }
.pane-sheet { background: var(--desk); }

/* ── controls ───────────────────────────────────────────────────────── */
.primary, .ghost {
  border-radius: 3px;
  border: 1px solid transparent;
  padding: .42rem .8rem;
  cursor: pointer;
  font-weight: 550;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.primary { background: var(--accent); color: #fff; }
.primary:hover:not(:disabled) { background: #27503f; }

.ghost { background: transparent; border-color: var(--rule); color: var(--ink-soft); }
.ghost:hover:not(:disabled) { background: rgba(0, 0, 0, .04); color: var(--ink); }

.primary:disabled, .ghost:disabled, .disabled { opacity: .45; cursor: default; pointer-events: none; }
.small { padding: .28rem .55rem; font-size: .82rem; }

.linky {
  background: none; border: 0; padding: 0;
  color: var(--ink-faint); font-size: .8rem; cursor: pointer;
  text-decoration: underline;
}
.linky:hover { color: var(--ink); }

.control {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: .7rem .8rem;
  margin-bottom: 1rem;
}

.tickrow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  padding-bottom: .55rem;
  margin-bottom: .55rem;
  border-bottom: 1px solid var(--rule);
}

.control-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

.check { display: flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--ink-soft); }
.check.tight { font-size: .8rem; }

.row { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; margin: .6rem 0 0; }
.row input[type="password"], .row input[type="url"], .row input[type="text"] {
  flex: 1;
  min-width: 9rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .35rem .5rem;
}

.hint { font-size: .79rem; color: var(--ink-faint); margin: .4rem 0 0; line-height: 1.45; }

/* ── activity log ───────────────────────────────────────────────────── */
.activity {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: .6rem .7rem;
  margin: .6rem 0 0;
}

.activity h3 {
  font-size: .8rem;
  color: var(--ink-soft);
  margin-bottom: .35rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.log { list-style: none; margin: 0; padding: 0; max-height: 12rem; overflow-y: auto; font-size: .78rem; }
.log li { display: flex; gap: .45rem; padding: .1rem 0; border-bottom: 1px solid rgba(0, 0, 0, .04); }
.log li:last-child { border-bottom: 0; }
.log time { color: var(--ink-faint); font-variant-numeric: tabular-nums; flex: none; }
.log .msg { color: var(--ink-soft); overflow-wrap: anywhere; }
.log .k-stage .msg { color: var(--ink); font-weight: 550; }
.log .k-search .msg, .log .k-tool .msg { color: var(--accent); }
.log .k-retry .msg { color: var(--warn); }
.log .k-error .msg, .log .k-quota .msg { color: var(--flag); }
.log .k-done .msg { color: var(--accent); font-weight: 550; }

/* ── score ──────────────────────────────────────────────────────────── */
.score-box, .reqs {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: .75rem .8rem;
  margin-bottom: 1rem;
}

.score-box h3, .reqs h3, .advert h3, .changes h3, .comment-box h3,
.conversation h3 {
  font-size: .8rem; color: var(--ink-soft); margin-bottom: .45rem;
}

.score-head { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; }
.score-total { font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.score-head .hint { margin: 0; }

.score-reasoning { margin: .5rem 0 .6rem; font-size: .85rem; border-left: 2px solid var(--accent); padding-left: .65rem; }

.gates { display: flex; gap: .3rem; flex-wrap: wrap; margin-bottom: .65rem; }

/* Named `knockout` rather than `gate` so it cannot collide with `.gate`, the
   sign-in overlay: one shared class name there silently restyled the whole
   sign-in card as a 0.72rem chip. */
.knockout {
  font-size: .72rem;
  padding: .1rem .4rem;
  border-radius: 2px;
  border: 1px solid var(--rule);
  white-space: nowrap;
}
.knockout.pass    { border-color: var(--accent); background: var(--accent-lo); color: var(--accent); }
.knockout.fail    { border-color: var(--flag); background: var(--flag-lo); color: var(--flag); }
.knockout.unknown { color: var(--ink-faint); }

.breakdown {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .12rem .7rem;
  margin: 0 0 .6rem;
  font-size: .8rem;
}
.breakdown dt { color: var(--ink-faint); }
.breakdown dd { margin: 0; }
.bd-score { font-variant-numeric: tabular-nums; font-weight: 600; }
.bd-weight { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.bd-note { display: block; color: var(--ink-soft); font-size: .78rem; }

.score-notes h4 { font-size: .78rem; color: var(--ink-faint); margin: .5rem 0 .2rem; }
.good-list, .bad-list { margin: 0; padding-left: 1.1rem; font-size: .82rem; }
.good-list li { color: var(--ink); }
.bad-list li { color: var(--flag); }

/* ── requirements ───────────────────────────────────────────────────── */
.req-list { list-style: none; margin: 0; padding: 0; }

.req {
  border-left: 2px solid var(--accent);
  padding: .35rem 0 .45rem .6rem;
  margin-bottom: .55rem;
}
.req.optional { border-left-color: var(--rule); }

.req-head { display: flex; gap: .35rem; align-items: baseline; flex-wrap: wrap; }
.req-label { font-weight: 550; font-size: .85rem; }
.req-detail { margin: .2rem 0 0; font-size: .82rem; color: var(--ink-soft); }

.req-quote {
  margin: .3rem 0 0;
  padding-left: .6rem;
  border-left: 1px solid var(--rule);
  font-size: .8rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* ── advert ─────────────────────────────────────────────────────────── */
.meta { margin: 0 0 .75rem; display: grid; grid-template-columns: auto 1fr; gap: .1rem .7rem; font-size: .8rem; }
.meta dt { color: var(--ink-faint); }
.meta dd { margin: 0; overflow-wrap: anywhere; }

.advert-body {
  font-family: var(--sans);
  font-size: .83rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: .75rem;
  margin: 0;
  max-height: 28rem;
  overflow-y: auto;
}

/* ── document buttons ───────────────────────────────────────────────── */
.doc-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .55rem;
  margin-bottom: 1rem;
}

.doc-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: .6rem .7rem .65rem;
}
.doc-card.has { border-left: 3px solid var(--accent); }

.doc-head { display: flex; gap: .3rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .4rem; }
.doc-label { font-weight: 600; font-size: .87rem; }

.doc-quote {
  margin: 0 0 .45rem;
  font-size: .78rem;
  color: var(--ink-faint);
  font-style: italic;
  border-left: 1px solid var(--rule);
  padding-left: .5rem;
}

.doc-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

/* ── sheet ──────────────────────────────────────────────────────────── */
.sheet-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .85rem;
}

.versions { display: flex; align-items: center; gap: .4rem; font-size: .82rem; }
.versions label { color: var(--ink-faint); }
.versions select { background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: .22rem .35rem; }
.version-origin { color: var(--ink-faint); font-size: .78rem; }
.sheet-actions { display: flex; gap: .35rem; flex-wrap: wrap; }

.sheet {
  display: grid;
  grid-template-columns: 4.4rem minmax(0, 1fr);
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 1px 0 var(--desk-deep), 0 10px 24px -18px rgba(0, 0, 0, .5);
  padding: 2.4rem 2.6rem 2.8rem 1.1rem;
  max-width: 48rem;
}

.sheet-margin {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  padding-right: 1rem;
  border-right: 1px solid var(--rule);
  font-size: .72rem;
  color: var(--ink-faint);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sheet-body {
  padding-left: 1.5rem;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.62;
  text-align: justify;
  hyphens: auto;
}
.sheet-body p { margin: 0 0 .85em; }
.sheet-body p:last-child { margin-bottom: 0; }

.sheet-body.cv-body {
  padding-left: 0;
  text-align: left;
  hyphens: none;
  font-size: .95rem;
  line-height: 1.45;
}
.sheet-body.cv-body .cv-name {
  font-size: 1.25rem;
  text-align: center;
  margin: 0 0 .25rem;
}
.sheet-body.cv-body .cv-h {
  font-size: .92rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: .95rem 0 .25rem;
  padding-bottom: .15rem;
  border-bottom: 1px solid var(--rule);
}
.sheet-body.cv-body .cv-h3 {
  font-size: .95rem;
  margin: .45rem 0 .1rem;
}
.sheet-body.cv-body .cv-line,
.sheet-body.cv-body .cv-bullet {
  margin: 0 0 .15rem;
}
.sheet-body.cv-body .cv-bullet { padding-left: .9rem; }
.sheet-body.cv-body .cv-gap { height: .35rem; }

.sheet-empty {
  background: var(--paper);
  border: 1px dashed var(--rule);
  padding: 2rem;
  text-align: center;
  color: var(--ink-soft);
  max-width: 48rem;
}

.margin-score { color: var(--accent); }
.margin-score.thin { color: var(--flag); }

/* ── needs, changes, comments ───────────────────────────────────────── */
.needs, .changes, .comment-box, .conversation { max-width: 48rem; margin-top: 1.3rem; }

/* ── the conversation about one document ────────────────────────────── */
.turns { list-style: none; margin: .6rem 0 0; padding: 0; max-height: 22rem; overflow-y: auto; }

.turn {
  border-left: 2px solid var(--rule);
  padding: .35rem 0 .5rem .7rem;
  margin-bottom: .6rem;
}
.turn.applicant { border-left-color: var(--accent); }
.turn.assistant { border-left-color: var(--rule); }

.turn-head {
  display: flex;
  gap: .5rem;
  align-items: baseline;
  font-size: .72rem;
  color: var(--ink-faint);
  margin-bottom: .2rem;
}
.turn-who { font-weight: 650; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.turn.applicant .turn-who { color: var(--accent); }
.turn-version { font-variant-numeric: tabular-nums; }
.turn-line { margin: .18rem 0; font-size: .85rem; line-height: 1.5; }
.turn.assistant .turn-line { color: var(--ink-soft); }
.needs h3 { font-size: .8rem; margin-bottom: .4rem; }
.flagged-head { color: var(--flag) !important; margin-top: 1rem; }

.change-list, .unaddressed-list { list-style: none; margin: 0; padding: 0; }

.change-list li {
  border-left: 2px solid var(--accent);
  padding: .3rem 0 .35rem .65rem;
  margin-bottom: .45rem;
  font-size: .85rem;
}
.change-list .from-comment { display: block; color: var(--ink-faint); font-size: .78rem; margin-top: .12rem; }

.unaddressed-list li {
  border-left: 2px solid var(--flag);
  background: var(--flag-lo);
  padding: .45rem .65rem;
  margin-bottom: .45rem;
  font-size: .85rem;
}
.unaddressed-list .why { display: block; margin-top: .18rem; color: var(--ink-soft); }
.unaddressed-list .fix { display: block; margin-top: .22rem; }

.comment-box textarea {
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .65rem .75rem;
  line-height: 1.55;
  resize: vertical;
}
.comment-box textarea:focus { border-color: var(--accent); }

.comment-actions { display: flex; align-items: center; gap: .8rem; margin-top: .55rem; flex-wrap: wrap; }
.comment-actions .hint { margin: 0; }

/* The first line of a modal, answering "what is this for?" before the detail. */
.lede {
  margin: 0 0 .6rem;
  font-size: .95rem;
  color: var(--ink);
}

/* ── modals ─────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(31, 36, 33, .45);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 1.2rem;
}

.modal-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, .7);
  width: min(38rem, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.wide-card { width: min(50rem, 100%); }

.modal-head, .modal-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1.1rem;
}
.modal-head { border-bottom: 1px solid var(--rule); }
.modal-head h2 { font-size: 1rem; }
.modal-foot { border-top: 1px solid var(--rule); background: var(--desk); }
.modal-foot div { display: flex; gap: .4rem; }

.modal-body { overflow-y: auto; padding: 1rem 1.1rem 1.2rem; min-height: 0; }
.modal-body > p:first-child { margin-top: 0; }
.modal-body h3 { font-size: .85rem; margin: 1.1rem 0 .35rem; }
.modal-body h3:first-child { margin-top: 0; }

.settings-block { padding-bottom: 1rem; margin-bottom: 1rem; border-bottom: 1px solid var(--rule); }
.settings-block:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.filedrop {
  display: block;
  border: 1px dashed var(--rule);
  background: var(--desk);
  padding: 1.1rem;
  text-align: center;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: .85rem;
  margin: .6rem 0;
}
.filedrop:hover { border-color: var(--accent); color: var(--ink); }
.filedrop input { display: block; margin: .5rem auto 0; }

.np-headline { margin: 0; font-weight: 550; }
.np-summary { margin-bottom: .9rem; }

.np-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: .4rem .7rem;
  align-items: center;
  margin-bottom: .9rem;
}
.np-grid label { font-size: .82rem; color: var(--ink-soft); }
.np-grid input, .np-grid select {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .35rem .5rem;
  min-width: 0;
}

.chips { display: flex; flex-wrap: wrap; gap: .28rem; margin-bottom: .7rem; }

.chip {
  font-size: .76rem;
  padding: .12rem .45rem;
  background: var(--accent-lo);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 2px;
}

.np-notes { margin: 0 0 .8rem; padding-left: 1.1rem; font-size: .82rem; color: var(--ink-soft); }

.np-cat-tools { display: flex; gap: .35rem; margin: .5rem 0; flex-wrap: wrap; }
.np-cat-tools input {
  flex: 1;
  min-width: 8rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .3rem .45rem;
}

.np-cats {
  max-height: 17rem;
  overflow-y: auto;
  border: 1px solid var(--rule);
  background: var(--desk);
  padding: .3rem .4rem;
}
.np-cats.short { max-height: 11rem; }

.cat-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .4rem;
  align-items: baseline;
  padding: .12rem .2rem;
  font-size: .82rem;
  cursor: pointer;
}
.cat-row:hover { background: rgba(0, 0, 0, .04); }
.cat-label { overflow-wrap: anywhere; }
.cat-why { font-size: .73rem; color: var(--ink-faint); white-space: nowrap; }
.cat-why.related { color: var(--warn); }

.np-extra { margin-top: .9rem; }
.np-extra summary { cursor: pointer; font-size: .82rem; color: var(--ink-soft); }

/* ── access check ───────────────────────────────────────────────────── */
.check-summary {
  margin: .7rem 0 .5rem;
  padding: .45rem .65rem;
  font-size: .85rem;
  border-left: 2px solid var(--rule);
  background: var(--desk);
}
.check-summary.ok   { border-left-color: var(--accent); background: var(--accent-lo); }
.check-summary.warn { border-left-color: var(--warn); background: var(--warn-lo); }
.check-summary.bad  { border-left-color: var(--flag); background: var(--flag-lo); color: var(--flag); }

.check-list { list-style: none; margin: 0; padding: 0; font-size: .83rem; }
.check-list li { display: flex; gap: .5rem; align-items: baseline; padding: .22rem 0; border-bottom: 1px solid rgba(0, 0, 0, .05); }
.check-list li:last-child { border-bottom: 0; }
.ck-mark { flex: none; width: 1rem; font-weight: 700; }
.check-list li.ok .ck-mark { color: var(--accent); }
.check-list li.bad .ck-mark { color: var(--flag); }
.ck-body { flex: 1; min-width: 0; }
.ck-detail { display: block; color: var(--ink-soft); font-size: .8rem; overflow-wrap: anywhere; }
.ck-ms { flex: none; color: var(--ink-faint); font-size: .75rem; font-variant-numeric: tabular-nums; }

.remedy { margin-top: .7rem; padding: .55rem .7rem; background: var(--warn-lo); border-left: 2px solid var(--warn); font-size: .83rem; }
.remedy .diagnosis { margin: 0 0 .4rem; }
.remedy ul { margin: 0; padding-left: 1.1rem; }
.remedy li { margin-bottom: .25rem; }

.resolvers, .model-table { width: 100%; border-collapse: collapse; font-size: .8rem; margin-top: .5rem; }
.resolvers td, .model-table td { padding: .18rem .35rem; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.resolvers tr.ok td:first-child { color: var(--accent); font-weight: 700; }
.resolvers tr.bad td { color: var(--ink-faint); }
.model-table .yes { color: var(--accent); }
.model-table .no { color: var(--ink-faint); }
.model-table .hint { margin: 0; }

/* ── toast ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: .5rem 1rem;
  border-radius: 3px;
  font-size: .85rem;
  z-index: 40;
  max-width: 36rem;
}
.toast.bad { background: var(--flag); }

/* ── responsive ─────────────────────────────────────────────────────── */
@media (max-width: 1400px) {
  .panes { grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); }
}

@media (max-width: 1180px) {
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .listcol { grid-column: 2; }
  .main {
    grid-column: 1 / -1;
    border-top: 1px solid var(--rule);
  }
  .panes { grid-template-columns: minmax(0, 1fr); }
  .pane-advert { border-right: 0; border-bottom: 1px solid var(--rule); }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .rail-list { display: flex; overflow-x: auto; padding: .3rem; }
  .rail-item { min-width: 11rem; border-left: 0; border-bottom: 3px solid transparent; }
  .rail-item[aria-selected="true"] { border-bottom-color: var(--accent); }
  .listcol { grid-column: 1; border-right: 0; border-bottom: 1px solid var(--rule); }
  .position-list { max-height: 22rem; }
  .sheet { grid-template-columns: minmax(0, 1fr); padding: 1.3rem; }
  .sheet-margin {
    flex-direction: row;
    gap: .8rem;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 0 0 .5rem;
    margin-bottom: .85rem;
    text-align: left;
  }
  .sheet-body { padding-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
