:root {
    --bg: #0b1020;
    --bg2: #111827;
    --panel: rgba(17, 24, 39, .78);
    --panel2: rgba(30, 41, 59, .82);
    --text: #e5e7eb;
    --muted: #94a3b8;
    --line: rgba(148, 163, 184, .18);
    --accent: #f97316;
    --accent2: #fb923c;
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #facc15;
    --blue: #38bdf8;
    --shadow: 0 24px 80px rgba(0, 0, 0, .38);
    --radius: 24px;
    --sidebar: 270px;
}
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(249, 115, 22, .18), transparent 32rem),
        radial-gradient(circle at 80% 10%, rgba(56, 189, 248, .12), transparent 28rem),
        linear-gradient(135deg, #070b16 0%, #0f172a 42%, #111827 100%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 18px;
    border-right: 1px solid var(--line);
    background: rgba(2, 6, 23, .58);
    backdrop-filter: blur(22px);
}
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.logo-mark {
    width: 44px; height: 44px; border-radius: 15px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #f97316, #facc15);
    color: #111827; font-weight: 900;
    box-shadow: 0 14px 40px rgba(249, 115, 22, .25);
}
.logo-title { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.logo-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 13px;
    border-radius: 16px;
    color: var(--muted);
    transition: .16s ease;
}
.nav a:hover, .nav a.active {
    color: var(--text);
    background: rgba(148, 163, 184, .12);
}
.sidebar-card {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(15, 23, 42, .72);
}
.main { padding: 24px; min-width: 0; }
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    margin-bottom: 24px;
}
.kicker { color: var(--accent2); font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 48px); line-height: 1.02; letter-spacing: -.05em; }
.lead { margin: 10px 0 0; color: var(--muted); max-width: 760px; line-height: 1.55; }
.user-pill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(15, 23, 42, .56); color: var(--muted); }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(249, 115, 22, .16); color: var(--accent2); font-weight: 800; }
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
    position: relative;
    overflow: hidden;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(30,41,59,.76), rgba(15,23,42,.72));
    box-shadow: var(--shadow);
}
.card::before {
    content: "";
    position: absolute;
    inset: -1px;
    pointer-events: none;
    background: radial-gradient(circle at 80% 0%, rgba(249,115,22,.14), transparent 19rem);
}
.card > * { position: relative; }
.card-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; color: var(--muted); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .07em; }
.big-number { margin-top: 12px; font-size: clamp(30px, 5vw, 52px); line-height: 1; font-weight: 850; letter-spacing: -.05em; }
.delta { margin-top: 10px; color: var(--muted); line-height: 1.4; }
.delta strong { color: var(--text); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; }
.badge.red { color: #fecaca; border-color: rgba(239,68,68,.28); background: rgba(239,68,68,.09); }
.badge.green { color: #bbf7d0; border-color: rgba(34,197,94,.28); background: rgba(34,197,94,.09); }
.badge.orange { color: #fed7aa; border-color: rgba(249,115,22,.3); background: rgba(249,115,22,.1); }
.chart-wrap { min-height: 340px; }
.section-title { margin: 28px 0 14px; display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.section-title h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.section-title p { margin: 4px 0 0; color: var(--muted); }
.rank-list { display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: rgba(15, 23, 42, .55); border: 1px solid rgba(148,163,184,.12); }
.rank-num { color: var(--muted); font-weight: 800; }
.rank-name { font-weight: 750; }
.rank-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.table th { color: var(--muted); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.table tr:hover td { background: rgba(148,163,184,.06); }
.form-row { display: grid; gap: 8px; margin-bottom: 14px; }
label { color: var(--muted); font-weight: 700; font-size: 13px; }
input, select, textarea {
    width: 100%; padding: 12px 13px; border-radius: 15px;
    border: 1px solid rgba(148,163,184,.25);
    background: rgba(2,6,23,.42);
    color: var(--text);
    outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(249,115,22,.65); box-shadow: 0 0 0 4px rgba(249,115,22,.12); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 15px; padding: 12px 16px;
    background: linear-gradient(135deg, #f97316, #facc15);
    color: #111827; font-weight: 900; cursor: pointer;
    box-shadow: 0 16px 34px rgba(249,115,22,.18);
}
.btn.secondary { background: rgba(148,163,184,.12); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.btn.danger { background: rgba(239,68,68,.15); color: #fecaca; box-shadow: none; border: 1px solid rgba(239,68,68,.24); }
.inline-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flash { margin-bottom: 14px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(15,23,42,.76); }
.flash.error { border-color: rgba(239,68,68,.35); color: #fecaca; }
.flash.warn { border-color: rgba(250,204,21,.35); color: #fef3c7; }
.flash.success { border-color: rgba(34,197,94,.35); color: #bbf7d0; }
.hero {
    padding: 34px;
    border-radius: 32px;
    border: 1px solid var(--line);
    background: radial-gradient(circle at 0 0, rgba(249,115,22,.18), transparent 24rem), rgba(15,23,42,.72);
    box-shadow: var(--shadow);
    margin-bottom: 18px;
}
.hero-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; align-items: center; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.stat-mini { padding: 14px; border: 1px solid rgba(148,163,184,.14); background: rgba(2,6,23,.34); border-radius: 18px; }
.stat-mini div:first-child { color: var(--muted); font-size: 12px; }
.stat-mini div:last-child { margin-top: 7px; font-weight: 850; font-size: 20px; }
.locked {
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}
.lock-overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(2,6,23,.45); backdrop-filter: blur(2px); }
.auth-box { width: min(480px, 94vw); margin: 6vh auto; }
.auth-box .card { padding: 30px; }
.small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.source-note { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
@media (max-width: 1040px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; display: block; }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .grid-3, .grid-2, .hero-grid, .stat-strip { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .main { padding: 16px; }
    .hero { padding: 22px; }
    .topbar { align-items: flex-start; flex-direction: column; }
    .table { font-size: 14px; }
    .table th:nth-child(4), .table td:nth-child(4) { display: none; }
}
.compact-grid { gap: 12px; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 16px; color: var(--muted); line-height: 1.45; }
.check-row input { width: auto; margin-top: 3px; }
.profile-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.template-card { display: block; text-decoration: none; color: inherit; min-height: 150px; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.template-card:hover { transform: translateY(-2px); border-color: rgba(249,115,22,.34); }
.template-card.is-selected { border-color: rgba(249,115,22,.7); background: linear-gradient(180deg, rgba(249,115,22,.16), rgba(15,23,42,.78)); }
.template-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.badge.blue { color: #bfdbfe; border-color: rgba(59,130,246,.3); background: rgba(59,130,246,.1); }
.badge.pink { color: #fbcfe8; border-color: rgba(236,72,153,.3); background: rgba(236,72,153,.1); }
