:root {
  color-scheme: dark;
  --bg: #070b16;
  --surface: #0d1324;
  --surface-2: #121a2e;
  --surface-3: #18223a;
  --border: rgba(155, 174, 217, 0.14);
  --border-strong: rgba(155, 174, 217, 0.24);
  --text: #f6f8ff;
  --text-soft: #a9b4d1;
  --muted: #7e8baa;
  --primary: #6d7cff;
  --primary-strong: #8793ff;
  --accent: #e1b85b;
  --success: #55d6a7;
  --warning: #f3c96b;
  --danger: #ff7285;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --radius: 18px;
  --radius-small: 12px;
  --sidebar: 252px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.network-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:20px 0; }
.network-panel, .ad-placement { min-width:0; border:1px solid var(--border-strong); border-radius:16px; background:var(--surface-2); padding:20px; }
.network-panel legend, .ad-placement legend { color:var(--accent); font-weight:750; padding:0 8px; }
.network-panel .field { display:grid; gap:8px; margin:14px 0; }
.network-panel input, #monetization input, #monetization select, #sponsors input, #sponsors select, #profit input, #profit select { min-width:0; max-width:100%; background:var(--surface); color:var(--text); border:1px solid var(--border-strong); border-radius:10px; padding:11px; }
#monetization input[type=checkbox], #sponsors input[type=checkbox] { width:22px; height:22px; accent-color:var(--primary); }
.network-panel a { font-size:13px; color:var(--primary-strong); }
.network-panel .button, #sponsorForm .button { margin:5px 6px 5px 0; }
.monetization-actions { display:flex; flex-wrap:wrap; gap:10px; margin:20px 0; }
.creative-preview { margin:15px 0; border-radius:12px; overflow:hidden; background:var(--surface); }
.creative-preview img, .creative-preview video { display:block; width:100%; max-height:240px; object-fit:contain; }
#adDiagnostics, #profitReport { display:grid; gap:16px; margin:24px 0; }
#monetization .muted, #sponsors .muted, #profit .muted { line-height:1.65; overflow-wrap:anywhere; }
#monetization .form-grid, #sponsors .form-grid, #profit .form-grid { margin-bottom:16px; }
@media(max-width:820px) { .network-grid { grid-template-columns:1fr; } .network-panel, .ad-placement { padding:16px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--bg); }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at top right, rgba(109,124,255,.09), transparent 34rem), var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled, textarea:disabled { cursor: not-allowed; opacity: .58; }
a { color: inherit; }
.hidden { display: none !important; }

