/* Wivo CRM — "ledger" design language.
   Calm, dense, information-first: warm neutral greys, ink-black primary actions, one cobalt accent for focus and
   links, hairline rules instead of floating cards, tabular numbers, 6px corners. No gradients, glows or glass. */

:root {
  --font: "Inter var", Inter, -apple-system, "SF Pro Text", system-ui, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --side-w: 228px;
  --top-h: 52px;
  --r: 6px; --r-sm: 5px; --r-lg: 8px;

  color-scheme: light;
  --bg: #fbfbfa;
  --side: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f6f6f4;
  --surface-3: #ededea;
  --hover: rgba(28, 25, 23, .045);
  --press: rgba(28, 25, 23, .08);
  --line: #e8e7e3;
  --line-2: #d9d7d2;
  --ink: #1c1b19;
  --ink-2: #57534e;
  --ink-3: #8f8a84;
  --primary: #1c1b19;          /* primary buttons are ink, not colour */
  --on-primary: #ffffff;
  --primary-hover: #34312d;
  --accent: #2f54eb;           /* focus rings, links, selection */
  --accent-soft: rgba(47, 84, 235, .09);
  --accent-ink: #2442c4;
  --danger: #c8321e;
  --danger-soft: rgba(200, 50, 30, .08);
  --ok: #18794e;
  --warn: #a35a00;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px rgba(47, 84, 235, .55);
  --pop: 0 1px 2px rgba(28, 25, 23, .06), 0 12px 32px -8px rgba(28, 25, 23, .18), 0 0 0 1px var(--line-2);
  --bar: #1c1b19; --bar-track: #ecebe7;

  --slate: #64748b; --gray: #8a8580; --red: #d1432b; --orange: #dc6c13; --amber: #c99400; --green: #2f9e64;
  --teal: #13958a; --cyan: #0e93b5; --blue: #2f6fe0; --violet: #7357e0; --pink: #d0438a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0e; --side: #111112; --surface: #151516; --surface-2: #1a1a1c; --surface-3: #232326;
    --hover: rgba(255, 255, 255, .045); --press: rgba(255, 255, 255, .08); --line: #242427; --line-2: #313135;
    --ink: #ececec; --ink-2: #a5a5aa; --ink-3: #6f6f75;
    --primary: #ececec; --on-primary: #111112; --primary-hover: #ffffff;
    --accent: #6c8cff; --accent-soft: rgba(108, 140, 255, .12); --accent-ink: #8ea6ff;
    --danger: #f06a55; --danger-soft: rgba(240, 106, 85, .1); --ok: #4cc38a; --warn: #e3a33b;
    --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(108, 140, 255, .6);
    --pop: 0 16px 40px -10px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2);
    --bar: #ececec; --bar-track: #242427;
    --slate: #8b9ab0; --gray: #8f8f95; --red: #f06a55; --orange: #f08a3c; --amber: #e3b43b; --green: #4cc38a;
    --teal: #3cc4b4; --cyan: #3ab6d6; --blue: #6c9bff; --violet: #9d86ff; --pink: #f06aa8;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0e; --side: #111112; --surface: #151516; --surface-2: #1a1a1c; --surface-3: #232326;
  --hover: rgba(255, 255, 255, .045); --press: rgba(255, 255, 255, .08); --line: #242427; --line-2: #313135;
  --ink: #ececec; --ink-2: #a5a5aa; --ink-3: #6f6f75;
  --primary: #ececec; --on-primary: #111112; --primary-hover: #ffffff;
  --accent: #6c8cff; --accent-soft: rgba(108, 140, 255, .12); --accent-ink: #8ea6ff;
  --danger: #f06a55; --danger-soft: rgba(240, 106, 85, .1); --ok: #4cc38a; --warn: #e3a33b;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(108, 140, 255, .6);
  --pop: 0 16px 40px -10px rgba(0, 0, 0, .7), 0 0 0 1px var(--line-2);
  --bar: #ececec; --bar-track: #242427;
  --slate: #8b9ab0; --gray: #8f8f95; --red: #f06a55; --orange: #f08a3c; --amber: #e3b43b; --green: #4cc38a;
  --teal: #3cc4b4; --cyan: #3ab6d6; --blue: #6c9bff; --violet: #9d86ff; --pink: #f06aa8;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg); color: var(--ink); font: 13.5px/1.5 var(--font); letter-spacing: -.006em;
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
::selection { background: var(--accent-soft); }
.num, td, .k-v { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); }
.small { font-size: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
svg.i.s { width: 13px; height: 13px; }
svg.i.l { width: 16px; height: 16px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 520; font-size: 13px; white-space: nowrap; color: var(--ink);
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn:active { background: var(--surface-3); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12.5px; gap: 5px; }
.btn.icon { width: 30px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.kbd { font: 500 10.5px/1 var(--mono); padding: 2px 5px; border-radius: 4px; border: 1px solid var(--line-2); border-bottom-width: 2px; color: var(--ink-3); background: var(--surface); }

.inp, .sel, .ta {
  height: 30px; padding: 0 9px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--surface);
  outline: none; transition: border-color .12s, box-shadow .12s; min-width: 0; font-size: 13px;
}
.inp:hover, .sel:hover, .ta:hover { border-color: color-mix(in srgb, var(--line-2) 50%, var(--ink-3)); }
.inp:focus, .sel:focus, .ta:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp::placeholder, .ta::placeholder { color: var(--ink-3); }
.ta { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.55; width: 100%; }
.sel { padding-right: 26px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 14px) 13px, calc(100% - 10px) 13px; background-size: 4px 4px; background-repeat: no-repeat; }
.inp.err, .ta.err { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.field-err { color: var(--danger); font-size: 12px; margin-top: 4px; }
.field-err a { text-decoration: underline; }
label.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
input[type="checkbox"], input[type="radio"] { width: 14px; height: 14px; accent-color: var(--ink); margin: 0; cursor: pointer; }

/* ---------- stage / tag / status marks ---------- */
.c-slate { --c: var(--slate); } .c-gray { --c: var(--gray); } .c-red { --c: var(--red); } .c-orange { --c: var(--orange); }
.c-amber { --c: var(--amber); } .c-green { --c: var(--green); } .c-teal { --c: var(--teal); } .c-cyan { --c: var(--cyan); }
.c-blue { --c: var(--blue); } .c-violet { --c: var(--violet); } .c-pink { --c: var(--pink); }
/* stage: a small square swatch + the name in ink — readable, never colour alone */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 7px 0 6px; border-radius: var(--r-sm); font-size: 12px; font-weight: 520;
  background: transparent; color: var(--ink); white-space: nowrap; border: 1px solid var(--line-2);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--slate)); flex: none; }
