/* Hex CRM — shares the Ice design tokens with hectorherrera.me. Light default, dark via [data-mode]. */
@font-face { font-family: "Geist"; src: url(fonts/geist-var.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Bricolage"; src: url(fonts/bricolage-var.woff2) format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(fonts/geist-mono-var.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #F5F6F7; --bg-deep: #ECEEF0; --surface: #FFFFFF; --line: #E0E3E6; --line-2: #C5CACE;
  --text: #141516; --muted: #565B61; --accent: #0A67A3; --accent-ink: #FFFFFF;
  --ok: #1E7A45; --warn: #9A5B00; --bad: #B42318; --ok-bg: #E6F4EC; --warn-bg: #FFF3DC; --bad-bg: #FDECEA;
  --display: "Bricolage", system-ui, sans-serif; --body: "Geist", system-ui, sans-serif; --mono: "Geist Mono", ui-monospace, monospace;
  --radius: 10px; --bar: 60px;
}
:root[data-mode="dark"] {
  --bg: #161718; --bg-deep: #101112; --surface: #1E2022; --line: #303336; --line-2: #45494D;
  --text: #ECEEF0; --muted: #A3A8AD; --accent: #8FD3FF; --accent-ink: #0E1A22;
  --ok: #6FD39B; --warn: #F2B544; --bad: #FF8A80; --ok-bg: #16301F; --warn-bg: #33270C; --bad-bg: #3A1A17;
  color-scheme: dark;
}
.site-hexai    { --site: #5B6CFF; } .site-nexchron { --site: #1E88E5; } .site-hh { --site: #0A67A3; }
:root[data-mode="dark"] .site-hexai { --site: #9AA5FF; } :root[data-mode="dark"] .site-nexchron { --site: #7CC0FF; } :root[data-mode="dark"] .site-hh { --site: #8FD3FF; }

* { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15.5px/1.55 var(--body); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.5rem, 3vw, 1.9rem); } h2 { font-size: 1.15rem; margin-top: 1.4em; } h3 { font-size: 1rem; margin-top: 1.1em; }
a { color: var(--accent); text-underline-offset: 3px; }
p { margin: 0 0 .8em; }
code { font: .85em var(--mono); }
.muted { color: var(--muted); } .small { font-size: .85rem; } .wrap { overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -50px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 99; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 10px clamp(12px, 3vw, 28px);
  background: var(--bg-deep); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.05rem var(--display); color: var(--text); text-decoration: none; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.nav { display: flex; gap: 4px; }
.nav a, .tabbar a { color: var(--muted); text-decoration: none; font-weight: 500; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current] { color: var(--text); background: var(--surface); box-shadow: inset 0 -2px 0 var(--accent); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-right form { margin: 0; }
.whatsnew { font: 500 .78rem var(--mono); color: var(--muted); text-decoration: none; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; }
.whatsnew.has-new { color: var(--accent); border-color: var(--accent); }
.icon-btn { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--line-2);
  background: none; color: var(--text); cursor: pointer; }
.i-sun { display: none; } [data-mode="dark"] .i-sun { display: block; } [data-mode="dark"] .i-moon { display: none; }
.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 8px 4px; }
.link:hover { color: var(--text); }

.main { max-width: 1180px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) clamp(12px, 3vw, 28px) 100px; }
.narrow { max-width: 520px; margin: 0 auto; padding: 8vh 16px 60px; }
.auth.wide { max-width: 560px; }
.auth .brand { margin-bottom: 18px; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.back { margin-bottom: 10px; } .back a { text-decoration: none; font-weight: 500; }

/* Forms & buttons */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 500; }
input, textarea, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
input[type="checkbox"] { width: 18px; min-height: 18px; margin-right: 8px; }
label:has(input[type="checkbox"]) { display: flex; align-items: center; font-weight: 400; }
textarea { resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 600 .92rem var(--body); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.notice { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; font-weight: 500; }
.notice.ok { background: var(--ok-bg); color: var(--ok); } .notice.err { background: var(--bad-bg); color: var(--bad); }
.secret { font: 600 1.15rem var(--mono); letter-spacing: .06em; background: var(--surface); border: 1px dashed var(--line-2); border-radius: 8px; padding: 12px; overflow-wrap: anywhere; }
.codes { columns: 2; font: 600 1rem var(--mono); padding-left: 1.2em; }

/* Filters */
.search { flex: 1 1 280px; max-width: 420px; } .search input { min-height: 40px; }
.sites, .tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 10px; }
.sites a { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .9rem; }
.sites a[aria-current] { border-color: var(--accent); color: var(--text); background: var(--surface); }
.swatch { width: 9px; height: 9px; border-radius: 50%; background: var(--site); }
.tabs { border-bottom: 1px solid var(--line); margin-bottom: 0; }
.tabs a { white-space: nowrap; padding: 10px 10px; color: var(--muted); text-decoration: none; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; }
.tabs a[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.count { font: 500 .75rem var(--mono); background: var(--bg-deep); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }

/* List */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); }
.row a { display: grid; gap: 5px; padding: 14px 16px 14px 18px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; position: relative; }
.row:last-child a { border-bottom: 0; }
.row a:hover { background: var(--bg); }
.row.status-new .who { font-weight: 700; }
.row.is-priority a::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 2px; background: var(--site, var(--accent)); }
.row.is-priority { --site: #5B6CFF; } :root[data-mode="dark"] .row.is-priority { --site: #9AA5FF; }
.row-top { display: flex; justify-content: space-between; gap: 12px; }
.who { font-weight: 600; } .org { font-weight: 400; color: var(--muted); }
.when { font: 500 .8rem var(--mono); color: var(--muted); white-space: nowrap; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .85rem; margin: 0; }
.site-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.site-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--site); }
.topic { color: var(--muted); }
.sla { font: 600 .75rem var(--body); padding: 2px 8px; border-radius: 999px; }
.sla-late { background: var(--bad-bg); color: var(--bad); } .sla-soon { background: var(--warn-bg); color: var(--warn); }
.sla-fine { background: var(--bg-deep); color: var(--muted); } .sla-ok { background: var(--ok-bg); color: var(--ok); }
.badge-new { font: 700 .7rem var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.status-pill { font: 600 .75rem var(--body); padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); }
.snippet { color: var(--muted); font-size: .92rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.empty { background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); padding: 48px 20px; text-align: center; }

