:root {
    --bg: #0b0c10;
    --bg-soft: #101218;
    --bg-card: #15171f;
    --bg-card-hover: #1a1d27;
    --bg-input: #0e0f15;
    --border: #262a36;
    --border-soft: #1d202a;
    --border-focus: #7c8cff;
    --text: #f3f4f8;
    --text-muted: #9a9db0;
    --text-dim: #6b6e80;
    --accent-a: #6c7bff;
    --accent-b: #a06cff;
    --accent-grad: linear-gradient(135deg, var(--accent-a), var(--accent-b));
    --danger: #ff5d6c;
    --danger-bg: rgba(255, 93, 108, 0.12);
    --success: #33d17a;
    --success-bg: rgba(51, 209, 122, 0.12);
    --warn: #f9ab00;
    --warn-bg: rgba(249, 171, 0, 0.12);
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.55);
    --shadow-pop: 0 20px 60px -20px rgba(108, 123, 255, 0.35);
}

* { box-sizing: border-box; }

body.advertise-body {
    margin: 0;
    background:
        radial-gradient(1100px 480px at 15% -10%, rgba(108, 123, 255, 0.16), transparent 60%),
        radial-gradient(900px 420px at 100% 0%, rgba(160, 108, 255, 0.12), transparent 55%),
        var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------- Topbar */

.advertise-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(14px);
    background: rgba(11, 12, 16, 0.72);
    border-bottom: 1px solid var(--border-soft);
}

.advertise-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: -.01em;
}

.advertise-logo .logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent-grad);
    color: #fff;
    font-size: 13px;
}

.advertise-back-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.advertise-back-link:hover { color: var(--text); border-color: var(--border-focus); background: rgba(124, 140, 255, 0.08); }

/* ---------------------------------------------------------- Layout */

.advertise-main {
    max-width: 1040px;
    margin: 0 auto;
    padding: 48px 24px 100px;
}

.advertise-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: start;
}
@media (min-width: 880px) {
    .advertise-layout { grid-template-columns: 1fr 320px; gap: 28px; }
}

.advertise-form-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.advertise-loading, .advertise-help {
    color: var(--text-muted);
    font-size: 14px;
}

.advertise-error {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(255, 93, 108, 0.3);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    margin-bottom: 18px;
    font-size: 14px;
    font-weight: 500;
}

/* ---------------------------------------------------------- Hero */

.advertise-hero {
    max-width: 720px;
    margin: 0 auto 36px;
    text-align: center;
}
.advertise-hero .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: transparent;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    background-clip: text;
    margin-bottom: 14px;
}
.advertise-hero h1 {
    font-size: clamp(28px, 4vw, 40px);
    line-height: 1.1;
    letter-spacing: -.02em;
    margin: 0 0 14px;
    font-weight: 800;
}
.advertise-hero p {
    color: var(--text-muted);
    margin: 0;
    line-height: 1.6;
    font-size: 15.5px;
}
.advertise-hero p + p { margin-top: 8px; }

.advertise-signedin { font-size: 13.5px; }
.advertise-signedin strong { color: var(--text); }
.advertise-signedin a { color: var(--accent-a); text-decoration: none; font-weight: 600; cursor: pointer; }
.advertise-signedin a:hover { text-decoration: underline; }

.advertise-myads-list {
    max-width: 480px;
    margin: 14px auto 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}
.advertise-myad-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    font-size: 13.5px;
    font-weight: 600;
    transition: border-color .15s ease;
}
.advertise-myad-row:hover { border-color: var(--accent-a); }
.advertise-myad-row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------- Stepper */

