/* Knopa CRM — same design system as Knopa Hub: paper & ink, one violet accent, Onest / Unbounded / JetBrains Mono.
   Tokens below are Hub's. The older CRM names (--fg, --line, --bg-hover …) are kept as aliases so every page keeps working.
   Layout: sidebar (collapsible) + main column. Phone (<=820px): bottom tab bar, drawer sidebar, bottom sheets. */
:root {
  --font: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Unbounded', 'Onest', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --bg: #f4f3ef; --bg-sub: #efeee9; --bg-sunk: #e9e8e2; --panel: #ffffff; --elev: #ffffff;
  --border: #e3e1da; --border-2: #d3d0c7; --text: #141413; --text-2: #5d5b55; --text-3: #8f8c84; --text-inv: #fff;
  --hover: rgba(20, 20, 15, .05); --active: rgba(20, 20, 15, .085);
  --ink: #141413; --ink-2: #2b2b29; --on-ink: #ffffff; --key: rgba(0, 0, 0, .55);
  --accent: #5b2ee6; --accent-2: #4a20d4; --accent-soft: rgba(91, 46, 230, .1); --accent-text: #4f22dc; --focus: rgba(91, 46, 230, .28);
  --ok: #17924a; --ok-soft: rgba(23, 146, 74, .11); --warn: #c77d00; --warn-soft: rgba(214, 140, 0, .13); --bad: #d93a3f; --bad-soft: rgba(217, 58, 63, .1);
  --c-grey: #7d7a72; --c-red: #d93a3f; --c-orange: #e8661c; --c-amber: #c98a00; --c-green: #17924a; --c-teal: #0e9488; --c-blue: #2a64f0; --c-violet: #6a3ff0; --c-pink: #d43f8f; --c-slate: #56607a;
  --shadow-sm: 0 1px 2px rgba(30, 28, 20, .06); --shadow: 0 1px 2px rgba(30, 28, 20, .05), 0 6px 18px rgba(30, 28, 20, .06);
  --shadow-lg: 0 18px 50px rgba(30, 28, 20, .18), 0 2px 8px rgba(30, 28, 20, .06);
  --overlay: rgba(20, 19, 15, .38);
  --r-sm: 7px; --r: 10px; --r-lg: 14px; --r-xl: 20px;
  --sidebar: 252px;
  --ease: cubic-bezier(.22, .8, .24, 1); --ease-out: cubic-bezier(.4, 0, 1, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060607; --bg-sub: #0d0d0f; --bg-sunk: #030304; --panel: #141417; --elev: #1b1b1f;
    --border: #26262b; --border-2: #36363c; --text: #ededeb; --text-2: #a8a7a3; --text-3: #7a7975; --text-inv: #0c0c0d;
    --hover: rgba(255, 255, 255, .05); --active: rgba(255, 255, 255, .09);
    --ink: #f1f0ec; --ink-2: #ffffff; --on-ink: #0c0c0d; --key: rgba(0, 0, 0, .4);
    --accent: #9476ff; --accent-2: #a68cff; --accent-soft: rgba(148, 118, 255, .15); --accent-text: #ab95ff; --focus: rgba(148, 118, 255, .35);
    --ok: #3dcc7c; --ok-soft: rgba(61, 204, 124, .13); --warn: #f2b443; --warn-soft: rgba(242, 180, 67, .13); --bad: #ff6a6e; --bad-soft: rgba(255, 106, 110, .13);
    --c-grey: #9d9b95; --c-red: #ff6a6e; --c-orange: #ff9150; --c-amber: #f2b443; --c-green: #3dcc7c; --c-teal: #2fc8b8; --c-blue: #6f9bff; --c-violet: #a28bff; --c-pink: #f47bbd; --c-slate: #98a2bc;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .35); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
    --overlay: rgba(0, 0, 0, .62);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #060607; --bg-sub: #0d0d0f; --bg-sunk: #030304; --panel: #141417; --elev: #1b1b1f;
  --border: #26262b; --border-2: #36363c; --text: #ededeb; --text-2: #a8a7a3; --text-3: #7a7975; --text-inv: #0c0c0d;
  --hover: rgba(255, 255, 255, .05); --active: rgba(255, 255, 255, .09);
  --ink: #f1f0ec; --ink-2: #ffffff; --on-ink: #0c0c0d; --key: rgba(0, 0, 0, .4);
  --accent: #9476ff; --accent-2: #a68cff; --accent-soft: rgba(148, 118, 255, .15); --accent-text: #ab95ff; --focus: rgba(148, 118, 255, .35);
  --ok: #3dcc7c; --ok-soft: rgba(61, 204, 124, .13); --warn: #f2b443; --warn-soft: rgba(242, 180, 67, .13); --bad: #ff6a6e; --bad-soft: rgba(255, 106, 110, .13);
  --c-grey: #9d9b95; --c-red: #ff6a6e; --c-orange: #ff9150; --c-amber: #f2b443; --c-green: #3dcc7c; --c-teal: #2fc8b8; --c-blue: #6f9bff; --c-violet: #a28bff; --c-pink: #f47bbd; --c-slate: #98a2bc;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .35); --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6), 0 2px 8px rgba(0, 0, 0, .4);
  --overlay: rgba(0, 0, 0, .62);
  color-scheme: dark;
}
/* aliases: old CRM names -> Hub tokens. Note: old --bg (white surface) is now --panel; --bg is the page paper. */
:root {
  --bg-hover: var(--hover); --bg-active: var(--active); --bg-elev: var(--elev);
  --line: var(--border); --line-strong: var(--border-2);
  --fg: var(--text); --fg-2: var(--text-2); --fg-3: var(--text-3); --fg-4: color-mix(in srgb, var(--text-3) 55%, transparent);
  --ink-fg: var(--on-ink);
  --sel: var(--hover); --sel-strong: var(--active);
  --shadow-1: var(--shadow-sm); --shadow-2: var(--shadow); --shadow-3: var(--shadow-lg);
  --scrim: var(--overlay);
  --g1: var(--bg-sunk); --g2: var(--border-2); --g3: var(--c-grey); --g4: var(--text-3); --g5: var(--text-2);
  --fs-xs: 11px; --fs-sm: 12px; --fs: 13.5px; --fs-md: 14px; --fs-lg: 16px; --fs-xl: 22px; --fs-2xl: 28px;
  --row: 38px; --side: var(--sidebar);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --p0-bg: color-mix(in srgb, var(--c-red) 16%, var(--panel)); --p0-fg: var(--c-red);
  --p1-bg: color-mix(in srgb, var(--c-orange) 16%, var(--panel)); --p1-fg: var(--c-orange);
  --p2-bg: color-mix(in srgb, var(--c-amber) 16%, var(--panel)); --p2-fg: var(--c-amber);
  --p3-bg: color-mix(in srgb, var(--c-green) 16%, var(--panel)); --p3-fg: var(--c-green);
  --p4-bg: color-mix(in srgb, var(--c-teal) 16%, var(--panel)); --p4-fg: var(--c-teal);
  --p5-bg: color-mix(in srgb, var(--c-blue) 16%, var(--panel)); --p5-fg: var(--c-blue);
  --p6-bg: color-mix(in srgb, var(--c-violet) 16%, var(--panel)); --p6-fg: var(--c-violet);
  --p7-bg: color-mix(in srgb, var(--c-pink) 16%, var(--panel)); --p7-fg: var(--c-pink);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--panel); color: var(--fg); font: 400 var(--fs)/1.45 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
::selection { background: var(--ink); color: var(--ink-fg); }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 1px; border-radius: 4px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.muted { color: var(--fg-3); }
.svg { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle; }
.svg.sm { width: 14px; height: 14px; }
.svg.xs { width: 12px; height: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- boot ---------- */
.boot { height: 100%; display: grid; place-items: center; }
.boot-mark { font-weight: 700; font-size: 22px; letter-spacing: -.03em; animation: pulse 1.2s var(--ease) infinite alternate; }
@keyframes pulse { from { opacity: .35 } to { opacity: 1 } }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100%; }
.side { background: var(--bg-sub); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; padding-top: env(safe-area-inset-top, 0px); }
.side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.ws { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; padding: 5px 6px; border-radius: var(--r); transition: background .15s, scale .22s var(--spring); }
.ws:hover { background: var(--bg-hover); }
.ws-mark { width: 24px; height: 24px; border-radius: 7px; background: var(--ink); color: var(--ink-fg); display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: -.04em; flex: none; }
.ws-name { font-weight: 600; font-size: var(--fs-md); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-name small { font-weight: 500; color: var(--fg-3); font-size: var(--fs-sm); margin-left: 4px; letter-spacing: 0; }
.side-search { margin: 4px 12px 10px; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; border-radius: var(--r); background: var(--panel); box-shadow: var(--shadow-1); color: var(--fg-3); transition: box-shadow .15s, color .15s, scale .22s var(--spring); width: calc(100% - 24px); text-align: left; }
.side-search:hover { color: var(--fg-2); box-shadow: 0 0 0 1px var(--line-strong); }
.side-search span { flex: 1; }
.kbd { font-family: var(--mono); font-size: 10.5px; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--fg-3); background: var(--panel); line-height: 1.5; }
.side-scroll { flex: 1; overflow-y: auto; padding: 0 8px 12px; min-height: 0; }
.nav-sec { margin-top: 14px; }
.nav-sec-title { display: flex; align-items: center; justify-content: space-between; font-size: var(--fs-xs); font-weight: 500; color: var(--fg-3); padding: 0 8px 4px; letter-spacing: .02em; }
.nav-item { display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: var(--r); color: var(--fg-2); font-weight: 500; transition: background .12s, color .12s, scale .22s var(--spring); position: relative; width: 100%; text-align: left; }
.nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.nav-item.on { background: var(--bg-active); color: var(--fg); }
.nav-item .count { margin-left: auto; font-size: var(--fs-xs); color: var(--fg-3); font-family: var(--mono); }
.nav-item .count.hot { background: var(--ink); color: var(--ink-fg); border-radius: 9px; padding: 0 6px; line-height: 17px; }
.side-foot { border-top: 1px solid var(--line); padding: 8px; display: flex; align-items: center; gap: 4px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
.me { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 4px 6px; border-radius: var(--r); transition: background .12s, scale .22s var(--spring); }
.me:hover { background: var(--bg-hover); }
.me-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; background: var(--panel); padding-top: env(safe-area-inset-top, 0px); }
.topbar { height: 48px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.burger { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 500; flex: 1; }
.crumbs a { color: var(--fg-3); transition: color .12s; white-space: nowrap; }
.crumbs a:hover { color: var(--fg); }
.crumbs .sep { color: var(--fg-4); }
.crumbs .cur { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.content { flex: 1; min-height: 0; overflow: auto; position: relative; }
.page-enter { animation: pageIn .32s var(--ease-out) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: var(--r); font-weight: 500; white-space: nowrap; color: var(--fg); background: var(--panel); box-shadow: var(--shadow-1); transition: background .12s, box-shadow .12s, opacity .12s, scale .22s var(--spring); user-select: none; }
.btn:hover { background: var(--bg-hover); }
.btn:active { scale: .96; }
.btn.primary { background: var(--ink); color: var(--ink-fg); box-shadow: none; }
.btn.primary:hover { opacity: .86; }
.btn.ghost { box-shadow: none; background: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--fg); }
.btn.icon { width: 30px; padding: 0; }
.btn.sm { height: 26px; padding: 0 8px; font-size: var(--fs-sm); }
.btn.sm.icon { width: 26px; }
.btn.danger { color: var(--fg); }
.btn.danger.primary { background: var(--ink); color: var(--ink-fg); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .badge { background: var(--ink); color: var(--ink-fg); border-radius: 8px; font-size: 10.5px; padding: 0 5px; line-height: 16px; font-family: var(--mono); }
.btn.on { background: var(--bg-active); }
.input, .select, .textarea { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--panel); outline: none; transition: border-color .12s, box-shadow .12s; }
.textarea { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--fg); box-shadow: 0 0 0 3px var(--sel-strong); }
.input::placeholder, .textarea::placeholder { color: var(--fg-4); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 15px) 14px, calc(100% - 11px) 14px; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 28px; }
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: var(--fs-sm); color: var(--fg-2); font-weight: 500; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--bg-hover); border-radius: var(--r); padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { height: 26px; padding: 0 10px; border-radius: 5px; color: var(--fg-2); font-weight: 500; transition: background .15s, color .15s, box-shadow .15s, scale .22s var(--spring); display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--panel); color: var(--fg); box-shadow: var(--shadow-1); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 13px; border: 1px solid var(--line-strong); color: var(--fg-2); font-weight: 500; font-size: var(--fs-sm); transition: all .12s, scale .22s var(--spring); }
.chip:hover { color: var(--fg); border-color: var(--fg-3); }
.chip.on { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--fg-4); display: inline-grid; place-items: center; flex: none; transition: background .15s, border-color .15s, transform .1s; cursor: pointer; background: var(--panel); }
.check:hover { border-color: var(--fg-2); }
.check.on { background: var(--ink); border-color: var(--ink); }
.check svg { width: 10px; height: 10px; color: var(--ink-fg); opacity: 0; transform: scale(.5); transition: opacity .15s, transform .2s var(--ease-out); }
.check.on svg { opacity: 1; transform: none; }
.check.round { border-radius: 50%; width: 17px; height: 17px; }
.check:active { transform: scale(.88); }

