/* Be Online AI Marketing Platform prototype (the Marketing section of a Be Online account).
   Layout: forest rail on the left (bottom tab bar on phones), work area on a pale green paper.
   Orange = drafted by the AI. Forest = a person decided. Lime = allowed by your policy. No blue (Be Online rule). */
:root {
  --paper: #f5f8f2;
  --surface: #ffffff;
  --surface-2: #f8fbf5;
  --line: #dde7d5;
  --line-2: #ebf1e5;
  --ink: #12261a;
  --ink-2: #3a4d40;
  --ink-3: #5e6e64;
  --night: #0c3a22;
  --night-2: #0f4a2b;
  --night-3: #176237;
  --on-night: #e6f2dc;
  --on-night-2: #a9c4a8;
  --human: #0c3a22;
  --human-ink: #ffffff;
  --ai: #c4501c;
  --ai-tint: #fdeee6;
  --ai-line: #f2c6ae;
  --mk: #4c7a0c;
  --mk-tint: #eef6e0;
  --mk-line: #cfe3ad;
  --lime: #8cc63f;
  --green: #0f7b3c;
  --ok: #157a44;
  --ok-tint: #e3f3e8;
  --warn: #8f5200;
  --warn-tint: #fdf1dc;
  --bad: #b42318;
  --bad-tint: #fdecea;
  --focus: #0f7b3c;
  --fb: #2f5a3f; --ig: #8a3a64; --li: #44604d; --tt: #111611; --yt: #b3261e; --xx: #4a4a4a;
  --cmp-a: #d99a1e; --cmp-b: #0f7b3c; --cmp-c: #8a3a64; --cmp-d: #c4501c;
  --ch-1: #0f7b3c; --ch-2: #c4501c; --ch-3: #8cc63f;
  --shadow: 0 1px 2px rgb(18 38 26 / 0.06);
  --lift: 0 18px 40px -18px rgb(12 58 34 / 0.38);
  --r: 12px;
  --r-sm: 8px;
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --rail: 244px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #07140c; --surface: #0d1f15; --surface-2: #11281b; --line: #21402d; --line-2: #183222;
    --ink: #e6f2dc; --ink-2: #b8ccb6; --ink-3: #8aa28c;
    --night: #04100a; --night-2: #0a2215; --night-3: #13351f;
    --human: #e6f2dc; --human-ink: #0c3a22;
    --ai: #ff8d5e; --ai-tint: #391a0d; --ai-line: #6d3219;
    --mk: #a9dc5f; --mk-tint: #1c3112; --mk-line: #36561f;
    --ok: #5ccf94; --ok-tint: #12301f; --warn: #f3b860; --warn-tint: #33240c; --bad: #ff8a80; --bad-tint: #3a1614;
    --focus: #a9dc5f;
    --fb: #8fc4a0; --ig: #e59ac2; --li: #a9c7b2; --tt: #e6f2dc; --yt: #ff7b70; --xx: #c4c4c4;
    --cmp-a: #f0bd52; --cmp-b: #5fcf8c; --cmp-c: #e59ac2; --cmp-d: #ff8d5e;
    --ch-1: #5fcf8c; --ch-2: #ff8d5e; --ch-3: #c7ec8e;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4); --lift: 0 18px 40px -16px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #07140c; --surface: #0d1f15; --surface-2: #11281b; --line: #21402d; --line-2: #183222;
  --ink: #e6f2dc; --ink-2: #b8ccb6; --ink-3: #8aa28c;
  --night: #04100a; --night-2: #0a2215; --night-3: #13351f;
  --human: #e6f2dc; --human-ink: #0c3a22;
  --ai: #ff8d5e; --ai-tint: #391a0d; --ai-line: #6d3219;
  --mk: #a9dc5f; --mk-tint: #1c3112; --mk-line: #36561f;
  --ok: #5ccf94; --ok-tint: #12301f; --warn: #f3b860; --warn-tint: #33240c; --bad: #ff8a80; --bad-tint: #3a1614;
  --focus: #a9dc5f;
  --fb: #8fc4a0; --ig: #e59ac2; --li: #a9c7b2; --tt: #e6f2dc; --yt: #ff7b70; --xx: #c4c4c4;
  --cmp-a: #f0bd52; --cmp-b: #5fcf8c; --cmp-c: #e59ac2; --cmp-d: #ff8d5e;
  --ch-1: #5fcf8c; --ch-2: #ff8d5e; --ch-3: #c7ec8e;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4); --lift: 0 18px 40px -16px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 60; background: var(--night); }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; }
h2 { font-size: 1.15rem; line-height: 1.3; font-weight: 650; }
h3 { font-size: 0.98rem; line-height: 1.35; font-weight: 650; }
p { margin: 0; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.num, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.eyebrow { font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); min-height: 100vh; }
.rail { background: var(--night); color: var(--on-night); position: sticky; top: env(safe-area-inset-top, 0px); height: calc(100vh - env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; padding: 18px 12px 14px max(12px, env(safe-area-inset-left, 0px)); gap: 14px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 10px; border-bottom: 1px solid rgb(255 255 255 / 0.08); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #c23a1c, #9b2f6a); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: #fff; font-size: 14px; flex: none; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 14px; line-height: 1.15; color: #fff; }
.brand-name small { display: block; font-family: var(--font-body); font-weight: 500; font-size: 11.5px; color: var(--on-night-2); letter-spacing: 0.02em; }
.persona { display: grid; grid-template-columns: 1fr 1fr; background: rgb(255 255 255 / 0.06); border-radius: 9px; padding: 3px; gap: 3px; }
.persona button { border: 0; background: transparent; color: var(--on-night-2); padding: 7px 6px; border-radius: 7px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.persona button[aria-pressed="true"] { background: var(--lime); color: #0c3a22; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-night-2); padding: 10px 10px 4px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--on-night); font-weight: 500; font-size: 13.5px; }
.nav a svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav a:hover { background: rgb(255 255 255 / 0.06); }
.nav a[aria-current="page"] { background: rgb(255 255 255 / 0.11); color: #fff; }
.nav a[aria-current="page"] svg { opacity: 1; }
.nav .badge { margin-left: auto; background: var(--ai); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; text-align: center; border-radius: 999px; padding: 1px 6px; font-family: var(--font-mono); }
:root[data-theme="dark"] .nav .badge { color: #1a0d08; }
.rail-foot { margin-top: auto; font-size: 11.5px; color: var(--on-night-2); padding: 10px 8px 0; border-top: 1px solid rgb(255 255 255 / 0.08); display: grid; gap: 8px; }
.rail-foot .legend { display: grid; gap: 5px; }
.rail-foot .legend span { display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.dot.ai { background: #f0703a; } .dot.human { background: #fff; } .dot.mk { background: #8cc63f; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px max(20px, env(safe-area-inset-right, 0px)) 10px 24px; }
.ws { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ws-logo { width: 34px; height: 34px; border-radius: 9px; background: #0f5e6b; color: #f6b544; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 13px; flex: none; }
.ws-name { font-family: var(--font-display); font-weight: 650; font-size: 14.5px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.mode-pill { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px 5px 9px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.mode-pill svg { width: 15px; height: 15px; }
.icon-btn { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn svg { width: 17px; height: 17px; }
.pause-btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid color-mix(in srgb, var(--bad) 35%, var(--line)); color: var(--bad); background: var(--surface); border-radius: 9px; padding: 7px 12px; font-weight: 650; font-size: 13px; cursor: pointer; white-space: nowrap; }
.pause-btn svg { width: 15px; height: 15px; }
.pause-btn[aria-pressed="true"] { background: var(--bad); color: #fff; border-color: var(--bad); }

.banner { display: flex; align-items: center; gap: 12px; padding: 11px 24px; background: var(--bad); color: #fff; font-weight: 600; font-size: 13.5px; }
:root[data-theme="dark"] .banner { color: #1d0807; }
.banner svg { width: 18px; height: 18px; flex: none; }
.banner .btn { margin-left: auto; }

.view { padding: 26px max(24px, env(safe-area-inset-right, 0px)) 60px 28px; display: grid; gap: 22px; max-width: 1280px; width: 100%; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.view-head .lede { color: var(--ink-2); margin-top: 6px; max-width: 62ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- primitives ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none; line-height: 1.2; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--human); color: var(--human-ink); }
.btn.primary:hover { filter: brightness(1.15); }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.ai { background: var(--ai-tint); color: var(--ai); border-color: var(--ai-line); }
.btn.danger { background: var(--surface); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.light { background: #fff; color: #0c3a22; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2, .card-head h3 { font-size: 0.98rem; }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; line-height: 1.6; }
.chip svg { width: 12px; height: 12px; }
.chip.ai { background: var(--ai-tint); color: var(--ai); }
.chip.human { background: var(--human); color: var(--human-ink); }
.chip.mk { background: var(--mk-tint); color: var(--mk); }
.chip.ok { background: var(--ok-tint); color: var(--ok); }
.chip.warn { background: var(--warn-tint); color: var(--warn); }
.chip.bad { background: var(--bad-tint); color: var(--bad); }
.chip.line { background: transparent; border: 1px solid var(--line); }

.net { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-family: var(--font-display); font-size: 10px; font-weight: 800; color: #fff; flex: none; letter-spacing: -0.02em; }
.net.lg { width: 38px; height: 38px; border-radius: 10px; font-size: 14px; }
.net.fb { background: var(--fb); } .net.ig { background: var(--ig); } .net.li { background: var(--li); } .net.gb { background: var(--gb); }
.net.tt { background: var(--tt); color: var(--surface); } .net.yt { background: var(--yt); } .net.xx { background: var(--xx); }
:root[data-theme="dark"] .net:not(.tt) { color: #0a111c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .net:not(.tt) { color: #0a111c; } }
.nets { display: inline-flex; gap: 4px; }

/* AI vs human marks */
.mark-ai { border-left: 3px solid var(--ai); }
.by { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.by .dot.ai { background: var(--ai); } .by .dot.human { background: var(--human); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 4px; min-width: 0; }
.kpis.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi .k { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.kpi .v { font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .d { font-size: 12px; font-weight: 600; color: var(--ok); }
.kpi .d.down { color: var(--bad); }
.kpi.alert { border-color: var(--ai-line); background: linear-gradient(180deg, var(--ai-tint), var(--surface) 70%); }
.kpi.alert .v { color: var(--ai); }

/* loop */
.loop { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; position: relative; }
.loop-step { padding: 14px 12px 12px; display: grid; gap: 5px; position: relative; min-width: 0; }
.loop-step + .loop-step { border-left: 1px dashed var(--line); }
.loop-step .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.loop-step .t { font-family: var(--font-display); font-weight: 650; font-size: 14px; }
.loop-step .s { font-size: 12.5px; color: var(--ink-2); }
.loop-step .who { margin-top: 4px; }
.loop-step.active { background: var(--mk-tint); }
.loop-step.active .t { color: var(--mk); }

/* lists */
.list { display: grid; }
.li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.li:first-child { border-top: 0; }
.li .ttl { font-weight: 600; font-size: 13.5px; line-height: 1.35; }
.li .sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.li.click { cursor: pointer; }
.li.click:hover { background: var(--surface-2); }
.when { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); text-align: right; white-space: nowrap; }

/* post art */
.art { border-radius: 8px; overflow: hidden; background: #0f5e6b; flex: none; display: block; }
.art svg { display: block; width: 100%; height: 100%; }
.thumb { width: 54px; height: 54px; }
.thumb.tall { width: 40px; height: 54px; }

/* approvals */
.queue { display: grid; gap: 14px; }
.qcard { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 0; overflow: hidden; }
.qcard .art { width: 148px; height: 100%; min-height: 168px; border-radius: 0; }
.qbody { padding: 14px 18px 16px; display: grid; gap: 10px; min-width: 0; }
.qtop { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.qtitle { font-family: var(--font-display); font-weight: 650; font-size: 15px; line-height: 1.35; }
.caption { white-space: pre-wrap; font-size: 13.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; max-height: 128px; overflow: auto; }
.why { display: flex; gap: 6px; flex-wrap: wrap; }
.qact { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qact .spacer { flex: 1; }
.empty { padding: 34px 18px; text-align: center; color: var(--ink-3); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 30px; height: 30px; color: var(--ok); }

/* checks */
.checks { display: grid; gap: 6px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.check svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.check.ok svg { color: var(--ok); } .check.wait svg { color: var(--warn); } .check.bad svg { color: var(--bad); }

/* tabs + segmented */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 9px 12px; font-weight: 600; font-size: 13px; color: var(--ink-3); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--lime); }
.tabs .count { font-family: var(--font-mono); font-size: 11px; background: var(--line-2); padding: 0 6px; border-radius: 999px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.cal-h { padding: 8px 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; border-bottom: 1px solid var(--line-2); }
.cal-d { min-height: 112px; padding: 6px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); display: grid; align-content: start; gap: 4px; min-width: 0; }
.cal-d:nth-child(7n) { border-right: 0; }
.cal-d .dn { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); padding: 2px 4px; }
.cal-d.today .dn { background: var(--human); color: var(--human-ink); border-radius: 5px; justify-self: start; font-weight: 600; }
.cal-d.out { background: var(--surface-2); }
.cal-d.out .dn { opacity: 0.5; }
.ev { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px; align-items: center; text-align: left; border: 1px solid var(--line); border-left-width: 3px; background: var(--surface); border-radius: 6px; padding: 4px 6px; font-size: 11.5px; line-height: 1.3; cursor: pointer; width: 100%; }
.ev .et { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .tm { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.ev.published { border-left-color: var(--ok); }
.ev.scheduled { border-left-color: var(--human); }
.ev.waiting { border-left-color: var(--ai); background: var(--ai-tint); }
.ev.auto { border-left-color: var(--mk); }
.ev.held { border-left-color: var(--bad); background: var(--bad-tint); text-decoration: line-through; }
.ev.rejected { opacity: 0.5; text-decoration: line-through; }
.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.cal-list { display: none; }

/* inbox */
.ibox { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.msg { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 11px; padding: 12px 16px; border-top: 1px solid var(--line-2); cursor: pointer; text-align: left; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; }
.msg:first-child { border-top: 0; }
.msg:hover { background: var(--surface-2); }
.msg[aria-current="true"] { background: var(--mk-tint); }
.msg .who { font-weight: 650; font-size: 13.5px; }
.msg .txt { font-size: 13px; color: var(--ink-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thread { display: grid; gap: 14px; }
.bubble { padding: 11px 13px; border-radius: 12px; font-size: 13.5px; max-width: 92%; }
.bubble.them { background: var(--surface-2); border: 1px solid var(--line); justify-self: start; border-bottom-left-radius: 4px; }
.bubble.ours { background: var(--ai-tint); border: 1px solid var(--ai-line); justify-self: end; border-bottom-right-radius: 4px; }
.bubble.ours.sent { background: var(--human); color: var(--human-ink); border-color: transparent; }
.rule { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 9px 11px; }
.rule svg { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--mk); }
textarea, input[type="text"], input[type="email"], select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
textarea:focus, input:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgb(140 198 63 / 0.3); }
label.f { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--ink-3); font-family: var(--font-mono); font-size: 10.5px; }
.chart .grid line { stroke: var(--line-2); }
.chart .area { fill: var(--ch-1); opacity: 0.12; }
.chart .line { fill: none; stroke: var(--ch-1); stroke-width: 2.25; }
.chart .end { fill: var(--ch-1); }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: 116px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 12.5px; }
.bar .track { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 999px; }
.bar .val { font-family: var(--font-mono); text-align: right; color: var(--ink-2); }

/* tables */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.health .dot.ok { background: var(--ok); } .health .dot.warn { background: var(--warn); } .health .dot.bad { background: var(--bad); } .health .dot.off { background: var(--ink-3); }

/* modes */
.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.mode { text-align: left; border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; padding: 16px; display: grid; gap: 8px; cursor: pointer; align-content: start; }
.mode:hover { border-color: var(--ink-3); }
.mode[aria-pressed="true"] { border-color: var(--mk); box-shadow: 0 0 0 3px var(--mk-tint); }
.mode .mt { font-family: var(--font-display); font-weight: 650; font-size: 14.5px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mode .mb { font-size: 13px; color: var(--ink-2); }
.mode .ms { font-size: 12px; color: var(--ink-3); border-top: 1px dashed var(--line); padding-top: 8px; }
.radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.mode[aria-pressed="true"] .radio { border-color: var(--mk); background: radial-gradient(circle, var(--mk) 45%, transparent 50%); }

/* switches */
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line-2); }
.sw-row:first-child { border-top: 0; }
.sw-row .l { min-width: 0; }
.sw-row .l b { font-weight: 600; font-size: 13.5px; display: block; }
.sw-row .l span { font-size: 12.5px; color: var(--ink-3); }
.toggle { width: 40px; height: 23px; border-radius: 999px; background: var(--line); border: 0; position: relative; cursor: pointer; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgb(0 0 0 / 0.25); }
.toggle[aria-checked="true"] { background: var(--mk); }
.toggle[aria-checked="true"]::after { transform: translateX(17px); }
.toggle:disabled { opacity: 0.55; cursor: not-allowed; }

/* accounts */
.acc { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line-2); }
.acc:first-child { border-top: 0; }

/* brand kit */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 54px; display: grid; gap: 4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.swatch i { display: block; height: 40px; border-radius: 8px; border: 1px solid var(--line); }
.slider { display: grid; grid-template-columns: 90px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--ink-3); }
.slider .t { height: 6px; border-radius: 999px; background: var(--line-2); position: relative; }
.slider .t i { position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--mk); transform: translate(-50%, -50%); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--mk); }
.words { display: flex; gap: 6px; flex-wrap: wrap; }

/* wizard */
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.step i { font-style: normal; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); font-family: var(--font-mono); font-size: 11px; }
.step[aria-current="step"] { color: var(--ink); border-color: var(--mk); }
.step[aria-current="step"] i { background: var(--mk); color: #fff; }
.step.done i { background: var(--ok); color: #fff; }
.wiz { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.netgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.netcard { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); align-items: start; }
.netcard .nc-foot { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.goal-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt { text-align: left; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); cursor: pointer; display: grid; gap: 3px; }
.opt b { font-size: 13.5px; } .opt span { font-size: 12.5px; color: var(--ink-3); }
.opt[aria-pressed="true"] { border-color: var(--mk); box-shadow: 0 0 0 3px var(--mk-tint); }
.aside-note { background: var(--night); color: var(--on-night); border-radius: 12px; padding: 18px; display: grid; gap: 10px; font-size: 13px; }
.aside-note h3 { color: #fff; }
.aside-note .muted { color: var(--on-night-2); }

/* drawer + modal */
.scrim { position: fixed; inset: 0; background: rgb(8 13 22 / 0.5); z-index: 70; display: flex; justify-content: flex-end; }
.drawer { width: min(620px, 100%); height: 100%; background: var(--surface); box-shadow: var(--lift); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 18px 20px 28px; overflow-y: auto; display: grid; gap: 18px; align-content: start; flex: 1; }
.drawer-foot { padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface-2); }
.scrim.center { justify-content: center; align-items: center; padding: 16px; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 14px; box-shadow: var(--lift); display: grid; max-height: calc(100vh - 32px); overflow: auto; }
.modal-head { padding: 18px 20px 6px; display: grid; gap: 6px; }
.modal-body { padding: 10px 20px 4px; display: grid; gap: 12px; }
.modal-foot { padding: 14px 20px 18px; display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.perm { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; }
.perm svg { width: 16px; height: 16px; color: var(--ok); flex: none; margin-top: 2px; }
.preview-phone { width: 230px; max-width: 100%; border-radius: 18px; border: 1px solid var(--line); background: var(--surface-2); padding: 10px; display: grid; gap: 8px; justify-self: center; }
.preview-phone .art { width: 100%; aspect-ratio: 4 / 5; max-width: 100%; }
.preview-phone .art.tall { aspect-ratio: 9 / 16; }
.pp-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; }
.pp-av { width: 22px; height: 22px; border-radius: 50%; background: #0f5e6b; color: #f6b544; font-size: 9px; font-weight: 800; display: grid; place-items: center; font-family: var(--font-display); }
.pp-cap { font-size: 11.5px; color: var(--ink-2); white-space: pre-wrap; max-height: 92px; overflow: hidden; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--night); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--lift); z-index: 90; font-size: 13.5px; font-weight: 500; display: flex; gap: 10px; align-items: center; max-width: calc(100% - 32px); }
:root[data-theme="dark"] .toast { background: #e6f2dc; color: #0c3a22; }
.toast svg { width: 17px; height: 17px; color: #8cc63f; flex: none; }

.audit { display: grid; }
.audit .a { display: grid; grid-template-columns: 48px auto minmax(0, 1fr); gap: 10px; padding: 9px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; align-items: start; }
.audit .a:first-child { border-top: 0; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; background: var(--mk-tint); color: var(--ink); font-size: 13px; border: 1px solid var(--mk-line); }
.notice svg { width: 17px; height: 17px; color: var(--mk); flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.warn svg { color: var(--warn); }
.demo-tag { font-size: 11px; font-weight: 600; color: var(--on-night-2); border: 1px dashed rgb(255 255 255 / 0.25); border-radius: 6px; padding: 4px 7px; text-align: center; }

/* phone */
.tabbar { display: none; }
@media (max-width: 1100px) {
  .g-main, .ibox { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .loop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .loop-step:nth-child(4) { border-left: 0; }
  .loop-step:nth-child(n+4) { border-top: 1px dashed var(--line); }
  .wiz { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .topbar { padding: 9px max(14px, env(safe-area-inset-right, 0px)) 9px max(14px, env(safe-area-inset-left, 0px)); gap: 8px; }
  .mode-pill .mp-t { display: none; }
  .pause-btn .pb-t { display: none; }
  .pause-btn { padding: 8px 10px; }
  .view { padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); gap: 16px; }
  .banner { padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); flex-wrap: wrap; }
  h1 { font-size: 1.32rem; }
  .kpis, .kpis.k3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .v { font-size: 1.3rem; }
  .g2, .g3, .modes, .netgrid, .goal-opts { grid-template-columns: minmax(0, 1fr); }
  .loop { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loop-step:nth-child(n) { border-left: 0; border-top: 1px dashed var(--line); }
  .loop-step:nth-child(even) { border-left: 1px dashed var(--line); }
  .loop-step:nth-child(-n+2) { border-top: 0; }
  .qcard { grid-template-columns: minmax(0, 1fr); }
  .qcard .art { width: 100%; height: 150px; min-height: 0; }
  .cal { display: none; }
  .cal-list { display: grid; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--night); padding: 6px max(6px, env(safe-area-inset-right, 0px)) calc(6px + env(safe-area-inset-bottom, 0px)) max(6px, env(safe-area-inset-left, 0px)); }
  .tabbar a, .tabbar button { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; color: var(--on-night-2); text-decoration: none; font-size: 10.5px; font-weight: 600; border: 0; background: transparent; position: relative; cursor: pointer; }
  .tabbar svg { width: 20px; height: 20px; }
  .tabbar [aria-current="page"] { color: #fff; }
  .tabbar .badge { position: absolute; top: 1px; left: calc(50% + 6px); background: var(--ai); color: #fff; font-size: 9.5px; font-weight: 700; border-radius: 999px; padding: 0 5px; font-family: var(--font-mono); }
  .bar { grid-template-columns: 92px minmax(0, 1fr) 54px; }
  .li { padding: 12px 14px; }
  .card-head, .card-body { padding-left: 14px; padding-right: 14px; }
  .acc { grid-template-columns: auto minmax(0, 1fr); padding: 14px; }
  .acc > :last-child { grid-column: 1 / -1; justify-self: start; }
  .slider { grid-template-columns: 70px minmax(0, 1fr) 70px; }
  .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; }
}
@media (max-width: 380px) {
  .ws-sub { display: none; }
  .kpis { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
