/* Adserver admin: soft monochrome design system + layout. Mobile-first. */

/* ============================== tokens ============================== */

:root {
    color-scheme: light;
    --canvas: #e3e3e3;            /* around the app frame (desktop) */
    --bg: #f2f2f2;                /* the app frame itself */
    --surface: #ffffff;
    --surface-fade: rgba(255, 255, 255, .55);   /* where cards fade out on the right */
    --surface-2: #efefef;
    --surface-3: #e6e6e6;
    --border: #e7e7e7;
    --border-strong: #d7d7d7;
    --text: #161616;
    --text-2: #545454;
    --text-3: #6b6b6b;
    --text-4: #9d9d9d;            /* decorative only (title fade, idle icons) */
    --accent: #161616;
    --accent-hover: #000000;
    --on-accent: #ffffff;
    --accent-soft: #ececec;
    --accent-text: #161616;
    --ring: rgba(22, 22, 22, .12);
    --good: #0b6b37;   --good-soft: #dff5e7;  --good-line: #bfe8cc;  --good-dot: #22a35a;
    --warn: #983b0b;   --warn-soft: #ffe6d6;  --warn-line: #ffcdaf;  --warn-dot: #f0843e;
    --bad: #b42318;    --bad-soft: #fde5e2;   --bad-line: #f7c6bf;   --bad-dot: #e5484d;
    --info: #1f4db0;   --info-soft: #e3ebff;  --info-dot: #4a7cf0;
    --neutral-dot: #a3a3a3;
    --mint: #bdeccf;
    --peach: #ffcdab;
    --danger-bg: #d92d20;
    --danger-bg-hover: #b42318;
    --series-1: #262626;
    --grid: #ededed;
    --axis: #d4d4d4;
    --inverse-bg: #161616;
    --inverse-text: #ffffff;
    --inverse-accent: #a9ecc4;
    --code-bg: #161616;
    --code-text: #ececec;
    --backdrop: rgba(24, 24, 24, .26);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .04);
    --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px -6px rgba(0, 0, 0, .10);
    --shadow-raise: 0 1px 1px rgba(0, 0, 0, .04), 0 8px 20px -8px rgba(0, 0, 0, .16);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .28), 0 8px 22px -10px rgba(0, 0, 0, .10);
    --checker: rgba(0, 0, 0, .022);
    --seg-on: #ffffff;
    --knob: #ffffff;
    --title-grad: linear-gradient(90deg, #858585 0%, #b9b9b9 80%, #d2d2d2 100%);
    --value-grad: linear-gradient(170deg, #1b1b1b 25%, #6e6e6e 100%);

    --r-xs: 10px;
    --r-sm: 14px;
    --r: 22px;
    --r-lg: 28px;
    --sidebar-w: 276px;
    --topbar-h: 64px;
    --tabbar-h: 66px;
    --ctl-h: 46px;
    --font: "Google Sans Flex", "Google Sans", "Product Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --canvas: #050505;
        --bg: #111111;
        --surface: #1b1b1b;
        --surface-fade: rgba(27, 27, 27, .55);
        --surface-2: #242424;
        --surface-3: #2d2d2d;
        --border: #272727;
        --border-strong: #383838;
        --text: #f3f3f3;
        --text-2: #bebebe;
        --text-3: #9a9a9a;
        --text-4: #686868;
        --accent: #f3f3f3;
        --accent-hover: #ffffff;
        --on-accent: #111111;
        --accent-soft: #2b2b2b;
        --accent-text: #f3f3f3;
        --ring: rgba(255, 255, 255, .16);
        --good: #86e3ad;   --good-soft: rgba(34, 163, 90, .17);   --good-line: rgba(34, 163, 90, .38);
        --warn: #ffbb8f;   --warn-soft: rgba(240, 132, 62, .17);  --warn-line: rgba(240, 132, 62, .38);
        --bad: #ff9d96;    --bad-soft: rgba(229, 72, 77, .17);    --bad-line: rgba(229, 72, 77, .38);
        --info: #a9c2ff;   --info-soft: rgba(74, 124, 240, .2);
        --neutral-dot: #707070;
        --series-1: #e4e4e4;
        --grid: #262626;
        --axis: #3b3b3b;
        --inverse-bg: #f3f3f3;
        --inverse-text: #111111;
        --inverse-accent: #0b6b37;
        --code-bg: #0b0b0b;
        --backdrop: rgba(0, 0, 0, .6);
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px -6px rgba(0, 0, 0, .5);
        --shadow-raise: 0 1px 1px rgba(0, 0, 0, .4), 0 8px 20px -8px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05);
        --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .05);
        --checker: rgba(255, 255, 255, .025);
        --seg-on: #343434;
        --knob: #111111;
        --title-grad: linear-gradient(90deg, #8f8f8f 0%, #5c5c5c 80%, #444 100%);
        --value-grad: linear-gradient(170deg, #ffffff 25%, #9a9a9a 100%);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --canvas: #050505;
    --bg: #111111;
    --surface: #1b1b1b;
    --surface-fade: rgba(27, 27, 27, .55);
    --surface-2: #242424;
    --surface-3: #2d2d2d;
    --border: #272727;
    --border-strong: #383838;
    --text: #f3f3f3;
    --text-2: #bebebe;
    --text-3: #9a9a9a;
    --text-4: #686868;
    --accent: #f3f3f3;
    --accent-hover: #ffffff;
    --on-accent: #111111;
    --accent-soft: #2b2b2b;
    --accent-text: #f3f3f3;
    --ring: rgba(255, 255, 255, .16);
    --good: #86e3ad;   --good-soft: rgba(34, 163, 90, .17);   --good-line: rgba(34, 163, 90, .38);
    --warn: #ffbb8f;   --warn-soft: rgba(240, 132, 62, .17);  --warn-line: rgba(240, 132, 62, .38);
    --bad: #ff9d96;    --bad-soft: rgba(229, 72, 77, .17);    --bad-line: rgba(229, 72, 77, .38);
    --info: #a9c2ff;   --info-soft: rgba(74, 124, 240, .2);
    --neutral-dot: #707070;
    --series-1: #e4e4e4;
    --grid: #262626;
    --axis: #3b3b3b;
    --inverse-bg: #f3f3f3;
    --inverse-text: #111111;
    --inverse-accent: #0b6b37;
    --code-bg: #0b0b0b;
    --backdrop: rgba(0, 0, 0, .6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px -6px rgba(0, 0, 0, .5);
    --shadow-raise: 0 1px 1px rgba(0, 0, 0, .4), 0 8px 20px -8px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .05);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .05);
    --checker: rgba(255, 255, 255, .025);
    --seg-on: #343434;
    --knob: #111111;
    --title-grad: linear-gradient(90deg, #8f8f8f 0%, #5c5c5c 80%, #444 100%);
    --value-grad: linear-gradient(170deg, #ffffff 25%, #9a9a9a 100%);
}

@media (min-width: 900px) {
    :root { --ctl-h: 42px; }
}

/* =============================== base =============================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
    margin: 0;
    font: 400 15.5px/1.5 var(--font);
    font-optical-sizing: auto;
    letter-spacing: -.003em;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}
@media (min-width: 900px) { body { font-size: 15px; background: var(--canvas); } }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
code, kbd, pre, .mono { font-family: var(--mono); font-variant-ligatures: none; letter-spacing: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
::selection { background: var(--surface-3); }

.ic {
    width: 20px; height: 20px; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.7;
    stroke-linecap: round; stroke-linejoin: round;
}
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-3); }
.min0 { min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Two-tone headings: a solid first word, then a softer word fading out. */
.t2 {
    color: var(--text-4);
    background: var(--title-grad);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================== layout ============================== */

.app { min-height: 100vh; min-height: 100dvh; }
.main { min-width: 0; }
.sidebar { display: none; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 8px;
    min-height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    backdrop-filter: saturate(160%) blur(16px);
}
.topbar::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
    background: var(--border); opacity: 0; transition: opacity .2s;
}
.topbar.scrolled::after { opacity: 1; }
.page-title {
    flex: 1; min-width: 0;
    font-size: 27px; font-weight: 620; letter-spacing: -.035em; line-height: 1.1;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-actions { display: flex; align-items: center; gap: 8px; }

.view {
    padding: 6px max(18px, env(safe-area-inset-right)) calc(var(--tabbar-h) + 44px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    outline: none;
    transition: opacity .2s;
}
.view.is-loading { opacity: .55; pointer-events: none; }
.stack { display: grid; gap: 16px; }

/* floating tab bar (phones / small tablets) */
.tabbar {
    position: fixed; z-index: 30;
    left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right));
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    height: var(--tabbar-h); padding: 0 6px; border-radius: 26px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    backdrop-filter: saturate(180%) blur(18px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}
.tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-width: 0; height: 100%; padding: 0; border: 0; background: none; cursor: pointer;
    font-size: 11.5px; font-weight: 520; color: var(--text-3); text-decoration: none;
}
.tab .ic { width: 23px; height: 23px; }
.tab[aria-current="page"] { color: var(--text); font-weight: 650; }
.tab[aria-current="page"] .ic { stroke-width: 2.1; }
.tab-new .ic {
    box-sizing: content-box; width: 22px; height: 22px; padding: 13px;
    border-radius: 50%; background: var(--accent); color: var(--on-accent); stroke-width: 2.2;
    box-shadow: 0 8px 18px -6px rgba(0, 0, 0, .45);
    transition: transform .15s var(--ease);
}
.tab-new:active .ic { transform: scale(.93); }

/* desktop: the app fills the window; only the content pane scrolls */
@media (min-width: 900px) {
    .app {
        display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
        height: 100dvh; min-height: 0;
        background: var(--bg); overflow: clip;
    }
    .tabbar { display: none; }
    .sidebar {
        display: flex; flex-direction: column; gap: 22px; min-height: 0; overflow-y: auto;
        padding: 30px 18px 22px 22px;
    }
    .main { overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
    .topbar { min-height: 104px; padding: 18px 40px 0 32px; }
    .page-title { font-size: 40px; }
    .view { padding: 6px 40px 48px 32px; }
    .topbar, .view { max-width: 1480px; }
    .account-btn { display: none; }
}

/* sidebar */
.brand {
    display: flex; align-items: center; gap: 12px; padding: 0 6px 6px;
    font-size: 19px; font-weight: 650; letter-spacing: -.02em; color: var(--text); text-decoration: none;
}
.logo { width: 48px; height: 48px; flex: none; filter: drop-shadow(0 6px 7px rgba(0, 0, 0, .22)); }
.sidebar .btn-primary { height: 48px; justify-content: flex-start; padding: 0 14px 0 16px; }
.sidebar .btn-primary kbd {
    margin-left: auto; padding: 2px 7px; border-radius: 7px; font-size: 11px; font-weight: 600;
    background: rgba(127, 127, 127, .28);
}
.nav { display: grid; gap: 4px; }
.nav a, .nav-signout {
    display: flex; align-items: center; gap: 14px; height: 50px; padding: 0 14px;
    border-radius: 16px; color: var(--text-3); text-decoration: none;
    font-size: 16px; font-weight: 520;
    transition: background .15s, color .15s, box-shadow .15s;
}
.nav a:hover, .nav-signout:hover { color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); font-weight: 620; box-shadow: var(--shadow-raise); }
.nav .ic, .nav-signout .ic { width: 22px; height: 22px; }
.nav-row { position: relative; display: flex; align-items: center; }
.nav-row > a { flex: 1; }
/* A parent of an open sub-menu reads as active text, without the pill (the child gets it). */
.nav-group:not(.collapsed) .nav-parent[aria-current="page"] { background: none; box-shadow: none; }
.nav-chev {
    position: absolute; right: 6px; display: grid; place-items: center; width: 36px; height: 36px;
    border: 0; border-radius: 12px; background: none; color: var(--text-3); cursor: pointer;
}
.nav-chev:hover { background: var(--surface-2); color: var(--text); }
.nav-chev .ic { width: 18px; height: 18px; transition: transform .2s var(--ease); transform: rotate(180deg); }
.nav-group.collapsed .nav-chev .ic { transform: none; }
.nav-group.collapsed .subnav { display: none; }

/* sub-menu drawn as a tree: one rail, a rounded elbow into each item */
.subnav { list-style: none; margin: 2px 0 6px 25px; padding: 0 0 0 20px; display: grid; gap: 2px; }
.subnav li { position: relative; }
.subnav li::before {
    content: ""; position: absolute; left: -20px; top: 0; width: 14px; height: 50%;
    border-left: 1.5px solid var(--border-strong); border-bottom: 1.5px solid var(--border-strong);
    border-bottom-left-radius: 11px;
}
.subnav li:not(:last-child)::after {
    content: ""; position: absolute; left: -20px; top: 0; bottom: -2px; border-left: 1.5px solid var(--border-strong);
}
.subnav a { height: 44px; font-size: 15px; padding: 0 10px 0 14px; justify-content: space-between; gap: 10px; }
.nbadge {
    display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px;
    border-radius: 9px; background: var(--surface-3); color: #161616;
    font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.nbadge.mint { background: var(--mint); }
.nbadge.peach { background: var(--peach); }
:root[data-theme="dark"] .nbadge:not(.mint):not(.peach) { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .nbadge:not(.mint):not(.peach) { color: var(--text); } }
.sidebar-foot { margin-top: auto; display: grid; gap: 6px; }
.seg-theme { display: grid; grid-template-columns: repeat(3, 1fr); }
.seg-theme button { justify-content: center; }
.seg-theme .ic { width: 18px; height: 18px; }

/* ============================= controls ============================= */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: var(--ctl-h); padding: 0 18px; flex: none;
    border: 1px solid transparent; border-radius: 999px;
    font-size: 14.5px; font-weight: 580; line-height: 1; white-space: nowrap;
    text-decoration: none; cursor: pointer; user-select: none;
    transition: background .15s, border-color .15s, color .15s, box-shadow .15s, opacity .15s, transform .1s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn .ic { width: 19px; height: 19px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .5); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { border-color: var(--border-strong); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger-bg); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-bg-hover); }
.btn-danger-ghost { background: transparent; color: var(--bad); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--bad-soft); }
.btn-icon { width: var(--ctl-h); padding: 0; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn-sm.btn-icon { width: 36px; padding: 0; }
.btn-lg { height: 52px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-link {
    padding: 0; border: 0; background: none; cursor: pointer;
    color: var(--text); font-weight: 600; font-size: inherit; text-decoration: underline; text-underline-offset: 3px;
    text-decoration-color: var(--border-strong);
}
.btn-link:hover { text-decoration-color: currentColor; }
@media (min-width: 900px) { .btn-sm { height: 32px; } .btn-sm.btn-icon { width: 32px; } }
.spin {
    width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.input, .select, .textarea {
    width: 100%; height: var(--ctl-h); padding: 0 14px;
    border: 1px solid var(--border-strong); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text);
    font-size: 16px; /* 16px stops iOS zooming into focused fields */
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-4); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--text-4); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 4px var(--ring); }
.select {
    appearance: none; padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.textarea { height: auto; min-height: 150px; padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: vertical; }
@media (max-width: 899px) { .textarea { font-size: 16px; } }
@media (min-width: 900px) { .input, .select { font-size: 15px; } }

.field { display: grid; gap: 7px; min-width: 0; }
.field-label { display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text); }
.field-label .opt { font-weight: 450; font-size: 12.5px; color: var(--text-3); }
.field-hint { font-size: 13px; line-height: 1.45; color: var(--text-3); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* segmented control: buttons (filters, tabs) or radios (forms) */
.seg {
    display: inline-flex; gap: 2px; padding: 4px; max-width: 100%;
    background: var(--surface-3); border-radius: 999px;
}
.seg > button, .seg > label {
    position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: calc(var(--ctl-h) - 8px); padding: 0 15px; border: 0; border-radius: 999px;
    background: none; color: var(--text-3); font-size: 14px; font-weight: 560; white-space: nowrap; cursor: pointer;
    transition: background .15s, color .15s, box-shadow .15s;
}
.seg > button:hover, .seg > label:hover { color: var(--text); }
.seg > button[aria-pressed="true"], .seg > button[aria-selected="true"], .seg > label:has(input:checked) {
    background: var(--seg-on); color: var(--text); box-shadow: var(--shadow-raise);
}
.seg > label input { position: absolute; opacity: 0; pointer-events: none; }
.seg > label:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 1px; }
.seg .count { font-weight: 500; color: var(--text-3); font-variant-numeric: tabular-nums; }
.seg .ic { width: 17px; height: 17px; }
.seg-block { display: flex; width: 100%; }
.seg-block > * { flex: 1; }
.seg-scroll { overflow-x: auto; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }

