/* ===== 全局 ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
    font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
    background:
        linear-gradient(135deg, #faf2e4 0%, #f0e2c8 40%, #e8d4b0 100%);
    color: #2a1810;
    min-height: 100vh;
    overflow: hidden;
}

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

/* ===== 登录/注册 独立布局 ===== */
.auth-layout {
    min-height: 100vh;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 30px 20px;
}
.auth-logo {
    width: 64px; height: 64px; border-radius: 16px;
    background: linear-gradient(145deg, #d4a574, #8b5a2b);
    color: #fff; font-weight: 800; font-size: 28px;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px;
    box-shadow: 0 6px 16px rgba(90,58,34,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
}
.auth-card {
    width: 100%; max-width: 360px;
    padding: 34px 30px;
    text-align: center;
}
.auth-card h1 { font-size: 22px; color: #3d2817; margin-bottom: 4px; }
.auth-card .subtitle { color: #8b6a44; font-size: 13px; margin-bottom: 22px; }
.auth-link { margin-top: 18px; color: #8b6a44; font-size: 13px; }
.auth-link a { color: #5a3a22; font-weight: 600; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }

/* ===== Sidebar ===== */
.sidebar {
    width: 220px;
    background: linear-gradient(180deg, #e8d4b0 0%, #d4b88a 50%, #c9a978 100%);
    backdrop-filter: blur(14px);
    border-right: 1px solid rgba(139,90,43,0.2);
    display: flex; flex-direction: column;
    box-shadow: 4px 0 18px rgba(90,58,34,0.18), inset 1px 0 0 rgba(255,255,255,0.4);
    flex-shrink: 0;
}
.sidebar-brand {
    padding: 22px 18px 18px;
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid rgba(139,90,43,0.15);
}
.logo-badge {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(145deg, #d4a574, #8b5a2b);
    color: #fff; font-weight: 800; font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.35);
}
.brand-title { color: #3d2817; font-size: 16px; font-weight: 700; }
.brand-sub { color: #8b6a44; font-size: 11px; letter-spacing: 0.5px; }

.sidebar-nav { padding: 14px 10px; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; margin: 3px 0;
    border-radius: 8px;
    color: #5a3a22;
    text-decoration: none; font-size: 14px; font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}
.nav-item:hover {
    background: rgba(139,90,43,0.1);
    color: #3d2817;
    border-color: rgba(139,90,43,0.15);
}
.nav-item.active {
    background: linear-gradient(145deg, #f3e5d1, #e0c8a0);
    color: #3d2817;
    border-color: rgba(139,90,43,0.25);
    box-shadow: 0 2px 6px rgba(90,58,34,0.15), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav-icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-bottom {
    padding: 14px 12px; border-top: 1px solid rgba(139,90,43,0.15);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(145deg, #d4a574, #8b5a2b);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.35);
}
.user-name { color: #3d2817; font-size: 13px; font-weight: 700; }
.user-role { color: #8b6a44; font-size: 11px; font-weight: 500; }
.btn-logout {
    display: block; text-align: center; padding: 7px;
    background: rgba(200,60,60,0.15); color: #a03030;
    border-radius: 6px; text-decoration: none; font-size: 12px; font-weight: 600;
    border: 1px solid rgba(200,60,60,0.25);
    transition: all 0.2s;
}
.btn-logout:hover { background: rgba(200,60,60,0.25); }

/* ===== 主内容区 ===== */
.main-content {
    flex: 1; overflow-y: auto;
    padding: 24px 32px;
}

/* ===== Glass / Card ===== */
.glass {
    background: rgba(255,245,230,0.72);
    backdrop-filter: blur(14px);
    border-radius: 14px;
    border: 1px solid rgba(255,255,255,0.55);
    box-shadow: 0 8px 28px rgba(60,30,10,0.18), inset 0 1px 0 rgba(255,255,255,0.7);
    padding: 20px 24px; margin-bottom: 18px;
}

.section-title {
    font-size: 16px; font-weight: 700; color: #3d2817;
    margin-bottom: 14px; padding-bottom: 10px;
    border-bottom: 1px solid rgba(61,40,23,0.12);
    display: flex; align-items: center; justify-content: space-between;
}
.section-title .count-badge {
    background: linear-gradient(145deg, #8b5a2b, #5a3a22);
    color: #fff; padding: 2px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 600;
}

/* ===== 表单 ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-row { margin-bottom: 12px; }
.form-row label {
    display: block; font-size: 12px; font-weight: 600;
    color: #5a3a22; margin-bottom: 5px;
}
.input, select.input {
    width: 100%; padding: 8px 12px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(139,90,43,0.3);
    border-radius: 7px; font-size: 13px;
    color: #2a1810; outline: none;
    transition: all 0.2s;
}
.input:focus, select.input:focus {
    border-color: #8b5a2b;
    box-shadow: 0 0 0 3px rgba(139,90,43,0.15);
}

/* ===== 按钮 ===== */
.btn {
    display: inline-block; padding: 8px 18px;
    border: none; border-radius: 7px; cursor: pointer;
    font-size: 13px; font-weight: 600; text-decoration: none;
    transition: all 0.15s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.btn-primary { background: linear-gradient(145deg, #d4a574, #8b5a2b); color: #fff; }
.btn-primary:hover { background: linear-gradient(145deg, #e2b682, #9a6534); }
.btn-success { background: linear-gradient(145deg, #5aa55a, #3d7a3d); color: #fff; }
.btn-success:hover { background: linear-gradient(145deg, #6ab56a, #4d8a4d); }
.btn-danger { background: linear-gradient(145deg, #d85a5a, #a03030); color: #fff; }
.btn-danger:hover { background: linear-gradient(145deg, #e86a6a, #b04040); }
.btn-default { background: linear-gradient(145deg, #e0d0b8, #b8a588); color: #3d2817; }
.btn-default:hover { background: linear-gradient(145deg, #eadcc5, #c8b598); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ===== Flash ===== */
.flash {
    padding: 10px 16px; border-radius: 8px; margin-bottom: 12px;
    font-size: 13px; font-weight: 600;
}
.flash.success { background: rgba(90,165,90,0.2); color: #2d6a2d; border: 1px solid rgba(90,165,90,0.4); }
.flash.error { background: rgba(216,90,90,0.2); color: #802020; border: 1px solid rgba(216,90,90,0.4); }

/* ===== 证书卡片（翻页列表） ===== */
.cert-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    font-size: 13px;
}
.cert-table thead th {
    background: linear-gradient(145deg, rgba(139,90,43,0.18), rgba(90,58,34,0.1));
    padding: 10px 12px; text-align: left;
    color: #5a3a22; font-weight: 700; font-size: 12px;
    border-bottom: 2px solid rgba(139,90,43,0.25);
    position: sticky; top: 0; z-index: 1;
}
.cert-table thead th:first-child { border-radius: 8px 0 0 0; }
.cert-table thead th:last-child { border-radius: 0 8px 0 0; }
.cert-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(61,40,23,0.08);
    color: #3d2817;
}
.cert-table tbody tr:hover td {
    background: rgba(212,165,116,0.1);
}
.cert-table tbody tr:last-child td:first-child { border-radius: 0 0 0 8px; }
.cert-table tbody tr:last-child td:last-child { border-radius: 0 0 8px 0; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.status-valid { background: #3da83d; box-shadow: 0 0 6px rgba(61,168,61,0.5); }
.status-invalid { background: #d85a5a; box-shadow: 0 0 6px rgba(216,90,90,0.5); }

.fingerprint-cell {
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px; color: #7a5a3a;
    max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== 分页 ===== */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 5px; margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(61,40,23,0.1);
}
.pagination .pg-btn {
    padding: 6px 12px;
    background: linear-gradient(145deg, #e8d8c0, #c0a888);
    border: 1px solid rgba(139,90,43,0.25);
    border-radius: 6px; cursor: pointer;
    color: #3d2817; font-size: 13px; font-weight: 600;
    text-decoration: none;
    transition: all 0.15s;
}
.pagination .pg-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #d4a574, #8b5a2b); color: #fff;
}
.pagination .pg-btn.active {
    background: linear-gradient(145deg, #8b5a2b, #5a3a22); color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}
.pagination .pg-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination .pg-info {
    color: #7a5a3a; font-size: 12px; padding: 0 10px;
}

/* ===== 上传区 ===== */
.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 2px dashed rgba(139,90,43,0.4);
    border-radius: 12px; padding: 30px;
    background: rgba(255,255,255,0.4);
    cursor: pointer; transition: all 0.2s;
}
.dropzone:hover { background: rgba(212,165,116,0.08); border-color: #8b5a2b; }
.dropzone.dragover { background: rgba(212,165,116,0.15); border-color: #d4a574; }
.drop-icon { font-size: 40px; margin-bottom: 10px; }
.drop-text { font-size: 15px; font-weight: 600; color: #3d2817; }
.drop-hint { font-size: 12px; color: #7a5a3a; margin-top: 6px; }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center; padding: 40px 20px;
    color: #7a5a3a;
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state .empty-text { font-size: 14px; }

/* ===== 标签页切换 ===== */
.tabs {
    display: flex; gap: 0; margin-bottom: 18px;
    background: rgba(61,40,23,0.06);
    border-radius: 10px; padding: 4px;
}
.tab-btn {
    flex: 1; padding: 9px 14px;
    background: transparent; border: none; cursor: pointer;
    color: #7a5a3a; font-size: 13px; font-weight: 600;
    border-radius: 8px; transition: all 0.2s;
    text-decoration: none; text-align: center;
}
.tab-btn:hover { color: #3d2817; }
.tab-btn.active {
    background: linear-gradient(145deg, #8b5a2b, #5a3a22);
    color: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.2);
}

/* ===== 设置页 ===== */
.setting-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 0; border-bottom: 1px solid rgba(61,40,23,0.08);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .setting-label {
    width: 150px; font-weight: 600; color: #3d2817; font-size: 13px;
}
.setting-row .setting-control { flex: 1; max-width: 320px; }
.setting-row .setting-desc { color: #7a5a3a; font-size: 12px; }

/* 自定义 checkbox */
input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }

/* 底部提示 */
.footer-notice {
    margin-top: 28px;
    padding: 16px 22px;
    background: linear-gradient(135deg, rgba(200,154,42,0.10), rgba(200,154,42,0.04));
    border: 1px solid rgba(200,154,42,0.35);
    border-left: 4px solid #c89a2a;
    border-radius: 10px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}
.footer-notice-icon {
    font-size: 22px;
    flex-shrink: 0;
    line-height: 1.2;
}
.footer-notice-text {
    color: #5a3a22;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
}
