/* 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);
  --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);
  }
}
: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);
}

* { 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; }
.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 ---------- */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; min-width: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox] { accent-color: var(--ink); width: 15px; height: 15px; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 550; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.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: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; 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; }
.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)); }
.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: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
/* inline filter rows render as a chip toolbar */
form#filters { background: none; border: 0; padding: 0; box-shadow: none; margin-bottom: 4px; }
form#filters select, form#filters input { border-radius: 9px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; min-width: 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; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12.5px; font-weight: 500; color: var(--muted); background: var(--surface); position: sticky; top: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; 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: 9px 0; border-bottom: 1px solid var(--border); }
.feed li:last-child { border-bottom: 0; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 7px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- 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: 12px 14px 0; flex-wrap: wrap; }
.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 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; }
