:root {
    --bg: #081018;
    --bg-2: #0e1824;
    --surface: #122033;
    --surface-2: #173049;
    --line: rgba(232, 196, 112, 0.16);
    --text: #eef3f8;
    --muted: #93a4b8;
    --gold: #e8c470;
    --gold-2: #f3d48a;
    --teal: #6ec8c0;
    --danger: #f07167;
    --ok: #7dce82;
    --warn: #f0b429;
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: "Sora", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(232, 196, 112, 0.08), transparent 28%),
        linear-gradient(180deg, var(--bg), #05090e 80%);
    color: var(--text);
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-2); }
code, .eyebrow, small, .pill, .badge {
    font-family: "IBM Plex Mono", monospace;
}

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-shell {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.auth-panel {
    padding: 48px;
    background:
        linear-gradient(160deg, rgba(110, 200, 192, 0.12), transparent 40%),
        #0b1622;
}
.auth-panel h1 { font-size: 40px; margin: 10px 0 16px; }
.auth-points { padding-left: 18px; color: var(--muted); line-height: 1.8; }
.auth-card { padding: 48px; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    padding: 24px 18px;
    background: rgba(8, 16, 24, 0.92);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.brand { display: flex; gap: 12px; align-items: center; color: var(--text); }
.brand-mark {
    width: 42px; height: 42px; display: grid; place-items: center;
    border-radius: 12px; background: var(--gold); color: #1b1406; font-weight: 700;
}
.brand small { display: block; color: var(--muted); font-size: 11px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
    color: var(--muted);
    padding: 12px 14px;
    border-radius: 12px;
}
.sidebar nav a.active, .sidebar nav a:hover {
    background: var(--surface);
    color: var(--text);
}
.sidebar-user { margin-top: auto; display: grid; gap: 6px; }
.workspace { padding: 28px 32px 48px; }
.topbar { display: flex; justify-content: space-between; align-items: end; margin-bottom: 24px; }
.topbar h1 { margin: 4px 0 0; font-size: 32px; }
.content { display: grid; gap: 20px; }

.eyebrow { color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-size: 11px; margin: 0; }
.muted { color: var(--muted); }
.panel, .stat-card, .ad-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; gap: 16px; align-items: start; margin-bottom: 16px; }
.panel-head h2, .panel-head p { margin: 0; }
.panel-head p { color: var(--muted); font-size: 14px; }

.stats-grid, .cards-grid, .split, .filters, .meta-grid, .row {
    display: grid;
    gap: 16px;
}
.stats-grid { grid-template-columns: repeat(4, 1fr); }
.split { grid-template-columns: 1.1fr 0.9fr; }
.cards-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.cards-grid.one-row {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
}
.cards-grid.one-row .ad-card {
    flex: 1 0 220px;
    min-width: 220px;
    max-width: 280px;
}
.filters { grid-template-columns: repeat(4, 1fr); }
.meta-grid { grid-template-columns: repeat(3, 1fr); }
.row { grid-template-columns: 1fr 1fr; }
.wide { grid-column: span 2; }
.tag-input-label { grid-column: 1 / -1; }
.filter-actions { grid-column: 1 / -1; display: flex; gap: 10px; }

.stat-card { padding: 20px; }
.stat-card span { color: var(--muted); display: block; margin-bottom: 8px; }
.stat-card strong { font-size: 34px; }
.stat-card.accent { background: linear-gradient(180deg, #1d2c22, var(--surface)); border-color: rgba(110, 200, 192, 0.3); }

label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input, select, textarea, button {
    font: inherit;
}
input, select, textarea {
    width: 100%;
    background: var(--bg-2);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
}
textarea { resize: vertical; }
.stack { display: grid; gap: 14px; }

.tag-input { display: grid; gap: 8px; }
.tag-input-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 8px 10px;
    background: var(--bg-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: text;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 999px;
    padding: 6px 8px 6px 12px;
    font-size: 13px;
}
.tag-chip button {
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: rgba(232, 196, 112, 0.16);
    color: var(--gold);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}
.tag-input-box input {
    flex: 1 1 160px;
    min-width: 140px;
    width: auto;
    border: 0;
    padding: 8px 6px;
    background: transparent;
}
.tag-input-box input:focus { outline: none; }
.tag-hint { color: var(--muted); font-size: 12px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
}
.btn-primary { background: var(--gold); color: #1b1406; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.alert { padding: 12px 14px; border-radius: 12px; }
.alert-error { background: rgba(240, 113, 103, 0.12); color: #ffc3be; }
.alert-success { background: rgba(125, 206, 130, 0.12); color: #c8f0cb; }
.alert-warn { background: rgba(240, 180, 41, 0.12); color: #ffe2a0; }

.rank-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.rank-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.rank-list small { display: block; color: var(--muted); }
.pill, .badge, .chip {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--text);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { color: var(--text); }
.ad-card { padding: 0; overflow: hidden; display: grid; gap: 0; }
.ad-card h3, .ad-card p { margin: 0; }
.ad-card-body { padding: 16px; display: grid; gap: 8px; }
.ad-preview, .detail-preview {
    position: relative;
    background: #0a121c;
    overflow: hidden;
}
.ad-preview {
    aspect-ratio: 4 / 5;
}
.detail-preview {
    aspect-ratio: 4 / 5;
    max-width: 420px;
    border-radius: 16px;
    border: 1px solid var(--line);
    margin: 8px 0 20px;
}
.ad-preview iframe, .ad-preview img, .ad-preview video,
.detail-preview iframe, .detail-preview img, .detail-preview video {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    object-fit: cover;
    background: #0a121c;
}
.ad-preview-empty {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 13px;
}
.card-actions { display: flex; gap: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line); }
.help-list { color: var(--muted); line-height: 1.7; }
.detail h3 { margin-bottom: 8px; }

.panel-head-title, .rank-item { display: flex; align-items: center; gap: 10px; }
.checkbox-label span {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    color: var(--text);
}
.checkbox-label input[type="checkbox"] {
    width: auto;
    accent-color: var(--gold);
}
.star-form { display: inline-flex; }
.star-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-2);
    color: var(--muted);
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
}
.star-btn.is-on,
.star-btn:hover {
    color: var(--gold);
    border-color: rgba(232, 196, 112, 0.45);
}
@media (max-width: 980px) {
    .auth-shell, .app-shell, .stats-grid, .split, .filters, .meta-grid { grid-template-columns: 1fr; }
    .wide, .filter-actions, .tag-input-label { grid-column: auto; }
    .workspace { padding: 20px; }
}
