:root {
    --bg: #0b0714;
    --side: #120a1e;
    --card: #171024;
    --card-2: #211633;
    --line: rgba(196, 181, 253, .16);
    --text: #f7f3ff;
    --muted: #b3a6cc;
    --purple: #7c3aed;
    --purple-2: #a855f7;
    --pink: #e879f9;
    --gold: #f6c56b;
    --cyan: #67e8f9;
    --danger: #fb7185;
    --ok: #34d399;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: Poppins, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(900px 420px at 12% -10%, rgba(124, 58, 237, .28), transparent 60%),
        radial-gradient(700px 380px at 100% 0%, rgba(192, 38, 211, .16), transparent 55%),
        var(--bg);
}
a { color: #d8b4fe; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.layout { display: flex; min-height: 100vh; }
.side {
    width: 268px;
    flex: 0 0 268px;
    padding: 22px 16px 18px;
    background: linear-gradient(180deg, rgba(28, 16, 48, .96), rgba(12, 8, 22, .98));
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 18px; }
.brand img { width: 46px; height: 46px; border-radius: 14px; box-shadow: 0 8px 22px rgba(124, 58, 237, .45); }
.brand strong { display: block; font-size: 16px; letter-spacing: .2px; }
.brand span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.nav-label { margin: 14px 12px 8px; color: #8b7ea6; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.side a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ddd3f0;
    padding: 10px 12px;
    border-radius: 12px;
    margin-bottom: 4px;
    font-size: 14px;
}
.side a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.side a.active, .side a:hover { background: linear-gradient(90deg, rgba(124, 58, 237, .38), rgba(192, 38, 211, .16)); color: #fff; }
.side a.active svg, .side a:hover svg { opacity: 1; }
.badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #f59e0b;
    color: #1c1408;
    font-size: 11px;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
}
.side .logout { margin-top: auto; color: #f3c4d4; }
.work { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 28px 8px;
}
.top h1 { margin: 0; font-size: 22px; font-weight: 650; }
.crumb { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.search { flex: 1; max-width: 460px; position: relative; }
.search input {
    width: 100%;
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px 12px 40px;
    outline: none;
}
.search input:focus { border-color: #a78bfa; box-shadow: 0 0 0 4px rgba(124, 58, 237, .18); }
.search svg { position: absolute; left: 14px; top: 13px; width: 16px; height: 16px; color: var(--muted); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; text-align: right; }
.who strong { display: block; font-size: 14px; }
.who span { color: var(--muted); font-size: 12px; }
.avatar {
    width: 40px; height: 40px; border-radius: 14px;
    display: grid; place-items: center; font-weight: 700;
    background: linear-gradient(145deg, #7c3aed, #c026d3);
    box-shadow: 0 8px 18px rgba(124, 58, 237, .4);
}
.main { padding: 8px 28px 36px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 12px 0 16px; }
.stat {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px 16px 14px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    box-shadow: var(--shadow);
}
.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
}
.stat.c1::before { background: #67e8f9; }
.stat.c2::before { background: #f6c56b; }
.stat.c3::before { background: #c084fc; }
.stat.c4::before { background: #fb7185; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin: 8px 0 6px; font-size: 28px; letter-spacing: -.4px; }
.stat em { color: #d6cce8; font-style: normal; font-size: 12px; }
.ico {
    width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 42px;
    background: rgba(124, 58, 237, .18); color: #e9d5ff;
}
.ico svg { width: 20px; height: 20px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr .9fr; gap: 14px; margin-bottom: 14px; }
.panel, .card, table, .auth-card {
    background: rgba(23, 16, 36, .92);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.panel { padding: 16px 16px 12px; }
.panel header, .panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.panel h2, .main h2 { margin: 0; font-size: 16px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: #9b90b3; font-size: 11px; font-family: Poppins, "Segoe UI", sans-serif; }
.donut-wrap { display: flex; gap: 16px; align-items: center; }
.donut-wrap svg { width: 210px; height: 210px; flex: 0 0 210px; }
.legend { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.legend div { display: flex; align-items: center; gap: 8px; color: #ddd4ef; font-size: 13px; }
.legend i { width: 9px; height: 9px; border-radius: 99px; display: inline-block; }
.legend b { margin-left: auto; color: #fff; font-weight: 600; }
.card { padding: 16px; margin-bottom: 12px; }
.card b { display: block; font-size: 28px; }
.card span, .muted { color: var(--muted); }
table { width: 100%; border-collapse: collapse; overflow: hidden; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
tr:hover td { background: rgba(255,255,255,.02); }
.toolbar { display: flex; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; align-items: center; }
input, select, textarea {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 12px;
    outline: none;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #a78bfa; }
label { display: block; margin: 12px 0; color: var(--muted); font-size: 13px; }
label input[type="checkbox"] { width: auto; margin-right: 6px; }
button, .btn {
    border: 0;
    background: linear-gradient(90deg, #7c3aed, #c026d3);
    color: #fff;
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    display: inline-block;
}
.btn.ghost, button.ghost { background: rgba(168, 85, 247, .16); color: #f3e8ff; }
.btn.danger, button.danger { background: linear-gradient(90deg, #e11d48, #fb7185); }
.alert { background: rgba(251, 113, 133, .12); color: #fecdd3; padding: 10px 12px; border-radius: 12px; }
.pill { border-radius: 999px; padding: 3px 8px; background: rgba(168, 85, 247, .18); color: #f3e8ff; font-size: 12px; }
.pill.risk-high { background: rgba(251, 113, 133, .2); color: #fecdd3; }
.pill.risk-mid { background: rgba(246, 197, 107, .18); color: #fde68a; }
.pill.risk-low { background: rgba(103, 232, 249, .14); color: #cffafe; }
td.actions { min-width: 220px; }
td.actions form.inline { margin-bottom: 6px; }
form.inline { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
form.inline input, form.inline select { width: auto; }
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(600px 300px at 50% 0%, rgba(124, 58, 237, .45), transparent 60%),
        var(--bg);
}
.auth-card { width: min(440px, calc(100% - 32px)); padding: 28px; text-align: left; }
.auth-card img { width: 72px; height: 72px; border-radius: 20px; display: block; margin-bottom: 12px; }
.auth-card h1 { margin: 0 0 6px; }
.auth-card p { margin: 0 0 8px; color: var(--muted); }
.auth-card button { width: 100%; margin-top: 8px; padding: 12px; }
.empty { color: var(--muted); padding: 12px 0; }
.thumb {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    object-fit: cover;
    display: block;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
}
.thumb.empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 11px;
}
.list-card {
    background: rgba(23, 16, 36, .92);
    border: 1px solid var(--line);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
}
.list-head {
    padding: 14px 16px 8px;
    border-bottom: 1px solid var(--line);
}
.list-head strong { font-size: 15px; }
.dense-list { width: 100%; }
.dense-cols,
.dense-row {
    display: grid;
    grid-template-columns: 52px minmax(160px, 1.6fr) minmax(110px, .9fr) 110px 120px 110px minmax(140px, .8fr);
    gap: 10px;
    align-items: center;
    padding: 10px 14px;
}
.dense-cols {
    color: #8b7ea6;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    font-weight: 600;
    border-bottom: 1px solid var(--line);
}
.dense-row {
    border-bottom: 1px solid var(--line);
    min-height: 56px;
}
.dense-row:last-child { border-bottom: 0; }
.dense-row:hover { background: rgba(255,255,255,.025); }
.dense-row.alert { background: rgba(251, 113, 133, .08); box-shadow: inset 3px 0 0 #fb7185; }
.dense-main { min-width: 0; }
.dense-main .row-title {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dense-cell {
    color: #e9e2f8;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dense-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap;
}
.pic {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    min-height: 40px;
    max-width: 40px;
    max-height: 40px;
    border-radius: 999px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
}
.pic img {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    object-fit: cover !important;
    display: block !important;
}
.pic.empty { color: var(--muted); font-size: 12px; }
.list-table { width: 100%; border-collapse: collapse; background: transparent; border: 0; box-shadow: none; border-radius: 0; table-layout: fixed; }
.list-table th, .list-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.list-table th {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8b7ea6;
    font-weight: 600;
}
.list-table tr:last-child td { border-bottom: 0; }
.list-table tr:hover td { background: rgba(255,255,255,.025); }
.list-table tr.row-alert td { background: rgba(251, 113, 133, .08); }
.list-table tr.row-alert td:first-child { box-shadow: inset 3px 0 0 #fb7185; }
.avatar-sm, .avatar-link .avatar-sm {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    border-radius: 999px;
    object-fit: cover !important;
    display: block;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--line);
}
.avatar-sm.empty {
    display: grid;
    place-items: center;
    color: var(--muted);
    font-size: 12px;
}
.row-title { color: #fff; font-weight: 600; font-size: 14px; }
.row-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
@media (max-width: 1100px) {
    .dense-cols { display: none; }
    .dense-row {
        grid-template-columns: 52px 1fr;
        grid-template-areas:
            "pic main"
            "pic meta"
            "pic actions";
    }
    .dense-row > a:first-child { grid-area: pic; }
    .dense-main { grid-area: main; }
    .dense-cell { display: inline-block; margin-right: 10px; color: var(--muted); }
    .dense-actions { grid-area: actions; justify-content: flex-start; margin-top: 6px; }
}
.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #e9e2f8;
}
.status i {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    display: inline-block;
    background: #a78bfa;
}
.status.ok i { background: #34d399; }
.status.warn i { background: #f6c56b; }
.status.bad i { background: #fb7185; }
.status.muted i { background: #8b7ea6; }
.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-grid;
    place-items: center;
    background: rgba(124, 58, 237, .18);
    color: #e9d5ff;
    margin-right: 6px;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.edit { background: rgba(103, 232, 249, .14); color: #a5f3fc; }
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.gallery img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.04);
}
@media (max-width: 1100px) {
    .stats, .grid-2 { grid-template-columns: 1fr 1fr; }
    .donut-wrap { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 800px) {
    .layout { display: block; }
    .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .brand { width: 100%; }
    .nav-label, .side .logout { display: none; }
    .side a { margin: 0; }
    .top, .main { padding-left: 16px; padding-right: 16px; }
    .top { flex-wrap: wrap; }
    .stats, .grid-2 { grid-template-columns: 1fr; }
    .who { margin-left: 0; }
}