/* ---------- pills, avatars ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 6px; background: var(--bg-hover); color: var(--fg); font-weight: 500; font-size: var(--fs-sm); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; border: 1px solid transparent; }
.pill.out { background: transparent; border-color: var(--line-strong); }
.pill.ink { background: var(--ink); color: var(--ink-fg); }
.pill.status { background: var(--panel); border-color: var(--line-strong); }
.pill.status.won { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.pill.status.lost { color: var(--fg-3); text-decoration: line-through; text-decoration-color: var(--fg-4); }
.pill .x { opacity: .5; margin-left: 2px; }
.pill .x:hover { opacity: 1; }
.pills { display: flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; min-width: 0; }
.wrap .pills, .pills.wrap { flex-wrap: wrap; }
.ring { width: 12px; height: 12px; flex: none; }
.av { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 9.5px; font-weight: 600; flex: none; color: var(--fg); background: var(--g2); letter-spacing: -.02em; overflow: hidden; position: relative; }
.av.co { border-radius: 5px; }
.av img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; background: #fff; }
.av.lg { width: 40px; height: 40px; font-size: 15px; border-radius: 50%; }
.av.lg.co { border-radius: 10px; }
.av.xl { width: 52px; height: 52px; font-size: 19px; }
.av.xl.co { border-radius: 12px; }
.av.p0 { background: var(--p0-bg); color: var(--p0-fg); } .av.p1 { background: var(--p1-bg); color: var(--p1-fg); } .av.p2 { background: var(--p2-bg); color: var(--p2-fg); } .av.p3 { background: var(--p3-bg); color: var(--p3-fg); } .av.p4 { background: var(--p4-bg); color: var(--p4-fg); } .av.p5 { background: var(--p5-bg); color: var(--p5-fg); } .av.p6 { background: var(--p6-bg); color: var(--p6-fg); } .av.p7 { background: var(--p7-bg); color: var(--p7-fg); } 
.av.s1 { background: var(--g1); } .av.s2 { background: var(--g2); } .av.s3 { background: var(--g3); color: var(--panel); } .av.s4 { background: var(--g4); color: var(--panel); } .av.s5 { background: var(--g5); color: var(--panel); }
.user-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.user-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 6px 1px 2px; border-radius: 6px; border: 1px solid var(--line); max-width: 100%; min-width: 0; transition: border-color .12s, background .12s, scale .22s var(--spring); }
.rec-chip:hover { border-color: var(--fg-3); background: var(--bg-hover); }
.rec-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* ---------- view toolbar ---------- */
.vbar { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; left: 0; }
.vbar .grow { flex: 1; }
.view-switch { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 8px 0 9px; border-radius: var(--r); font-weight: 600; transition: background .12s; max-width: 260px; }
.view-switch:hover { background: var(--bg-hover); }
.view-switch .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vsearch { position: relative; width: 210px; }
.vsearch .svg { position: absolute; left: 9px; top: 8px; color: var(--fg-3); pointer-events: none; }
.vsearch .input { padding-left: 30px; height: 30px; }
@keyframes grow { from { transform: scaleX(.3); opacity: 0 } to { transform: none; opacity: 1 } }

/* ---------- table ---------- */
.grid-wrap { overflow: auto; height: 100%; position: relative; }
.grid { display: grid; min-width: max-content; position: relative; }
.gr { display: contents; }
.gc { height: var(--row); display: flex; align-items: center; padding: 0 10px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); min-width: 0; overflow: hidden; white-space: nowrap; background: var(--panel); position: relative; transition: background .08s; }
.gh .gc { position: sticky; top: 0; z-index: 3; height: 34px; color: var(--fg-3); font-weight: 500; font-size: var(--fs-sm); background: var(--panel); gap: 6px; cursor: pointer; user-select: none; }
.gh .gc:hover { color: var(--fg); background: var(--bg-hover); }
.gh .gc .svg { color: var(--fg-4); }
.gh .gc .sort { margin-left: auto; color: var(--fg); }
.gc.first { position: sticky; left: 0; z-index: 2; gap: 9px; }
.gc.chk { position: sticky; left: 0; z-index: 2; width: 40px; justify-content: center; padding: 0; border-right: 0; }
.gc.chk + .gc.first { left: 40px; }
.gh .gc.first, .gh .gc.chk { z-index: 4; }
.gr:hover .gc { background: var(--bg-sub); }
.gr.sel .gc { background: var(--sel-strong); }
.gr.sel .gc.first, .gr.sel .gc.chk { background: color-mix(in srgb, var(--panel) 92%, var(--fg)); }
.gr .gc.first .open-btn { margin-left: auto; opacity: 0; transition: opacity .12s; flex: none; }
.gr:hover .gc.first .open-btn { opacity: 1; }
.gc .cell-text { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gc.editable { cursor: default; }
.gc.editable:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.gc.editing { box-shadow: inset 0 0 0 2px var(--fg) !important; z-index: 5; overflow: visible; }
.gc .name-link { font-weight: 500; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.gc .name-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--fg-4); }
.gc.add-col { border-right: 0; color: var(--fg-4); justify-content: center; width: 44px; cursor: pointer; }
.gc.add-col:hover { color: var(--fg); }
.gc.filler { border-right: 0; }
.gc a.link { color: var(--fg-2); text-decoration: underline; text-decoration-color: var(--fg-4); text-underline-offset: 3px; overflow: hidden; text-overflow: ellipsis; }
.gc a.link:hover { color: var(--fg); }
.resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 5; }
.resize:hover::after, .resize.on::after { content: ""; position: absolute; left: 3px; top: 6px; bottom: 6px; width: 2px; background: var(--fg); border-radius: 1px; }
.cell-input { position: absolute; inset: 0; border: 0; outline: 0; padding: 0 10px; background: var(--panel); font: inherit; width: 100%; }
.gfoot { position: sticky; bottom: 0; left: 0; display: flex; align-items: center; gap: 12px; padding: 0 16px; height: 34px; border-top: 1px solid var(--line); background: var(--panel); color: var(--fg-3); font-size: var(--fs-sm); z-index: 6; }
.gfoot .add-row { color: var(--fg-3); display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.gfoot .add-row:hover { color: var(--fg); }
.row-in { animation: rowIn .28s var(--ease-out) both; }
@keyframes rowIn { from { opacity: 0; transform: translateY(4px) } to { opacity: 1; transform: none } }
.flash .gc { animation: flash 1s var(--ease); }
@keyframes flash { 0% { background: var(--sel-strong) } 100% { background: var(--panel) } }
.next-task { display: flex; align-items: center; gap: 6px; min-width: 0; }
.next-task .t { overflow: hidden; text-overflow: ellipsis; }
.due { font-family: var(--mono); font-size: var(--fs-xs); color: var(--fg-3); flex: none; padding: 0 5px; border-radius: 4px; line-height: 18px; }
.due.over { background: var(--ink); color: var(--ink-fg); }
.due.today { border: 1px solid var(--fg); color: var(--fg); }
.empty-cell { color: var(--fg-4); }

/* bulk bar */
.bulk { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--ink-fg); border-radius: 12px; padding: 6px 6px 6px 14px; display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-3); z-index: 40; animation: bulkIn .3s var(--ease-out); max-width: calc(100vw - 32px); }
@keyframes bulkIn { from { opacity: 0; transform: translate(-50%, 14px) scale(.97) } to { opacity: 1; transform: translateX(-50%) } }
.bulk .btn { background: transparent; color: var(--ink-fg); box-shadow: none; }
.bulk .btn:hover { background: color-mix(in srgb, var(--ink-fg) 14%, transparent); }
.bulk .n { font-weight: 600; margin-right: 6px; white-space: nowrap; }

/* ---------- kanban ---------- */
.board { display: flex; gap: 12px; padding: 14px 16px 24px; height: 100%; overflow: auto; align-items: flex-start; scroll-snap-type: x proximity; }
.col { width: 284px; flex: none; display: flex; flex-direction: column; max-height: 100%; background: var(--bg-sub); border-radius: var(--r-lg); border: 1px solid var(--line); scroll-snap-align: start; transition: background .15s, border-color .15s; }
.col.over { background: var(--bg-hover); border-color: var(--fg-3); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 12px; font-weight: 600; }
.col-head .cnt { color: var(--fg-3); font-family: var(--mono); font-size: var(--fs-sm); font-weight: 400; }
.col-head .sum { margin-left: auto; color: var(--fg-3); font-family: var(--mono); font-size: var(--fs-sm); font-weight: 400; }
.col-body { padding: 2px 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 60px; }
.kcard { background: var(--bg-elev); border-radius: var(--r); padding: 10px 11px; box-shadow: var(--shadow-1); cursor: grab; display: grid; gap: 7px; transition: box-shadow .15s, transform .15s, scale .22s var(--spring); touch-action: none; user-select: none; animation: rowIn .3s var(--ease-out) both; }
.kcard:hover { box-shadow: var(--shadow-2); }
.kcard .kt { display: flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.kcard .kt span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard .kf { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--fg-2); font-size: var(--fs-sm); min-width: 0; }
.kcard .kf > * { max-width: 100%; }
.kcard.ghost { opacity: .25; }
.kdrag { position: fixed; z-index: 100; pointer-events: none; box-shadow: var(--shadow-3); transform: rotate(2deg) scale(1.03); cursor: grabbing; transition: transform .12s; }
.kph { border: 1.5px dashed var(--line-strong); border-radius: var(--r); background: transparent; transition: height .15s; }
.col-add { color: var(--fg-3); display: flex; align-items: center; gap: 6px; padding: 6px 4px; border-radius: 6px; font-weight: 500; transition: color .12s, background .12s; }
.col-add:hover { color: var(--fg); background: var(--bg-hover); }

