/* =====================================================================
   项目管理小工具 · 样式（移动优先）
   结构：变量 → 基础 → 布局 → 组件 → 页面 → 响应式
   ===================================================================== */

/* ---------- 1. 变量 ---------- */
:root {
    --brand: #2f6fed;
    --brand-dark: #1e4fd6;
    --brand-soft: #eaf1ff;
    --bg: #f3f5fa;
    --surface: #ffffff;
    --line: #e5e9f2;
    --line-soft: #eef1f7;
    --ink: #16213a;
    --ink-2: #3b4660;
    --muted: #6b7690;
    --muted-2: #98a1b6;
    --green: #10885a;
    --green-soft: #e7f7ef;
    --red: #d93a3a;
    --red-soft: #feebeb;
    --amber: #b06907;
    --amber-soft: #fff5e3;
    --purple: #6d4ad8;
    --purple-soft: #f1ecff;
    --blue-soft: #e8f0ff;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .12);
    --sidebar-w: 236px;
}

/* ---------- 2. 基础 ---------- */
* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }

.icon {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.text-muted { color: var(--muted); }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }

/* ---------- 3. 布局 ---------- */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #101b33 0%, #0d1528 100%);
    color: #d7dff0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 18px;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 6px 22px;
    color: #fff;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: linear-gradient(135deg, #4f8bff, #2f6fed 60%, #8b5cf6);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    box-shadow: 0 6px 16px -6px rgba(79, 139, 255, .9);
}

.brand-name { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: #7c8aab; letter-spacing: .08em; }

.nav-group-title {
    font-size: 11px;
    color: #66759a;
    letter-spacing: .12em;
    padding: 14px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #aebad4;
    font-size: 14px;
    margin-bottom: 2px;
    transition: background .16s ease, color .16s ease;
}

.nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-link.active {
    background: linear-gradient(90deg, rgba(47, 111, 237, .28), rgba(47, 111, 237, .1));
    color: #fff;
    box-shadow: inset 2px 0 0 #5c93ff;
}

.nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #f0503d;
    color: #fff;
    font-size: 11px;
    line-height: 20px;
    text-align: center;
}

.sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3d6fe0, #6d4ad8);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 600;
    flex: none;
}

