/* Push Agent v2 */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e4e7ef;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8a94a8;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-soft: #eef0ff;
  --green: #059669; --green-soft: #e7f7f1;
  --amber: #b45309; --amber-soft: #fdf3e2;
  --red: #dc2626; --red-soft: #fdecec;
  --blue: #0369a1; --blue-soft: #e6f3fb;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.05);
  --shadow-lg: 0 20px 50px rgba(15,23,42,.18);
  --radius: 14px;
  --sidebar: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f1a; --surface: #121826; --surface-2: #1a2233; --border: #242d40;
    --text: #e8ecf5; --text-2: #aab4c8; --muted: #748099;
    --brand: #818cf8; --brand-2: #a5b4fc; --brand-soft: #1e2145;
    --green: #34d399; --green-soft: #0f2a22; --amber: #fbbf24; --amber-soft: #2b2112;
    --red: #f87171; --red-soft: #2d1616; --blue: #7dd3fc; --blue-soft: #10233a;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f1a; --surface: #121826; --surface-2: #1a2233; --border: #242d40;
  --text: #e8ecf5; --text-2: #aab4c8; --muted: #748099;
  --brand: #818cf8; --brand-2: #a5b4fc; --brand-soft: #1e2145;
  --green: #34d399; --green-soft: #0f2a22; --amber: #fbbf24; --amber-soft: #2b2112;
  --red: #f87171; --red-soft: #2d1616; --blue: #7dd3fc; --blue-soft: #10233a;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 20px 50px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- boot / spinner ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 4px 12px rgba(99,102,241,.35); }
.brand-mark svg.i { width: 18px; height: 18px; }
.site-switch { position: relative; margin-bottom: 14px; }
.site-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; cursor: pointer; color: var(--text); font: inherit;
}
.site-btn:hover { border-color: var(--brand-2); }
.site-btn img, .site-ico { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; background: var(--surface); flex: none; }
.site-btn .meta { min-width: 0; flex: 1; }
.site-btn .meta b { display: block; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-btn .meta span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; max-height: 320px; overflow: auto;
}
.menu button, .menu a { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0;
  background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav .label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }
.nav a .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding-top: 14px; }

