* { box-sizing: border-box; }

:root {
    --brand: #b32024;
    --brand-dark: #8f191d;
    --sidebar: #1f2733;
    --sidebar-hover: #2b3543;
    --text: #1f2329;
    --muted: #8a9099;
    --line: #e6e8eb;
    --bg: #f4f6f8;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; }

/* ---------------- 侧边栏 ---------------- */
.sidebar {
    width: 216px;
    flex: 0 0 216px;
    background: var(--sidebar);
    color: #c9d1dc;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    padding: 20px 18px 16px;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: .5px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.brand span {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #8e9aab;
    letter-spacing: 2px;
    margin-top: 4px;
}

.nav { padding: 12px 10px 40px; }

.nav-title {
    padding: 14px 10px 6px;
    font-size: 11px;
    letter-spacing: 1px;
    color: #6f7b8b;
    text-transform: uppercase;
}

.nav-item {
    display: block;
    padding: 9px 12px;
    margin: 2px 0;
    border-radius: 6px;
    color: #c9d1dc;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}

.nav-item.active {
    background: var(--brand);
    color: #fff;
    font-weight: 600;
}

/* ---------------- 主区域 ---------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.crumb { font-weight: 600; }

.user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.user-name { color: var(--text); }
.logout { color: var(--muted); }

.content { padding: 20px 24px 40px; }

.page-head { margin-bottom: 16px; }
.page-head h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------------- 卡片 ---------------- */
.card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 18px;
}

.card-head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
}

/* ---------------- 工具栏 ---------------- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.field { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }

.field input, .field select {
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9dde3;
    border-radius: 5px;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    width: 130px;
}

.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(179, 32, 36, .1);
}

.tools { display: flex; gap: 8px; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border: 1px solid #d9dde3;
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

.btn:hover { border-color: #b9bfc7; text-decoration: none; }

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }

.btn-danger { color: #c62828; border-color: #f0c2c2; }
.btn-danger:hover { background: #fdf2f2; }

.btn-mini { height: 26px; padding: 0 10px; font-size: 12px; }

.btn-block { width: 100%; }

form.inline { display: inline-block; margin-left: 6px; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }

table.grid th, table.grid td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

table.grid th {
    background: #fafbfc;
    font-weight: 600;
    color: #4b5563;
    white-space: nowrap;
    position: sticky;
    top: 0;
    overflow: hidden;
}

table.grid tbody tr:hover { background: #fcfcfd; }

table.grid td { word-break: break-word; overflow: hidden; }

table.grid td a { white-space: nowrap; display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

table.grid .check { width: 36px; text-align: center; }
table.grid td.check { text-align: center; }

table.grid .empty { text-align: center; color: var(--muted); padding: 40px 0; }

a.sort { color: #4b5563; }
a.sort.on { color: var(--brand); font-weight: 600; }

/* ---------------- 分页 ---------------- */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    font-size: 13px;
}

.pages { display: flex; gap: 6px; }

.pg {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d9dde3;
    border-radius: 5px;
    color: var(--text);
    background: #fff;
}

.pg:hover { border-color: #b9bfc7; text-decoration: none; }
.pg.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.pg.disabled { color: #c0c5cc; background: #fafbfc; }

.muted { color: var(--muted); }

/* ---------------- 首页统计 ---------------- */
.stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px 18px;
}

.stat-label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.stat strong { font-size: 26px; font-weight: 600; letter-spacing: .5px; }

/* ---------------- 表单 ---------------- */
.form { padding: 20px 18px; max-width: 560px; }

.form-item { margin-bottom: 16px; }
.form-item label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 6px; }

.form-item input[type=text], .form-item input[type=password], .form-item select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #d9dde3;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.form-item input:focus, .form-item select:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(179, 32, 36, .08);
}

.form-actions { display: flex; gap: 10px; margin-top: 22px; }

.alert {
    margin: 16px 18px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #fdf2f2;
    border: 1px solid #f3c9c9;
    color: #a31515;
    font-size: 13px;
}

.jump { padding: 40px 18px; text-align: center; }
.jump-msg { font-size: 16px; margin: 0 0 8px; }

/* ---------------- 登录 ---------------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #1f2733 0%, #2c3a4d 100%);
    min-height: 100vh;
}

.login-wrap { width: 100%; max-width: 380px; padding: 20px; }

.login-card {
    background: #fff;
    border-radius: 10px;
    padding: 30px 26px 22px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, .25);
}

.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand strong { display: block; font-size: 22px; letter-spacing: 2px; color: var(--brand); }
.login-brand span { display: block; font-size: 12px; color: var(--muted); letter-spacing: 3px; margin-top: 6px; }

.login-tip { text-align: center; color: #b3b9c2; font-size: 12px; margin: 16px 0 0; }

.login-card .alert { margin: 0 0 16px; }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