.pill.plain::before { display: none; }
.pill.plain { border-color: transparent; background: var(--surface-2); color: var(--ink-2); }
button.pill { cursor: pointer; }
button.pill:hover { background: var(--hover); }
.pill.flag { background: var(--danger-soft); color: var(--danger); border-color: transparent; font-weight: 600; }
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 11.5px; font-weight: 520;
  background: color-mix(in srgb, var(--c, var(--slate)) 11%, transparent); color: color-mix(in srgb, var(--c, var(--slate)) 62%, var(--ink)); white-space: nowrap;
}
.tag button { border: 0; background: none; padding: 0; margin-right: -2px; color: inherit; opacity: .55; display: inline-flex; }
.tag button:hover { opacity: 1; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.temp { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; letter-spacing: .01em; }
.temp.hot { color: var(--danger); } .temp.warm { color: var(--warn); } .temp.cold { color: var(--blue); }
.av {
  width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 10px; font-weight: 650; flex: none; letter-spacing: .02em;
  background: color-mix(in srgb, var(--c, var(--slate)) 16%, var(--surface)); color: color-mix(in srgb, var(--c, var(--slate)) 70%, var(--ink));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, var(--slate)) 22%, transparent);
}
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.sm { width: 20px; height: 20px; font-size: 9px; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; font-variant-numeric: tabular-nums; }
.badge.soft { background: var(--surface-3); color: var(--ink-2); }
.badge.warn { background: var(--danger); color: #fff; }
.agent { font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); border: 1px solid var(--line-2); padding: 0 4px; border-radius: 3px; margin-left: 5px; line-height: 15px; display: inline-block; vertical-align: 1px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; background: var(--side); border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 10px 8px; gap: 1px; z-index: 20; overflow-y: auto;
}
.logo { display: flex; align-items: center; gap: 9px; padding: 4px 8px 14px; font: 650 14.5px/1 var(--font); letter-spacing: -.01em; }
.logo img { width: 22px; height: 22px; border-radius: 6px; }
.logo small { font: 500 11px/1 var(--font); color: var(--ink-3); margin-left: auto; }
.side-label { font: 600 10.5px/1 var(--font); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: 14px 8px 6px; }
.nav { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 8px; border-radius: var(--r); color: var(--ink-2); font-weight: 500; position: relative; }
.nav:hover { background: var(--hover); color: var(--ink); }
.nav.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .04); font-weight: 560; }
.nav .badge { margin-left: auto; background: transparent; color: var(--ink-3); font-weight: 560; }
.nav .badge.warn { background: var(--danger); color: #fff; }
.nav .dot { width: 7px; height: 7px; border-radius: 2px; background: var(--c, var(--ink-3)); margin: 0 4px 0 4px; }
.side .spacer { flex: 1; min-height: 12px; }
.side .me { display: flex; align-items: center; gap: 9px; padding: 10px 8px 4px; border-top: 1px solid var(--line); margin-top: 6px; }
.side .me .nm { font-weight: 560; font-size: 12.5px; line-height: 1.2; }
.side .me .rl { font-size: 11.5px; color: var(--ink-3); text-transform: capitalize; }
.side .me .btn { margin-left: auto; }
.side .me .btn + .btn { margin-left: 0; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 15; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 22px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.top h1 { font: 620 15px/1 var(--font); letter-spacing: -.01em; margin: 0; display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.top h1 .count { font: 500 12.5px/1 var(--font); color: var(--ink-3); }
.top .grow { flex: 1; }
.search-trigger {
  display: flex; align-items: center; gap: 8px; height: 30px; width: min(300px, 32vw); padding: 0 6px 0 10px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); cursor: text; font-size: 13px;
}
.search-trigger:hover { border-color: color-mix(in srgb, var(--line-2) 50%, var(--ink-3)); }
.search-trigger span { flex: 1; text-align: left; }
.page { padding: 20px 22px 64px; max-width: 1440px; width: 100%; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); opacity: .8; }
.live-dot.pulse { animation: pulse 1.2s var(--ease); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 50%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }

/* sections: hairline-ruled blocks, not floating cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 11px 14px 9px; min-height: 42px; }
.card-h h2, .card-h h3 { margin: 0; font: 600 13px/1.2 var(--font); letter-spacing: -.003em; }
.card-h .act { margin-left: auto; display: flex; gap: 4px; }
.card-b { padding: 2px 14px 14px; }
.empty { padding: 22px 14px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.empty b { display: block; color: var(--ink-2); font-weight: 560; margin-bottom: 2px; font-size: 13px; }
.sec-title { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 0 0 8px; }

/* ---------- today: a work queue ---------- */
.hello { margin: 0 0 16px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.hello h2 { font: 640 20px/1.2 var(--font); letter-spacing: -.02em; margin: 0; }
.hello .sub { font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px 13px; text-align: left; border: 0; border-right: 1px solid var(--line); background: transparent; transition: background .12s; min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi:hover { background: var(--hover); }
.kpi .k-l { font-size: 12px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.kpi .k-l svg { color: var(--ink-3); }
.kpi .k-v { font: 620 22px/1.15 var(--font); letter-spacing: -.02em; margin-top: 4px; }
.kpi .k-h { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.alert .k-v { color: var(--danger); }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.today-grid > div { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.row-link { display: flex; align-items: center; gap: 11px; padding: 9px 14px; border-top: 1px solid var(--line); min-width: 0; transition: background .1s; }
.row-link:hover { background: var(--hover); }
.row-link .grow { flex: 1; min-width: 0; }
.row-link .t1 { font-weight: 560; }
.row-link .t2 { font-size: 12px; color: var(--ink-3); }
.quote { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; border-left: 2px solid var(--line-2); padding-left: 8px; }
.pipe-row { display: grid; grid-template-columns: 128px minmax(0, 1fr) 34px 72px; align-items: center; gap: 10px; padding: 5px 14px; font-size: 12.5px; }
.pipe-row:hover { background: var(--hover); }
.pipe-row .bar { height: 6px; border-radius: 0 3px 3px 0; background: var(--bar); }
.pipe-row .track { background: var(--bar-track); border-radius: 0 3px 3px 0; height: 6px; overflow: hidden; }
.pipe-row .v { text-align: right; color: var(--ink-3); font-size: 11.5px; }
.pipe-row .pill { border: 0; padding: 0; height: auto; }

/* ---------- filters / table ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.filters .inp.search { width: 232px; padding-left: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%238f8a84' stroke-width='2' stroke-linecap='round' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px 50%; }
.chip-f { height: 28px; padding: 0 9px; border-radius: var(--r); border: 1px dashed var(--line-2); background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 5px; }
.chip-f:hover { background: var(--hover); color: var(--ink); }
.chip-f.on { border-style: solid; border-color: var(--ink); background: var(--surface); color: var(--ink); font-weight: 560; }
.chip-f .n { color: var(--ink-3); font-weight: 560; }
.dd-menu {
  position: fixed; z-index: 60; min-width: 220px; max-height: 340px; overflow: auto; padding: 4px;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--pop); animation: pop .14s var(--ease);
}
.dd-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: var(--r-sm); border: 0; background: none; text-align: left; font-size: 13px; color: var(--ink); }
.dd-item:hover, .dd-item.act, .dd-item:focus-visible { background: var(--hover); box-shadow: none; }
.dd-item .chk { width: 14px; color: var(--ink); display: inline-flex; }
.dd-item.danger { color: var(--danger); }
.dd-item .pill { border: 0; padding: 0; height: auto; }
.dd-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.dd-search { width: 100%; margin-bottom: 4px; }
.tbl-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: clip; }
table.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tbl th {
  position: sticky; top: var(--top-h); z-index: 5; text-align: left; font-size: 11.5px; font-weight: 560; color: var(--ink-3); padding: 0 10px; height: 34px;
  background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--ink); }
.tbl th .arr { font-size: 9px; margin-left: 4px; color: var(--ink); }
.tbl td { padding: 0 10px; height: 46px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 13px; overflow: hidden; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; transition: background .08s; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr.sel { background: var(--accent-soft); }
.tbl tbody tr:focus-visible { box-shadow: inset 2px 0 0 var(--accent); border-radius: 0; background: var(--hover); }
.tbl td.ck, .tbl th.ck { width: 38px; padding-left: 14px; padding-right: 0; }
.tbl td .tags { flex-wrap: nowrap; overflow: hidden; }
.tbl td .pill { border-color: transparent; padding-left: 0; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-person .nm { font-weight: 560; }
.cell-person .ti { font-size: 12px; color: var(--ink-3); }
.cell-person .flag { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex: none; box-shadow: 0 0 0 3px var(--danger-soft); }
.touch { display: flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 12.5px; }
.touch .dir-in { color: var(--ok); display: inline-flex; } .touch .dir-out { color: var(--ink-3); display: inline-flex; }
.due { font-size: 12px; }
.due.over { color: var(--danger); font-weight: 560; }
.due.today { color: var(--warn); font-weight: 560; }
.bulkbar {
  position: sticky; bottom: 16px; z-index: 30; margin: 12px auto 0; width: fit-content; max-width: 100%; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 6px 6px 6px 14px; border-radius: var(--r-lg); background: var(--ink); color: var(--bg); box-shadow: var(--pop); animation: up .2s var(--ease);
}
.bulkbar .n { font-weight: 600; margin-right: 8px; font-size: 12.5px; }
.bulkbar .btn { background: transparent; border-color: transparent; color: var(--bg); }
.bulkbar .btn:hover { background: color-mix(in srgb, var(--bg) 14%, transparent); }
.bulkbar .btn.danger { color: color-mix(in srgb, var(--danger) 70%, var(--bg)); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
.loadmore { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--line); }

/* ---------- lead page: timeline-first, properties on the right ---------- */
.lead-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.lead-head .who { flex: 1; min-width: 260px; }
.lead-head h2 { font: 640 21px/1.2 var(--font); letter-spacing: -.02em; margin: 1px 0 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lead-head .role { color: var(--ink-2); margin-top: 3px; font-size: 13px; }
.lead-head .role b { color: var(--ink); font-weight: 560; }
.lead-head .role a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.lead-head .role a:hover { text-decoration-color: var(--ink); }
.lead-head .meta-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.lead-head .meta-row .muted { margin-left: 4px; font-size: 12px; }
.lead-head .acts { display: flex; gap: 6px; align-items: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-3); font-size: 12.5px; margin-bottom: 12px; }
.back:hover { color: var(--ink); }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 336px; gap: 18px; align-items: start; }
.lead-grid > div { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lead-grid > div:first-child { order: 2; position: sticky; top: calc(var(--top-h) + 16px); max-height: calc(100dvh - var(--top-h) - 32px); overflow-y: auto; scrollbar-width: thin; }
.lead-grid > div:first-child .card { border: 0; background: transparent; border-radius: 0; border-bottom: 1px solid var(--line); }
.lead-grid > div:first-child .card:last-child { border-bottom: 0; }
.lead-grid > div:first-child .card-h { padding: 4px 0 6px; min-height: 0; }
.lead-grid > div:first-child .card-h h3 { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.lead-grid > div:first-child .card-b { padding: 0 0 14px; }
.fields { display: grid; grid-template-columns: 1fr; }
.fld { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: start; gap: 6px; padding: 1px 0; min-height: 30px; }
.fld > .lbl { color: var(--ink-3); font-size: 12px; padding-top: 6px; }
.fld .val { padding: 4px 7px; margin: 0 -7px; border-radius: var(--r-sm); min-height: 28px; cursor: text; word-break: break-word; border: 1px solid transparent; font-size: 13px; }
.fld .val:hover { background: var(--hover); }
.fld .val.empty-v { color: var(--ink-3); }
.fld .val a.ext { color: var(--accent-ink); }
.fld .val a.ext:hover { text-decoration: underline; }
.fld .val.has-edit { position: relative; padding-right: 30px; }
.fld .val .fld-edit { position: absolute; right: 1px; top: 1px; opacity: 0; transition: opacity .12s; }
.fld .val:hover .fld-edit, .fld .val:focus-visible .fld-edit { opacity: 1; }
@media (hover: none) { .fld .val .fld-edit { opacity: .6; } }
.fld .inp, .fld .sel { width: 100%; height: 30px; }
.summary-box .ta { min-height: 100px; background: var(--surface); }
.saved-tick { color: var(--ok); font-size: 11.5px; margin-left: auto; opacity: 0; transition: opacity .25s; display: inline-flex; gap: 4px; align-items: center; text-transform: none; letter-spacing: 0; font-weight: 500; }
.saved-tick.show { opacity: 1; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.refs li { display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; padding: 2px 0; }
.refs { list-style: none; margin: 0; padding: 0; }
.refs code, code.mono { font: 11.5px var(--mono); color: var(--ink-2); word-break: break-all; }

.composer { padding: 4px 14px 12px; }
.ctabs { display: flex; gap: 2px; padding: 8px 10px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.ctab { height: 32px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--ink-3); font-weight: 520; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; border-radius: 0; }
.ctab:hover { color: var(--ink); }
.ctab.on { color: var(--ink); border-bottom-color: var(--ink); }
.crow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.composer .ta { border-color: var(--line); min-height: 76px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button { height: 24px; padding: 0 9px; border: 0; background: none; color: var(--ink-2); font-size: 12px; font-weight: 520; display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, .05); }

.tasklist { list-style: none; margin: 0; padding: 0; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); }
.tasklist > .task:first-child { border-top: 0; }
.card-h + .tasklist > .task:first-child { border-top: 1px solid var(--line); }
.task:hover { background: var(--hover); }
.task .tt { flex: 1; min-width: 0; }
.task .tt .t1 { font-weight: 520; }
.task.done .t1 { text-decoration: line-through; text-decoration-color: var(--ink-3); color: var(--ink-3); }
.task .tt .t2 { font-size: 12px; color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1px; }
.task .tt .t2 a:hover { color: var(--ink); text-decoration: underline; }
.task input[type="checkbox"] { margin-top: 3px; width: 15px; height: 15px; border-radius: 50%; }
.task .ops { opacity: 0; transition: opacity .12s; display: flex; gap: 2px; }
.task:hover .ops, .task:focus-within .ops { opacity: 1; }
.addtask { display: flex; gap: 6px; padding: 9px 14px 11px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--line); }
.addtask .inp.t { flex: 1; min-width: 170px; }

.timeline { position: relative; padding: 4px 14px 16px; }
.tl-day { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin: 18px 0 10px 34px; }
.tl-day:first-child { margin-top: 8px; }
.tl-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding-bottom: 12px; }
.tl-item::before { content: ""; position: absolute; left: 11.5px; top: 26px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink-3); z-index: 1; box-shadow: 0 0 0 1px var(--line-2); }
.tl-ic.in { color: var(--ok); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok) 45%, transparent); }
.tl-ic.out { color: var(--ink); }
.tl-ic.ev { box-shadow: none; background: none; height: 20px; }
.tl-ic.ev::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--line-2); }
.tl-box { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 9px 12px; min-width: 0; }
.tl-box.in { border-left: 2px solid var(--ok); }
.tl-box.sched { border-style: dashed; background: transparent; }
.tl-top { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.tl-top .who { color: var(--ink); font-weight: 560; }
.tl-top .what { color: var(--ink-2); }
.tl-top .ops { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.tl-box:hover .ops, .tl-box:focus-within .ops { opacity: 1; }
.tl-top a.ext { color: var(--accent-ink) !important; }
.tl-subj { font-weight: 600; margin-top: 4px; }
.tl-body { margin-top: 4px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; color: var(--ink); }
.tl-body.clamp { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.tl-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.tl-more { border: 0; background: none; color: var(--ink-2); font-size: 12px; padding: 4px 0 0; font-weight: 520; }
.tl-more:hover { color: var(--ink); }
.tl-ev { font-size: 12px; color: var(--ink-3); padding-top: 2px; }
.tl-ev .who { color: var(--ink-2); font-weight: 560; }
.status-chip { font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding: 0 5px; line-height: 16px; border-radius: 3px; border: 1px solid var(--line-2); color: var(--ink-2); }
.status-chip.scheduled { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.status-chip.failed, .status-chip.canceled { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* ---------- pipeline board ---------- */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; min-height: calc(100dvh - var(--top-h) - 120px); scrollbar-width: thin; }
.col { flex: 0 0 264px; background: var(--side); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100dvh - var(--top-h) - 104px); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; }
.col-h .pill { border: 0; padding: 0; font-weight: 600; }
.col-h .n { color: var(--ink-3); font-weight: 560; font-size: 12px; }
.col-h .v { margin-left: auto; color: var(--ink-3); font-size: 11.5px; }
.col-b { padding: 2px 6px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; min-height: 60px; flex: 1; border-radius: 0 0 var(--r-lg) var(--r-lg); transition: background .12s, box-shadow .12s; }
.col.over .col-b { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 10px; cursor: grab; transition: border-color .12s, opacity .12s, transform .12s var(--ease); display: block; }
.kcard:hover { border-color: var(--line-2); }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .4; transform: scale(.98); }
.kcard .nm { font-weight: 560; display: flex; align-items: center; gap: 6px; }
.kcard .co { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.kcard .ft { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.kcard .ft .grow { flex: 1; }
.kcard .pill.flag { height: 17px; font-size: 10px; padding: 0 5px; }
.col-more { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px; }
a.col-more:hover { color: var(--ink); }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line); align-items: flex-start; }
.card-h + .feed li:first-child { border-top: 1px solid var(--line); }
.feed .ft1 { font-size: 12.5px; line-height: 1.5; }
.feed .ft1 .who { font-weight: 560; }
.feed .ft1 a { font-weight: 560; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.feed .ft1 a:hover { text-decoration-color: var(--ink); }
.feed .ft1 b { font-weight: 560; }
.feed .ft2 { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }

/* ---------- settings ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 8px 10px; color: var(--ink-3); font-weight: 520; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 13px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.set-grid { display: grid; gap: 16px; max-width: 860px; }
.srow { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.card-h + .srow, .srow:first-child { border-top: 1px solid var(--line); }
.srow .grow { flex: 1; min-width: 160px; }
.srow .t1 { font-weight: 560; }
.srow .t2 { font-size: 12px; color: var(--ink-3); }
.secret { display: flex; gap: 8px; align-items: center; padding: 9px 11px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line-2); font: 13px var(--mono); word-break: break-all; }
pre.code { margin: 6px 0 0; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); font: 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--ink); }
.callout { padding: 11px 13px; border-radius: var(--r-lg); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; line-height: 1.6; border: 1px solid var(--line); }
.callout b { color: var(--ink); font-weight: 600; }
.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 2px 0 10px 30px; line-height: 1.55; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--ink-2); }

/* ---------- sign-in ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login { width: min(380px, 100%); }
.login img { width: 28px; height: 28px; border-radius: 7px; }
.login h1 { font: 640 22px/1.2 var(--font); letter-spacing: -.02em; margin: 18px 0 4px; }
.login p { color: var(--ink-2); margin: 0 0 22px; }
.login .inp.lg { width: 100%; height: 38px; font-size: 14px; }
.login .fl label { display: block; font-size: 12px; color: var(--ink-2); font-weight: 520; margin-bottom: 5px; }
.login .btn.primary { width: 100%; height: 38px; font-size: 14px; margin-top: 14px; }
.login .row { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12.5px; color: var(--ink-2); }
.login .err { color: var(--danger); font-size: 12.5px; margin-top: 10px; min-height: 18px; }
.login .foot { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.login .foot a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.login .foot a:hover { color: var(--ink); }
.pw-wrap { position: relative; }
.pw-wrap .inp { padding-right: 60px; }
.pw-wrap .btn { position: absolute; right: 5px; top: 6px; }

/* ---------- modal, palette, toast ---------- */
dialog.modal { border: 0; padding: 0; border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--pop); width: min(540px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); }
dialog.modal::backdrop { background: rgba(20, 18, 16, .32); }
dialog.modal[open] { animation: pop .16s var(--ease); }
@keyframes pop { from { transform: translateY(4px) scale(.985); opacity: 0; } }
.m-h { display: flex; align-items: center; padding: 16px 18px 4px; gap: 10px; }
.m-h h2 { margin: 0; font: 620 15px/1.3 var(--font); letter-spacing: -.01em; }
.m-h .btn { margin-left: auto; }
.m-b { padding: 8px 18px 4px; display: grid; gap: 12px; overflow: auto; }
.m-f { display: flex; justify-content: flex-end; gap: 6px; padding: 14px 18px 16px; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fl label { display: block; font-size: 12px; color: var(--ink-2); font-weight: 520; margin-bottom: 4px; }
.fl .inp, .fl .sel { width: 100%; }
.dupe-hint { font-size: 12.5px; padding: 8px 10px; border-radius: var(--r); background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--ink); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.dupe-hint a { font-weight: 600; text-decoration: underline; }
dialog.palette { margin-top: 14vh; width: min(600px, calc(100vw - 32px)); }
.pal-in { width: 100%; height: 48px; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 0 16px; font-size: 15px; outline: none; border-radius: 10px 10px 0 0; }
.pal-list { max-height: 52vh; overflow: auto; padding: 4px; }
.pal-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r); cursor: pointer; min-width: 0; }
.pal-item.act { background: var(--hover); }
.pal-item .grow { flex: 1; min-width: 0; }
.pal-item .t2 { font-size: 12px; color: var(--ink-3); }
.pal-item .pill { border: 0; }
.pal-group { font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); padding: 10px 10px 6px; }
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 14px; border-radius: var(--r-lg); background: var(--ink); color: var(--bg); font-weight: 520; font-size: 13px; box-shadow: var(--pop); animation: up .2s var(--ease); max-width: min(560px, calc(100vw - 32px)); }
.toast.err { background: var(--danger); color: #fff; }
.toast button { border: 0; background: color-mix(in srgb, currentColor 16%, transparent); color: inherit; border-radius: 4px; height: 24px; padding: 0 9px; font-weight: 600; font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }
.skel { height: 46px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--hover), transparent); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- connect page ---------- */
.connect { max-width: 760px; margin: 0 auto; padding: 48px 24px 80px; }
.connect header { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; }
.connect header img { width: 24px; height: 24px; border-radius: 6px; }
.connect header b { font-weight: 650; }
.connect header a { margin-left: auto; }
.connect h1 { font: 660 30px/1.15 var(--font); letter-spacing: -.03em; margin: 0 0 10px; }
.connect .lede { font-size: 15px; color: var(--ink-2); margin: 0 0 32px; max-width: 600px; line-height: 1.55; }
.connect .url { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); font: 15px var(--mono); margin-bottom: 36px; }
.connect .url span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connect .seg { margin-bottom: 18px; }
.connect .seg button { height: 28px; padding: 0 12px; font-size: 13px; }
.connect .panel { border-top: 1px solid var(--line); padding-top: 20px; }
.connect .panel h2 { font: 620 16px/1.3 var(--font); margin: 0 0 4px; }
.connect .panel .note { color: var(--ink-3); font-size: 12.5px; margin: 0 0 16px; }
.connect .steps li { font-size: 14px; padding-bottom: 14px; }
.connect .steps code { font: 13px var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; }
.connect .cmd { position: relative; }
.connect .cmd .btn { position: absolute; top: 8px; right: 8px; }
.connect .cmd pre.code { padding-right: 70px; }
.connect .try { margin-top: 32px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface-2); border: 1px solid var(--line); }
.connect .try h3 { margin: 0 0 8px; font: 600 13px/1.3 var(--font); }
.connect .try ul { margin: 0; padding-left: 18px; color: var(--ink-2); line-height: 1.9; }