.main { min-width: 0; overflow-x: clip; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .title .muted { font-size: 12.5px; }
.btn.menu-toggle { display: none; }
.user-menu { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center;
  font-weight: 600; font-size: 13px; overflow: hidden; border: 0; cursor: pointer; padding: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-menu .menu { left: auto; right: 0; width: 220px; }
.page { padding: 26px 28px 60px; max-width: 1280px; width: 100%; margin: 0 auto; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.card-b { padding: 16px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: .12s;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.25); }
:root[data-theme="dark"] .btn.primary { color: #0b0f1a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0b0f1a; } }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; }
.icon-btn { width: 36px; height: 36px; padding: 0; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.pulse::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .2; } }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; border: 1px solid; }
.alert svg.i { margin-top: 1px; }
.alert.amber { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 30%, transparent); color: var(--text); }
.alert.amber svg.i { color: var(--amber); }
.alert.red { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert.red svg.i { color: var(--red); }
.alert.blue { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.alert.blue svg.i { color: var(--blue); }
.alert b { display: block; margin-bottom: 2px; }

/* KPI */
.kpi { padding: 18px; }
.kpi .top { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-weight: 500; font-size: 13px; }
.kpi .ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.kpi .ico.green { background: var(--green-soft); color: var(--green); }
.kpi .ico.amber { background: var(--amber-soft); color: var(--amber); }
.kpi .ico.blue { background: var(--blue-soft); color: var(--blue); }
.kpi .val { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.kpi .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* charts */
.chart { width: 100%; height: 220px; display: block; }
.chart .bar { fill: var(--brand-2); }
.chart .bar:hover { fill: var(--brand); }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .grid-l { stroke: var(--border); stroke-dasharray: 3 4; }
.bars-list { display: flex; flex-direction: column; gap: 11px; }
.bars-list .it { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.bars-list .it .n { color: var(--text-2); font-variant-numeric: tabular-nums; }
.bars-list .track { grid-column: 1 / -1; height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bars-list .fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 99px; }
.flag { font-size: 16px; margin-right: 6px; }

/* table */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr.click:hover td { background: var(--surface-2); }
table.t .r { text-align: right; }
.cell-title b { display: block; font-weight: 600; max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-title span { display: block; color: var(--muted); font-size: 12.5px; max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s ease; }
.progress.lg { height: 10px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty .ico svg.i { width: 24px; height: 24px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }

.skel { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-weight: 600; font-size: 13px; }
.field .hint { color: var(--muted); font-size: 12px; }
.field .counter { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input[readonly] { background: var(--surface-2); }
.form { display: flex; flex-direction: column; gap: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.upload { display: flex; align-items: center; gap: 12px; }
.upload .thumb { width: 56px; height: 56px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border); object-fit: cover; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.upload .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload input[type=file] { display: none; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 10px; gap: 2px; }
.seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 8px; color: var(--text-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--border);
  background: var(--surface); font: inherit; font-size: 12.5px; font-weight: 500; color: var(--text-2); cursor: pointer; }
.chip:hover { border-color: var(--muted); }
.chip.on { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.chip .n { color: var(--muted); font-size: 11.5px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 500; }
.switch input { display: none; }
.switch .tr { width: 36px; height: 20px; border-radius: 99px; background: var(--border); position: relative; transition: .15s; }
.switch .tr::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .tr { background: var(--brand); }
.switch input:checked + .tr::after { left: 18px; }

/* composer */
.composer { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 20px; align-items: start; }
.preview-col { position: sticky; top: 84px; }
.audience-count { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.audience-count b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stage { border-radius: 14px; padding: 26px 18px; min-height: 260px; display: flex; align-items: flex-start; justify-content: center; }
.stage.desktop { background: linear-gradient(135deg, #1e3a8a, #6d28d9 60%, #db2777); }
.stage.android { background: linear-gradient(180deg, #111827, #1f2937); }
.n-desktop { width: 100%; max-width: 360px; background: #fff; color: #1f2937; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.35); overflow: hidden; font-family: "Segoe UI", Inter, sans-serif; }
.n-desktop .hd { display: flex; align-items: center; gap: 6px; padding: 8px 12px; font-size: 11.5px; color: #6b7280; }
.n-desktop .hd img { width: 14px; height: 14px; }
.n-desktop .bd { display: flex; gap: 12px; padding: 4px 12px 12px; }
.n-desktop .bd img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; flex: none; }
.n-desktop .t { font-weight: 600; font-size: 13.5px; }
.n-desktop .m { font-size: 12.5px; color: #4b5563; margin-top: 2px; word-break: break-word; }
.n-desktop .s { font-size: 11.5px; color: #9ca3af; margin-top: 3px; }
.n-desktop .banner, .n-android .banner { width: 100%; max-height: 170px; object-fit: cover; display: block; }
.n-android { width: 100%; max-width: 340px; background: #2a2f3a; color: #f3f4f6; border-radius: 18px; padding: 12px 14px; font-family: Roboto, Inter, sans-serif; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.n-android .hd { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #9ca3af; }
.n-android .bd { display: flex; gap: 10px; margin-top: 6px; }
.n-android .bd img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex: none; }
.n-android .t { font-weight: 600; font-size: 13.5px; }
.n-android .m { font-size: 12.5px; color: #d1d5db; word-break: break-word; }
.n-android .banner { border-radius: 10px; margin-top: 10px; }

/* modal / drawer */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(15,23,42,.45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); max-height: calc(100vh - 32px); overflow: auto; }
.modal .mh { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 0; }
.modal .mb { padding: 16px 20px 20px; }
.modal .mf { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-row > div { background: var(--surface-2); border-radius: 12px; padding: 12px; }
.stat-row b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stat-row span { font-size: 12px; color: var(--muted); }

/* code */
.code { position: relative; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: 16px 96px 16px 16px; font: 12.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; }
.code .copy { position: absolute; top: 10px; right: 10px; }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 22px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; }
.step::before { counter-increment: s; content: counter(s); width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.step h3 { margin: 4px 0 6px; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { position: relative; overflow: hidden; padding: 48px; color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -10%, #8b5cf6 0, transparent 55%), radial-gradient(900px 500px at 110% 110%, #ec4899 0, transparent 55%), #312e81; }
.auth-art h2 { font-size: 34px; line-height: 1.15; font-weight: 700; max-width: 440px; letter-spacing: -.02em; }
.auth-art p { opacity: .8; max-width: 420px; margin-top: 12px; font-size: 15px; }
.auth-art .brand { color: #fff; padding: 0; }
.float-n { background: rgba(255,255,255,.95); color: #1f2937; border-radius: 12px; padding: 12px; display: flex; gap: 10px; width: 300px; box-shadow: 0 20px 40px rgba(0,0,0,.25); font-size: 12.5px; }
.float-n .d { width: 36px; height: 36px; border-radius: 9px; background: linear-gradient(135deg, #6366f1, #ec4899); flex: none; }
.float-n b { display: block; font-size: 13px; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h1 { font-size: 26px; margin-bottom: 6px; }
.pw { position: relative; }
.pw .btn { position: absolute; right: 4px; top: 4px; height: 32px; width: 32px; }

/* toasts */
#toasts { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 380px; padding: 12px 14px; border-radius: 12px; background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); animation: fade .18s; font-weight: 500; }
.toast.err { background: var(--red); color: #fff; }

/* responsive */
@media (max-width: 1100px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .composer { grid-template-columns: minmax(0, 1fr); }
  .preview-col { position: static; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 45; background: rgba(15,23,42,.4); }
  .btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .page { padding: 18px 16px 48px; }
  .g-3, .g-2, .two { grid-template-columns: minmax(0, 1fr); }
  .chart { height: 180px; }
  .topbar .title .muted { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .hide-sm { display: none; }
}
@media (max-width: 520px) { .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; } .kpi .val { font-size: 22px; } }
.hide { display: none !important; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

/* brand logo */
.brand-logo { width: 32px; height: 32px; object-fit: contain; flex: none; }
.auth-logo { height: 52px; width: auto; align-self: flex-start; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; margin-bottom: 28px; }
.auth-mobile-brand img { width: 36px; height: 36px; }
@media (max-width: 860px) { .auth-mobile-brand { display: flex; } }

.ts-box:empty { display: none; }
.ts-box { min-height: 65px; }

/* Google sign-in */
.g-wrap { display: flex; justify-content: center; min-height: 44px; }
.g-btn { width: 100%; display: flex; justify-content: center; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

/* Integration steps: keep long URLs and code inside the card */
.step { grid-template-columns: 34px minmax(0, 1fr); }
.step > div, .grid > *, .stack > * { min-width: 0; }
.step p, .step code { overflow-wrap: anywhere; word-break: break-word; }
.code { max-width: 100%; overflow-x: auto; }
.step .code { white-space: pre-wrap; word-break: break-all; }

/* Integration: access token field */
.token-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

/* Integration: WordPress / Joomla box with access token */
.plugin-box { border-color: color-mix(in srgb, var(--brand) 35%, var(--border)); background: linear-gradient(135deg, var(--brand-soft), var(--surface) 75%); }
.plugin-box h2 { margin: 0; }
.token-box { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.token-box label { font-weight: 600; font-size: 13px; }
.token-code { margin-top: 6px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; user-select: all; }

/* ---------- v3: plans, limits and admin ---------- */
.badge.lock { gap: 4px; background: var(--surface-2); color: var(--text-2); text-decoration: none; font-size: 11px; height: 20px; padding: 0 8px; vertical-align: middle; }
.badge.lock svg.i { width: 12px; height: 12px; }
.badge.lock:hover { color: var(--brand); }
.card-h h2 .badge.lock { margin-left: 6px; }
.switch.locked { opacity: .55; cursor: not-allowed; }
.plan-chip { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px; padding: 9px 12px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 600; text-decoration: none; }
.plan-chip b { color: var(--brand); font-weight: 700; }
.plan-chip:hover { color: var(--text); }
.meter { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.meter .row { font-size: 14px; }
.meter .progress { height: 8px; }
.progress > div.near { background: var(--amber); }
.progress > div.over { background: var(--red); }
.over-txt { color: var(--red); font-weight: 700; }
.feat-list { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); }
.feat-list span { display: inline-flex; align-items: center; gap: 6px; }
.feat-list span svg.i { width: 15px; height: 15px; }
.feat-list span.on { color: var(--text-2); }
.feat-list span.on svg.i { color: var(--green); }
fieldset.optin { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px 18px; margin: 0; min-width: 0; }
fieldset.optin h3 { margin: 0; font-size: 15px; }
fieldset.optin.locked .optin-grid .form { opacity: .55; }
.optin-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; margin-top: 12px; align-items: start; }
.optin-preview { background: var(--surface-2); border-radius: 12px; padding: 16px; }
.optin-card { display: flex; gap: 12px; background: #fff; color: #1f2937; border-radius: 12px; padding: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.12); font-size: 13px; line-height: 1.45; }
.optin-card img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; flex: none; }
.optin-card b { display: block; font-size: 14px; margin-bottom: 2px; word-break: break-word; }
.optin-card p { margin: 0; color: #4b5563; word-break: break-word; }
.optin-card small { display: block; margin-top: 8px; color: #9ca3af; font-size: 11px; }
.optin-btns { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.optin-btns span { border: 1px solid #e5e7eb; border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: 12px; }
.optin-btns span.y { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.modal.wide { max-width: 760px; max-height: calc(100vh - 32px); overflow: auto; }
@media (max-width: 860px) { .optin-grid { grid-template-columns: 1fr; } }

/* ---------- v4: API & WooCommerce ---------- */
.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row .input { flex: 1; min-width: 0; }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 10px; line-height: 1.55; }
.steps-list .btn { margin-left: 6px; vertical-align: middle; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2::after { content: " +"; color: var(--muted); font-weight: 400; }
details.card[open] > summary h2::after { content: " −"; }
pre.code { padding: 16px; white-space: pre-wrap; word-break: break-all; margin: 0; }

/* ---------------------------------------------------------------- v5: A/B testing + RSS auto-push */
.cell-title .tags { display: flex; gap: 6px; margin-top: 5px; white-space: normal; overflow: visible; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-style: normal; font-size: 11px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; }
.tag svg { width: 12px; height: 12px; }
.tag.ab { color: var(--brand); background: var(--brand-soft); border-color: transparent; }

.ab-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text-2); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.ab-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; color: var(--brand); }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice { text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: grid; gap: 4px; transition: border-color .15s, background .15s; }
.choice b { font-size: 14px; }
.choice span { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.choice:hover { border-color: var(--brand-2); }
.choice.on { border-color: var(--brand); background: var(--brand-soft); }
.ab-summary { border: 1px dashed var(--border); border-radius: 12px; padding: 12px 14px; }
.ab-summary p { margin: 8px 0 0; }
.ab-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ab-flow svg { width: 15px; height: 15px; color: var(--muted); }
.ab-flow .arrow { color: var(--muted); font-weight: 700; }
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; }
.pill.a { background: var(--blue-soft); color: var(--blue); }
.pill.b { background: var(--amber-soft); color: var(--amber); }
.pill.w { background: var(--green-soft); color: var(--green); }
.ab-results { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.ab-results .row svg { width: 16px; height: 16px; color: var(--brand); }
.t.compact th, .t.compact td { padding: 8px 10px; }
.t.compact .cell-title b, .t.compact .cell-title span { max-width: 230px; }
.t tr.win td { background: var(--green-soft); }
.t td.lead { color: var(--green); font-weight: 700; }
.vtag { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 800; margin-right: 8px; vertical-align: -1px; }
.vtag.a { background: var(--blue-soft); color: var(--blue); }
.vtag.b { background: var(--amber-soft); color: var(--amber); }
.ab-results .badge { margin-top: 5px; }

.feed-list { display: grid; gap: 12px; }
.feed { display: flex; gap: 14px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.feed-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--amber-soft); color: var(--amber); flex: none; }
.feed-ico svg { width: 20px; height: 20px; }
.feed-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.feed-url { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; display: block; }
.feed-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.feed-meta span { display: inline-flex; align-items: center; gap: 4px; }
.feed-meta svg { width: 13px; height: 13px; }
.feed-err { display: flex; gap: 6px; align-items: center; color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 6px 10px; margin-top: 4px; }
.feed-err svg { width: 14px; height: 14px; flex: none; }
.feed-actions { display: flex; gap: 4px; flex: none; align-items: center; }
.feed-preview { border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: grid; gap: 10px; background: var(--surface-2); }
.fp-item { display: flex; gap: 10px; align-items: center; min-width: 0; }
.fp-item img, .fp-noimg { width: 52px; height: 36px; border-radius: 6px; object-fit: cover; flex: none; background: var(--surface); }
.fp-noimg { display: grid; place-items: center; color: var(--muted); }
.fp-noimg svg { width: 16px; height: 16px; }
.fp-item > div { min-width: 0; display: grid; }
.fp-item b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.card > summary { list-style: none; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
@media (max-width: 720px) {
  .choice-grid { grid-template-columns: 1fr; }
  .feed { flex-wrap: wrap; }
  .feed-actions { width: 100%; justify-content: flex-end; }
}
.cell-title .vtag { display: inline-grid; max-width: none; color: inherit; font-size: 11px; }
.cell-title .vtag.a { color: var(--blue); } .cell-title .vtag.b { color: var(--amber); }
.ab-results .badge { font-style: normal; }
