/* Funnel Lab dashboard: a neutral, dark control-room UI (deliberately calm so the funnels stand out). */
:root {
  color-scheme: dark;
  --page: #0c0d0f;
  --surface-1: #16171a;
  --surface-2: #1d1e22;
  --surface-3: #25262b;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --series-1: #3987e5;
  --series-1-soft: rgba(57, 135, 229, 0.16);
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--page); color: var(--text-primary); font: 14px/1.45 var(--font); }
body { -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: #7fb4f0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

/* ---- header ---- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 14px 28px; background: rgba(12, 13, 15, 0.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--border-strong); }
.logo-mark svg { width: 18px; height: 18px; }
.logo h1 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: 0.2px; }
.logo small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 500; }
.top-kpis { display: flex; gap: 6px; margin-left: auto; }
.kpi { min-width: 92px; padding: 6px 12px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--border); }
.kpi b { display: block; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--text-muted); font-size: 11.5px; }
.top-actions { display: flex; gap: 8px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 9px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-primary); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn.primary { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.btn.primary:hover { background: #4b95ec; }
.btn.ghost { background: transparent; }
.btn.danger { color: #ff8f8f; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.iconbtn { width: 34px; padding: 0; }

/* ---- main grid ---- */
main { padding: 22px 28px 60px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.section-head p { margin: 0; color: var(--text-muted); font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(540px, 1fr)); gap: 16px; }
@media (max-width: 1180px) { .grid { grid-template-columns: 1fr; } }

.card { position: relative; display: grid; grid-template-columns: 132px 1fr; gap: 18px; padding: 16px; border-radius: var(--radius); background: var(--surface-1); border: 1px solid var(--border); transition: border-color 0.15s, transform 0.15s; min-height: 262px; }
.card:hover { border-color: var(--border-strong); }
.thumb { position: relative; width: 132px; height: 234px; border-radius: 12px; overflow: hidden; background: #0a0a0b; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.thumb img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play-ov { z-index: 2; }
.thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 12px; text-align: center; padding: 10px; background: repeating-linear-gradient(135deg, #141416 0 10px, #18181b 10px 20px); }
.thumb .play-ov { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); opacity: 0; transition: opacity 0.15s; }
.thumb:hover .play-ov, .thumb:focus-visible .play-ov { opacity: 1; }
.play-ov span { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.92); color: #111; }
.play-ov svg { width: 18px; height: 18px; margin-left: 3px; }
.card-body { display: flex; flex-direction: column; min-width: 0; }
.card-title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 700; }
.card-title .num { color: var(--text-muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.card-desc { margin: 4px 0 8px; color: var(--text-secondary); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-secondary); font-size: 11.5px; font-weight: 600; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip .sw { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; border: 1px solid rgba(255, 255, 255, 0.25); }
.chip.status-good { color: #b9f0b9; }
.chip.status-good::before { content: "●"; color: var(--good); font-size: 9px; }
.chip.status-warn::before { content: "▲"; color: var(--warning); font-size: 9px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; }

/* mini funnel */
.funnel { display: grid; grid-template-columns: 52px 1fr 54px 48px; align-items: center; column-gap: 8px; row-gap: 5px; font-size: 12px; }
.funnel .lbl { color: var(--text-secondary); }
.funnel .bar { position: relative; height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.funnel .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; transition: width 0.4s; }
.funnel .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.funnel .rate { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.funnel-empty { color: var(--text-muted); font-size: 12.5px; padding: 6px 0; }
.funnel-zero { opacity: 0.45; }
.funnel-zero .bar i { display: none; }

.card.soon { grid-template-columns: 132px 1fr; opacity: 0.78; }
.card.soon .thumb { cursor: default; }
.soon-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; background: rgba(250, 178, 25, 0.12); color: #ffd27a; font-size: 11.5px; font-weight: 700; }
.soon-badge::before { content: "◔"; margin-right: 5px; }
.card.add { grid-template-columns: 1fr; place-items: center; text-align: center; border-style: dashed; cursor: pointer; background: transparent; }
.card.add:hover { background: var(--surface-1); }
.add-inner { display: grid; justify-items: center; gap: 8px; color: var(--text-secondary); }
.add-inner .plus { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); font-size: 24px; color: var(--text-primary); }
.add-inner b { color: var(--text-primary); font-size: 15px; }

.dash-foot { padding: 0 28px 28px; color: var(--text-muted); font-size: 12px; }
.chip.pack-chip { color: #e7d7a8; }

/* ---- overlay shells (play, drawers, docs) ---- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(4, 5, 6, 0.72); backdrop-filter: blur(4px); display: flex; }
.drawer { margin-left: auto; width: min(640px, 100%); height: 100%; background: var(--surface-1); border-left: 1px solid var(--border-strong); display: flex; flex-direction: column; box-shadow: -20px 0 50px rgba(0, 0, 0, 0.45); animation: drawer-in 0.22s ease-out; }
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-head small { color: var(--text-muted); display: block; font-size: 12px; }
.drawer-head .spacer { flex: 1; }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 30px; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer-foot .spacer { flex: 1; }

/* play view */
.play { flex-direction: column; background: #08090a; backdrop-filter: none; }
.play-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-1); }
.play-bar h3 { margin: 0 8px 0 0; font-size: 15px; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); gap: 2px; }
.seg button { height: 28px; padding: 0 11px; border-radius: 7px; border: 0; background: transparent; color: var(--text-secondary); font-weight: 600; font-size: 12.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.seg svg { width: 14px; height: 14px; }
.play-main { flex: 1; display: grid; grid-template-columns: 1fr 330px; min-height: 0; }
.stagearea { position: relative; display: grid; place-items: center; grid-template: minmax(0, 1fr) / minmax(0, 1fr); overflow: hidden; background: radial-gradient(80% 70% at 50% 40%, #1a1b1f, #08090a); }
.device { position: relative; transform-origin: center center; }
.device iframe { display: block; border: 0; background: #000; }
.device.phone { padding: 14px; border-radius: 62px; background: linear-gradient(145deg, #3a3b40, #121214 40%, #26272b); box-shadow: 0 0 0 2px #4a4b50, 0 0 0 3px #0c0c0d, 0 40px 80px rgba(0, 0, 0, 0.6), inset 0 0 6px rgba(255, 255, 255, 0.12); }
.device.phone iframe { border-radius: 0 0 48px 48px; }
.device.phone .statusbar { height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 6px 34px 0 40px; background: #000; color: #fff; font: 600 15px/1 var(--font); border-radius: 48px 48px 0 0; }
.sb-icons { display: inline-flex; align-items: flex-end; gap: 2px; }
.sb-icons i { width: 3px; background: #fff; border-radius: 1px; }
.sb-icons i:nth-child(1) { height: 5px; } .sb-icons i:nth-child(2) { height: 8px; } .sb-icons i:nth-child(3) { height: 11px; }
.sb-icons b { width: 22px; height: 11px; margin-left: 6px; border-radius: 3px; border: 1.5px solid rgba(255, 255, 255, 0.8); box-shadow: inset 0 0 0 1.5px #000, inset 15px 0 0 #fff; }
.device.phone::before { content: ""; position: absolute; top: 22px; left: 50%; width: 122px; height: 34px; margin-left: -61px; border-radius: 20px; background: #000; z-index: 2; box-shadow: inset 0 0 0 1.5px #1b1b1d; }
.device.phone::after { content: ""; position: absolute; top: 120px; right: -4px; width: 4px; height: 78px; border-radius: 0 3px 3px 0; background: #2a2b2f; box-shadow: 0 110px 0 #2a2b2f; }
.device.phone .btn-l { position: absolute; left: -4px; top: 150px; width: 4px; height: 52px; border-radius: 3px 0 0 3px; background: #2a2b2f; box-shadow: 0 70px 0 #2a2b2f; }
.device.tablet { padding: 22px; border-radius: 40px; background: linear-gradient(145deg, #34353a, #141416 45%, #26272b); box-shadow: 0 0 0 2px #45464b, 0 40px 80px rgba(0, 0, 0, 0.6); }
.device.tablet iframe { border-radius: 20px; }
.device.desktop { border-radius: 12px; overflow: hidden; background: #1c1d20; box-shadow: 0 0 0 1px #3a3b40, 0 40px 80px rgba(0, 0, 0, 0.6); }
.device.desktop .chrome { height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 14px; background: #232428; border-bottom: 1px solid #111; }
.device.desktop .chrome i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.device.desktop .chrome i:nth-child(2) { background: #febc2e; }
.device.desktop .chrome i:nth-child(3) { background: #28c840; }
.device.desktop .chrome .url { margin-left: 14px; flex: 1; height: 24px; border-radius: 6px; background: #151618; color: var(--text-muted); font: 12px/24px var(--mono); padding: 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.device .label { position: absolute; left: 0; right: 0; bottom: -30px; text-align: center; color: var(--text-muted); font-size: 12px; }

.side { border-left: 1px solid var(--border); background: var(--surface-1); display: flex; flex-direction: column; min-height: 0; }
.side h4 { margin: 0; padding: 14px 16px 8px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); }
.side .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; padding: 0 16px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.side .kv span { color: var(--text-muted); }
.side .kv b { font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evlist { flex: 1; overflow: auto; padding: 0 8px 12px; margin: 0; list-style: none; font-size: 12.5px; }
.evlist li { display: grid; grid-template-columns: 62px 1fr; gap: 8px; padding: 6px 8px; border-radius: 7px; }
.evlist li:first-child { animation: ev-in 0.4s ease-out; }
@keyframes ev-in { from { background: var(--series-1-soft); } }
.evlist time { color: var(--text-muted); font-family: var(--mono); font-size: 11.5px; }
.evlist b { font-weight: 650; }
.evlist em { font-style: normal; color: var(--text-secondary); }
.ev-empty { color: var(--text-muted); padding: 10px 16px; font-size: 12.5px; }

/* forms */
.form-sec { margin: 0 0 22px; }
.form-sec > h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.form-sec > p.help { margin: -4px 0 10px; color: var(--text-muted); font-size: 12.5px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > span { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.field small { color: var(--text-muted); font-size: 11.5px; }
input[type="text"], input[type="url"], input[type="number"], select, textarea {
  width: 100%; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--page); color: var(--text-primary); outline: none;
}
textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--series-1); box-shadow: 0 0 0 3px var(--series-1-soft); }
input[type="color"] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--border-strong); border-radius: 7px; background: transparent; cursor: pointer; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.toggle input { width: 16px; height: 16px; accent-color: var(--series-1); }
.radios { display: flex; gap: 8px; }
.radios label { flex: 1; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; }
.radios label:has(input:checked) { border-color: var(--series-1); background: var(--series-1-soft); }
.radios b { display: block; font-size: 13px; }
.radios small { color: var(--text-muted); font-size: 12px; }
.radios input { margin-top: 3px; accent-color: var(--series-1); }
.colors { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.colors label { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-secondary); padding: 4px 6px; border-radius: 8px; background: var(--surface-2); }
.colors label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.theme-tile { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; }
.theme-tile:has(input:checked) { border-color: var(--series-1); background: var(--series-1-soft); }
.theme-tile input { position: absolute; opacity: 0; pointer-events: none; }
.theme-tile:has(input:focus-visible) { outline: 2px solid var(--series-1); outline-offset: 2px; }
.theme-tile .sw-row { display: flex; gap: 3px; margin-bottom: 4px; }
.theme-tile .sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(255, 255, 255, 0.25); }
.theme-tile b { font-size: 13px; }
.theme-tile small { color: var(--text-muted); font-size: 11.5px; line-height: 1.3; }
.art-slots { display: grid; gap: 10px; }
.art-slot { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.art-prev { width: 96px; height: 64px; border-radius: 8px; display: grid; place-items: center; overflow: hidden; color: var(--text-muted); font-size: 12px; background: repeating-conic-gradient(#202125 0% 25%, #18191c 0% 50%) 50% / 14px 14px; }
.art-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.art-info b { display: block; font-size: 13px; }
.art-info small { display: block; color: var(--text-muted); font-size: 12px; }
.art-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.offers { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 12.5px; }
.offers th { text-align: left; font-size: 11px; color: var(--text-muted); font-weight: 600; padding: 0 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.offers td { padding: 0 3px; vertical-align: middle; }
.offers td input, .offers td select { height: 30px; padding: 0 7px; font-size: 12.5px; }
.offers .ic { width: 30px; height: 30px; }
.offers .ic svg { width: 30px; height: 30px; display: block; }
.offers .chance { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; white-space: nowrap; }
.offers tr.off td { opacity: 0.45; }
.offer-row-2 td { padding-top: 0; }
.msgs { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 6px; }
.msgs li { padding: 8px 10px; border-radius: 8px; font-size: 12.5px; display: flex; gap: 8px; }
.msgs .err { background: rgba(208, 59, 59, 0.14); color: #ffb3b3; }
.msgs .err::before { content: "✕"; color: var(--critical); font-weight: 800; }
.msgs .warn { background: rgba(250, 178, 25, 0.1); color: #ffdf9e; }
.msgs .warn::before { content: "▲"; color: var(--warning); }
.label-search { margin-bottom: 10px; }
.labels-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.labels-grid .field > span { font-family: var(--mono); font-weight: 500; font-size: 11.5px; color: var(--text-muted); }

/* stats */
.hero { display: flex; gap: 10px; margin-bottom: 18px; }
.hero .kpi { flex: 1; padding: 10px 12px; background: var(--surface-2); }
.hero .kpi b { font-size: 22px; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: 11.5px; padding: 6px 8px; border-bottom: 1px solid var(--baseline); }
.table td { padding: 7px 8px; border-bottom: 1px solid var(--grid); }
.table td.r, .table th.r { text-align: right; }
.cmpbar { position: relative; height: 12px; min-width: 120px; background: var(--surface-3); border-radius: 4px; }
.cmpbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--series-1); border-radius: 0 4px 4px 0; }
.cmpbar u { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-secondary); text-decoration: none; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-secondary); margin: 8px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw-bar { width: 14px; height: 8px; border-radius: 2px; background: var(--series-1); }
.legend .sw-tick { width: 2px; height: 12px; background: var(--text-secondary); }
.verdict { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.verdict .ico { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; font-size: 12px; color: #fff; }
.verdict.good .ico { background: var(--good); }
.verdict.warn .ico { background: var(--warning); color: #241800; }
.verdict.info .ico { background: var(--surface-3); color: var(--text-secondary); }
.verdict small { display: block; color: var(--text-muted); margin-top: 2px; font-size: 12px; }
.tip { position: fixed; z-index: 90; pointer-events: none; padding: 6px 9px; border-radius: 7px; background: #000; border: 1px solid var(--border-strong); font-size: 12px; color: #fff; white-space: nowrap; }

/* docs */
.docs { margin: auto; width: min(900px, 94%); height: 90%; background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; }
.md { padding: 10px 30px 40px; overflow: auto; flex: 1; line-height: 1.6; color: var(--text-secondary); }
.md h1, .md h2, .md h3 { color: var(--text-primary); line-height: 1.25; }
.md h1 { font-size: 24px; } .md h2 { font-size: 18px; margin-top: 30px; border-bottom: 1px solid var(--border); padding-bottom: 6px; } .md h3 { font-size: 15px; margin-top: 22px; }
.md code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; color: #e7e6df; }
.md pre { background: #0b0c0d; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; overflow: auto; }
.md pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.5; }
.md table { border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.md th, .md td { border: 1px solid var(--grid); padding: 6px 9px; text-align: left; vertical-align: top; }
.md li { margin: 3px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; padding: 10px 16px; border-radius: 10px; background: #f2f2ee; color: #111; font-weight: 600; font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: toast-in 0.2s ease-out; }
@keyframes toast-in { from { transform: translate(-50%, 10px); opacity: 0; } }

/* ---- small screens (phones, narrow windows): one column, wrapping bars, full-width drawers ---- */
@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 10px; padding: 10px max(14px, env(safe-area-inset-right, 0px)) 10px max(14px, env(safe-area-inset-left, 0px)); }
  .logo small { display: none; }
  .top-actions { margin-left: auto; }
  .top-kpis { order: 3; width: 100%; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .top-kpis::-webkit-scrollbar { display: none; }
  .kpi { min-width: 74px; flex: 0 0 auto; }
  main { padding: 14px max(14px, env(safe-area-inset-right, 0px)) 40px max(14px, env(safe-area-inset-left, 0px)); }
  .section-head { flex-wrap: wrap; gap: 4px 10px; }
  .dash-foot { padding: 0 14px 20px; }
  .card { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px; min-height: 0; }
  .thumb { width: 96px; height: 170px; }
  .btn { height: 38px; }
  .btn.sm { height: 34px; }
  .iconbtn { width: 38px; }
  .play-bar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .play-bar h3 { flex: 1 1 100%; margin: 0; }
  .play-bar > span[style] { display: none; }
  .play-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .side { border-left: 0; border-top: 1px solid var(--border); max-height: 30vh; }
  .drawer { width: 100%; border-left: 0; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 14px; padding-right: 14px; }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .offers { display: block; overflow-x: auto; }
  .drawer-body .table { display: block; overflow-x: auto; }
  .radios { flex-direction: column; }
  .radios label { min-width: 0; }
  .docs { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .md { padding: 10px 16px 30px; }
}
/* phone landscape: keep the event list beside the preview */
@media (max-height: 500px) and (orientation: landscape) {
  .top { position: static; }
  .play-main { grid-template-columns: minmax(0, 1fr) 240px; grid-template-rows: none; }
  .side { border-top: 0; border-left: 1px solid var(--border); max-height: none; }
  .play-bar h3 { flex: 0 1 auto; }
}
