/* ══════════════════════════════════════════════════════════════
   RawFind — the hosted Raw Finder CRM.

   Same world as the Raw Finder dashboard (harvey/web/app.css): Geist,
   one cobalt accent for the primary action and the current selection,
   status hues only on status, problem categories in their own colours.

   The screen is a triage desk: the list on the left, the lead you are
   working on to the right. The messages are the work, so they sit first
   and every block copies on click.
   ══════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('fonts/geist.woff2') format('woff2'); }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url('fonts/geist-mono.woff2') format('woff2'); }

:root {
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-caption: 0.75rem; --fs-ui: 0.8125rem; --fs-body: 0.875rem; --fs-lead: 0.9375rem;
  --fs-h3: 1rem; --fs-h2: 1.25rem; --fs-h1: 1.5rem;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --r-xs: 4px; --r-sm: 6px; --r-md: 10px; --r-lg: 14px;
  --list-w: 400px;
  --top-h: 56px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  --bg: #F6F6F7; --surface: #FFFFFF; --surface-2: #F3F3F4; --surface-3: #EBEBED;
  --line: #E7E7EA; --line-strong: #D6D6DB;
  --text: #111113; --text-2: #5B5B63; --text-3: #75757E;
  --accent: #1D4ED8; --accent-hover: #1E40AF; --accent-text: #FFFFFF;
  --accent-soft: #EBF1FE; --accent-line: #CCDBFC;

  --good: #1F7A4D; --good-bg: #E8F6EE; --good-line: #C6EAD5;
  --wait: #8A5A00; --wait-bg: #FFF4DE; --wait-line: #F6DFAE;
  --bad: #B4232F; --bad-bg: #FDECEE; --bad-line: #F7CDD2;
  --active: #0E7490; --active-bg: #E5F6F9; --active-line: #BDE5EE;
  --note: #6A3FB0; --note-bg: #F2ECFC; --note-line: #DFD1F6;

  --cat-tracking: #B4232F; --cat-tracking-bg: #FDECEE; --cat-tracking-line: #F7CDD2;
  --cat-ppc: #C2410C; --cat-ppc-bg: #FFF0E6; --cat-ppc-line: #FBD3B8;
  --cat-consent: #8A5A00; --cat-consent-bg: #FFF4DE; --cat-consent-line: #F6DFAE;
  --cat-seo: #1D4ED8; --cat-seo-bg: #EBF1FE; --cat-seo-line: #CCDBFC;
  --cat-site: #6A3FB0; --cat-site-bg: #F2ECFC; --cat-site-line: #DFD1F6;

  --shadow-border: 0 0 0 1px rgb(17 17 19 / 0.06), 0 1px 2px -1px rgb(17 17 19 / 0.06), 0 2px 4px 0 rgb(17 17 19 / 0.04);
  --shadow-border-hover: 0 0 0 1px rgb(17 17 19 / 0.10), 0 1px 2px -1px rgb(17 17 19 / 0.08), 0 4px 10px -2px rgb(17 17 19 / 0.08);
  --shadow-pop: 0 0 0 1px rgb(17 17 19 / 0.08), 0 12px 32px -8px rgb(17 17 19 / 0.20);
  --btn-shadow: 0 0 0 1px rgb(17 17 19 / 0.10), 0 1px 2px rgb(17 17 19 / 0.06);
  --btn-primary-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 0 0 1px #1A44C2, 0 1px 2px rgb(17 17 19 / 0.12);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E10; --surface: #161618; --surface-2: #1D1D20; --surface-3: #26262A;
    --line: #26262A; --line-strong: #34343A;
    --text: #F3F3F5; --text-2: #A3A3AC; --text-3: #85858E;
    --accent: #3D6FF5; --accent-hover: #5A85FF; --accent-text: #FFFFFF;
    --accent-soft: #111C36; --accent-line: #1E3366;
    --good: #5CCB8F; --good-bg: #10261B; --good-line: #1C4130;
    --wait: #F0B84F; --wait-bg: #2A2010; --wait-line: #4A3817;
    --bad: #FF7A85; --bad-bg: #2C1316; --bad-line: #4C1F25;
    --active: #4CC3D9; --active-bg: #0C2328; --active-line: #164049;
    --note: #B79BF5; --note-bg: #1E1730; --note-line: #352857;
    --cat-tracking: #FF7A85; --cat-tracking-bg: #2C1316; --cat-tracking-line: #4C1F25;
    --cat-ppc: #FB923C; --cat-ppc-bg: #2B1709; --cat-ppc-line: #4D2A12;
    --cat-consent: #F0B84F; --cat-consent-bg: #2A2010; --cat-consent-line: #4A3817;
    --cat-seo: #7FA2FF; --cat-seo-bg: #111C36; --cat-seo-line: #1E3366;
    --cat-site: #B79BF5; --cat-site-bg: #1E1730; --cat-site-line: #352857;
    --shadow-border: 0 0 0 1px rgb(255 255 255 / 0.07);
    --shadow-border-hover: 0 0 0 1px rgb(255 255 255 / 0.13);
    --shadow-pop: 0 0 0 1px rgb(255 255 255 / 0.09), 0 16px 40px -8px rgb(0 0 0 / 0.6);
    --btn-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 0 0 1px rgb(255 255 255 / 0.10);
    --btn-primary-shadow: inset 0 1px 0 rgb(255 255 255 / 0.20), 0 0 0 1px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

/* ── Base ── */
* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: var(--accent-soft); color: var(--text); }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans); font-size: var(--fs-body); line-height: 1.5;
  background: var(--bg); color: var(--text); min-height: 100dvh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: underline; text-underline-offset: 2px;
    text-decoration-thickness: from-font; text-decoration-color: var(--line-strong); }
