:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --line: #e7eaf0;
    --text: #101828;
    --muted: #667085;
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --ok: #12b76a;
    --warn: #f79009;
    --danger: #f04438;
    --side: #111827;
    --side-2: #1f2937;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; }

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

.sidebar {
    width: 246px;
    flex: 0 0 246px;
    background: var(--side);
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 22px;
}

.brand .logo {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    font-size: 19px;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 6px 16px rgba(79, 70, 229, .35);
}

.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: .5px; }
.brand small { color: #8b98ab; font-size: 11px; }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 12px;
    border-radius: 10px;
    color: #aab6c8;
    font-size: 14px;
    transition: .15s;
}

.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-item.active {
    background: linear-gradient(90deg, rgba(79, 70, 229, .95), rgba(124, 58, 237, .75));
    color: #fff;
    box-shadow: 0 6px 18px rgba(79, 70, 229, .28);
}

.nav-item .ico { width: 18px; text-align: center; opacity: .95; }

.side-foot {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22d3ee, #6366f1);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.side-foot b { color: #fff; font-size: 13px; display: block; }
.side-foot small { color: #8b98ab; font-size: 11px; }
.side-foot .logout { margin-left: auto; color: #94a3b8; font-size: 12px; }
.side-foot .logout:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 34px 18px;
}

.topbar h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; letter-spacing: .3px; }
.topbar p { margin: 0; color: var(--muted); font-size: 13px; }

.content { padding: 0 34px 30px; flex: 1; }

.foot {
    padding: 16px 34px 26px;
    color: #98a2b3;
    font-size: 12px;
}

/* ---------- cards ---------- */
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -18px rgba(16, 24, 40, .25);
    overflow: hidden;
}

.card + .card { margin-top: 20px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 9px; }
.card-title .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); }
.card-title .count { font-size: 12px; color: var(--muted); font-weight: 400; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- stats ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}

.stat::after {
    content: "";
    position: absolute;
    right: -22px;
    top: -22px;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: rgba(79, 70, 229, .07);
}

