/* Ad Control. Neutral SaaS system (shadcn-style): zinc surfaces, 1px borders, soft radius, Geist.
   Color is reserved for status. Light + dark. */
:root {
  --bg: #ffffff;
  --app: #fafafa;
  --card: #ffffff;
  --pop: #ffffff;
  --fg: #0a0a0a;
  --fg-2: #404040;
  --muted-fg: #737373;
  --muted: #f5f5f5;
  --accent: #f4f4f5;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: rgba(115, 115, 115, .35);
  --primary: #171717;
  --primary-fg: #fafafa;
  --primary-hover: #262626;
  --good: #15803d; --good-bg: #f0fdf4; --good-bd: #bbf7d0;
  --warn: #b45309; --warn-bg: #fffbeb; --warn-bd: #fde68a;
  --bad: #b91c1c;  --bad-bg: #fef2f2;  --bad-bd: #fecaca;
  --info: #1d4ed8; --info-bg: #eff6ff; --info-bd: #bfdbfe;
  --chart-1: #171717;
  --chart-2: #d4d4d4;
  --chart-3: #a3a3a3;
  --overlay: rgba(0, 0, 0, .45);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, .08), 0 2px 4px -2px rgba(0, 0, 0, .05);
  --shadow-lg: 0 12px 24px -6px rgba(0, 0, 0, .14), 0 4px 8px -4px rgba(0, 0, 0, .06);
  --r: 10px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a0a; --app: #0a0a0a; --card: #141414; --pop: #1a1a1a;
    --fg: #fafafa; --fg-2: #d4d4d4; --muted-fg: #a1a1a1; --muted: #262626; --accent: #262626;
    --border: rgba(255, 255, 255, .1); --input: rgba(255, 255, 255, .15); --ring: rgba(161, 161, 161, .4);
    --primary: #e5e5e5; --primary-fg: #171717; --primary-hover: #d4d4d4;
    --good: #4ade80; --good-bg: rgba(34, 197, 94, .12); --good-bd: rgba(34, 197, 94, .3);
    --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .12); --warn-bd: rgba(245, 158, 11, .3);
    --bad: #f87171;  --bad-bg: rgba(239, 68, 68, .12);  --bad-bd: rgba(239, 68, 68, .3);
    --info: #60a5fa; --info-bg: rgba(59, 130, 246, .12); --info-bd: rgba(59, 130, 246, .3);
    --chart-1: #e5e5e5; --chart-2: #404040; --chart-3: #737373;
    --overlay: rgba(0, 0, 0, .7);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 4px 10px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a0a; --app: #0a0a0a; --card: #141414; --pop: #1a1a1a;
  --fg: #fafafa; --fg-2: #d4d4d4; --muted-fg: #a1a1a1; --muted: #262626; --accent: #262626;
  --border: rgba(255, 255, 255, .1); --input: rgba(255, 255, 255, .15); --ring: rgba(161, 161, 161, .4);
  --primary: #e5e5e5; --primary-fg: #171717; --primary-hover: #d4d4d4;
  --good: #4ade80; --good-bg: rgba(34, 197, 94, .12); --good-bd: rgba(34, 197, 94, .3);
  --warn: #fbbf24; --warn-bg: rgba(245, 158, 11, .12); --warn-bd: rgba(245, 158, 11, .3);
  --bad: #f87171;  --bad-bg: rgba(239, 68, 68, .12);  --bad-bd: rgba(239, 68, 68, .3);
  --info: #60a5fa; --info-bg: rgba(59, 130, 246, .12); --info-bd: rgba(59, 130, 246, .3);
  --chart-1: #e5e5e5; --chart-2: #404040; --chart-3: #737373;
  --overlay: rgba(0, 0, 0, .7);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3); --shadow-md: 0 4px 10px rgba(0, 0, 0, .4); --shadow-lg: 0 16px 32px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--app); color: var(--fg); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