@media (hover: hover) { a:hover { text-decoration-color: currentColor; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
kbd { font-family: var(--mono); font-size: 10.5px; line-height: 1; display: inline-flex; align-items: center;
      justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: var(--r-xs);
      color: var(--text-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none;
           stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 14px; height: 14px; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
input, textarea, select, button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── Controls ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-sm); cursor: pointer;
  font-size: var(--fs-ui); font-weight: 500; white-space: nowrap; text-decoration: none;
  background: var(--surface); color: var(--text); box-shadow: var(--btn-shadow);
  transition: background-color 150ms, box-shadow 150ms, transform 120ms var(--ease-out);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--surface-2); } }
.btn-primary { background: var(--accent); color: var(--accent-text); box-shadow: var(--btn-primary-shadow); }
@media (hover: hover) { .btn-primary:hover:not(:disabled) { background: var(--accent-hover); } }
.btn-ghost { background: none; box-shadow: none; color: var(--text-2); }
@media (hover: hover) { .btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); } }
.btn-danger { color: var(--bad); }
@media (hover: hover) { .btn-danger:hover:not(:disabled) { background: var(--bad-bg); } }
.btn-sm { height: 28px; padding: 0 10px; font-size: var(--fs-caption); }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; height: 40px; font-size: var(--fs-body); }

.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 10px; border-radius: var(--r-sm); border: 0;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: box-shadow 150ms;
}
.textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.select { width: auto; padding-right: 28px; appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 10px) 15px; background-size: 4px 4px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.field { display: grid; gap: 6px; }
.field label { font-size: var(--fs-ui); font-weight: 500; color: var(--text-2); }
.field .err { font-size: var(--fs-caption); color: var(--bad); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: var(--fs-caption); font-weight: 500; white-space: nowrap; border: 1px solid var(--line);
  color: var(--text-2); background: var(--surface-2); }
.st-qualified { color: var(--active); background: var(--active-bg); border-color: var(--active-line); }
.st-contacted { color: var(--note); background: var(--note-bg); border-color: var(--note-line); }
.st-replied, .st-meeting, .st-proposal { color: var(--wait); background: var(--wait-bg); border-color: var(--wait-line); }
.st-won { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.st-lost, .st-rejected { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-line); }

.cat { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 999px;
  border: 1px solid; font-size: 11px; font-weight: 500; white-space: nowrap; }
.cat .n { opacity: 0.8; }
.cat-tracking { color: var(--cat-tracking); background: var(--cat-tracking-bg); border-color: var(--cat-tracking-line); }
.cat-ppc { color: var(--cat-ppc); background: var(--cat-ppc-bg); border-color: var(--cat-ppc-line); }
.cat-consent { color: var(--cat-consent); background: var(--cat-consent-bg); border-color: var(--cat-consent-line); }
.cat-seo { color: var(--cat-seo); background: var(--cat-seo-bg); border-color: var(--cat-seo-line); }
.cat-site { color: var(--cat-site); background: var(--cat-site-bg); border-color: var(--cat-site-line); }
button.cat { cursor: pointer; height: 24px; padding: 0 9px; font-size: var(--fs-caption); }
button.cat.off { background: none; color: var(--text-3); border-color: var(--line); }
.cats { display: flex; flex-wrap: wrap; gap: 4px; }

