/* AutoDM — minimal black & white. Colour is used only for errors. */

/* ---------- tokens ---------- */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --surface-3: #e9e9e9;
  --border: #e6e6e6;
  --border-strong: #d4d4d4;
  --text: #0a0a0a;
  --text-2: #2e2e2e;
  --muted: #737373;
  --ink: #0a0a0a;
  --on-ink: #ffffff;
  --soft: rgba(0, 0, 0, 0.045);
  --danger: #c4231b;
  --danger-soft: rgba(196, 35, 27, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 30px 80px -24px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Tamil", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #0a0a0a;
    --surface-2: #141414;
    --surface-3: #1f1f1f;
    --border: #1f1f1f;
    --border-strong: #2e2e2e;
    --text: #f5f5f5;
    --text-2: #d4d4d4;
    --muted: #8a8a8a;
    --ink: #fafafa;
    --on-ink: #0a0a0a;
    --soft: rgba(255, 255, 255, 0.06);
    --danger: #ff6b61;
    --danger-soft: rgba(255, 107, 97, 0.1);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -16px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #0a0a0a;
  --surface-2: #141414;
  --surface-3: #1f1f1f;
  --border: #1f1f1f;
  --border-strong: #2e2e2e;
  --text: #f5f5f5;
  --text-2: #d4d4d4;
  --muted: #8a8a8a;
  --ink: #fafafa;
  --on-ink: #0a0a0a;
  --soft: rgba(255, 255, 255, 0.06);
  --danger: #ff6b61;
  --danger-soft: rgba(255, 107, 97, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -16px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; font-weight: 650; }
code, .mono { font-family: var(--mono); font-size: 0.9em; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--surface-3); border-top-color: var(--ink); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; padding: 20px 12px; border-right: 1px solid var(--border); background: var(--bg); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; font-weight: 700; font-size: 15px; letter-spacing: -0.02em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--ink); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.brand-mark .b1 { fill: var(--on-ink); }
.brand-mark .b2 { fill: var(--ink); }
.brand small { display: block; font-weight: 450; font-size: 11.5px; color: var(--muted); letter-spacing: 0; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 14px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; text-decoration: none; transition: background 0.12s, color 0.12s; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item .count.todo { background: var(--ink); color: var(--on-ink); padding: 0 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.account-card { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 12px; }
.account-card .meta { min-width: 0; flex: 1; }
.account-card .meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-card .meta span { font-size: 12px; color: var(--muted); }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--ink); color: var(--on-ink); flex: none; display: grid; place-items: center; font-weight: 650; font-size: 12px; filter: grayscale(1); }
.avatar-ring { display: contents; }
.foot-row { display: flex; gap: 6px; }

.main { min-width: 0; padding: 32px clamp(16px, 3.5vw, 48px) 120px; }
.page { max-width: 1120px; margin: 0 auto; animation: rise 0.2s ease-out; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.03em; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 640px; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 10px; text-decoration: none; }
.crumb:hover { color: var(--text); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.card-head h3 { font-size: 15px; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background 0.12s, border-color 0.12s, opacity 0.12s; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.86; background: var(--ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.sm.icon-only { width: 30px; }
.btn.block { width: 100%; }
.btn .spinner { width: 15px; height: 15px; border-color: color-mix(in srgb, var(--on-ink) 35%, transparent); border-top-color: var(--on-ink); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: 16px; }
.label { font-weight: 600; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.label .counter { margin-left: auto; font-weight: 450; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.label .counter.over { color: var(--danger); }
.hint { color: var(--muted); font-size: 12.5px; }
.err { color: var(--danger); font-size: 12.5px; font-weight: 500; }
.err:empty { display: none; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); padding: 8px 12px; outline: none; transition: border-color 0.12s, box-shadow 0.12s; }
.textarea { min-height: 88px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--soft); }
.invalid .input, .invalid .textarea, .invalid .chips { border-color: var(--danger); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 40px; padding: 5px; border: 1px solid var(--border-strong); border-radius: 9px; background: var(--surface); cursor: text; }
.chips:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px var(--soft); }
.chips input { flex: 1; min-width: 120px; border: 0; outline: none; background: transparent; padding: 4px 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px 2px 10px; border-radius: 99px; background: var(--ink); color: var(--on-ink); font-weight: 600; font-size: 12.5px; }
.chip button { border: 0; background: transparent; cursor: pointer; color: inherit; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; padding: 0; opacity: 0.7; }
.chip button:hover { opacity: 1; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 550; color: var(--text-2); border: 1px solid var(--border-strong); }
.tag.mono { font-family: var(--mono); font-size: 11.5px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 550; color: var(--muted); cursor: pointer; display: inline-flex; gap: 7px; align-items: center; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border); }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background 0.18s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 0.18s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--on-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 11px; cursor: pointer; }
.radio-card + .radio-card { margin-top: 8px; }
.radio-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.radio-card input { margin-top: 3px; accent-color: var(--ink); }
.radio-card b { display: block; }
.check { width: 18px; height: 18px; accent-color: var(--ink); flex: none; margin: 0; cursor: pointer; }

