:root {
    --bg: #0b1220;
    --panel: #121a27;
    --panel-soft: #182233;
    --panel-strong: #0f1724;
    --line: #253247;
    --text: #eef4fb;
    --muted: #91a2ba;
    --accent: #4ea1ff;
    --danger: #ff6b6b;
    --success: #36c690;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: "Segoe UI", "DejaVu Sans", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(78, 161, 255, 0.18), transparent 28%),
        radial-gradient(circle at bottom right, rgba(54, 198, 144, 0.12), transparent 24%),
        linear-gradient(180deg, #08101b 0%, #0b1220 100%);
}
a { color: inherit; text-decoration: none; }
.shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    border-right: 1px solid var(--line);
    background: rgba(7, 12, 20, 0.82);
    backdrop-filter: blur(14px);
    display: flex;
    flex-direction: column;
    padding: 24px 18px;
}
.brand {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 24px;
}
.brand-logo-shell {
    width: 100%;
    min-width: 0;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0 0;
}
.brand-logo {
    display: block;
    width: 100%;
    max-width: 160px;
    max-height: 72px;
    object-fit: contain;
}
.brand-copy { min-width: 0; text-align: center; }
.brand-title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.brand-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.35; }
.nav { display: flex; flex-direction: column; gap: 8px; }
.nav-link {
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--muted);
}
.nav-link:hover, .nav-link.is-active {
    background: var(--panel-soft);
    border-color: var(--line);
    color: var(--text);
}
.sidebar-foot {
    margin-top: auto;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(18, 26, 39, 0.78);
}
.foot-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.foot-value { margin-top: 8px; font-size: 28px; font-weight: 800; }
.ghost-link { display: inline-block; margin-top: 14px; color: var(--accent); }
.content { padding: 30px; }
.topbar {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px;
}
.topbar > div:first-of-type {
    min-width: 0;
    flex: 1 1 auto;
}
h1 { margin: 0 0 8px; font-size: 34px; line-height: 1.1; }
.muted { color: var(--muted); }
.topbar-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.grid { display: grid; gap: 18px; }
.grid.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: 1.2fr 0.8fr; }
.card {
    background: rgba(18, 26, 39, 0.84);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.18);
}
.card h2, .card h3 { margin: 0 0 10px; }
.card-head {
    display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px;
}
.stat-kicker { color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.stat-value { margin-top: 10px; font-size: 38px; font-weight: 800; }
.stat-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.badge {
    display: inline-flex; align-items: center; justify-content: center; padding: 6px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 700; border: 1px solid transparent;
}
.badge-accent { background: rgba(78, 161, 255, 0.14); color: #b9dbff; border-color: rgba(78, 161, 255, 0.3); }
.badge-success { background: rgba(54, 198, 144, 0.14); color: #9be6ca; border-color: rgba(54, 198, 144, 0.3); }
.badge-danger { background: rgba(255, 107, 107, 0.14); color: #ffc0c0; border-color: rgba(255, 107, 107, 0.28); }
.badge-muted { background: rgba(145, 162, 186, 0.12); color: #d1d9e5; border-color: rgba(145, 162, 186, 0.24); }
.filters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.filters.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.filters .actions {
    align-self: end;
}
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.field input, .field select {
    width: 100%; background: var(--panel-strong); color: var(--text); border: 1px solid var(--line);
    border-radius: 14px; padding: 12px 14px; outline: none;
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.actions { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.btn {
    background: var(--accent); color: #05111e; border: none; border-radius: 14px;
    padding: 12px 16px; font-weight: 700; cursor: pointer;
}
.btn.secondary { background: var(--panel-soft); color: var(--text); border: 1px solid var(--line); }
.btn.block { width: 100%; }
table { width: 100%; border-collapse: collapse; }
thead th {
    color: var(--muted); font-weight: 600; text-align: left; font-size: 12px; letter-spacing: 0.06em;
    text-transform: uppercase; padding: 12px 10px; border-bottom: 1px solid var(--line);
}
tbody td { padding: 14px 10px; border-bottom: 1px solid rgba(37, 50, 71, 0.58); vertical-align: top; }
tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-note {
    display: none;
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 12px;
}
.mini-list { display: flex; flex-direction: column; gap: 12px; }
.mini-item {
    border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: rgba(255, 255, 255, 0.02);
}
.mini-title { font-weight: 700; margin-bottom: 4px; }
.split { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.menu-toggle { display: none; }
.sidebar-overlay { display: none; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
    width: min(460px, 100%); background: rgba(18, 26, 39, 0.92); border: 1px solid var(--line);
    border-radius: 26px; padding: 28px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}
.login-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 18px;
}
.login-logo {
    display: block;
    max-width: min(240px, 72%);
    max-height: 88px;
    object-fit: contain;
}
.login-card > .badge {
    display: flex;
    width: max-content;
    margin: 0 auto 12px;
}
.login-title { font-size: 34px; font-weight: 800; margin: 0 0 6px; }
.login-note { color: var(--muted); margin-bottom: 18px; }
.alert {
    margin-bottom: 14px; border-radius: 14px; padding: 12px 14px; border: 1px solid rgba(255, 107, 107, 0.3);
    background: rgba(255, 107, 107, 0.08); color: #ffd7d7;
}
@media (max-width: 1180px) {
    .grid.stats, .grid.two, .filters, .filters.compact { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0; z-index: 1000;
        width: 260px; border-right: 1px solid var(--line);
        transform: translateX(-100%); transition: transform 0.25s ease;
        overflow-y: auto;
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed; inset: 0; z-index: 999;
        background: rgba(0,0,0,0.5);
        display: none;
    }
    .sidebar-overlay.is-visible { display: block; }
    .menu-toggle {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px;
        background: var(--panel); color: var(--text); font-size: 22px; cursor: pointer;
        margin-right: 12px; flex-shrink: 0;
    }
    .content { padding: 18px; }
    .filters,
    .filters.compact {
        grid-template-columns: 1fr 1fr;
    }
    .filters .actions {
        grid-column: 1 / -1;
    }
    .topbar {
        display: grid;
        grid-template-columns: auto 1fr;
        align-items: start;
        gap: 12px;
    }
    .topbar-meta {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
    .card { padding: 16px; border-radius: 18px; }
    .card-head {
        flex-direction: column;
        align-items: flex-start;
    }
    .stat-value { font-size: 32px; }
    .foot-value { font-size: 22px; }
}
@media (max-width: 640px) {
    .grid.stats, .grid.two, .filters, .filters.compact { grid-template-columns: 1fr; }
    body.menu-open { overflow: hidden; }
    .content { padding: 14px; }
    h1 { font-size: 26px; }
    .sidebar {
        width: min(84vw, 320px);
        padding: 20px 14px;
    }
    .brand-logo-shell { height: 72px; }
    .brand-title { font-size: 16px; }
    .brand-subtitle { font-size: 12px; }
    .field input, .field select,
    .btn {
        min-height: 44px;
    }
    .actions {
        flex-direction: column;
        align-items: stretch;
    }
    .actions .btn,
    .actions button,
    .actions a {
        width: 100%;
    }
    .split {
        flex-wrap: wrap;
        align-items: flex-start;
    }
    .mobile-note { display: block; }
    table.mobile-table,
    table.mobile-table thead,
    table.mobile-table tbody,
    table.mobile-table tr,
    table.mobile-table th,
    table.mobile-table td {
        display: block;
        width: 100%;
    }
    table.mobile-table thead {
        display: none;
    }
    table.mobile-table tbody tr {
        border: 1px solid var(--line);
        border-radius: 16px;
        padding: 12px;
        margin-bottom: 12px;
        background: rgba(255,255,255,0.03);
    }
    table.mobile-table tbody td {
        border-bottom: 1px solid rgba(37, 50, 71, 0.45);
        padding: 8px 0;
        white-space: normal;
    }
    table.mobile-table tbody td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    table.mobile-table tbody td::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        margin-bottom: 4px;
    }
    table.mobile-table tbody td[data-label=""]::before {
        display: none;
    }
    .login-shell { padding: 14px; }
    .login-card {
        padding: 20px;
        border-radius: 20px;
    }
    .login-title { font-size: 28px; }
}
