/* 奈斯自卫盾 · 后台样式
   视觉参考：暖白纸底 + 米色分区 + 细线分隔 + 衬线标题，无阴影扁平风格 */

:root {
    --bg: #fdfcf8;
    --surface: #ffffff;
    --surface-2: #f7f4ec;
    --surface-3: #fbf9f3;
    --border: #e8e4d9;
    --border-strong: #d9d3c4;

    --text: #1a2332;
    --text-2: #3a4556;
    --text-3: #7a8394;

    --accent: #1554a8;
    --accent-soft: #eef3fa;

    --ok: #2f6b4f;
    --ok-bg: #eef4ee;
    --ok-border: #dfe9e0;

    --warn: #8a6417;
    --warn-bg: #fbf3e3;
    --warn-border: #f0e5cc;

    --danger: #a83a32;
    --danger-bg: #fbeeee;
    --danger-border: #f0dcd9;

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 10px;

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, "SimSun", serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-2);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 12px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    white-space: nowrap;
}

/* ---------- 整体骨架 ---------- */

.admin-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 248px;
    width: 248px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 14px 18px;
    border-right: 1px solid var(--border);
    background: var(--bg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 22px;
    color: var(--text);
    text-decoration: none;
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    font-family: var(--font-serif);
    font-size: 17px;
    color: var(--text);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong {
    font-family: var(--font-serif);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
}
.brand-text small { font-size: 11px; color: var(--text-3); letter-spacing: 0.06em; }

.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-2);
    font-size: 13.5px;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-list a:hover { background: var(--surface); text-decoration: none; }
.nav-list a.active {
    background: var(--surface);
    border-color: var(--border);
    color: var(--accent);
    font-weight: 500;
}

.nav-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: transparent;
}
.nav-list a.active .nav-dot { background: var(--accent); border-color: var(--accent); }

.sidebar-foot {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--text-3);
}
.sidebar-foot .logout {
    color: var(--text-3);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    transition: color 0.15s ease, border-color 0.15s ease;
}
.sidebar-foot .logout:hover {
    color: var(--danger);
    border-color: var(--danger-border);
    background: var(--danger-bg);
    text-decoration: none;
}

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

.main-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 38px 40px 72px;
}

/* ---------- 页面标题 ---------- */

.page-head { margin-bottom: 26px; }
.page-head h1 {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text);
}
.page-head p {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-3);
}

/* ---------- 统计卡片 ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px 20px;
}

.stat-card .label {
    font-size: 12px;
    color: var(--text-3);
    letter-spacing: 0.04em;
    margin-bottom: 10px;
}

.stat-card .value {
    font-family: var(--font-serif);
    font-size: 30px;
    line-height: 1.1;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.stat-card .value.is-danger { color: var(--danger); }

/* ---------- 卡片 ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    margin-bottom: 18px;
}

.card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.card-head h2 {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.card-head .card-meta { font-size: 12px; color: var(--text-3); }

.card-link {
    font-size: 12.5px;
    color: var(--text-3);
    white-space: nowrap;
}
.card-link:hover { color: var(--accent); text-decoration: none; }

/* ---------- 表格 ---------- */

.table-wrap {
    overflow-x: auto;
    margin: 0 -4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.table-wrap::-webkit-scrollbar { height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--text-3);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 12px;
    font-size: 13px;
    color: var(--text-2);
    border-bottom: 1px solid #f1eee5;
    vertical-align: middle;
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-3); }

td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

.path-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    color: var(--text-3);
}

/* ---------- 标签 ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.8;
    white-space: nowrap;
}

.badge-success,
.badge-ok,
.badge-permanent,
.badge-active { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-border); }

.badge-warning,
.badge-count { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }

.badge-danger,
.badge-deny,
.badge-expired { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

.badge-info { background: var(--accent-soft); color: var(--accent); border-color: #dbe5f2; }

.badge-used { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }

.crack-method { color: var(--danger); font-weight: 500; }

.hwid-short {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 6px;
    white-space: nowrap;
}

/* ---------- 按钮与表单 ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }

.btn-primary {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
}
.btn-primary:hover { background: #2a3444; border-color: #2a3444; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.search-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
}

input[type="text"],
input[type="password"],
input[type="search"],
select {
    font-family: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 13px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus {
    outline: none;
    border-color: #b9c6da;
    box-shadow: 0 0 0 3px rgba(21, 84, 168, 0.08);
}

.search-form input[type="text"] { flex: 1; min-width: 200px; max-width: 360px; }

/* ---------- 提示条 ---------- */

.alert {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 18px;
}
.alert-warning {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

/* ---------- 大数字条 ---------- */

.banner {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 20px 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    margin-bottom: 18px;
}
.banner .banner-value {
    font-family: var(--font-serif);
    font-size: 32px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.banner .banner-label { font-size: 13px; color: var(--text-3); }

/* ---------- 分页 ---------- */

.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 20px;
}
.pagination a,
.pagination span {
    min-width: 32px;
    padding: 6px 10px;
    text-align: center;
    font-size: 13px;
    color: var(--text-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-decoration: none;
}
.pagination a:hover { border-color: var(--border-strong); background: var(--surface-2); text-decoration: none; }
.pagination .active { background: var(--text); border-color: var(--text); color: #fff; }

/* ---------- 空状态 ---------- */

.empty {
    padding: 44px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
}

/* ---------- 登录页 ---------- */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg);
}

.auth-inner { width: 100%; max-width: 400px; }

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 28px;
}
.auth-brand .brand-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
    font-size: 19px;
}

.auth-title {
    font-family: var(--font-serif);
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text);
    text-align: center;
}
.auth-subtitle {
    margin-top: 8px;
    text-align: center;
    font-size: 13px;
    color: var(--text-3);
}

.auth-chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px 0 30px;
}
.auth-chips span {
    padding: 4px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    font-size: 12px;
    color: var(--text-2);
}

.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label {
    font-size: 12px;
    color: var(--text-3);
    letter-spacing: 0.04em;
}
.auth-form input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    font-size: 14px;
    background: var(--surface);
    border-radius: var(--radius);
}
.auth-form .btn-login {
    width: 100%;
    padding: 13px 16px;
    font-size: 14px;
    margin-top: 4px;
}

.auth-error {
    padding: 10px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--danger-border);
    border-radius: var(--radius);
    background: var(--danger-bg);
    color: var(--danger);
    font-size: 13px;
}

.auth-foot {
    margin-top: 28px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: 12px;
    color: var(--text-3);
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
    .admin-shell { flex-direction: column; }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        flex-basis: auto;
        flex-direction: row;
        align-items: center;
        gap: 16px;
        padding: 12px 16px;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }

    .brand { padding: 0; flex: 0 0 auto; }
    .brand-text small { display: none; }

    .nav-list { flex-direction: row; gap: 6px; }
    .nav-list a { white-space: nowrap; padding: 7px 12px; }
    .nav-dot { display: none; }

    .sidebar-foot {
        margin: 0 0 0 auto;
        padding: 0 0 0 12px;
        border-top: none;
        border-left: 1px solid var(--border);
        flex: 0 0 auto;
    }
    .sidebar-foot .who { display: none; }

    .main-inner { padding: 26px 18px 48px; }
    .page-head h1 { font-size: 22px; }
    .card { padding: 18px 16px; }
    .stat-card { padding: 15px 16px; }
    .stat-card .value { font-size: 26px; }
}
