/* ==========================================================================
   沐林亭瞳OA - 管理后台设计系统（Modern SaaS）
   ========================================================================== */

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

:root {
    /* 品牌色（靛蓝主色，克制中性） */
    --brand-50: #eef2ff;
    --brand-100: #e0e7ff;
    --brand-200: #c7d2fe;
    --brand-300: #a5b4fc;
    --brand-400: #818cf8;
    --brand-500: #6366f1;
    --brand-600: #4f46e5;
    --brand-700: #4338ca;
    --brand-800: #3730a3;
    --brand-900: #312e81;

    /* 语义色 */
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --info-border: #bfdbfe;

    /* 中性色 */
    --gray-0: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* 背景与结构 */
    --bg: #f5f6fa;
    --surface: #ffffff;
    --border: #e6e8ee;
    --border-strong: #d4d8e0;

    /* 圆角 */
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;

    /* 阴影（更精致、多层） */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(16, 24, 40, 0.06), 0 2px 4px -2px rgba(16, 24, 40, 0.05);
    --shadow-lg: 0 12px 24px -8px rgba(16, 24, 40, 0.12), 0 4px 8px -4px rgba(16, 24, 40, 0.06);
    --shadow-xl: 0 24px 48px -12px rgba(16, 24, 40, 0.2), 0 8px 16px -8px rgba(16, 24, 40, 0.08);

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

    /* ===== 兼容旧变量（页面内联样式大量引用，映射到新品牌色） ===== */
    --primary: #1e1b4b;
    --primary-light: #3730a3;
    --primary-lighter: #4f46e5;
    --secondary: #4f46e5;
    --secondary-dark: #4338ca;
    --secondary-light: #eef2ff;
    --gradient-primary: linear-gradient(135deg, #1e1b4b 0%, #312e81 40%, #4f46e5 100%);
    --gradient-green: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(16,24,40,0.06), 0 1px 2px rgba(16,24,40,0.04);
    --shadow-lg: 0 12px 24px -8px rgba(16,24,40,0.12), 0 4px 8px -4px rgba(16,24,40,0.06);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand-600); text-decoration: none; transition: color 0.18s ease; }
a:hover { color: var(--brand-700); }

/* ==========================================================================
   布局
   ========================================================================== */
.app-wrap { display: flex; min-height: 100vh; }

/* --- 侧边栏 --- */
.sidebar {
    width: 260px;
    background: var(--gray-900);
    color: #cbd5e1;
    flex-shrink: 0;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }

.sidebar-header {
    padding: 22px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
}
.sidebar-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-header .brand-logo {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 17px;
    box-shadow: 0 6px 16px -4px rgba(99, 102, 241, 0.5);
    flex-shrink: 0;
}
.sidebar-header .brand-text h1 { font-size: 16px; color: #fff; font-weight: 700; letter-spacing: 0.3px; line-height: 1.2; }
.sidebar-header .brand-text p { font-size: 11px; color: #64748b; letter-spacing: 0.5px; margin-top: 2px; }

.sidebar-nav { list-style: none; padding: 12px 12px; flex: 1; }
.sidebar-nav .nav-group-label {
    padding: 14px 12px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 600;
}
.sidebar-nav li a {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 2px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.18s ease;
    border-radius: 9px;
    font-size: 14px;
    gap: 12px;
    font-weight: 500;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar-nav li a.active {
    background: var(--brand-600);
    color: #fff;
    box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.6);
}
.sidebar-nav li a .icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-nav li a .icon svg { width: 19px; height: 19px; }
.sidebar-nav li a .nav-text { flex: 1; }
.sidebar-nav li a .nav-badge {
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    min-width: 18px; height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 5px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 13px;
    padding: 10px;
    border-radius: 9px;
    transition: all 0.18s ease;
}
.sidebar-footer a:hover { background: rgba(255,255,255,0.06); color: #ef4444; }

/* --- 主内容区 --- */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- 顶栏 --- */
.topbar {
    background: rgba(255,255,255,0.82);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar h2 { font-size: 17px; color: var(--gray-800); font-weight: 700; }
.topbar-breadcrumb { font-size: 12px; color: var(--gray-400); }
.topbar-breadcrumb a { color: var(--gray-400); }
.topbar-breadcrumb a:hover { color: var(--brand-600); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px 6px 6px;
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    cursor: pointer;
    transition: all 0.18s ease;
}
.user-info:hover { border-color: var(--brand-300); background: var(--gray-100); }
.user-info .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

/* 移动菜单按钮 */
.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 38px; height: 38px;
    font-size: 20px;
    color: var(--gray-600);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
}
.mobile-menu-btn:hover { background: var(--gray-100); }
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.mobile-overlay.show { display: block; }

/* --- 内容区 --- */
.content { padding: 26px 28px 40px; flex: 1; }

/* ==========================================================================
   卡片
   ========================================================================== */
.card {
    background: var(--surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: box-shadow 0.2s ease;
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   统计卡片
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 20px 22px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--brand-500);
}
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.purple::before { background: #8b5cf6; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .label { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; font-weight: 500; letter-spacing: 0.2px; }
.stat-card .value { font-size: 30px; font-weight: 800; color: var(--gray-800); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-card.green .value { color: var(--success); }
.stat-card.orange .value { color: var(--warning); }
.stat-card.purple .value { color: #8b5cf6; }
.stat-card .sub { font-size: 12px; color: var(--gray-400); margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-card .trend-up { color: var(--success); font-weight: 600; }
.stat-card .trend-down { color: var(--danger); font-weight: 600; }

/* ==========================================================================
   表格
   ========================================================================== */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
}
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: transparent;
}
table.data-table th, table.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data-table thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}
table.data-table tbody tr { transition: background 0.12s ease; }
table.data-table tbody tr:hover { background: var(--gray-50); }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* ==========================================================================
   标签徽章
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.5;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.badge-success { background: var(--success-light); color: #047857; border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-light); color: #b45309; border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-light); color: #b91c1c; border: 1px solid var(--danger-border); }
.badge-info { background: var(--info-light); color: #1d4ed8; border: 1px solid var(--info-border); }
.badge-secondary { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--border); }

/* ==========================================================================
   按钮
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: var(--r-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    white-space: nowrap;
    gap: 7px;
    font-family: inherit;
    line-height: 1.4;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
    background: var(--brand-600);
    color: #fff;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.3), 0 4px 10px -2px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover { background: var(--brand-700); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 16px -4px rgba(99, 102, 241, 0.5); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border-color: var(--border); }
.btn-secondary:hover { background: var(--gray-200); color: var(--gray-800); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-ghost { background: transparent; color: var(--gray-600); border-color: var(--border); }
.btn-ghost:hover { background: var(--gray-50); color: var(--gray-800); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ==========================================================================
   表单
   ========================================================================== */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-weight: 600;
}
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: 14px;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    background: var(--surface);
    font-family: inherit;
    color: var(--gray-800);
}
.form-control::placeholder { color: var(--gray-400); }
.form-control:focus {
    outline: none;
    border-color: var(--brand-500);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
select.form-control { cursor: pointer; appearance: auto; }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; }

/* ==========================================================================
   Tab
   ========================================================================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
    padding: 11px 16px;
    cursor: pointer;
    color: var(--gray-500);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    transition: all 0.18s ease;
    font-weight: 500;
    margin-bottom: -1px;
    border-radius: 6px 6px 0 0;
}
.tab:hover { color: var(--brand-600); background: var(--brand-50); }
.tab.active {
    color: var(--brand-600);
    border-bottom-color: var(--brand-600);
    font-weight: 700;
    background: transparent;
}

/* ==========================================================================
   搜索栏
   ========================================================================== */
.search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
    background: var(--surface);
    padding: 14px 16px;
    border-radius: var(--r-md);
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
}
.search-bar input, .search-bar select {
    padding: 9px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: 14px;
    background: var(--surface);
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s;
    color: var(--gray-800);
}
.search-bar input:focus, .search-bar select:focus { border-color: var(--brand-500); outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }

/* ==========================================================================
   Alert
   ========================================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--r-md);
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    border: 1px solid transparent;
    animation: slideDown 0.3s ease;
}
.alert-success { background: var(--success-light); color: #065f46; border-color: var(--success-border); }
.alert-danger { background: var(--danger-light); color: #991b1b; border-color: var(--danger-border); }
.alert-info { background: var(--info-light); color: #1e40af; border-color: var(--info-border); }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: var(--warning-border); }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   登录页
   ========================================================================== */
.login-page {
    min-height: 100vh;
    background: radial-gradient(1200px 600px at 80% -10%, var(--brand-900) 0%, transparent 60%),
                radial-gradient(800px 500px at 10% 110%, var(--brand-700) 0%, transparent 50%),
                linear-gradient(135deg, #0f172a 0%, #1e1b4b 55%, #312e81 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 420px; height: 420px;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 50%;
    top: -120px; right: -120px;
    animation: floatBubble 12s ease-in-out infinite;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 560px; height: 560px;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 50%;
    bottom: -180px; left: -140px;
    animation: floatBubble 16s ease-in-out infinite reverse;
}
@keyframes floatBubble {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-24px); }
}
.login-card {
    background: var(--surface);
    border-radius: var(--r-xl);
    padding: 40px 38px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255,255,255,0.1);
}
.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 10px;
}
.login-brand .logo-box {
    width: 46px; height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 19px;
    box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.5);
}
.login-card h1 { text-align: center; color: var(--gray-800); margin-bottom: 4px; font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.login-card .subtitle { text-align: center; color: var(--gray-500); margin-bottom: 30px; font-size: 13px; }
.login-card .form-group .form-label { color: var(--gray-600); }
.login-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--gray-400); line-height: 1.8; }