p { margin: 0; }
.muted { color: var(--muted-fg); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
i.ph { font-size: 16px; line-height: 1; flex: none; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; font-size: 14px; font-weight: 500; white-space: nowrap; background: var(--primary); color: var(--primary-fg); box-shadow: var(--shadow-xs); transition: background .15s, border-color .15s, color .15s; }
.btn:hover { background: var(--primary-hover); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn.outline { background: var(--card); color: var(--fg); border: 1px solid var(--input); }
.btn.outline:hover { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: none; }
.btn.ghost:hover { background: var(--accent); }
.btn.secondary { background: var(--muted); color: var(--fg); box-shadow: none; }
.btn.secondary:hover { background: var(--accent); filter: brightness(.97); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.ghost.danger { background: transparent; color: var(--bad); }
.btn.ghost.danger:hover { background: var(--bad-bg); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.xs { height: 28px; padding: 0 8px; font-size: 12.5px; border-radius: 6px; gap: 4px; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.icon.xs { width: 28px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.ib { all: unset; cursor: pointer; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--muted-fg); flex: none; }
.ib i.ph { font-size: 14px; }
.ib:hover, .ib[aria-expanded="true"] { color: var(--fg); background: var(--accent); }
.ib:focus-visible { box-shadow: 0 0 0 2px var(--ring); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; white-space: nowrap; border: 1px solid var(--border); color: var(--fg-2); background: var(--card); }
.badge i.ph { font-size: 13px; }
.badge.good { color: var(--good); background: var(--good-bg); border-color: var(--good-bd); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-bd); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: var(--info-bd); }
.badge.ready { color: var(--primary-fg); background: var(--primary); border-color: var(--primary); }
.badge.muted { color: var(--muted-fg); background: var(--muted); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--chart-3); }
.dot.good, .dot.live { background: #22c55e; }
.dot.warn, .dot.building { background: #f59e0b; }
.dot.bad { background: #ef4444; }
.dot.info { background: #3b82f6; }
.dot.empty, .dot.muted { background: transparent; box-shadow: inset 0 0 0 1.5px var(--chart-3); }

/* ---------- inputs ---------- */
.in, .field input, .field select, .field textarea { width: 100%; height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--input); background: var(--card); color: var(--fg); font-size: 14px; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
textarea.in, .field textarea { height: auto; padding: 8px 12px; resize: vertical; line-height: 1.5; }
select.in, .field select { padding-right: 32px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted-fg) 50%), linear-gradient(135deg, var(--muted-fg) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.in:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--chart-3); box-shadow: 0 0 0 3px var(--ring); }
.in:disabled, .field :disabled { opacity: .6; cursor: not-allowed; background: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.field small { color: var(--muted-fg); font-size: 12.5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { position: relative; }
.search i.ph { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-fg); }
.search .in { padding-left: 32px; width: 240px; height: 32px; font-size: 13px; }

/* ---------- segmented tabs ---------- */
.tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 9px; background: var(--muted); }
.tabs button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted-fg); white-space: nowrap; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--fg); box-shadow: var(--shadow-xs); }
.tabs button:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.tabs .count { font-size: 11.5px; color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.tabs.sm button { height: 24px; padding: 0 8px; font-size: 12.5px; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sb { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--app); overflow-y: auto; }
.sb-top { padding: 2px 0 8px; }
.sb-label { display: block; padding: 12px 8px 4px; font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.sb-item { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px; border-radius: 7px; font-size: 14px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-item:hover { background: var(--accent); color: var(--fg); }
.sb-item[aria-current="page"] { background: var(--accent); color: var(--fg); font-weight: 500; }
.sb-item:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.sb-item.sub { font-size: 13px; height: 30px; }
.sb-item.sub small { margin-left: auto; color: var(--muted-fg); font-size: 12px; }
.sb-foot { margin-top: auto; }
.switch { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.switch:hover, .switch[aria-expanded="true"] { background: var(--accent); }
.switch:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.switch .mark { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--primary); color: var(--primary-fg); font-weight: 600; font-size: 14px; flex: none; }
.switch .t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.switch .t b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch .t small { font-size: 12px; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch > i.ph { color: var(--muted-fg); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--muted); color: var(--fg); font-size: 12.5px; font-weight: 600; flex: none; border: 1px solid var(--border); }
.avatar.sm { width: 22px; height: 22px; font-size: 10.5px; }
.main { min-width: 0; margin: 8px 8px 8px 0; background: var(--bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-xs); }
.mh { display: none; }
.page { max-width: 1480px; margin: 0 auto; padding: 24px 28px 48px; display: flex; flex-direction: column; gap: 16px; }
.sb-scrim { display: none; }

/* ---------- page header ---------- */
.phead { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding-bottom: 4px; }
.ph-l { min-width: 0; }
.phead h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.ph-sub { color: var(--muted-fg); margin-top: 4px; font-size: 14px; }
.ph-r { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-fg); flex-wrap: wrap; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--fg); }
.crumbs i.ph { font-size: 12px; }
.crumbs b { font-weight: 500; color: var(--fg); }
.sync { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 7px; font-size: 13px; color: var(--muted-fg); }
.sync:hover, .sync[aria-expanded="true"] { background: var(--accent); color: var(--fg); }

/* ---------- banners ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--card); font-size: 14px; }
.banner i.ph { font-size: 18px; margin-top: 1px; }
.banner b { font-weight: 600; }
.banner.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-bd); }
.banner.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-bd); }
.banner.info { background: var(--muted); border-color: transparent; color: var(--fg-2); }
.banner .grow { flex: 1; }

/* ---------- cards + widgets ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 0; min-height: 46px; }
.card-h h2, .card-h h3 { font-size: 14px; font-weight: 600; }
.card-h .r { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.card-b { padding: 12px 16px 16px; }
.card-d { color: var(--muted-fg); font-size: 13px; padding: 2px 16px 0; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.widget { position: relative; display: flex; flex-direction: column; }
.s3 { grid-column: span 3; } .s4 { grid-column: span 4; } .s6 { grid-column: span 6; } .s8 { grid-column: span 8; } .s12 { grid-column: span 12; }
.w-h { display: flex; align-items: center; gap: 6px; padding: 12px 12px 0 16px; min-height: 44px; }
.w-t { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-grip { all: unset; cursor: grab; display: grid; place-items: center; width: 20px; height: 24px; margin-left: -10px; border-radius: 5px; color: var(--muted-fg); opacity: 0; transition: opacity .15s; touch-action: none; }
.w-grip:active { cursor: grabbing; }
.w-grip:focus-visible { opacity: 1; box-shadow: 0 0 0 2px var(--ring); }
.widget:hover .w-grip, .widget.lifting .w-grip { opacity: 1; }
.w-grip:hover { background: var(--accent); color: var(--fg); }
.w-tools { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.w-tools > .btn.icon { opacity: .6; }
.widget:hover .w-tools > .btn.icon, .w-tools > .btn.icon[aria-expanded="true"] { opacity: 1; }
.w-b { padding: 8px 16px 16px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.w-b > * { flex: none; }
.w-resize { position: absolute; right: -2px; top: 16px; bottom: 16px; width: 10px; cursor: ew-resize; touch-action: none; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.w-resize::after { content: ""; width: 4px; height: 36px; max-height: 60%; border-radius: 4px; background: var(--chart-3); }
.widget:hover .w-resize, .widget.resizing .w-resize { opacity: 1; }
.widget.lifting { box-shadow: var(--shadow-lg); z-index: 5; outline: 2px solid var(--chart-3); outline-offset: 2px; }
.widget.resizing { outline: 2px dashed var(--chart-3); outline-offset: 2px; }
body.arranging, body.arranging * { cursor: grabbing !important; user-select: none; }
body.resizing-w, body.resizing-w * { cursor: ew-resize !important; user-select: none; }

/* KPI */
.kpi-v { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.kpi-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi-sub { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-fg); margin-top: 6px; }
.spark { display: block; width: 100%; height: 40px; margin-top: 12px; color: var(--chart-1); overflow: visible; }
.spark .area { fill: currentColor; opacity: .07; }
.spark .line { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.kpi-foot { font-size: 12px; color: var(--muted-fg); margin-top: 6px; }

/* chart */
.w-b > .chart { flex: 1 1 auto; }
.chart { position: relative; width: 100%; min-height: 220px; }
.chart svg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-l line { stroke: var(--border); }
.chart .axis text { fill: var(--muted-fg); font-size: 11px; font-family: var(--font); }
.chart .bar.in { fill: var(--chart-1); }
.chart .bar.out { fill: var(--chart-2); }
.chart .ref { stroke: var(--muted-fg); stroke-width: 1.25; stroke-dasharray: 4 4; }
.chart .buy { fill: #22c55e; stroke: var(--card); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--fg); opacity: .04; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted-fg); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .dash { width: 14px; border-top: 1.5px dashed var(--muted-fg); display: inline-block; }
.legend .buyd { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; display: inline-block; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--pop); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow-md); max-width: 280px; }
.tip b { display: block; font-weight: 600; margin-bottom: 2px; }
.tip div { color: var(--fg-2); }

/* action items */
.more-btn { margin-top: 6px; align-self: flex-start; }
.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.todo li { display: grid; grid-template-columns: 28px 1fr auto; gap: 4px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.todo li:first-child { border-top: 0; padding-top: 2px; }
.todo .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--muted); color: var(--fg-2); }
.todo .ic.bad { background: var(--bad-bg); color: var(--bad); }
.todo .ic.ready { background: var(--primary); color: var(--primary-fg); }
.todo .t { min-width: 0; }
.todo .t b { display: block; font-weight: 500; font-size: 13.5px; line-height: 1.35; overflow-wrap: anywhere; }
.todo .t small { display: block; color: var(--muted-fg); font-size: 12.5px; line-height: 1.4; margin-top: 1px; }
.todo .r { display: flex; align-items: center; gap: 8px; }
.owner { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted-fg); }
.empty-s { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 24px 12px; color: var(--muted-fg); font-size: 13px; }
.empty-s .ei { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--muted); color: var(--fg-2); margin-bottom: 4px; }
.empty-s .ei i.ph { font-size: 20px; }
.empty-s b { color: var(--fg); font-weight: 600; font-size: 14px; }