/* ---------- Review Gate ---------- */
.nav .badge.accent { background: var(--accent); color: #fff; }
.rg-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px; margin: -4px 0 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--ink-2); transition: background .12s; }
.rg-banner:hover { background: var(--surface-2); }
.rg-banner b { color: var(--ink); font-weight: 600; }
.rg-banner svg { color: var(--accent); }
.rg-banner.hot { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); }
.rg-banner .grow { flex: 1; }
.rg-bar-top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.rg-bar-top .grow { flex: 1; }
.rg-bar-top .seg button { height: 28px; padding: 0 12px; font-size: 12.5px; }
.rg-tc { font-weight: 650; color: var(--accent-ink); margin-left: 2px; }
.rg-tc:empty { display: none; }
.rg-keys { display: inline-flex; align-items: center; gap: 4px; }
.rg-keys .kbd { margin-right: 1px; }
.rg-empty { max-width: 640px; padding: 34px 28px; text-align: center; color: var(--ink-2); display: grid; justify-items: center; gap: 4px; }
.rg-empty svg { width: 26px; height: 26px; color: var(--ink-3); margin-bottom: 6px; }
.rg-empty b { color: var(--ink); font-size: 14px; font-weight: 600; }
.rg-empty p { margin: 4px 0 0; line-height: 1.6; font-size: 13px; }
#rg-box { display: grid; gap: 18px; max-width: 1040px; }
.rg-round { overflow: clip; }
.rg-head { padding: 14px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 6px; }
.rg-h1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rg-h1 h2 { margin: 0; font: 640 15.5px/1.3 var(--font); letter-spacing: -.012em; margin-right: 2px; }
.rg-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.rg-meta svg { color: var(--violet); }
.rg-brief { font-size: 13px; color: var(--ink-2); }
.rg-brief summary, .rg-hist summary, .rg-prev details summary { cursor: pointer; color: var(--ink-3); font-size: 12px; font-weight: 520; width: fit-content; list-style-position: inside; }
.rg-brief summary:hover, .rg-hist summary:hover, .rg-prev details summary:hover { color: var(--ink); }
.rg-brief .rg-txt { margin-top: 6px; padding: 9px 12px; background: var(--surface-2); border-radius: var(--r); }
.rg-hist { padding: 10px 18px 12px; }
.rg-hist[open] { padding-bottom: 0; }
.rg-hist > .rg-items { margin: 10px -18px 0; }
.rg-progress { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.rg-progress .grow { flex: 1; }
.rg-track { width: 140px; height: 4px; border-radius: 2px; background: var(--bar-track); overflow: hidden; }
.rg-track i { display: block; height: 100%; background: var(--ink); border-radius: 2px; transition: width .25s var(--ease); }
.rg-items { list-style: none; margin: 0; padding: 0; }
.rg-item { position: relative; padding: 14px 18px 14px 22px; border-top: 1px solid var(--line); display: grid; gap: 10px; outline: none; transition: background .15s; }
.rg-items > .rg-item:first-child { border-top: 0; }
.rg-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: transparent; transition: background .15s; }
.rg-item.st-approved::before, .rg-item.st-queued::before, .rg-item.st-done::before { background: var(--ok); }
.rg-item.st-declined::before, .rg-item.st-failed::before { background: var(--danger); }
.rg-item.st-changes_requested::before { background: var(--orange); }
.rg-item.st-revised, .rg-item.st-withdrawn, .rg-item.st-canceled, .rg-item.st-skipped { opacity: .72; }
.rg-item:focus-visible, .rg-item:focus { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); box-shadow: none; border-radius: 0; }
.rg-i-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.rg-i-top .grow { flex: 1; }
.rg-num { width: 20px; height: 20px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); font-size: 11px; font-weight: 650; display: inline-grid; place-items: center; flex: none; }
.rg-lead { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 340px; }
.rg-lead b { font-weight: 600; }
.rg-lead:hover b { text-decoration: underline; text-underline-offset: 3px; }
.rg-type { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 520; }
.rg-prio { font-size: 11.5px; font-weight: 600; color: var(--danger); }
.rg-prio.low { color: var(--ink-3); font-weight: 520; }
.rg-title { margin: 0; font: 600 14px/1.4 var(--font); letter-spacing: -.006em; }
.rg-warn { list-style: none; margin: 0; padding: 8px 11px; border-radius: var(--r); background: color-mix(in srgb, var(--warn) 9%, transparent); color: var(--ink); display: grid; gap: 4px; font-size: 12.5px; }
.rg-warn li { display: flex; gap: 7px; align-items: flex-start; }
.rg-warn svg { color: var(--warn); margin-top: 2px; }
.rg-prev { display: grid; gap: 6px; }
.rg-prev-note { display: flex; gap: 7px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.rg-prev-note svg { color: var(--violet); margin-top: 2px; }
.rg-prev-note b { color: var(--ink); font-weight: 560; }
.rg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 22px; }
.rg-lbl { display: flex; align-items: center; gap: 8px; font: 600 10.5px/1 var(--font); text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); margin-bottom: 5px; }
.rg-lbl .grow { flex: 1; }
.rg-txt { font-size: 13px; line-height: 1.6; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.rg-txt a, .rg-bubble a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.rg-links { display: flex; flex-wrap: wrap; gap: 4px; margin: -2px 0 0 -8px; }
.rg-text { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 9px; background: var(--surface-2); }
.rg-text.editing { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rg-edited { display: inline-flex; align-items: center; gap: 4px; text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 600; color: var(--accent-ink); }
.rg-count { text-transform: none; letter-spacing: 0; font-size: 11.5px; font-weight: 520; color: var(--ink-3); }
.rg-count.over { color: var(--danger); font-weight: 650; }
.rg-subj { display: flex; gap: 8px; font-size: 13px; font-weight: 560; margin-bottom: 6px; }
.rg-subj-in { width: 100%; margin-bottom: 6px; font-weight: 560; }
.rg-bubble { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; color: var(--ink); max-height: 340px; overflow: auto; scrollbar-width: thin; }
.rg-bubble.empty { color: var(--ink-3); font-style: italic; }
.rg-bubble.old { margin-top: 6px; padding: 8px 10px; border-radius: var(--r); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 50%, transparent); }
.rg-ta { min-height: 120px; font-size: 13.5px; line-height: 1.6; }
.rg-text-ops { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 6px 0 0 -8px; }
.rg-text.editing .rg-text-ops { margin-left: 0; gap: 6px; }
.rg-decide { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rg-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.rg-toggle button { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 0; background: transparent; font-size: 13px; font-weight: 560; color: var(--ink-2); transition: background .12s, color .12s; }
.rg-toggle button + button { border-left: 1px solid var(--line-2); }
.rg-toggle button:hover { background: var(--hover); color: var(--ink); }
.rg-toggle .rg-yes.on { background: var(--ok); color: #fff; }
.rg-toggle .rg-no.on { background: var(--danger); color: #fff; }
.rg-exec { display: flex; gap: 8px; align-items: flex-start; padding: 8px 11px; border-radius: var(--r); background: var(--surface-2); font-size: 12.5px; }
.rg-exec.x-done svg { color: var(--ok); margin-top: 2px; }
.rg-exec.x-failed { background: var(--danger-soft); }
.rg-exec.x-failed svg { color: var(--danger); margin-top: 2px; }
.rg-exec.x-skipped svg { color: var(--ink-3); margin-top: 2px; }
.rg-exec .rg-txt { margin-top: 2px; }
.rg-thread { display: grid; gap: 8px; padding-left: 12px; border-left: 2px solid var(--line); }
.rg-reasons { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.rg-reasons .muted { margin-right: 4px; }
.chip { height: 24px; padding: 0 9px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 12px; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface-2); }
.rg-c { display: flex; gap: 8px; align-items: flex-start; }
.rg-c .av { margin-top: 2px; }
.rg-c-b { min-width: 0; flex: 1; }
.rg-c-h { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.rg-c-h b { font-weight: 600; }
.rg-c.agent .rg-c-h b { color: var(--violet); }
.rg-c-del { margin-left: auto; opacity: 0; transition: opacity .12s; }
.rg-c:hover .rg-c-del, .rg-c-del:focus-visible { opacity: 1; }
.rg-cform { display: flex; gap: 6px; align-items: flex-end; }
.rg-cform .ta { min-height: 32px; padding: 6px 10px; resize: none; }
.rg-foot { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 11px 18px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.rg-foot-l { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rg-foot-l b { color: var(--ink); font-weight: 600; }
.rg-foot-l .ok { color: var(--ok); font-weight: 560; }
.rg-foot-l .no { color: var(--danger); font-weight: 560; }
.rg-foot.calm { position: static; background: var(--surface-2); }
.rg-ready { min-width: 112px; }
/* v2: release bar, folded items, alternatives to a decision, diffs, rules */
.rg-release { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--accent-soft); border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); font-size: 13px; color: var(--ink); }
.rg-release > svg { color: var(--accent); flex: none; }
.rg-release > div { flex: 1; min-width: 0; }
.rg-round.to-release .rg-foot .rg-ready { box-shadow: 0 0 0 3px var(--accent-soft); animation: rg-pulse 1.8s var(--ease) 3; }
@keyframes rg-pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); } 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 30%, transparent); } }
.rg-stat { color: var(--ink-2); font-weight: 520; }
.rg-item.compact { padding-top: 8px; padding-bottom: 8px; gap: 0; }
.rg-item.compact .rg-i-top { flex-wrap: nowrap; }
.rg-item.compact .rg-lead { max-width: 200px; flex: none; }
.rg-ctitle { flex: 1; min-width: 0; color: var(--ink-2); font-size: 12.5px; }
.rg-item.compact .rg-type { flex: none; }
.rg-alt { display: inline-flex; gap: 2px; margin-left: 2px; padding-left: 8px; border-left: 1px solid var(--line); }
.rg-diff-d { margin-top: 2px; }
.rg-diff { margin-top: 6px; padding: 9px 12px; border-radius: var(--r); background: var(--surface-2); font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.rg-diff del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--danger) 60%, transparent); border-radius: 3px; }
.rg-diff ins { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); text-decoration: none; border-radius: 3px; font-weight: 520; }
.rg-c-ops { margin-left: auto; display: inline-flex; gap: 2px; align-items: center; }
.rg-c-ops .rg-c-del { margin-left: 0; }
.rg-c-rule { opacity: 0; transition: opacity .12s; color: var(--accent-ink); }
.rg-c:hover .rg-c-rule, .rg-c-rule:focus-visible { opacity: 1; }
@media (hover: none) { .rg-c-rule { opacity: .8; } }
.rg-rules { display: grid; gap: 14px; max-width: 860px; }
.rg-rule-list { list-style: none; margin: 0; padding: 0; }
.rg-rule { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line); }
.rg-rule-list > .rg-rule:first-child { border-top: 0; }
.rg-rule-b { flex: 1; min-width: 0; display: grid; gap: 3px; }
.rg-rule-b .rg-txt { color: var(--ink); }
.rg-rule-ops { display: flex; gap: 2px; opacity: .55; transition: opacity .12s; }
.rg-rule:hover .rg-rule-ops, .rg-rule:focus-within .rg-rule-ops { opacity: 1; }
.rg-rule-add { padding: 12px 14px; display: grid; gap: 8px; }
.rg-rule-add-f { display: flex; gap: 8px; justify-content: flex-end; }
.rg-leadcard .card-h h3 { display: inline-flex; align-items: center; gap: 6px; }
.rg-leadcard .row-link svg { color: var(--ink-3); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-right: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line); }
  .today-grid { grid-template-columns: 1fr; }
  .lead-grid { grid-template-columns: 1fr; }
  .lead-grid > div:first-child { order: 0; position: static; max-height: none; overflow: visible; }
  .tbl .c-owner, .tbl .c-tags { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); justify-content: space-around; overflow: visible; }
  .side .logo, .side .spacer, .side .me, .nav .lbl, .nav.opt, .side-label, .nav.view { display: none; }
  .nav { flex-direction: column; height: 42px; padding: 6px 10px; gap: 2px; justify-content: center; }
  .nav.on { box-shadow: none; background: var(--hover); }
  .nav .badge { position: absolute; top: 1px; right: -2px; margin: 0; transform: scale(.85); }
  .main { padding-bottom: 66px; }
  .top { padding: 0 14px; }
  .search-trigger span, .search-trigger .kbd { display: none; }
  .search-trigger { width: 34px; padding: 0 9px; }
  .page { padding: 14px 14px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-right: 1px solid var(--line) !important; border-top: 1px solid var(--line); }
  .kpi:nth-child(-n+2) { border-top: 0; }
  .kpi:nth-child(2n) { border-right: 0 !important; }
  .tbl .c-company, .tbl .c-touch, .tbl th.ck, .tbl td.ck { display: none; }
  .tbl th:last-child { width: 34% !important; }
  .tbl th[data-sort="stage"] { width: 104px !important; }
  .filters .inp.search { width: 100%; }
  .f2 { grid-template-columns: 1fr; }
  .top .btn .lbl { display: none; }
  .connect h1 { font-size: 24px; }
  .rg-keys { display: none; }
  .rg-head, .rg-item, .rg-foot { padding-left: 14px; padding-right: 14px; }
  .rg-item { padding-left: 17px; }
  .rg-foot { flex-wrap: wrap; bottom: 58px; }
  .rg-foot-l { flex-basis: 100%; }
  .rg-foot .btn { flex: 1; }
  .rg-lead { max-width: 100%; }
  .rg-track { width: 90px; }
  .rg-item.compact .rg-i-top { flex-wrap: wrap; }
  .rg-item.compact .rg-lead { max-width: 70%; }
  .rg-ctitle { flex-basis: 100%; order: 9; }
  .rg-alt { border-left: 0; padding-left: 0; margin-left: 0; }
  .rg-release { flex-wrap: wrap; padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