.fit { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 24px; padding: 0 7px;
  border-radius: 999px; font: 600 var(--fs-caption)/1 var(--mono); border: 1px solid var(--line);
  color: var(--text-2); background: var(--surface-2); }
.fit.hi { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.fit.mid { color: var(--wait); background: var(--wait-bg); border-color: var(--wait-line); }
.fit.out { color: var(--text-3); background: none; text-decoration: line-through; }
button.fit { cursor: pointer; }

/* ── Top bar ── */
.top {
  position: sticky; top: 0; z-index: 50; height: var(--top-h);
  display: flex; align-items: center; gap: var(--sp-4); padding: 0 var(--sp-4);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.mark { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font-size: 15px; letter-spacing: -0.01em; }
.mark b { font-weight: 600; }
.mark span { font-weight: 400; color: var(--text-2); }
.mark i { width: 20px; height: 20px; border-radius: 6px; background: var(--accent); position: relative; flex: none;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25); }
.mark i::after { content: ''; position: absolute; left: 6px; top: 5px; width: 6px; height: 6px; border-radius: 50%;
  border: 2px solid #fff; }
.mark i::before { content: ''; position: absolute; left: 12px; top: 11px; width: 2px; height: 5px; background: #fff;
  transform: rotate(-45deg); border-radius: 1px; }
.top .search { position: relative; flex: 0 1 380px; margin-left: var(--sp-4); }
.top .search .icon { position: absolute; left: 10px; top: 10px; color: var(--text-3); pointer-events: none; }
.top .search .input { padding-left: 32px; padding-right: 32px; background: var(--surface); }
.top .search kbd { position: absolute; right: 9px; top: 9px; }
.top .spacer { flex: 1; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-caption); color: var(--text-3); white-space: nowrap; }
.sync .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.sync.stale .dot { background: var(--wait); box-shadow: 0 0 0 3px var(--wait-bg); }
.sync.never .dot { background: var(--text-3); box-shadow: none; }

/* ── Desk: list + workspace ── */
.desk { display: grid; grid-template-columns: var(--list-w) minmax(0, 1fr); height: calc(100dvh - var(--top-h)); }
.list-pane { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); min-height: 0; }
.list-tools { padding: var(--sp-3) var(--sp-3) var(--sp-2); display: grid; gap: var(--sp-2); border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; }
.tabs button { flex: none; height: 28px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer;
  font-size: var(--fs-ui); color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.tabs button .n { font-size: 11px; color: var(--text-3); }
.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tabs button.on .n { color: var(--accent); }
@media (hover: hover) { .tabs button:not(.on):hover { background: var(--surface-2); color: var(--text); } }
.list-tools .row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.list-tools .select { height: 28px; font-size: var(--fs-caption); background-position: calc(100% - 14px) 12px, calc(100% - 10px) 12px; }
.list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.list-foot { padding: var(--sp-2) var(--sp-3); font-size: var(--fs-caption); color: var(--text-3); border-top: 1px solid var(--line); }

.item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px var(--sp-3); width: 100%; text-align: left;
  padding: 11px var(--sp-4) 12px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer;
  position: relative; transition: background-color 120ms; }
