/* ============================================================
   现代化设计系统 v2 (桌面 + 手机 H5)
   - 玻璃态导航/卡片渐变
   - 移动端底部 Tab 栏 + 安全区适配 (iPhone 刘海/灵动岛)
   - 大触控目标(>=44px)、表单/表格/弹窗 H5 优化
   ============================================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --primary-soft: #eff6ff;
    --bg: #f3f6fb;
    --bg-soft: #f8fafc;
    --text: #0f172a;
    --text-soft: #1f2937;
    --muted: #64748b;
    --border: #e5e7eb;
    --border-soft: #eef2f7;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #0891b2;
    --shadow-sm: 0 1px 3px rgba(15,23,42,.04), 0 1px 2px rgba(15,23,42,.06);
    --shadow: 0 4px 16px rgba(15,23,42,.05), 0 2px 6px rgba(15,23,42,.04);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.10), 0 4px 12px rgba(15,23,42,.06);
    --shadow-primary: 0 10px 28px rgba(37,99,235,.22);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 18px;
    --topbar-h: 56px;
    --sidebar-w: 220px;
    --sidebar-bg: #1a2b4a;
}

* { box-sizing: border-box; }

html, body { -webkit-tap-highlight-color: transparent; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }

/* 滚动条现代化(桌面端) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; background-clip: padding-box; border: 2px solid transparent; }

/* ===== 左侧边栏 (桌面端 ≥992px) ===== */
.app-sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex; flex-direction: column;
    z-index: 1040;
    box-shadow: 2px 0 20px rgba(0,0,0,.12);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand-logo {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
    flex-shrink: 0;
}
.sidebar-brand-name { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.sidebar-brand-sub { color: rgba(255,255,255,.5); font-size: .72rem; letter-spacing: 1px; }

.sidebar-nav {
    flex: 1; overflow-y: auto;
    padding: 12px 10px;
}
.sidebar-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px;
    color: rgba(255,255,255,.7);
    font-size: .9rem; font-weight: 500;
    border-radius: 10px;
    margin-bottom: 2px;
    transition: color .15s, background .15s;
    text-decoration: none;
}
.sidebar-nav-item i { font-size: 1.15rem; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav-item:hover { color: #fff; background: rgba(255,255,255,.08); }
.sidebar-nav-item.active {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-user {
    display: flex; align-items: center; gap: 8px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user-link {
    display: flex; align-items: center; gap: 10px;
    flex: 1; min-width: 0;
    color: rgba(255,255,255,.85);
    text-decoration: none;
    padding: 6px 8px; border-radius: 8px;
    transition: background .15s;
}
.sidebar-user-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar-user-link .avatar { width: 34px; height: 34px; font-size: .9rem; flex-shrink: 0; }
.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-name { color: #fff; font-size: .85rem; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { color: rgba(255,255,255,.5); font-size: .72rem; }
.sidebar-logout {
    color: rgba(255,255,255,.5); font-size: 1.1rem;
    padding: 8px 10px; border-radius: 8px;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.sidebar-logout:hover { color: #fca5a5; background: rgba(239,68,68,.15); }

/* ===== 顶部页标题栏 ===== */
.app-topbar {
    display: flex; align-items: center; justify-content: space-between;
    height: var(--topbar-h);
    padding: 0 24px;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0;
    z-index: 1030;
    margin-left: var(--sidebar-w);
    transition: margin-left .2s ease;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-back {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: #fff; color: var(--text);
    font-size: 1.2rem;
    transition: background .15s, box-shadow .15s;
    -webkit-tap-highlight-color: transparent;
}
.topbar-back:hover { background: var(--primary-soft); color: var(--primary); }
.topbar-back:active { transform: scale(.95); }
.topbar-title-wrap { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-date { font-size: .76rem; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-greeting { font-size: .85rem; color: var(--muted); font-weight: 500; }
.topbar-avatar-link { display: flex; cursor: pointer; }
.topbar-avatar { width: 36px; height: 36px; font-size: .9rem; }

/* 头像下拉菜单 (手机端) */
.topbar-menu {
    border: 1px solid var(--border-soft);
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(15,23,42,.16);
    padding: 6px;
    min-width: 200px;
    margin-top: 6px !important;
}
.topbar-menu-header {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px 6px;
}
.topbar-menu-header .avatar { width: 40px; height: 40px; font-size: 1rem; }
.topbar-menu-info { min-width: 0; }
.topbar-menu-name { font-weight: 600; font-size: .9rem; color: var(--text); line-height: 1.2; }
.topbar-menu-role { font-size: .76rem; color: var(--muted); }
.topbar-menu .dropdown-divider { margin: 4px 8px; }
.topbar-menu .dropdown-item {
    border-radius: 8px; padding: 10px 12px;
    font-size: .9rem; font-weight: 500;
    display: flex; align-items: center;
    transition: background .12s;
}
.topbar-menu .dropdown-item:active { background: var(--primary-soft); color: var(--primary); }

/* 用户头像 */
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 50%;
    background: #fff; color: var(--primary);
    font-weight: 700; font-size: .85rem;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ===== 主内容区 ===== */
.app-main {
    margin-left: var(--sidebar-w);
    padding: 20px 28px;
    min-height: calc(100vh - var(--topbar-h));
    transition: margin-left .2s ease;
}
.content-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.page-title {
    font-weight: 700; margin-bottom: 18px;
    color: var(--primary-dark);
    display: flex; align-items: center; gap: 10px;
    font-size: 1.15rem;
}
.page-title i { color: var(--primary); }

/* ===== 卡片 / 统计卡 ===== */
.card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: #fff;
}
.card-header {
    background: linear-gradient(180deg, #fff 0%, #fbfcfd 100%);
    border-bottom: 1px solid var(--border);
    font-weight: 600; padding: 14px 18px;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 18px; }

.stat-card {
    background: linear-gradient(135deg, #fff 0%, #f9fafb 100%);
    border-radius: var(--radius); padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card .icon { font-size: 2.2rem; opacity: .82; }
.stat-card .value { font-size: 1.6rem; font-weight: 800; color: var(--text); letter-spacing: -.5px; }
.stat-card .label { color: var(--muted); font-size: .85rem; }
.stat-card.success { border-left-color: var(--success); }
.stat-card.success .icon { color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.warning .icon { color: var(--warning); }
.stat-card.info { border-left-color: var(--info); }
.stat-card.info .icon { color: var(--info); }
.stat-card.primary .icon { color: var(--primary); }

/* ===== 筛选栏 ===== */
.filter-bar {
    background: linear-gradient(180deg, #fff 0%, var(--bg-soft) 100%);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
    display: flex; flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    box-shadow: var(--shadow-sm);
}
.filter-bar .form-label { font-size: .8rem; color: var(--muted); margin-bottom: 4px; font-weight: 500; }
.filter-bar .form-control, .filter-bar .form-select { height: 40px; min-width: 130px; }

/* ===== 按钮: 现代化 ===== */
.btn { border-radius: 10px; font-weight: 500; transition: transform .12s, box-shadow .2s, background .2s; }
.btn:active { transform: scale(.97); }
.btn-sm { border-radius: 8px; }

.btn-hr {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff; border: 0;
    box-shadow: 0 4px 12px rgba(37,99,235,.28);
}
.btn-hr:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #1e3a8a 100%);
    color: #fff;
    box-shadow: 0 6px 18px rgba(37,99,235,.36);
}
.btn-hr:active { transform: scale(.97); }

.btn-action { padding: 4px 9px; font-size: .78rem; margin: 0 2px; border-radius: 7px; }

/* ===== 表格 ===== */
table.data-table {
    background: #fff; border-radius: var(--radius-sm); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
table.data-table thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f3f4f6 100%);
    font-weight: 600; font-size: .82rem; color: #374151;
    white-space: nowrap; border-bottom: 1px solid var(--border);
}
table.data-table tbody tr { transition: background .15s; }
table.data-table tbody tr:hover { background: var(--primary-soft); }
.table > :not(caption) > * > * { padding: 11px 12px; }

/* 分页 */
.pagination .page-link { border-radius: 8px; margin: 0 3px; color: var(--primary); border: 1px solid var(--border); min-width: 38px; text-align: center; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(37,99,235,.24); }
.pagination .page-link:focus { box-shadow: 0 0 0 3px rgba(37,99,235,.18); }

/* ===== 状态徽章 ===== */
.status-pill {
    display: inline-block;
    padding: 3px 11px; border-radius: 12px;
    font-size: .75rem; font-weight: 600;
    letter-spacing: .2px;
}
.status-pill.normal, .status-pill.scheduled { background: #d1fae5; color: #065f46; }
.status-pill.late, .status-pill.warning { background: #fef3c7; color: #92400e; }
.status-pill.absent, .status-pill.cancelled { background: #fee2e2; color: #991b1b; }
.status-pill.overtime, .status-pill.completed { background: #dbeafe; color: #1e40af; }
.status-pill.leave, .status-pill.business, .status-pill.early { background: #e0e7ff; color: #3730a3; }

/* ===== 登录页 ===== */
.login-bg {
    background:
        radial-gradient(1200px 600px at 10% 10%, rgba(255,255,255,.15) 0%, transparent 60%),
        radial-gradient(1000px 500px at 90% 90%, rgba(8,145,178,.25) 0%, transparent 55%),
        linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0891b2 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.login-card {
    background: rgba(255,255,255,.96);
    border: 1px solid rgba(255,255,255,.6);
    border-radius: 20px; padding: 38px 32px;
    width: 100%; max-width: 430px;
    box-shadow: 0 24px 60px rgba(0,0,0,.22), 0 8px 24px rgba(30,58,138,.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}
.login-card h2 { font-weight: 800; color: var(--primary-dark); margin-bottom: 4px; letter-spacing: -.3px; }
.login-card .sub { color: var(--muted); margin-bottom: 24px; font-size: .85rem; }
.login-card .form-control { height: 46px; border-radius: 10px; }
.login-card .input-group-text {
    background: var(--bg-soft); border: 1px solid var(--border);
    border-right: 0; border-radius: 10px 0 0 10px;
    color: var(--muted);
}
.login-card .input-group .form-control:first-child { border-left: 0; }
.login-card .btn-hr { height: 48px; font-size: 1.02rem; font-weight: 600; letter-spacing: 1px; }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center; padding: 50px 20px;
    color: var(--muted);
}
.empty-state i { font-size: 3rem; opacity: .42; }

/* 图表容器 */
.chart-container { position: relative; height: 320px; }

/* 角色徽章 */
.badge-role-admin { background: #fee2e2; color: #991b1b; }
.badge-role-manager { background: #dbeafe; color: #1e40af; }
.badge-role-operator { background: #e0e7ff; color: #4338ca; }

/* ===== Toast ===== */
.toast { position: fixed; top: calc(var(--topbar-h) + 10px); right: 20px; z-index: 1080; min-width: 280px; border-radius: 12px; }
.toast-container { z-index: 1080; }
.toast-body { font-weight: 500; }

/* ============================================================
   统计表格 (周期考勤矩阵: 行=员工, 列=日期) - 保留原样式
   ============================================================ */
.mx-wrap { max-height: 72vh; overflow: auto; }
.mx-scroll { min-width: max-content; }
#mx-table { font-size: .8rem; border: 1px solid #f0f0f0; }
#mx-table th, #mx-table td { padding: 4px 6px; white-space: nowrap; border-right: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
#mx-table thead th { position: sticky; top: 0; background: #fafafa; z-index: 3; font-weight: 600; color: #1f2937; }
#mx-table tbody tr:nth-child(even) { background: #fafafa; }
#mx-table tbody tr:hover { background: #e6f4ff; }
.mx-sc1, .mx-sc2 { position: sticky; background: #fff; z-index: 2; }
#mx-table tbody tr:nth-child(even) .mx-sc1,
#mx-table tbody tr:nth-child(even) .mx-sc2 { background: #fafafa; }
.mx-sc1 { left: 0; min-width: 96px; }
.mx-sc2 { left: 96px; min-width: 64px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
#mx-table thead .mx-sc1, #mx-table thead .mx-sc2 { z-index: 4; }
.mx-cell { min-width: 34px; font-weight: 600; }
.mx-legend .mx-cell { display: inline-block; min-width: 22px; text-align: center; border-radius: 4px; padding: 0 3px; margin: 0 1px; }
.mx-none { color: #bfbfbf; }
.mx-normal { color: #389e0d; }
.mx-half { color: #d48806; background: #ffe58f !important; }            /* 半天: 黄 */
.mx-rest { color: #cf1322; background: #ffa39e !important; }          /* 休: 红 */
.mx-personal { color: #d4380d; background: #ffd591 !important; }      /* 事假: 橙 */
.mx-annual { color: #096dd9; background: #bae0ff !important; }       /* 年假: 蓝 */
.mx-absent { color: #531dab; background: #d3adf7 !important; }       /* 旷工: 紫 */
.mx-business { color: #d48806; background: #ffe58f !important; }   /* 出差: 黄 */
.mx-overtime { color: #1e40af; background: #eff6ff !important; }
.mx-resigned { color: #8c8c8c; background: #d9d9d9 !important; }     /* 离职: 灰 */
.mx-late, .mx-early { color: #92400e; background: #fffdf5 !important; }
.mx-leave { color: #3730a3; background: #eef2ff !important; }
/* 新员工标识 */
.mx-newrow td { background: #f6fef8 !important; }
.mx-newcell { background: #dcfce7 !important; }
.new-badge { background: #16a34a; font-size: .62rem; padding: .15em .4em; vertical-align: middle; }
/* 单元格状态编辑浮层 */
.mx-editor {
    position: fixed; z-index: 2000;
    background: #fff; border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 30px rgba(15,23,42,.18);
    padding: 8px; display: grid; gap: 4px; min-width: 128px;
}
.mx-editor-title { font-size: .75rem; color: var(--muted); text-align: center; padding-bottom: 2px; }
.mx-editor-btn {
    border: 1px solid var(--border); background: #fff; border-radius: 7px;
    padding: 4px 10px; font-size: .82rem; text-align: left;
}
.mx-editor-btn:active { transform: scale(.97); }
.mx-editor-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.mx-editor-clear { color: var(--danger); border-color: #fecaca; background: #fef2f2; }

/* ============================================================
   普通用户手机端: 日期竖板视图 (一行一天)
   ============================================================ */
.mx-v-summary {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
}
.mx-v-name {
    font-size: 1.08rem; font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
    display: flex; align-items: center; gap: 6px;
}
.mx-v-stats {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.mx-v-stat {
    display: inline-flex; align-items: center; gap: 3px;
    font-size: .76rem; padding: 4px 10px;
    border-radius: 12px;
    background: #fff; color: var(--muted);
    border: 1px solid var(--border-soft);
}
.mx-v-stat b { font-weight: 700; font-size: .9rem; }
.mx-v-stat.mx-v-normal { background: #d9f7d9; color: #389e0d; border-color: #b7eb8f; }
.mx-v-stat.mx-v-normal b { color: #389e0d; }
.mx-v-stat.mx-v-half { background: #ffe58f; color: #d48806; border-color: #ffc53d; }
.mx-v-stat.mx-v-half b { color: #d48806; }
.mx-v-stat.mx-v-rest { background: #ffa39e; color: #cf1322; border-color: #ff7875; }
.mx-v-stat.mx-v-personal { background: #ffd591; color: #d4380d; border-color: #ffa940; }
.mx-v-stat.mx-v-absent { background: #d3adf7; color: #531dab; border-color: #9254de; }
.mx-v-stat.mx-v-absent b { color: #531dab; }
.mx-v-stat.mx-v-annual { background: #bae0ff; color: #096dd9; border-color: #69c0ff; }
.mx-v-stat.mx-v-business { background: #ffe58f; color: #d48806; border-color: #ffc53d; }
.mx-v-stat.mx-v-total { background: linear-gradient(135deg, #2563eb, #1e40af); color: #fff; border-color: transparent; }
.mx-v-stat.mx-v-total b { color: #fff; font-size: 1rem; }

.mx-v-list {
    display: flex; flex-direction: column; gap: 6px;
}
.mx-v-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: #fff;
    transition: background .12s;
}
.mx-v-row.mx-v-new { border-color: #bbf7d1; background: #f6fef8; }
.mx-v-row.mx-v-today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,.12) inset; }
.mx-v-date {
    flex: 0 0 56px; text-align: center; line-height: 1.2;
    border-right: 1px solid var(--border-soft);
    padding-right: 10px;
}
.mx-v-date.weekend .mx-v-d-wd { color: var(--danger); }
.mx-v-d-date { font-weight: 700; font-size: .95rem; color: var(--text); }
.mx-v-d-wd { font-size: .72rem; color: var(--muted); }
.mx-v-status {
    flex: 1; display: flex; align-items: center; gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    min-height: 36px;
    font-weight: 600;
}
.mx-v-sym {
    font-weight: 800; font-size: 1rem; min-width: 22px; text-align: center;
}
.mx-v-label { font-size: .88rem; }
/* 复用 mx-* 状态配色 */
.mx-v-status.mx-none { background: #f9fafb; color: #bfbfbf; }
.mx-v-status.mx-normal { background: #d9f7d9; color: #389e0d; }
.mx-v-status.mx-half { background: #ffe58f; color: #d48806; }
.mx-v-status.mx-rest { background: #ffa39e; color: #cf1322; }
.mx-v-status.mx-personal { background: #ffd591; color: #d4380d; }
.mx-v-status.mx-annual { background: #bae0ff; color: #096dd9; }
.mx-v-status.mx-absent { background: #d3adf7; color: #531dab; }
.mx-v-status.mx-business { background: #ffe58f; color: #d48806; }
.mx-v-status.mx-resigned { background: #d9d9d9; color: #8c8c8c; }
.mx-v-status.mx-late, .mx-v-status.mx-early { background: #fffdf5; color: #92400e; }
.mx-v-status.mx-leave { background: #eef2ff; color: #3730a3; }
.mx-v-status.mx-overtime { background: #eff6ff; color: #1e40af; }

/* ===== 数据库管理面板 ===== */
.db-stat { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); color: #e2e8f0; border-radius: 12px; padding: 22px; }
.db-stat .label { color: #94a3b8; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.db-stat .value { font-size: 1.4rem; font-weight: 700; color: #fff; }
.db-stat .ok { color: #4ade80; }
.db-stat .badge { font-size: .9rem; }

.code-block {
    background: #0f172a; color: #e2e8f0;
    border-radius: 8px; padding: 14px;
    font-family: "Fira Code", "Consolas", monospace;
    font-size: .82rem; overflow-x: auto;
    white-space: pre-wrap;
}

.table-link:hover { text-decoration: underline; }

/* ===== 今日点名 ===== */
.roll-toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.roll-toolbar-row { display: flex; gap: 8px; }
.roll-toolbar-row #r-date { flex: 1 1 135px; min-width: 0; height: 40px; }
.roll-toolbar-row #r-kw { flex: 2 1 120px; min-width: 0; height: 40px; }
.roll-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.roll-chips::-webkit-scrollbar { display: none; }
.roll-chip {
    flex: 0 0 auto;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 18px;
    padding: 5px 14px;
    font-size: .85rem;
    transition: all .12s;
}
.roll-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.roll-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* 顶部部门统计条 */
.roll-dept-stats {
    display: flex; gap: 8px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    padding-bottom: 4px; margin-bottom: 8px;
    scrollbar-width: none;
}
.roll-dept-stats::-webkit-scrollbar { display: none; }
.roll-dept-stats:empty { display: none; }
.rds {
    flex: 0 0 auto;
    display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 14px;
    text-align: left;
    transition: border-color .12s;
}
.rds .rds-name { font-size: .78rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.rds .rds-num { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.rds .rds-num b { font-size: 1.02rem; margin-right: 2px; }
.rds.full { border-color: var(--success); background: #f0fdf4; }
.rds.full .rds-num, .rds.full .rds-name { color: #065f46; }
.rds.full .rds-num b { color: var(--success); }
.rds.part { border-color: var(--primary); background: #eff6ff; }
.rds.part .rds-num b { color: var(--primary); }
.rds.none .rds-num b { color: var(--danger); }
/* 不计入总数的部门(生产管理): 紫色独立显示 */
.rds.exclude { border-color: #ddd6fe; background: #f5f3ff; }
.rds.exclude .rds-name, .rds.exclude .rds-num { color: #6d28d9; }
.rds.exclude .rds-num b { color: #7c3aed; }
.rds.active { box-shadow: 0 0 0 2px var(--primary) inset; }
.roll-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 14px; padding: 4px 12px; font-size: .82rem; }
.roll-pill b { font-size: .95rem; }
.roll-pill.on { background: #ecfdf5; color: #065f46; }
.roll-pill.half { background: #fffbeb; color: #92400e; }
.roll-pill.restp { background: #eef2ff; color: #3730a3; }
.roll-pill.off { background: #f3f4f6; color: #374151; }
.roll-pill.roll-filter { cursor: pointer; user-select: none; transition: box-shadow .12s; }
.roll-pill.roll-filter:hover { box-shadow: 0 0 0 2px rgba(0,0,0,.1) inset; }
.roll-pill.roll-filter.active { box-shadow: 0 0 0 2px var(--danger) inset; font-weight: 600; }

.roll-group { margin-bottom: 16px; }
.roll-group-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 4px; font-weight: 600; color: var(--primary-dark);
}
.roll-group-head small { color: var(--muted); font-weight: 400; margin-left: 8px; font-size: .78rem; }

.roll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 8px; }
.roll-item {
    display: flex; align-items: center; gap: 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    min-height: 60px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    transition: transform .12s, border-color .12s, background .12s;
}
.roll-item:active { transform: scale(.98); }
.roll-item .r-info { flex: 1 1 auto; min-width: 0; }
.roll-item .r-name { font-size: 1rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.roll-item .r-meta { font-size: .75rem; color: var(--muted); line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roll-item .r-badge {
    flex: 0 0 auto;
    font-size: .78rem; font-weight: 500;
    padding: 3px 8px; border-radius: 12px;
    background: #f3f4f6; color: var(--muted);
    white-space: nowrap;
}
/* 状态配色 */
.roll-item.on { border-left-color: var(--success); background: #f0fdf4; }
.roll-item.on .r-badge { background: var(--success); color: #fff; }
.roll-item.half { border-left-color: var(--warning); background: #fffbeb; }
.roll-item.half .r-badge { background: var(--warning); color: #fff; }
/* 休(含预填的年假/事假等归类显示) */
.roll-item.st-rest { border-left-color: #94a3b8; background: #f8fafc; }
.roll-item.st-rest .r-badge { background: #e2e8f0; color: #475569; }
/* 点名按钮布局: 左"休"右"出勤", 中间姓名区点击取消 */
.roll-item { cursor: default; }
.roll-item .r-main { flex: 1 1 auto; min-width: 0; cursor: pointer; }
.roll-item .r-btn {
    flex: 0 0 auto;
    min-width: 46px; padding: 6px 9px;
    border: 1px solid transparent; border-radius: 8px;
    font-size: .8rem; font-weight: 600; line-height: 1.2;
    cursor: pointer; user-select: none; -webkit-user-select: none;
    transition: background .12s, filter .12s, transform .12s;
}
.roll-item .r-btn:active { transform: scale(.95); }
.roll-item .r-btn-on { background: var(--success); color: #fff; }
.roll-item .r-btn-on:hover { filter: brightness(1.08); }
.roll-item .r-btn-rest { background: #f1f5f9; color: #475569; }
.roll-item .r-btn-rest:hover { background: #e2e8f0; }
.roll-item.st-late, .roll-item.st-early { border-left-color: var(--warning); background: #fffdf5; }
.roll-item.st-late .r-badge, .roll-item.st-early .r-badge { background: #fef3c7; color: #92400e; }
.roll-item.st-leave, .roll-item.st-business { border-left-color: #6366f1; background: #eef2ff; }
.roll-item.st-leave .r-badge, .roll-item.st-business .r-badge { background: #e0e7ff; color: #3730a3; }
.roll-item.st-absent { border-left-color: var(--danger); background: #fef2f2; }
.roll-item.st-absent .r-badge { background: #fee2e2; color: #991b1b; }
.roll-item.st-overtime { border-left-color: var(--primary); background: #eff6ff; }
.roll-item.st-overtime .r-badge { background: #dbeafe; color: #1e40af; }

/* ============================================================
   响应式: 平板/手机 (≤991px) — 隐藏边栏, 显示返回按钮+头像
   ============================================================ */
@media (max-width: 991.98px) {
    .app-sidebar { display: none; }
    .app-topbar { margin-left: 0; padding: 0 14px; }
    .app-main { margin-left: 0; padding: 16px 14px; }
}

/* ============================================================
   响应式: 手机 H5 (<=768px)
   - 表单/表格/弹窗 H5 优化
   ============================================================ */
@media (max-width: 768px) {
    :root { --topbar-h: 52px; }
    body { font-size: 13px; }

    /* 顶栏手机端紧凑 */
    .topbar-title { font-size: 1rem; }
    .topbar-back { width: 36px; height: 36px; font-size: 1.1rem; }
    .topbar-avatar { width: 32px; height: 32px; font-size: .82rem; }

    /* 内容卡片间距 */
    .content-card { padding: 14px; border-radius: 12px; }
    .stat-card .value { font-size: 1.3rem; }
    .page-title { font-size: 1.08rem; margin-bottom: 14px; }

    /* 筛选栏: 全宽, 大触控 */
    .filter-bar { padding: 12px; border-radius: 12px; }
    .filter-bar .form-control, .filter-bar .form-select {
        min-width: 0; flex: 1 1 42%; height: 42px;
        font-size: .92rem;
    }
    .filter-bar .btn { flex: 1 1 28%; height: 42px; font-size: .9rem; }
    .filter-bar .btn-hr { flex: 1 1 100%; }

    /* 标签页: 横向滚动 */
    .nav-tabs {
        flex-wrap: nowrap; overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-link { white-space: nowrap; padding: .55rem .9rem; font-size: .92rem; }
    .nav-tabs .nav-link.active { font-weight: 600; }

    /* 点名: 手机单列大触控行 */
    .roll-toolbar { position: sticky; top: var(--topbar-h); z-index: 100; background: var(--bg); padding: 4px 0 8px; margin-bottom: 6px; }
    .roll-grid { grid-template-columns: 1fr; gap: 8px; }
    .roll-item { min-height: 64px; padding: 12px 14px; border-radius: 12px; }
    .roll-item .r-name { font-size: 1.08rem; }
    .roll-item .r-badge { font-size: .82rem; padding: 4px 12px; }
    .roll-item .r-btn { min-width: 64px; padding: 11px 14px; font-size: .92rem; border-radius: 10px; }
    .roll-group-head { font-size: 1rem; }
    .roll-chip { padding: 6px 16px; font-size: .88rem; }

    /* 表格手机紧凑 */
    table.data-table { font-size: .82rem; }
    .table > :not(caption) > * > * { padding: 9px 7px; }
    .table-responsive { -webkit-overflow-scrolling: touch; }

    /* 弹窗手机: 全宽底部抽屉式 */
    .modal { padding-right: 0 !important; }
    .modal-dialog {
        margin: 0;
        padding: 0;
        max-width: 100%;
        position: fixed;
        bottom: 0; top: auto;
        left: 0; right: 0;
        transform: translateY(100%);
        transition: transform .28s ease;
    }
    .modal.show .modal-dialog { transform: translateY(0); }
    .modal-content {
        border-radius: 18px 18px 0 0;
        max-height: 92vh;
        max-height: 92dvh;
        overflow: auto;
        box-shadow: 0 -8px 30px rgba(15,23,42,.18);
    }
    .modal-content::before {
        content: ''; display: block; width: 38px; height: 4px;
        background: #cbd5e1; border-radius: 4px;
        margin: 8px auto 0;
    }
    .modal-header { padding: 12px 16px; }
    .modal-title { font-size: 1rem; font-weight: 700; }
    .modal-body { padding: 14px 16px; }
    .modal-footer { padding: 12px 16px; gap: 8px; }
    .modal-footer .btn { flex: 1; height: 44px; font-size: .95rem; }
    .modal-footer .btn-secondary { background: var(--bg-soft); color: var(--text); border: 1px solid var(--border); }

    /* 大弹窗 (modal-lg) 同样底部抽屉 */
    .modal-dialog.modal-lg,
    .modal-dialog.modal-sm {
        margin: 0;
        max-width: 100%;
    }

    /* Toast 占满宽度 */
    .toast {
        left: 12px; right: 12px; top: calc(var(--topbar-h) + 8px);
        min-width: 0; max-width: none;
        border-radius: 12px;
    }
    .toast-body { font-size: .9rem; padding: 12px 14px; }

    /* 表单输入: 大触控目标 >=44px */
    .form-control, .form-select { height: 44px; font-size: .95rem; border-radius: 10px; }
    .form-control:Focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.16); }
    textarea.form-control { min-height: 70px; }
    .input-group-text { height: 44px; border-radius: 10px 0 0 10px; }
    .input-group .form-control:not(:first-child) { border-radius: 0 10px 10px 0; }

    /* 按钮: 大触控 */
    .btn { min-height: 40px; padding: 8px 14px; font-size: .92rem; }
    .btn-sm { min-height: 32px; padding: 4px 10px; }

    /* 考勤矩阵手机紧凑 */
    .mx-wrap { max-height: 62vh; font-size: .75rem; }
    #mx-table th, #mx-table td { padding: 2px 3px; }
    .mx-sc1 { min-width: 82px; }
    .mx-sc2 { left: 82px; min-width: 54px; }

    /* 分页手机紧凑 */
    .pagination .page-link { min-width: 34px; height: 34px; line-height: 1.2; padding: 6px 8px; }
    .pagination { gap: 2px; }

    /* 卡片间距 */
    .row.g-3 { --bs-gutter-x: 10px; --bs-gutter-y: 10px; }
}

/* ============================================================
   响应式: 小屏手机 (<=575px)
   ============================================================ */
@media (max-width: 575.98px) {
    .content-card { padding: 12px; border-radius: 12px; }
    .page-title { font-size: 1.02rem; }
    .stat-card { padding: 16px; }
    .stat-card .value { font-size: 1.25rem; }
    .stat-card .icon { font-size: 1.8rem; }

    /* 筛选栏: 单列堆叠 */
    .filter-bar .form-control, .filter-bar .form-select { flex: 1 1 100%; }
    .filter-bar .btn { flex: 1 1 100%; }

    /* 模态框底部抽屉, 按钮全宽 */
    .modal-footer { flex-direction: column; }
    .modal-footer .btn { width: 100%; }
}

/* ============================================================
   响应式: 超小屏 (<=380px)
   ============================================================ */
@media (max-width: 380px) {
    body { font-size: 12.5px; }
    .topbar-title { font-size: .9rem; }
}

/* ============================================================
   深色模式 (跟随系统) - 可选, 仅修改部分关键元素
   ============================================================ */
@media (prefers-color-scheme: dark) {
    /* 暂不启用深色模式, 保留明亮蓝色主题以保证生产场景识别度 */
}

/* ============================================================
   人员选择器 / 参会人标签容器 (会议管理 + 培训管理共用)
   ============================================================ */
.emp-tags-box {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2px;
    padding: 6px 10px;
    cursor: default;
}
.emp-tags-box .badge { font-weight: 500; }
.emp-picker-item { cursor: pointer; transition: background .12s; }
.emp-picker-item:hover { background: rgba(30, 91, 181, .06); }
.emp-picker-item .form-check-input { cursor: pointer; }

/* ============================================================
   个人档案页 (仿教育培训个人档案卡)
   ============================================================ */
.archive-field {
    display: flex;
    align-items: center;
    border: 1px solid #e5e9f2;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    min-height: 44px;
}
.archive-label {
    flex: 0 0 5.5em;
    background: #f5f7fb;
    color: #5a6478;
    font-size: .82rem;
    text-align: center;
    padding: 9px 6px;
    border-right: 1px solid #e5e9f2;
}
.archive-value {
    flex: 1;
    padding: 9px 12px;
    font-weight: 600;
    color: #1f2d3d;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-mini {
    background: linear-gradient(135deg, #f5f7fb, #eef2f9);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}
.stat-mini .stat-num { font-size: 1.35rem; font-weight: 700; color: #1e5bb5; line-height: 1.2; }
.stat-mini .stat-label { font-size: .78rem; color: #8792a8; margin-top: 2px; }

/* ============================================================
   考试答题页
   ============================================================ */
.exam-sticky { position: sticky; top: 12px; z-index: 10; }
.exam-timer {
    font-size: 1.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #1e5bb5;
    letter-spacing: 1px;
}
.exam-option {
    border: 1px solid #e5e9f2;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: all .15s;
    margin-bottom: 4px;
}
.exam-option:hover { border-color: #1e5bb5; background: rgba(30, 91, 181, .04); }
.exam-option.checked { border-color: #1e5bb5; background: rgba(30, 91, 181, .08); }