/* ---------- popovers / menus ---------- */
#layer { position: relative; z-index: 110; }
.pop { position: fixed; z-index: 110; background: var(--bg-elev); border-radius: var(--r-lg); box-shadow: var(--shadow-2); min-width: 200px; max-width: min(360px, calc(100vw - 16px)); padding: 4px; transform-origin: top left; animation: popIn .16s var(--ease-out); display: flex; flex-direction: column; max-height: min(420px, calc(100vh - 24px)); }
.pop.closing { animation: popOut .12s var(--ease) forwards; }
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(-4px) } to { opacity: 1; transform: none } }
@keyframes popOut { to { opacity: 0; transform: scale(.97) } }
.pop-search { padding: 4px 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.pop-search input { width: 100%; border: 0; outline: 0; background: transparent; height: 28px; padding: 0 6px; }
.pop-list { overflow-y: auto; min-height: 0; }
.mi { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 4px 8px; border-radius: 6px; text-align: left; color: var(--fg); transition: background .08s, scale .22s var(--spring); }
.mi:hover, .mi.hl { background: var(--bg-hover); }
.mi .svg { color: var(--fg-3); }
.mi .r { margin-left: auto; color: var(--fg-3); display: flex; align-items: center; gap: 6px; }
.mi.danger { color: var(--fg); }
.mi.disabled { opacity: .45; pointer-events: none; }
.mi .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.msep { height: 1px; background: var(--line); margin: 4px 2px; }
.mhead { font-size: var(--fs-xs); color: var(--fg-3); padding: 6px 8px 4px; font-weight: 500; }
.mempty { padding: 10px 8px; color: var(--fg-3); }
.pop-body { padding: 8px; }

/* filter builder */
.fb { display: grid; gap: 6px; padding: 6px; min-width: min(560px, calc(100vw - 32px)); }
.fb-row { display: grid; grid-template-columns: 34px minmax(110px, 1fr) minmax(100px, 0.9fr) minmax(120px, 1.3fr) 28px; gap: 6px; align-items: center; animation: rowIn .2s var(--ease-out); }
.fb-row .w { color: var(--fg-3); font-size: var(--fs-sm); text-align: right; }
.fb .select, .fb .input { height: 30px; }
.fb-val { display: flex; gap: 4px; flex-wrap: wrap; min-width: 0; }
.fb-multi { display: flex; align-items: center; gap: 4px; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: var(--r); width: 100%; overflow: hidden; text-align: left; }
.fb-multi .pills { flex: 1; }

/* ---------- modal ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 80; animation: fade .2s var(--ease); display: flex; align-items: flex-start; justify-content: center; padding: max(8vh, 20px) 16px 16px; overflow-y: auto; }
.scrim.closing { animation: fadeOut .16s var(--ease) forwards; }
@keyframes fade { from { opacity: 0 } }
@keyframes fadeOut { to { opacity: 0 } }
.modal { background: var(--bg-elev); border-radius: var(--r-xl); box-shadow: var(--shadow-3); width: 100%; max-width: 520px; animation: modalIn .28s var(--ease-out); display: flex; flex-direction: column; max-height: calc(100vh - 2 * max(8vh, 20px)); }
.modal.wide { max-width: 720px; }
.scrim.closing .modal { animation: modalOut .16s var(--ease) forwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }
@keyframes modalOut { to { opacity: 0; transform: translateY(8px) scale(.98) } }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.modal-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.015em; flex: 1; }
.modal-body { padding: 10px 18px 6px; display: grid; gap: 14px; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 18px 16px; }
.modal-foot .grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: 18px; z-index: 120; display: grid; gap: 8px; justify-items: end; pointer-events: none; }
.toast { background: var(--ink); color: var(--ink-fg); border-radius: 10px; padding: 9px 12px; font-weight: 500; box-shadow: var(--shadow-3); display: flex; align-items: center; gap: 10px; pointer-events: auto; animation: toastIn .35s var(--ease-out); max-width: min(420px, calc(100vw - 36px)); }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
.toast button { color: var(--ink-fg); opacity: .7; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.toast button:hover { opacity: 1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96) } to { opacity: 1; transform: none } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) } }

/* ---------- home ---------- */
.home { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; display: grid; gap: 22px; }
.home-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -.035em; text-wrap: balance; }
.home-head p { margin: 4px 0 0; color: var(--fg-3); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.kpi { padding: 14px 16px 15px; display: grid; gap: 4px; border-right: 1px solid var(--line); transition: background .15s, scale .22s var(--spring); text-align: left; min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--bg-sub); }
.kpi .k { color: var(--fg-3); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .s { color: var(--fg-3); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; letter-spacing: -.01em; flex: 1; }
.panel-body { padding: 4px 0; }
.panel-empty { padding: 22px 14px; color: var(--fg-3); text-align: center; }
.group-title { font-size: var(--fs-xs); color: var(--fg-3); font-weight: 600; padding: 10px 14px 4px; letter-spacing: .03em; text-transform: uppercase; display: flex; gap: 6px; align-items: center; }
.group-title .n { font-family: var(--mono); font-weight: 400; }
.pipe { display: grid; gap: 10px; padding: 14px; }
.pipe-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--bg-hover); }
.pipe-bar span { display: block; height: 100%; transition: flex-grow .6s var(--ease-out); }
.pipe-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px 12px; }
.pipe-legend a { display: flex; align-items: center; gap: 7px; color: var(--fg-2); font-size: var(--fs-sm); padding: 3px 4px; border-radius: 5px; transition: scale .22s var(--spring); }
.pipe-legend a:hover { background: var(--bg-hover); color: var(--fg); }
.pipe-legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.pipe-legend b { margin-left: auto; font-family: var(--mono); font-weight: 500; color: var(--fg); }

