/* Reewamp CLM (design shared with Reewamp CRM): quiet monochrome UI. Ink-black primary, warm neutral surfaces, status colours only for status. */
:root {
  color-scheme: light;
  --bg: #fdfdfc; --side: #f7f7f5; --surface: #ffffff; --surface-2: #f3f3f1; --hover: #efefec;
  --border: #e8e8e4; --border-strong: #d9d9d4;
  --text: #111111; --text-2: #55554f; --muted: #8c8c85;
  --ink: #111111; --ink-ink: #ffffff;
  --accent: #2f6fe4; /* progress + focus only */
  --series-1: #111111; --series-2: #9a9a93; --grid: #ececE8;
  --good: #16863a; --good-soft: #e8f5ec; --warn: #9a6400; --warn-soft: #fcf3de;
  --bad: #c9342f; --bad-soft: #fbeaea; --info-soft: #f0f0ee;
  --radius: 10px; --radius-lg: 14px;
  --shadow-pop: 0 8px 30px rgba(0,0,0,.10), 0 1px 3px rgba(0,0,0,.06);
  /* select chevron: stroke matches --muted for each theme */
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238c8c85' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --ring: color-mix(in srgb, var(--accent) 22%, transparent);
  --control-h: 32px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141413; --side: #1a1a19; --surface: #1c1c1b; --surface-2: #242422; --hover: #2a2a28;
    --border: #2e2e2b; --border-strong: #3a3a37;
    --text: #f2f2ef; --text-2: #bdbdb6; --muted: #86867f;
    --ink: #f2f2ef; --ink-ink: #141413; --accent: #5b8ff0;
    --series-1: #f2f2ef; --series-2: #86867f; --grid: #2a2a28;
    --good: #4cc36d; --good-soft: #16291c; --warn: #eeb445; --warn-soft: #30270f;
    --bad: #f07470; --bad-soft: #351a19; --info-soft: #242422;
    --shadow-pop: 0 8px 30px rgba(0,0,0,.5);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%2386867f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413; --side: #1a1a19; --surface: #1c1c1b; --surface-2: #242422; --hover: #2a2a28;
  --border: #2e2e2b; --border-strong: #3a3a37;
  --text: #f2f2ef; --text-2: #bdbdb6; --muted: #86867f;
  --ink: #f2f2ef; --ink-ink: #141413; --accent: #5b8ff0;
  --series-1: #f2f2ef; --series-2: #86867f; --grid: #2a2a28;
  --good: #4cc36d; --good-soft: #16291c; --warn: #eeb445; --warn-soft: #30270f;
  --bad: #f07470; --bad-soft: #351a19; --info-soft: #242422;
  --shadow-pop: 0 8px 30px rgba(0,0,0,.5);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%2386867f' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; letter-spacing: -0.003em; }
a { color: inherit; text-decoration: none; }
.view a:not(.btn):not(.chip-btn):not(.nav-item) { color: var(--text); font-weight: 500; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .15s; }
.view a:not(.btn):not(.chip-btn):hover { text-decoration-color: currentColor; }
h1 { font-size: 22px; font-weight: 650; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
h3 { font-size: 12px; margin: 0 0 8px; color: var(--muted); font-weight: 500; }
.sub-h { color: var(--text-2); margin: 2px 0 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); font-size: 12px; }
.error { color: var(--bad); min-height: 1em; }
.mt { margin-top: 20px; }
.mb { margin-bottom: 20px; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ico { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.shell.collapsed { grid-template-columns: 0 1fr; }
.shell.collapsed .sidebar { visibility: hidden; }

/* Chat open: the panel docks on the right, the page makes room, and the sidebar becomes an icon rail (like Peec). */
.shell.chat-open, .shell.chat-open.collapsed { grid-template-columns: 60px 1fr; margin-right: var(--chat-w); }
.shell.chat-open .sidebar { visibility: visible; padding: 12px 8px; align-items: center; }
.shell.chat-open .side-top { justify-content: center; }
.shell.chat-open .ws-btn { flex: none; padding: 6px; }
.shell.chat-open .ws-btn #ws-name, .shell.chat-open .ws-btn .caret, .shell.chat-open #search-btn, .shell.chat-open .seg,
.shell.chat-open .nav-head, .shell.chat-open .lbl, .shell.chat-open .nav-item .count, .shell.chat-open .start-card,
.shell.chat-open #user-name, .shell.chat-open .user-row .caret, .shell.chat-open #agent-side { display: none; }
.shell.chat-open .nav { margin: 0; padding: 0; align-items: center; width: 100%; }
.shell.chat-open .nav-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); width: 100%; display: flex; flex-direction: column; align-items: center; }
.shell.chat-open .nav-group:first-child { border-top: 0; padding-top: 0; }
.shell.chat-open .nav-group.closed .nav-items { display: flex; }
.shell.chat-open .nav-items { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.shell.chat-open .nav-item { justify-content: center; padding: 8px; width: 40px; position: relative; }
.shell.chat-open .nav-item .dot { position: absolute; top: 6px; right: 6px; margin: 0; }
.shell.chat-open .side-foot { width: 100%; align-items: center; }
.shell.chat-open .user-row { padding: 6px; }
.shell.chat-open .menu.up { left: 0; right: auto; }
.shell.chat-open .side-top .menu { left: 0; right: auto; }
/* The rail is 60px wide: let the workspace and account menus open past its edge instead of being clipped. */
.shell.chat-open .sidebar { overflow: visible; }
.sidebar { background: var(--side); border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; height: 100vh; overflow: hidden; }
.side-top { display: flex; align-items: center; gap: 6px; position: relative; }
.ws-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font: inherit; font-weight: 650; font-size: 15px; color: var(--text); background: transparent; border: 0; border-radius: 8px; padding: 6px 8px; cursor: pointer; text-align: left; }
.ws-btn:hover { background: var(--hover); }
.ws-btn #ws-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--muted); display: inline-flex; }
.caret .ico { width: 12px; height: 12px; }
.logo-mark { width: 22px; height: 22px; color: var(--text); flex: none; display: block; }
.brand-lg .logo-mark { width: 28px; height: 28px; }
.logo { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: var(--ink-ink); font-weight: 800; font-size: 13px; flex: none; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.brand-lg { font-size: 18px; justify-content: center; margin-bottom: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--hover); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: 13.5px; border: 0; background: transparent; color: var(--muted); padding: 6px 0; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); font-weight: 550; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; margin: 0 -4px; padding: 0 4px; }
.nav-group { margin-top: 10px; }
.nav-group:first-child { margin-top: 4px; }
.nav-head { display: flex; align-items: center; gap: 6px; width: 100%; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; padding: 4px 8px; cursor: pointer; border-radius: 6px; }
.nav-head:hover { color: var(--text-2); }
.nav-head .ico { width: 10px; height: 10px; transition: transform .15s; fill: currentColor; stroke: none; }
.nav-group.closed .nav-head .ico { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }
.nav-item { display: flex; align-items: center; gap: 10px; color: var(--text); padding: 7px 10px; border-radius: 8px; font-size: 14.5px; }
.nav-item .ico { color: var(--text-2); }
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--hover); font-weight: 550; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-left: -2px; }
.nav-item .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-foot { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 8px; position: relative; }
.start-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.start-card:hover { border-color: var(--border-strong); }
.start-card b { font-weight: 600; }
.start-card .bar { height: 5px; border-radius: 3px; background: var(--hover); margin: 8px 0; overflow: hidden; }
.start-card .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.start-card .next { color: var(--text-2); font-size: 13px; }
.user-row { display: flex; align-items: center; gap: 8px; font: inherit; color: var(--text); background: transparent; border: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer; text-align: left; }
.user-row:hover { background: var(--hover); }
.avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--hover); color: var(--text-2); font-size: 10px; font-weight: 700; border: 1px solid var(--border); }
.menu { position: absolute; z-index: 45; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; min-width: 200px; }
.side-top .menu { top: 40px; left: 0; right: 0; }
.menu.up { bottom: 44px; left: 0; right: 0; }
.menu button, .menu a { display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; color: var(--text); background: none; border: 0; padding: 7px 10px; border-radius: 7px; cursor: pointer; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu .check { margin-left: auto; }
.agent-side { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.agent-side-list a { display: block; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-side-list a:hover, .agent-side-list a.active { background: var(--hover); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); background: var(--bg); position: sticky; top: 0; z-index: 20; min-height: 54px; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 15px; min-width: 0; }
.crumbs a { color: var(--text-2); }
.crumbs a:hover { color: var(--text); }
.crumbs .sepc { color: var(--muted); display: inline-flex; }
.crumbs .sepc .ico { width: 13px; height: 13px; }
.crumbs span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface-2); border: 0; padding: 6px 11px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.chip-btn:hover { background: var(--hover); }
.chip-btn.has { background: var(--warn-soft); color: var(--warn); }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; position: relative; }
.chip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; border-radius: 9px; cursor: pointer; white-space: nowrap; position: relative; }
.chip:hover { border-color: var(--border-strong); }
.chip .ico { color: var(--text-2); }
.chip.active { background: var(--ink); color: var(--ink-ink); border-color: var(--ink); }
.chip.active .ico { color: var(--ink-ink); }
.toolbar .spacer { flex: 1; }
.chip-wrap { position: relative; }
.chip-wrap .menu { top: 40px; left: 0; }
.view { padding: 24px 28px 40px; max-width: 1440px; width: 100%; }
.view.flush { padding: 0; max-width: none; }

