:root {
    --bg: #070b16;
    --panel: rgba(15, 23, 42, .78);
    --panel-solid: #101827;
    --line: rgba(148, 163, 184, .16);
    --text: #e5edf8;
    --muted: #8fa0b7;
    --red: #ff3158;
    --red-2: #b80f31;
    --blue: #14213d;
    --green: #2ee59d;
    --yellow: #f7c948;
    --danger: #fb7185;
    --shadow: 0 24px 80px rgba(0, 0, 0, .35);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 49, 88, .14), transparent 34rem),
        radial-gradient(circle at 85% 10%, rgba(59, 130, 246, .11), transparent 32rem),
        linear-gradient(135deg, #050711, #0b1224 45%, #050711);
    min-height: 100vh;
}

a { color: #ff6f8c; text-decoration: none; }
a:hover { color: white; }
button, input, select, textarea { font: inherit; }

.shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
    padding: 24px;
    border-right: 1px solid var(--line);
    background: rgba(5, 9, 20, .72);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 30px; color: var(--text); }
.brand-mark, .login-logo {
    width: 44px; height: 44px; border-radius: 16px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--red), #7c1027 55%, #101827);
    box-shadow: 0 16px 40px rgba(255, 49, 88, .28);
    font-weight: 900;
}
.brand small, .admin-pill small, table small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 8px; }
.nav a {
    color: var(--muted); padding: 12px 14px; border-radius: 14px;
    border: 1px solid transparent; transition: .18s ease;
}
.nav a:hover, .nav a.active {
    color: white; background: rgba(255, 49, 88, .12); border-color: rgba(255, 49, 88, .18);
}
.sidebar-card {
    position: absolute; left: 24px; right: 24px; bottom: 24px;
    display: flex; gap: 10px; padding: 14px; border-radius: 18px;
    background: rgba(15, 23, 42, .8); border: 1px solid var(--line);
}
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); margin-top: 5px; box-shadow: 0 0 16px var(--green); }

