/* Job Hunt dashboard - light and dark themes via tokens on :root. */
:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --ink: #0f172a;
  --ink-2: #334155;
  --ink-3: #64748b;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #ccfbf1;
  --accent-soft-ink: #115e59;
  --good: #15803d;   --good-soft: #dcfce7;
  --warn: #b45309;   --warn-soft: #fef3c7;
  --bad: #b91c1c;    --bad-soft: #fee2e2;
  --info: #1d4ed8;   --info-soft: #dbeafe;
  --violet: #6d28d9; --violet-soft: #ede9fe;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .06);
  --radius: 12px;
  --font: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120; --panel: #111827; --panel-2: #0f172a; --line: #1f2937; --line-strong: #334155;
    --ink: #e5e7eb; --ink-2: #cbd5e1; --ink-3: #94a3b8;
    --accent: #2dd4bf; --accent-ink: #042f2e; --accent-soft: #134e4a; --accent-soft-ink: #99f6e4;
    --good: #4ade80; --good-soft: #14532d; --warn: #fbbf24; --warn-soft: #451a03;
    --bad: #f87171; --bad-soft: #450a0a; --info: #93c5fd; --info-soft: #1e3a8a;
    --violet: #c4b5fd; --violet-soft: #2e1065;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1120; --panel: #111827; --panel-2: #0f172a; --line: #1f2937; --line-strong: #334155;
  --ink: #e5e7eb; --ink-2: #cbd5e1; --ink-3: #94a3b8;
  --accent: #2dd4bf; --accent-ink: #042f2e; --accent-soft: #134e4a; --accent-soft-ink: #99f6e4;
  --good: #4ade80; --good-soft: #14532d; --warn: #fbbf24; --warn-soft: #451a03;
  --bad: #f87171; --bad-soft: #450a0a; --info: #93c5fd; --info-soft: #1e3a8a;
  --violet: #c4b5fd; --violet-soft: #2e1065;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* author display rules must not override hidden */
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout */
.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; background: var(--panel); border-right: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; padding: 2px 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent);
  box-shadow: inset 0 0 0 7px var(--accent), inset 0 0 0 9px rgba(255,255,255,.6); }
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: var(--ink-3); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); font-weight: 500; }
.nav a:hover { background: var(--panel-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-soft-ink); }
.nav .ico { width: 18px; text-align: center; opacity: .8; }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.badge:empty { display: none; }
.badge.muted { background: var(--line); color: var(--ink-2); }
.badge.bad { background: var(--bad); color: #fff; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.run-status { font-size: 12px; color: var(--ink-3); display: flex; flex-direction: column; gap: 4px; }
.run-status .row { display: flex; gap: 6px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dot.live { background: var(--accent); animation: pulse 1.2s infinite; }
.dot.ok { background: var(--good); }
.dot.err { background: var(--bad); }
@keyframes pulse { 50% { opacity: .35; } }

.main { padding: 26px 30px 96px; max-width: 1400px; width: 100%; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.loading { color: var(--ink-3); padding: 40px; }

/* ---------- cards / panels */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 14px 16px; }
.panel-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.grid.home { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.empty { color: var(--ink-3); padding: 18px 16px; font-size: 13px; }

.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tile .k { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }
.tile .s { font-size: 12px; color: var(--ink-3); }
.tile.accent .v { color: var(--accent); }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------- list rows */
.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); }
.item:first-child { border-top: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .title a { color: var(--ink); }
.item .meta { color: var(--ink-3); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 2px; }
.item .why { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.item .actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--panel-2); }

/* ---------- score ring */
.score { --p: 0; --c: var(--accent); width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); position: relative; }
.score::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--panel); }
.score b { position: relative; font-size: 13px; font-weight: 700; }
.score.sm { width: 34px; height: 34px; }
.score.sm::before { inset: 4px; }
.score.sm b { font-size: 11px; }
.score.gated { --c: var(--bad); }
.score.gated b { color: var(--bad); }