.stat .lbl { font-size: 12px; color: var(--muted); letter-spacing: .2px; }
.stat .val { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat .hint { font-size: 11px; color: #98a2b3; margin-top: 4px; }

.stat.s-blue .val { color: #2563eb; }
.stat.s-amber .val { color: #b54708; }
.stat.s-green .val { color: #067647; }
.stat.s-red .val { color: #b42318; }
.stat.s-violet .val { color: #6941c6; }

/* ---------- buttons ---------- */
.btn {
    border: 1px solid transparent;
    border-radius: 9px;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: .15s;
    white-space: nowrap;
}

.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .25); }
.btn-primary:hover { filter: brightness(1.06); color: #fff; }

.btn-soft { background: #eef2ff; color: #4338ca; border-color: #e0e7ff; }
.btn-soft:hover { background: #e0e7ff; color: #3730a3; }

.btn-light { background: #fff; color: #344054; border-color: #d0d5dd; }
.btn-light:hover { background: #f9fafb; }

.btn-danger-soft { background: #fef3f2; color: #b42318; border-color: #fee4e2; }
.btn-danger-soft:hover { background: #fee4e2; }

.btn-xs { padding: 5px 9px; font-size: 12px; border-radius: 7px; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

table.data thead th {
    background: #f9fafb;
    color: #475467;
    font-weight: 600;
    text-align: left;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    font-size: 12px;
    letter-spacing: .3px;
}

table.data tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f2f4f7;
    color: #1d2939;
    white-space: nowrap;
}

table.data tbody tr:hover td { background: #f9faff; }
table.data tbody tr:last-child td { border-bottom: none; }

.empty { text-align: center; color: #98a2b3; padding: 46px 0 !important; }
.empty span { display: block; font-size: 28px; margin-bottom: 8px; opacity: .55; }

.mono { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; }

/* ---------- pills ---------- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: #f2f4f7;
    color: #475467;
}

.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: #ecfdf3; color: #067647; }
.pill.warn { background: #fffaeb; color: #b54708; }
.pill.bad { background: #fef3f2; color: #b42318; }
.pill.info { background: #eff8ff; color: #175cd3; }
.pill.mute { background: #f2f4f7; color: #667085; }

/* ---------- pagination ---------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pager .meta { color: var(--muted); font-size: 12.5px; }
.pager .pages { display: flex; gap: 6px; }
.pager .pages a, .pager .pages span {
    min-width: 32px;
    height: 32px;
    padding: 0 9px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    font-size: 12.5px;
    border: 1px solid var(--line);
    color: #475467;
    background: #fff;
}

.pager .pages a:hover { border-color: #c7d2fe; color: var(--brand); }
.pager .pages .on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pager .pages .off { opacity: .45; }

/* ---------- modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, .45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1050;
    backdrop-filter: blur(2px);
}

.modal .box {
    width: 460px;
    max-width: 100%;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(16, 24, 40, .3);
}

.modal .box-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    font-weight: 650;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal .box-body { padding: 20px; }
.modal .box-foot {
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    background: #fcfcfd;
}

.field-label { font-size: 12.5px; color: #344054; font-weight: 600; margin-bottom: 6px; display: block; }
.field {
    width: 100%;
    border: 1px solid #d0d5dd;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 13.5px;
    outline: none;
}
.field:focus { border-color: #a5b4fc; box-shadow: 0 0 0 3px rgba(99, 102, 241, .12); }

.note {
    margin-top: 14px;
    background: #fffaeb;
    border: 1px solid #fedf89;
    color: #93370d;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.6;
}

/* ---------- auth ---------- */
.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(900px 500px at 12% 8%, rgba(99, 102, 241, .18), transparent 60%),
        radial-gradient(700px 420px at 88% 92%, rgba(14, 165, 233, .16), transparent 62%),
        #f4f6fb;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 32px 30px 26px;
    box-shadow: 0 24px 60px -30px rgba(16, 24, 40, .35);
}

.auth-logo {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    font-size: 22px;
    margin: 0 auto 14px;
    box-shadow: 0 10px 22px rgba(79, 70, 229, .3);
}

.auth h2 { text-align: center; font-size: 20px; margin: 0 0 6px; }
.auth .sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 22px; }
.auth .field { margin-bottom: 14px; }
.auth .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.auth .foot { text-align: center; margin-top: 16px; font-size: 12.5px; color: var(--muted); }
.auth .foot a { color: var(--brand); font-weight: 600; }

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 12.5px;
    margin-bottom: 14px;
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: #b42318;
}

/* ---------- responsive ---------- */
@media (max-width: 980px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; flex: none; height: auto; position: relative; padding: 14px 16px; }
    .nav { flex-direction: row; overflow-x: auto; }
    .nav-item { white-space: nowrap; }
    .side-foot { display: none; }
    .topbar { padding: 18px 18px 12px; }
    .content { padding: 0 18px 24px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
    .stats { grid-template-columns: 1fr; }
}

/* ---------- download dropdown ---------- */
.dl-menu {
    min-width: 220px;
    padding: 6px;
    margin-top: 6px !important;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 40px -18px rgba(16, 24, 40, .35), 0 2px 6px rgba(16, 24, 40, .06);
}

.dl-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: #344054;
}

.dl-menu .dropdown-item:hover,
.dl-menu .dropdown-item:focus {
    background: #f4f6ff;
    color: #4338ca;
}

.dl-menu .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #98a2b3;
    flex: 0 0 7px;
}

.dl-menu .dot.han { background: #7c3aed; }
.dl-menu .dot.letter { background: #0ea5e9; }
.dl-menu .dot.digit { background: #12b76a; }
.dl-menu .dot.banned { background: #f04438; }

.dl-menu .dropdown-divider {
    margin: 6px 4px;
    border-color: var(--line);
}