.advertise-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    max-width: 640px;
    margin: 0 auto 40px;
    flex-wrap: wrap;
}
.advertise-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    font: inherit;
    appearance: none;
    cursor: pointer;
    opacity: .5;
    transition: opacity .15s ease, border-color .15s ease;
}
.advertise-step:disabled { cursor: default; }
.advertise-step.active, .advertise-step.done { opacity: 1; }
.advertise-step.active { border-color: var(--accent-a); }
.advertise-step b {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-grad);
    color: #fff;
}
.advertise-step span { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.advertise-step-sep { width: 20px; height: 1px; background: var(--border); }

/* ---------------------------------------------------------- Step panels */

.advertise-step-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
}
.advertise-step-nav .advertise-primary-btn, .advertise-step-nav .advertise-secondary-btn { width: auto; min-width: 140px; }
.advertise-secondary-btn {
    padding: 14px 22px;
    background: transparent;
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.advertise-secondary-btn:hover { border-color: color-mix(in srgb, var(--accent-a) 45%, var(--border)); background: rgba(124, 140, 255, 0.04); }

/* ---------------------------------------------------------- Cards */

.advertise-card {
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-card);
}
.advertise-card + .advertise-card { margin-top: 0; }
.advertise-card h2 {
    font-size: 15px;
    font-weight: 700;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 9px;
    letter-spacing: -.01em;
}
.advertise-card h2 .step-num {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(124, 140, 255, 0.12);
    color: var(--accent-a);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
}

/* ---------------------------------------------------------- Form fields */

.advertise-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.advertise-form label:last-child { margin-bottom: 0; }
.advertise-form input[type="text"],
.advertise-form input[type="url"],
.advertise-form input[type="email"],
.advertise-form input[type="number"],
.advertise-form textarea {
    display: block;
    width: 100%;
    margin-top: 7px;
    padding: 11px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14.5px;
    font-family: inherit;
    font-weight: 500;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.advertise-form input:focus, .advertise-form textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(124, 140, 255, 0.18);
}
.advertise-form input::placeholder, .advertise-form textarea::placeholder { color: var(--text-dim); }

.advertise-file-field {
    margin-top: 7px;
    position: relative;
}
.advertise-file-field input[type="file"] {
    width: 100%;
    padding: 22px 14px;
    background: var(--bg-input);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13.5px;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.advertise-file-field input[type="file"]:hover { border-color: var(--accent-a); background: rgba(124, 140, 255, 0.04); }
.advertise-file-field input[type="file"]::file-selector-button {
    background: var(--accent-grad);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12.5px;
    margin-right: 12px;
    cursor: pointer;
}

/* ---------------------------------------------------------- Placement cards */

.placement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
    max-height: 52vh;
    overflow-y: auto;
    padding-right: 2px;
}
.placement-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
    position: relative;
}
.placement-card:hover { border-color: color-mix(in srgb, var(--accent-a) 45%, var(--border)); background: rgba(124, 140, 255, 0.04); }
.placement-card:has(input:checked) {
    border-color: var(--accent-a);
    background: rgba(124, 140, 255, 0.08);
    box-shadow: 0 0 0 1px var(--accent-a);
}
.placement-card input { position: absolute; opacity: 0; pointer-events: none; }
.placement-diagram-thumb { flex: 0 0 auto; width: 70px; line-height: 0; }
.placement-diagram-svg { display: block; width: 100%; height: auto; border-radius: 6px; }
.placement-card-body { flex: 1; min-width: 0; }
.placement-card-body strong { display: block; font-size: 12.5px; font-weight: 700; line-height: 1.25; }
.placement-card-body small { display: block; color: var(--text-dim); font-size: 11px; margin-top: 2px; }
.placement-price { flex: 0 0 auto; text-align: right; font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; }
.placement-price small { display: block; font-weight: 500; color: var(--text-dim); font-size: 10px; }
.placement-check {
    flex: 0 0 auto;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-input);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.placement-card:has(input:checked) .placement-check { background: var(--accent-grad); border-color: transparent; }