/* ---------- controls ---------- */
/* Text inputs and picklists share one look: height, padding, border, radius and focus ring. */
input, select, textarea { font: inherit; font-size: 14px; line-height: 1.4; color: var(--text); background-color: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; min-width: 0; transition: border-color .12s, box-shadow .12s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: var(--control-h); padding-top: 0; padding-bottom: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-2); color: var(--muted); border-color: var(--border); cursor: not-allowed; box-shadow: none; }
/* picklists: native <select> (keyboard + mobile pickers stay native), custom chevron */
select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px 12px; }
select:disabled { opacity: .75; }
select:has(> option[value=""]:checked) { color: var(--muted); }
select option { color: var(--text); background-color: var(--surface); }
select[multiple] { height: auto; padding: 4px; background-image: none; }
input[type=checkbox], input[type=radio] { accent-color: var(--ink); width: 15px; height: 15px; margin: 0; flex: none; cursor: pointer; }
input[type=file] { padding: 6px 8px; }
textarea { width: 100%; min-height: 80px; resize: vertical; line-height: 1.5; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); min-width: 0; }
label > input[type=checkbox] { align-self: flex-start; margin: 10px 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 550; line-height: 1.4; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 12px; min-height: var(--control-h); border-radius: 9px; cursor: pointer; white-space: nowrap; }
.btn:focus-visible, .chip:focus-visible, .tabs button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-ink); }
.btn.primary:hover { opacity: .88; }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.small { padding: 0 9px; min-height: 28px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; flex-direction: row; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.spread > h1, .spread > h2, .spread > div > h1, .spread > div > h2 { margin: 0; }
.spread > div > h1 + p, .spread > div > h2 + p { margin: 4px 0 0; }
h1 > .muted.small, h2 > .muted.small { font-weight: 450; margin-left: 2px; font-variant-numeric: tabular-nums; letter-spacing: 0; }
/* checkbox + text on one line (filters, toolbars) */
label.check-inline { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 400; color: var(--text-2); white-space: nowrap; cursor: pointer; min-height: var(--control-h); }
label.check-inline > input[type=checkbox] { margin: 0; align-self: center; }
.page-intro { color: var(--text-2); font-size: 13px; max-width: 820px; margin: -6px 0 18px; line-height: 1.55; }
.grid { display: grid; gap: 16px; align-items: start; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* Card rows: every card as tall as the tallest in its row, so a row reads as one band (content stays at the top). */
.grid.g2, .grid.g3 { align-items: stretch; }
.g-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 16px; align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > .wide:not(label) { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* inline filter rows render as a toolbar above the table */
form#filters { background: none; border: 0; padding: 0; box-shadow: none; margin-bottom: 12px; gap: 8px; }
form#filters select { width: auto; min-width: 150px; max-width: 220px; }
form#filters input[name=q] { flex: 1 1 220px; max-width: 320px; }
form#filters + .card.mt { margin-top: 0; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; min-width: 0; }
.card > h2 { display: flex; align-items: center; gap: 6px; min-height: 28px; margin: 0 0 10px; }
.card > .spread { margin-bottom: 12px; }
.card > .spread:first-child, .card > .card-head:first-child { min-height: 28px; }
.card > p:last-child, .card > ul:last-child, .card > dl:last-child { margin-bottom: 0; }
.section { margin-top: 32px; }
.section > h2 { font-size: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 16px; overflow: hidden; }
.kpi { padding: 14px 18px; border-right: 1px solid var(--border); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .label { font-size: 13.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.kpi .label .ico { width: 13px; height: 13px; color: var(--muted); }
.kpi .value { font-size: 20px; font-weight: 550; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.kpi .delta { font-size: 13.5px; font-weight: 500; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); } .delta.flat { color: var(--muted); }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* hero composer (overview) */
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 16px 40px; }
.hero .mark { display: grid; place-items: center; margin-bottom: 22px; }
.hero .mark .logo-mark { width: 44px; height: 44px; }
.hero h1 { font-size: 34px; line-height: 1.15; letter-spacing: -0.03em; max-width: 560px; }
.hero .composer { width: min(640px, 100%); margin-top: 28px; }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 14px; max-width: 680px; }
.suggest button { font: inherit; font-size: 13.5px; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); padding: 5px 11px; border-radius: 9px; cursor: pointer; }
.suggest button:hover { color: var(--text); border-color: var(--border-strong); }
.composer { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 8px 8px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.composer:focus-within { border-color: var(--border-strong); box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.composer textarea, .composer input { flex: 1; border: 0; padding: 6px 0; min-height: 0; resize: none; background: transparent; font-size: 15px; }
.composer textarea:focus, .composer input:focus { outline: none; }
.send-btn { width: 32px; height: 32px; border-radius: 9px; border: 0; background: var(--ink); color: var(--ink-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.send-btn:disabled { opacity: .35; cursor: default; }
.headline h1 { font-size: 24px; }
.headline p { color: var(--text-2); margin: 4px 0 18px; font-size: 15px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface); position: sticky; top: 0; white-space: nowrap; padding-top: 9px; padding-bottom: 9px; letter-spacing: .01em; }
th.num, td.num { text-align: right; }
th.actions { text-align: right; }
tbody tr { transition: background-color .1s; }
tbody tr:hover { background: var(--hover); }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn + .btn { margin-left: 4px; }
td .small, td .muted.small { line-height: 1.45; }
td > .muted.small, td > .small { margin-top: 1px; }
td.nowrap, th.nowrap, .nowrap { white-space: nowrap; }
td.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
td.empty b { display: block; color: var(--text-2); font-weight: 550; margin-bottom: 2px; }
/* tables in a card run edge to edge; headings and toolbars keep the card gutter */
.card.table-wrap { padding: 14px 0 4px; }
.card.table-wrap > :not(table) { margin-left: 20px; margin-right: 20px; }
.card.table-wrap > table:first-child { margin-top: -6px; }
.card.table-wrap > h2 + table, .card.table-wrap > .spread + table { margin-top: 2px; }
.card.table-wrap > table th:first-child, .card.table-wrap > table td:first-child { padding-left: 20px; }
.card.table-wrap > table th:last-child, .card.table-wrap > table td:last-child { padding-right: 20px; }
/* name cell: small avatar + two lines */
.cell-id { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.cell-id > .avatar { width: 26px; height: 26px; font-size: 10.5px; margin-top: 1px; flex: none; }
.cell-id > .avatar.square { border-radius: 7px; }
.cell-id > div { min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 18px; vertical-align: 1px; font-weight: 500; background: var(--surface-2); color: var(--text-2); white-space: nowrap; border: 1px solid var(--border); }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--text); }
.pill.dotted::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }

/* ---------- kanban ---------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--surface-2); border-radius: var(--radius-lg); padding: 10px; min-height: 200px; }
.col.drop { outline: 2px dashed var(--border-strong); }
.col-head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 550; color: var(--text-2); margin: 2px 4px 10px; }
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.deal-card:hover { border-color: var(--border-strong); }
.deal-card .t { font-weight: 550; }
.deal-card .m { font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }

.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.step { font: inherit; border: 1px solid var(--border); border-radius: 9px; padding: 6px 11px; font-size: 13px; background: var(--surface); color: var(--text); cursor: pointer; }
.step:hover { border-color: var(--border-strong); }
.step.current { background: var(--ink); border-color: var(--ink); color: var(--ink-ink); font-weight: 550; }
.step .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; background: var(--good); }
.step.blocked .dot { background: var(--bad); }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 5px 0; display: flex; gap: 10px; align-items: baseline; }
.checklist .sev { font-size: 11px; font-weight: 700; min-width: 64px; letter-spacing: .02em; }
.sev.blocker { color: var(--bad); } .sev.warn { color: var(--warn); } .sev.info { color: var(--muted); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--border); line-height: 1.5; }
.feed li:first-child { padding-top: 4px; }
.feed li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 9px 14px; font-size: 13.5px; margin: 0; align-items: baseline; }
.kv dt { color: var(--muted); font-size: 13px; line-height: 1.5; } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; line-height: 1.5; }
.kv dd .muted.small { margin-left: 4px; }

/* ---------- charts ---------- */
.chart-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px 0; flex-wrap: wrap; }
.chart-head h2 { margin: 0; }
.chart-empty { margin: 0; padding: 12px 20px 20px; }
@media (max-width: 640px) { .chart-head { padding: 16px 16px 0; } .chart-empty { padding: 10px 16px 16px; } }
.chart-foot { border-top: 1px solid var(--border); padding: 10px 16px; font-size: 13.5px; color: var(--text-2); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mtabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; flex-wrap: wrap; }
.mtabs button { font: inherit; font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: var(--text-2); padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.mtabs button.on { background: var(--surface); color: var(--text); font-weight: 550; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chart { position: relative; padding: 6px 12px 4px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis-label { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--series-1); opacity: .05; }
.chart .pt { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .xhair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2.5; }
.chart .bar { fill: var(--series-1); }
.chart .bar-hit { fill: transparent; }
.chart .val-label { fill: var(--text-2); font-size: 12px; font-weight: 600; }
.chart .bar.past { fill: var(--series-2); }
.chart .bar.renew { fill: var(--accent); opacity: .55; }
.chart .bar.risk { fill: var(--warn); opacity: .6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--series-1); display: inline-block; }
.legend .sw.past { background: var(--series-2); } .legend .sw.renew { background: var(--accent); opacity: .55; } .legend .sw.risk { background: var(--warn); opacity: .6; }
.tabs.flat { margin-bottom: 0; }
tr.muted td { color: var(--muted); }
.meter { width: 100%; height: 6px; display: block; }
.meter .track { fill: var(--surface-2); }
.meter .fill { fill: var(--series-1); }
.meter .fill.hot { fill: var(--warn); } .meter .fill.over { fill: var(--bad); } .meter .fill.cold { fill: var(--muted); }
.tip { position: fixed; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border); box-shadow: var(--shadow-pop); padding: 7px 10px; border-radius: 8px; font-size: 12.5px; z-index: 60; white-space: nowrap; }

/* ---------- modal / toast / login ---------- */
.modal { position: fixed; inset: 0; background: rgba(10,10,10,.28); display: grid; place-items: start center; padding: 10vh 16px 16px; z-index: 50; }
.modal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; width: min(640px, 100%); max-height: 80vh; overflow: auto; position: relative; box-shadow: var(--shadow-pop); }
.modal-close { position: absolute; top: 12px; right: 12px; }
.palette input { width: 100%; font-size: 16px; padding: 10px 12px; }
.palette .results { margin-top: 10px; display: flex; flex-direction: column; }
.palette .results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; }
.palette .results a:hover, .palette .results a.sel { background: var(--hover); }
.palette .results .kind { margin-left: auto; font-size: 12px; color: var(--muted); }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--ink-ink); padding: 10px 16px; border-radius: 10px; z-index: 70; max-width: 90vw; box-shadow: var(--shadow-pop); }
.toast.bad { background: var(--bad); color: #fff; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.google-login { display: flex; flex-direction: column; gap: 10px; }
.google-btn.hidden { display: none; }
.google-btn { justify-content: center; padding: 9px 12px; }
.google-btn .g-mark { width: 18px; height: 18px; }
.google-login p { margin: 0; text-align: center; }

.tabs { display: flex; gap: 2px; background: var(--surface-2); padding: 3px; border-radius: 10px; margin-bottom: 18px; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.tabs button { font: inherit; font-size: 13.5px; background: none; border: 0; padding: 6px 12px; color: var(--text-2); cursor: pointer; border-radius: 8px; }
.tabs button.active { background: var(--surface); color: var(--text); font-weight: 550; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
pre.code, textarea.code { font-family: var(--mono); font-size: 12px; }
textarea.code { min-height: 420px; }

/* ---------- AI agent ---------- */
:root { --chat-w: 440px; }
.agent { position: fixed; top: 0; right: 0; bottom: 0; width: min(var(--chat-w), 100vw); background: var(--surface); border-left: 1px solid var(--border); z-index: 35; display: flex; flex-direction: column; }
.agent.inline { position: static; width: auto; box-shadow: none; border: 0; background: transparent; height: calc(100vh - 54px - 64px); max-width: 820px; margin: 0 auto; }
.agent.inline .agent-head { display: none; }
.agent-head { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.agent-head select { flex: 1; }
.agent-log { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; }
.bubble { padding: 9px 13px; border-radius: 14px; max-width: 88%; overflow-wrap: anywhere; line-height: 1.55; }
.bubble.user { align-self: flex-end; background: var(--surface-2); border: 1px solid var(--border); }
.bubble.assistant { align-self: flex-start; padding-left: 2px; }
.bubble.error { align-self: stretch; background: var(--bad-soft); color: var(--bad); }
.bubble p { margin: 0 0 6px; } .bubble p:last-child { margin: 0; } .bubble ul { margin: 4px 0; padding-left: 18px; }
.bubble code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.toolchip { align-self: flex-start; font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: baseline; }
.agent-pending { border-top: 1px solid var(--border); padding: 12px; background: var(--surface-2); max-height: 45vh; overflow-y: auto; }
.proposal { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; display: flex; flex-direction: row; gap: 9px; align-items: flex-start; color: var(--text); font-size: 13.5px; }
.proposal pre { margin: 4px 0 0; font-family: var(--mono); font-size: 11px; white-space: pre-wrap; color: var(--text-2); max-height: 120px; overflow: auto; }
.agent-form { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.agent-empty { margin: auto; text-align: center; color: var(--text-2); max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.agent-empty .mark { margin-bottom: 8px; }
.agent-empty .mark .logo-mark { width: 40px; height: 40px; }
.agent-empty h2 { color: var(--text); font-size: 20px; }
.agent-empty .suggest { margin-top: 14px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 13px; }
.ai-msg { display: flex; gap: 8px; align-items: flex-start; align-self: flex-start; max-width: 100%; }
.ai-msg .bubble.assistant { max-width: none; padding-top: 2px; }
.ai-msg.typing { align-items: center; }
.ai-avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); flex: none; }
.ai-avatar .logo-mark { width: 13px; height: 13px; }
.score { font-variant-numeric: tabular-nums; font-weight: 650; }

@media (max-width: 1280px) { :root { --chat-w: 380px; } }
@media (max-width: 900px) {
  .shell, .shell.collapsed, .shell.chat-open, .shell.chat-open.collapsed { grid-template-columns: 1fr; margin-right: 0; }
  .agent { width: 100vw; box-shadow: var(--shadow-pop); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; visibility: visible !important; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  .topbar, .toolbar { padding-left: 16px; padding-right: 16px; }
  .view { padding: 16px; }
  .g2, .g3, .g-side { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .kpi { border-bottom: 1px solid var(--border); }
  .hero h1 { font-size: 26px; }
  .top-actions .chip-btn span:not([data-icon]):not(#bell-n) { display: none; }
  #help-btn { display: none; }
}
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--surface-2); }
.fx-bar { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; margin: 4px 0 14px; }
.fx-bar:empty { display: none; }
.fx-item { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fx-form input { width: 110px; }

/* person picker */
.picker { position: relative; }
.picker-q { width: 100%; }
.picker-menu { top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow: auto; }
.picker-menu button > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.picker-menu .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-empty { padding: 8px 10px; }

/* dedup */
th.sel, td.sel { width: 28px; padding-right: 0; }
.dup-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dup-person + .dup-person { margin-top: 8px; }
label.check-row { display: flex; flex-direction: row; font-size: 13.5px; color: var(--text); gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.check-row > span { display: flex; flex-direction: column; gap: 2px; }
.check-row input { margin-top: 3px; }
.merge-table th[scope=row] { width: 140px; text-align: left; color: var(--muted); font-weight: 500; background: none; position: static; }
.merge-table thead th { vertical-align: top; text-align: left; min-width: 200px; }
.merge-table thead th.keep { background: var(--good-soft); }
.merge-table label.keep-pick { display: flex; flex-direction: row; color: var(--text); font-size: inherit; gap: 8px; align-items: flex-start; cursor: pointer; }
.merge-table .keep-pick > span { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.merge-table .block { display: block; }
.merge-table tr:not(.differs) td { color: var(--muted); }
.merge-table td.chosen { background: var(--hover); }
.merge-table label.pick { display: flex; flex-direction: row; color: inherit; font-size: inherit; gap: 8px; align-items: flex-start; cursor: pointer; word-break: break-word; }
.merge-table .pick input { margin-top: 3px; }
.merge-table [data-leave] { margin-top: 6px; }

/* record pages (people, companies): header, facts, tabs, history timeline */
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.record-head > .row { gap: 6px; }
.record-id > div { min-width: 0; }
.record-id > div > .muted { margin-top: 2px; }
.record-head h1 { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.record-id { display: flex; gap: 14px; align-items: center; min-width: 0; }
.record-avatar { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; flex: none; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-weight: 650; font-size: 16px; }
.record-avatar.square { border-radius: 12px; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 18px; padding: 0 0 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2); }
.fact > a, .fact > span:not(.pill) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fact { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.fact .ico { width: 14px; height: 14px; color: var(--muted); flex: none; }
.fact a { color: var(--text); }
.record-tabs { margin-bottom: 16px; }
.tab-count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 500; text-align: center; }
.tabs button.active .tab-count { background: var(--hover); }
.history-card { max-width: 860px; }
.tabs.tl-filter { margin-bottom: 16px; }
.timeline { position: relative; }
.tl-day { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 6px; }
.tl-day:first-child { margin-top: 0; }
.tl-item { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.tl-item::before { content: ''; position: absolute; left: 13px; top: 36px; bottom: -8px; width: 1px; background: var(--border); }
.tl-item:last-child::before, .tl-item:has(+ .tl-day)::before { display: none; }
.tl-dot { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; flex: none; font-size: 10.5px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); position: relative; z-index: 1; }
.tl-item.by-auto .tl-dot { color: var(--muted); }
.tl-dot .ico { width: 13px; height: 13px; }
.tl-body { min-width: 0; flex: 1; padding-top: 4px; }
.tl-head { font-size: 13.5px; }
.tl-changes { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.tl-changes li { display: grid; grid-template-columns: 150px 1fr; gap: 10px; font-size: 13px; }
.tl-field { color: var(--muted); }
.tl-old { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
.tl-old .pill { text-decoration: line-through; }
.tl-arrow { color: var(--muted); padding: 0 2px; }
.tl-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
@media (max-width: 640px) { .tl-changes li { grid-template-columns: 1fr; gap: 0; } .record-avatar { width: 40px; height: 40px; font-size: 14px; } }

/* record forms: read-only view with Edit, or auto-save */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; min-height: 28px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 6px; }
.card-actions { gap: 6px; flex-wrap: nowrap; }
.ro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px 16px; margin: 0; }
.ro-grid > div { min-width: 0; }
.ro-grid .wide { grid-column: 1 / -1; }
.ro-grid dt { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-bottom: 4px; line-height: 1.4; }
.ro-grid dd { margin: 0; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.save-state { white-space: nowrap; }

/* phones: no horizontal page scroll; tables scroll inside their card */
@media (max-width: 640px) {
  .hide-sm { display: none; }
  h1 { font-size: 20px; }
  .spread > .row { width: 100%; }
  form#filters select, form#filters input[name=q] { flex: 1 1 140px; max-width: none; min-width: 0; }
  .record-head > .row { width: 100%; }
  .record-head > .row .btn { flex: 1 1 auto; }
  .card { padding: 16px; }
  .card.table-wrap { padding: 12px 0 4px; }
  .card.table-wrap > :not(table) { margin-left: 16px; margin-right: 16px; }
  .card.table-wrap > table th:first-child, .card.table-wrap > table td:first-child { padding-left: 16px; }
  .card.table-wrap > table th:last-child, .card.table-wrap > table td:last-child { padding-right: 16px; }
  .ro-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .page-intro { margin-top: 0; }
  table.list-table td:first-child:not(.sel), table.list-table td.sel + td { min-width: 180px; }
}

/* list pages (people, companies, signals) */
.list-table td:first-child:not(.sel), .list-table td.sel + td { min-width: 220px; }
.list-table td.sel input { margin-top: 5px; }
.card.table-wrap > table th.sel:first-child, .card.table-wrap > table td.sel:first-child { width: 44px; padding-right: 0; }
.list-table td .avatar, .signals-table td .avatar { background: var(--surface-2); }
.signals-table td.score { font-size: 14px; }
.signals-table td.score .pill { font-weight: 600; }
.score-cell { display: inline-grid; grid-template-columns: 44px 6ch; align-items: center; column-gap: 8px; }
.score-hot { display: flex; justify-content: flex-start; }
.score-val { text-align: right; }
.signals-table a.pill { text-decoration: none; }
.signals-table a.pill:hover { filter: brightness(0.95); }
.signals-table td:nth-child(3) { min-width: 180px; max-width: 280px; }
.signals-table td:nth-child(5) { min-width: 180px; max-width: 260px; color: var(--text-2); }
.inline-add input { flex: 1 1 160px; }
.card > form + .feed { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--border); }
.card > form + .feed > li.muted { border-bottom: 0; }
/* rows that hold form controls (settings users, call dispositions): centre everything on the control */
tbody tr:has(> td > select, > td > input:not([type=checkbox])) > td { vertical-align: middle; }
td > select { width: auto; min-width: 96px; }

/* notifications inbox */
.nt-filters { justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.nt-filters select { width: auto; min-width: 200px; }
.tabs .tab-link { font-size: 13.5px; padding: 6px 12px; color: var(--text-2); border-radius: 8px; text-decoration: none; }
.tabs .tab-link.active { background: var(--surface); color: var(--text); font-weight: 550; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.tabs.deal-view { margin-bottom: 0; } /* Board | List on the Deals header row */
.nt-layout { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.nt-list { padding: 6px; max-height: calc(100vh - 230px); overflow: auto; }
.nt-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.nt-item + .nt-item { margin-top: 2px; }
.nt-item:hover { background: var(--hover); }
.nt-item.active { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.nt-item.unseen .nt-title { font-weight: 600; }
.nt-item.resolved { opacity: .65; }
.nt-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nt-title { font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.nt-meta { font-size: 12px; color: var(--muted); }
.nt-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.nt-dot.warn { background: var(--warn); } .nt-dot.error { background: var(--bad, #ef5f5f); } .nt-dot.success { background: var(--good); } .nt-dot.info { background: var(--accent, #2f7cf6); }
.nt-detail { min-width: 0; }
.nt-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nt-h { margin: 10px 0 4px; font-size: 18px; line-height: 1.3; }
.nt-body { margin: 0 0 4px; color: var(--text-2); white-space: pre-wrap; }
.nt-section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.nt-section h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 8px; }
.nt-section .row { flex-wrap: wrap; gap: 8px; align-items: center; }
.nt-resolved { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--good-soft); }
.nt-resolved p { margin: 6px 0 0; }
.nt-resolve textarea { width: 100%; margin-bottom: 8px; resize: vertical; }
.nt-back { display: none; margin-bottom: 10px; }
.nt-detail .empty, .nt-list .empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 36px 12px; text-align: center; }
#bell.unseen #bell-n { font-weight: 700; }
@media (max-width: 860px) {
  .nt-layout { grid-template-columns: 1fr; }
  .nt-list { max-height: none; }
  .nt-layout.has-selection .nt-list { display: none; }
  .nt-layout:not(.has-selection) .nt-detail { display: none; }
  .nt-back { display: inline-block; }
}
.btn.danger.ghost { color: var(--bad); }
.code-block { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 10px; }
.right { text-align: right; white-space: nowrap; }
select[multiple] { height: auto; min-height: 84px; padding: 4px 6px; }
/* App switcher (web/apps.ts), shared by every app's top bar */
.apps-wrap { position: relative; }
.apps-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 270px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 6px; display: grid; gap: 2px; }
.apps-menu a { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.apps-menu a span { font-size: 12.5px; color: var(--muted); }
.apps-menu a:hover { background: var(--hover); }
.apps-menu a.on { background: var(--surface-2); }
.apps-sep { height: 1px; background: var(--border); margin: 4px 2px; }
@media (max-width: 640px) { .apps-label { display: none; } }
/* Buttons (shared by every app): compact, white with a hairline border and soft shadow; primary is near-black.
   Icons inside take the text colour. */
:root { --btn-shadow: 0 1px 2px rgba(16, 24, 40, .06); --btn-h: 32px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --btn-shadow: 0 1px 2px rgba(0, 0, 0, .4); } }
:root[data-theme="dark"] { --btn-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.btn { font-size: 13.5px; font-weight: 500; gap: 6px; padding: 0 10px; min-height: var(--btn-h); border-radius: 8px; border-color: var(--border); box-shadow: var(--btn-shadow); transition: background-color .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { box-shadow: none; transform: translateY(.5px); }
.btn .ico { width: 15px; height: 15px; vertical-align: 0; }
.btn.primary, .btn.dark { background: var(--ink); border-color: var(--ink); color: var(--ink-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), var(--btn-shadow); }
.btn.primary:hover, .btn.dark:hover { background: var(--ink); opacity: .88; }
.btn.ghost { box-shadow: none; }
.btn.danger:not(.ghost) { border-color: color-mix(in srgb, var(--bad) 30%, var(--border)); }
.btn.small { padding: 0 8px; min-height: 26px; font-size: 12.5px; border-radius: 7px; }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--ring); }

/* Empty states: title on its own line, text under it, action below; centred in the card or table. */
div.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 32px 16px; color: var(--muted); }
div.empty b { color: var(--text); font-weight: 550; }
div.empty > .muted { max-width: 520px; }
div.empty > .btn { margin-top: 10px; }
td > div.empty { padding: 28px 16px; }
.view > h1:first-child { margin-bottom: 16px; }
.view > h1:first-child + p { margin: -12px 0 16px; }

.login-legal { margin: 0; text-align: center; }
.login-legal a { color: var(--muted); }

/* Files card (company and deal pages): list, drop zone, highlighted while a file is dragged over it. */
.files { list-style: none; margin: 0 0 10px; padding: 0; }
.files li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.files li:first-child { border-top: 0; }
.files li a { font-weight: 550; overflow-wrap: anywhere; grid-column: 1; }
.files li .muted { grid-column: 1; }
.files li .btn { grid-column: 2; grid-row: 1 / span 2; }
.files li .muted a { font-weight: 500; color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.drop-zone { border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 14px; text-align: center; }
.files-card.dragging { outline: 2px dashed var(--accent); outline-offset: -6px; }
.files-card.dragging .drop-zone { border-color: var(--accent); color: var(--text); }

/* App not in the workspace's plan (web/apps.ts) */
.apps-blocked { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.apps-blocked-card { max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; display: grid; gap: 12px; }
.apps-blocked-card h1 { margin: 0; font-size: 20px; }
.apps-blocked-card p { margin: 0; color: var(--text-2); }
.apps-blocked-card .btn { margin-right: 8px; }

/* ---------- validation rule errors on record forms (src/validation.ts) ---------- */
label.has-error input, label.has-error select, label.has-error textarea { border-color: var(--bad); }
.field-error { color: var(--bad); font-size: 12px; font-weight: 500; }
.form-banner { background: var(--bad-soft); color: var(--bad); border-radius: 9px; padding: 8px 12px; font-size: 13px; font-weight: 500; }
.card > .form-banner, form > .form-banner { margin-bottom: 12px; }

/* ---------- Settings > Pipelines ---------- */
.stage-table td { vertical-align: top; }
.stage-table input[data-k="label"] { width: 100%; min-width: 140px; }
.stage-table input[data-k="probability"] { width: 64px; }
.stage-table td.order { width: 1%; }
.stage-table td.stage-actions { width: 1%; }
.stage-table td.reqs { min-width: 240px; max-width: 340px; }
.stage-table td.reqs .pill { white-space: normal; }
.stage-table .req-row > td { max-width: none; }
.stage-table td.stage-actions .btn { display: flex; width: 100%; margin-bottom: 4px; }
.stage-table .check-row { max-width: 150px; padding-bottom: 0; font-size: 12.5px; }
.stage-table select[data-k="kind"] { min-width: 110px; }
.stage-table tr.open > td { background: var(--surface-2); }
.stage-table .req-row > td { background: var(--surface-2); padding-top: 0; }
.req-panel h3 { margin: 4px 0 8px; font-size: 13.5px; }
.req-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.req-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 4px 6px 4px 10px; font-size: 13.5px; }
.req-panel .row select { max-width: 300px; }
label.inline-label { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
label.inline-label input { width: 110px; }
.savebar { position: sticky; bottom: 16px; margin-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--ink); color: var(--ink-ink);
  padding: 10px 12px 10px 16px; border-radius: 12px; box-shadow: var(--shadow-pop); z-index: 5; }
.savebar .btn.ghost { color: var(--ink-ink); }
.savebar .btn.primary { background: var(--ink-ink); color: var(--ink); border-color: var(--ink-ink); }

/* ---------- Settings > Validation rules ---------- */
.modal-card:has(.wide-modal) { width: min(920px, 100%); }
.cond-box { display: flex; flex-direction: column; gap: 10px; align-items: stretch !important; background: var(--surface-2); border-radius: 12px; padding: 12px; }
.cond-box > .row b { font-size: 13.5px; }
.cond-box > .btn { align-self: flex-start; }
.cond-row { display: grid; grid-template-columns: 40px minmax(150px, 1.4fr) minmax(120px, 1fr) minmax(110px, .8fr) minmax(120px, 1.2fr) auto; gap: 8px; align-items: center; }
.cond-row .cond-join { text-align: right; }
.cond-row input.num { width: 80px; }
.vr-test input { width: 120px; }
.test-result { border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.test-result.bad { background: var(--bad-soft); }
.test-result.good { background: var(--good-soft); }
.test-result ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 720px) { .cond-row { grid-template-columns: 1fr 1fr; } .cond-row .cond-join { grid-column: 1 / -1; text-align: left; } }

/* Settings > Users: the sign-in link for someone off the workspace's domains */
.copy-link { width: 100%; }

/* Settings > Integrations: tiles; one opens that integration's settings */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.int-tile { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 4px 12px; align-items: start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); text-decoration: none; transition: border-color .12s; }
.int-tile:hover { border-color: var(--border-strong); }
.int-mark { grid-row: span 2; width: 36px; height: 36px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); display: grid; place-items: center; font-weight: 600; font-size: 13px; letter-spacing: -0.02em; }
/* Logos in public/integrations/: Simple Icons (CC0, black marks) and the Reewamp mark; light in dark mode. */
.int-mark img { width: 20px; height: 20px; display: block; }
.int-mark:not(:has(img)) { font-weight: 700; font-size: 12.5px; } /* a monogram where the logo is a wide wordmark (Cal.com) */
.int-mark img { mix-blend-mode: multiply; } /* a logo on white (Orianna's emblem) loses its white box */
:root[data-theme="dark"] .int-mark img { filter: invert(1); mix-blend-mode: screen; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .int-mark img { filter: invert(1); mix-blend-mode: screen; } }
.int-body { display: grid; gap: 2px; min-width: 0; }
.int-tile .pill { justify-self: start; }