/* ==========================================================================
   弹窗（Modal）
   ========================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal {
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: 26px;
    width: 90%;
    max-width: 460px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid var(--border);
}
.modal-lg { max-width: 560px; }
.modal h3 { font-size: 17px; font-weight: 700; color: var(--gray-800); margin-bottom: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
@keyframes modalIn {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   文件标签 / 详情
   ========================================================================== */
.m-file, .file-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: 7px;
    font-size: 12px;
    color: var(--gray-600);
    border: 1px solid var(--border);
    margin: 2px 2px 2px 0;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==========================================================================
   审批流程条
   ========================================================================== */
.progress-flow { display: flex; align-items: center; }
.progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    font-size: 12px;
}
.progress-step .dot {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--gray-200);
    color: var(--gray-500);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 6px;
    font-size: 12px;
    font-weight: 700;
    border: 2px solid var(--gray-200);
}
.progress-step.completed .dot { background: var(--success); border-color: var(--success); color: #fff; }
.progress-step.active .dot { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.progress-step .name { color: var(--gray-500); font-weight: 500; }
.progress-step.completed .name { color: var(--success); }
.progress-step.active .name { color: var(--brand-600); font-weight: 600; }

/* ==========================================================================
   移动端响应
   ========================================================================== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-260px); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .main-content { margin-left: 0; }
    .mobile-menu-btn { display: flex; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card .value { font-size: 24px; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; height: 56px; }
    .topbar h2 { font-size: 16px; }
    .topbar-breadcrumb { display: none; }
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-bar > * { width: 100%; }
    table.data-table th, table.data-table td { padding: 10px 12px; font-size: 12px; }
    .stat-card { padding: 16px; }
    .card { padding: 16px; }
    .login-card { padding: 32px 24px; }
    .tabs { overflow-x: auto; }
    .tab { white-space: nowrap; }
}

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

/* ==========================================================================
   Utility
   ========================================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 8px; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }
.text-brand { color: var(--brand-600); }

.mobile-only { display: none; }
@media (max-width: 768px) {
    .mobile-only { display: block; }
    .desktop-only { display: none; }
}

/* 空状态 */
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 44px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* 仪表盘网格与列表 */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.chart-note { text-align: center; color: var(--gray-400); font-size: 12px; margin-top: 10px; }
.list-stack { display: flex; flex-direction: column; }
.list-row {
    padding: 11px 0;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}
.list-row:last-child { border-bottom: none; }
.empty-cell { text-align: center; color: var(--gray-400); padding: 24px; }
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* 页面工具栏（标题区操作） */
.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}
.toolbar-right { display: flex; justify-content: flex-end; margin-bottom: 14px; }
/* 表格单元格内的小状态标签 */
.status-inline { margin-left: 6px; font-size: 11px; }
/* 位置单元格 */
.loc-cell { font-size: 12px; color: var(--gray-600); max-width: 200px; line-height: 1.5; }
/* 缩略图 */
.thumb-img {
    width: 56px; height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.thumb-img:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }
/* 内联复选框 */
.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    font-weight: 500;
}
.checkbox-inline input { width: 16px; height: 16px; accent-color: var(--brand-600); }

/* 审批流程列表 */
.approval-flow-list { display: flex; flex-direction: column; gap: 16px; }
.approval-flow-item { padding: 6px 0; }
.approval-flow-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 13px;
}
.approval-flow-head .badge { margin-left: auto; }
.progress-track {
    display: flex;
    height: 26px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--gray-100);
    gap: 2px;
}
.progress-seg {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    background: var(--gray-300);
    letter-spacing: 0.3px;
}
.progress-seg.done { background: var(--success); }