/* lists (tasks, feed) */
.trow { display: flex; align-items: flex-start; gap: 10px; padding: 8px 14px; transition: background .1s, scale .22s var(--spring); position: relative; }
.trow:hover { background: var(--bg-sub); }
.trow .check { margin-top: 1px; }
.trow .tm { flex: 1; min-width: 0; display: grid; gap: 3px; }
.trow .tt { font-weight: 500; overflow-wrap: anywhere; cursor: pointer; }
.trow.done .tt { color: var(--fg-3); text-decoration: line-through; text-decoration-color: var(--fg-4); }
.trow .tsub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--fg-3); font-size: var(--fs-sm); min-width: 0; }
.trow .tact { opacity: 0; transition: opacity .12s; display: flex; gap: 2px; }
.trow:hover .tact { opacity: 1; }
.trow.leaving { animation: leave .4s var(--ease) forwards; }
@keyframes leave { 40% { opacity: .5 } to { opacity: 0; transform: translateX(10px); height: 0; padding-top: 0; padding-bottom: 0; } }
.feed { display: grid; }
.fitem { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 9px 14px; position: relative; }
.fitem .fi { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--fg-2); background: var(--panel); position: relative; z-index: 1; }
.fitem .fm { min-width: 0; display: grid; gap: 2px; }
.fitem .fl { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.fitem .fl b { font-weight: 600; }
.fitem .ft { color: var(--fg-3); font-size: var(--fs-sm); white-space: nowrap; }
.fitem .fb2 { color: var(--fg-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.feed.line .fitem:not(:last-child)::before { content: ""; position: absolute; left: 27.5px; top: 36px; bottom: -8px; width: 1px; background: var(--line); }
.quick-add { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.quick-add input { flex: 1; border: 0; outline: 0; background: transparent; height: 30px; min-width: 0; }

/* ---------- record page ---------- */
.rec { display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: 100%; }
.rec-main { min-width: 0; border-right: 1px solid var(--line); }
.rec-head { padding: 22px 26px 0; display: grid; gap: 14px; }
.rec-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.rec-title .tw { min-width: 0; flex: 1; display: grid; gap: 4px; }
.rec-name { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.03em; border: 0; outline: 0; background: transparent; padding: 2px 6px; margin-left: -6px; border-radius: 6px; width: 100%; min-width: 0; text-overflow: ellipsis; transition: background .12s; }
.rec-name:hover { background: var(--bg-hover); }
.rec-name:focus { background: var(--bg-hover); box-shadow: 0 0 0 2px var(--fg); }
.rec-sub { color: var(--fg-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-width: 0; }
.rec-sub a { color: var(--fg-2); }
.rec-sub a:hover { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.rec-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 20px; margin-top: 4px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 0; background: var(--panel); z-index: 5; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 40px; padding: 0 8px; color: var(--fg-3); font-weight: 500; position: relative; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: color .12s, scale .22s var(--spring); }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--fg); }
.tab.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; background: var(--fg); border-radius: 2px; animation: grow .25s var(--ease-out); }
.tab .n { font-family: var(--mono); font-size: var(--fs-xs); color: var(--fg-3); }
.rec-body { padding: 20px 26px 60px; display: grid; gap: 22px; min-width: 0; }
.hl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.hl > div { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 6px; min-width: 0; align-content: start; }
.hl > div:nth-child(3n) { border-right: 0; }
.hl > div:nth-last-child(-n+3) { border-bottom: 0; }
.hl .k { color: var(--fg-3); font-size: var(--fs-sm); font-weight: 500; }
.hl .v { min-height: 22px; display: flex; align-items: center; min-width: 0; cursor: pointer; border-radius: 5px; }
.hl .v:hover { background: var(--bg-hover); box-shadow: 0 0 0 4px var(--bg-hover); }
.sect { display: grid; gap: 8px; min-width: 0; }
.sect-head { display: flex; align-items: center; gap: 8px; }
.sect-head h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; flex: 1; letter-spacing: -.01em; }
.box { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); min-width: 0; transition: background .1s, scale .22s var(--spring); cursor: pointer; }
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--bg-sub); }
.mini-row .mn { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-row .ms { color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.attrs { padding: 18px 16px 40px; display: grid; gap: 2px; align-content: start; background: var(--panel); }
.attrs-head { display: flex; align-items: center; gap: 8px; padding: 0 6px 8px; }
.attrs-head h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; flex: 1; }
.arow { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 32px; padding: 0 6px; border-radius: 6px; }
.arow .ak { color: var(--fg-3); display: flex; align-items: center; gap: 7px; min-width: 0; font-size: var(--fs); }
.arow .ak span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .av2 { min-height: 28px; display: flex; align-items: center; min-width: 0; padding: 3px 6px; border-radius: 6px; cursor: pointer; transition: background .1s; overflow-wrap: anywhere; }
.arow .av2:hover { background: var(--bg-hover); }
.arow .av2.long { white-space: pre-wrap; align-items: flex-start; line-height: 1.5; }
.arow.ro .av2 { cursor: default; }
.arow.ro .av2:hover { background: transparent; }
.attrs-meta { color: var(--fg-3); font-size: var(--fs-sm); padding: 14px 6px 0; border-top: 1px solid var(--line); margin-top: 10px; display: grid; gap: 4px; }
.note-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; display: grid; gap: 6px; cursor: pointer; transition: border-color .12s, box-shadow .15s, scale .22s var(--spring); }
.note-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.note-card h4 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.note-card .nb { color: var(--fg-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-card .nm { color: var(--fg-3); font-size: var(--fs-sm); }
.md p { margin: 0 0 8px; } .md ul { margin: 0 0 8px; padding-left: 18px; } .md a { text-decoration: underline; text-underline-offset: 3px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 46px 20px; color: var(--fg-3); text-align: center; }
.empty .ei { width: 44px; height: 44px; border-radius: 12px; border: 1px dashed var(--line-strong); display: grid; place-items: center; color: var(--fg-3); }
.empty h4 { margin: 0; color: var(--fg); font-size: var(--fs-md); font-weight: 600; }
.empty p { margin: 0; max-width: 340px; }

/* ---------- tasks page ---------- */
.page-pad { max-width: 980px; margin: 0 auto; padding: 22px 24px 60px; display: grid; gap: 16px; }
.page-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-title h1 { margin: 0; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.03em; flex: 1; }

/* ---------- palette ---------- */
.palette { max-width: 620px; }
.palette .pinput { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette .pinput input { flex: 1; border: 0; outline: 0; background: transparent; font-size: var(--fs-lg); min-width: 0; }
.palette .plist { max-height: min(420px, 60vh); overflow-y: auto; padding: 6px; }
.palette .mi { min-height: 38px; }
.palette .pfoot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--fg-3); font-size: var(--fs-sm); flex-wrap: wrap; }

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100%; }
.set-nav { border-right: 1px solid var(--line); padding: 18px 10px; display: grid; gap: 2px; align-content: start; }
.set-body { padding: 24px 28px 60px; max-width: 860px; display: grid; gap: 22px; align-content: start; min-width: 0; }
.set-body h2 { margin: 0; font-size: var(--fs-xl); font-weight: 600; letter-spacing: -.03em; }
.set-body .lead { color: var(--fg-3); margin: -14px 0 0; }
.set-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; display: grid; gap: 14px; min-width: 0; }
.set-card h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.theme-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-opt { border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 8px; display: grid; gap: 8px; text-align: left; transition: border-color .15s, box-shadow .15s, scale .22s var(--spring); }
.theme-opt.on { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.theme-opt .prev { height: 64px; border-radius: 7px; overflow: hidden; display: grid; grid-template-columns: 28% 1fr; border: 1px solid var(--line); }
.theme-opt .prev.l { background: #fff; } .theme-opt .prev.l i { background: #f2f2f0; }
.theme-opt .prev.d { background: #0b0b0b; } .theme-opt .prev.d i { background: #191919; }
.theme-opt .prev.s { background: linear-gradient(90deg, #fff 50%, #0b0b0b 50%); }
.theme-opt .prev.s i { background: transparent; }
.theme-opt span { font-weight: 500; }
.attr-list { display: grid; }
.attr-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 6px; border-bottom: 1px solid var(--line); min-width: 0; }
.attr-item:last-child { border-bottom: 0; }
.attr-item .an { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attr-item .at { color: var(--fg-3); font-size: var(--fs-sm); white-space: nowrap; }
.opt-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) 28px; gap: 8px; align-items: center; }
.opt-row .grip { color: var(--fg-4); cursor: grab; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); min-width: 0; flex-wrap: wrap; }
.member:last-child { border-bottom: 0; }
.member .mm { flex: 1; min-width: 160px; display: grid; }
.member .mm b { font-weight: 600; }
.member .mm span { color: var(--fg-3); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.dot-on { width: 7px; height: 7px; border-radius: 50%; background: var(--fg); display: inline-block; box-shadow: 0 0 0 3px var(--sel-strong); }
.link-box { display: flex; gap: 6px; align-items: center; }
.link-box input { font-family: var(--mono); font-size: var(--fs-sm); }
.import-map { display: grid; gap: 6px; }
.import-map .imr { display: grid; grid-template-columns: minmax(0, 1fr) 20px minmax(0, 1fr); gap: 8px; align-items: center; }
.import-map .imr .src { font-family: var(--mono); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 6px 8px; background: var(--bg-sub); border-radius: 6px; }
.dropzone { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 26px; display: grid; justify-items: center; gap: 8px; color: var(--fg-3); text-align: center; transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone:hover, .dropzone.over { border-color: var(--fg); background: var(--bg-sub); color: var(--fg); }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--bg-sub); overflow-y: auto; height: 100%; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 28px 26px 24px; display: grid; gap: 16px; animation: modalIn .4s var(--ease-out); }
.auth-brand { display: flex; align-items: center; gap: 10px; }
.auth-brand .ws-mark { width: 30px; height: 30px; font-size: 15px; border-radius: 8px; }
.auth-brand b { font-size: var(--fs-lg); letter-spacing: -.03em; }
.auth-card h1 { margin: 6px 0 0; font-size: var(--fs-xl); letter-spacing: -.03em; font-weight: 600; }
.auth-card p { margin: -8px 0 0; color: var(--fg-3); }
.auth-card .btn { height: 36px; }
.err { color: var(--fg); font-weight: 500; font-size: var(--fs-sm); display: flex; gap: 6px; align-items: center; background: var(--bg-hover); padding: 8px 10px; border-radius: var(--r); animation: shake .35s var(--ease); }
@keyframes shake { 20% { transform: translateX(-4px) } 40% { transform: translateX(4px) } 60% { transform: translateX(-2px) } 80% { transform: translateX(2px) } }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--bg-hover) 0%, var(--bg-active) 50%, var(--bg-hover) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: 5px; height: 12px; }
@keyframes sk { to { background-position: -200% 0 } }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- responsive ---------- */
.drawer-scrim { display: none; }
@media (max-width: 1100px) {
  .rec { grid-template-columns: minmax(0, 1fr) 300px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .home-cols { grid-template-columns: minmax(0, 1fr); }
  .rec { grid-template-columns: minmax(0, 1fr); }
  .rec-main { border-right: 0; }
  .attrs { border-top: 1px solid var(--line); order: 2; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .set-nav { border-right: 0; border-bottom: 1px solid var(--line); display: flex; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
  .set-nav .nav-item { width: auto; white-space: nowrap; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; top: 0; bottom: 0; left: 0; width: min(290px, 84vw); z-index: 90; transform: translateX(-102%); transition: transform .3s var(--ease-out); box-shadow: var(--shadow-3); }
  .shell.drawer .side { transform: none; }
  .drawer-scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 85; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .shell.drawer .drawer-scrim { opacity: 1; pointer-events: auto; }
  .burger { display: inline-flex; }
  .topbar { padding: 0 10px; gap: 6px; }
  .top-actions .hide-sm { display: none; }
  .vbar { padding: 8px 12px; gap: 6px; }
  .vsearch { width: 100%; order: 10; }
  .home { padding: 18px 16px 50px; gap: 18px; }
  .home-head h1 { font-size: 22px; }
  .kpi .v { font-size: 22px; }
  .rec-head { padding: 16px 16px 0; }
  .rec-body { padding: 16px 16px 50px; }
  .tabs { padding: 0 10px; }
  .hl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hl > div:nth-child(3n) { border-right: 1px solid var(--line); }
  .hl > div:nth-child(2n) { border-right: 0; }
  .hl > div:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .hl > div:nth-last-child(-n+2) { border-bottom: 0; }
  .arow { grid-template-columns: 116px minmax(0, 1fr); }
  .page-pad { padding: 16px 16px 50px; }
  .set-body { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .fb-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; }
  .fb-row .w { display: none; }
  .fb-row .fb-v { grid-column: 1 / 3; }
  .scrim { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; animation: sheetIn .32s var(--ease-out); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .scrim.closing .modal { animation: sheetOut .2s var(--ease) forwards; }
  @keyframes sheetIn { from { transform: translateY(100%) } to { transform: none } }
  @keyframes sheetOut { to { transform: translateY(100%) } }
  .col { width: 82vw; }
  .gc.first { max-width: 58vw; }
  #toasts { right: 50%; transform: translateX(50%); justify-items: center; }
  .theme-pick { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .crumbs a.hide-sm, .crumbs .sep.hide-sm { display: none; }
}
@media (max-width: 420px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 12px; }
  .arow { grid-template-columns: 104px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.pop.pop-wide { max-width: min(660px, calc(100vw - 16px)); }
.pop.pop-wide .fb { overflow-y: auto; }
#app { height: 100%; }
.topbar .burger { display: none; }
@media (max-width: 820px) { .topbar .burger { display: inline-flex; } }
.av img { opacity: 0; transition: opacity .2s; }
.av img.ok { opacity: 1; }
.next-task .t { white-space: nowrap; }
.hl .v .next-task { align-items: flex-start; }
.hl .v .next-task .t { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 820px) { .vbar .btn .t { display: none; } .vbar .btn[data-filter], .vbar .btn[data-sort], .vbar .btn[data-cols], .vbar .btn[data-kset] { padding: 0 8px; } }
.clamp6 { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 820px) { .hl .v .next-task { flex-wrap: wrap; gap: 4px; } .hl .v .next-task .t { flex-basis: 100%; } }

.av.co:has(img.ok) { background: #fff; box-shadow: 0 0 0 1px var(--line); }

/* ---------- collapsible sidebar (desktop) ---------- */
.side-collapse, .side-expand { color: var(--fg-3); }
.side-collapse:hover, .side-expand:hover { color: var(--fg); }
.side-expand { display: none; }
@media (min-width: 821px) {
  .shell { grid-template-columns: auto minmax(0, 1fr); }
  .side { width: var(--side); overflow: hidden; transition: width .4s var(--ease); }
  .side-head, .side-scroll, .side-foot { width: var(--side); flex-shrink: 0; }
  .side-scroll { overflow-x: hidden; }
  .side-head { padding-left: 12px; transition: padding .4s var(--ease); }
  .side-head .side-collapse { flex: none; opacity: 0; transition: opacity .2s, background .12s; }
  .side:hover .side-head .side-collapse, .side-collapse:focus-visible { opacity: 1; }
  .side-search { width: calc(var(--side) - 24px); transition: width .4s var(--ease), padding .4s var(--ease), margin .4s var(--ease), box-shadow .15s, color .15s; }
  .nav-item { width: calc(var(--side) - 16px); transition: width .4s var(--ease), padding .4s var(--ease), background .12s, color .12s; }
  .nav-sub .nav-item { width: calc(var(--side) - 30px); }
  .nav-item .nl, .side-search .nl, .side-search .kbd, .ws-name, .me-name, .nav-item .count, .nav-sec-title, .side-foot > a { transition: opacity .22s ease .12s; }
  .me { transition: padding .4s var(--ease), background .12s; }

  .shell.collapsed .side { width: 52px; }
  .shell.collapsed .side-head { padding-left: 8px; }
  .shell.collapsed .side-search { width: 36px; margin-left: 8px; margin-right: 8px; padding-left: 10px; }
  .shell.collapsed .nav-item { width: 36px; padding: 0 10px; }
  .shell.collapsed .nav-sub { grid-template-rows: 0fr; opacity: 0; } .shell.collapsed .nav-act, .shell.collapsed .nav-add, .shell.collapsed .nav-empty { display: none; }
  .shell.collapsed .me { padding-left: 8px; }
  .shell.collapsed .nav-item .nl, .shell.collapsed .side-search .nl, .shell.collapsed .side-search .kbd, .shell.collapsed .ws-name,
  .shell.collapsed .me-name, .shell.collapsed .nav-item .count, .shell.collapsed .nav-sec-title, .shell.collapsed .side-foot > a,
  .shell.collapsed .side-head .side-collapse { opacity: 0; transition-delay: 0s; transition-duration: .12s; pointer-events: none; }
  .shell.collapsed .nav-item .count.hot { opacity: 1; position: absolute; left: 25px; top: 6px; width: 8px; height: 8px; padding: 0; font-size: 0; border-radius: 50%; box-shadow: 0 0 0 2px var(--bg-sub); }
  .shell.collapsed .side-expand { display: inline-flex; animation: fadeIn .3s var(--ease) .15s both; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }

/* iPhone: no zoom on double tap; inputs at 16px so Safari never zooms on focus */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
@media (max-width: 820px), (pointer: coarse) {
  input, textarea, select, .input, .select, .textarea, .pop-search input, .quick-add input, .palette .pinput input, .cell-input { font-size: 16px !important; }
}

img.ws-mark { object-fit: cover; padding: 0; background: #0b0b0b; display: block; box-shadow: 0 0 0 1px var(--line-strong); }

/* ---------- outreach bot ---------- */
.bot-home { display: grid; gap: 22px; }
.bdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--g3); margin-right: 8px; flex: none; }
.bdot.ok { background: #2f9e55; box-shadow: 0 0 0 3px rgba(47,158,85,.18); } .bdot.paused { background: #d9a21b; } .bdot.down { background: #d0463c; } .bdot.unknown { background: var(--g3); }
.kpi .v.bstat { display: flex; align-items: center; font-size: 17px; letter-spacing: -.02em; line-height: 1.5; min-height: 40px; }
.pill.bstat { display: inline-flex; align-items: center; }
.bcard { background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-lg); padding: 12px; display: grid; gap: 8px; min-width: 0; }
.bc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bc-kind { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--fg-2); }
.bc-age { font-size: var(--fs-xs); } .bc-title { font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.bc-recs { display: flex; gap: 6px; flex-wrap: wrap; } .bc-why { display: flex; gap: 6px; flex-wrap: wrap; } .bc-sum { color: var(--fg-2); font-size: var(--fs-sm); }
.bc-to { font-size: var(--fs-sm); } .bc-text { width: 100%; min-height: 80px; padding: 8px 10px; resize: vertical; font-family: var(--font); line-height: 1.45; height: auto; }
.bc-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bc-warn { background: var(--bg-hover); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 8px 10px; font-size: var(--fs-sm); }
.bot-tag { height: 18px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.chat { display: grid; gap: 8px; max-height: 340px; overflow: auto; padding: 4px 2px; }
.bubble { padding: 8px 11px; border-radius: 12px; max-width: 86%; display: grid; gap: 3px; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble small { color: inherit; opacity: .6; font-size: var(--fs-xs); }
.bubble.me { justify-self: end; background: var(--ink); color: var(--ink-fg); border-bottom-right-radius: 4px; }
.bubble.bot { justify-self: start; background: var(--bg-hover); border-bottom-left-radius: 4px; }
@media (max-width: 820px) { .bubble { max-width: 94%; } }
.bot-home .fb2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.bot-home .fitem .row { display: none; }


/* ---------- tap feedback ---------- */
a, button, [role="button"], label { -webkit-tap-highlight-color: transparent; }
.nav-item:active, .nav-add:active, .nav-empty:active, .side-search:active, .me:active, .ws:active, .chip:active, .seg button:active, .mi:active, .theme-opt:active, .tab:active, .pipe-legend a:active, .fn-row:active, .more-row:active { scale: .965; }
.mini-row:active, .kpi:active, .trow:active, .kcard:active, .note-card:active, .rec-chip:active, .ib-item:active, .iss:active, .nt-row:active, .ng-head:active, .fold-panel > .panel-head:active, .fitem:active { scale: .985; }
.kcard.ghost:active { scale: 1; }
.nav-item, .mini-row, .kpi, .trow, .iss, .ib-item, .nt-row, .ng-head, .fn-row, .more-row, .nav-add, .nav-empty, .fold-panel > .panel-head { transition: background .18s var(--ease), color .18s var(--ease), scale .22s var(--spring), width .4s var(--ease), padding .4s var(--ease); }

/* ---------- sidebar: groups, pinned, row actions ---------- */
.nav-row { position: relative; display: flex; align-items: center; }
.nav-row .nav-item { flex: 1; min-width: 0; }
.shell:not(.collapsed) .nav-group > .nav-row > .nav-item { padding-right: 30px; }
.nav-item .nl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nav-item .svg { flex: none; }
.nav-item .count { transition: opacity .15s; }
.nav-act { width: 22px; height: 22px; border-radius: 5px; display: inline-grid; place-items: center; color: var(--fg-3); flex: none; opacity: 0; transition: opacity .15s, background .12s, color .12s, scale .22s var(--spring); }
.nav-act:hover { background: var(--bg-active); color: var(--fg); }
.nav-act:active { scale: .85; }
.nav-act.on { opacity: 1; color: var(--fg); }
.nav-act.on .svg { fill: currentColor; }
.nav-caret { position: absolute; right: 4px; top: 4px; opacity: .55; }
.nav-caret .svg { transition: transform .3s var(--ease-out); }
.nav-group:not(.open) .nav-caret .svg { transform: rotate(-90deg); }
.nav-row:hover .nav-caret, .nav-row:focus-within .nav-caret { opacity: 1; }
.nav-acts { position: absolute; right: 3px; top: 3px; display: flex; gap: 1px; }
.nav-row:hover .nav-act, .nav-row:focus-within .nav-act { opacity: 1; }
.nav-row:hover .nav-item .count:not(.hot), .nav-row:focus-within .nav-item .count:not(.hot) { opacity: 0; }
.nav-group > .nav-row:hover .nav-item .count { opacity: 1; }
.nav-sub { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .34s var(--ease-out), opacity .24s ease; }
.nav-group.open > .nav-sub { grid-template-rows: 1fr; opacity: 1; }
.nav-sub-in { overflow: hidden; min-height: 0; padding-left: 14px; position: relative; }
.nav-sub-in::before { content: ""; position: absolute; left: 15px; top: 2px; bottom: 2px; width: 1px; background: var(--line-strong); }
.nav-group:not(.open) .nav-sub-in { visibility: hidden; transition: visibility 0s .34s; }
.nav-sub .nav-item { height: 27px; font-weight: 400; padding-left: 10px; font-size: var(--fs); gap: 8px; }
.nav-sub .nav-item .svg { color: var(--fg-4); }
.nav-sub .nav-item.on .svg { color: var(--fg-2); }
.nav-add { display: flex; align-items: center; gap: 8px; height: 27px; padding: 0 10px; border-radius: var(--r); color: var(--fg-4); width: 100%; text-align: left; font-size: var(--fs-sm); }
.nav-add:hover { background: var(--bg-hover); color: var(--fg-2); }
.nav-empty { display: block; width: 100%; text-align: left; padding: 6px 8px; color: var(--fg-4); font-size: var(--fs-sm); line-height: 1.4; border-radius: var(--r); }
.nav-empty:hover { color: var(--fg-3); background: var(--bg-hover); }
.nav-sec-title .nav-act.top { opacity: 0; margin-right: -2px; }
.nav-sec:hover .nav-act.top, .nav-sec-title .nav-act.top:focus-visible { opacity: 1; }
@media (hover: none) {
  .nav-act { opacity: 1; }
  .nav-row.sub .nav-item .count:not(.hot) { opacity: 0; }
  .nav-act.top { opacity: 1 !important; }
}

/* ---------- inbox ---------- */
.bell { position: relative; }
.bell .svg { transform-origin: 50% 8%; }
.bell-n { position: absolute; top: 1px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ink); color: var(--ink-fg); font: 600 9.5px/16px var(--mono); text-align: center; box-shadow: 0 0 0 2px var(--panel); animation: badgePop .4s var(--spring); pointer-events: none; }
.bell.ring .svg { animation: ring .9s var(--ease) both; }
@keyframes badgePop { from { scale: 0; } to { scale: 1; } }
@keyframes ring { 0% { rotate: 0deg; } 12% { rotate: 16deg; } 28% { rotate: -13deg; } 44% { rotate: 9deg; } 60% { rotate: -6deg; } 76% { rotate: 3deg; } 100% { rotate: 0deg; } }
.pop.pop-inbox { width: min(400px, calc(100vw - 16px)); max-width: none; padding: 0; overflow: hidden; }
.inbox { display: flex; flex-direction: column; max-height: min(560px, calc(100vh - 80px)); }
.ib-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ib-head b { font-weight: 600; font-size: var(--fs-md); }
.ib-head .grow { flex: 1; }
.ib-list { overflow-y: auto; min-height: 64px; }
.ib-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) 8px; gap: 10px; align-items: start; width: 100%; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ib-item:last-child { border-bottom: 0; }
.ib-item:hover { background: var(--bg-sub); }
.ib-ic { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--fg-2); background: var(--panel); }
.ib-item.new .ib-ic { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.ib-m { display: grid; gap: 1px; min-width: 0; }
.ib-m b { font-weight: 500; overflow-wrap: anywhere; }
.ib-item:not(.new) .ib-m b { font-weight: 400; color: var(--fg-2); }
.ib-m span { color: var(--fg-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.ib-m small { color: var(--fg-3); font-size: var(--fs-xs); }
.ib-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; }
.ib-item.new .ib-dot { background: var(--ink); }
.ib-empty { display: grid; justify-items: center; gap: 4px; padding: 28px 24px; color: var(--fg-3); text-align: center; }
.ib-empty b { color: var(--fg); font-weight: 600; }
.ib-empty .svg { width: 22px; height: 22px; margin-bottom: 4px; }
.ib-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--fg-3); background: var(--bg-sub); }
.ib-foot:empty { display: none; }
.ib-foot a:hover { color: var(--fg); }

/* ---------- folding ---------- */
.fold { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .34s var(--ease-out); }
.fold-in { overflow: hidden; min-height: 0; }
.closed > .fold { grid-template-rows: 0fr; }
.closed > .fold > .fold-in { visibility: hidden; transition: visibility 0s .34s; }
.fold-chev { display: inline-grid; place-items: center; color: var(--fg-3); transition: transform .3s var(--ease-out); flex: none; }
.closed > [data-foldhead] .fold-chev { transform: rotate(-90deg); }
[data-foldhead] { cursor: pointer; user-select: none; }
.fold-panel > .panel-head { transition: border-color .3s, background .18s var(--ease), scale .22s var(--spring); }
.fold-panel > .panel-head:hover { background: var(--bg-sub); }
.fold-panel.closed > .panel-head { border-bottom-color: transparent; }
.panel-head .btn.sm { margin-right: -4px; }
.group-title[data-foldhead] { padding: 8px 14px 4px; cursor: pointer; }
.group-title[data-foldhead]:hover { color: var(--fg-2); }
.group-title .svg { transition: transform .3s var(--ease-out); color: var(--fg-4); }
.closed > .group-title .svg { transform: rotate(-90deg); }
.more-row { display: block; width: 100%; text-align: center; padding: 9px; color: var(--fg-3); font-size: var(--fs-sm); border-top: 1px solid var(--line); }
.more-row:hover { background: var(--bg-sub); color: var(--fg); }
.more-note { padding: 8px 14px; font-size: var(--fs-sm); text-align: center; }

/* ---------- home ---------- */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 22px; min-width: 0; align-content: start; }
.seg.sm button { height: 22px; padding: 0 8px; font-size: var(--fs-sm); }
.dl { font-family: var(--mono); font-size: var(--fs-sm); white-space: nowrap; }
.dl.good { color: var(--ok); } .dl.bad { color: var(--bad); } .dl.flat { color: var(--fg-3); }
.kpi .s .dl { margin-right: 2px; }
/* chart */
.chart { padding: 12px 14px 12px; }
.ch-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-sm); color: var(--fg-3); margin-bottom: 14px; }
.ch-legend .sw { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }
.sw.out { background: var(--ink); } .sw.in { background: var(--g3); } .sw.bad { background: var(--bad); border-radius: 50%; width: 7px; height: 7px; }
.ch-wrap { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px; height: 188px; }
.ch-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; font: 10.5px/1 var(--mono); color: var(--fg-4); padding-bottom: 20px; }
.ch-plot { position: relative; min-width: 0; }
.ch-grid { position: absolute; inset: 0 0 20px 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.ch-grid i { height: 1px; background: var(--line); }
.ch-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; }
.ch-col { position: relative; min-width: 0; border-radius: 6px; outline-offset: -1px; transition: background .15s; }
.ch-col:hover, .ch-col:focus-visible { background: var(--bg-hover); }
.ch-bars { position: absolute; left: 0; right: 0; top: 0; bottom: 20px; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 2px; }
.ch-bar { position: relative; width: min(15px, 46%); height: var(--h); border-radius: 3px 3px 0 0; transform-origin: bottom; }
.ch-bar.out { background: var(--ink); } .ch-bar.in { background: var(--g3); }
.ch-bar em { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font: 600 10px/1.4 var(--mono); font-style: normal; color: var(--fg-2); }
.ch-x { position: absolute; left: 0; right: 0; bottom: 0; height: 20px; line-height: 20px; text-align: center; font: 10.5px/20px var(--mono); color: var(--fg-3); }
.ch-col.today .ch-x { color: var(--fg); font-weight: 600; }
.ch-flag { position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.ch-col::after { content: attr(data-tip); position: absolute; top: -6px; left: 50%; transform: translate(-50%, -100%); background: var(--ink); color: var(--ink-fg); padding: 5px 8px; border-radius: 6px; font-size: 11.5px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5; box-shadow: var(--shadow-2); }
.ch-col:nth-child(-n+3)::after { left: 0; transform: translate(0, -100%); }
.ch-col:nth-last-child(-n+3)::after { left: auto; right: 0; transform: translate(0, -100%); }
.ch-col:hover::after, .ch-col:focus::after { opacity: 1; }
.ch-empty { text-align: center; color: var(--fg-3); padding-top: 8px; font-size: var(--fs-sm); }
.home.animate .ch-bar { animation: barUp .7s var(--ease-out) both; animation-delay: calc(var(--i) * 26ms); }
@keyframes barUp { from { transform: scaleY(0); } to { transform: none; } }
/* funnel */
.funnel { display: grid; padding: 8px 8px 0; }
.fn-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) 34px 40px; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 7px; }
.fn-row:hover { background: var(--bg-hover); }
.fn-bar { height: 10px; border-radius: 5px; background: var(--bg-hover); overflow: hidden; }
.fn-bar i { display: block; height: 100%; width: var(--w); background: var(--ink); border-radius: 5px; transform-origin: left; }
.home.animate .fn-bar i { animation: barRight .8s var(--ease-out) both; animation-delay: calc(var(--i) * 80ms); }
@keyframes barRight { from { transform: scaleX(0); } to { transform: none; } }
.fn-row b { text-align: right; font-weight: 600; }
.fn-p { text-align: right; font-size: var(--fs-sm); }
.fn-note { margin: 0; padding: 4px 14px 12px; font-size: var(--fs-sm); }
/* report */
.rp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rp { padding: 12px 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 2px; align-content: start; min-width: 0; }
.rp:nth-child(3n) { border-right: 0; }
.rp:nth-last-child(-n+3) { border-bottom: 0; }
.rp .k { color: var(--fg-3); font-size: var(--fs-sm); }
.rp .v { font-size: 22px; font-weight: 600; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.rp .v small { font-size: 13px; color: var(--fg-3); font-weight: 400; letter-spacing: 0; }
.rp .s { font-size: var(--fs-sm); color: var(--fg-3); }
.rp-note { margin: 0; padding: 8px 14px 10px; border-top: 1px solid var(--line); font-size: var(--fs-sm); }
/* issues */
.iss { display: flex; align-items: flex-start; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.iss:hover { background: var(--bg-sub); }
.iss .bdot { margin-top: 5px; }
.iss .im { flex: 1; min-width: 0; display: grid; gap: 1px; }
.iss b { font-weight: 500; overflow-wrap: anywhere; }
.iss small { color: var(--fg-3); overflow-wrap: anywhere; }
.iss .ms { font-size: var(--fs-sm); white-space: nowrap; margin-left: 10px; margin-top: 2px; }
.iss.ok { cursor: default; } .iss.ok:hover { background: none; } .iss.ok:active { scale: 1; }
.spark { padding: 12px 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; font-size: var(--fs-sm); }
.sp-bars { display: flex; align-items: flex-end; gap: 3px; height: 30px; flex: none; }
.sp-bars i { width: 6px; height: max(3px, var(--h)); background: var(--bg-active); border-radius: 2px; }
.sp-bars i.w { background: var(--g4); } .sp-bars i.e { background: var(--bad); }
/* needs */
.needs { display: grid; }
.ng + .ng { border-top: 1px solid var(--line); }
.ng-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; min-height: 48px; }
.ng-head:hover { background: var(--bg-sub); }
.ng.mine > .ng-head { background: var(--bg-sub); }
.ng-head b { font-weight: 600; white-space: nowrap; }
.ng-sum { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.nt { border-top: 1px solid var(--line); }
.nt-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; text-align: left; }
.nt-row:hover { background: var(--bg-sub); }
.nt-ic { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--fg-2); flex: none; background: var(--panel); }
.nt-m { flex: 1; min-width: 0; display: grid; }
.nt-m b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-m small { color: var(--fg-3); font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-age { font-size: var(--fs-sm); white-space: nowrap; }
.nt .fold { grid-template-rows: 0fr; }
.nt.open > .fold { grid-template-rows: 1fr; }
.nt:not(.open) > .fold > .fold-in { visibility: hidden; transition: visibility 0s .34s; }
.nt .fold-chev { transform: rotate(-90deg); }
.nt.open .fold-chev { transform: none; }
.nt .fold-in > .bcard { margin: 2px 14px 14px; }
.panel-empty .sk { height: 12px; }
@media (max-width: 820px) {
  .rp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp:nth-child(3n) { border-right: 1px solid var(--line); } .rp:nth-child(2n) { border-right: 0; }
  .rp:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); } .rp:nth-last-child(-n+2) { border-bottom: 0; }
  .ch-wrap { height: 164px; }
  .ng-sum { display: none; }
  .home-head { align-items: center; }
}

