/* Design system: neutral shadcn-like tokens, layout modeled on Leadspicker (see docs/v1/ui-spec.md). */
@font-face { font-family: Geist; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/public/fonts/geist-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Geist; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/public/fonts/geist-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f5f5f5; --chrome: #e9e9e9; --surface: #fff; --fg: #0a0a0a; --ink: #171a25; --muted: #737373; --muted-2: #525866;
  --line: #e5e5e5; --line-strong: #c4cbcd; --ring: #a3a3a3; --nav-ink: #180e32;
  --primary: #171717; --primary-hover: #2e2e2e; --primary-fg: #fafafa; --secondary: #f5f5f5;
  --danger: #dc2626; --danger-soft: #fdecec;
  --warn: #f59e0b; --warn-soft: #fef3c7; --warn-strong: #92400e;
  --ok: #10b981; --ok-soft: #ecfdf5; --ok-strong: #065f46; --ok-line: #a7f3d0;
  --info: #2563eb; --info-soft: #eff6ff; --info-strong: #1e40af;
  --s-positive: #0bbb9b; --s-maybe: #f9b33c; --s-not: #ea981c; --s-negative: #fb4b6b; --s-neutral: #8a94a6;
  --shadow-xs: 0 1px 1px rgba(0,0,0,.05); --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
  --r: 8px; --r-lg: 10px; --side: 256px; --bar: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 13px/1.45 Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: inherit; }