/* toggle chips (multi-select checkboxes) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    position: relative; display: inline-flex; align-items: center; gap: 7px;
    min-height: 38px; padding: 6px 14px; border: 1px solid var(--border-strong); border-radius: 999px;
    background: var(--surface); color: var(--text-2); font-size: 14px; font-weight: 520; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip .ic { width: 17px; height: 17px; }
.chip:hover { border-color: var(--text-4); }
.chip:has(input:checked) { border-color: var(--text); background: var(--text); color: var(--surface); }
.chip:has(input:checked) .pill { color: inherit; background: rgba(127, 127, 127, .25); }
.chip:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }

/* switch (button[role=switch] or input[type=checkbox].switch) */
.switch {
    position: relative; flex: none; width: 44px; height: 26px; margin: 0; padding: 0;
    border: 0; border-radius: 999px; background: var(--border-strong);
    cursor: pointer; appearance: none; -webkit-appearance: none;
    transition: background .2s var(--ease);
}
.switch::before { content: ""; position: absolute; inset: -10px -6px; }   /* bigger touch target */
.switch::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s var(--ease), background .2s;
}
.switch[aria-checked="true"], .switch:checked { background: var(--accent); }
.switch[aria-checked="true"]::after, .switch:checked::after { transform: translateX(18px); background: var(--knob); }
.switch:disabled { opacity: .5; cursor: wait; }
.switch-row {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface-2);
}
.switch-row .t, .switch-row .s { display: block; }
.switch-row .t { font-weight: 600; }
.switch-row .s { font-size: 13px; color: var(--text-3); }
.switch-row .s .badge { margin-top: 4px; }