/* Conversation */
.conv { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.conv-head { margin-bottom: 14px; } .conv-head h1 { margin-top: 8px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.msg header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.msg .body { overflow-wrap: anywhere; }
.msg-out { border-left: 3px solid var(--accent); } .msg-auto { border-style: dashed; } .msg-auto .body { color: var(--muted); }
.reply { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0; }
.notes { margin-top: 24px; } .note { background: var(--warn-bg); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; } .note p:last-child { margin: 0; }
.side { display: grid; gap: 16px; position: sticky; top: 76px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.panel h2 { margin-top: 0; font-size: 1.02rem; } .panel h2 a { color: var(--text); }
.facts { margin: 0; } .facts > div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.facts > div:last-child { border-bottom: 0; } .facts dt { color: var(--muted); } .facts dd { margin: 0; overflow-wrap: anywhere; }
.snooze { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; } .snooze label { grid-column: 1 / -1; font-size: .9rem; }
.consents, .plain { padding-left: 1.1em; margin: 0; font-size: .9rem; } .plain li, .consents li { margin-bottom: 6px; }
.person { margin-bottom: 18px; } .person .row-meta { margin-top: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 4px 0 12px 16px; display: grid; gap: 2px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.t-when { font: 500 .78rem var(--mono); color: var(--muted); }
.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 600; min-height: 40px; display: flex; align-items: center; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .8rem; color: var(--muted); font-weight: 600; background: var(--bg-deep); }
.table tbody th { font-weight: 600; } .table .sub { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; }
.release ul { margin: 0; padding-left: 1.2em; } .inline p { margin: 0 0 10px; }
.empty-page { padding: 60px 0; text-align: center; }

/* Mobile */
.tabbar { display: none; }
@media (max-width: 860px) {
  .nav { display: none; }
  .top { gap: 10px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--bar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--bg-deep); border-top: 1px solid var(--line); }
  .tabbar a { flex: 1; display: flex; align-items: center; justify-content: center; border-radius: 0; }
  .tabbar a[aria-current] { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
  .conv { grid-template-columns: 1fr; } .side { position: static; order: -1; }
  .table thead { display: none; } .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 1px solid var(--line); padding: 8px 0; } .table th, .table td { border: 0; padding: 4px 12px; }
  .whatsnew { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── Phase 3 ─────────────────────────────────────────────────────────────── */
:root { --series: #0A67A3; } :root[data-mode="dark"] { --series: #3987E5; }   /* validated single-series mark color */
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--bad); color: #fff; font: 700 .7rem/18px var(--body); text-align: center; }
.kbd-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted); font: 500 .85rem var(--body); cursor: pointer; }
kbd { font: 600 .72rem var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--muted); }
.icon-link { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; color: var(--muted); }
.icon-link:hover, .icon-link[aria-current] { color: var(--text); background: var(--surface); }

.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 160px; }
.col header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; } .col h2 { margin: 0; font-size: .95rem; }
.col-empty { text-align: center; padding: 18px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.card.stalled { border-color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }
.card h3 { margin: 0 0 2px; font-size: .95rem; } .card h3 a { color: var(--text); text-decoration: none; } .card h3 a:hover { text-decoration: underline; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .8rem; color: var(--muted); margin: 6px 0; }
.move { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin-top: 6px; } .move select, .move .btn { min-height: 34px; padding: 4px 8px; font-size: .82rem; }
.stage-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }

.tasklist { list-style: none; margin: 0 0 10px; padding: 0; }
.tasklist li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tasklist li.done .t-title { color: var(--muted); text-decoration: line-through; }
.tasklist .inline { margin: 0; }
.check { width: 24px; height: 24px; border-radius: 6px; border: 2px solid var(--line-2); background: var(--surface); color: var(--ok); font-weight: 700; cursor: pointer; padding: 0; line-height: 1; }
.check:hover { border-color: var(--accent); }
.t-due { font: 500 .78rem var(--mono); color: var(--muted); white-space: nowrap; } .t-due.late { color: var(--bad); }
.taskadd { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; } .taskadd input, .taskadd select, .taskadd .btn { min-height: 40px; }
.taskgroup h2 { margin-top: 0; }

.scores { display: flex; gap: 18px; margin: 4px 0 8px; } .scores strong { font: 700 1.4rem var(--display); color: var(--text); margin-right: 4px; }

.fire { border-left: 4px solid var(--warn); } .fire h2 { margin-top: 0; } .ok-line { color: var(--ok); font-weight: 600; margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--text); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.big { font: 700 1.9rem/1.1 var(--display); letter-spacing: -0.02em; } .big .of { font-size: 1rem; color: var(--muted); font-weight: 500; }
.chart { margin: 0 0 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.bars { width: 100%; height: auto; display: block; }
.bars .axis { stroke: var(--line-2); stroke-width: 1; }
.bars .mark, .rowbar .mark { fill: var(--series); }
.bars .hit { fill: transparent; } .bars .bar:hover .mark { opacity: .8; }
.bars text { font: 500 13px var(--body); fill: var(--muted); text-anchor: middle; } .bars .val { fill: var(--text); font-weight: 600; }
.rowbar { width: 90px; height: 10px; display: inline-block; vertical-align: middle; background: var(--bg-deep); border-radius: 2px; margin-right: 6px; }
.rowbars td:nth-child(2) { white-space: nowrap; }

.palette { position: fixed; inset: 0; z-index: 100; background: rgba(10, 12, 14, .45); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-box { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; }
.palette-box input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; min-height: 54px; font-size: 1.05rem; padding: 0 16px; }
.palette-box input:focus { box-shadow: none; }
#pal-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
#pal-list li { display: grid; grid-template-columns: 96px 1fr; gap: 2px 10px; padding: 9px 10px; border-radius: 8px; cursor: pointer; }
#pal-list li[aria-selected] { background: var(--bg-deep); box-shadow: inset 3px 0 0 var(--accent); }
.pal-type { font: 600 .72rem var(--body); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); grid-row: span 2; align-self: center; }
.pal-sub { color: var(--muted); font-size: .82rem; } .pal-empty { color: var(--muted); padding: 12px; }
.pal-hint { padding: 8px 14px; margin: 0; border-top: 1px solid var(--line); }
.row > a:focus-visible { outline-offset: -3px; }

@media (max-width: 860px) {
  .kbd-btn kbd { display: none; } .kbd-btn { padding: 4px 8px; }
  .tabbar a { font-size: .78rem; padding: 0 2px; }
  .board { grid-auto-flow: row; grid-auto-columns: auto; }
  .stage-form, .taskadd { grid-template-columns: 1fr; }
}
details > summary { min-height: 28px; display: flex; align-items: center; cursor: pointer; }   /* WCAG 2.2 target size */
.settings-link { text-decoration: none; } .settings-link[aria-current] { color: var(--text); }
@media (max-width: 860px) { .settings-link { font-size: .85rem; } }
@media (max-width: 860px) { .col { min-height: 0; } .col-empty { padding: 4px 0 2px; text-align: left; } }

/* Efferent */
.draft-panel { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 14px 16px; margin: 18px 0 0; }
.draft-panel h2 { margin-top: 0; }
.draft-summary { background: var(--bg-deep); border-radius: 8px; padding: 8px 12px 8px 26px; list-style: disc; }
.notice.warn { background: var(--warn-bg); color: var(--warn); font-weight: 500; } .notice.warn ul { margin: 6px 0 0; color: var(--text); }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; vertical-align: -1px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 6px 0 10px; } .inline-form label { flex: 1 1 220px; }