h1 { font-size: 20px; font-weight: 600; color: var(--fg); margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; color: var(--fg); margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
h4 { font-size: 12px; font-weight: 600; margin: 12px 0 6px; }
.muted { color: var(--muted); }
.icon { display: inline-block; flex: none; vertical-align: -2px; }
code, pre, .mono { font-family: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.sidebar { background: var(--chrome); padding: 6px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 6px; font-weight: 700; font-size: 15px; color: var(--fg); text-decoration: none; letter-spacing: -.02em; }
.sidebar .brand .logo { width: 22px; height: 22px; border-radius: 6px; background: var(--primary); color: var(--primary-fg); display: grid; place-items: center; font-size: 12px; }
.user-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 9px; display: flex; align-items: center; gap: 9px; }
.user-card .name { font-size: 12px; font-weight: 600; color: var(--fg); }
.user-card .plan { font-size: 12px; color: var(--muted); }
.nav { display: grid; gap: 2px; }
.nav .group-label { font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 6px 2px; }
.nav a, .nav button { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border-radius: var(--r); font-family: inherit; font-size: 12px; font-weight: 400; line-height: 1; color: var(--nav-ink); text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.nav a:hover, .nav button:hover { background: rgba(0,0,0,.05); }
.nav a.active { background: var(--surface); font-weight: 500; box-shadow: var(--shadow-xs); }
.nav .count { margin-left: auto; font-size: 11px; font-weight: 600; background: var(--primary); color: var(--primary-fg); border-radius: 999px; padding: 2px 6px; }
.sidebar .bottom { margin-top: auto; }
.main { min-width: 0; display: flex; flex-direction: column; }
.tabsbar { height: var(--bar); background: var(--chrome); display: flex; align-items: flex-end; gap: 4px; padding: 0 12px 0 0; position: sticky; top: 0; z-index: 20; }
.tabsbar .tab { height: 39px; display: flex; align-items: center; gap: 6px; padding: 0 16px; background: var(--bg); border-radius: 15px 15px 0 0; font-size: 12px; font-weight: 600; color: var(--fg); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabsbar .right { margin-left: auto; align-self: center; display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
main { padding: 0 18px 48px; flex: 1; }
.flash { margin: 12px 0 0; padding: 9px 12px; border-radius: var(--r); border: 1px solid var(--ok-line); background: var(--ok-soft); color: var(--ok-strong); font-size: 12px; font-weight: 500; }
.flash.error { background: var(--danger-soft); border-color: #f5b5b5; color: var(--danger); }
.flash.warn { background: var(--warn-soft); border-color: #f3d48a; color: var(--warn-strong); }

/* ---------- Page head & toolbar ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 0 0; }
.page-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.page-head .title { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 9px 0; }
.toolbar .spacer { flex: 1; }
.toolbar .count { font-size: 13px; font-weight: 600; color: var(--muted-2); }
/* Filters in a toolbar: LP shows no field labels there; keep them for screen readers. */
.toolbar .field { margin: 0; }
.toolbar .field .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.search { position: relative; display: inline-flex; align-items: center; margin: 0; }
.search input { height: 40px; width: min(400px, 70vw); padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font: inherit; font-size: 12px; color: var(--fg); }
.search .icon { position: absolute; right: 12px; color: var(--muted); pointer-events: none; }
.search input:focus { outline: 2px solid var(--ring); outline-offset: -1px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 12px; border-radius: var(--r); border: 1px solid transparent; font-family: inherit; font-size: 12px; font-weight: 500; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-xs); }
.btn.sm { height: 27px; padding: 0 10px; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.sm.icon-only { width: 27px; }
.btn.primary { background: var(--primary); color: var(--primary-fg); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.secondary { background: var(--surface); color: var(--fg); border-color: var(--line); }
.btn.secondary:hover { background: var(--bg); }
.btn.ghost { background: transparent; box-shadow: none; color: var(--fg); }
.btn.ghost:hover { background: rgba(0,0,0,.05); }
.btn.danger { background: var(--surface); color: var(--danger); border-color: var(--line); }
.btn.danger:hover { background: var(--danger-soft); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
button.link { background: none; border: 0; padding: 0; color: var(--fg); text-decoration: underline; cursor: pointer; font: inherit; }
form.inline { display: inline-flex; margin: 0; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 15px 18px; margin: 12px 0; }
.card > h2:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.login { max-width: 380px; margin: 12vh auto; display: grid; gap: 12px; padding: 24px; }
.login h1 { margin-bottom: 4px; }
.notice { background: var(--warn-soft); border: 1px solid #f3d48a; color: var(--warn-strong); border-radius: var(--r-lg); padding: 9px 12px; font-size: 12px; }
.info-banner { display: flex; gap: 8px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 12px; font-size: 12px; }
.alert { background: var(--warn-soft); border: 1px solid var(--warn-strong); color: var(--warn-strong); border-radius: var(--r-lg); padding: 9px 12px; font-size: 12px; }
.alert.bad { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 5px; margin: 0 0 12px; min-width: 0; border: 0; padding: 0; }
.field .label, .field legend { font-size: 12px; font-weight: 600; color: var(--fg); padding: 0; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, .input {
  font: inherit; font-size: 12px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--fg); width: 100%; }
.field textarea { height: auto; padding: 9px 10px; line-height: 1.5; resize: vertical; border-radius: var(--r-lg); }
.field textarea.code, textarea.code { font-family: "Geist Mono", ui-monospace, Consolas, monospace; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid var(--ring); outline-offset: -1px; }
.field .hint { color: var(--muted-2); font-size: 12px; }
.field .error { color: var(--danger); font-size: 12px; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.form-grid, .grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; align-items: start; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 6px; align-items: center; grid-column: 1 / -1; padding-top: 4px; }
.check-list { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer; }
input[type=checkbox] { width: 16px; height: 16px; border-radius: 4px; accent-color: var(--primary); margin: 0; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chip-btn { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 12px; font-weight: 500; color: var(--fg); cursor: pointer; }

/* Card toggle (switch) */
.toggle-card { display: flex; align-items: flex-start; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; cursor: pointer; }
.toggle-card .t-label { font-size: 12px; font-weight: 500; color: var(--fg); }
.toggle-card .t-desc { font-size: 12px; color: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 24px !important; height: 16px !important; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; margin: 2px 0 0; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-xs); transition: transform .15s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(8px); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 12px; }
th { font-weight: 500; color: var(--fg); background: var(--surface); padding-top: 12px; padding-bottom: 12px; white-space: nowrap; }
.table-wrap.soft th { background: var(--bg); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafafa; }
tr[data-href] { cursor: pointer; }
td .name, td.name { font-weight: 500; color: var(--fg); }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
td.check, th.check { width: 40px; padding-right: 0; }
td.menu-cell, th.menu-cell { width: 1%; white-space: nowrap; text-align: right; position: sticky; right: 0; background: inherit; }
td.menu-cell .row { flex-wrap: nowrap; justify-content: flex-end; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash { color: var(--muted); }
.empty { color: var(--muted); padding: 32px 16px; text-align: center; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); font-size: 12px; }
/* Dense spreadsheet grid (lists, leads) */
.grid-table th { background: var(--bg); padding: 8px 6px; font-weight: 500; }
.grid-table td { padding: 6px; height: 43px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-table td.rownum, .grid-table th.rownum { width: 44px; color: var(--muted); text-align: center; }
.src-chip { display: inline-block; font-size: 10px; background: rgba(0,0,0,.04); border-radius: 4px; padding: 1px 5px; color: var(--muted-2); font-weight: 500; margin-left: 4px; }
.cell-input { width: 100%; min-width: 120px; height: 28px; border: 1px solid transparent; background: transparent; font: inherit; font-size: 12px; padding: 0 6px; border-radius: 6px; }
.cell-input:hover { border-color: var(--line); }
.cell-input:focus { border-color: var(--ring); background: var(--surface); outline: 0; }

/* ---------- Pills / badges ---------- */
.pill, .badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 1.2; white-space: nowrap; background: var(--secondary); color: var(--muted); border: 1px solid transparent; }
.pill.sm, .badge.sm { padding: 2px 6px; gap: 4px; }
.pill.ok, .badge.good { background: var(--surface); border-color: var(--line); color: var(--ok-strong); }
.pill.info { background: var(--info-soft); color: var(--info-strong); }
.pill.muted, .badge.neutral { background: var(--secondary); color: var(--muted); }
.pill.warn, .badge.warn { background: var(--warn-soft); color: var(--warn-strong); }
.pill.bad, .badge.bad { background: var(--danger-soft); color: var(--danger); }
.pill.dark { background: var(--primary); color: var(--primary-fg); }
.acct { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: var(--r-lg); background: var(--secondary); font-size: 11px; color: var(--fg); white-space: nowrap; }
/* Reply sentiment (solid) */
.sentiment { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 16px; font-size: 12px; font-weight: 500; color: #fff; background: var(--s-neutral); white-space: nowrap; }
.sentiment.positive { background: var(--s-positive); }
.sentiment.maybe { background: var(--s-maybe); }
.sentiment.out_of_office { background: #8b9bb4; }
.sentiment.not_interested { background: var(--s-not); }
.sentiment.negative, .sentiment.removal_request, .sentiment.bounced { background: var(--s-negative); }
.sentiment.pending, .sentiment.unknown { background: var(--s-neutral); }
.unread { display: inline-flex; padding: 2px 8px; border-radius: 999px; background: rgba(247,196,24,.2); border: 1px solid rgba(247,196,24,.45); color: #6b4b00; font-size: 12px; font-weight: 700; }

/* Progress */
.progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress .bar { width: 56px; height: 6px; border-radius: 999px; background: var(--secondary); overflow: hidden; }
.progress .bar > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* Avatar */
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--secondary); color: var(--fg); display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex: none; border: 1px solid var(--line); }
.avatar.lg { width: 40px; height: 40px; font-size: 13px; }
.who { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Segmented control & tabs ---------- */
.segmented, nav.tabs { display: inline-flex; gap: 2px; background: var(--secondary); border: 1px solid var(--line); border-radius: var(--r); padding: 3px; flex-wrap: wrap; }
.segmented a, nav.tabs a { display: inline-flex; align-items: center; gap: 6px; height: 27px; padding: 0 12px; border-radius: 6px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.segmented a:hover, nav.tabs a:hover { color: var(--fg); }
.segmented a.active, nav.tabs a.active { background: var(--surface); color: var(--fg); box-shadow: var(--shadow-sm); }
nav.tabs { margin: 12px 0 0; }

/* ---------- Dropdown menu (details/summary) ---------- */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-width: 31px; height: 24px; padding: 0 6px; border-radius: 6px; background: var(--secondary); color: var(--fg); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > .menu-body { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 4px; display: grid; text-align: left; }
details.menu.left > .menu-body { right: auto; left: 0; }
.menu-body a, .menu-body button, .menu-body .btn { display: flex; justify-content: flex-start; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: none; border-radius: 6px; font: inherit; font-size: 12px; color: var(--fg); text-decoration: none; cursor: pointer; text-align: left; box-shadow: none; height: auto; }
.menu-body a:hover, .menu-body button:hover, .menu-body .btn:hover { background: var(--secondary); }
.menu-body .danger, .menu-body button.danger, .menu-body .btn.danger { color: var(--danger); }
.menu-body form { margin: 0; display: block; }
.menu-body .btn { border: 0; background: none; box-shadow: none; color: var(--fg); }
.menu-body hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Drawer & modal (server-rendered; open when present, close link = overlay) ---------- */
.overlay { position: fixed; inset: 0; background: rgba(10,10,10,.25); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(630px, 100vw); background: var(--surface); border-left: 3px solid var(--line); box-shadow: var(--shadow-lg); z-index: 51; display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.drawer-body { padding: 12px 15px 18px; overflow-y: auto; flex: 1; }
.drawer-foot { display: flex; gap: 6px; align-items: center; padding: 12px 15px; border-top: 1px solid var(--line); }
.drawer-foot .spacer { flex: 1; }
.drawer .field .label, .drawer .field legend { font-size: 13px; }
.modal { position: fixed; top: 6vh; left: 50%; transform: translateX(-50%); width: min(900px, calc(100vw - 32px)); max-height: 88vh; overflow-y: auto; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 51; padding: 18px 20px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h2 { font-size: 16px; margin: 0; }
.modal h3 { font-size: 16px; margin: 16px 0 8px; }

/* ---------- Sequence flow ---------- */
.flow { background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: 24px 0 48px; }
.flow .edge { width: 1px; height: 28px; background: var(--line-strong); }
.flow .start { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 48px; padding: 8px 16px; font-size: 12px; font-weight: 700; color: var(--fg); }
.flow .node { width: 270px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 10px 12px; box-shadow: var(--shadow-sm); display: grid; gap: 8px; text-decoration: none; color: inherit; }
.flow a.node:hover { border-color: var(--fg); }
.flow .node.selected { outline: 2px solid var(--fg); outline-offset: 1px; }
.flow .node-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.flow .node-type { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; }
.flow .node-label { font-size: 12px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flow .node-meta { font-size: 11px; color: var(--muted); }
.flow .fix-chip { justify-self: start; background: #ffc0c5; color: #681219; border-radius: 6px; padding: 2px 6px; font-size: 12px; font-weight: 500; }
.flow .wait { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 5px 12px; font-size: 12px; font-weight: 500; }
.flow .add { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; border: 1px dashed var(--line-strong); background: var(--surface); color: var(--muted); }

/* ---------- Timeline (logs) ---------- */
.timeline { display: grid; gap: 0; }
.tl-day { font-size: 12px; font-weight: 700; color: var(--fg); padding: 12px 0 6px; }
.tl-item { display: grid; grid-template-columns: 34px 1fr; gap: 12px; position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; color: var(--fg); }
.tl-time { font-size: 12px; color: #677f98; }
.tl-text { font-size: 14px; color: var(--fg); }
.tl-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Indicators / tiles ---------- */
.indicators, .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 9px; }
.indicator, .tile { display: grid; gap: 6px; align-content: start; min-height: 98px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 500; }
.indicator .n, .tile .n { font-size: 24px; font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.indicator .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
a.indicator:hover, a.tile:hover { border-color: var(--ring); }
.indicator.alert, .tile.alert { border-color: var(--warn); background: #fffbeb; }

/* ---------- Message cards (lead messages, inbox detail) ---------- */
.msg-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 8px; margin-bottom: 9px; }
.msg-card .msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: var(--fg); }
.msg-card .msg-time { font-size: 12px; color: var(--muted); }
.msg-body { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; font-size: 12px; white-space: pre-wrap; }
.msg-body .msg-label { font-size: 11px; color: var(--muted); font-weight: 500; margin-bottom: 4px; white-space: normal; }
.msg-body .msg-subject { font-weight: 700; margin-bottom: 6px; white-space: normal; }
.state-chip { display: inline-flex; padding: 2px 8px; border-radius: var(--r); background: var(--secondary); font-size: 12px; font-weight: 500; color: var(--fg); }
.state-chip.bad { color: var(--danger); }
pre.mail { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; font: 12px/1.55 Geist, ui-sans-serif, system-ui, sans-serif; margin: 0; }

/* ---------- Pagination ---------- */
.pagination { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 0; color: var(--fg); font-size: 12px; }
.pagination .pages { font-weight: 500; }
.pagination .nav-btns { display: flex; gap: 4px; }
.pagination .nav-btns a, .pagination .nav-btns span { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--fg); }
.pagination .nav-btns span { color: var(--line-strong); }
.pagination .total { color: var(--muted); margin-right: auto; }

/* ---------- Misc ---------- */
.state-counts { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.state-counts strong { color: var(--fg); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--fg); }
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: 9px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; }
  .sidebar .user-card, .sidebar .nav .group-label { display: none; }
  .nav { display: flex; flex-wrap: nowrap; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented { flex-wrap: nowrap; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .segmented a { flex: none; }
  .nav a, .nav button { width: auto; }
  .sidebar .bottom { margin: 0; }
  .tabsbar { display: none; }
  main { padding: 0 16px 40px; }
  .split { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .search { flex: 1 1 100%; }
}

/* Sticky action column needs an opaque cell; header label is for screen readers only. */
td.menu-cell { background: var(--surface); }
tbody tr:hover td.menu-cell { background: #fafafa; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tenant-switch { display: grid; gap: 4px; }
.tenant-switch .group-label { font-size: 12px; font-weight: 500; color: var(--muted); padding: 0 6px; }
.tenant-switch select { height: 30px; font: inherit; font-size: 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); color: var(--fg); padding: 0 6px; }