@media (hover: hover) { .item:hover { background: var(--surface-2); } }
.item.on { background: var(--accent-soft); }
.item.on .name { color: var(--accent); }
.item .name { font-weight: 600; font-size: var(--fs-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { grid-column: 1; font-size: var(--fs-caption); color: var(--text-3); display: flex; gap: 6px; align-items: center;
  overflow: hidden; white-space: nowrap; }
.item .sub .sep { color: var(--line-strong); }
.item .meta { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.item .reach { margin-left: auto; display: inline-flex; gap: 6px; color: var(--text-3); align-items: center; font-size: 11px; }
.item .reach .on { color: var(--accent); }
.item.dq { opacity: 0.6; }
.rating { font: 500 var(--fs-caption)/1 var(--mono); color: var(--text-2); }

/* ── Workspace ── */
.work { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }
.work-inner { max-width: 1240px; margin: 0 auto; padding: var(--sp-5) var(--sp-6) var(--sp-7); }
.lead-head { display: flex; align-items: flex-start; gap: var(--sp-4); flex-wrap: wrap; padding-bottom: var(--sp-4); }
.lead-head .grow { flex: 1; min-width: 260px; }
.lead-head h1 { font-size: var(--fs-h1); line-height: 1.2; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }
.lead-head .sub { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; margin-top: 6px; color: var(--text-2); font-size: var(--fs-ui); }
.lead-head .sub a { display: inline-flex; align-items: center; gap: 4px; }
.flag { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--text-3); }
.lead-actions { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.why { margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface);
  box-shadow: var(--shadow-border); font-size: var(--fs-ui); color: var(--text-2); display: grid; gap: 3px; }
.why b { color: var(--text); font-weight: 500; }
.excluded { margin-top: var(--sp-2); font-size: var(--fs-ui); color: var(--bad); }

.cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: var(--sp-5); align-items: start; margin-top: var(--sp-4); }
.stack { display: grid; gap: var(--sp-5); min-width: 0; }
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border); padding: var(--sp-4) var(--sp-4) var(--sp-4); min-width: 0; }
.panel > h2 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.panel > h2 .hint { font-size: var(--fs-caption); font-weight: 400; color: var(--text-3); margin-left: auto; text-align: right; }
.empty-line { color: var(--text-3); font-size: var(--fs-ui); }

/* People */
.person { display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) 0; }
.person + .person { border-top: 1px solid var(--line); }
.person .txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2); font-size: var(--fs-caption); font-weight: 600; }
.person.main .avatar { background: var(--accent-soft); color: var(--accent); }
.person .who { font-weight: 600; display: flex; gap: 4px var(--sp-2); align-items: baseline; flex-wrap: wrap; }
.person .who .title { font-weight: 400; color: var(--text-2); font-size: var(--fs-ui); }
.person .line2 { font-size: var(--fs-caption); line-height: 1.45; color: var(--text-3); max-height: 2.9em; overflow: hidden; }
.person .li { flex: none; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--r-xs); font-size: 11px;
  background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line); }