/* badges & pills */
.badge {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px;
    border-radius: 999px; background: var(--surface-2); color: var(--text-2);
    font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-dot); flex: none; }
.badge.live { background: var(--good-soft); color: var(--good); }
.badge.live::before { background: var(--good-dot); }
.badge.scheduled { background: var(--info-soft); color: var(--info); }
.badge.scheduled::before { background: var(--info-dot); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.warn::before { background: var(--warn-dot); }
.pill {
    display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 7px;
    background: var(--surface-2); color: var(--text-2);
    font-size: 12px; font-weight: 560; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* ============================== surfaces ============================= */

/* Cards are white on the left and fade into the frame on the right. */
.card {
    background: linear-gradient(100deg, var(--surface) 52%, var(--surface-fade));
    border-radius: var(--r); box-shadow: var(--shadow-sm);
}
@media (min-width: 900px) { .card { border-radius: var(--r-lg); } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.card-title { font-size: 18px; font-weight: 620; letter-spacing: -.02em; }
.card-sub { margin-top: 2px; font-size: 13.5px; color: var(--text-3); }
.card-body { padding: 16px 22px 22px; }
@media (min-width: 900px) {
    .card-head { padding: 26px 28px 0; }
    .card-title { font-size: 20px; }
    .card-body { padding: 18px 28px 26px; }
}
.grid-2 { display: grid; gap: 16px; }
@media (min-width: 1100px) { .grid-2 { grid-template-columns: 1fr 1fr; gap: 18px; } }

.page-intro { margin: -2px 0 18px; color: var(--text-3); font-size: 15px; max-width: 70ch; }
.page-intro b { color: var(--text); font-weight: 600; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 240px; max-width: 400px; }
.search .ic { position: absolute; left: 16px; top: 50%; width: 19px; height: 19px; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { padding-left: 44px; border-radius: 999px; border-color: transparent; box-shadow: var(--shadow-sm); }
.search .input:focus { border-color: var(--text); }
.search kbd {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    padding: 1px 7px; border-radius: 6px; background: var(--surface-2); font-size: 11.5px; color: var(--text-3);
}
@media (max-width: 899px) {
    .search { max-width: none; flex-basis: 100%; }
    .search kbd { display: none; }
    .toolbar .seg { flex: 1 1 100%; }
    .toolbar .seg > button { flex: 1; }
}

/* empty / error states */
.empty { display: grid; justify-items: center; gap: 8px; padding: 60px 20px; text-align: center; }
.empty-ic {
    display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 8px;
    border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.empty-ic .ic { width: 26px; height: 26px; }
.empty-ic.bad { background: var(--bad-soft); color: var(--bad); }
.empty h2, .empty h3 { font-size: 19px; font-weight: 620; letter-spacing: -.02em; }
.empty p { max-width: 400px; color: var(--text-3); }
.empty .btn { margin-top: 12px; }
.empty-mini { padding: 24px 0 8px; color: var(--text-3); text-align: center; font-size: 14px; }

/* skeletons */
.skel {
    display: block; border-radius: 10px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite;
}
.skel-card { border-radius: var(--r); background: var(--surface); padding: 20px; display: grid; gap: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.alert {
    padding: 11px 14px; border-radius: var(--r-sm);
    background: var(--bad-soft); color: var(--bad); font-size: 14.5px; font-weight: 500;
}
.note {
    display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-sm);
    background: var(--surface-2); color: var(--text-2); font-size: 14px;
}
.note .ic { width: 19px; height: 19px; margin-top: 1px; color: var(--text-3); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.warn .ic { color: var(--warn); }

/* =============================== overview =========================== */

.setup { padding: 22px; display: grid; gap: 16px; }
@media (min-width: 900px) { .setup { padding: 28px; } }
.setup-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.setup-progress { font-size: 13.5px; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.setup-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.setup-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.setup-steps li {
    display: grid; grid-template-columns: 32px 1fr auto; gap: 14px; align-items: center;
    padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2);
}
.setup-steps .dot {
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: var(--surface); color: var(--text-3); font-size: 13px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.setup-steps li.done .dot { background: var(--mint); color: #0b6b37; box-shadow: none; }
.setup-steps li.done .dot .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.setup-steps li.done .t { color: var(--text-3); text-decoration: line-through; }
.setup-steps .t { font-weight: 600; }
.setup-steps .s { font-size: 13px; color: var(--text-3); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; } }
.kpi {
    position: relative; display: grid; align-content: start; gap: 6px; min-width: 0;
    padding: 16px; text-align: left; text-decoration: none; color: inherit; cursor: pointer;
    border: 0; border-radius: var(--r);
    background: linear-gradient(100deg, var(--surface) 52%, var(--surface-fade)); box-shadow: var(--shadow-sm);
    transition: box-shadow .15s, transform .15s var(--ease);
}
.kpi:hover { box-shadow: var(--shadow); }
.kpi[aria-pressed="true"] { background: var(--surface); box-shadow: var(--shadow-raise); }
.kpi[aria-pressed="true"] .kpi-ic { background: var(--accent); color: var(--on-accent); }
.kpi-ic {
    display: grid; place-items: center; width: 40px; height: 40px; margin-bottom: 8px;
    border-radius: 50%; background: var(--surface-2); color: var(--text-2); transition: background .2s, color .2s;
}
.kpi-ic .ic { width: 19px; height: 19px; }
/* phones: the disc tucks into the corner so tiles stay short */
@media (max-width: 899px) {
    .kpi-ic { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; margin: 0; }
    .kpi-ic .ic { width: 17px; height: 17px; }
    .kpi-label { padding-right: 38px; min-height: 36px; align-content: center; }
}
.kpi-label { display: grid; font-size: 14px; font-weight: 560; line-height: 1.3; color: var(--text-2); }
.kpi-label > span:first-child { display: block; }
.kpi .help { display: inline-block; margin-left: 5px; color: var(--text-4); cursor: help; vertical-align: -3px; }
@media (hover: none) { .kpi .help { display: none; } }   /* a hover hint; touch can't reach it */
.kpi .help .ic { width: 17px; height: 17px; }
.kpi-value {
    font-size: 34px; font-weight: 620; letter-spacing: -.045em; line-height: 1.05;
    color: var(--text); background: var(--value-grad);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-bottom: 2px;
}
.kpi-value .unit { font-weight: 480; opacity: .55; margin-left: .04em; }
.kpi-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; font-size: 13px; color: var(--text-3); }
.chip-delta {
    display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px;
    border-radius: 9px; border: 1px solid transparent; font-size: 13.5px; font-weight: 620;
    font-variant-numeric: tabular-nums;
}
.chip-delta .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.chip-delta.up { background: var(--good-soft); border-color: var(--good-line); color: var(--good); }
.chip-delta.down { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.chip-delta.flat { background: var(--surface-2); color: var(--text-2); }
@media (min-width: 900px) {
    .kpi { padding: 24px 24px 22px; border-radius: var(--r-lg); gap: 8px; }
    .kpi-ic { width: 56px; height: 56px; margin-bottom: 14px; }
    .kpi-ic .ic { width: 22px; height: 22px; }
    .kpi-label { font-size: 15px; }
    .kpi-value { font-size: 48px; }
}

.chart { position: relative; min-height: 240px; }
.chart svg { display: block; width: 100%; height: 240px; touch-action: pan-y; overflow: visible; }
.chart svg:focus-visible { outline-offset: 4px; border-radius: 6px; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .gl.base { stroke: var(--axis); }
.chart .yl, .chart .xl { fill: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--series-1); transition: opacity .12s; }
.chart .band { fill: var(--surface-2); }
.chart svg.hovering .bar:not(.on) { opacity: .35; }
.chart-tip {
    position: absolute; z-index: 2; pointer-events: none;
    padding: 8px 12px; border-radius: 12px; white-space: nowrap;
    background: var(--surface); box-shadow: var(--shadow-lg);
    font-size: 12.5px; color: var(--text-3); transform: translate(-50%, calc(-100% - 10px));
}
.chart-tip b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.02em; color: var(--text); }
.chart-empty { display: grid; place-items: center; align-content: center; gap: 10px; height: 240px; color: var(--text-3); text-align: center; }
.chart-empty .ic { width: 30px; height: 30px; }

.table-wrap { overflow: auto; max-height: 340px; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.data { width: 100%; border-collapse: collapse; font-size: 14px; }
.data th, .data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-3); font-size: 12.5px; font-weight: 600; }
.data tr:last-child td { border-bottom: 0; }
.data .num { text-align: right; font-variant-numeric: tabular-nums; }

.rank { list-style: none; margin: 0; padding: 0; }
.rank > li + li { border-top: 1px solid var(--border); }
.rank-row {
    display: grid; grid-template-columns: 46px minmax(0, 1fr) auto; gap: 14px; align-items: center;
    width: calc(100% + 16px); padding: 11px 8px; margin: 0 -8px;
    border: 0; border-radius: var(--r-sm); background: none; text-align: left; color: inherit;
}
button.rank-row { cursor: pointer; }
button.rank-row:hover { background: var(--surface-2); }
.rank-row .name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .sub { display: block; font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { display: block; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 2px; background: var(--series-1); }
.rank-row .nums { text-align: right; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-row .nums b { display: block; font-size: 16px; font-weight: 650; color: var(--text); }
.thumb {
    display: grid; place-items: center; width: 46px; height: 46px; overflow: hidden;
    border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.thumb:has(img) { border-radius: 12px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ic { width: 20px; height: 20px; }

/* ================================= ads ============================== */

.ad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 18px; }
.ad-card { position: relative; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); transition: box-shadow .2s, transform .2s var(--ease); }
.ad-card:hover { box-shadow: var(--shadow); }
.preview {
    position: relative; display: grid; place-items: center; height: 168px; padding: 14px; cursor: pointer; overflow: hidden;
    margin: 8px 8px 0; border-radius: calc(var(--r) - 8px);
    background-color: var(--surface-2);
    background-image:
        linear-gradient(45deg, var(--checker) 25%, transparent 25%, transparent 75%, var(--checker) 75%),
        linear-gradient(45deg, var(--checker) 25%, transparent 25%, transparent 75%, var(--checker) 75%);
    background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
/* Banners fill the padded box but never upscale; HTML frames are scaled by fitFrames(). */
.preview > img {
    position: absolute; left: 14px; top: 14px; width: calc(100% - 28px); height: calc(100% - 28px);
    object-fit: scale-down;
}
.preview > iframe {
    position: absolute; left: 14px; top: 14px; width: calc(100% - 28px); height: calc(100% - 28px);
    border: 0; pointer-events: none; background: transparent; color-scheme: light; transform-origin: 0 0;
}
.preview .ic { width: 28px; height: 28px; color: var(--text-4); }
.native-prev {
    display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; width: 100%; max-width: 320px;
    padding: 10px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-sm); text-align: left;
}
.native-prev.no-img { grid-template-columns: 1fr; }
.native-prev img { width: 56px; height: 56px; object-fit: cover; border-radius: 9px; }
.native-prev b { display: block; font-size: 13.5px; line-height: 1.3; }
.native-prev span { display: block; font-size: 12.5px; color: var(--text-3); line-height: 1.35; margin-top: 2px; }
.ad-body { display: grid; gap: 9px; padding: 14px 18px 14px; flex: 1; cursor: pointer; min-width: 0; }
.ad-name {
    display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
    font-size: 16.5px; font-weight: 620; letter-spacing: -.02em; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ad-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--text-3); min-width: 0; }
.ad-meta .camp { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-stats { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ad-stats span { white-space: nowrap; }
.ad-stats b { color: var(--text); font-weight: 650; font-size: 14.5px; }
.ad-foot { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-top: 1px solid var(--border); }
.ad-foot .lbl { font-size: 13.5px; font-weight: 560; color: var(--text-3); margin-right: auto; }

@media (max-width: 599px) {
    .ad-grid { grid-template-columns: 1fr; gap: 10px; }
    .ad-card { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; align-items: stretch; }
    .ad-card .preview { height: auto; min-height: 96px; margin: 8px 0 8px 8px; padding: 8px; border-radius: 16px; }
    .ad-card .preview > img, .ad-card .preview > iframe { left: 8px; top: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
    .ad-card .native-prev { grid-template-columns: 1fr; padding: 6px; }
    .ad-card .native-prev img, .ad-card .native-prev span { display: none; }
    .ad-card .ad-body { padding: 12px 4px 12px 14px; gap: 6px; align-content: center; }
    .ad-card .ad-name { font-size: 15.5px; }
    .ad-card .ad-stats { gap: 2px 12px; }
    .ad-card .ad-foot {
        flex-direction: column; justify-content: space-between; align-items: center; gap: 4px;
        padding: 14px 10px 6px; border-top: 0;
    }
    .ad-card .ad-foot .lbl { display: none; }
}

/* ad detail */
.detail-preview { height: 220px; margin: 0; cursor: default; }
@media (min-width: 900px) { .detail-preview { height: 260px; } }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stat { padding: 12px 14px; border-radius: var(--r-sm); background: var(--surface-2); }
.mini-stat .l { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.mini-stat .v { font-size: 24px; font-weight: 640; letter-spacing: -.035em; }
.facts { margin: 0; display: grid; }
.facts > div { display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.facts > div:first-child { border-top: 0; }
.facts dt { color: var(--text-3); font-size: 14px; font-weight: 520; }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts dd a { display: inline-flex; align-items: center; gap: 4px; text-underline-offset: 3px; }
.facts dd a .ic { width: 15px; height: 15px; }
.facts ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.facts .dev { display: inline-flex; align-items: center; gap: 5px; margin-right: 14px; }
.facts .dev .ic { width: 17px; height: 17px; color: var(--text-3); }
@media (max-width: 599px) { .facts > div { grid-template-columns: 1fr; gap: 2px; } }

/* =========================== campaigns (rows) ======================== */

.rows { overflow: hidden; }
.trow {
    display: grid; align-items: center; gap: 4px 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "main act" "meta act" "nums nums";
    padding: 16px 14px 16px 20px; border-top: 1px solid var(--border);
}
.trow:first-child { border-top: 0; }
.trow.thead { display: none; }
.trow.clickable { cursor: pointer; transition: background .15s; }
.trow.clickable:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.c-main { grid-area: main; min-width: 0; }
.c-main .name {
    display: block; max-width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer;
    font-weight: 620; font-size: 16px; letter-spacing: -.015em; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.c-main .sub { font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-meta { grid-area: meta; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13.5px; color: var(--text-2); }
.c-meta .when { display: inline-flex; align-items: center; gap: 6px; }
.c-meta .when .ic { width: 16px; height: 16px; color: var(--text-3); }
.c-nums { grid-area: nums; display: flex; gap: 16px; margin-top: 6px; font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.c-nums b { color: var(--text); font-weight: 650; }
.c-act { grid-area: act; display: flex; align-items: center; gap: 6px; }
.c-col { display: none; }
@media (min-width: 900px) {
    .trow {
        grid-template-columns: minmax(200px, 2fr) 150px minmax(170px, 1.5fr) 64px 90px 72px 100px;
        grid-template-areas: none; padding: 14px 16px 14px 28px;
    }
    .trow > * { grid-area: auto; }
    .trow.thead { display: grid; padding-top: 18px; padding-bottom: 12px; border-top: 0; font-size: 13px; font-weight: 560; color: var(--text-3); }
    .trow.thead + .trow { border-top: 1px solid var(--border); }
    .c-meta { display: contents; }
    .c-nums { display: none; }
    .c-col { display: block; text-align: right; font-variant-numeric: tabular-nums; }
    .c-act { justify-content: flex-end; }
}

/* ================================ sites =============================== */

.site-grid { display: grid; gap: 18px; }
@media (min-width: 1240px) { .site-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.site-head { display: flex; align-items: center; gap: 14px; padding: 18px 12px 14px 20px; }
.site-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); flex: none; }
.site-icon .ic { width: 22px; height: 22px; }
.site-name { font-size: 18px; font-weight: 620; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-domain { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; color: var(--text-3); text-decoration: none; }
.site-domain:hover { color: var(--text); }
.site-domain .ic { width: 14px; height: 14px; }
.slots { list-style: none; margin: 0 10px; padding: 0; }
.slot {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center;
    padding: 12px 2px 12px 10px; border-top: 1px solid var(--border);
}
.slot-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.slot-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; font-size: 13px; color: var(--text-3); }
.slot-meta code { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.slot-act { display: flex; align-items: center; gap: 4px; }
.site-foot { padding: 8px 12px 12px; }
.site-empty { margin: 0 20px; padding: 16px 0; border-top: 1px solid var(--border); color: var(--text-3); font-size: 14px; }
@media (max-width: 599px) { .slot-act .lbl { display: none; } }

/* embed snippets */
.embed-slug { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.embed-slug code { padding: 5px 10px; border-radius: 9px; background: var(--surface-2); font-size: 13px; }
.code-block { display: grid; gap: 7px; }
.code-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.code {
    position: relative; margin: 0; padding: 16px 54px 16px 18px; border-radius: var(--r-sm);
    background: var(--code-bg); color: var(--code-text);
    font: 12.5px/1.65 var(--mono); white-space: pre-wrap; word-break: break-word;
}
.code .copy {
    position: absolute; top: 9px; right: 9px; color: #cfcfcf; background: rgba(255, 255, 255, .09); border-color: transparent;
}
.code .copy:hover { background: rgba(255, 255, 255, .18) !important; color: #fff; }

/* =============================== forms =============================== */

.form { display: grid; gap: 28px; }
.form-section { display: grid; gap: 15px; }
.form-section > h3 { font-size: 13px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
details.more > summary {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none;
    font-size: 14px; font-weight: 600; color: var(--text);
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary .ic { width: 17px; height: 17px; transition: transform .2s; }
details.more[open] > summary .ic { transform: rotate(180deg); }
details.more[open] > summary { margin-bottom: 15px; }
details.more > .inner { display: grid; gap: 15px; }

.uploader {
    display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 16px; align-items: center;
    padding: 12px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-sm);
}
.uploader.busy { opacity: .7; }
.up-preview {
    display: grid; place-items: center; width: 100px; height: 76px; overflow: hidden;
    border-radius: 10px; background: var(--surface-2); color: var(--text-4);
}
.up-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.up-info { display: grid; gap: 4px; justify-items: start; }
.up-info .t { font-weight: 600; }
.up-info .s { font-size: 13px; color: var(--text-3); }
.up-info .btn { margin-top: 4px; }

.html-live { height: 140px; border: 0; border-radius: var(--r-sm); background: var(--surface-2); }

.zone-picker { display: grid; gap: 16px; }
.zp-site { display: grid; gap: 9px; }
.zp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 620; }

.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 8px; }
.size-opt {
    position: relative; display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: center;
    padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.size-opt input { position: absolute; opacity: 0; pointer-events: none; }
.size-opt:hover { border-color: var(--text-4); }
.size-opt:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.size-opt:has(input:focus-visible) { outline: 2px solid var(--text); outline-offset: 2px; }
.size-opt .box { display: grid; place-items: center; width: 36px; height: 36px; }
.size-opt .box i { display: block; border: 1.5px solid currentColor; border-radius: 3px; color: var(--text-4); }
.size-opt:has(input:checked) .box i { color: var(--text); background: var(--surface-3); }
.size-opt .n { font-size: 13.5px; font-weight: 620; line-height: 1.2; font-variant-numeric: tabular-nums; }
.size-opt .d { display: block; font-size: 12px; color: var(--text-3); line-height: 1.25; }

/* =============================== wizard ============================== */

.steps { display: grid; gap: 9px; margin-bottom: 24px; }
.steps-bar { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.steps-bar i { height: 4px; border-radius: 2px; background: var(--surface-3); transition: background .25s; }
.steps-bar i.on { background: var(--accent); }
.steps-label { font-size: 13.5px; color: var(--text-3); font-weight: 560; }
.steps-label b { color: var(--text); font-weight: 650; }
.wz { display: grid; gap: 20px; }
.dropzone {
    position: relative; display: grid; justify-items: center; gap: 6px; padding: 32px 18px; cursor: pointer; text-align: center;
    border: 1.5px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2);
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--text); background: var(--surface-3); }
.dropzone:focus-within { border-color: var(--text); }
.dropzone .dz-ic { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface); color: var(--text); box-shadow: var(--shadow); margin-bottom: 6px; }
.dropzone .dz-ic .ic { width: 22px; height: 22px; }
.dropzone .t { font-weight: 620; font-size: 16px; }
.dropzone .s { font-size: 13.5px; color: var(--text-3); max-width: 380px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dz-touch { display: none; }
@media (hover: none) { .dz-touch { display: inline; } .dz-mouse { display: none; } }
.wz-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.wz-thumbs:empty { display: none; }
.wz-thumb { position: relative; display: grid; gap: 7px; padding: 8px; border-radius: var(--r-sm); background: var(--surface-2); }
.wz-thumb .img { display: grid; place-items: center; height: 86px; border-radius: 9px; background: var(--surface); overflow: hidden; }
.wz-thumb img { max-height: 100%; object-fit: contain; }
.wz-thumb .rm {
    position: absolute; top: -8px; right: -8px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
    border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent);
    box-shadow: var(--shadow); cursor: pointer;
}
.wz-thumb .rm .ic { width: 15px; height: 15px; stroke-width: 2.2; }
.wz-alt { font-size: 14px; color: var(--text-3); text-align: center; }
.pick-list { display: grid; gap: 10px; }
.pick {
    position: relative; display: grid; gap: 9px; padding: 15px 16px;
    border-radius: var(--r-sm); background: var(--surface-2);
    transition: background .15s, box-shadow .15s;
}
.pick:has(> .pick-top input:checked) { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--text), var(--shadow); }
.pick-top { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.pick-top input { position: absolute; opacity: 0; pointer-events: none; }
.pick-top .box {
    display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 8px;
    border: 1.5px solid var(--text-4); background: var(--surface); color: transparent; transition: background .15s, border-color .15s;
}
.pick-top .box .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.pick-top input:checked + .box { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pick-top input:focus-visible + .box { outline: 2px solid var(--text); outline-offset: 2px; }
.pick-top .t { font-weight: 620; }
.pick-top .s { font-size: 13px; color: var(--text-3); }
.pick-all { padding: 13px 16px; }
.place-lines { list-style: none; margin: 0 0 0 36px; padding: 0; display: grid; gap: 7px; font-size: 13.5px; color: var(--text-2); }
.place-lines li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.place-lines .ok { color: var(--good); }
.place-lines .no { color: var(--warn); }
.place-lines .ic { width: 16px; height: 16px; }
.place-lines label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; color: var(--text); }
.place-lines label input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.review { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.review li { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px; border-radius: var(--r-sm); background: var(--surface-2); }
.review .img { display: grid; place-items: center; height: 62px; border-radius: 9px; background: var(--surface); overflow: hidden; }
.review img { max-height: 100%; object-fit: contain; }
.review .where { font-size: 14px; }
.review .where .muted { font-size: 13px; }
.summary { display: grid; gap: 7px; margin: 0; padding: 14px 16px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 14px; }
.summary div { display: flex; gap: 8px; min-width: 0; }
.summary dt, .summary .k { flex: none; width: 84px; color: var(--text-3); }
.summary dd, .summary .v { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.done { display: grid; justify-items: center; gap: 8px; padding: 22px 0 8px; text-align: center; }
.done-tick {
    display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 8px; border-radius: 50%;
    background: var(--mint); color: #0b6b37; animation: pop .35s var(--ease);
}
.done-tick .ic { width: 32px; height: 32px; stroke-width: 2.4; }
.done h3 { font-size: 24px; font-weight: 650; letter-spacing: -.03em; }
.done p { color: var(--text-3); }

/* ========================= sheets, dialogs, menus ===================== */

dialog { color: var(--text); }
dialog.sheet {
    position: fixed; inset: auto 0 0 0; width: 100%; height: auto;
    max-width: none; max-height: none; margin: 0; padding: 0;
    border: 0; background: transparent; overflow: visible;
}
dialog::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
dialog[open]::backdrop { animation: fade .22s ease-out; }
dialog.closing::backdrop { animation: fade-out .2s ease-in forwards; }
.sheet-panel {
    display: flex; flex-direction: column; overflow: hidden;
    max-height: calc(100dvh - 12px - env(safe-area-inset-top));
    background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
}
dialog.sheet.full .sheet-panel { height: calc(100dvh - 12px - env(safe-area-inset-top)); }
dialog[open] > .sheet-panel { animation: sheet-up .32s var(--ease); }
dialog.closing > .sheet-panel { animation: sheet-down .22s ease-in forwards; }
.sheet-panel::before {
    content: ""; flex: none; width: 40px; height: 5px; margin: 9px auto -4px; border-radius: 3px; background: var(--border-strong);
}
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 22px; flex: none; }
.sheet-head h2 { flex: 1; min-width: 0; font-size: 21px; font-weight: 650; letter-spacing: -.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 6px 22px 26px; }
.sheet-body > .stack { gap: 18px; }
.sheet-foot {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px; flex: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border); background: var(--surface);
}
.sheet-foot .spacer { flex: 1; }
.sheet-error { flex: 1 1 100%; padding: 10px 14px; border-radius: var(--r-sm); background: var(--bad-soft); color: var(--bad); font-size: 14px; font-weight: 500; }
@media (max-width: 599px) {
    .sheet-foot .btn:not(.btn-icon) { flex: 1; }
    .sheet-foot .spacer { display: none; }
    .sheet-foot .btn-danger-ghost { flex: 0 0 auto; }
    .sheet-foot .btn-danger-ghost .lbl { display: none; }
}
@media (min-width: 600px) and (max-width: 899px) {
    dialog.sheet { left: 50%; right: auto; width: min(640px, 100%); transform: translateX(-50%); }
}
/* desktop: drawers float inside the window like the app's cards */
@media (min-width: 900px) {
    dialog.sheet { inset: 14px 14px 14px auto; width: min(560px, calc(100vw - 28px)); height: calc(100% - 28px); }
    dialog.sheet.wide { width: min(720px, calc(100vw - 28px)); }
    dialog.sheet .sheet-panel, dialog.sheet.full .sheet-panel { height: 100%; max-height: none; border-radius: var(--r-lg); }
    dialog.sheet[open] > .sheet-panel { animation: drawer-in .32s var(--ease); }
    dialog.sheet.closing > .sheet-panel { animation: drawer-out .2s ease-in forwards; }
    dialog.sheet .sheet-panel::before { display: none; }
    .sheet-head { padding: 22px 18px 16px 30px; }
    .sheet-head h2 { font-size: 24px; }
    .sheet-body { padding: 8px 30px 30px; }
    .sheet-foot { padding: 16px 22px 16px 30px; }
    dialog.sheet.center { inset: 0; margin: auto; width: min(460px, calc(100vw - 32px)); height: fit-content; }
    dialog.sheet.center .sheet-panel { height: auto; max-height: calc(100dvh - 64px); }
    dialog.sheet.center[open] > .sheet-panel { animation: pop .2s var(--ease); }
    dialog.sheet.center.closing > .sheet-panel { animation: fade-out .15s ease-in forwards; }
    dialog.sheet.center .sheet-foot { border-top: 0; padding-top: 4px; padding-bottom: 24px; }
}
.confirm-msg { color: var(--text-2); }

dialog.menu {
    position: fixed; inset: auto; margin: 0; padding: 6px; min-width: 220px; max-width: calc(100vw - 16px);
    border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg);
}
dialog.menu::backdrop { background: transparent; animation: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
dialog.menu[open] { animation: menu-in .14s var(--ease); }
dialog.menu.closing { animation: fade-out .1s ease-in forwards; }
.menu-item {
    display: flex; align-items: center; gap: 12px; width: 100%; height: 42px; padding: 0 12px;
    border: 0; border-radius: 13px; background: none; color: var(--text);
    font-size: 14.5px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer;
}
.menu-item .ic { width: 19px; height: 19px; color: var(--text-3); }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item.danger, .menu-item.danger .ic { color: var(--bad); }
.menu-item .check { margin-left: auto; color: var(--text); stroke-width: 2.4; }
.menu-sep { height: 1px; margin: 6px 6px; background: var(--border); }
.menu-heading { padding: 8px 12px 4px; font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--text-3); }
.action-sheet .sheet-body { padding: 0 10px 14px; }
.action-sheet .menu-item { height: 54px; font-size: 16px; padding: 0 14px; border-radius: 16px; }

/* toasts */
.toasts {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 100;
    bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom));
    display: grid; justify-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 24px); pointer-events: none;
}
dialog .toasts { bottom: calc(88px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .toasts, dialog .toasts { bottom: 28px; } }
.toast {
    display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 8px 8px 16px; pointer-events: auto;
    border-radius: 999px; background: var(--inverse-bg); color: var(--inverse-text);
    box-shadow: var(--shadow-lg); font-size: 14.5px; font-weight: 500;
    animation: toast-in .25s var(--ease);
}
.toast > .ic { width: 19px; height: 19px; color: var(--good-dot); }
.toast.error > .ic { color: var(--bad-dot); }
.toast span { padding-right: 8px; }
.toast button {
    height: 34px; padding: 0 14px; border: 0; border-radius: 999px; cursor: pointer;
    background: color-mix(in srgb, var(--inverse-text) 12%, transparent);
    color: var(--inverse-accent); font-weight: 650; font-size: 14px;
}
.toast button:hover { background: color-mix(in srgb, var(--inverse-text) 20%, transparent); }
.toast.out { animation: fade-out .18s ease-in forwards; }

@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes drawer-in { from { transform: translateX(calc(100% + 20px)); } }
@keyframes drawer-out { to { transform: translateX(calc(100% + 20px)); } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after, *::backdrop { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================ login ============================== */

.login-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--canvas); }
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
    display: grid; gap: 16px; padding: 32px 24px 26px;
    background: linear-gradient(160deg, var(--surface) 55%, var(--bg)); border-radius: 32px; box-shadow: var(--shadow-lg);
}
@media (min-width: 600px) { .login-card { padding: 44px 40px 36px; } }
.login-brand { display: grid; justify-items: center; gap: 8px; margin-bottom: 8px; text-align: center; }
.login-brand .logo { width: 68px; height: 68px; margin-bottom: 12px; }
.login-brand h1 { font-size: 34px; font-weight: 620; letter-spacing: -.04em; line-height: 1.1; }
.login-brand p { color: var(--text-3); font-size: 15px; }
.login-card .btn { margin-top: 8px; }

/* ============================ responsive bits ========================= */

.lbl-short { display: none; }
.range-btn { background: var(--surface); border-color: transparent; }
@media (max-width: 899px) {
    .hide-sm { display: none; }
    .range-btn .lbl-long { display: none; }
    .range-btn .lbl-short { display: inline; }
    .range-btn { padding: 0 13px; gap: 6px; }
    .range-btn .chev { display: none; }
    .page-actions .btn { height: 42px; }
    .page-actions .btn-icon { width: 42px; padding: 0; }
    .page-actions .btn-primary:has(.hide-sm) { width: 42px; padding: 0; }
}
@media (min-width: 900px) { .show-sm { display: none; } }