/* ---------- tones (all monochrome, except red for problems) ---------- */
.tone-violet, .tone-blue, .tone-amber, .tone-green, .tone-slate { background: var(--surface-2); color: var(--text); }
.tone-red { background: var(--danger-soft); color: var(--danger); }

/* ---------- KPIs + charts ---------- */
.kpi { padding: 20px; }
.kpi .kpi-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 550; font-size: 13px; }
.kpi .kpi-icon { display: none; }
.kpi .value { font-size: 34px; font-weight: 700; letter-spacing: -0.04em; margin-top: 10px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid-line { stroke: var(--border); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .bar-a { fill: var(--surface-3); }
.chart .bar-b { fill: var(--ink); }
.chart g.day:hover .bar-a { fill: var(--border-strong); }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .la { background: var(--surface-3); }
.legend .lb { background: var(--ink); }
.funnel-row + .funnel-row { margin-top: 16px; }
.funnel-row .top { display: flex; justify-content: space-between; font-weight: 550; font-size: 13px; }
.funnel-row .top span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--ink); transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.progress { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; background: var(--ink); border-radius: 99px; transition: width 0.5s ease; }

/* ---------- status ---------- */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 99px; font-weight: 550; font-size: 12.5px; border: 1px solid var(--border-strong); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--ink); animation: pulse 2s infinite; }
.dot.warn { background: transparent; border: 1.5px solid var(--muted); }
.dot.off { background: var(--danger); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--soft); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.callout.warn, .callout.info { background: var(--surface-2); }
.callout.strong { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.callout.strong p { color: var(--on-ink); opacity: 0.8; }
.callout.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.callout .icon { margin-top: 2px; }
.callout p { margin: 2px 0 0; color: var(--text-2); }

/* ---------- checklist ---------- */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-item { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); }
.check-item:first-child { border-top: 0; }
.check-badge { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 650; font-size: 11.5px; color: var(--muted); border: 1px solid var(--border-strong); }
.check-item.done .check-badge, .wz-step.done .check-badge { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.check-item .body { flex: 1; min-width: 0; }
.check-item .body b { display: block; }
.check-item .body p { margin: 3px 0 0; color: var(--muted); }
.copy-box { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 5px 5px 5px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.copy-box code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; background: none; border: 0; padding: 0; }
.codeblock { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--ink); color: var(--on-ink); font-family: var(--mono); font-size: 12.5px; overflow-x: auto; white-space: pre; position: relative; }
.copy-area { position: relative; margin-top: 10px; }
.copy-area pre { margin: 0; padding: 14px 16px; padding-right: 92px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface-2); white-space: pre-wrap; word-wrap: break-word; font: 13px/1.6 var(--font); color: var(--text-2); max-height: 340px; overflow-y: auto; }
.copy-area .btn { position: absolute; top: 8px; right: 8px; }