/* =====================================================================
   Hub skin: restyles the CRM components with Knopa Hub's look.
   Page = paper (--bg), surfaces = --panel, one violet accent, keycap-like buttons, dog logo.
   ===================================================================== */
body { background: var(--bg); color: var(--text); font-size: 14px; }
::selection { background: var(--focus); color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
h1, h2, h3, h4 { letter-spacing: -.01em; }
.main, .content, .topbar { background: var(--bg); }
.num, .mono { font-family: var(--mono); font-size: .92em; letter-spacing: 0; }
.display { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; }
::-webkit-scrollbar-thumb { background: var(--border-2); border: 3px solid transparent; background-clip: content-box; }

/* logo: the dog only, a mask that follows the text colour */
.mark-dog { display: inline-block; background: currentColor; -webkit-mask: url(/brand/dog.png) center / contain no-repeat; mask: url(/brand/dog.png) center / contain no-repeat; flex: none; width: 26px; aspect-ratio: 398 / 414; }
.boot { color: var(--text); }
.boot .mark-dog { width: 44px; animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.boot-mark { display: none; }

/* buttons: flat keys with a lively hover */
.btn { height: 34px; padding: 0 13px; border-radius: var(--r); border: 1px solid var(--border-2); background: var(--panel); box-shadow: none; font-weight: 550; font-size: 13px; transition: background .16s, border-color .16s, color .16s, box-shadow .2s var(--ease), transform .18s var(--ease), scale .22s var(--spring); }
.btn:hover { background: var(--bg-sub); border-color: var(--text-3); transform: translateY(-1px); box-shadow: 0 5px 14px -7px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn:active { transform: none; scale: .97; box-shadow: none; background: var(--active); }
.btn .svg { transition: transform .22s var(--ease); }
.btn:hover .svg { transform: scale(1.1) rotate(-4deg); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.primary:hover { background: var(--ink-2); opacity: 1; border-color: var(--accent); box-shadow: 0 8px 20px -10px var(--accent); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: var(--accent-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; transform: none; box-shadow: none; }
.btn.ghost:hover .svg { transform: none; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); box-shadow: none; }
.btn.danger.primary { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.icon { width: 34px; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn.sm.icon { width: 28px; }
.btn.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn .badge { background: var(--accent); color: #fff; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; }

.input, .select, .textarea { height: 36px; border-radius: var(--r); border-color: var(--border-2); background: var(--panel); font-size: 13.5px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238f8c84' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 12px; padding-right: 30px; }
.field > label, .label { font-weight: 550; }
.seg { background: var(--bg-sunk); }
.seg button { height: 28px; border-radius: 7px; font-weight: 550; font-size: 12.5px; }
.seg button:hover:not(.on) { background: var(--hover); }
.seg button.on { background: var(--panel); box-shadow: var(--shadow-sm); }
.seg.sm button { height: 24px; }
.chip { border-color: var(--border-2); background: var(--panel); font-weight: 550; }
.chip:hover { border-color: var(--text-3); }
.chip.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.check { border-color: var(--border-2); border-width: 1.5px; }
.check.on { background: var(--accent); border-color: var(--accent); }
.check svg { color: #fff; }
.kbd { font: 500 11px var(--font); height: 19px; display: inline-flex; align-items: center; border-radius: 5px; border-color: var(--border-2); background: transparent; }
.pill.ink { background: var(--accent); color: #fff; }
.pill.status.won { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill { border-radius: 6px; font-weight: 550; }
.av { color: #fff; background: var(--c-grey); font-weight: 650; }
.av.p0 { background: var(--c-red); color: #fff; } .av.p1 { background: var(--c-orange); color: #fff; } .av.p2 { background: var(--c-amber); color: #fff; } .av.p3 { background: var(--c-green); color: #fff; }
.av.p4 { background: var(--c-teal); color: #fff; } .av.p5 { background: var(--c-blue); color: #fff; } .av.p6 { background: var(--c-violet); color: #fff; } .av.p7 { background: var(--c-pink); color: #fff; }
.av.s1, .av.s2, .av.s3, .av.s4, .av.s5 { background: var(--c-slate); color: #fff; }
.av.co { color: var(--text); background: var(--bg-sunk); }
.av.co.p0, .av.co.p1, .av.co.p2, .av.co.p3, .av.co.p4, .av.co.p5, .av.co.p6, .av.co.p7 { color: #fff; }
.av.sys { background: var(--ink); color: var(--on-ink); }

/* shell + sidebar */
.shell { height: 100vh; height: 100dvh; }
.side { background: var(--bg-sub); border-right: 1px solid var(--border); }
.side-head { padding: 14px 12px 10px 18px; min-height: 58px; }
.ws { gap: 10px; }
.ws:hover { background: transparent; }
.ws .mark-dog { width: 28px; color: var(--text); transition: transform .3s var(--ease); }
.ws:hover .mark-dog { transform: rotate(-6deg) scale(1.06); }
.ws-name { font: 600 14px var(--display); letter-spacing: -.01em; line-height: 1.1; }
.ws-name small { font: 500 11.5px var(--font); color: var(--text-3); display: block; margin: 2px 0 0; letter-spacing: 0; }
.side-search { margin: 2px 10px 8px; height: 34px; border-radius: var(--r); background: var(--panel); border: 1px solid var(--border); box-shadow: none; width: calc(100% - 20px); }
.side-search:hover { border-color: var(--border-2); box-shadow: none; }
.nav-sec-title { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; padding: 14px 10px 5px; }
.nav-item { height: 33px; border-radius: 8px; padding: 0 10px 0 11px; font-weight: 520; font-size: 13.5px; color: var(--text-2); }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.nav-item.on::before { content: ''; position: absolute; left: -8px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-sub .nav-item { height: 30px; font-size: 13px; }
.nav-sub .nav-item.on::before { left: -22px; }
.nav-item .count { font-family: var(--font); font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item .count.hot { background: var(--accent); color: #fff; font-weight: 650; min-width: 18px; text-align: center; }
.nav-sub-in::before { background: var(--border-2); }
.side-foot { border-top: 1px solid var(--border); }
.me:hover, .nav-act:hover { background: var(--hover); }
.nav-act.on .svg { fill: var(--accent); color: var(--accent); }
.shell.collapsed .nav-item.on::before { left: -8px; }
.shell.collapsed .nav-item .count.hot { background: var(--accent); }
/* one fold button, like Hub: the app icon sits at the top left; folded, hovering the head swaps it for the unfold button */
.side-head { position: relative; }
.ws .app-mark { width: 30px; height: 30px; border-radius: 8px; flex: none; display: block; transition: opacity .16s, transform .3s var(--ease); }
.ws:hover .app-mark { transform: rotate(-6deg) scale(1.06); }
.side-peek { display: none; }
@media (min-width: 821px) {
  .side-peek { display: flex; position: absolute; left: 8px; top: 15px; width: 32px; height: 32px; border-radius: 9px; align-items: center; justify-content: center; color: var(--text-2); opacity: 0; pointer-events: none; transition: opacity .16s, background .12s; }
  .side-peek:hover { background: var(--hover); color: var(--text); }
  .side-peek svg { width: 17px; height: 17px; }
  .shell.collapsed .side-head:hover .ws .app-mark { opacity: 0; transform: scale(.8); }
  .shell.collapsed .side-head:hover .side-peek { opacity: 1; pointer-events: auto; }
}

/* top bar + pages */
.topbar { height: 56px; padding: 0 18px 0 24px; gap: 10px; }
.crumbs { font-size: 15px; font-weight: 650; }
.crumbs a { font-weight: 520; }
.bell-n { background: var(--accent); color: #fff; font-family: var(--font); box-shadow: 0 0 0 2px var(--bg); }
.vbar { padding: 10px 24px; background: var(--bg); }
.view-switch { font-weight: 650; }
.home { max-width: 1240px; margin: 0; padding: 28px 24px 80px; gap: 24px; }
.page-pad { max-width: 1240px; margin: 0; padding: 28px 24px 80px; }
.home-head h1, .page-title h1, .set-body h2 { font-family: var(--display); font-weight: 600; letter-spacing: -.025em; }
.home-head h1 { font-size: 26px; line-height: 1.15; }
.page-title h1, .set-body h2 { font-size: 24px; }
.home-head p { color: var(--text-2); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; border: 0; border-radius: 0; overflow: visible; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-lg) !important; border-right: 1px solid var(--border) !important; border-bottom: 1px solid var(--border) !important; padding: 15px 16px 14px; }
.kpi:hover { background: var(--panel); border-color: var(--border-2); }
.kpi .k { font-weight: 550; color: var(--text-2); }
.kpi .v { font: 600 26px/1.1 var(--display); letter-spacing: -.03em; margin-top: 4px; }
.kpi .v.bstat { font: 600 15px/1.4 var(--display); }
.kpi .v small { font: 500 14px var(--font); color: var(--text-3); }
.panel, .box, .note-card, .set-card, .bcard, .hl { background: var(--panel); border-color: var(--border); border-radius: var(--r-lg); }
.panel-head { padding: 14px 16px; }
.panel-head h3, .sect-head h3, .attrs-head h3, .set-card h3 { font-size: 14px; font-weight: 650; }
.group-title { letter-spacing: .06em; }
.empty .ei { background: var(--bg-sunk); border: 0; border-radius: 13px; width: 46px; height: 46px; }
.empty h4 { font-size: 14px; }
.tabs { background: var(--bg); }
.tab.on::after { background: var(--accent); }
.tab { font-weight: 550; }
.rec-main { border-right-color: var(--border); }
.attrs { background: var(--bg-sub); }
.rec-name { font-family: var(--display); font-weight: 600; letter-spacing: -.02em; }
.rec-name:focus { box-shadow: 0 0 0 2px var(--accent); }
.mini-row:hover, .trow:hover, .iss:hover, .ng-head:hover, .nt-row:hover, .ib-item:hover, .more-row:hover { background: var(--hover); }
.note-card:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.dot-on { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.link-box input { font-family: var(--mono); }

/* table */
.grid-wrap { background: var(--panel); }
.gc { background: var(--panel); }
.gh .gc { background: var(--bg-sub); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.gh .gc:hover { background: var(--active); }
.gr:hover .gc { background: var(--bg-sub); }
.gr.sel .gc { background: var(--accent-soft); }
.gr.sel .gc.first, .gr.sel .gc.chk { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.gc.editing { box-shadow: inset 0 0 0 2px var(--accent) !important; }
.gc.editable:hover { box-shadow: inset 0 0 0 1px var(--border-2); }
.resize:hover::after, .resize.on::after { background: var(--accent); }
.gfoot { background: var(--bg-sub); }
.due.over { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.due.today { border: 0; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.due { font-family: var(--font); font-size: 11.5px; }
.bulk { background: var(--ink); color: var(--on-ink); border-radius: var(--r-lg); }

/* kanban */
.col { background: var(--bg-sub); border-color: var(--border); }
.col.over { background: var(--accent-soft); border-color: var(--accent); }
.col-head .cnt, .col-head .sum { font-family: var(--font); font-variant-numeric: tabular-nums; }
.kcard { background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.kcard:hover { border-color: var(--border-2); box-shadow: var(--shadow); }
.kph { border-color: var(--accent); background: var(--accent-soft); }

/* menus, pickers, popovers */
.pop { background: var(--elev); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 5px; animation: popIn .16s var(--ease); }
.pop.closing { animation: popOut .12s var(--ease-out) forwards; }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes popOut { to { opacity: 0; transform: translateY(4px) scale(.985); } }
.mi { height: auto; min-height: 32px; border-radius: 7px; font-size: 13px; }
.mi:hover, .mi.hl { background: var(--hover); }
.mi .svg { color: var(--text-2); }
.mi.danger, .mi.danger .svg { color: var(--bad); }
.mhead { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; padding: 7px 9px 4px; }
.pop-search { border-bottom-color: var(--border); }

/* modals */
.scrim { background: var(--overlay); padding-top: max(6vh, 20px); }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: modalIn .24s var(--ease); }
@keyframes modalIn { from { transform: translateY(6px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes modalOut { to { transform: translateY(4px) scale(.985); opacity: 0; } }
.modal-head h2 { font-size: 16px; font-weight: 650; }
.modal-body { padding: 12px 18px 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--bg-sub); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.palette .pinput { border-bottom-color: var(--border); }

/* toasts */
#toasts { left: 50%; right: auto; transform: translateX(-50%); justify-items: center; }
.toast { border-radius: var(--r); font-size: 13px; font-weight: 520; }

/* inbox */
.ib-item.new .ib-ic { background: var(--accent); border-color: var(--accent); color: #fff; }
.ib-item.new .ib-dot { background: var(--accent); }
.ib-foot { background: var(--bg-sub); }

/* home widgets / bot */
.ch-bar.out, .sw.out { background: var(--accent); }
.ch-bar.in, .sw.in { background: var(--border-2); }
.fn-bar i { background: var(--accent); }
.ch-col.today .ch-x { color: var(--accent-text); }
.ch-col::after { background: var(--ink); color: var(--on-ink); }
.bdot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); } .bdot.paused { background: var(--warn); } .bdot.down { background: var(--bad); }
.bubble.me { background: var(--accent); color: #fff; }
.bubble.bot { background: var(--bg-sunk); }
.bcard { border-color: var(--border); }
.bc-warn { background: var(--warn-soft); border-color: transparent; }
.err { background: var(--bad-soft); color: var(--bad); }
.spark, .sp-bars i.w { }
.sp-bars i.w { background: var(--warn); }
.pipe-bar { background: var(--bg-sunk); }

/* auth */
.auth { background: var(--bg); }
.auth-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); }
.auth-brand .mark-dog { width: 34px; }
.auth-brand b { font: 600 15px var(--display); letter-spacing: -.01em; }
.auth-card h1 { font: 600 22px var(--display); letter-spacing: -.02em; }

/* bottom tab bar (phone) */
.botnav, .sb-handle { display: none; }
@media (max-width: 820px) {
  html, body { overscroll-behavior: none; }
  .btn { height: 40px; } .btn.sm { height: 36px; } .btn.icon { width: 40px; } .btn.sm.icon { width: 36px; }
  .topbar { padding: 0 10px; height: 52px; }
  .content { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .home, .page-pad { padding: 16px 14px 28px; }
  .home-head h1 { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 12px; } .kpi .v { font-size: 20px; }
  .side { width: min(86vw, 320px); }
  .botnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; gap: 2px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px)); background: color-mix(in srgb, var(--bg) 94%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-top: 1px solid var(--border); transition: transform .2s var(--ease); }
  .bn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 10px; font-size: 10.5px; font-weight: 550; color: var(--text-3); position: relative; transition: scale .22s var(--spring), color .15s; }
  .bn:active { scale: .92; }
  .bn .svg { width: 21px; height: 21px; } .bn.on { color: var(--text); } .bn.on .svg { color: var(--accent); }
  .bn span.t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bn .bn-n { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 650; line-height: 16px; text-align: center; }
  body:has(.scrim) .botnav { transform: translateY(110%); }
  #toasts { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 24px); }
  .scrim { align-items: flex-end; padding: 0; }
  .modal, .modal.wide { max-width: 100%; width: 100%; max-height: 92dvh; border-radius: 18px 18px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-foot { border-radius: 0; }
  .sb-handle { display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 8px auto 0; flex: none; }
  .tab { height: 44px; }
  .tbl-wrap, .grid-wrap { -webkit-overflow-scrolling: touch; }
}
html, body { max-width: 100%; }
body { overflow-x: hidden; }

/* ---------- «Бот» page: dashboard + mini chat window ---------- */
.bot-page { display: grid; gap: 20px; align-content: start; }
.bot-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; }
.bh-t { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.bh-t h1 { margin: 0; font: 600 24px/1.15 var(--display); letter-spacing: -.025em; }
.bh-a { display: flex; gap: 8px; }
.bh-s { grid-column: 1 / -1; margin: 0; }
.bot-kpis .meter { margin-top: 6px; }
.bot-kpis .kpi .v small { font-size: 13px; }
.bot-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.bot-col { display: grid; gap: 20px; min-width: 0; align-content: start; }
.bp .panel-head .svg { color: var(--text-3); }
.bp-body { padding: 16px; display: grid; gap: 14px; }
.bp-body .form-grid { gap: 12px; }
.bp-save { display: flex; }
.bp .panel-empty { padding: 28px 16px; }
.bp .more-note { padding: 0; }
.bot-tasks { display: grid; gap: 10px; margin: -4px; padding: 4px; }
.bp .mini-row { padding: 9px 0; cursor: default; border-bottom: 1px solid var(--border); }
.bp .mini-row:hover { background: transparent; }
.bp .mini-row:last-child { border-bottom: 0; }
.bp .bi { gap: 8px; }
.bp .check { display: inline-flex; align-items: center; gap: 8px; width: auto; height: auto; border: 0; background: none; font-size: 13px; cursor: pointer; }
.bp .check input, .bi input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.bp .row { display: flex; gap: 8px; flex-wrap: nowrap; }
.bp .row .input { flex: 1; min-width: 0; }

/* chat: a compact window in the corner (desktop) / bottom sheet (phone) */
.botchat { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 380px; max-width: calc(100vw - 32px); height: min(560px, calc(100dvh - 110px)); display: none; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.botchat.open { display: flex; animation: modalIn .24s var(--ease); }
.bc-bar { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-sub); flex: none; }
.bc-bar .mark-dog { width: 20px; }
.bc-bar b { font-weight: 650; font-size: 14px; }
.bc-bar .bstat { height: 20px; font-size: 11px; padding: 0 6px; }
.bc-bar .grow { flex: 1; }
.botchat .chat { flex: 1; max-height: none; padding: 14px; align-content: start; overflow-y: auto; }
.chat-empty { display: grid; justify-items: center; gap: 6px; text-align: center; color: var(--text-3); padding: 40px 16px; }
.chat-empty .mark-dog { width: 34px; color: var(--text-3); opacity: .6; margin-bottom: 4px; }
.chat-empty b { color: var(--text); font-size: 14px; }
.bc-form { display: flex; gap: 8px; padding: 10px 12px 6px; flex: none; }
.bc-form .input { flex: 1; min-width: 0; }
.bc-hint { padding: 0 14px 12px; flex: none; }
.botchat-fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 52px; height: 52px; border-radius: 50%; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; box-shadow: var(--shadow-lg); transition: transform .18s var(--ease), box-shadow .2s; }
.botchat-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -8px var(--accent); }
.botchat-fab:active { transform: scale(.94); }
.botchat-fab .svg { width: 22px; height: 22px; }
.botchat-fab.hidden { display: none; }
.bcf-n { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font: 650 11px/18px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.botchat-scrim { display: none; }
@media (max-width: 1100px) { .bot-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) {
  .bot-head { grid-template-columns: minmax(0, 1fr); }
  .bh-t h1 { font-size: 22px; }
  .bh-a .btn { flex: 1; }
  .bh-a [data-chatopen] { display: none; }
  .bp-body { padding: 14px; }
  .botchat { left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 82dvh; border-radius: 18px 18px 0 0; border-bottom: 0; z-index: 130; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .botchat.open { animation: sheetIn .32s var(--ease); }
  .botchat-fab { right: 14px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .botchat-scrim.on { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 125; animation: fade .2s var(--ease); }
  body:has(.botchat.open) .botnav { transform: translateY(110%); }
  .bc-form .input { font-size: 16px; }
}

/* settings sub-menu: items fill their own column (the sidebar's fixed item width made the active one spill over the divider) */
.set-nav { min-width: 0; }
.set-nav .nav-item { width: 100%; max-width: 100%; transition: background .15s, color .15s; }
.set-nav .nav-item.on::before { left: -9px; }
.set-body { overflow-wrap: anywhere; }
.set-card { overflow: hidden; }
@media (max-width: 900px) {
  .set-nav { gap: 4px; }
  .set-nav .nav-item { width: auto; flex: none; }
  .set-nav .nav-item.on::before { display: none; }
}
@media (max-width: 900px) { .settings { align-content: start; grid-auto-rows: max-content; } .set-nav { align-self: start; } }

/* ---------- simple mode (Компанії, картка компанії, Чекає вас, Звіт, Бот) ---------- */
/* centered, and wide enough when the browser is zoomed out */
.simple { width: 100%; max-width: 1360px; }
.home, .page-pad { margin-left: auto; margin-right: auto; }
.simple > * { min-width: 0; }
.sc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.sc-n { margin-left: 6px; color: var(--fg-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.seg button.on .sc-n { color: var(--fg-2); }
.sc-search { position: relative; width: 240px; max-width: 100%; }
.sc-search .svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-3); pointer-events: none; }
.sc-search .input { padding-left: 30px; }
.sc-list { overflow: hidden; }
.sc-row { display: grid; grid-template-columns: 38px minmax(170px, 1.3fr) 104px minmax(200px, 2.2fr) 56px minmax(150px, 1.2fr); align-items: center; gap: 10px; padding: 10px 14px 10px 8px; border-top: 1px solid var(--line); min-width: 0; cursor: pointer; transition: background .12s; }
.sc-row:first-child { border-top: 0; }
.sc-row:hover { background: var(--bg-sub); }
.sc-row.sel { background: var(--accent-soft); }
.sc-row.hot .sc-now { color: var(--fg); font-weight: 550; }
.sc-head { cursor: default; font-size: var(--fs-sm); color: var(--fg-3); font-weight: 550; padding-top: 8px; padding-bottom: 8px; }
.sc-head:hover { background: transparent; }
.sc-c { display: grid; place-items: center; height: 28px; cursor: pointer; }
.sc-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sc-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-head .sc-name { font-weight: 550; }
.sc-now { min-width: 0; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-ppl { display: inline-flex; align-items: center; gap: 5px; color: var(--fg-2); }
.sc-last { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-sm); }
.sc-confirm p { margin: 0 0 10px; color: var(--fg-2); } .sc-confirm p b { color: var(--fg); }
.sc-warn { color: var(--warn) !important; }
.sc-add { display: grid; gap: 10px; } .sc-add .textarea { height: auto; padding: 8px 10px; resize: vertical; font-family: var(--font); }
.sc-add p { margin: 0 0 6px; }

.sc-top { display: flex; }
.sc-title { align-items: center; flex-wrap: wrap; row-gap: 12px; }
.sc-tt { flex: 1; min-width: 220px; display: grid; gap: 6px; }
.sc-tt h1 { margin: 0; font-size: 24px; font-family: var(--display); font-weight: 600; letter-spacing: -.025em; overflow-wrap: anywhere; }
.sc-nowline { font-size: var(--fs); }
.sc-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.sc-steps li { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--fg-3); font-weight: 550; }
.sc-steps li::before { content: ''; height: 4px; border-radius: 2px; background: var(--bg-active); }
.sc-steps li.done::before { background: var(--ink); } .sc-steps li.done { color: var(--fg-2); }
.sc-steps li.now::before { background: var(--accent); } .sc-steps li.now { color: var(--accent-text); }
.sc-steps i { display: none; }
.sc-sum { white-space: pre-line; color: var(--fg-2); overflow-wrap: anywhere; }
.sc-sum.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.sc-person { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.sc-person:first-child { border-top: 0; } .sc-person:hover { background: var(--bg-sub); }
.sp-m { flex: 1; min-width: 0; display: grid; gap: 3px; }
.sp-n { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; } .sp-n b { font-weight: 600; }
.sp-s { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: var(--fs-sm); min-width: 0; overflow-wrap: anywhere; }
.sp-a { display: flex; gap: 6px; flex: none; }
.sc-hist { display: flex; gap: 10px; align-items: flex-start; padding: 9px 14px; border-top: 1px solid var(--line); }
.sc-hist:first-child { border-top: 0; }
.sh-i { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--fg-2); flex: none; background: var(--panel); }
.sh-m { flex: 1; min-width: 0; overflow-wrap: anywhere; } .sh-t { font-size: var(--fs-sm); } .sh-a { font-size: var(--fs-sm); white-space: nowrap; }
.sc-details > summary { display: flex; align-items: center; gap: 8px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 650; font-size: var(--fs-md); }
.sc-details > summary::-webkit-details-marker { display: none; }
.sc-details > summary .svg { transition: transform .2s var(--ease); transform: rotate(-90deg); }
.sc-details[open] > summary .svg { transform: none; }
.sc-details[open] > summary { border-bottom: 1px solid var(--line); }
.sc-kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; padding: 6px 0; overflow-wrap: anywhere; }

@media (max-width: 820px) {
  .simple { padding-left: 16px; padding-right: 16px; }
  .sc-head { display: none; }
  .sc-row { grid-template-columns: 34px minmax(0, 1fr) max-content; grid-template-areas: "c name st" ". now now" ". ppl last"; row-gap: 4px; padding: 11px 12px 11px 6px; }
  .sc-c { grid-area: c; } .sc-name { grid-area: name; } .sc-st { grid-area: st; justify-self: end; } .sc-now { grid-area: now; white-space: normal; } .sc-ppl { grid-area: ppl; } .sc-last { grid-area: last; text-align: right; }
  .sc-search { width: 100%; }
  .sc-bar .seg { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; } .sc-bar .seg button { flex: none; }
  .sc-steps li span { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sc-person { flex-wrap: wrap; } .sp-a { width: 100%; padding-left: 38px; }
  .sc-kv { grid-template-columns: 110px minmax(0, 1fr); }
  .sc-actions .btn { flex: 1; }
}
.sr-status { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.sr-st { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); min-width: 0; transition: background .15s; }
.sr-st:hover { background: var(--bg-sub); }
.sr-st .k, .sr-tile .k { color: var(--fg-3); font-size: var(--fs-sm); font-weight: 500; }
.sr-st .v { font-size: 20px; font-weight: 600; letter-spacing: -.03em; display: flex; align-items: center; }
.sr-st .s { color: var(--fg-2); font-size: var(--fs); overflow-wrap: anywhere; }
.sr-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.sr-tile { display: grid; gap: 3px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); min-width: 0; align-content: start; }
.sr-tile .v { font-size: 28px; font-weight: 600; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sr-tile .s { color: var(--fg-3); font-size: var(--fs-sm); }
.sr-note { margin: 0; font-size: var(--fs-sm); }
@media (max-width: 820px) { .sr-status { grid-template-columns: minmax(0, 1fr); } .sr-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .sr-tile .v { font-size: 24px; } }
.simple .fn-row { grid-template-columns: 110px minmax(0, 1fr) 34px 4px; }
.bot-simple .sb-now { display: grid; gap: 4px; } .sb-line { font-size: 18px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.bot-simple .bot-kpis { margin: 0; }
.bot-embedded { display: grid; gap: 16px; }
@media (max-width: 820px) { .bot-simple .page-title .bstat { order: 2; } }
.bot-simple form.row { flex-wrap: nowrap; margin-top: 10px; } .bot-simple form.row .input { flex: 1; min-width: 0; }

/* tutorial */
.tour-modal { max-width: 460px; }
.tour { display: grid; gap: 10px; text-align: left; padding: 6px 2px 2px; }
.tour-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.tour-ic .svg { width: 24px; height: 24px; }
.tour h2 { margin: 4px 0 0; font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.tour p { margin: 0; color: var(--fg-2); line-height: 1.55; font-size: var(--fs-md); }
.tour-dots { display: flex; gap: 6px; margin-top: 8px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--bg-active); transition: width .2s var(--ease), background .2s; }
.tour-dots i.past { background: var(--fg-4); } .tour-dots i.on { width: 20px; border-radius: 4px; background: var(--accent); }
.sb-todo { margin: 0 0 10px; padding-left: 18px; display: grid; gap: 6px; color: var(--fg-2); }
.bot-simple { padding-bottom: 100px; }

/* bot screen = chat */
.botc { max-width: 1360px; }
.bc-tabs { display: none; }
.bc-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.bc-chat { display: flex; flex-direction: column; height: calc(100dvh - 210px); min-height: 420px; max-height: 860px; overflow: hidden; }
.bc-now { padding: 12px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 2px; }
.bc-line { font-size: 17px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.bc-stream { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: grid; gap: 8px; align-content: start; scroll-behavior: smooth; }
.bc-ev { display: flex; align-items: center; gap: 4px; justify-self: start; max-width: 94%; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); font-size: var(--fs); color: var(--fg-2); overflow-wrap: anywhere; }
.bc-ev .bdot { margin-right: 6px; } .bc-ev small { margin-left: 8px; opacity: .6; font-size: var(--fs-xs); white-space: nowrap; }
.bc-ev.error { border-color: var(--bad); color: var(--fg); } .bc-ev.warn { border-color: var(--warn); color: var(--fg); }
.bc-typing { font-size: var(--fs-sm); padding-left: 4px; }
.bc-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px 0; }
.chip { height: 28px; padding: 0 11px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--fg-2); font-size: var(--fs-sm); font-weight: 550; transition: background .15s, color .15s; }
.chip:hover { background: var(--bg-hover); color: var(--fg); }
.bc-form2 { display: flex; gap: 8px; padding: 10px 16px 14px; } .bc-form2 .input { flex: 1; min-width: 0; height: 40px; }
.bc-form2 .btn.icon { width: 40px; height: 40px; }
.bc-needs { max-height: calc(100dvh - 210px); overflow-y: auto; }
.bc-task + .bc-task { margin-top: 12px; } .bc-who { font-size: var(--fs-sm); margin-bottom: 4px; }
.bc-needs .bcard { margin: 0; }
@media (max-width: 1100px) { .bc-grid { grid-template-columns: minmax(0, 1fr); } .bc-needs { max-height: none; } }
@media (max-width: 820px) {
  .bc-tabs { display: inline-flex; align-self: start; }
  .bc-grid[data-tab="chat"] .bc-needs, .bc-grid[data-tab="needs"] .bc-chat { display: none; }
  .bc-chat { height: calc(100dvh - 300px); min-height: 360px; }
  .botc .page-title .sc-actions { width: 100%; } .botc .page-title .sc-actions .seg { flex: 1; } .botc .page-title .sc-actions .seg button { flex: 1; }
}
.botc .seg { flex-wrap: nowrap; } .botc .seg button { white-space: nowrap; }

/* company tiles */
.stg { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; border: 1px solid var(--line-strong); background: var(--panel); font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; }
.stg i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc, var(--c-grey)); flex: none; }
.stg.dim { color: var(--fg-3); }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.st-tile { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); min-width: 0; }
.st-tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.st-tile.hot { border-color: var(--ink); }
.st-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.st-nm { flex: 1; min-width: 0; display: grid; } .st-nm b { font-size: var(--fs-lg); font-weight: 650; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .st-nm .muted { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-ppl { display: flex; gap: 6px; flex-wrap: wrap; font-size: var(--fs-sm); min-height: 22px; align-items: center; }
.st-chip { height: 22px; padding: 0 8px; border-radius: 11px; background: var(--bg-hover); display: inline-flex; align-items: center; font-weight: 550; color: var(--fg-2); }
.st-chip.hot { background: var(--ink); color: var(--ink-fg); } .st-chip.ok { background: var(--ok-soft); color: var(--ok); }
.st-now { color: var(--fg); font-weight: 550; line-height: 1.35; overflow-wrap: anywhere; }
.st-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; margin-top: auto; padding-top: 4px; }
.st-foot .btn { flex: none; }
.st-now { min-height: 2.7em; }
.st-last { font-size: var(--fs-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* company page tabs and people table */
.sc-tabs { align-self: start; }
.sp-bar { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.sp-bar .seg { max-width: 100%; }
.sp-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp-tools .sc-search { width: 190px; } .sp-sort { width: auto; height: 32px; }
.pt-row { display: grid; grid-template-columns: 34px minmax(150px, 1.4fr) 80px 56px 112px 108px minmax(110px, 1fr) 176px; gap: 10px; align-items: center; padding: 9px 14px 9px 8px; border-top: 1px solid var(--line); min-width: 0; }
.pt-row:first-child { border-top: 0; } .pt-row:not(.pt-head):hover { background: var(--bg-sub); cursor: pointer; } .pt-row.sel { background: var(--hover); }
.pt-head { font-size: var(--fs-sm); color: var(--fg-3); font-weight: 550; border-top: 0; }
.pt-row .sp-a { justify-content: flex-end; }
.pt-c { display: grid; place-items: center; height: 28px; cursor: pointer; }
.pt-n { display: flex; gap: 9px; align-items: center; min-width: 0; } .pt-nn { display: grid; min-width: 0; } .pt-nn b, .pt-nn .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pt-nn .muted { font-size: var(--fs-sm); }
.pt-ch { display: flex; gap: 8px; color: var(--fg-2); }
.pt-cn, .pt-sq, .pt-ls { font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-desc { height: auto; padding: 10px 12px; margin: 10px 0; resize: vertical; line-height: 1.5; font-family: var(--font); }
@media (max-width: 1400px) { .pt-row { grid-template-columns: 34px minmax(150px, 1.4fr) 56px 112px 108px minmax(100px, 1fr) 176px; } .pt-cn, .pt-head span:nth-child(3) { display: none; } }
@media (max-width: 1100px) { .pt-row { grid-template-columns: 34px minmax(140px, 1.4fr) 112px minmax(90px, 1fr) 176px; } .pt-ch, .pt-sq, .pt-head span:nth-child(4), .pt-head span:nth-child(6) { display: none; } }
@media (max-width: 820px) {
  .st-grid { grid-template-columns: minmax(0, 1fr); }
  .pt-head { display: none; }
  .pt-row { grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "c n st" ". sq sq" ". ls ls" ". a a"; row-gap: 4px; }
  .pt-c { grid-area: c; } .pt-n { grid-area: n; } .pt-st { grid-area: st; } .pt-sq { grid-area: sq; } .pt-ls { grid-area: ls; white-space: normal; } .pt-row .sp-a { grid-area: a; width: auto; padding-left: 0; }
  .pt-cn, .pt-ch { display: none; }
  .sp-tools { width: 100%; } .sp-tools .sc-search { flex: 1; width: auto; } .sp-bar .seg { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; } .sp-bar .seg button { flex: none; }
}

.cc-chat { height: min(560px, calc(100dvh - 330px)); min-height: 340px; }

/* thread picker under the bot chat */
.bc-threads { display: flex; gap: 6px; align-items: center; padding: 8px 16px 0; overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; border-top: 1px solid var(--line); }
.bc-threads[hidden] { display: none; } .bc-threads .chip { flex: none; } .bc-th-l { font-size: var(--fs-sm); flex: none; margin-right: 2px; }
.chip.on { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }

/* the report under the bot chat (one page instead of two tabs) */
.bc-report { margin-top: 28px; display: grid; gap: 16px; }
.bc-report .page-title h2 { margin: 0; flex: 1; font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.025em; }
.botc .bc-chat { height: min(560px, calc(100dvh - 210px)); }
.botc .bc-needs { max-height: 560px; overflow-y: auto; }
@media (max-width: 1100px) { .botc .bc-needs { max-height: none; } }

/* bot page: one calm row above the input (chat picker + commands) and a single Auto switch */
.bc-pick { display: flex; gap: 6px; align-items: center; padding: 8px 16px 0; border-top: 1px solid var(--line); min-width: 0; }
.bc-pick > span { display: inline-flex; min-width: 0; } .bc-pick > span[hidden] { display: none; }
.bc-pick .chip { max-width: 100%; } .bc-thn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.bc-auto { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 4px 0 2px; color: var(--fg-2); font-weight: 500; cursor: pointer; }
.bc-auto .sw { width: 36px; height: 20px; border-radius: 10px; background: var(--line-strong); position: relative; transition: background .18s; flex: none; }
.bc-auto .sw i { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow-1); transition: transform .2s var(--spring, ease); }
.bc-auto[aria-checked="true"] { color: var(--fg); } .bc-auto[aria-checked="true"] .sw { background: var(--accent); } .bc-auto[aria-checked="true"] .sw i { transform: translateX(16px); background: #fff; }

/* bot settings tab + reply-check card */
.bs-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.bs-save { display: flex; gap: 10px; align-items: center; } .bs-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.set-card .field.full { display: grid; gap: 6px; } .set-card .hint { color: var(--fg-3); font-size: var(--fs-sm); }
.pf-list { display: grid; gap: 8px; } .pf-row { display: grid; grid-template-columns: 1.2fr 1.4fr 1.4fr 110px 1fr 32px; gap: 6px; align-items: center; }
@media (max-width: 900px) { .pf-row { grid-template-columns: minmax(0, 1fr) 32px; } .pf-row .input, .pf-row .select { grid-column: 1; } .pf-row [data-rm] { grid-column: 2; grid-row: 1; } }
.bc-people { display: grid; gap: 6px; } .bc-person { display: flex; gap: 8px; align-items: center; } .bc-pn { display: grid; flex: 1; min-width: 0; } .bc-pn .muted { font-size: var(--fs-sm); }
.bs-head .lead { margin: 6px 0 0; max-width: 560px; }
.bs-head h2 { margin: 0; }

.bc-why2 { font-size: var(--fs-sm); color: var(--fg-2); background: var(--bg-hover); border-radius: var(--r); padding: 6px 10px; }
