/* ============================================
   考勤管理系统 - 样式表
   支持桌面版 + 手机网页版自适应
   ============================================ */

/* ---------- 基础重置 ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --entry-color: #059669;
    --entry-bg: #d1fae5;
    --exit-color: #d97706;
    --exit-bg: #fef3c7;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.25s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---------- 顶部导航 ---------- */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.header-logo .icon {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.header-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 同步状态胶囊：绿点=已连本地数据库，橙点=离线 */
.header-badge.sync {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text-muted);
}

.header-badge.sync::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #cbd5e1;
}

.header-badge.sync.ok {
    background: #ecfdf5;
    color: #047857;
}

.header-badge.sync.ok::before {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

.header-badge.sync.off {
    background: #fff7ed;
    color: #b45309;
}

.header-badge.sync.off::before {
    background: #f59e0b;
}

/* ---------- 主容器 ---------- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* ---------- 统计卡片 ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.entry {
    background: var(--entry-bg);
    color: var(--entry-color);
}

.stat-icon.exit {
    background: var(--exit-bg);
    color: var(--exit-color);
}

.stat-icon.people {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon.records {
    background: #fce7f3;
    color: #be185d;
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 4px;
}

/* ---------- 主内容区两列布局 ---------- */
.main-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

/* ---------- 卡片通用 ---------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title .dot {
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.card-body {
    padding: 20px;
}

/* ---------- 图表区 ---------- */
.chart-wrapper {
    position: relative;
    height: 280px;
}

/* ---------- 上传区 ---------- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 18px 22px;
    cursor: pointer;
    transition: var(--transition);
    background: #fafbfc;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-icon {
    font-size: 1.9rem;
    line-height: 1;
    flex-shrink: 0;
}

.upload-copy {
    flex: 1;
    min-width: 0;
}

.upload-text {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 4px;
    font-weight: 500;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.upload-btn {
    display: inline-block;
    margin-top: 0;
    flex-shrink: 0;
    padding: 8px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.upload-btn:hover {
    background: var(--primary-dark);
}

.file-info {
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--entry-bg);
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    color: var(--entry-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 数据库状态条 */
.db-bar {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.db-info {
    line-height: 1.5;
}

.db-info strong {
    color: var(--primary);
}

.db-clear {
    flex: none;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text-muted);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.db-clear:hover {
    color: var(--exit-color);
    border-color: var(--exit-color);
}

/* ---------- 筛选栏 ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 16px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.filter-select,
.filter-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: #fff;
    color: var(--text);
    transition: var(--transition);
    min-width: 120px;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-entry {
    background: var(--entry-color);
    color: #fff;
}

.btn-exit {
    background: var(--exit-color);
    color: #fff;
}

/* ---------- 数据表格 ---------- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr:hover {
    background: #f8fafc;
}

.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-entry {
    background: var(--entry-bg);
    color: var(--entry-color);
}

.tag-exit {
    background: var(--exit-bg);
    color: var(--exit-color);
}

/* ---------- 首尾时间统计表 ---------- */
.summary-table th:nth-child(5) {
    color: var(--entry-color);
}

/* 手机上把日期缩成 月-日，平时只显示完整日期 */
.summary-table .d-short {
    display: none;
}

.summary-table th:nth-child(6) {
    color: var(--exit-color);
}

/* ---------- 首尾时间统计表（桌面自动多栏） ---------- */
.dual-table {
    font-size: 12.6px;
}

.dual-table th,
.dual-table td {
    padding: var(--dual-pad, 7px) 9px;
    line-height: 1.25;
    vertical-align: middle;
}

.dual-table th.col-idx,
.dual-table td.col-idx {
    width: 30px;
    min-width: 30px;
    color: var(--text-muted);
    text-align: center;
}

/* 分栏之间的留白 */
.dual-table .dual-gap {
    width: 16px;
    min-width: 16px;
    padding: 0;
    background: #fff;
    border-bottom: none;
}

/* 有出厂 / 未出厂两组之间的分隔 */
.dual-table .dual-gap.group-gap {
    width: 20px;
    min-width: 20px;
    border-left: 2px solid #cbd5e1;
}

.dual-table th.th-in {
    color: var(--entry-color);
}

.dual-table th.th-out {
    color: var(--exit-color);
}

.dual-table td.cell-in {
    color: var(--entry-color);
    font-weight: 600;
}

.dual-table td.cell-out {
    color: var(--exit-color);
    font-weight: 600;
}

/* ---------- 月度统计（1-31 日整月表） ---------- */
.month-tip {
    font-size: 0.78rem;
    color: var(--text-muted);
    align-self: center;
}

.month-wrap {
    overflow: auto;
    max-height: calc(100vh - 250px);
    border-radius: var(--radius-sm);
}

.month-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    font-size: 12px;
    --m-seq-w: 40px;
    --m-name-w: 116px;
    --m-day-font: 11px;
    --m-head-font: 10px;
    --m-name-font: 12px;
}

.month-table th,
.month-table td {
    padding: 4px 2px;
    text-align: center;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.month-table thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: #f8fafc;
    font-size: var(--m-head-font);
    padding: 5px 2px;
}

.month-table th.m-seq,
.month-table td.m-seq {
    position: sticky;
    left: 0;
    width: var(--m-seq-w);
    z-index: 2;
    background: #fff;
    color: var(--text-muted);
}

/* 窄窗口（<900px）隐藏序号，把宽度让给日期列 */
.month-table.m-narrow th.m-seq,
.month-table.m-narrow td.m-seq {
    display: none;
}

.month-table th.m-name,
.month-table td.m-name {
    position: sticky;
    left: var(--m-seq-w);
    width: var(--m-name-w);
    z-index: 2;
    background: #fff;
    text-align: left;
    padding-left: 8px;
    padding-top: 5px;
    vertical-align: middle;
    line-height: 1.3;
    font-weight: 600;
    font-size: var(--m-name-font);
    overflow: hidden;
    text-overflow: ellipsis;
}

.month-table.m-narrow th.m-name,
.month-table.m-narrow td.m-name {
    left: 0;
}

.month-table thead th.m-seq,
.month-table thead th.m-name {
    z-index: 4;
    background: #f8fafc;
}

.month-table tbody tr:hover td {
    background: #f8fafc;
}

.month-table tbody tr:hover td.m-seq,
.month-table tbody tr:hover td.m-name {
    background: #f1f5f9;
}

.month-table .day-cell span {
    display: block;
    font-size: var(--m-day-font);
    line-height: 1.45;
}

.month-table .day-cell .m-in {
    color: var(--entry-color);
    font-weight: 600;
}

.month-table .day-cell .m-out {
    color: var(--exit-color);
    font-weight: 600;
}

.month-table .m-weekend {
    background: #fafafa;
}

.month-table .m-today {
    background: #eff6ff;
}

/* 月度分组分隔线：有出厂 / 未出厂之间 */
.month-table tbody tr.m-group-start td {
    border-top: 2px solid #cbd5e1;
}

/* 上传卡片自成一行 */
.upload-card {
    margin-bottom: 24px;
}

/* 查看首尾统计时收起上传卡片，把整屏高度让给表格 */
body.summary-focus .upload-card {
    display: none;
}

/* 同时放宽容器宽度，宽屏上把表格铺开而不是挤在中间 */
body.summary-focus .container {
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

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

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state .text {
    font-size: 0.9rem;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.825rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 8px;
}

/* ---------- Toast 提示 ---------- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: transform 0.3s ease;
    max-width: min(92vw, 560px);
    white-space: normal;
    text-align: center;
    line-height: 1.5;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--entry-color);
}

.toast.error {
    background: var(--danger);
}

/* ---------- 标签页 ---------- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ============================================
   响应式 - 平板
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   响应式 - 手机
   ============================================ */
@media (max-width: 640px) {
    .header {
        padding: 0 16px;
        height: 56px;
    }

    .header-logo {
        font-size: 1.05rem;
    }

    .header-logo .icon {
        width: 28px;
        height: 28px;
        font-size: 0.95rem;
    }

    .header-badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .container {
        padding: 12px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px 16px;
        gap: 10px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    .card-header {
        padding: 12px 16px;
    }

    .card-body {
        padding: 14px;
    }

    .chart-wrapper {
        height: 220px;
    }

    .upload-zone {
        flex-direction: column;
        gap: 8px;
        padding: 16px 12px;
        text-align: center;
    }

    .upload-copy {
        flex: none;
    }

    .upload-icon {
        font-size: 1.7rem;
        margin-bottom: 0;
    }

    .upload-text {
        font-size: 0.85rem;
    }

    .upload-btn {
        margin-top: 4px;
    }

    .filter-bar {
        gap: 8px;
    }

    .filter-select,
    .filter-input {
        min-width: 100px;
        font-size: 0.8rem;
        padding: 7px 10px;
    }

    .btn {
        padding: 7px 14px;
        font-size: 0.8rem;
    }

    thead th,
    tbody td {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab {
        padding: 8px 14px;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}

/* ============================================
   刘海屏安全区适配
   ============================================ */
@supports (padding-top: env(safe-area-inset-top)) {
    .header {
        height: calc(64px + env(safe-area-inset-top));
        padding-top: env(safe-area-inset-top);
    }

    .container {
        padding-bottom: calc(24px + env(safe-area-inset-bottom));
    }

    .toast {
        bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

@media (max-width: 640px) {
    @supports (padding-top: env(safe-area-inset-top)) {
        .header {
            height: calc(56px + env(safe-area-inset-top));
        }

        .container {
            padding-bottom: calc(12px + env(safe-area-inset-bottom));
        }

        .toast {
            bottom: calc(16px + env(safe-area-inset-bottom));
        }
    }

    /* 手机上筛选控件铺满整行，按钮均分，避免挤成一条 */
    .filter-item {
        flex: 1 1 44%;
    }

    .filter-select,
    .filter-input {
        width: 100%;
        min-width: 0;
    }

    .filter-bar .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .page-btn {
        min-width: 40px;
        height: 40px;
    }

    /* 手机上让 5~6 列尽量完整可见，超出时再横向滚动 */
    table {
        min-width: 0;
    }

    .summary-table {
        min-width: 0;
    }

    #recordsTable tbody td:first-child,
    #recordsTable thead th:first-child {
        padding-left: 8px;
        padding-right: 4px;
        width: 34px;
    }

    .tag {
        padding: 2px 6px;
    }

    /* 记录表 5 列定宽，长姓名换行，避免“方向”列被挤出屏幕 */
    #recordsTable table {
        table-layout: fixed;
        width: 100%;
    }

    #recordsTable thead th,
    #recordsTable tbody td {
        padding: 7px 4px;
        font-size: 0.72rem;
    }

    #recordsTable thead th:nth-child(1),
    #recordsTable tbody td:nth-child(1) {
        width: 34px;
    }

    #recordsTable thead th:nth-child(3),
    #recordsTable tbody td:nth-child(3) {
        width: 86px;
    }

    #recordsTable thead th:nth-child(4),
    #recordsTable tbody td:nth-child(4) {
        width: 52px;
    }

    #recordsTable thead th:nth-child(5),
    #recordsTable tbody td:nth-child(5) {
        width: 54px;
    }

    #recordsTable tbody td:nth-child(2) {
        white-space: normal;
        word-break: break-all;
        line-height: 1.25;
    }

    /* 统计表在手机上是 5 列（姓名 / 日期 / 首次进门 / 末次出门 / 在厂时长），
       定宽铺满整行，不产生横向滚动 */
    .summary-table {
        width: 100%;
        table-layout: fixed;
    }

    .summary-table thead th,
    .summary-table tbody td {
        padding: 8px 3px;
        font-size: 0.7rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 手机上不显示序号、班次（班次仍保留在导出的 Excel 里） */
    .summary-table thead th:nth-child(1),
    .summary-table tbody td:nth-child(1),
    .summary-table thead th:nth-child(4),
    .summary-table tbody td:nth-child(4) {
        display: none;
    }

    .summary-table thead th:nth-child(2),
    .summary-table tbody td:nth-child(2) {
        width: 24%;
        white-space: normal;
        word-break: break-all;
        line-height: 1.25;
    }

    .summary-table thead th:nth-child(3),
    .summary-table tbody td:nth-child(3) {
        width: 18%;
    }

    .summary-table thead th:nth-child(5),
    .summary-table tbody td:nth-child(5),
    .summary-table thead th:nth-child(6),
    .summary-table tbody td:nth-child(6) {
        width: 18%;
    }

    .summary-table thead th:nth-child(7),
    .summary-table tbody td:nth-child(7) {
        width: 22%;
    }

    /* 手机日期只显示 月-日，省出宽度给姓名和时长 */
    .summary-table .d-full {
        display: none;
    }

    .summary-table .d-short {
        display: inline;
    }

    /* 未出门的行：手机上只显示“未出门”标签，不再显示占位横线 */
    .summary-table tr.row-noexit .out-time {
        display: none;
    }

    .summary-table tr.row-noexit {
        background: #fffaf0;
    }

    .summary-table .tag {
        display: inline-block;
        padding: 1px 4px;
        font-size: 0.62rem;
        line-height: 1.4;
    }

    /* 统计页收起上传卡片后，让表格贴边铺满 */
    body.summary-focus .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- 滚动条美化 ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

/* ============================================
   月度统计 - 手机端（横向滑动，姓名列固定）
   ============================================ */
@media (max-width: 640px) {
    .month-table {
        width: max-content;
        min-width: 0;
        font-size: 10px;
    }

    .month-table th.m-seq,
    .month-table td.m-seq {
        display: none;
    }

    .month-table th.m-name,
    .month-table td.m-name {
        left: 0;
        width: 68px;
        font-size: 11px;
        padding-left: 6px;
        white-space: normal;
        word-break: break-all;
        line-height: 1.25;
    }

    .month-table thead th,
    .month-table td.day-cell {
        width: 34px;
    }

    .month-table .day-cell span {
        font-size: 9.5px;
    }

    .month-tip {
        display: none;
    }

    .month-wrap {
        max-height: calc(100vh - 130px);
    }
}

/* 单排表的“已出厂 / 未出厂”分段标题（手机和窄窗口） */
.summary-table tr.group-sep td {
    display: table-cell;
    background: #f1f5f9;
    color: #475569;
    font-weight: 600;
    font-size: 0.72rem;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

/* 分段上方复制的表头行（非 sticky，随段落一起滚动） */
.summary-table tr.group-head td {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.summary-table tr.group-head:hover td {
    background: #f8fafc;
}

.summary-table tr.group-head td:nth-child(5) {
    color: var(--entry-color);
}

.summary-table tr.group-head td:nth-child(6) {
    color: var(--exit-color);
}




/* ---------- 登录闸门（手机号白名单） ---------- */
.gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, #dbeafe 0%, #f1f5f9 60%);
}
.gate-card {
    width: 100%;
    max-width: 360px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 32px 24px 24px;
    text-align: center;
}
.gate-logo {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.gate-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; }
.gate-sub { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; }
.gate-input {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    font-size: 1rem;
    letter-spacing: 1px;
    outline: none;
    margin-bottom: 12px;
}
.gate-input:focus { border-color: var(--primary); }
.gate-btn {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}
.gate-btn:disabled { opacity: 0.6; cursor: default; }
.gate-error { color: var(--danger); font-size: 0.85rem; margin-top: 10px; }
.gate-tip { color: var(--text-muted); font-size: 0.75rem; margin-top: 16px; line-height: 1.6; }