/* ---------- setup wizard ---------- */
.wizard { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 28px; align-items: start; }
.wz-side { position: sticky; top: 24px; }
.wz-progress { margin-bottom: 16px; }
.wz-progress .row { justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; font-weight: 550; }
.wz-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.wz-step { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 10px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; color: var(--muted); }
.wz-step:hover { background: var(--surface-2); color: var(--text); }
.wz-step.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.wz-step.done { color: var(--text-2); }
.wz-step .check-badge { width: 22px; height: 22px; font-size: 11px; }
.wz-panel { padding: 28px; }
.wz-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.wz-panel h2 { font-size: 22px; margin: 6px 0 6px; letter-spacing: -0.025em; }
.wz-panel > p.lead { color: var(--muted); margin: 0 0 22px; max-width: 620px; }
.wz-list { list-style: none; counter-reset: s; margin: 0; padding: 0; }
.wz-list > li { counter-increment: s; position: relative; padding: 0 0 18px 40px; }
.wz-list > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 11.5px; font-weight: 650; color: var(--muted); }
.wz-list > li::after { content: ""; position: absolute; left: 11.5px; top: 28px; bottom: 4px; width: 1px; background: var(--border); }
.wz-list > li:last-child::after { display: none; }
.wz-list > li > b { display: block; margin-bottom: 2px; }
.wz-list > li p { margin: 0; color: var(--text-2); }
.kbd { display: inline-block; padding: 0 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; font-size: 12px; font-weight: 600; background: var(--surface); white-space: nowrap; }
.wz-foot { display: flex; align-items: center; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.status-line { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-strong); margin-top: 6px; font-weight: 550; }
.status-line.ok { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.status-line.bad { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }

/* ---------- approval kit ---------- */
.kit { display: flex; flex-direction: column; gap: 14px; }
.kit-item { padding: 20px 22px; }
.kit-item > header { display: flex; gap: 14px; align-items: flex-start; }
.kit-item > header .num { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 650; font-size: 12px; flex: none; color: var(--muted); }
.kit-item.done > header .num { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.kit-item > header h3 { font-size: 16px; }
.kit-item > header p { margin: 3px 0 0; color: var(--muted); }
.kit-item > header .done-toggle { margin-left: auto; display: inline-flex; gap: 8px; align-items: center; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; white-space: nowrap; }
.kit-body { margin: 16px 0 0 42px; }
.kit-item.done .kit-body { display: none; }
.kit-item.done.open .kit-body { display: block; }
.kit-body h4 { font-size: 13px; margin: 18px 0 2px; }
.kit-body h4:first-child { margin-top: 0; }
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.timeline > div { padding: 16px 18px; }
.timeline > div + div { border-left: 1px solid var(--border); }
.timeline b { display: block; font-size: 13px; }
.timeline span { font-size: 12.5px; color: var(--muted); }
.timeline .when { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 6px; display: block; }

/* ---------- automations ---------- */
.auto-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.auto-card { display: flex; flex-direction: column; overflow: hidden; transition: border-color 0.15s, box-shadow 0.15s; }
.auto-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.auto-top { display: flex; gap: 14px; padding: 18px; text-decoration: none; color: inherit; }
.thumb { width: 52px; height: 66px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--muted); filter: grayscale(1); }
.thumb.any { background: var(--ink); color: var(--on-ink); border: 0; filter: none; }
.auto-top .info { flex: 1; min-width: 0; }
.auto-top h3 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-top .where { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-top .kw { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.auto-stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--border); }
.auto-stats div { padding: 12px 16px; }
.auto-stats div + div { border-left: 1px solid var(--border); }
.auto-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.auto-stats span { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.auto-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px 10px 18px; border-top: 1px solid var(--border); }
.status-text { font-size: 12.5px; font-weight: 600; }
.status-text.off { color: var(--muted); }
.empty { text-align: center; padding: 64px 24px; }
.empty .art { width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 16px; background: var(--ink); color: var(--on-ink); display: grid; place-items: center; }
.empty .art .icon { width: 26px; height: 26px; }
.empty h2 { font-size: 20px; }
.empty p { color: var(--muted); max-width: 460px; margin: 8px auto 22px; }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 32px; align-items: start; }
.step { position: relative; padding-left: 48px; }
.step + .step { margin-top: 14px; }
.step::before { content: ""; position: absolute; left: 15px; top: 46px; bottom: -18px; width: 1px; background: var(--border-strong); }
.step:last-child::before { display: none; }
.step-num { position: absolute; left: 0; top: 16px; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2); }
.step.trigger .step-num { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.step-card { padding: 18px 20px; }
.step-card > header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step-card > header h3 { font-size: 15px; }
.step-card > header p { margin: 1px 0 0; color: var(--muted); font-size: 12.5px; }
.step-card.off > :not(header) { display: none; }
.step-card.off > header { margin-bottom: 0; }
.step-card.off { background: transparent; border-style: dashed; }
.picked-post { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--border-strong); border-radius: 11px; margin-top: 12px; }
.picked-post .thumb { width: 42px; height: 54px; }
.picked-post .cap { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tester { display: flex; gap: 8px; align-items: center; margin-top: 14px; padding: 9px 12px; border-radius: 9px; background: var(--surface-2); }
.tester input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.verdict { font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.verdict.no { color: var(--muted); }
.reply-row { display: flex; gap: 8px; }
.reply-row + .reply-row { margin-top: 8px; }
.save-bar { position: fixed; left: 240px; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; padding: 12px clamp(16px, 3.5vw, 48px); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border); }
.save-bar .inner { width: 100%; max-width: 1120px; display: flex; align-items: center; gap: 10px; }

/* ---------- phone preview ---------- */
.preview-col { position: sticky; top: 24px; }
.preview-tabs { display: flex; justify-content: center; margin-bottom: 14px; }
.phone { width: 320px; margin: 0 auto; border-radius: 42px; padding: 10px; background: #0a0a0a; box-shadow: var(--shadow-lg), inset 0 0 0 1px #2a2a2a; }
.screen { position: relative; height: 610px; border-radius: 33px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.notch { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); width: 88px; height: 24px; border-radius: 20px; background: #0a0a0a; z-index: 2; }
.statusbar { height: 42px; flex: none; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 26px 4px; font-size: 12px; font-weight: 650; }
.app-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; border-bottom: 1px solid var(--border); flex: none; }
.app-bar .avatar { width: 28px; height: 28px; font-size: 11px; }
.app-bar b { font-size: 13.5px; display: block; line-height: 1.2; }
.app-bar span { font-size: 11px; color: var(--muted); }
.thread { flex: 1; overflow-y: auto; padding: 14px 12px 18px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: none; }
.thread::-webkit-scrollbar { display: none; }
.msg { max-width: 82%; padding: 8px 13px; border-radius: 18px; font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; animation: rise 0.2s ease-out; }
.msg.in { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.msg.out { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 5px; }
.msg.tpl { padding: 0; overflow: hidden; background: var(--surface-2); border-bottom-left-radius: 5px; align-self: flex-start; width: 82%; }
.msg.tpl .t { padding: 10px 13px; }
.msg.tpl .b { display: block; text-align: center; padding: 9px; border-top: 1px solid var(--border-strong); font-weight: 650; }
.sys { align-self: center; font-size: 11px; color: var(--muted); padding: 4px 0; text-align: center; }
.placeholder-msg { opacity: 0.45; font-style: italic; }
.post-media { aspect-ratio: 4 / 5; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.post-media img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
.comments { padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.comment { display: flex; gap: 9px; font-size: 13px; line-height: 1.35; }
.comment .avatar { width: 24px; height: 24px; font-size: 10px; }
.comment.reply { margin-left: 33px; }
.comment b { margin-right: 5px; }
.comment small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }

/* ---------- media picker ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.media-item { position: relative; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface-2); padding: 0; aspect-ratio: 4 / 5; }
.media-item img { width: 100%; height: 100%; object-fit: cover; }
.media-item:hover { border-color: var(--border-strong); }
.media-item.on { border-color: var(--ink); }
.media-item .badge { position: absolute; top: 6px; left: 6px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 10.5px; font-weight: 650; padding: 1px 7px; border-radius: 99px; }
.media-item .cap { position: absolute; inset: auto 0 0; padding: 18px 8px 6px; font-size: 11px; color: #fff; text-align: left; background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- activity ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 12px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 18px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td .detail { color: var(--muted); max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; font-weight: 550; font-size: 12px; white-space: nowrap; }
.feed { list-style: none; margin: 0; padding: 4px 22px 12px; }
.feed li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--border); }
.feed li:first-child { border-top: 0; }
.feed .ev-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.feed .txt { flex: 1; min-width: 0; font-size: 13px; }
.feed .txt span { color: var(--muted); }
.feed time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--border-strong); background: var(--surface); padding: 5px 12px; border-radius: 99px; font-weight: 550; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.filter.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.filter.on .muted { color: var(--on-ink); opacity: 0.6; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 36px 28px; animation: rise 0.25s ease-out; }
.auth-card .brand { justify-content: center; padding: 0 0 4px; font-size: 18px; }
.auth-card .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.auth-card .brand-mark svg { width: 22px; height: 22px; }
.auth-card h1 { text-align: center; font-size: 22px; margin-top: 22px; }
.auth-card > p { text-align: center; color: var(--muted); margin: 6px 0 24px; }

/* ---------- modal + toast ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.5); display: grid; place-items: center; padding: 16px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 720px; max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-lg); animation: rise 0.18s ease-out; }
.modal.narrow { max-width: 420px; }
.modal header { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal header h3 { font-size: 16px; flex: 1; }
.modal .body { padding: 20px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.toasts { position: fixed; right: 20px; bottom: 84px; z-index: 60; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: center; padding: 11px 15px; border-radius: 11px; background: var(--ink); color: var(--on-ink); box-shadow: var(--shadow-lg); font-weight: 550; animation: rise 0.2s ease-out; max-width: 380px; }
.toast.error { background: var(--danger); color: #fff; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 12px; border: 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
.mobile-only { display: none; }
@media (max-width: 1180px) {
  .editor { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; }
}
@media (max-width: 1000px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .wizard { grid-template-columns: minmax(0, 1fr); }
  .wz-side { position: static; }
  .timeline { grid-template-columns: 1fr 1fr; }
  .timeline > div:nth-child(3) { border-left: 0; }
  .timeline > div:nth-child(n + 3) { border-top: 1px solid var(--border); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--border); }
  .brand, .nav-label, .sidebar-foot, .nav-item .count { display: none; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 6px 6px; }
  .main { padding: 22px 16px 140px; }
  .save-bar { left: 0; bottom: 60px; }
  .page-head h1 { font-size: 23px; }
  .phone { width: 296px; }
  .screen { height: 560px; }
  .toasts { left: 16px; right: 16px; bottom: 80px; }
  .mobile-only { display: flex; }
  .wz-panel { padding: 20px; }
  .kit-body { margin-left: 0; }
}
@media (max-width: 480px) {
  .grid-4 { gap: 10px; }
  .kpi .value { font-size: 26px; }
  .auto-grid { grid-template-columns: minmax(0, 1fr); }
  .step { padding-left: 0; }
  .step::before, .step-num { display: none; }
  .timeline { grid-template-columns: 1fr; }
  .timeline > div { border-left: 0 !important; border-top: 1px solid var(--border); }
  .timeline > div:first-child { border-top: 0; }
  .kit-item > header { flex-wrap: wrap; }
  .kit-item > header .done-toggle { margin-left: 42px; }
}
