:root {
    --bg: #0a0c12;
    --bg-grad-1: #0c0f17;
    --bg-grad-2: #0a0c12;
    --panel: #12151f;
    --panel-2: #161a26;
    --panel-hover: #1b2030;
    --border: #232838;
    --border-soft: #1c2130;
    --text: #e8ebf2;
    --muted: #8b93a7;
    --muted-2: #6a7185;
    --accent: #6366f1;
    --accent-2: #8b5cf6;
    --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, .14);
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, .14);
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, .14);
    --blue: #38bdf8;
    --blue-soft: rgba(56, 189, 248, .14);
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
    --radius: 16px;
    --radius-sm: 11px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: radial-gradient(1200px 600px at 80% -10%, #141a2e 0%, transparent 55%),
                linear-gradient(180deg, var(--bg-grad-1), var(--bg-grad-2));
    background-attachment: fixed;
    color: var(--text);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }
code { color: #c4b5fd; background: rgba(139, 92, 246, .1); padding: 1px 6px; border-radius: 6px; font-size: .85em; }

/* ===== Layout ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #11141e 0%, #0d1016 100%);
    border-right: 1px solid var(--border-soft);
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 800; font-size: 1.15rem; color: #fff;
    padding: 8px 10px 18px;
    letter-spacing: .2px;
}
.brand .logo {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--accent-grad);
    display: grid; place-items: center; font-size: 18px;
    box-shadow: 0 6px 18px -6px rgba(99, 102, 241, .7);
}
.brand small { display:block; font-weight: 500; font-size: .68rem; color: var(--muted-2); letter-spacing: .5px; }

.nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); padding: 14px 12px 6px; }

.nav-link {
    display: flex; align-items: center; gap: 12px;
    color: var(--muted); padding: 10px 12px; border-radius: 11px;
    margin: 2px 0; font-weight: 500; transition: all .15s ease;
    position: relative;
}
.nav-link .ico { width: 20px; text-align: center; font-size: 16px; opacity: .9; }
.nav-link:hover { background: var(--panel-hover); color: var(--text); }
.nav-link.active { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(99,102,241,.8); }
.nav-link.active .ico { opacity: 1; }

.sidebar-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }

/* ===== Main ===== */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 28px; border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0; z-index: 20;
    background: rgba(10, 12, 18, .72); backdrop-filter: blur(12px);
}
.topbar h1 { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: -.3px; }
.topbar .sub { color: var(--muted); font-size: .8rem; margin-top: 2px; }

.chip {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--panel-2); border: 1px solid var(--border);
    padding: 7px 13px; border-radius: 999px; font-size: .8rem; color: var(--muted);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.content { padding: 26px 28px 48px; }

/* ===== Cards ===== */
.card {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border-soft); display:flex; align-items:center; justify-content: space-between; }
.card-head h3 { margin: 0; font-size: 1rem; font-weight: 650; }

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: 1fr; } }

.stat-card {
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 18px; transition: transform .18s ease, border-color .18s ease;
    position: relative; overflow: hidden;
}
.stat-card:hover { transform: translateY(-3px); border-color: #2c3346; }
.stat-card .ico {
    width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
    font-size: 20px; margin-bottom: 14px;
}
.ico.i-indigo { background: rgba(99,102,241,.16); }
.ico.i-green { background: var(--green-soft); }
.ico.i-amber { background: var(--amber-soft); }
.ico.i-blue { background: var(--blue-soft); }
.ico.i-red { background: var(--red-soft); }
.ico.i-violet { background: rgba(139,92,246,.16); }

.stat-card .label { color: var(--muted); font-size: .82rem; }
.stat-card .value { font-size: 1.85rem; font-weight: 750; letter-spacing: -.5px; margin: 2px 0; }
.stat-card .value .unit { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat-card .delta { font-size: .76rem; color: var(--muted-2); }
.stat-card .delta.up { color: var(--green); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .875rem; }
table.tbl thead th {
    text-align: left; padding: 13px 18px; color: var(--muted-2);
    font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .6px;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--panel-2);
}
table.tbl tbody td { padding: 14px 18px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
table.tbl tbody tr { transition: background .12s ease; }
table.tbl tbody tr:hover { background: rgba(255,255,255,.025); }
table.tbl tbody tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--muted-2); padding: 40px 0; }

/* ===== Badges ===== */
.badge2 { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 600; }
.b-green { background: var(--green-soft); color: #4ade80; }
.b-red { background: var(--red-soft); color: #f87171; }
.b-amber { background: var(--amber-soft); color: #fbbf24; }
.b-blue { background: var(--blue-soft); color: #7dd3fc; }
.b-gray { background: rgba(255,255,255,.06); color: var(--muted); }
.b-violet { background: rgba(139,92,246,.16); color: #c4b5fd; }

/* ===== Buttons ===== */
.btn2 { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: .85rem; border: 1px solid transparent; cursor: pointer; transition: all .15s ease; white-space: nowrap; }
.btn-primary2 { background: var(--accent-grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(99,102,241,.8); }
.btn-primary2:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--panel-hover); border-color: #2c3346; }
.btn-success2 { background: var(--green); color: #06210f; }
.btn-success2:hover { filter: brightness(1.08); }
.btn-danger2 { background: transparent; color: #f87171; border-color: rgba(239,68,68,.4); }
.btn-danger2:hover { background: var(--red-soft); }
.btn-sm2 { padding: 6px 12px; font-size: .78rem; }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .78rem; color: var(--muted); font-weight: 500; }
.inp, .sel {
    background: #0c0f17; border: 1px solid var(--border); color: var(--text);
    padding: 10px 13px; border-radius: 10px; font-size: .88rem; width: 100%; transition: border-color .15s, box-shadow .15s;
    font-family: inherit;
}
.inp:focus, .sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.inp::placeholder { color: var(--muted-2); }
.input-group2 { display: flex; align-items: stretch; }
.input-group2 .prefix { display: grid; place-items: center; padding: 0 12px; background: #0c0f17; border: 1px solid var(--border); border-right: none; border-radius: 10px 0 0 10px; color: var(--muted); font-weight: 600; }
.input-group2 .inp { border-radius: 0 10px 10px 0; }

.form-grid { display: grid; gap: 14px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--accent); }

.hint { color: var(--muted-2); font-size: .78rem; }

/* utils */
.row-flex { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.mt-3 { margin-top: 18px; } .mt-4 { margin-top: 24px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2-lg { display: grid; grid-template-columns: 5fr 7fr; gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
@media (max-width: 900px) { .grid-2, .grid-2-lg, .grid-4 { grid-template-columns: 1fr; } }
.text-green { color: #4ade80; } .text-red { color: #f87171; } .muted { color: var(--muted); } .small { font-size: .8rem; }
.kv { width: 100%; border-collapse: collapse; }
.kv td { padding: 9px 0; border-bottom: 1px solid var(--border-soft); font-size: .86rem; }
.kv td:first-child { color: var(--muted); width: 42%; }
.kv tr:last-child td { border-bottom: none; }

/* mobile sidebar */
.menu-toggle { display: none; }
@media (max-width: 860px) {
    .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .25s ease; z-index: 60; box-shadow: 0 0 60px rgba(0,0,0,.6); }
    #nav-toggle:checked ~ .layout .sidebar { transform: translateX(0); }
    .menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); cursor: pointer; }
    .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55; }
    #nav-toggle:checked ~ .layout .overlay { display: block; }
}
