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

:root {
    --primary: #1e6fff;
    --primary-dark: #1656c9;
    --bg: #f4f6fb;
    --sidebar-bg: #1d2b45;
    --sidebar-text: #c7d0e0;
    --text: #2b3546;
    --muted: #8895a9;
    --border: #e5e9f2;
    --white: #ffffff;
    --green: #18a058;
    --orange: #f0a020;
    --red: #d03050;
    --blue: #1e6fff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 14px;
    line-height: 1.6;
}

/* ===== 登录页 ===== */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1d2b45 0%, #1e6fff 100%);
}

.login-wrap { width: 100%; max-width: 400px; padding: 24px; }

.login-card {
    background: var(--white);
    border-radius: 14px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

.login-logo {
    width: 60px; height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #1e6fff, #1656c9);
    color: #fff;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700; letter-spacing: 2px;
}

.login-title { text-align: center; font-size: 19px; font-weight: 700; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 28px; }

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

.sidebar {
    width: 230px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, #1e6fff, #1656c9);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; letter-spacing: 2px; font-size: 15px;
}

.brand-name { color: #fff; font-size: 14px; font-weight: 600; line-height: 1.3; }
.brand-sub { font-size: 12px; color: var(--sidebar-text); }

.nav { padding: 14px 0; flex: 1; overflow-y: auto; }

.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { width: 18px; text-align: center; font-size: 13px; }

.nav-divider { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 16px; }
.nav-group-title { font-size: 12px; color: rgba(255, 255, 255, .4); padding: 6px 20px; }

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

.topbar {
    background: var(--white);
    height: 60px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}

.topbar-title { font-size: 17px; font-weight: 700; }

.topbar-user { display: flex; align-items: center; gap: 12px; }
.user-badge {
    background: #e8f0ff; color: var(--primary);
    padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.user-name { font-weight: 600; }
.logout-btn {
    color: var(--muted); text-decoration: none;
    padding: 6px 12px; border-radius: 6px; font-size: 13px;
}
.logout-btn:hover { background: #f0f2f7; color: var(--red); }

.content { padding: 24px 28px; flex: 1; }

.footer {
    text-align: center; color: var(--muted); font-size: 12px;
    padding: 16px;
}

/* ===== 卡片 ===== */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.card {
    background: var(--white); border-radius: 12px; padding: 20px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}
.card-blue { border-left-color: var(--blue); }
.card-green { border-left-color: var(--green); }
.card-orange { border-left-color: var(--orange); }
.card-gray { border-left-color: #c0c8d6; }
.card-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card-value { font-size: 30px; font-weight: 700; }
.card-value-sm { font-size: 20px; }

/* ===== 面板 ===== */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.panel {
    background: var(--white); border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
}
.panel-narrow { max-width: 860px; }
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.panel-head h3 { font-size: 15px; font-weight: 700; }
.head-actions { display: flex; gap: 8px; }
.panel-body { padding: 20px; }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    white-space: nowrap;
}
.table th { background: #f7f9fc; color: var(--muted); font-weight: 600; }
.table tbody tr:hover { background: #fafbfe; }
.table .empty { text-align: center; color: var(--muted); padding: 30px; }
.mono { font-family: "SFMono-Regular", Consolas, "Courier New", monospace; font-size: 12.5px; }
.ellipsis { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.actions { display: flex; gap: 12px; align-items: center; }
.link { color: var(--primary); text-decoration: none; cursor: pointer; background: none; border: none; font-size: 13px; padding: 0; }
.link:hover { text-decoration: underline; }
.link-danger { color: var(--red); }
.inline-form { display: inline; margin: 0; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.required { color: var(--red); }

.input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d5dae4;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    transition: border-color .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 111, 255, .12); }
.input.textarea { resize: vertical; }
select.input { height: 40px; }

.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.input-group .btn { flex-shrink: 0; }

.input-readonly {
    padding: 9px 12px;
    background: #f7f9fc;
    border: 1px dashed #d5dae4;
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}
.muted { color: var(--muted); }
.form-hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.form-tip { color: var(--muted); font-size: 12px; margin-top: 12px; }

.form-actions { display: flex; gap: 10px; margin-top: 8px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; max-width: 520px; }
.search-bar .input { flex: 1; }

/* ===== 按钮 ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-light { background: #f0f2f7; color: var(--text); border-color: #d5dae4; }
.btn-light:hover { background: #e6e9ef; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ===== 提示 ===== */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.alert-success { background: #e8f8ef; color: #0d7a3f; border: 1px solid #b7e6c9; }
.alert-error { background: #fdeaea; color: #b01a2e; border: 1px solid #f3b6bf; }
.alert-warning { background: #fff6e8; color: #9a6a00; border: 1px solid #f2d9a0; }
.alert-info { background: #e8f0ff; color: #1656c9; border: 1px solid #bcd2ff; }
.error-list { padding-left: 20px; }
.info-list { padding-left: 20px; margin: 8px 0; }
.info-list li { margin-bottom: 4px; }
.info-list code { background: #eef2f8; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ===== 徽章 ===== */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-green { background: #e8f8ef; color: var(--green); }
.badge-orange { background: #fff6e8; color: var(--orange); }
.badge-blue { background: #e8f0ff; color: var(--blue); }

/* ===== 详情 ===== */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 24px; }
.detail-item { display: flex; flex-direction: column; }
.detail-label { color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.detail-value { font-size: 14px; font-weight: 600; }

/* ===== 分页 ===== */
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.page-info { color: var(--muted); font-size: 13px; }

/* ===== 弹窗 ===== */
.modal { display: none; position: fixed; inset: 0; z-index: 100; }
.modal.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); }
.modal-box {
    position: relative; margin: 100px auto 0; width: 400px;
    background: #fff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal-head { padding: 16px 20px; font-weight: 700; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; }

/* ===== 响应式 ===== */
@media (max-width: 900px) {
    .cards { grid-template-columns: repeat(2, 1fr); }
    .panel-grid { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr 1fr; }
    .sidebar { width: 64px; }
    .brand-text, .nav-item:not(.active) { font-size: 0; }
    .nav-item { justify-content: center; }
    .nav-group-title { display: none; }
}