.boot-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 18px; color: var(--text-soft); }
.boot-screen strong, .boot-screen span { display: block; }
.boot-screen strong { color: var(--text); margin-bottom: 4px; }
.brand-mark { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-weight: 850; letter-spacing: -.04em; background: linear-gradient(145deg, var(--primary-strong), #4857da); box-shadow: 0 12px 34px rgba(109,124,255,.26); color: white; }
.brand-mark-small { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.brand-lockup h1 { margin: 2px 0 0; font-size: 24px; }
.eyebrow { margin: 0; color: var(--primary-strong); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 480px); background: linear-gradient(180deg, rgba(18,26,46,.96), rgba(13,19,36,.96)); border: 1px solid var(--border-strong); border-radius: 24px; padding: 32px; box-shadow: var(--shadow); }
.auth-copy { margin: 28px 0 22px; color: var(--text-soft); line-height: 1.65; }
.security-note { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 18px 0 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 22px 18px; border-right: 1px solid var(--border); background: rgba(9,14,28,.92); backdrop-filter: blur(18px); display: flex; flex-direction: column; z-index: 20; }
.sidebar-brand { padding: 0 8px 24px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.side-nav { display: grid; gap: 6px; }
.nav-link { text-decoration: none; color: var(--text-soft); padding: 11px 13px; border-radius: 10px; font-size: 14px; font-weight: 650; transition: .18s ease; }
.nav-link:hover, .nav-link.active { color: var(--text); background: var(--surface-2); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 18px 8px 2px; color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(85,214,167,.08); }

.content-shell { margin-left: var(--sidebar); padding: 0 32px 48px; max-width: 1600px; }
.topbar { min-height: 92px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(180deg, rgba(7,11,22,.97) 72%, rgba(7,11,22,0)); padding-bottom: 16px; }
.topbar h1 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.03em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-identity { min-width: 0; max-width: 240px; padding: 0 10px; text-align: right; }
.admin-identity span, .admin-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity span { font-size: 13px; font-weight: 700; }
.admin-identity small { color: var(--muted); margin-top: 2px; }

.section-block { scroll-margin-top: 100px; margin-top: 30px; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-end; margin-bottom: 16px; }
.section-heading h2 { font-size: 21px; margin: 4px 0 0; letter-spacing: -.02em; }
.muted { color: var(--muted); font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.metric-card { border: 1px solid var(--border); background: linear-gradient(180deg, var(--surface-2), var(--surface)); border-radius: var(--radius); padding: 20px; min-height: 132px; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.metric-card span, .metric-card small { display: block; color: var(--muted); }
.metric-card span { font-size: 12px; font-weight: 700; }
.metric-card strong { display: block; margin: 13px 0 8px; font-size: 31px; letter-spacing: -.04em; }
.metric-card small { font-size: 11px; }
.metric-card-emphasis { border-color: rgba(225,184,91,.25); background: linear-gradient(180deg, rgba(225,184,91,.08), var(--surface)); }
.metric-card-emphasis strong { color: #ffe2a0; }

.table-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); background: rgba(255,255,255,.012); font-size: 10px; letter-spacing: .09em; text-transform: uppercase; font-weight: 800; }
td { color: var(--text-soft); font-size: 13px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.align-right { text-align: right; }
.user-cell strong, .user-cell small { display: block; }
.user-cell strong { color: var(--text); font-size: 13px; }
.user-cell small { color: var(--muted); margin-top: 2px; }
.amount { color: var(--text); font-weight: 800; font-variant-numeric: tabular-nums; }
.action-row { display: flex; justify-content: flex-end; gap: 7px; }
.empty-state { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

.subsection-heading { display: flex; justify-content: space-between; margin: 26px 0 12px; }
.subsection-heading h3 { margin: 0; font-size: 16px; }
.subsection-heading p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }

.button { border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; color: var(--text); background: transparent; font-weight: 750; font-size: 12px; transition: transform .14s ease, border-color .14s ease, background .14s ease; }
.button:not(:disabled):hover { transform: translateY(-1px); }
.button-primary { background: var(--primary); border-color: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-strong); }
.button-accent { background: var(--accent); border-color: var(--accent); color: #1d170a; }
.button-secondary { background: var(--surface-2); border-color: var(--border-strong); }
.button-ghost { border-color: var(--border); color: var(--text-soft); }
.button-danger { border-color: rgba(255,114,133,.35); color: #ff9baa; background: rgba(255,114,133,.06); }
.button-safe { border-color: rgba(85,214,167,.35); color: #8fe8c7; background: rgba(85,214,167,.06); }
.button-small { padding: 7px 10px; font-size: 11px; }
.button-wide { width: 100%; min-height: 44px; }

.pill, .type-badge { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; padding: 5px 9px; color: var(--text-soft); font-size: 10px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.pill-warning { border-color: rgba(243,201,107,.3); color: var(--warning); }
.pill-safe { border-color: rgba(85,214,167,.3); color: var(--success); }
.status-paid { color: var(--success); }
.status-rejected { color: var(--danger); }
.type-normal { border-color: rgba(109,124,255,.32); color: #aab2ff; }
.type-biggest { border-color: rgba(225,184,91,.34); color: #f4d183; }

.tournament-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-card { border: 1px solid var(--border); border-radius: var(--radius); background: linear-gradient(180deg, var(--surface-2), var(--surface)); padding: 20px; display: grid; gap: 15px; }
.form-card-featured { border-color: rgba(225,184,91,.25); }

.form-card-heading { margin-bottom: 2px; }
.form-card-heading h3 { display: inline; margin: 0 0 0 9px; font-size: 17px; vertical-align: middle; }
.form-card-heading p { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 10px 0 0; }
label { display: grid; gap: 7px; color: var(--text-soft); font-size: 12px; font-weight: 650; }
label small { color: var(--muted); font-weight: 450; line-height: 1.45; }
input, textarea { width: 100%; color: var(--text); background: rgba(5,9,20,.74); border: 1px solid var(--border-strong); border-radius: 10px; outline: 0; padding: 11px 12px; transition: border-color .15s ease, box-shadow .15s ease; }
textarea { resize: vertical; min-height: 100px; }
#launchOperations input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--primary); }
input:focus, textarea:focus { border-color: rgba(109,124,255,.72); box-shadow: 0 0 0 3px rgba(109,124,255,.10); }
.switch-row { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }
.switch-control { width: 34px; height: 20px; border-radius: 999px; background: #2b354e; position: relative; transition: .2s ease; }
.switch-control::after { content: ""; width: 14px; height: 14px; border-radius: 50%; position: absolute; top: 3px; left: 3px; background: white; transition: .2s ease; }
.switch-row input:checked + .switch-control { background: var(--primary); }
.switch-row input:checked + .switch-control::after { transform: translateX(14px); }

.compact-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.tournament-card { border: 1px solid var(--border); background: var(--surface); border-radius: 14px; padding: 15px; }
.tournament-card-featured { border-color: rgba(225,184,91,.23); }
.tournament-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tournament-card h4 { margin: 12px 0 5px; font-size: 20px; }
.tournament-card p { margin: 0; color: var(--muted); font-size: 11px; }
.tournament-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tournament-card-stats div { background: rgba(255,255,255,.02); border-radius: 9px; padding: 9px; }
.tournament-card-stats span, .tournament-card-stats strong { display: block; }
.tournament-card-stats span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.tournament-card-stats strong { margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.tournament-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; }

.notification-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 20px; display: grid; grid-template-columns: minmax(260px,.8fr) minmax(320px,1.2fr); gap: 26px; }
.notification-preview { align-self: start; padding: 17px; border: 1px solid var(--border-strong); background: linear-gradient(145deg, #171f35, #101729); border-radius: 16px; display: flex; gap: 12px; box-shadow: 0 12px 35px rgba(0,0,0,.18); }
.notification-app-icon { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; background: var(--primary); color: white; border-radius: 11px; font-size: 11px; font-weight: 850; }
.notification-preview strong { font-size: 13px; }
.notification-preview p { color: var(--text-soft); margin: 5px 0 0; font-size: 12px; line-height: 1.4; }
.notification-fields { display: grid; gap: 14px; }
.phase-note { color: var(--muted); line-height: 1.55; }

.notice { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 11px; padding: 11px 13px; color: var(--text-soft); font-size: 12px; line-height: 1.5; margin: 10px 0; }
.notice-error { border-color: rgba(255,114,133,.35); background: rgba(255,114,133,.07); color: #ffb2bd; }
.notice-warning { border-color: rgba(243,201,107,.3); background: rgba(243,201,107,.07); color: #f6d98f; }
.notice-success { border-color: rgba(85,214,167,.3); background: rgba(85,214,167,.07); color: #9be9cc; }

.confirm-dialog { width: min(92vw, 460px); border: 1px solid var(--border-strong); border-radius: 18px; padding: 0; color: var(--text); background: var(--surface-2); box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgba(2,5,12,.76); backdrop-filter: blur(3px); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin: 5px 0 10px; font-size: 20px; }
.confirm-dialog p:not(.eyebrow) { color: var(--text-soft); line-height: 1.55; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.footer { padding: 40px 0 8px; text-align: center; color: var(--muted); font-size: 10px; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .compact-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 820px) {
  :root { --sidebar: 0px; }
  .sidebar { display: none; }
  .content-shell { margin-left: 0; padding: 0 18px 38px; }
  .topbar { align-items: flex-start; padding-top: 17px; }
  .admin-identity { display: none; }
  .tournament-form-grid, .notification-card { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .metric-grid, .compact-grid { grid-template-columns: 1fr; }
  .topbar { position: static; flex-direction: column; min-height: auto; padding: 20px 0 8px; }
  .topbar-actions { width: 100%; flex-wrap: wrap; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .auth-card { padding: 24px; }
}