.placement-check svg { width: 10px; height: 10px; opacity: 0; transition: opacity .1s ease; color: #fff; }
.placement-card:has(input:checked) .placement-check svg { opacity: 1; }

.advertise-price {
    margin-top: 14px;
    font-size: 13.5px;
    color: var(--text);
    background: rgba(124, 140, 255, 0.08);
    border: 1px solid rgba(124, 140, 255, 0.18);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    font-weight: 500;
}
.advertise-price b { color: var(--accent-a); }

/* ---------------------------------------------------------- Buttons */

.advertise-primary-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--accent-grad);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: var(--shadow-pop);
    transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.advertise-primary-btn:hover { transform: translateY(-1px); box-shadow: 0 24px 60px -18px rgba(108, 123, 255, 0.5); }
.advertise-primary-btn:active { transform: translateY(0); }
.advertise-primary-btn:disabled { opacity: .55; cursor: default; transform: none; box-shadow: none; }

/* ---------------------------------------------------------- Summary sidebar */

.advertise-summary {
    position: sticky;
    top: 90px;
    background: var(--bg-card);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow-card);
}
.advertise-summary h3 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-dim);
    margin: 0 0 16px;
}
.advertise-summary-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 13.5px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-soft);
}
.advertise-summary-row:last-of-type { border-bottom: none; }
.advertise-summary-row span:first-child { color: var(--text-muted); }
.advertise-summary-row span:last-child { font-weight: 600; text-align: right; }
.advertise-summary-total {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.advertise-summary-total span { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.advertise-summary-total strong { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.advertise-summary-empty { color: var(--text-dim); font-size: 13px; line-height: 1.6; }

/* ---------------------------------------------------------- Gateway tabs */

.gateway-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
}
.gateway-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.gateway-tab:hover { color: var(--text); }
.gateway-tab.active {
    border-color: var(--accent-a);
    color: var(--text);
    background: rgba(124, 140, 255, 0.08);
}

/* ---------------------------------------------------------- Creative source tabs */

.creative-source-tabs {
    display: flex;
    gap: 8px;
    margin: 0 0 14px;
}
.creative-source-tab {
    flex: 1;
    padding: 9px 12px;
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 700;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.creative-source-tab:hover { color: var(--text); }
.creative-source-tab.active {
    border-color: var(--accent-a);
    color: var(--text);
    background: rgba(124, 140, 255, 0.08);
}
.advertise-form select#advSourceVideo {
    display: block;
    width: 100%;
    margin-top: 7px;
    padding: 11px 13px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
#advSourceVideoPreview .creative-preview { margin-top: 12px; max-height: 160px; object-fit: cover; }
#advTargetUrlLabel[hidden] { display: none; }

/* ---------------------------------------------------------- Empty / confirmation states */

.advertise-empty {
    text-align: center;
    padding: 70px 24px;
    max-width: 480px;
    margin: 0 auto;
}
.advertise-empty .empty-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-grad);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-pop);
}
.advertise-empty .empty-icon svg { width: 26px; height: 26px; }
.advertise-empty h1 { font-size: 22px; margin: 0 0 10px; font-weight: 800; letter-spacing: -.01em; }
.advertise-empty p { color: var(--text-muted); line-height: 1.6; margin: 0; }

.advertise-status-link {
    margin-top: 18px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.advertise-status-link a { color: var(--accent-a); word-break: break-all; font-size: 13px; text-decoration: none; }
.advertise-status-link a:hover { text-decoration: underline; }

.status-pill {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    background: var(--warn-bg);
    color: var(--warn);
}
.status-approved, .status-active { background: var(--success-bg); color: var(--success); }
.status-rejected, .status-revoked, .status-cancelled { background: var(--danger-bg); color: var(--danger); }

.creative-preview {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    display: block;
    border: 1px solid var(--border-soft);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}
.stats-grid > div {
    background: var(--bg-input);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}
.stats-grid span { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.stats-grid small { color: var(--text-muted); font-size: 12px; font-weight: 600; }

@media (max-width: 560px) {
    .advertise-main { padding: 28px 16px 70px; }
    .advertise-hero h1 { font-size: 26px; }
    .advertise-card { padding: 18px; }
}
