/* ========== 全局 ========== */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: #0f0f14;
    color: #c8c8d4;
    min-height: 100vh;
}

a { color: #7c8cf8; text-decoration: none; }
a:hover { opacity: 0.85; }

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

.sidebar {
    width: 220px; min-width: 220px;
    background: #13131c; border-right: 1px solid #2a2a3a;
    display: flex; flex-direction: column;
}

.sidebar-brand {
    padding: 24px 20px 20px; font-size: 17px; font-weight: bold;
    color: #7c8cf8; border-bottom: 1px solid #2a2a3a;
}

.sidebar-nav { flex:1; padding: 12px 0; }
.nav-item {
    display: block; padding: 11px 20px; color: #787890;
    font-size: 14px; transition: all 0.15s;
}
.nav-item:hover, .nav-item.active {
    color: #c8c8d4; background: #1a1a28;
}

.sidebar-footer {
    padding: 16px 20px; border-top: 1px solid #2a2a3a;
    display: flex; justify-content: space-between; align-items: center;
    font-size: 13px; color: #787890;
}
.logout-link { color: #f87171; font-size: 12px; }

.main {
    flex: 1; padding: 28px 32px;
    overflow-y: auto; max-height: 100vh;
}
.main h2 { font-size: 20px; margin-bottom: 20px; color: #e0e0e8; }

/* ========== 卡片 ========== */
.card {
    background: #1a1a24; border: 1px solid #2a2a3a;
    border-radius: 10px; padding: 24px; margin-bottom: 16px;
}
.card h3 { font-size: 15px; margin-bottom: 12px; color: #c8c8d4; }

/* ========== 统计 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px; margin-bottom: 20px;
}
.stat-card {
    background: #1a1a24; border: 1px solid #2a2a3a;
    border-radius: 10px; padding: 18px 16px; text-align: center;
}
.stat-num { font-size: 28px; font-weight: bold; color: #c8c8d4; }
.stat-label { font-size: 12px; color: #787890; margin-top: 4px; }
.stat-unused .stat-num { color: #7c8cf8; }
.stat-active .stat-num { color: #4ade80; }
.stat-expired .stat-num { color: #fbbf24; }
.stat-revoked .stat-num { color: #f87171; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block; font-size: 13px; color: #787890; margin-bottom: 4px;
}
input, select, textarea {
    width: 100%; padding: 9px 12px; background: #0f0f14;
    border: 1px solid #2a2a3a; border-radius: 6px;
    color: #c8c8d4; font-size: 14px; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: #7c8cf8;
}
.form-select { cursor: pointer; }

/* ========== 按钮 ========== */
.btn {
    display: inline-block; padding: 9px 18px;
    background: #2a2a3a; color: #c8c8d4;
    border: none; border-radius: 6px; font-size: 13px;
    cursor: pointer; font-family: inherit; transition: all 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #7c8cf8; color: #fff; }
.btn-red { background: #f87171; color: #fff; }
.btn-yellow { background: #fbbf24; color: #0f0f14; }
.btn-green { background: #4ade80; color: #0f0f14; }
.btn-full { width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ========== 提示 ========== */
.alert {
    padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: 14px;
}
.alert-success { background: #4ade8020; color: #4ade80; border: 1px solid #4ade8040; }
.alert-error { background: #f8717120; color: #f87171; border: 1px solid #f8717140; }

/* ========== 表格 ========== */
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 10px 10px; text-align: left; font-size: 13px;
    border-bottom: 1px solid #2a2a3a; white-space: nowrap;
}
th { color: #787890; font-weight: 600; font-size: 12px; }
tr:hover { background: #ffffff05; }
td.empty { text-align: center; color: #787890; padding: 40px; }

.key-text { font-family: "Consolas", monospace; color: #7c8cf8; font-size: 13px; }
.time-cell { font-size: 12px; color: #787890; }
.note-cell { max-width: 120px; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.actions { white-space: nowrap; }
.actions .btn { margin-right: 4px; }

/* ========== 徽章 ========== */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
}
.badge-type { background: #7c8cf820; color: #7c8cf8; }
.badge-unused { background: #7c8cf820; color: #7c8cf8; }
.badge-active { background: #4ade8020; color: #4ade80; }
.badge-expired { background: #fbbf2420; color: #fbbf24; }
.badge-revoked { background: #f8717120; color: #f87171; }

/* ========== 工具栏 ========== */
.toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 14px; gap: 12px;
}
.search-form { display: flex; gap: 6px; align-items: center; }
.search-form input { width: 200px; padding: 7px 12px; font-size: 13px; }

/* ========== 标签栏 ========== */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tab {
    padding: 6px 16px; border-radius: 6px; font-size: 13px;
    color: #787890; background: #1a1a24; transition: all 0.15s;
}
.tab:hover { color: #c8c8d4; }
.tab-active { background: #7c8cf8; color: #fff; }

/* ========== 分页 ========== */
.pagination { display: flex; gap: 6px; margin-top: 16px; justify-content: center; }
.page-link {
    display: inline-block; padding: 6px 14px; border-radius: 6px;
    background: #1a1a24; color: #787890; font-size: 13px;
}
.page-active { background: #7c8cf8; color: #fff; }

/* ========== 弹窗 ========== */
.modal {
    position: fixed; inset: 0; background: #00000080;
    display: flex; justify-content: center; align-items: center; z-index: 1000;
}
.modal-content {
    background: #1a1a24; border: 1px solid #2a2a3a;
    border-radius: 12px; padding: 28px; width: 380px;
}
.modal-content h3 { margin-bottom: 12px; color: #e0e0e8; }
.modal-btns { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

/* ========== 生成卡密展示 ========== */
.generated-keys {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: 8px; margin-top: 12px;
}
.key-item {
    padding: 10px 14px; background: #0f0f14; border: 1px solid #2a2a3a;
    border-radius: 6px; font-family: "Consolas", monospace;
    font-size: 14px; color: #4ade80; text-align: center;
    user-select: all; cursor: pointer;
}

/* ========== 登录页 ========== */
.login-box { width:380px; margin:120px auto; }
.login-box h1 { font-size:22px; margin-bottom:24px; text-align:center; color:#7c8cf8; }

/* ========== 批量操作栏 ========== */
.batch-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; margin-bottom: 14px;
    background: #fbbf2410; border: 1px solid #fbbf2440;
    border-radius: 8px; font-size: 13px;
}
.batch-info { color: #fbbf24; margin-right: auto; }
.batch-info strong { font-size: 16px; }

/* ========== 筛选栏 ========== */
.filter-bar {
    margin-bottom: 14px;
}
.filter-extra {
    display: flex; align-items: center; gap: 8px; margin-top: 10px;
    padding: 8px 12px; background: #1a1a24; border-radius: 8px;
}
.filter-select {
    width: auto; padding: 6px 12px; font-size: 12px;
    background: #0f0f14; border: 1px solid #2a2a3a;
    border-radius: 6px; color: #c8c8d4; cursor: pointer;
}
.filter-date {
    width: 130px; padding: 6px 10px; font-size: 12px;
    background: #0f0f14; border: 1px solid #2a2a3a;
    border-radius: 6px; color: #c8c8d4;
    font-family: inherit;
}
.filter-date:focus { outline: none; border-color: #7c8cf8; }
.filter-sep { color: #787890; font-size: 12px; }

/* ========== 表单行 ========== */
.form-row {
    display: flex; gap: 16px; align-items: flex-start;
}
.form-group-flex { flex: 1; min-width: 0; }
.form-group-flex label { display: block; }
.form-input-sm { width: 120px; }

/* ========== 卡片头部 ========== */
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.card-header h3 { margin-bottom: 0; }

/* ========== 工具栏左右 ========== */
.toolbar-left { display: flex; gap: 8px; }
.toolbar-right { display: flex; gap: 8px; }
.toolbar .search-input { width: 180px; padding: 7px 12px; font-size: 13px; }

/* ========== 分页信息 ========== */
.pagination-info {
    text-align: center; font-size: 12px; color: #787890;
    margin-top: 12px;
}

/* ========== 表格复选框 ========== */
table th input[type="checkbox"],
table td input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer;
    accent-color: #7c8cf8;
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .sidebar { width: 60px; min-width: 60px; }
    .sidebar-brand { font-size: 0; }
    .sidebar-brand::after { content: "🔐"; font-size: 18px; }
    .nav-item { font-size: 0; padding: 11px 18px; }
    .nav-item::before { font-size: 16px; }
    .sidebar-footer span { display: none; }
}