/* ---------- chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.violet { background: var(--violet-soft); color: var(--violet); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent-soft-ink); border-color: transparent; }

/* ---------- buttons / forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.btn-group button { border: none; background: var(--panel); padding: 6px 12px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-2); }
.btn-group button.on { background: var(--accent-soft); color: var(--accent-soft-ink); }
input[type=text], input[type=search], input[type=date], input[type=url], input[type=number], select, textarea {
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; min-width: 0; }
textarea { width: 100%; resize: vertical; min-height: 90px; line-height: 1.45; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=search] { width: 260px; }
.check { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); font-size: 13px; cursor: pointer; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.form label.full { grid-column: 1 / -1; }
.form input, .form select, .form textarea { color: var(--ink); font-size: 13.5px; font-weight: 400; }

/* ---------- table */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 650;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); position: sticky; top: 0; cursor: pointer; user-select: none; white-space: nowrap; }
table.data th.sorted::after { content: " \25BE"; }
table.data th.sorted.asc::after { content: " \25B4"; }
table.data td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tr.row:hover td { background: var(--panel-2); cursor: pointer; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.dim td { opacity: .55; }

/* ---------- board */
.board { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 200px; display: flex; flex-direction: column; }
.col-head { padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; font-weight: 650; font-size: 13px; }
.col-body { padding: 0 8px 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; cursor: grab; box-shadow: var(--shadow); }
.card:hover { border-color: var(--line-strong); }
.card.dragging { opacity: .5; }
.card .co { font-size: 12px; color: var(--ink-3); font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .row.top { flex-wrap: nowrap; justify-content: space-between; }
.card .ro { font-weight: 600; font-size: 13px; margin: 2px 0 6px; }
.card .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* the Closed column is a bin: a drop target that opens the Closed table when clicked */
.col.bin { cursor: pointer; transition: background-color .12s, border-color .12s; }
.col.bin:hover { border-color: var(--line-strong); }
.col.bin:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bin-body { align-items: center; text-align: center; gap: 6px; padding: 28px 12px 12px; color: var(--ink-3); font-size: 13px; }
.bin-body svg { width: 36px; height: 36px; opacity: .75; }
.col.bin.drop { background: var(--bad-soft); border-color: var(--bad); outline: 2px dashed var(--bad); outline-offset: -4px; }
.col.bin.drop .bin-body, .col.bin.drop .bin-body .muted { color: var(--bad); }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 60; margin: 0; pointer-events: none; box-shadow: 0 12px 32px rgba(15, 23, 42, .28); }
.drag-ghost .bin-mark { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; background: var(--bad-soft); color: var(--bad); opacity: 0; transition: opacity .12s; }
.drag-ghost.binning { border-color: var(--bad); }
.drag-ghost.binning .bin-mark { opacity: .94; }

/* ---------- drafts panel (job drawer) */
.drafts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 14px 16px; }
.draft { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.draft .thumb { display: block; aspect-ratio: 210 / 297; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; background: #fff; }
.draft a.thumb:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.draft .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.draft .thumb.none { display: grid; place-items: center; aspect-ratio: auto; min-height: 96px; background: var(--panel-2); color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-align: center; padding: 10px; }
.draft-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.draft .row { display: flex; gap: 6px; flex-wrap: wrap; }
.draft-foot { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; }
.drafts + .draft-foot { border-top: 1px solid var(--line); }
details.all-files > summary { cursor: pointer; list-style: none; }
details.all-files > summary::-webkit-details-marker { display: none; }
details.all-files > summary h2::before { content: "\25B8"; display: inline-block; margin-right: 6px; color: var(--ink-3); transition: transform .12s; }
details.all-files[open] > summary h2::before { transform: rotate(90deg); }
details.all-files:not([open]) > summary { border-bottom: none; }

/* ---------- drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; height: 100vh; width: min(760px, 96vw); background: var(--bg); border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(0,0,0,.15); z-index: 21; transform: translateX(100%); transition: transform .18s ease; overflow-y: auto; }
.drawer.open { transform: none; }
.drawer-head { position: sticky; top: 0; z-index: 2; background: var(--panel); border-bottom: 1px solid var(--line); padding: 16px 20px; display: flex; gap: 14px; align-items: flex-start; }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head .co { color: var(--ink-3); font-weight: 600; font-size: 13px; }
.drawer-body { padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 14px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; }
.facts .f .k { font-size: 11.5px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.facts .f .v { font-size: 13.5px; overflow-wrap: anywhere; }
.breakdown { display: flex; flex-direction: column; gap: 8px; }
.bd-row { display: grid; grid-template-columns: 78px 1fr 60px; gap: 10px; align-items: center; font-size: 12.5px; }
.bd-row .name { color: var(--ink-3); font-weight: 600; text-transform: capitalize; }
.bd-row .track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bd-row .track span { display: block; height: 100%; background: var(--accent); }
.bd-row .pts { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bd-row .why { grid-column: 2 / -1; color: var(--ink-3); margin-top: -6px; font-size: 12px; }
.gates { margin: 0 0 6px; padding: 10px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--bad); font-size: 13px; font-weight: 600; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.timeline li:first-child { border-top: none; }
.timeline .when { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.inline-form input[type=text] { flex: 1; min-width: 180px; }
.notes-view { white-space: pre-wrap; font-size: 13px; color: var(--ink-2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- modal / toasts */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 30; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); width: min(640px, 100%); max-height: 90vh; overflow-y: auto; }
.modal .panel-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.toasts { position: fixed; bottom: 88px; right: 22px; display: flex; flex-direction: column; gap: 8px; z-index: 40; }
.toast { background: var(--ink); color: var(--panel); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 420px; font-size: 13px; }
.toast.err { background: var(--bad); color: #fff; }
.toast ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- assistant */
.chat-fab { position: fixed; right: 22px; bottom: 22px; z-index: 25; width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow), 0 6px 18px rgba(15, 118, 110, .35);
  transition: transform .12s ease; }