/* 表格内容省略 */
.content-ellipsis {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.amount-cell { color: var(--brand-600); font-weight: 700; font-variant-numeric: tabular-nums; }
.chart-title { font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 12px; }
.chart-box { position: relative; height: 250px; width: 100%; }
.fw-600 { font-weight: 600; }

/* 详情页 */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.detail-title { font-size: 19px; font-weight: 700; color: var(--gray-800); }
.detail-meta { color: var(--gray-500); margin-top: 5px; font-size: 13px; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.detail-card {
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 16px;
}
.detail-label { font-size: 12px; color: var(--gray-500); font-weight: 500; margin-bottom: 6px; letter-spacing: 0.2px; }
.detail-value { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.detail-value.amount { color: var(--brand-600); font-variant-numeric: tabular-nums; }
.detail-block {
    border-top: 1px solid var(--border);
    padding: 18px 2px;
}
.detail-text { font-size: 14px; color: var(--gray-700); line-height: 1.8; white-space: pre-wrap; }
.attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-panel {
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 22px;
    margin-top: 8px;
}
.detail-panel-title { font-size: 16px; font-weight: 700; color: var(--gray-800); margin-bottom: 18px; }

/* 审阅区块 */
.review-block {
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin-bottom: 12px;
    border-left: 4px solid var(--border-strong);
    background: var(--gray-50);
}
.review-block.manager { background: #eff6ff; border-left-color: var(--info); }
.review-block.gm { background: #ecfdf5; border-left-color: var(--success); }
.review-block.returned { background: #fef2f2; border-left-color: var(--danger); }
.review-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}
.review-block.manager .review-head { color: #1e40af; }
.review-block.gm .review-head { color: #065f46; }
.review-block.returned .review-head { color: #991b1b; }
.review-text { font-size: 13px; line-height: 1.8; white-space: pre-wrap; color: var(--gray-700); }
.review-block.manager .review-text { color: #1e40af; }
.review-block.gm .review-text { color: #166534; }
.review-block.returned .review-text { color: #991b1b; }
.review-empty { color: var(--gray-400); font-style: italic; font-size: 13px; }
.plan-block {
    background: linear-gradient(135deg, #fffbeb, #fef9c3);
    border-left: 4px solid var(--warning);
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin: 4px 0 12px;
}
.plan-block .detail-label { color: #92400e; }
.plan-block .detail-text { color: #78350f; }

/* 用户单元格 */
.user-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm {
    width: 30px; height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.avatar-sm.dept { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.manager-cell { display: inline-flex; align-items: center; gap: 6px; color: var(--brand-600); font-weight: 500; }
/* 角色徽章 */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}
.role-gm { background: #ede9fe; color: #6d28d9; border: 1px solid #ddd6fe; }
.role-manager { background: var(--info-light); color: #1d4ed8; border: 1px solid var(--info-border); }
.role-employee { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--border); }
/* 状态点 */
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-400); }
.status-dot::before {
    content: '';
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
}
.status-dot.active { color: var(--success); font-weight: 500; }
.status-dot.active::before { background: var(--success); box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }


/* ==========================================================================
   【兼容层 · OA-202610 旧规则回补（靛蓝风格）】
   旧版 style.css 中存在、新版靛蓝系统中被结构性替换的选择器，
   在此以新品牌变量补回，保证既有 class 不失效。
   ========================================================================== */

/* 旧版侧边栏标题直挂场景（现行 HTML 已迁移至 .brand-text/.brand-logo，此为兜底） */
.sidebar-header h1 { font-size: 16px; color: #fff; font-weight: 700; letter-spacing: 0.3px; line-height: 1.2; }
.sidebar-header p  { font-size: 11px; color: #64748b; letter-spacing: 0.5px; margin-top: 2px; }

/* 统计卡片修饰类（新版以 ::before 顶条表达品牌色，此处保留类存在性兜底） */
.stat-card.green,
.stat-card.orange,
.stat-card.purple { position: relative; overflow: hidden; }

/* 表格行 hover / 末行分隔兜底（新版以 tbody 限定，此处补通用规则） */
table.data-table tr:hover { background: var(--gray-50); }
table.data-table tr:last-child td { border-bottom: none; }
