:root {
    --bg: #070b14;
    --bg-2: #0c1220;
    --surface: rgba(16, 24, 40, 0.72);
    --surface-2: #121a2b;
    --line: rgba(212, 175, 112, 0.18);
    --line-soft: rgba(255, 255, 255, 0.08);
    --gold: #d4af70;
    --gold-2: #f3d9a4;
    --teal: #5eead4;
    --text: #eef3fb;
    --muted: #8b97ad;
    --danger: #f07178;
    --ok: #7dd3a0;
    --warn: #f0c674;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    --radius: 22px;
    --font: "Manrope", "Segoe UI", sans-serif;
    --display: "Syne", "Manrope", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 10% -10%, rgba(212, 175, 112, 0.16), transparent 50%),
        radial-gradient(900px 500px at 100% 0%, rgba(94, 234, 212, 0.08), transparent 45%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
    letter-spacing: 0.01em;
}
a { color: var(--gold-2); text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.topbar, .admin-top, .portal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
}
.brand-plate {
    background: #fff;
    border-radius: 14px;
    padding: 8px 12px;
    display: grid;
    place-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.brand-plate img { height: 42px; width: auto; display: block; }
.nav {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}
.nav a, .nav button.lang {
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
}
.nav a:hover, .nav a.is-active { color: var(--text); border-color: var(--line); background: rgba(212,175,112,.08); }
.btn, .btn-gold, .btn-ghost, .btn-danger, .btn-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 999px;
    padding: 12px 20px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 700;
    transition: .2s ease;
}
.btn-gold {
    background: linear-gradient(135deg, #f3d9a4, #d4af70 55%, #b98a45);
    color: #1a1408;
    box-shadow: 0 10px 30px rgba(212,175,112,.25);
}
.btn-gold:hover { transform: translateY(-1px); }
.btn-ghost { border-color: var(--line); color: var(--gold-2); background: transparent; }
.btn-danger { background: rgba(240,113,120,.12); color: var(--danger); border-color: rgba(240,113,120,.3); }
.btn-ok { background: rgba(125,211,160,.12); color: var(--ok); border-color: rgba(125,211,160,.28); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 48px;
    align-items: center;
    padding: 48px 0 80px;
    min-height: calc(100vh - 110px);
}
.kicker {
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: .22em;
    font-size: 12px;
    font-weight: 700;
}
h1, h2, .display {
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 8px 0 16px;
}
h1 { font-size: clamp(40px, 6vw, 72px); line-height: .95; }
.lead { font-size: 18px; color: var(--muted); max-width: 52ch; line-height: 1.7; }
.typed { color: var(--gold-2); display: inline-block; min-height: 1.2em; transition: opacity .2s; }
.typed.is-swap { opacity: 0; transform: translateY(6px); }
.hero-card, .glass, .card {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.hero-card { padding: 28px; }
.grid-3, .grid-2, .kpi-grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.feature, .kpi, .card { padding: 22px; }
.feature h3, .kpi h3 { margin: 0 0 8px; font-size: 18px; }
.kpi .num { font-family: var(--display); font-size: 36px; color: var(--gold-2); }
.muted { color: var(--muted); }
.page-hero {
    padding: 48px 0 24px;
}
.page-hero h1 { font-size: 42px; }
.footer {
    border-top: 1px solid var(--line-soft);
    margin-top: 60px;
    padding: 28px 0 48px;
    color: var(--muted);
    font-size: 14px;
}
.form-grid { display: grid; gap: 14px; }
label span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url], input[type=date], select, textarea {
    width: 100%;
    background: rgba(7,11,20,.65);
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    padding: 12px 14px;
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,175,112,.12); }
.flash, .alert {
    padding: 12px 16px;
    border-radius: 14px;
    margin: 12px 0;
}
.flash-success, .alert-ok { background: rgba(125,211,160,.12); color: var(--ok); }
.flash-error, .alert-error { background: rgba(240,113,120,.12); color: var(--danger); }
.dropzone {
    border: 1.5px dashed rgba(212,175,112,.45);
    border-radius: 18px;
    padding: 28px;
    text-align: center;
    cursor: pointer;
    background: rgba(212,175,112,.04);
    transition: .2s ease;
}
.dropzone.is-over, .dropzone.has-file { border-color: var(--gold); background: rgba(212,175,112,.1); }
.dropzone img { max-height: 120px; margin-top: 12px; border-radius: 12px; }
.dropzone input { display: none; }
.table-wrap { overflow: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
}
table.data th, table.data td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}
table.data th { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}
.badge-live { background: rgba(125,211,160,.15); color: var(--ok); }
.badge-paused { background: rgba(240,113,120,.12); color: var(--danger); }
.badge-scheduled { background: rgba(240,198,116,.12); color: var(--warn); }
.layout-admin, .layout-portal {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}
.sidebar {
    padding: 22px 16px;
    border-right: 1px solid var(--line-soft);
    background: rgba(8,12,22,.75);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 4px;
}
.sidebar a:hover, .sidebar a.is-active { background: rgba(212,175,112,.1); color: var(--text); }
.sidebar .group-label {
    color: var(--gold);
    font-size: 11px;
    letter-spacing: .16em;
    text-transform: uppercase;
    margin: 18px 12px 8px;
}
.content { padding: 28px 32px 60px; }
.banner-thumb {
    max-height: 80px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
}
.chart-box { height: 280px; }
.embed textarea { font-family: ui-monospace, monospace; font-size: 12px; min-height: 90px; }
.cookie-bar {
    position: fixed;
    left: 20px;
    right: 20px;
    bottom: 20px;
    z-index: 50;
    padding: 18px 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: space-between;
}
.legal-body { line-height: 1.8; color: #d5dcea; }
.legal-body a { text-decoration: underline; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.status-dot.live { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.status-dot.paused { background: var(--danger); }
.status-dot.scheduled { background: var(--warn); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.login-wrap { width: min(460px, calc(100% - 32px)); margin: 8vh auto 40px; padding: 32px; }
.preview-stage {
    background:
        linear-gradient(45deg, #101826 25%, transparent 25%) -8px 0 / 16px 16px,
        linear-gradient(-45deg, #101826 25%, transparent 25%) -8px 0 / 16px 16px,
        #0b1220;
    border-radius: 16px;
    padding: 18px;
    display: grid;
    place-items: center;
    min-height: 140px;
}
iframe.banner-frame { border: 0; background: transparent; max-width: 100%; }

.theme-toggle {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
}
.banner-showcase {
    display: grid;
    grid-template-columns: 180px 1fr 180px;
    gap: 22px;
    align-items: stretch;
    padding-bottom: 80px;
}
.banner-frame-wrap {
    border-radius: 18px;
    overflow: hidden;
    width: 160px;
    min-height: 600px;
    border: 1px solid var(--line-soft);
    background: var(--surface);
}
.banner-frame-wrap iframe {
    width: 160px;
    height: 600px;
    border: 0;
    display: block;
}
.placement-mock {
    border-radius: 22px;
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--line-soft);
}
.admin-gate {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
    background:
        radial-gradient(900px 500px at 8% 0%, rgba(212,175,112,.22), transparent 50%),
        radial-gradient(700px 420px at 100% 100%, rgba(94,234,212,.12), transparent 46%),
        linear-gradient(180deg, var(--bg), var(--bg-2));
}
.admin-gate-card {
    width: min(440px, 100%);
    padding: 36px 32px;
    position: relative;
    overflow: hidden;
}
.admin-gate-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.admin-gate .brand-plate { margin-bottom: 18px; }

html[data-theme="light"] {
    --bg: #f6f1e8;
    --bg-2: #fffdf8;
    --surface: rgba(255, 252, 247, 0.86);
    --surface-2: #ffffff;
    --line: rgba(176, 132, 58, 0.28);
    --line-soft: rgba(40, 28, 10, 0.08);
    --gold: #b8893a;
    --gold-2: #8a6424;
    --teal: #0f766e;
    --text: #1c1710;
    --muted: #6d6458;
    --shadow: 0 24px 60px rgba(80, 55, 20, 0.08);
}
html[data-theme="light"] body {
    background:
        radial-gradient(1100px 520px at 8% -10%, rgba(212, 175, 112, 0.22), transparent 52%),
        radial-gradient(800px 480px at 100% 0%, rgba(15, 118, 110, 0.08), transparent 46%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
}
html[data-theme="light"] input[type=text],
html[data-theme="light"] input[type=password],
html[data-theme="light"] input[type=email],
html[data-theme="light"] input[type=number],
html[data-theme="light"] input[type=url],
html[data-theme="light"] input[type=date],
html[data-theme="light"] select,
html[data-theme="light"] textarea {
    background: #fff;
    color: var(--text);
    border-color: rgba(40, 28, 10, 0.12);
}
html[data-theme="light"] .sidebar {
    background: rgba(255, 252, 247, 0.92);
}
html[data-theme="light"] .legal-body { color: #3b3328; }
html[data-theme="light"] .preview-stage {
    background:
        linear-gradient(45deg, #efe8dc 25%, transparent 25%) -8px 0 / 16px 16px,
        linear-gradient(-45deg, #efe8dc 25%, transparent 25%) -8px 0 / 16px 16px,
        #f7f1e6;
}
html[data-theme="light"] .btn-ghost { color: var(--gold-2); }

@media (max-width: 980px) {
    .hero, .grid-3, .kpi-grid, .layout-admin, .layout-portal, .grid-2, .banner-showcase {
        grid-template-columns: 1fr;
    }
    .sidebar { position: relative; height: auto; }
    h1 { font-size: 40px; }
    .banner-frame-wrap { min-height: 420px; }
}