.chat-fab:hover { transform: scale(1.05); }
.chat-fab.on { transform: scale(.92); }
.chat { position: fixed; right: 22px; bottom: 88px; z-index: 26; width: min(430px, calc(100vw - 44px)); height: min(660px, calc(100vh - 116px));
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .22); overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-head b { flex: 1; }
.chat-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-quick { display: flex; gap: 4px; padding: 6px 10px 0; flex-wrap: wrap; border-top: 1px solid var(--line); }
.chat-quick:empty { display: none; }
.chat-input { display: flex; gap: 8px; align-items: flex-end; padding: 10px; }
.chat-input textarea { flex: 1; resize: none; min-height: 38px; height: 38px; max-height: 120px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; background: var(--panel); }
.chat-intro p { margin: 0 0 10px; color: var(--ink-2); font-size: 13.5px; }
.chat-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; }
.chat-opt:hover { border-color: var(--accent); }
.chat-opt span { font-size: 12.5px; color: var(--ink-3); }
.cm { max-width: 90%; padding: 8px 11px; border-radius: 12px; font-size: 13.5px; overflow-wrap: anywhere; }
.cm.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.cm.bot { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.cm.bot p { margin: 0 0 6px; }
.cm.bot p:last-child { margin-bottom: 0; }
.cm.bot ul, .cm.bot ol { margin: 4px 0 6px; padding-left: 20px; }
.cm.bot code { font-family: var(--mono); font-size: 12px; background: var(--line); padding: 0 4px; border-radius: 4px; }
.cm-tool { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-tool.err { color: var(--bad); }
.cm-work { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.cm-err { color: var(--bad); background: var(--bad-soft); padding: 8px 10px; border-radius: 8px; font-size: 13px; white-space: pre-wrap; }
.cm-doc { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 8px 10px; border: 1px dashed var(--accent); border-radius: 10px; font-size: 13px; }
.cm-cards { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex: none; }
.cm-cards-head { padding: 8px 10px; font-weight: 650; font-size: 12.5px; background: var(--panel-2); }
.cm-card { display: flex; gap: 8px; align-items: flex-start; padding: 9px 10px; border-top: 1px solid var(--line); font-size: 13px; }
.cm-card .grow { flex: 1; min-width: 0; }
.cm-card .title { font-weight: 600; }
.cm-card .title a { color: var(--ink); }
.cm-card .meta { color: var(--ink-3); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; margin-top: 2px; }
.cm-card .actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; max-width: 48%; }
.cm-n { font-weight: 700; color: var(--ink-3); min-width: 16px; }

/* ---------- CV / letter editor */
.doc-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .55); display: grid; place-items: center; padding: 16px; }
.doc { position: relative; background: var(--bg); width: min(1000px, 100%); height: 100%; border-radius: 14px; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow); }
.doc-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.doc-head .grow { flex: 1; min-width: 220px; }
.doc-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 2px; }
.doc-hint { padding: 6px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.doc-body { flex: 1; overflow-y: auto; padding: 18px 18px 200px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.doc-page { position: relative; width: min(820px, 100%); flex: none; background: #fff; box-shadow: 0 2px 14px rgba(0, 0, 0, .18); }
.doc-page img { display: block; width: 100%; height: 100%; }
.doc-line { position: absolute; border-radius: 2px; cursor: text; }
.doc-line:hover { background: rgba(15, 118, 110, .12); outline: 1px solid rgba(15, 118, 110, .4); }
.doc-line.on { background: rgba(250, 204, 21, .3); outline: 1px solid rgba(202, 138, 4, .7); }
.doc-line.fixed { cursor: default; }
.doc-line.fixed:hover { background: rgba(100, 116, 139, .1); outline: none; }
.doc-pdf { width: min(820px, 100%); height: 70vh; flex: none; border: 1px solid var(--line); background: #fff; }
.doc-missing { width: min(460px, 100%); margin-top: 48px; padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.doc-missing p { margin: 0; }
.doc-blocks { width: min(820px, 100%); display: flex; flex-direction: column; gap: 6px; }
.doc-block { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: text; font-size: 13px; }
.doc-block:hover { border-color: var(--accent); }
.doc-edit { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); background: var(--panel);
  border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.doc-edit textarea { width: 100%; min-height: 96px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px; background: var(--panel); }
.doc-edit .row { display: flex; gap: 8px; flex-wrap: wrap; }
.bad-ink { color: var(--bad); }

.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.sep { height: 1px; background: var(--line); margin: 4px 0; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; }
details.notes summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 13px; }
details.notes .notes-view { margin-top: 8px; }

@media (max-width: 1100px) {
  .grid.home { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* ---------- phone (iPhone via Tailscale, or a narrow window) */
.mtop { display: none; }
@media (max-width: 760px) {
  body { -webkit-text-size-adjust: 100%; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .mtop { display: flex; position: sticky; top: 0; z-index: 12; align-items: center; gap: 10px;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
  .mtop .grow { flex: 1; min-width: 0; }
  .mtop .brand-mark { width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 6px var(--accent), inset 0 0 0 8px rgba(255,255,255,.6); }
  .mtop .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* sidebar becomes a bottom tab bar */
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 15; flex-direction: row; gap: 0;
    padding: 4px 2px calc(4px + env(safe-area-inset-bottom)); border-right: none; border-top: 1px solid var(--line); }
  .sidebar .brand, .sidebar .side-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; gap: 0; }
  .nav a { position: relative; flex: 1; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; font-size: 10.5px; border-radius: 10px; }
  .nav .ico { font-size: 19px; width: auto; line-height: 1.1; }
  .nav .badge { position: absolute; top: 1px; left: calc(50% + 6px); margin: 0; min-width: 17px; line-height: 16px; font-size: 10px; padding: 0 4px; }

  .main { padding: 14px 12px calc(140px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 20px; }
  .page-head p { font-size: 12.5px; }

  /* iOS zooms into any field under 16px - keep them at 16 */
  input[type=text], input[type=search], input[type=date], input[type=url], input[type=number], select, textarea { font-size: 16px; }
  .form input, .form select, .form textarea { font-size: 16px; }

  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .tile { padding: 9px 10px; }
  .tile .k { font-size: 11px; }
  .tile .v { font-size: 20px; }
  .tile .s { display: none; }

  .item { flex-wrap: wrap; padding: 12px; }
  .item .grow { flex: 1 1 calc(100% - 64px); }
  .item .actions { width: 100%; justify-content: flex-start; gap: 4px; }
  .item > .chip { margin-left: auto; }
  .btn.small { padding: 7px 11px; font-size: 13px; }          /* bigger tap targets */
  .filters { gap: 6px; }
  .filters input[type=search] { width: 100%; }
  .filters select { flex: 1 1 40%; }
  .btn-group { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .btn-group button { white-space: nowrap; padding: 7px 11px; }

  /* swipe between pipeline columns */
  .board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 86%; scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .card { cursor: pointer; }

  .drawer { width: 100vw; border-left: none; }
  .drawer-head { flex-wrap: wrap; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; }
  .drawer-head > div:last-child { flex-direction: row-reverse !important; width: 100%; justify-content: space-between; align-items: center !important; }
  .drawer-body { padding: 12px 12px calc(40px + env(safe-area-inset-bottom)); }
  .facts { grid-template-columns: 1fr 1fr; }
  .two, .form { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 78px 1fr; }

  .modal-backdrop { padding: 0; place-items: end stretch; }
  .modal { width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .toasts { left: 12px; right: 12px; bottom: calc(136px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  .chat-fab { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 50px; height: 50px; }
  .chat { inset: 0; width: auto; height: auto; border-radius: 0; border: none; z-index: 36; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
  .cm-card { flex-wrap: wrap; }
  .cm-card .actions { max-width: none; width: 100%; justify-content: flex-start; }
  .doc-backdrop { padding: 0; }
  .doc { border-radius: 0; padding-top: env(safe-area-inset-top); }
  .doc-body { padding: 10px 10px 220px; }
  table.data { font-size: 12.5px; }
}
