:root {
    --bg: #f6f7fb;
    --card: #ffffff;
    --line: #ecedf3;
    --line-strong: #e2e5ee;
    --text: #1b2033;
    --text-2: #5c6379;
    --text-3: #8b92a8;
    --brand: #5a5af0;
    --brand-dark: #4646d6;
    --purple: #7c5cfc;
    --orange: #f97316;
    --pink: #ec4899;
    --green: #10b981;
    --red: #e11d48;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(23, 26, 51, .04), 0 10px 30px -18px rgba(23, 26, 51, .18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }

.app { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
    width: 236px;
    flex: 0 0 236px;
    background: var(--card);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 22px 14px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-logo {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, #7c5cfc, #5a5af0);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 17px;
    box-shadow: 0 8px 18px -8px rgba(90, 90, 240, .8);
}

/* ---------- 侧边栏品牌 Logo 精致化 ---------- */
.sidebar .brand-logo {
    position: relative;
    width: 40px; height: 40px; flex-basis: 40px; border-radius: 12px;
    overflow: hidden; isolation: isolate;
    background: linear-gradient(135deg, #9b8bff 0%, #7c5cfc 42%, #5046d9 100%);
    box-shadow:
        0 10px 20px -8px rgba(90, 90, 240, .85),
        0 3px 8px -3px rgba(90, 90, 240, .45),
        inset 0 1px 1px rgba(255, 255, 255, .55),
        inset 0 -2px 5px rgba(40, 30, 130, .45);
    transition: transform .25s ease, box-shadow .25s ease;
}
/* 顶部弧形高光 + 斜向反光条 */
.sidebar .brand-logo::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(120% 70% at 28% 8%, rgba(255, 255, 255, .5) 0%, rgba(255, 255, 255, 0) 55%),
        linear-gradient(115deg, rgba(255, 255, 255, 0) 38%, rgba(255, 255, 255, .22) 50%, rgba(255, 255, 255, 0) 62%);
}
/* 右上角点缀光斑 */
.sidebar .brand-logo::after {
    content: ""; position: absolute; top: 4px; right: 5px; z-index: -1;
    width: 7px; height: 7px; border-radius: 50%;
    background: rgba(255, 255, 255, .75);
    filter: blur(1px);
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, .45);
}
.sidebar .brand-glyph {
    color: #fff; font-weight: 800; font-size: 19px; line-height: 1;
    text-shadow: 0 1px 2px rgba(35, 25, 110, .55), 0 0 1px rgba(255, 255, 255, .9);
}
.sidebar .brand:hover .brand-logo {
    transform: translateY(-2px) scale(1.04);
    box-shadow:
        0 14px 26px -8px rgba(90, 90, 240, .95),
        0 5px 12px -3px rgba(90, 90, 240, .5),
        inset 0 1px 1px rgba(255, 255, 255, .65),
        inset 0 -2px 5px rgba(40, 30, 130, .45);
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .02em; }
.brand-sub { font-size: 10px; color: var(--text-3); letter-spacing: .18em; margin-top: 2px; }

.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--text-2);
    font-size: 14.5px;
    transition: background .16s ease, color .16s ease;
}
.menu-item:hover { background: #f7f8fc; color: var(--text); }
.menu-item.active { background: #f3f4fa; color: var(--text); font-weight: 600; }
.menu-item.active .tile { transform: scale(1.02); }

/* 多级菜单 */
.menu-group { display: block; }
.menu-parent {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border: 0; border-radius: 12px;
    background: transparent;
    color: var(--text-2);
    font-size: 14.5px;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.menu-parent:hover { background: #f7f8fc; color: var(--text); }
.menu-group.open > .menu-parent { color: var(--text); font-weight: 600; }
.chevron {
    margin-left: auto;
    width: 13px; height: 13px;
    color: #a8aec2;
    transition: transform .18s ease;
}
.menu-group.open > .menu-parent .chevron { transform: rotate(180deg); }
.submenu { display: none; flex-direction: column; gap: 2px; margin: 2px 0 6px; }
.menu-group.open > .submenu { display: flex; }

/* 三级菜单：模块内分组 */
.menu-count { font-size: 11px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.subgroup { display: flex; flex-direction: column; }
.subgroup-parent {
    width: 100%;
    display: flex; align-items: center; gap: 6px;
    padding: 8px 12px 8px 38px;
    border: 0; border-radius: 10px;
    background: transparent;
    color: var(--text-3);
    font-size: 12.5px; font-weight: 600; letter-spacing: .01em;
    text-align: left; cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.subgroup-parent:hover { background: #fafbfe; color: var(--text-2); }
.subgroup-parent .chevron { width: 11px; height: 11px; }
.subgroup.open > .subgroup-parent { color: var(--text-2); }
.subgroup.open > .subgroup-parent .chevron { transform: rotate(180deg); }
.subgroup-items { display: none; flex-direction: column; gap: 2px; }
.subgroup.open > .subgroup-items { display: flex; }
.subgroup .submenu-item { padding-left: 62px; }
.subgroup .submenu-item::before { left: 47px; }
.submenu-item {
    position: relative;
    display: flex; align-items: center;
    padding: 8px 12px 8px 54px;
    border-radius: 10px;
    color: var(--text-2);
    font-size: 13.5px;
    transition: background .16s ease, color .16s ease;
}
.submenu-item::before {
    content: "";
    position: absolute; left: 37px; top: 50%;
    width: 5px; height: 5px; border-radius: 50%;
    background: #d4d8e6;
    transform: translateY(-50%);
}
.submenu-item:hover { background: #f7f8fc; color: var(--text); }
.submenu-item.active { background: #f3f4fa; color: var(--brand); font-weight: 600; }
.submenu-item.active::before { background: var(--brand); }

.tile {
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
}
.tile .icon { width: 16px; height: 16px; }
.tile-purple { background: linear-gradient(135deg, #8f6bff, #6a4cff); box-shadow: 0 6px 12px -6px rgba(124, 92, 252, .9); }
.tile-orange { background: linear-gradient(135deg, #ffa04d, #f97316); box-shadow: 0 6px 12px -6px rgba(249, 115, 22, .85); }
.tile-pink   { background: linear-gradient(135deg, #ff7bb8, #ec4899); box-shadow: 0 6px 12px -6px rgba(236, 72, 153, .8); }
.tile-green  { background: linear-gradient(135deg, #45e0b1, #10b981); box-shadow: 0 6px 12px -6px rgba(16, 185, 129, .8); }
.tile-indigo { background: linear-gradient(135deg, #7b7bff, #5a5af0); box-shadow: 0 6px 12px -6px rgba(90, 90, 240, .8); }

.sidebar-footer { margin-top: auto; padding: 14px 10px 4px; font-size: 11.5px; color: var(--text-3); }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 24px 30px 18px;
}
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: .01em; }
.crumb { margin-top: 6px; font-size: 12.5px; color: var(--text-3); }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.status-pill {
    display: inline-flex; align-items: center; gap: 7px;
    background: #eefdf6; color: #0b8a63;
    border: 1px solid #d3f5e7; border-radius: 999px;
    padding: 5px 12px; font-size: 12px;
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: #10b981; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: #eef0ff; color: var(--brand);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px;
}

.content { padding: 4px 30px 44px; max-width: 1480px; width: 100%; }

/* ---------- 卡片 ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}
.card-head h2 { font-size: 15.5px; font-weight: 600; }
.card-head .muted { margin-top: 5px; font-size: 12.5px; color: var(--text-3); }
.card-body { padding: 20px 22px; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat { padding: 18px 20px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-value { margin-top: 10px; font-size: 25px; font-weight: 700; letter-spacing: -.01em; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 4px; }
.stat-foot { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.stat-foot b { color: var(--text-2); font-weight: 600; }

/* ---------- 模块入口 ---------- */
.modules { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.module {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    transition: transform .16s ease, border-color .16s ease;
}
.module:hover { transform: translateY(-2px); border-color: #dfe1ee; }
.module .tile { width: 38px; height: 38px; flex-basis: 38px; border-radius: 11px; }
.module .tile .icon { width: 19px; height: 19px; }
.module-name { font-size: 14px; font-weight: 600; }
.module-sub { font-size: 12px; color: var(--text-3); margin-top: 3px; }

/* ---------- 按钮 / 表单控件 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px;
    border-radius: 9px;
    border: 1px solid var(--line-strong);
    background: #fff;
    color: var(--text-2);
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s ease;
}
.btn:hover { border-color: #cdd2e4; color: var(--text); background: #fbfbfe; }
.btn.primary {
    background: var(--brand); border-color: var(--brand); color: #fff;
    box-shadow: 0 8px 16px -10px rgba(90, 90, 240, .9);
}
.btn.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.small { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: #fff5f7; border-color: #f5c7d2; }
.btn.success { color: #0b8a63; }
.btn.success:hover { background: #f1fdf8; border-color: #b9ecda; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter { display: flex; gap: 8px; flex-wrap: wrap; }
.input, .select, textarea.input {
    height: 36px; padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: #fff;
    color: var(--text);
    font-size: 13.5px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: #adb2c4; }
.input:focus, .select:focus, textarea.input:focus {
    border-color: #a9a9f8;
    box-shadow: 0 0 0 3px rgba(90, 90, 240, .12);
}
.select { min-width: 120px; cursor: pointer; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; min-width: 780px; }
.table th {
    text-align: left;
    padding: 12px 18px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-3);
    background: #fafbfe;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f3f4f9;
    font-size: 13.5px;
    color: var(--text-2);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fcfcff; }
.table .strong { color: var(--text); font-weight: 600; }
.table .num { font-variant-numeric: tabular-nums; }
.table .actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.table .actions form { display: inline-flex; margin: 0; }
.sub { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; }

.badge {
    display: inline-flex; align-items: center;
    padding: 3px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 500;
    background: #f1f3f9; color: #5c6379;
}
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.warn { background: #fff7ed; color: #c2410c; }
.badge.info { background: #eef2ff; color: #4338ca; }
.badge.danger { background: #fff1f4; color: #be123c; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* ---------- 提示信息 ---------- */
.flash {
    margin: 0 30px 16px;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 13px;
    background: #ecfdf5; color: #067a5b; border: 1px solid #c8f3e2;
}
.flash.error { background: #fff1f4; color: #b4123f; border-color: #f8cdd9; }
.notice {
    padding: 10px 14px; margin-bottom: 16px;
    border-radius: 10px;
    background: #f5f5ff; border: 1px solid #e4e4ff;
    color: #4b4ba8; font-size: 12.5px;
}

/* ---------- 表单 ---------- */
.form-card { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-2); }
.field label .req { color: #ef4444; margin-left: 3px; }
.field .input, .field .select { height: 42px; }
.field textarea.input { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.field-error { font-size: 12px; color: #dc2626; }
.hint { font-size: 12px; color: var(--text-3); }
.form-actions {
    display: flex; gap: 10px; justify-content: flex-end;
    padding: 16px 22px; border-top: 1px solid var(--line);
}
.readonly-value { font-size: 13.5px; color: var(--text); padding-top: 8px; }

/* ---------- 布局工具 ---------- */
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.money { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.money.income { color: #0b8a63; }
.money.expense { color: #d1345b; }
.list-line {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 0; border-bottom: 1px dashed #eef0f6;
    font-size: 13px;
}
.list-line:last-child { border-bottom: none; }
.list-line .t { color: var(--text); font-weight: 500; }

/* ---------- 我的流程 / 消息中心 ---------- */
.flow-row { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; align-items: stretch; margin-bottom: 18px; }
.flow-row > .card { display: flex; flex-direction: column; }
.flow-row > .card > .card-body { flex: 1; display: flex; align-items: center; }
.flow-row > .card > .card-body > .flow-grid,
.flow-row > .card > .card-body > .msg-empty { width: 100%; }
.flow-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 6px 0 2px; }
.flow-item {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 18px 8px 14px;
    border-radius: 12px;
    color: var(--text-2);
    font-size: 13.5px;
    transition: background .18s ease, color .18s ease;
}
.flow-item:hover { background: #f6f8fd; color: var(--text); }
.flow-item .icon { width: 30px; height: 30px; color: #3b6cf6; stroke-width: 1.8; }
.flow-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; margin-left: 3px;
    border-radius: 9px; background: #eaeaff; color: var(--brand); font-size: 11px;
}
.msg-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; padding: 6px 0 16px;
    color: var(--text-3); font-size: 13.5px;
}
.msg-empty svg { width: 108px; height: 92px; }
@media (max-width: 980px) { .flow-row { grid-template-columns: 1fr; } }

.progress { height: 7px; background: #f1f2f8; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #7c5cfc, #5a5af0); }

/* ---------- 登录页 ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(900px 520px at 12% 8%, #ececff 0%, rgba(236, 236, 255, 0) 60%),
        radial-gradient(820px 520px at 92% 92%, #e6f7f1 0%, rgba(230, 247, 241, 0) 55%),
        var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 24px 60px -30px rgba(23, 26, 51, .45);
    padding: 36px 34px 26px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-logo { width: 46px; height: 46px; flex-basis: 46px; border-radius: 13px; font-size: 19px; }
.auth-title { font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.auth-desc { margin-top: 20px; font-size: 13px; color: var(--text-3); }
.auth-form { margin-top: 12px; display: flex; flex-direction: column; }
.auth-label { margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.auth-input { width: 100%; height: 42px; }
.auth-submit { width: 100%; height: 42px; margin-top: 24px; font-size: 14.5px; letter-spacing: .18em; }
.auth-error { margin: 16px 0 0; }
.auth-foot { margin-top: 22px; text-align: center; font-size: 11.5px; color: var(--text-3); }

.user-box { display: flex; align-items: center; gap: 9px; }
.user-name { font-size: 12.5px; color: var(--text-2); }

/* ---------- 权限配置 ---------- */
.perm-group { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.perm-group-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 14px; background: #f7f8fd; border-bottom: 1px solid var(--line);
    font-size: 13px; color: var(--text);
}
.perm-filter { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 18px; }
.perm-filter .field { min-width: 180px; }
.perm-filter .field label { margin-bottom: 2px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 8px; padding: 12px 14px; }
.perm-item {
    display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px;
    cursor: pointer; font-size: 13px; color: var(--text-2);
}
.perm-item:hover { background: #f7f8fd; color: var(--text); }
.perm-item input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; flex-basis: 15px; }
.perm-item small { color: var(--text-3); font-size: 10.5px; margin-left: auto; }
.perm-item > span { white-space: nowrap; }

/* ================= 统一与响应式增强 ================= */
/* 侧边栏：菜单可滚动，页脚固定底部，避免菜单过多时重叠 */
.sidebar { overflow: hidden; }
.sidebar > .menu { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 6px; margin-right: -6px; }
.sidebar > .menu::-webkit-scrollbar { width: 5px; }
.sidebar > .menu::-webkit-scrollbar-thumb { background: #dfe2ee; border-radius: 999px; }
.sidebar > .menu::-webkit-scrollbar-track { background: transparent; }
.sidebar-footer { flex: 0 0 auto; padding-top: 12px; border-top: 1px solid var(--line); }

/* 表格数字/金额右对齐，表头同步 */
.table th.num, .table td.num,
.table th.money, .table td.money { text-align: right; }
.table th.money, .table td.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td { line-height: 1.5; }
.table .actions { flex-wrap: nowrap; }

/* 卡片头部标题与说明对齐统一 */
.card-head { align-items: center; }
.card-head h2 { line-height: 1.3; }

/* 表单域提示与错误信息占据稳定高度，避免保存校验时抖动 */
.field-error:empty { display: none; }

/* 统计数值统一数字字体，避免跳动 */
.stat-value, .module-sub { font-variant-numeric: tabular-nums; }

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
    .modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
    .content { padding-left: 20px; padding-right: 20px; }
    .topbar { padding-left: 20px; padding-right: 20px; }
    .flash { margin-left: 20px; margin-right: 20px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .app { flex-direction: column; }
    .sidebar { position: static; width: 100%; height: auto; flex-basis: auto; }
    .sidebar > .menu { max-height: 300px; }
    .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .flow-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: 1fr; }
    .card-head { flex-direction: column; align-items: stretch; }
    .toolbar, .filter { width: 100%; }
    .topbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 520px) {
    .stats, .modules { grid-template-columns: 1fr; }
}

/* ================= OA 审批 ================= */
.oa-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.oa-tabs a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 16px; font-size: 13.5px; color: var(--text-2);
    border-bottom: 2px solid transparent; white-space: nowrap;
}
.oa-tabs a:hover { color: var(--text); }
.oa-tabs a.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.oa-tabs a span {
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: #eef0f6; color: var(--text-2); font-size: 11px;
    display: inline-flex; align-items: center; justify-content: center;
}
.oa-tabs a.active span { background: #eaeaff; color: var(--brand); }

.oa-table { min-width: 1000px; }
.oa-table th, .oa-table td { white-space: nowrap; }
.oa-table .badge { white-space: nowrap; }

.settlement-table { min-width: 1150px; }
.settlement-table th, .settlement-table td { white-space: nowrap; }
.settlement-table .badge { white-space: nowrap; }

.customer-table { min-width: 1350px; }
.customer-table th, .customer-table td { white-space: nowrap; }
.customer-table .badge { white-space: nowrap; }

.log-table { min-width: 1250px; }
.log-table th, .log-table td { white-space: nowrap; font-size: 12.5px; }
.log-table .badge { white-space: nowrap; }
.log-table td:nth-child(7) { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
a.link { color: var(--brand); }
a.link:hover { text-decoration: underline; }

/* ---------- 分页 ---------- */
.pagination {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; padding: 14px 22px; border-top: 1px solid var(--line);
}
.page-info { font-size: 12.5px; color: var(--text-3); }
.page-info b { color: var(--text-2); }
.page-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-links a, .page-links > span > b, .page-links .page-ellipsis {
    min-width: 30px; height: 30px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-strong); border-radius: 8px;
    font-size: 12.5px; color: var(--text-2); background: #fff;
}
.page-links a:hover { border-color: var(--brand); color: var(--brand); }
.page-links > span.current > b { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-links .page-ellipsis { border: 0; background: transparent; color: var(--text-3); }

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.detail-item { display: flex; flex-direction: column; gap: 5px; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item .k { font-size: 12px; color: var(--text-3); }
.detail-item .v { font-size: 13.5px; color: var(--text); }
.detail-item .v.money { font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 6px; }
.timeline > li { position: relative; padding: 0 0 20px 26px; border-left: 2px solid var(--line); }
.timeline > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline .dot {
    position: absolute; left: -7px; top: 2px; width: 12px; height: 12px;
    border-radius: 50%; background: var(--brand); border: 2px solid #fff;
    box-shadow: 0 0 0 2px #eaeaff;
}
.timeline .dot.ok { background: var(--green); box-shadow: 0 0 0 2px #d3f5e7; }
.timeline .dot.danger { background: var(--red); box-shadow: 0 0 0 2px #f8cdd9; }
.tl-head { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.tl-head strong { color: var(--text); }
.tl-head .muted { font-size: 11.5px; }
.tl-body > .muted { font-size: 12px; margin-top: 3px; }
.tl-opinion {
    margin-top: 8px; padding: 8px 12px; border-radius: 8px;
    background: #f7f8fc; font-size: 12.5px; color: var(--text-2);
}

.flow-config-card { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; overflow: hidden; }
.flow-config-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #f7f8fd; border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.flow-steps { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 10px; }
.flow-step { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow-step .select { min-width: 130px; flex: 1; }
.flow-step .badge { min-width: 58px; justify-content: center; }
.flow-remove {
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; color: var(--text-3); cursor: pointer; font-size: 13px;
}
.flow-remove:hover { background: #fff1f4; color: var(--red); }
.flow-add-row { display: flex; align-items: center; gap: 10px; padding: 4px 16px 16px; }
@media (max-width: 760px) {
    .detail-grid { grid-template-columns: 1fr; }
    .flow-step .select { min-width: 100%; }
}


@media (max-width: 1200px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modules { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar {
        width: 100%; flex-basis: auto; height: auto; position: static;
        padding: 14px 12px; border-right: none; border-bottom: 1px solid var(--line);
    }
    .brand { padding: 0 4px 12px; }
    .menu { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 2px; }
    .menu-item { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
    .tile { width: 26px; height: 26px; flex-basis: 26px; border-radius: 8px; }
    .sidebar-footer { display: none; }
    .topbar { padding: 18px 16px 12px; }
    .content { padding: 4px 16px 32px; }
    .flash { margin: 0 16px 12px; }
    .modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stats { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .modules { grid-template-columns: 1fr; }
    .flow-grid { grid-template-columns: 1fr; }
    .table .actions { flex-wrap: wrap; }
}