.sidebar-user .name { font-size: 13px; color: #eef2fb; }
.sidebar-user .role { font-size: 11px; color: #7c8aab; }

.logout-btn { margin-left: auto; color: #7c8aab; padding: 6px; border-radius: 8px; }
.logout-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 28px;
    background: rgba(243, 245, 250, .86);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(229, 233, 242, .7);
}

.topbar-title { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.topbar-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.page { padding: 22px 28px 40px; width: 100%; max-width: 1280px; }

.mobile-only { display: none; }

/* 移动端底部导航 */
.tabbar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 0;
    font-size: 11px;
    color: var(--muted);
    border-radius: 10px;
}

.tabbar a.active { color: var(--brand); }
.tabbar a.active .icon { stroke-width: 2.1; }

/* ---------- 4. 组件 ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card + .card { margin-top: 16px; }

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line-soft);
}

.card-head h3 { font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 8px 10px; }

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0 0 12px;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
}

.btn:hover { border-color: #c9d3e6; background: #fafbff; }
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: linear-gradient(135deg, #3b7bff, var(--brand));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(47, 111, 237, .65);
}

.btn-primary:hover { background: linear-gradient(135deg, #4a86ff, var(--brand-dark)); }

.btn-danger { color: var(--red); border-color: #f3c9c9; background: #fffafa; }
.btn-danger:hover { background: var(--red-soft); border-color: #f0b3b3; }

.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef2fa; color: var(--ink); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 9px; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1;
    font-weight: 500;
    white-space: nowrap;
}

.b-blue { background: var(--blue-soft); color: var(--brand-dark); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-gray { background: #f0f2f7; color: var(--muted); }
.b-purple { background: var(--purple-soft); color: var(--purple); }

.priority-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.p-high { background: var(--red); }
.p-medium { background: #e6a23c; }
.p-low { background: #9aa4bb; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.stat-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: auto -30px -50px auto;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(47, 111, 237, .09), transparent 68%);
}

.stat-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}

.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.stat-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.stat-extra { font-size: 11.5px; color: var(--muted-2); margin-top: 8px; }
.stat-extra .up { color: var(--green); }
.stat-extra .warn { color: var(--red); }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }

table.data th {
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: var(--muted);
    padding: 11px 14px;
    background: #f8fafd;
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}

table.data td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: middle;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #fbfcff; }
table.data .name { font-weight: 500; color: var(--ink); }
table.data .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
table.data tr.row-overdue td { background: #fffafa; }

/* 进度条 */
.progress {
    --value: 0;
    position: relative;
    height: 7px;
    border-radius: 999px;
    background: #eaeef7;
    overflow: hidden;
    min-width: 70px;
}

.progress > span {
    display: block;
    height: 100%;
    width: calc(var(--value) * 1%);
    border-radius: inherit;
    background: linear-gradient(90deg, #4f8bff, var(--brand));
}

.progress.green > span { background: linear-gradient(90deg, #2fbf83, #10885a); }
.progress.amber > span { background: linear-gradient(90deg, #f3b34c, #d98a06); }
.progress.red > span { background: linear-gradient(90deg, #f17373, #d93a3a); }

.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-line .num { font-size: 12px; color: var(--muted); width: 34px; text-align: right; }

/* 表单 */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .col-span-2 { grid-column: span 2; }

.field label {
    display: block;
    font-size: 12.5px;
    color: var(--ink-2);
    font-weight: 500;
    margin-bottom: 6px;
}

.field label .req { color: var(--red); margin-left: 2px; }

.input, .select, .textarea {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #dfe4ef;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7690' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
.input::placeholder, .textarea::placeholder { color: #a9b2c6; }

.form-hint { font-size: 11.5px; color: var(--muted-2); margin-top: 5px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

.check-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
input[type="checkbox"].box, input[type="radio"].box {
    width: 17px;
    height: 17px;
    accent-color: var(--brand);
    cursor: pointer;
}

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; pointer-events: none; }
.chip-check span {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid #dfe4ef;
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    background: #fff;
}
.chip-check input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* 筛选栏 */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.filter-bar .field { min-width: 120px; }
.filter-bar .field label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.filter-bar .input, .filter-bar .select { height: 36px; font-size: 13px; border-radius: 9px; }
.filter-bar .grow { flex: 1 1 180px; }

/* 列表行（移动端卡片化） */
.list { display: block; }

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--line-soft);
    transition: background .15s ease;
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #fbfcff; }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.list-sub { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.list-side { text-align: right; font-size: 12px; color: var(--muted); flex: none; }

/* 任务 */
.task-group + .task-group { margin-top: 8px; }
.task-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 2px;
    border-bottom: 1px dashed var(--line-soft);
}
.task-row:last-child { border-bottom: none; }
.task-row .task-name { font-size: 13.5px; line-height: 1.45; }
.task-row.done .task-name { color: var(--muted); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.task-meta .overdue { color: var(--red); font-weight: 500; }
.task-actions { margin-left: auto; display: flex; gap: 2px; flex: none; }
.task-actions .btn { color: var(--muted-2); }

.check-btn {
    width: 22px;
    height: 22px;
    margin-top: 1px;
    border-radius: 7px;
    border: 1.6px solid #cbd3e4;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    color: transparent;
    flex: none;
    transition: all .15s ease;
}

.check-btn:hover { border-color: var(--brand); }
.check-btn.checked { background: var(--brand); border-color: var(--brand); color: #fff; }
.check-btn .icon { width: 14px; height: 14px; stroke-width: 2.6; }

.stage-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stage-card + .stage-card { margin-top: 10px; }
.stage-head { display: flex; align-items: center; gap: 8px; }
.stage-index {
    width: 22px; height: 22px; border-radius: 7px; background: var(--brand-soft); color: var(--brand-dark);
    font-size: 11px; display: grid; place-items: center; font-weight: 600; flex: none;
}

/* 空状态 */
.empty {
    padding: 42px 20px;
    text-align: center;
    color: var(--muted);
}

.empty .icon { width: 40px; height: 40px; color: #c3cbdc; margin-bottom: 10px; stroke-width: 1.4; }
.empty p { margin: 0; font-size: 13px; }
.empty .btn { margin-top: 14px; }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.pagination .info { font-size: 12px; color: var(--muted); }
.pages { display: flex; gap: 6px; }
.pages a, .pages span {
    min-width: 32px; height: 32px; padding: 0 9px; border-radius: 8px; border: 1px solid var(--line);
    display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; color: var(--ink-2); background: #fff;
}
.pages a:hover { border-color: var(--brand); color: var(--brand); }
.pages .current { background: var(--brand); border-color: var(--brand); color: #fff; }
.pages .disabled { color: #c3cbdc; background: #f7f9fc; }

/* 提示 */
.flash-stack { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }

.flash {
    display: flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 12px; font-size: 13px;
    box-shadow: 0 14px 34px -14px rgba(16, 24, 40, .35); animation: flash-in .25s ease;
    background: #fff; border: 1px solid var(--line); color: var(--ink);
}

.flash.success { background: var(--green-soft); border-color: #bdebd3; color: #0b6a46; }
.flash.error { background: var(--red-soft); border-color: #f6cccc; color: #a52121; }
.flash.info { background: var(--blue-soft); border-color: #cbdcff; color: #1c4fbe; }
.flash.hide { opacity: 0; transform: translateY(-6px); transition: all .3s ease; }

@keyframes flash-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 弹窗 */
dialog.modal {
    border: none;
    border-radius: 18px;
    padding: 0;
    width: min(520px, calc(100vw - 28px));
    max-height: calc(100vh - 48px);
    box-shadow: 0 30px 80px -20px rgba(16, 24, 40, .4);
    overflow: hidden;
}

dialog.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .2s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 18px 20px; max-height: 62vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-soft); background: #fbfcff; }

/* 提示块 */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; font-size: 13px; border: 1px solid; }
.alert-warn { background: var(--amber-soft); border-color: #f6e0b5; color: #8a5200; }
.alert-info { background: var(--blue-soft); border-color: #cfe0ff; color: #1d4fb8; }
.alert-danger { background: var(--red-soft); border-color: #f6cccc; color: #a52121; }

/* 详情键值 */
.kv-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.kv .k { font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.kv .v { font-size: 13.5px; color: var(--ink); word-break: break-word; }

/* 时间线 */
.timeline { position: relative; padding-left: 18px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: ""; position: absolute; left: -18px; top: 6px; width: 9px; height: 9px; border-radius: 50%;
    background: #fff; border: 2px solid var(--brand);
}
.timeline-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.timeline-body { font-size: 13.5px; color: var(--ink-2); margin-top: 5px; white-space: pre-wrap; word-break: break-word; }

/* 项目概况条 */
.overview { display: flex; flex-wrap: wrap; gap: 10px 28px; }
.overview .item .k { font-size: 11.5px; color: var(--muted); }
.overview .item .v { font-size: 15px; font-weight: 600; margin-top: 2px; }
.overview .item .v small { font-size: 12px; font-weight: 400; color: var(--muted); }

/* 双栏 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* 附件 */
.attach-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); font-size: 13px; }
.attach-item:last-child { border-bottom: none; }
.attach-item .file-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.attach-item .meta { font-size: 11.5px; color: var(--muted); }

/* 登录页 */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    background:
        radial-gradient(900px 500px at 10% -10%, rgba(79, 139, 255, .22), transparent 60%),
        radial-gradient(700px 500px at 100% 0%, rgba(139, 92, 246, .18), transparent 55%),
        #f3f5fa;
}

.auth-card { width: min(400px, 100%); background: #fff; border-radius: 22px; padding: 32px 28px; box-shadow: 0 30px 80px -30px rgba(22, 33, 58, .35); border: 1px solid rgba(255, 255, 255, .6); }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-title { font-size: 21px; font-weight: 650; letter-spacing: -.02em; }
.auth-sub { font-size: 13px; color: var(--muted); margin: 4px 0 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .input { height: 46px; }
.auth-foot { margin-top: 18px; font-size: 11.5px; color: var(--muted-2); text-align: center; }

/* 错误/403 页 */
.deny-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.deny-card { text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 40px 30px; max-width: 420px; box-shadow: var(--shadow); }
.deny-code { font-size: 44px; font-weight: 700; color: var(--brand); letter-spacing: -.04em; }

/* ---------- 5. 响应式 ---------- */
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .grid-main-side { grid-template-columns: 1fr; }
    .kv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { display: none; }
    .app-main { margin-left: 0; }
    .topbar { padding: 12px 16px; min-height: 58px; }
    .topbar-title { font-size: 16px; }
    .topbar-sub { display: none; }
    .page { padding: 14px 14px calc(84px + env(safe-area-inset-bottom)); }
    .tabbar { display: flex; }
    .mobile-only { display: initial; }
    .desktop-only { display: none !important; }

    .stat-grid { gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 21px; }
    .stat-icon { width: 32px; height: 32px; margin-bottom: 8px; border-radius: 9px; }
    .stat-icon .icon { width: 17px; height: 17px; }
    .stat-label { font-size: 12px; }

    .card { border-radius: 14px; }
    .card-head { padding: 13px 15px; }
    .card-body { padding: 14px 15px; }

    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .form-grid .col-span-2 { grid-column: auto; }

    .kv-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .filter-bar { padding: 12px; gap: 8px; }
    .filter-bar .field { flex: 1 1 calc(50% - 4px); min-width: 0; }
    .filter-bar .grow { flex-basis: 100%; }
    .filter-bar .btn { flex: 1 1 100%; }

    /* 表格卡片化 */
    table.data thead { display: none; }
    table.data, table.data tbody { display: block; }
    table.data tr {
        display: block;
        border: 1px solid var(--line);
        border-radius: 12px;
        padding: 6px 12px;
        margin-bottom: 10px;
        background: #fff;
    }
    table.data tbody tr:hover td { background: transparent; }
    table.data td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px dashed var(--line-soft);
        font-size: 13px;
    }
    table.data td:last-child { border-bottom: none; }
    table.data td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 12px;
        flex: none;
        font-weight: 500;
    }
    table.data td[data-label=""]::before, table.data td.cell-full::before { display: none; }
    table.data td.cell-full { display: block; }
    table.data td.row-actions { justify-content: flex-end; padding-top: 10px; }

    .pagination { padding: 12px 4px 0; border-top: none; }
    .pagination .info { width: 100%; text-align: center; }
    .pages { width: 100%; justify-content: center; }

    .list-item { padding: 12px 14px; }
    .list-side { display: none; }

    dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
    .modal-body { max-height: 66vh; }

    .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .form-actions { justify-content: stretch; }
    .form-actions .btn { flex: 1; }

    .overview { gap: 10px 20px; }
    .auth-card { padding: 26px 20px; border-radius: 18px; }
    .flash-stack { top: 10px; }
}

@media (max-width: 380px) {
    .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* 打印 */
@media print {
    .sidebar, .topbar, .tabbar, .btn, .flash-stack { display: none !important; }
    .app-main { margin: 0; }
    body { background: #fff; }
    .card { box-shadow: none; }
}