.ad-thumb { width: 40px; height: 50px; border-radius: 6px; overflow: hidden; background: var(--muted); display: grid; place-items: center; flex: none; color: var(--muted-fg); }
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ad-prog { height: 4px; border-radius: 4px; background: var(--muted); overflow: hidden; }
.ad-prog span { display: block; height: 100%; background: var(--chart-1); }
.meter-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted-fg); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* jobs home */
.strip4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stile { all: unset; box-sizing: border-box; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xs); min-width: 0; }
.stile.click { cursor: pointer; }
.stile.click:hover { border-color: var(--chart-3); }
.stile:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.stile small { display: inline-flex; align-items: center; gap: 2px; color: var(--muted-fg); font-size: 13px; }
.stile b { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stile .sub { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.segs { display: inline-flex; gap: 3px; }
.segs span { width: 18px; height: 6px; border-radius: 3px; background: var(--muted); box-shadow: inset 0 0 0 1px var(--border); }
.segs span.live { background: #22c55e; box-shadow: none; }
.segs span.building { background: #f59e0b; box-shadow: none; }
.jobs-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.jobs-rail { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; scroll-margin-top: 16px; }
.jgroup { display: flex; flex-direction: column; gap: 10px; }
.jgroup-h { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.jgroup-h h2 { font-size: 15px; font-weight: 600; }
.jgroup-h .muted { font-size: 13px; margin-left: 6px; }
.jgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.jcard { display: flex; flex-direction: column; gap: 12px; padding: 14px; transition: box-shadow .15s, border-color .15s; }
.jcard.over-files { border-color: var(--info); box-shadow: 0 0 0 3px var(--info-bd); }
.jcard-h { display: flex; align-items: flex-start; gap: 8px; }
.jt { flex: 1; min-width: 0; }
.jt-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none; }
.jt-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.jt p { color: var(--muted-fg); font-size: 12.5px; line-height: 1.4; margin-top: 2px; }
.hero { position: relative; border-radius: 10px; overflow: hidden; background: var(--muted); cursor: pointer; transition: box-shadow .15s, opacity .15s; }
.hero:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.hero:hover .mstrip img.fg { transform: scale(1.02); }
.hero.dragging { opacity: .45; }
.hero.empty { aspect-ratio: 1.92; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; padding: 16px; border: 1.5px dashed var(--chart-3); background: transparent; color: var(--muted-fg); font-size: 12.5px; }
.hero.empty i.ph { font-size: 22px; }
.hero.empty b { color: var(--fg); font-size: 13.5px; font-weight: 500; }
.hero.empty:hover { background: var(--accent); }
.hero-tag { position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px; background: rgba(10, 10, 10, .72); color: #fff; font-size: 11.5px; font-weight: 500; backdrop-filter: blur(4px); }
.mstrip { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; aspect-ratio: 1.92; background: var(--muted); }
.mstrip.big { border-radius: 10px; overflow: hidden; }
.mcell { position: relative; overflow: hidden; isolation: isolate; background: var(--muted); display: grid; place-items: center; color: var(--muted-fg); }
.mcell img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.mstrip.one .mcell img.fg { position: relative; object-fit: contain; }
.mstrip.one .mcell img.bg { position: absolute; inset: 0; filter: blur(18px) brightness(.85); transform: scale(1.15); }
.mcell .play { z-index: 1; }
.mcell .play { position: absolute; width: 34px; height: 34px; border-radius: 50%; background: rgba(10, 10, 10, .6); color: #fff; display: grid; place-items: center; }
.mstrip.none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted-fg); font-size: 12.5px; }
.mstrip.none i.ph { font-size: 24px; }
.jcard-title { display: flex; align-items: center; gap: 6px; margin-top: -4px; }
.jcard-title b { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.jcard-title small { color: var(--muted-fg); font-size: 12px; white-space: nowrap; }
.jcard-title .btn { margin-left: auto; }
.jstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--muted); }
.sm small { display: block; font-size: 11.5px; color: var(--muted-fg); }
.sm b { font-size: 14px; font-weight: 600; }
.jv { justify-self: end; }
.jready { display: flex; flex-direction: column; gap: 8px; }
.jready .row { justify-content: space-between; font-size: 12.5px; }
.jtest { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; transition: background .12s, box-shadow .12s, opacity .15s; }
.jtest:hover { background: var(--accent); }
.jtest:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.jtest .ad-thumb { width: 36px; height: 45px; }
.jtest-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12px; }
.jtest-t small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--info); }
.jtest-t b { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jtest.empty { cursor: default; border-style: dashed; color: var(--muted-fg); font-size: 12.5px; padding: 10px; }
.jtest.empty:hover { background: transparent; }
.jtest.dragging { opacity: .45; }
.jqueue { display: flex; flex-direction: column; gap: 6px; border-radius: 10px; padding: 6px; margin: -6px; transition: background .12s, box-shadow .12s; }
.jq-h { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .04em; }
.jq-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.jq-empty { font-size: 12.5px; color: var(--muted-fg); }
.qt { flex: none; width: 76px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; font-size: 11.5px; color: var(--fg-2); border-radius: 8px; }
.qt[draggable="true"], .pack[draggable="true"] { -webkit-user-drag: element; }
.qt:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.qt span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qt-img { width: 76px; height: 95px; border-radius: 8px; overflow: hidden; background: var(--muted); display: grid; place-items: center; color: var(--muted-fg); border: 1px solid var(--border); transition: transform .15s; }
.qt:hover .qt-img { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.qt-img img { width: 100%; height: 100%; object-fit: cover; }
.qt.dragging { opacity: .4; }
.loose-t { cursor: default; }
.loose-t .qt-img { border-style: dashed; }
.jcard-f { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); }
.jcard-f .act { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; flex-wrap: wrap; }
.jcard-f .act small { font-size: 12px; }
.jcard-f > a { flex: none; text-decoration: none; }
/* drop targets light up while an ad is being dragged */
[data-role].over { background: color-mix(in srgb, var(--fg) 6%, transparent); box-shadow: 0 0 0 2px var(--chart-3); }
body.dragging-ad .hero, body.dragging-ad .jtest, body.dragging-ad .jqueue, body.dragging-ad .pzone, body.dragging-ad .packs-wrap { outline: 1.5px dashed var(--chart-3); outline-offset: 2px; }
.flash { box-shadow: 0 0 0 2px var(--chart-3); }

/* one job */
.jh1 { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.jp-top { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; }
.jp-bottom { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.pzone .card-b { display: flex; flex-direction: column; gap: 12px; }
.pmedia { cursor: pointer; border-radius: 10px; }
.pmedia:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.pmedia:hover img.fg { transform: scale(1.02); }
.ptitle { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ptitle b { font-weight: 600; font-size: 15px; }
.statrow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--muted); }
.pchart-h { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted-fg); }
.achart { width: 100%; height: 110px; }
.achart svg { display: block; width: 100%; height: 110px; overflow: visible; }
.achart .bar { fill: var(--chart-1); }
.achart .base { stroke: var(--border); }
.achart .buy { fill: #22c55e; stroke: var(--card); stroke-width: 1.5; }
.achart text { fill: var(--muted-fg); font-size: 10.5px; font-family: var(--font); }
.achart .hit { fill: transparent; }
.achart .hit:hover { fill: var(--fg); opacity: .05; }
.pempty { display: grid; place-items: center; min-height: 260px; }
.pactions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tdetail { display: flex; flex-direction: column; gap: 6px; }
.mini-tbl { font-size: 12.5px; margin-top: 6px; }
.mini-tbl th, .mini-tbl td { height: auto; padding: 6px 8px; }
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pack { box-sizing: border-box; margin: 0; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--card); transition: box-shadow .15s, border-color .15s, opacity .15s, transform .15s; }
.pack:hover { border-color: var(--chart-3); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.pack:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.pack.dragging { opacity: .4; }
.pack .mstrip { aspect-ratio: 4 / 3; }
.pack-b { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.pack-b b { font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-b small { color: var(--muted-fg); font-size: 12px; }
.pack-b .row { justify-content: space-between; }
.pack.add { font: inherit; appearance: none; border: 1.5px dashed var(--chart-3); align-items: center; justify-content: center; text-align: center; gap: 6px; padding: 24px 16px; color: var(--muted-fg); font-size: 12.5px; min-height: 200px; }
.pack.add i.ph { font-size: 22px; }
.pack.add b { color: var(--fg); font-weight: 500; font-size: 13.5px; }
.pack.add:hover { background: var(--accent); transform: none; box-shadow: none; }
.card.over-files { border-color: var(--info); box-shadow: 0 0 0 3px var(--info-bd); }
.brief .card-b { display: flex; flex-direction: column; gap: 12px; color: var(--fg-2); }
.spec { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.spec > span:not(.badge) { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--muted-fg); }
.guide { padding: 10px 12px; border-radius: 10px; background: var(--muted); }
.guide small { display: block; font-size: 12px; font-weight: 500; color: var(--muted-fg); margin-bottom: 2px; }

/* slide-over */
.sheet-wrap { position: fixed; inset: 0; z-index: 75; }
.sheet-scrim { position: absolute; inset: 0; background: var(--overlay); animation: fadein .15s ease-out; }
@keyframes fadein { from { opacity: 0; } }
.sheet { position: absolute; top: 8px; right: 8px; bottom: 8px; width: 560px; max-width: calc(100vw - 16px); background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.sheet-h { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.sheet-h > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sheet-h small { color: var(--muted-fg); font-size: 12.5px; }
.sheet-h small a { text-decoration: none; }
.sheet-h small a:hover { text-decoration: underline; }
.sheet-h h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.sheet-h .mono { font-size: 11.5px; overflow-wrap: anywhere; }
.sheet-b { flex: 1; overflow-y: auto; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 20px; }
.gallery { display: flex; flex-direction: column; gap: 8px; }
.g-main { position: relative; border-radius: 12px; overflow: hidden; background: var(--muted); aspect-ratio: 4 / 5; max-height: 52vh; display: grid; place-items: center; }
.g-main img, .g-main video { width: 100%; height: 100%; object-fit: contain; background: #0a0a0a; }
.g-none { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted-fg); font-size: 13px; }
.g-none i.ph { font-size: 28px; }
.g-nav { all: unset; cursor: pointer; position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .9); color: #0a0a0a; box-shadow: var(--shadow-md); }
.g-nav.l { left: 10px; } .g-nav.r { right: 10px; }
.g-nav:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.g-thumbs { display: flex; gap: 6px; }
.g-thumbs button { all: unset; cursor: pointer; position: relative; width: 56px; height: 70px; border-radius: 8px; overflow: hidden; background: var(--muted); border: 2px solid transparent; display: grid; place-items: center; }
.g-thumbs button.on { border-color: var(--fg); }
.g-thumbs button:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.g-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.g-thumbs small { position: absolute; left: 3px; bottom: 3px; font-size: 9.5px; padding: 0 4px; border-radius: 4px; background: rgba(10, 10, 10, .7); color: #fff; }
.ssec { display: flex; flex-direction: column; gap: 10px; }
.ssec h3 { font-size: 13.5px; font-weight: 600; }
.ssec-h { display: flex; justify-content: space-between; align-items: center; }
.ssec .statrow { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.copy { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--muted); font-size: 13.5px; color: var(--fg-2); }
.copy p { white-space: pre-line; }
.copy .opt { font-size: 11.5px; font-weight: 600; width: 26px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--card); color: var(--fg-2); border: 1px solid var(--border); }
.copy.head b { font-weight: 600; color: var(--fg); }
.heads { display: flex; flex-direction: column; gap: 6px; }
.sheet-f { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); }
.sheet-f .spacer { flex: 1; }
body.sheet-open { overflow: hidden; }
@media (max-width: 1280px) { .jgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .strip4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 960px) { .jp-top, .jp-bottom { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .jgrid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .jobs-rail { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .statrow, .ssec .statrow { grid-template-columns: repeat(3, minmax(0, 1fr)); } .sheet { top: 0; right: 0; bottom: 0; border-radius: 0; max-width: 100vw; width: 100vw; } .jstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .jv { justify-self: start; } }
.retire-zone { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 60; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px; background: var(--pop); color: var(--fg-2); border: 1px dashed var(--chart-3); box-shadow: var(--shadow-lg); font-size: 13.5px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
body.dragging-ad .retire-zone { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.retire-zone.over { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); border-style: solid; }

/* drag files */
.filedrop-hint { position: fixed; top: 16px; left: 50%; transform: translate(-50%, -8px); z-index: 70; display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; background: var(--primary); color: var(--primary-fg); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
body.dragging-files .filedrop-hint { opacity: 1; transform: translate(-50%, 0); }
body.dragging-files .dropzone { border-color: var(--info); background: var(--info-bg); }

/* active test */
.progress-row { display: flex; justify-content: space-between; font-size: 12.5px; margin-top: 14px; margin-bottom: 6px; }
.prog { height: 6px; border-radius: 6px; background: var(--muted); overflow: hidden; }
.prog span { display: block; height: 100%; background: var(--chart-1); border-radius: 6px; }
.share { display: flex; height: 26px; border-radius: 7px; overflow: hidden; font-size: 12px; font-weight: 500; margin-top: 6px; }
.share span { display: flex; align-items: center; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.share .a { background: var(--chart-1); color: var(--primary-fg); }
.share .b { background: var(--muted); color: var(--fg-2); justify-content: flex-end; }
.callout { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; background: var(--muted); color: var(--fg-2); font-size: 13px; margin-top: 12px; }
.w-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.mt { margin-top: 12px; }

/* schedule */
.sched { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sched li { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); }
.sched li:first-child { border-top: 0; padding-top: 2px; }
.sched li.done { opacity: .55; }
.sched li.done b { text-decoration: line-through; }
.dtile { width: 44px; border-radius: 8px; border: 1px solid var(--border); text-align: center; overflow: hidden; line-height: 1.1; }
.dtile small { display: block; font-size: 10.5px; font-weight: 500; text-transform: uppercase; background: var(--muted); color: var(--muted-fg); padding: 2px 0; }
.dtile b { display: block; font-size: 16px; font-weight: 600; padding: 4px 0; }
.dtile.today { border-color: var(--fg); }
.sched .t b { font-weight: 500; font-size: 13.5px; display: block; }
.sched .t p { color: var(--muted-fg); font-size: 12.5px; margin-top: 2px; }
.sched .t .badge { margin-top: 4px; }
.check { all: unset; cursor: pointer; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--chart-3); display: grid; place-items: center; margin-top: 2px; }
.check i.ph { font-size: 12px; opacity: 0; }
.check[aria-checked="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.check[aria-checked="true"] i.ph { opacity: 1; }
.check:focus-visible { box-shadow: 0 0 0 2px var(--ring); }

/* unassigned */
.big { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.ulist { list-style: none; margin: 10px 0 0; padding: 0; }
.ulist li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.ulist .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ulist .v { color: var(--fg-2); }
.linkbtn { all: unset; cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.linkbtn:hover { text-decoration: underline; text-underline-offset: 3px; }

/* table */
.tbl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 12px 0; }
.tbl-tools .r { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 500; color: var(--muted-fg); font-size: 13px; height: 40px; padding: 0 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th.r, td.r { text-align: right; }
th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
th button:hover { color: var(--fg); }
th button i.ph { font-size: 12px; }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: color-mix(in srgb, var(--muted) 55%, transparent); }
tbody tr.click { cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
td.name { min-width: 240px; max-width: 380px; }
.cell-ad b, .cell-ad small { overflow-wrap: anywhere; }
.cell-ad { display: flex; align-items: center; gap: 10px; }
.cell-ad .ad-thumb { width: 32px; height: 40px; }
.cell-ad div { min-width: 0; display: flex; flex-direction: column; }
.cell-ad b { font-weight: 500; }
.cell-ad small { color: var(--muted-fg); font-size: 12px; }
td.empty { text-align: center; color: var(--muted-fg); padding: 32px; }

/* popover + menu */
.pop { position: absolute; z-index: 80; background: var(--pop); color: var(--fg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); animation: popin .12s ease-out; }
@keyframes popin { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.info-pop { width: 300px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--fg-2); }
.info-pop b { color: var(--fg); font-size: 13.5px; font-weight: 600; }
.info-pop .spec { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.menu { min-width: 200px; padding: 4px; display: flex; flex-direction: column; }
.menu-item { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 8px; border-radius: 6px; font-size: 13.5px; }
.menu-item:hover, .menu-item:focus-visible { background: var(--accent); }
.menu-item i.ph { color: var(--muted-fg); }
.menu-item .chk { margin-left: auto; }
.menu-item.danger { color: var(--bad); }
.menu-item.danger i.ph { color: var(--bad); }
.menu-item[disabled] { opacity: .45; pointer-events: none; }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { padding: 6px 8px 2px; font-size: 12px; font-weight: 500; color: var(--muted-fg); }
.menu-pop .who { padding: 8px 8px 6px; display: flex; flex-direction: column; line-height: 1.3; }
.menu-pop .who b { font-weight: 600; }
.menu-pop .who small { color: var(--muted-fg); font-size: 12px; }

/* dialog */
dialog { border: 0; padding: 0; background: transparent; color: var(--fg); max-width: calc(100vw - 32px); }
dialog::backdrop { background: var(--overlay); backdrop-filter: blur(2px); }
dialog[open] { animation: popin .15s ease-out; }
.dlg { width: 500px; max-width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dlg.sm { width: 420px; }
.dlg-h { display: flex; align-items: flex-start; gap: 8px; padding: 20px 20px 0; }
.dlg-h h3 { font-size: 17px; font-weight: 600; flex: 1; }
.dlg-h .btn { margin: -6px -8px 0 0; }
.dlg-b { padding: 12px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; color: var(--fg-2); font-size: 14px; }
.dlg-f { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 20px 20px; flex-wrap: wrap; }
.dlg-f .spacer { flex: 1; }
.progress { height: 6px; background: var(--muted); border-radius: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--chart-1); transition: width .2s; }
.jobpick { display: flex; flex-direction: column; gap: 6px; }
.jobpick button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; }
.jobpick button:hover, .jobpick button:focus-visible { background: var(--accent); border-color: var(--chart-3); }
.jobpick .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.jobpick .t b { color: var(--fg); font-weight: 500; }
.jobpick .t small { color: var(--muted-fg); font-size: 12.5px; }

/* toast */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; width: 360px; max-width: calc(100vw - 32px); padding: 12px 14px; border-radius: 10px; background: var(--pop); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toastin .2s ease-out; }
.toast i.ph { font-size: 18px; color: var(--good); }
.toast.bad i.ph { color: var(--bad); }
.toast .grow { flex: 1; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* settings */
.stabs { border-bottom: 1px solid var(--border); display: flex; gap: 4px; }
.stabs button { all: unset; cursor: pointer; padding: 8px 12px; font-size: 14px; color: var(--muted-fg); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.stabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.stabs button:hover { color: var(--fg); }
.stabs button:focus-visible { box-shadow: 0 0 0 2px var(--ring); border-radius: 6px; }
.form { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 0; margin: 0; font-size: 13.5px; }
.kv dt, .kv dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--border); }
.kv dt { color: var(--muted-fg); display: flex; align-items: center; gap: 4px; }
.kv dd { color: var(--fg); overflow-wrap: anywhere; }
.kv dd a { text-decoration: underline; text-underline-offset: 3px; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.statgrid .card { padding: 14px 16px; }
.statgrid small { display: flex; align-items: center; gap: 4px; color: var(--muted-fg); font-size: 13px; }
.statgrid b { display: block; font-size: 20px; font-weight: 600; margin-top: 4px; letter-spacing: -0.01em; }
.statgrid p { color: var(--muted-fg); font-size: 12.5px; margin-top: 4px; }
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.rules .card { padding: 14px 16px; }
.rules h3 { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.rules ul { margin: 0; padding-left: 18px; color: var(--fg-2); font-size: 13.5px; display: flex; flex-direction: column; gap: 4px; }

/* builder */
.bh { display: flex; flex-direction: column; gap: 10px; }
.bh-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.bh-row > div:first-child { min-width: 0; flex: 1; }
.bh h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.bh-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; font-size: 13px; }
.actionbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.actionbar .why { font-size: 12.5px; color: var(--muted-fg); max-width: 280px; text-align: right; }
.savestate { font-size: 12.5px; color: var(--muted-fg); display: inline-flex; align-items: center; gap: 4px; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: start; }
.editor { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px; }
.bsec .card-b { display: flex; flex-direction: column; gap: 12px; }
.bsec .card-h .hint { margin-left: auto; font-size: 12.5px; color: var(--muted-fg); font-weight: 400; text-align: right; }
.ident { display: flex; flex-wrap: wrap; gap: 10px; }
.id-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--border); border-radius: 10px; flex: 1; min-width: 220px; }
.id-row div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.id-row small { color: var(--muted-fg); font-size: 12px; }
.id-row b { font-weight: 500; }
.hint { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--muted-fg); }
.hint.center { justify-content: center; text-align: center; }
.kvs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.kvs > div { padding: 10px 12px; border-radius: 9px; background: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.kvs small { color: var(--muted-fg); font-size: 12px; }
.kvs b { font-weight: 500; font-size: 13.5px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.tile-m { all: unset; box-sizing: border-box; position: relative; aspect-ratio: var(--ratio, 4/5); background: var(--muted); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; margin: 0; }
.tile-m img, .tile-m video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile-m figcaption { position: absolute; left: 6px; bottom: 6px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tile-m figcaption span, .tile-m figcaption small { background: rgba(10, 10, 10, .72); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; font-weight: 500; }
.tile-m figcaption .warn { background: var(--bad); }
.tile-m.bad { box-shadow: inset 0 0 0 2px var(--bad); }
.tile-m .rm { all: unset; cursor: pointer; position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: rgba(10, 10, 10, .72); color: #fff; opacity: 0; transition: opacity .15s; }
.tile-m:hover .rm, .tile-m .rm:focus-visible { opacity: 1; }
.tile-m.empty, .dropzone { border: 1.5px dashed var(--chart-3); background: transparent; color: var(--muted-fg); font-size: 13px; }
.tile-m.empty i.ph { font-size: 20px; }
.tile-m.empty small { font-size: 11.5px; }
.tile-m.empty:hover, .tile-m.empty.over { border-color: var(--fg); color: var(--fg); background: var(--accent); }
.tile-m.empty:disabled { cursor: default; opacity: .6; }
.multi { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.multi-row { width: 100%; display: grid; grid-template-columns: 24px 1fr; gap: 6px 10px; align-items: start; }
.multi-row .opt { font-weight: 600; font-size: 12px; width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--muted); color: var(--fg-2); margin-top: 6px; }
.multi-f { grid-column: 2; display: flex; justify-content: space-between; align-items: center; margin-top: -2px; }
.multi-f .count { color: var(--muted-fg); font-size: 12px; font-variant-numeric: tabular-nums; }
.thumbcol img { width: 96px; border-radius: 8px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checks li { display: grid; grid-template-columns: 20px 1fr auto; gap: 0 8px; padding: 6px 0; font-size: 13.5px; align-items: start; }
.checks li > .btn { grid-row: 1 / span 2; grid-column: 3; align-self: center; }
.checks li i.ph { font-size: 17px; margin-top: 1px; }
.checks li.ok i.ph { color: var(--good); }
.checks li.no i.ph { color: var(--muted-fg); }
.checks li small { grid-column: 2; grid-row: 2; color: var(--muted-fg); font-size: 12.5px; overflow-wrap: anywhere; }
/* ad preview mimics Meta surfaces, so it keeps their own light colors */
.pv-stage { background: var(--muted); border-radius: 10px; padding: 16px; display: flex; justify-content: center; }
.pv { width: 300px; max-width: 100%; background: #fff; color: #050505; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 13px; line-height: 1.35; border-radius: 8px; overflow: hidden; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), var(--shadow-md); }
.pv i.ph { font-size: inherit; }
.pv-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.pv-top div { flex: 1; min-width: 0; }
.pv-top b { display: block; font-size: 13px; }
.pv-top small { color: #65676B; font-size: 11.5px; display: inline-flex; gap: 3px; align-items: center; }
.pv .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #111; color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.pv-media { position: relative; width: 100%; aspect-ratio: 4 / 5; background: #000; overflow: hidden; display: grid; place-items: center; }
.pv-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pv-media .ph { color: #888; font-size: 28px; }
.pv-cta { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid #efefef; font-weight: 600; color: #0095F6; }
.pv-head { padding: 6px 12px 0; font-weight: 600; font-size: 12.5px; }
.pv-icons { display: flex; gap: 14px; padding: 8px 12px 4px; font-size: 22px; }
.pv-icons .sp { flex: 1; }
.pv-cap { padding: 0 12px 12px; font-size: 13px; white-space: pre-line; }
.pv-text { padding: 0 12px 8px; white-space: pre-line; }
.pv .more { color: #65676B; }
.pv-link { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #F0F2F5; }
.pv-link div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pv-link small { color: #65676B; font-size: 11px; }
.pv-link b { font-size: 14px; line-height: 1.25; }
.pv-link span { color: #65676B; font-size: 12px; }
.pv-btn { background: #E4E6EB; padding: 7px 12px; font-weight: 600; font-size: 13px; border-radius: 6px; white-space: nowrap; color: #050505 !important; }
.pv.story { background: #111; color: #fff; aspect-ratio: 9 / 16; display: flex; flex-direction: column; justify-content: center; position: relative; }
.pv.story .pv-top { position: absolute; top: 14px; left: 0; right: 0; }
.pv.story .pv-top small { color: rgba(255, 255, 255, .8); }
.pv-bars { position: absolute; top: 6px; left: 8px; right: 8px; display: flex; gap: 4px; }
.pv-bars span { flex: 1; height: 2px; background: rgba(255, 255, 255, .5); }
.pv-st { position: absolute; bottom: 64px; left: 14px; right: 14px; font-size: 13px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.pv-pill { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); background: #fff; color: #050505; padding: 8px 14px; border-radius: 999px; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.steps-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.step { display: flex; align-items: center; gap: 2px; font-size: 12px; }
.step small { color: var(--muted-fg); margin-right: 4px; }

/* gate + loading */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--app); }
.gate-in { width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 28px; }
.gate-in .switch { pointer-events: none; padding: 0; margin-bottom: 8px; }
.gate-in h1 { font-size: 22px; font-weight: 600; }
.gate-in p { color: var(--muted-fg); }
.gate-in .btn { margin-top: 8px; width: 100%; }
.loading { min-height: 60vh; display: grid; place-items: center; color: var(--muted-fg); gap: 10px; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--fg); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .s3 { grid-column: span 6; }
  .s4 { grid-column: span 6; }
  .s8 { grid-column: span 12; }
  .builder { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sb { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 90; transform: translateX(-100%); transition: transform .2s; background: var(--card); border-right: 1px solid var(--border); }
  body.sb-open .sb { transform: none; box-shadow: var(--shadow-lg); }
  body.sb-open .sb-scrim { display: block; position: fixed; inset: 0; background: var(--overlay); z-index: 85; }
  .main { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .mh { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 20; }
  .mh b { font-weight: 600; }
  .page { padding: 16px 16px 40px; }
  .builder { grid-template-columns: 1fr; }
  .side { position: static; }
  .s6 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .s3, .s4 { grid-column: span 12; }
  .w-grip, .w-resize { display: none; }
  .row2 { grid-template-columns: 1fr; }
  .phead h1 { font-size: 22px; }
  .ph-r { margin-left: 0; width: 100%; }
  .search .in { width: 100%; }
  .search { flex: 1; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { border-top: 0; padding-top: 0; }
  .vs-side .ad-thumb { aspect-ratio: 1; }
  .actionbar { justify-content: flex-start; }
  .actionbar .why { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* format picker + AI generate */
.fmtpick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fmtpick button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 12px; color: var(--muted-fg); transition: border-color .12s, background .12s; }
.fmtpick button i.ph { font-size: 18px; color: var(--fg-2); margin-bottom: 2px; }
.fmtpick button b { font-size: 13.5px; font-weight: 500; color: var(--fg); }
.fmtpick button:hover { background: var(--accent); }
.fmtpick button[aria-checked="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); background: var(--card); }
.fmtpick button:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
.fmtpick button[disabled] { cursor: default; opacity: .6; }
.bsec .card-h .hint { display: inline-flex; align-items: center; gap: 10px; }
.btn.gen i.ph { color: #8b5cf6; }
.spinner.sm { width: 12px; height: 12px; border-width: 1.5px; }
.jq-add { align-self: flex-start; margin-top: 2px; }
.jt-name { display: inline-flex; align-items: center; gap: 2px; }
@media (max-width: 760px) { .fmtpick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