.li-btn { color: #0A66C2; }
@media (prefers-color-scheme: dark) { .li-btn { color: #70B5F9; } }

/* Messages: each block copies on click */
.msgs { display: grid; gap: var(--sp-3); margin-top: var(--sp-2); }
.msg { border-radius: var(--r-md); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden;
  transition: box-shadow 160ms; }
.msg-head { display: flex; align-items: center; gap: var(--sp-2); padding: 10px var(--sp-3) 0; font-size: var(--fs-ui); }
.msg-head .ch { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.msg-head .count { font-size: 11px; color: var(--text-3); font-family: var(--mono); }
.msg-head .count.over { color: var(--bad); font-weight: 600; }
.msg-head .status { margin-left: auto; }
.st-copied { color: var(--active); background: var(--active-bg); border-color: var(--active-line); }
.st-drafted { color: var(--note); background: var(--note-bg); border-color: var(--note-line); }
.st-sent { color: var(--good); background: var(--good-bg); border-color: var(--good-line); }
.st-discarded { color: var(--text-3); text-decoration: line-through; }
.st-review { color: var(--wait); background: var(--wait-bg); border-color: var(--wait-line); }
.copy-area { position: relative; display: block; width: 100%; text-align: left; border: 0; background: none; cursor: copy;
  padding: var(--sp-2) var(--sp-3) var(--sp-3); }
.copy-area .subject { font-weight: 600; margin-bottom: 6px; }
.copy-area .subject .k { color: var(--text-3); font-weight: 400; }
.copy-area .to { font-size: var(--fs-caption); color: var(--text-3); margin-bottom: 4px; }
.copy-area pre { font-family: var(--sans); font-size: var(--fs-body); line-height: 1.6; white-space: pre-wrap; word-break: break-word; max-width: 72ch; }
.msg-head .cue + .status { margin-left: 0; }
.msg-head .cue { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; font-weight: 500; color: var(--text-2); background: var(--surface);
  box-shadow: var(--btn-shadow); opacity: 0; transform: translateY(2px); transition: opacity 150ms, transform 150ms var(--ease-out); pointer-events: none; }
@media (hover: none) { .msg:not(.flash) .msg-head .cue { display: none; } }
@media (hover: hover) {
  .msg:hover { box-shadow: inset 0 0 0 1px var(--accent-line); }
  .msg:has(.copy-area:hover) .cue { opacity: 1; transform: none; }
}
.msg:has(.copy-area:focus-visible) .cue { opacity: 1; transform: none; }
.msg.flash { box-shadow: inset 0 0 0 1.5px var(--good); }
.msg.flash .cue { opacity: 1; transform: none; color: var(--good); background: var(--good-bg); box-shadow: inset 0 0 0 1px var(--good-line); }
.msg-foot { display: flex; align-items: center; gap: 2px; padding: 4px var(--sp-2) var(--sp-2); border-top: 1px dashed var(--line); }
.msg-foot .grow { flex: 1; }
.msg.discarded .copy-area { opacity: 0.55; }
.msg-edit { padding: var(--sp-2) var(--sp-3) var(--sp-3); display: grid; gap: var(--sp-2); }
.msg.email { box-shadow: inset 0 0 0 1px var(--line), 0 1px 0 var(--line); }
.msg.email .copy-area { cursor: pointer; }

/* Popover menu (email: copy or save as draft) */
.menu { position: fixed; z-index: 300; min-width: 260px; padding: 6px; border-radius: var(--r-md); background: var(--surface);
  box-shadow: var(--shadow-pop); display: grid; gap: 2px; transform-origin: top left; animation: pop 160ms var(--ease-out); }
.menu button { display: grid; grid-template-columns: 18px 1fr; gap: 2px 10px; align-items: center; text-align: left; padding: 8px 10px;
  border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; font-size: var(--fs-ui); }
.menu button small { grid-column: 2; color: var(--text-3); font-size: 11px; }
.menu button:disabled { opacity: 0.5; cursor: not-allowed; }
@media (hover: hover) { .menu button:hover:not(:disabled) { background: var(--surface-2); } }
.menu button:focus-visible { outline: none; background: var(--accent-soft); }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(-4px); } }

/* Score: 0-10 as one row of buttons, quicker than a slider */
.score { display: grid; gap: 6px; margin-bottom: var(--sp-3); }
.score .lbl { display: flex; justify-content: space-between; font-size: var(--fs-ui); color: var(--text-2); }
.score .lbl output { font: 600 var(--fs-ui)/1 var(--mono); color: var(--text); }
.scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; }
.scale button { height: 28px; border: 0; border-radius: 5px; background: var(--surface-2); color: var(--text-2); cursor: pointer;
  font: 500 var(--fs-caption)/1 var(--mono); transition: background-color 120ms, color 120ms; }
@media (hover: hover) { .scale button:hover { background: var(--surface-3); color: var(--text); } }
.scale button.in { background: var(--accent-soft); color: var(--accent); }
.scale button.on { background: var(--accent); color: var(--accent-text); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin: var(--sp-2) 0 var(--sp-3); }
.tags button { height: 26px; padding: 0 10px; border: 0; border-radius: 999px; cursor: pointer; font-size: var(--fs-caption);
  background: var(--surface); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-strong); transition: background-color 120ms, color 120ms; }
.tags button.on { background: var(--text); color: var(--bg); box-shadow: none; }
.row-end { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-3); align-items: center; }
.saved { font-size: var(--fs-caption); color: var(--text-3); margin-right: auto; }

/* Problems */
.problem { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px var(--sp-2); padding: 10px 0; }
.problem + .problem { border-top: 1px solid var(--line); }
.problem .t { font-weight: 500; }
.problem .e { grid-column: 2; font-size: var(--fs-caption); color: var(--text-2); word-break: break-word; }

/* Facts */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-4); }
.facts .k { font-size: 11px; color: var(--text-3); }
.facts .v { font-size: var(--fs-ui); word-break: break-word; }

/* Timeline */
.tl { display: grid; gap: 8px; }
.tl div { display: grid; grid-template-columns: 76px 1fr; gap: var(--sp-2); font-size: var(--fs-ui); }
.tl .when { color: var(--text-3); font-size: var(--fs-caption); }