.main { min-width: 0; padding: 26px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.eyebrow { color: #ff8aa2; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; font-weight: 800; margin: 0 0 7px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 42px); }
h2 { font-size: clamp(26px, 3vw, 38px); margin-bottom: 8px; }
h3 { margin-bottom: 6px; font-size: 22px; }
.muted { color: var(--muted); line-height: 1.6; }
.admin-pill { display: flex; align-items: center; gap: 12px; background: rgba(15, 23, 42, .62); border: 1px solid var(--line); padding: 10px 12px; border-radius: 20px; }
.logout { padding-left: 12px; border-left: 1px solid var(--line); font-size: 14px; }
.avatar { width: 38px; height: 38px; border-radius: 14px; display: inline-grid; place-items: center; background: linear-gradient(135deg, #17223a, #101827); border: 1px solid rgba(255,255,255,.08); font-weight: 900; }
.avatar.small { width: 34px; height: 34px; border-radius: 12px; font-size: 12px; }
.avatar.large { width: 70px; height: 70px; border-radius: 24px; font-size: 24px; }

.content { display: grid; gap: 22px; }
.hero-card, .panel, .stat-card {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}
.hero-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px; border-radius: 28px; overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; inset: auto -40px -80px auto; width: 220px; height: 220px; border-radius: 999px; background: rgba(255,49,88,.18); filter: blur(20px); }
.panel { padding: 22px; border-radius: 24px; min-width: 0; }
.panel.narrow { max-width: 760px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-header.wide { align-items: flex-end; }
.stats-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.stats-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { padding: 18px; border-radius: 22px; }
.stat-card span { color: var(--muted); font-size: 13px; }
.stat-card strong { display: block; font-size: 34px; margin: 8px 0 4px; }
.stat-card small { color: var(--muted); }
.stat-card.premium { background: linear-gradient(135deg, rgba(255,49,88,.22), rgba(15,23,42,.84)); border-color: rgba(255,49,88,.28); }
.stat-card.revenue { background: linear-gradient(135deg, rgba(46,229,157,.16), rgba(15,23,42,.84)); border-color: rgba(46,229,157,.24); }
.two-col { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 22px; align-items: start; }
.two-col.reverse { grid-template-columns: minmax(0, 1fr) 380px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 12px 10px; }
td { padding: 14px 10px; border-top: 1px solid var(--line); vertical-align: middle; }
.user-cell { display: flex; align-items: center; gap: 11px; }
code { background: rgba(148, 163, 184, .12); border: 1px solid var(--line); padding: 4px 7px; border-radius: 9px; color: #dbeafe; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.badge-premium { color: #ffd9e2; background: rgba(255,49,88,.18); border: 1px solid rgba(255,49,88,.30); }
.badge-free { color: #cbd5e1; background: rgba(148,163,184,.11); border: 1px solid rgba(148,163,184,.16); }
.badge-danger { color: #ffe4e6; background: rgba(251,113,133,.16); border: 1px solid rgba(251,113,133,.30); }

.primary-button, .secondary-button, .ghost-button {
    border: 0; border-radius: 14px; color: white; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; font-weight: 800;
}
.primary-button { background: linear-gradient(135deg, var(--red), var(--red-2)); box-shadow: 0 16px 30px rgba(255, 49, 88, .2); }
.secondary-button { background: rgba(148, 163, 184, .12); border: 1px solid var(--line); color: var(--text); }
.ghost-button { background: transparent; border: 1px solid var(--line); color: var(--text); }
.compact { min-height: 36px; padding: 0 12px; font-size: 14px; }
.menu-button { display: none; }
.text-button { border: 0; background: transparent; color: #ff8aa2; cursor: pointer; padding: 0; }
.text-button.danger { color: var(--danger); }

form label { display: grid; gap: 8px; color: #d7e2f3; font-weight: 700; }
input, select, textarea {
    width: 100%; background: rgba(2, 6, 23, .58); border: 1px solid var(--line); color: var(--text); border-radius: 14px; padding: 12px 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(255,49,88,.6); box-shadow: 0 0 0 4px rgba(255,49,88,.08); }
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
.form-stack { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 10px; align-items: center; }
.filters input { width: 280px; }

.flash { margin-bottom: 16px; border-radius: 16px; padding: 13px 15px; border: 1px solid var(--line); background: rgba(15,23,42,.8); }
.flash.success { border-color: rgba(46,229,157,.28); color: #a7f3d0; }
.flash.error { border-color: rgba(251,113,133,.3); color: #fecdd3; }

.note-list { display: grid; gap: 12px; }
.note-list.large { gap: 16px; }
.note-item { border: 1px solid var(--line); background: rgba(2,6,23,.24); border-radius: 18px; padding: 16px; }
.note-item h4 { margin: 12px 0 7px; }
.note-item p { color: var(--muted); line-height: 1.6; }
.note-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sticky-panel { position: sticky; top: 24px; }

.breakdown { display: grid; gap: 16px; }
.break-row > div:first-child { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.bar { height: 10px; border-radius: 999px; background: rgba(148,163,184,.12); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--red), #ff9db0); border-radius: inherit; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; color: var(--muted); }
.pagination div { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination a { min-width: 34px; min-height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); }
.pagination a.active { background: rgba(255,49,88,.15); color: white; border-color: rgba(255,49,88,.3); }
.profile-head, .settings-card { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.column-list { display: grid; gap: 10px; }
.column-list div { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border-radius: 14px; background: rgba(2,6,23,.28); border: 1px solid var(--line); }
.back-row { margin-bottom: -8px; }
.center-panel { text-align: center; }

.login-body { display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(460px, 100%); }
.login-card { padding: 34px; border-radius: 30px; border: 1px solid var(--line); background: rgba(15, 23, 42, .84); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.login-logo { width: 58px; height: 58px; border-radius: 20px; margin-bottom: 22px; }

@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .two-col, .two-col.reverse { grid-template-columns: 1fr; }
    .sticky-panel { position: static; }
}

@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 30; transform: translateX(-105%); transition: .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .main { padding: 18px; }
    .topbar { align-items: flex-start; }
    .menu-button { display: inline-flex; }
    .admin-pill { flex-wrap: wrap; justify-content: flex-end; }
    .hero-card, .panel-header.wide { flex-direction: column; align-items: flex-start; }
    .stats-grid, .stats-grid.three { grid-template-columns: 1fr 1fr; }
    .filters { width: 100%; flex-direction: column; align-items: stretch; }
    .filters input { width: 100%; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .stats-grid, .stats-grid.three { grid-template-columns: 1fr; }
    .topbar { flex-direction: column; }
    .admin-pill { width: 100%; justify-content: space-between; }
}
