:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --sidebar: #ffffff;
  --border: #e3e7ee;
  --border-strong: #cfd5df;
  --text: #17202e;
  --text-2: #4a5567;
  --muted: #6b7587;
  --accent: #0068ff;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0ff;
  --ok: #138a4b; --ok-soft: #e3f5ea;
  --warn: #a35d00; --warn-soft: #fff1dc;
  --bad: #c62a2a; --bad-soft: #fde8e8;
  --bar: #4d8dff;
  --s-new: #e8edf5; --s-new-ink: #3b4658;
  --s-contacted: #e2eeff; --s-contacted-ink: #0b4fb8;
  --s-interested: #fff1dc; --s-interested-ink: #8a4e00;
  --s-customer: #e3f5ea; --s-customer-ink: #0f6e3c;
  --s-ignored: #f1f1f1; --s-ignored-ink: #77777c;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --surface: #171d26; --surface-2: #1c2330; --sidebar: #131921;
    --border: #273040; --border-strong: #364154; --text: #e8edf5; --text-2: #b7c0cf; --muted: #8893a6;
    --accent: #3d8bff; --accent-ink: #ffffff; --accent-soft: #16294a;
    --ok: #4cc98a; --ok-soft: #12321f; --warn: #f0b050; --warn-soft: #3a2a10; --bad: #ff7b7b; --bad-soft: #3d1a1a;
    --bar: #5b9bff;
    --s-new: #232b38; --s-new-ink: #c3ccda; --s-contacted: #16294a; --s-contacted-ink: #8fb9ff;
    --s-interested: #3a2a10; --s-interested-ink: #f3c27a; --s-customer: #12321f; --s-customer-ink: #7fdcaa;
    --s-ignored: #22262d; --s-ignored-ink: #8a909b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --surface: #171d26; --surface-2: #1c2330; --sidebar: #131921;
  --border: #273040; --border-strong: #364154; --text: #e8edf5; --text-2: #b7c0cf; --muted: #8893a6;
  --accent: #3d8bff; --accent-ink: #ffffff; --accent-soft: #16294a;
  --ok: #4cc98a; --ok-soft: #12321f; --warn: #f0b050; --warn-soft: #3a2a10; --bad: #ff7b7b; --bad-soft: #3d1a1a;
  --bar: #5b9bff;
  --s-new: #232b38; --s-new-ink: #c3ccda; --s-contacted: #16294a; --s-contacted-ink: #8fb9ff;
  --s-interested: #3a2a10; --s-interested-ink: #f3c27a; --s-customer: #12321f; --s-customer-ink: #7fdcaa;
  --s-ignored: #22262d; --s-ignored-ink: #8a909b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