details.signals summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; }
details.signals summary::-webkit-details-marker { display: none; }
details.signals summary .icon { transition: transform 150ms var(--ease-out); }
details.signals[open] summary .icon { transform: rotate(90deg); }
details.signals table { width: 100%; border-collapse: collapse; margin-top: var(--sp-3); font-size: var(--fs-caption); }
details.signals td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
details.signals td:first-child { color: var(--text-3); width: 38%; padding-right: var(--sp-3); }

/* Inline panel (reject, won) */
.inline { margin-top: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-pop); animation: pop 160ms var(--ease-out); }
.inline h3 { font-size: var(--fs-body); font-weight: 600; margin-bottom: 4px; }
.inline p { font-size: var(--fs-ui); color: var(--text-2); }

/* Empty / welcome */
.blank { height: 100%; display: grid; place-items: center; padding: var(--sp-6); }
.blank .box { max-width: 420px; text-align: center; display: grid; gap: var(--sp-2); justify-items: center; }
.blank .box h2 { font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.015em; }
.blank .box p { color: var(--text-2); }
.keys { display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: center; margin-top: var(--sp-3); font-size: var(--fs-caption); color: var(--text-3); }
.keys span { display: inline-flex; gap: 5px; align-items: center; }

/* Skeleton */
.skel { padding: var(--sp-4); display: grid; gap: 14px; }
.skel i { display: block; height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skel i:nth-child(3n) { width: 60%; } .skel i:nth-child(3n+1) { width: 85%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Toast */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 400; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: var(--fs-ui); box-shadow: var(--shadow-pop); animation: toast 220ms var(--ease-out); max-width: min(560px, 92vw); }
.toast.error { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 200ms, transform 200ms; }
@keyframes toast { from { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ── Auth & account pages ── */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: var(--sp-5) var(--sp-4); }
.auth-card { width: min(380px, 100%); display: grid; gap: var(--sp-5); }
.auth-card .mark { justify-self: start; }
.auth-card h1 { font-size: var(--fs-h2); font-weight: 600; letter-spacing: -0.015em; }
.auth-card p.lead { color: var(--text-2); margin-top: 4px; }
.auth-card form { display: grid; gap: var(--sp-4); }
.code-input { font: 500 1.375rem/1 var(--mono); letter-spacing: 0.4em; text-align: center; height: 52px; }
.page { max-width: 760px; margin: 0 auto; padding: var(--sp-6) var(--sp-4) var(--sp-7); display: grid; gap: var(--sp-5); }
.page h1 { font-size: var(--fs-h1); font-weight: 600; letter-spacing: -0.02em; }
.page .panel form { display: grid; gap: var(--sp-3); max-width: 420px; }
.page .panel p { color: var(--text-2); font-size: var(--fs-ui); max-width: 65ch; }
.notice { padding: 10px 14px; border-radius: var(--r-md); background: var(--good-bg); color: var(--good); box-shadow: inset 0 0 0 1px var(--good-line); font-size: var(--fs-ui); }
.notice.err { background: var(--bad-bg); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-line); }
.qr { display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; margin: var(--sp-3) 0; }
.qr .code { padding: 8px; background: #fff; border-radius: var(--r-md); box-shadow: var(--shadow-border); line-height: 0; }
.qr .code svg { width: 168px; height: 168px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 6px var(--sp-3); font-size: var(--fs-ui); }
.kv dt { color: var(--text-3); }

/* ── Responsive ── */
@media (max-width: 1180px) { .cols { grid-template-columns: minmax(0, 1fr); } .work-inner { padding: var(--sp-5) var(--sp-5) var(--sp-7); } }
@media (max-width: 860px) {
  :root { --list-w: 100%; }
  .desk { grid-template-columns: 1fr; }
  .desk.reading .list-pane { display: none; }
  .desk:not(.reading) .work { display: none; }
  .top .search { margin-left: 0; flex: 1; }
  .top .sync .txt, .top .hide-sm, .top .spacer, .mark span { display: none; }
  .msg-head { flex-wrap: wrap; }
  .panel > h2 { flex-wrap: wrap; }
  .panel > h2 .hint { margin-left: 0; text-align: left; flex-basis: 100%; }
  .work-inner { padding: var(--sp-4) var(--sp-4) var(--sp-7); }
  .lead-head h1 { font-size: var(--fs-h2); }
  .facts { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .back { display: inline-flex !important; }
}
.back { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; } }