code, .mono { font-family: "Cascadia Mono", Consolas, ui-monospace, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; gap: 16px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; padding: 4px 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.session-box { margin-top: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface-2); }
.session-line { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.session-box p { margin: 4px 0 10px; }
.session-box:hover { border-color: var(--accent); }
.session-box p { margin-bottom: 0 !important; }
.nav-section { margin: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-section:first-child { margin-top: 0; }
.sidebar { overflow-y: auto; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.local-chip { font-size: 11px; letter-spacing: .06em; color: var(--ok); background: var(--ok-soft); border-radius: 99px; padding: 2px 8px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); flex: none; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.bad { background: var(--bad); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 18px; font-weight: 650; }
.topbar .menu-btn { display: none; }
.scan-banner { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--accent-soft); color: var(--accent); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; max-width: 50%; }
.scan-banner span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.view { padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 18px; max-width: 1400px; width: 100%; }
.loading { padding: 32px; color: var(--muted); text-align: center; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.error-card { color: var(--bad); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.link { color: var(--accent); }
.link:hover { text-decoration: underline; }
.linklike { background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; cursor: pointer; text-align: left; }
.linklike:hover { color: var(--accent); text-decoration: underline; }
.bulkbar .linklike { color: var(--accent); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); transition: border-color .15s; min-width: 0; }
.kpi:hover { border-color: var(--accent); }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 30px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value.kpi-text { font-size: 22px; padding: 4px 0; }
.kpi-sub { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.session-big { display: flex; gap: 12px; align-items: flex-start; }
.session-big .dot { margin-top: 6px; width: 11px; height: 11px; }
.session-big p { margin: 2px 0 0; }

.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.bars a { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 6px; }
.bars a:hover { background: var(--surface-2); }
.bar-label { color: var(--text-2); font-size: 13px; }
.bar-track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-item p { margin: 0; }
.feed-item time { color: var(--muted); font-size: 12px; }
.feed-icon { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-size: 12px; flex: none; font-weight: 700; }
.feed-item.kind-scan .feed-icon { background: var(--accent-soft); color: var(--accent); }
.feed-item.kind-error .feed-icon { background: var(--bad-soft); color: var(--bad); }
.feed-item.kind-contact .feed-icon { background: var(--ok-soft); color: var(--ok); }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { color: var(--accent-ink); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-group { display: inline-flex; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }
.icon-btn.tiny { width: 22px; height: 22px; font-size: 16px; margin-left: auto; }
input[type="url"], input[type="search"], input[type="password"], input[type="number"], input:not([type]), input[type="datetime-local"], select, textarea {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 7px 10px; min-width: 0; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; vertical-align: middle; }

.add-group { display: flex; gap: 10px; }
.add-group input { flex: 1; padding: 9px 12px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.selected { background: var(--accent-soft); }
.table.compact td, .table.compact th { padding: 7px 4px; }
.table.compact th { background: transparent; }
.card .table.compact tbody tr:hover { background: transparent; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.check-col { width: 40px; }
.actions-col { text-align: right; white-space: nowrap; }
.actions-col > * { vertical-align: middle; }
.sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.sort:hover, .sort.on { color: var(--text); }
.sort .arrow::after { content: '↕'; opacity: .35; }
.sort.on.asc .arrow::after { content: '↑'; opacity: 1; }
.sort.on.desc .arrow::after { content: '↓'; opacity: 1; }
.person { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.person > span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.person:hover b { color: var(--accent); text-decoration: underline; }
.meter { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 4px; width: 120px; margin-left: auto; }
.meter span { display: block; height: 100%; background: var(--bar); }
.pager { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pager select { padding: 3px 6px; }

.avatar { --s: 32px; width: var(--s); height: var(--s); border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-grid; place-items: center; font-weight: 700; font-size: calc(var(--s) * .38); position: relative; overflow: hidden; flex: none; }
.avatar > * { grid-area: 1 / 1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.status-new { background: var(--s-new); color: var(--s-new-ink); }
.status-contacted { background: var(--s-contacted); color: var(--s-contacted-ink); }
.status-interested { background: var(--s-interested); color: var(--s-interested-ink); }
.status-customer { background: var(--s-customer); color: var(--s-customer-ink); }
.status-ignored { background: var(--s-ignored); color: var(--s-ignored-ink); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.run { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; }
.chip button { border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; }
.chip button:hover { color: var(--bad); }
.chips.editable { border: 1px solid var(--border-strong); border-radius: 8px; padding: 6px; }
.chips.editable input { border: 0; box-shadow: none; padding: 2px 4px; flex: 1; min-width: 120px; background: transparent; }

/* ---------- toolbar / bulk ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar input[type="search"] { flex: 1 1 260px; max-width: 380px; }
.toolbar select { max-width: 220px; }
.bulkbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius); padding: 8px 12px; }
.bulk-field { display: inline-flex; gap: 6px; align-items: center; }
.bulk-field input { width: 140px; padding: 4px 8px; }
.bulk-field select { padding: 4px 8px; }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty h3 { margin: 10px 0 4px; font-size: 16px; color: var(--text); }
.empty p { margin: 0 0 14px; }
.empty-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: inline-grid; place-items: center; }
.empty-icon svg { width: 22px; height: 22px; }

/* ---------- drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 25, .35); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(520px, 100%); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 21; transform: translateX(100%); transition: transform .2s ease; overflow-y: auto; padding: 22px 24px 40px; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-close { position: absolute; top: 14px; right: 14px; }
.drawer-head { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; padding-right: 36px; }
.drawer-head h2 { margin: 0; font-size: 19px; }
.drawer-head p { margin: 2px 0 0; }
.drawer-actions { margin-top: 18px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 22px 0 8px; font-weight: 650; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field-row { display: flex; gap: 12px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 6px 0 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; word-break: break-all; }
.note { background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.plain-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.activity-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.activity-form textarea { grid-column: 1 / -1; }
.activity-form button { grid-column: 2; justify-self: end; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 14px 12px; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li.kind-status::before { border-color: var(--muted); }
.tl-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.tl-head time { color: var(--muted); font-size: 12px; }
.timeline p { margin: 2px 0 0; white-space: pre-wrap; }

/* ---------- logs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.tab { border: 0; background: none; padding: 9px 14px; cursor: pointer; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
[data-panel] { display: flex; flex-direction: column; gap: 12px; }
[data-panel] > p { margin: 0; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg-btn { border: 0; background: var(--surface); padding: 5px 10px; font-size: 13px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--border); }
.seg-btn:last-child { border-right: 0; }
.seg-btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.netlog { max-height: 64vh; overflow-y: auto; font-size: 13px; }
.net-row { display: grid; grid-template-columns: 76px 88px 1fr; gap: 10px; padding: 6px 14px; border-bottom: 1px solid var(--border); align-items: baseline; }
.net-row time { color: var(--muted); font-family: "Cascadia Mono", Consolas, monospace; font-size: 12px; }
.net-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.net-msg { min-width: 0; overflow-wrap: anywhere; }
.net-msg small { display: block; color: var(--muted); font-family: "Cascadia Mono", Consolas, monospace; }
.net-row.kind-data .net-kind, .net-row.kind-task .net-kind { color: var(--accent); }
.net-row.kind-error .net-kind { color: var(--bad); }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .2s; z-index: 40; max-width: calc(100% - 32px); font-weight: 500; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast[data-type="bad"] { background: var(--bad); color: #fff; }
.toast[data-type="warn"] { background: var(--warn); color: #fff; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .topbar .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; }
  .view { padding: 16px 16px 40px; }
  .scan-banner { max-width: 60%; }
  .add-group { flex-direction: column; }
  .toolbar input[type="search"], .toolbar select { max-width: none; flex: 1 1 100%; }
  .actions-col .btn-ghost { display: none; }
}
@media (max-width: 480px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .facts, .activity-form { grid-template-columns: 1fr; }
  .activity-form button { grid-column: 1; }
}

/* ---------- accounts / scan / onboarding ---------- */
.intro { display: flex; gap: 18px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.intro h2 { margin: 0 0 4px; font-size: 16px; }
.intro p { margin: 0; max-width: 640px; }
.inline-form { display: flex; gap: 8px; flex: 1 1 360px; max-width: 520px; }
.inline-form input { flex: 1; }
.steps { margin: 0 0 14px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.qr-box { display: grid; place-items: center; min-height: 280px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: #fff; padding: 12px; }
.qr-box img { width: 260px; height: 260px; object-fit: contain; image-rendering: pixelated; }
.qr-box .loading { color: #555; }
.qr-actions { display: flex; gap: 8px; margin: 10px 0; }
.qr-done { text-align: center; color: #17202e; }
.qr-done .check { width: 56px; height: 56px; border-radius: 50%; background: #e3f5ea; color: #138a4b; font-size: 30px; display: inline-grid; place-items: center; }
.qr-done h3 { margin: 10px 0 2px; }
.runbar { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.btn-lg { padding: 10px 18px; font-size: 14.5px; }
.runbar-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.runbar-field select { min-width: 260px; color: var(--text); font-weight: 400; }
.with-unit { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 400; }
.with-unit input { width: 76px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 7px 10px; }
.scan-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; }
.scan-grid textarea { font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.scan-grid p { margin: 6px 0 0; }
.help .steps { font-size: 13.5px; }
.card-head.pad { padding: 14px 18px 0; }
.status-table td { vertical-align: top; }
.empty.slim { padding: 22px; }
.text-bad { color: var(--bad); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist p { margin: 0; }
.step-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.checklist li.done .step-num { background: var(--ok-soft); color: var(--ok); }
@media (max-width: 1000px) { .scan-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .runbar-field select { min-width: 0; width: 100%; } .runbar-field { flex: 1 1 100%; } .inline-form { flex-direction: column; } }
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 20px; width: min(440px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 16px; }
.modal p { margin: 0 0 12px; white-space: pre-line; }
.modal-input { width: 100%; margin-bottom: 12px; }
.modal-check { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover:not(:disabled) { color: #fff; filter: brightness(1.08); }

/* ---------- auth ---------- */
.user-box { border-top: 1px solid var(--border); padding-top: 12px; }
.user-line { display: flex; gap: 10px; align-items: center; padding: 0 4px; }
.user-line > div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-line b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; gap: 2px; margin-top: 6px; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(400px, 100%); padding: 28px; }
.auth-card h1 { font-size: 20px; margin: 18px 0 14px; }
.auth-brand { padding: 0; }
.field input { width: 100%; padding: 9px 12px; }
.btn.block { width: 100%; margin-top: 4px; }
.form-error { color: var(--bad); min-height: 1.2em; margin: 0 0 8px; font-size: 13px; }
.center { text-align: center; }
.role-note { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 12px; margin: 0; }

/* ---------- tasks, templates, member changes ---------- */
.nav a { position: relative; }
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; }
.nav-badge.alert { background: var(--bad); color: #fff; }
.kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-alert .kpi-value { color: var(--bad); }
.text-ok { color: var(--ok); }
.task-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.task-form #tTitle { grid-column: 1 / -1; }
.task-form button { grid-column: 2; justify-self: end; }
.task-list, .task-rows, .mini-tasks, .change-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: grid; grid-template-columns: 22px 1fr 24px; gap: 8px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--border); }
.task-list li > div, .task-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.task-list li.done b, .task-row.done b { text-decoration: line-through; color: var(--muted); }
.task-list li.overdue b { color: var(--bad); }
.task-rows .task-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; border-top: 1px solid var(--border); }
.task-main { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.task-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.small-person { gap: 6px; font-size: 13px; color: var(--text-2); }
.small-person > span:last-child { flex-direction: row; }
.bucket-overdue h2 { color: var(--bad); }
#taskBody { display: flex; flex-direction: column; gap: 14px; }
.mini-tasks li, .change-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); }
.mini-tasks li:last-child, .change-list li:last-child { border-bottom: 0; }
.mini-tasks a { display: flex; flex-direction: column; min-width: 0; }
.mini-tasks a:hover b { color: var(--accent); }
.change-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.change-cols h4 { margin: 0 0 4px; font-size: 13px; }
.schedule-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.compose-actions { display: flex; gap: 6px; margin: 6px 0 2px; }
#tplSel { width: 100%; margin-bottom: 6px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.tpl-body, .tpl-preview { white-space: pre-wrap; margin: 0 0 10px; font-size: 13.5px; color: var(--text-2); }
.tpl-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.tpl-actions { display: flex; gap: 6px; }
.vars { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.var { cursor: pointer; font-family: "Cascadia Mono", Consolas, monospace; }
.chip.var:hover { border-color: var(--accent); color: var(--accent); }
.field-row > .field { flex: 1; min-width: 0; }
@media (max-width: 1300px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .task-rows .task-row { grid-template-columns: 24px 1fr; } .task-meta { grid-column: 2; align-items: flex-start; text-align: left; } .change-cols, .task-form { grid-template-columns: 1fr; } .task-form button { grid-column: 1; } }
