/* ===== CSS Variables ===== */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #DBEAFE;
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --purple: #8B5CF6;
    --purple-light: #EDE9FE;

    --bg: #F1F5F9;
    --bg-card: #FFFFFF;
    --border: #E2E8F0;
    --text: #1E293B;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;

    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Login Page (v2 重设计) ===== */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(1200px 600px at 15% 0%, rgba(59,130,246,.28), transparent 60%),
        radial-gradient(900px 520px at 90% 100%, rgba(139,92,246,.26), transparent 62%),
        linear-gradient(135deg, #1e293b 0%, #334155 55%, #1e293b 100%);
    -webkit-overflow-scrolling: touch;
}

/* 背景装饰光斑 */
.login-bg-deco { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbd {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .45;
}
.lbd-1 { width: 380px; height: 380px; top: -120px; left: -90px; background: #3b82f6; }
.lbd-2 { width: 300px; height: 300px; bottom: -110px; right: -70px; background: #8b5cf6; }
.lbd-3 { width: 220px; height: 220px; top: 46%; left: 58%; background: #06b6d4; opacity: .28; }

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    margin: auto;
}

.login-card {
    background: rgba(255,255,255,.98);
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 20px;
    padding: 36px 32px 30px;
    box-shadow: 0 24px 64px rgba(2,6,23,.42), 0 2px 6px rgba(2,6,23,.16);
    backdrop-filter: blur(10px);
}

.login-header { text-align: center; margin-bottom: 28px; }
.login-logo { margin-bottom: 14px; line-height: 0; }
.login-logo svg { border-radius: 12px; box-shadow: 0 8px 20px rgba(59,130,246,.32); }
.login-header h1 { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: .2px; }
.login-header p {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 6px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* --- 表单字段：label 独立一行，输入框不再被图标压住 --- */
.lf-field { margin-bottom: 18px; }

.lf-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.lf-input-wrap {
    position: relative;
    display: block;
}

.lf-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color .18s;
    flex-shrink: 0;
}

/* 关键：left padding 足够大 + 图标绝对定位，文字/占位符不会被图标盖住 */
.lf-input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 1.5px solid var(--border);
    border-radius: 11px;
    background: #f8fafc;
    font-size: 15px;
    line-height: 48px;
    color: var(--text);
    outline: none;
    transition: border-color .18s, background .18s, box-shadow .18s;
    -webkit-appearance: none;
    appearance: none;
}

/* 有密码显隐按钮时右侧留出空间 */
.lf-input-wrap:has(.lf-eye) .lf-input { padding-right: 46px; }
#password.lf-input { padding-right: 46px; }

.lf-input::placeholder { color: #b6c1d0; font-size: 14px; }

.lf-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59,130,246,.14);
}
.lf-input-wrap:focus-within .lf-input-icon { color: var(--primary); }

/* 密码显隐 */
.lf-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background .16s, color .16s;
}
.lf-eye:hover { background: #eef2f7; color: var(--text-secondary); }

/* --- 记住登录：自绘方框，彻底避免原生 checkbox 与文字挤压 --- */
.lf-options {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin: 2px 0 22px;
}
.lf-check-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.4;
    user-select: none;
}

.lf-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    line-height: 1;
}
.lf-check input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}
.lf-check-box {
    width: 19px;
    height: 19px;
    flex: 0 0 19px;
    border-radius: 6px;
    border: 1.5px solid #cbd5e1;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background .16s, border-color .16s, box-shadow .16s;
}
.lf-check-box svg { opacity: 0; transform: scale(.6); transition: opacity .14s, transform .14s; }
.lf-check input[type="checkbox"]:checked + .lf-check-box {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(59,130,246,.35);
}
.lf-check input[type="checkbox"]:checked + .lf-check-box svg { opacity: 1; transform: scale(1); }
.lf-check input[type="checkbox"]:focus-visible + .lf-check-box {
    box-shadow: 0 0 0 3px rgba(59,130,246,.28);
}
.lf-check-text { white-space: nowrap; }

/* --- 提交按钮 --- */
.lf-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 11px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    font-size: 15.5px;
    font-weight: 600;
    letter-spacing: .12em;
    cursor: pointer;
    box-shadow: 0 10px 24px -8px rgba(37,99,235,.7);
    transition: transform .14s, box-shadow .18s, filter .18s;
    -webkit-tap-highlight-color: transparent;
}
.lf-submit:hover { filter: brightness(1.05); box-shadow: 0 14px 28px -8px rgba(37,99,235,.78); }
.lf-submit:active { transform: translateY(1px) scale(.995); }
.lf-submit:disabled { opacity: .68; cursor: not-allowed; transform: none; }
.lf-submit-arrow { transition: transform .18s; opacity: .9; }
.lf-submit:hover .lf-submit-arrow { transform: translateX(3px); }

/* 页脚说明（替代原「默认账号」提示） */
.login-footer-note {
    margin-top: 18px;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,.62);
    letter-spacing: .02em;
}

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 16px;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-text { background: none; color: var(--primary); padding: 6px 12px; }
.btn-text:hover { background: var(--primary-light); }

.btn-block { width: 100%; }

.btn-sm { padding: 6px 14px; font-size: 13px; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover { background: var(--bg); color: var(--text); }

/* ===== Main Layout ===== */
.main-app { display: flex; min-height: 100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info { display: flex; align-items: center; gap: 10px; }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-details { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ===== Sidebar Overlay (mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Top Bar ===== */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 700; }

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.current-date {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 8px;
    transition: background 0.15s;
    user-select: none;
}
.current-date:hover { background: var(--bg-secondary); }
.clock-date { color: var(--text-secondary); }
.clock-time {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: 1px;
    min-width: 60px;
    text-align: right;
}

/* ===== Calendar Popup ===== */
.calendar-popup {
    position: fixed;
    z-index: 9999;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 16px;
    width: 280px;
    display: none;
}
.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.cal-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-primary);
}
.cal-nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}
.cal-nav:hover { background: var(--bg-secondary); color: var(--primary); }
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 6px;
}
.cal-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 0;
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-day, .cal-empty {
    text-align: center;
    padding: 6px 2px;
    font-size: 13px;
    border-radius: 6px;
    cursor: default;
    line-height: 1.4;
    color: var(--text-primary);
}
.cal-day:hover { background: var(--bg-secondary); }
.cal-weekend { color: #EF4444; }
.cal-today {
    background: var(--primary) !important;
    color: white !important;
    font-weight: 700;
    border-radius: 6px;
}
.cal-footer {
    display: flex;
    justify-content: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}
.cal-today-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 16px;
    font-size: 12px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    transition: background 0.15s;
}
.cal-today-btn:hover { background: #EFF6FF; }

/* ===== Page Content ===== */
.page-content { flex: 1; padding: 24px; }

.page { display: none; }
.page.active { display: block; }

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}

.stat-blue { border-left-color: var(--primary); }
.stat-green { border-left-color: var(--success); }
.stat-orange { border-left-color: var(--warning); }
.stat-purple { border-left-color: var(--purple); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-blue .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-purple .stat-icon { background: var(--purple-light); color: var(--purple); }

.stat-info { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 13px; color: var(--text-secondary); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== Cards ===== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

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

.card-header h3 { font-size: 15px; font-weight: 600; }

.card-body { padding: 20px; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
}

/* ===== Recent List ===== */
.recent-list { max-height: 320px; overflow-y: auto; }

.recent-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.recent-item:last-child { border-bottom: none; }

.recent-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.recent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}

.recent-name { font-weight: 500; font-size: 14px; }
.recent-meta { font-size: 12px; color: var(--text-muted); }
.recent-text { display: flex; flex-direction: column; gap: 2px; }
.recent-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.recent-date { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }

/* ===== Chart ===== */
.chart-container { min-height: 200px; display: flex; flex-direction: column; gap: 12px; }

.chart-bar-item { display: flex; align-items: center; gap: 12px; }

.chart-label { width: 80px; font-size: 13px; color: var(--text-secondary); text-align: right; flex-shrink: 0; }

.chart-bar {
    flex: 1;
    height: 24px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.chart-value { width: 40px; font-size: 13px; font-weight: 600; color: var(--text); flex-shrink: 0; }

/* ===== Log List ===== */
.log-list { max-height: 240px; overflow-y: auto; }

.log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.log-item:last-child { border-bottom: none; }

.log-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.log-text { flex: 1; color: var(--text-secondary); }
.log-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.log-detail-cell { color: var(--text-secondary); word-break: break-all; max-width: 360px; }

/* ===== Page Toolbar ===== */
.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: white;
    min-width: 260px;
    transition: border-color 0.2s;
}

.search-box:focus-within { border-color: var(--primary); }

.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-box input {
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    background: transparent;
}

select {
    padding: 8px 32px 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

select:focus { border-color: var(--primary); }

/* ===== Data Table ===== */
.table-container { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table thead { background: #F8FAFC; }

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover { background: #F8FAFC; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* 表格操作按钮 */
.btn-link { background: none; border: none; color: #3b82f6; cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 4px; }
.btn-link:hover { background: #eff6ff; text-decoration: underline; }
.btn-link.danger { color: #dc2626; }
.btn-link.danger:hover { background: #fef2f2; }
.btn-link.success { color: #16a34a; }
.btn-link.success:hover { background: #f0fdf4; }

.table-sm .data-table th, .table-sm .data-table td { padding: 8px 12px; font-size: 12px; }

.empty-text { color: var(--text-muted); text-align: center; padding: 32px 16px !important; }

/* 体检预约 - 核销区 */
.verify-card { border-left: 4px solid #3b82f6; margin-bottom: 16px; background: linear-gradient(90deg, rgba(59,130,246,0.06), transparent); }
.verify-title { font-weight: 600; margin-bottom: 12px; font-size: 15px; }
.verify-row { display: flex; gap: 10px; }
.verify-row input { flex: 1; padding: 12px 14px; font-size: 16px; border: 1px solid #e2e8f0; border-radius: 8px; }
.verify-result { margin-top: 12px; font-size: 14px; min-height: 20px; }
.verify-result.ok { color: #16a34a; font-weight: 600; }
.verify-result.err { color: #dc2626; font-weight: 600; }
.verify-result.info { color: #64748b; }

/* 体检预约 - 批量预约区 */
.batch-card { border-left: 4px solid #10b981; margin-bottom: 16px; background: linear-gradient(90deg, rgba(16,185,129,0.06), transparent); }
.batch-title { font-weight: 600; margin-bottom: 12px; font-size: 15px; }
.batch-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.batch-row input { flex: 1; min-width: 260px; padding: 12px 14px; font-size: 16px; border: 1px solid #e2e8f0; border-radius: 8px; }
.batch-hint { color: #64748b; font-size: 13px; }
.batch-summary { margin: 14px 0 8px; font-size: 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.batch-all { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
.batch-msg { font-size: 13px; color: #64748b; }

.appt-paste-box { background: #f8fafc; border: 1px dashed #cbd5e1; border-radius: 10px; padding: 14px; margin-bottom: 18px; }
.appt-paste-box textarea { background: #fff; resize: vertical; }
.appt-paste-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.batch-empty { color: #64748b; font-size: 14px; padding: 12px 4px; }
#batchTable input[type="text"], #batchTable input[type="date"], #batchTable select {
    padding: 6px 8px; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 6px; width: 100%; box-sizing: border-box;
}
#batchTable input.batch-branch { min-width: 130px; }
#batchTable input.batch-date { min-width: 130px; }
#batchTable input.batch-examname { min-width: 90px; }
#batchTable input.batch-idcard { min-width: 160px; }
#batchTable input.batch-phone { min-width: 120px; }
#batchTable select.batch-gender { min-width: 100px; }
#batchTable input.batch-notes { min-width: 150px; }
/* 证件核验性别：只读结果块（浅黄底），与可手动更正的「男女已婚」下拉区分 */
.batch-idgender-val { display: inline-block; min-width: 56px; padding: 5px 10px; border-radius: 6px; background: #fffbeb; color: #92400e; font-size: 13px; font-weight: 600; text-align: center; }
.batch-idgender-val.idg-none { background: #f1f5f9; color: #94a3b8; font-weight: 400; }
#batchTable select.batch-gender.gender-mismatch { border-color: #f59e0b; background: #fffbeb; }
.id-gender-tag { display: inline-block; padding: 2px 8px; border-radius: 5px; background: #fef3c7; color: #92400e; font-size: 12px; }
.id-gender-tag.idg-bad { background: #fee2e2; color: #b91c1c; }
.id-gender-tag.idg-warn { background: #fef3c7; color: #92400e; }

/* 身份证合法性核验：输入框着色 + 核验列状态提示 */
#batchTable input.batch-idcard.idc-ok { border-color: #86efac; background: #f0fdf4; }
#batchTable input.batch-idcard.idc-bad { border-color: #f87171; background: #fef2f2; }
#batchTable input.batch-idcard.idc-warn { border-color: #fcd34d; background: #fffbeb; }
.batch-idverify-cell { min-width: 132px; }
.batch-idmsg { font-size: 11px; line-height: 1.4; margin-top: 3px; white-space: nowrap; }
.idmsg-ok { color: #16a34a; }
.idmsg-bad { color: #dc2626; font-weight: 600; }
.idmsg-warn { color: #b45309; }
.idmsg-empty { color: #94a3b8; }
#batchTable td { vertical-align: middle; }

/* 批量预约 - 统一备注工具 */
.batch-common-note { display: inline-flex; align-items: center; gap: 6px; }
.batch-common-note input { min-width: 200px; padding: 6px 10px; font-size: 13px; border: 1px solid #e2e8f0; border-radius: 6px; }

/* 预约列表 - 备注列（超长省略，hover 看全文） */
.appt-notes-cell { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #475569; }

/* 体检预约页 - 输入框「名称 + 用途」标注（作用域限定，避免影响其它页面） */
#page-appointments .batch-field { flex: 1; min-width: 320px; }
#page-appointments .batch-field-line { display: flex; gap: 10px; align-items: center; }
#page-appointments .batch-field-line input { flex: 1; min-width: 200px; }
#page-appointments .toolbar-left, #page-appointments .toolbar-right { align-items: flex-start; }
#page-appointments .toolbar-field { display: flex; flex-direction: column; gap: 5px; }
#page-appointments .toolbar-field .search-box { min-width: 240px; }
#page-appointments .toolbar-field select { min-width: 150px; }
.field-tag { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; margin-right: 8px; vertical-align: middle; }
.field-tag-green { background: #d1fae5; color: #047857; }
.field-cap { display: block; font-size: 12px; font-weight: 600; color: #0f766e; line-height: 1.5; }
.field-cap-inline { display: inline; margin: 0 4px 0 0; }
.field-usage { font-size: 12px; color: #64748b; line-height: 1.6; }
.batch-common-note .field-cap { color: #475569; }

/* ===== 体检预约页 · 分区卡片式 UI（①~⑥：emoji 图标 + 圆形编号 + 独立色块）===== */
.appt-hero { padding: 18px 20px 16px; }
.appt-hero-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 14px; padding-bottom: 12px;
    border-bottom: 1px dashed rgba(16,185,129,.35);
}
.hero-icon {
    width: 38px; height: 38px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; border-radius: 10px;
    background: #d1fae5; border: 1px solid #a7f3d0;
}
/* 圆形数字徽章：--tool 由所在卡片继承，故 2/3/4/5 自动跟随各自主题色 */
.step-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; flex-shrink: 0;
    border-radius: 50%; background: var(--tool, #3b82f6); color: #fff;
    font-size: 12px; font-weight: 800; line-height: 1;
    box-shadow: 0 1px 3px rgba(15,23,42,.18);
}
.step-badge-green { --tool: #10b981; }
.step-badge-teal  { --tool: #0d9488; }
.hero-head-text { flex: 1; min-width: 0; }
.hero-title { font-size: 16px; font-weight: 700; color: #065f46; }
.hero-sub { font-size: 12.5px; color: #64748b; margin-top: 2px; }
.hero-pill {
    font-size: 11px; font-weight: 700; color: #047857;
    background: #d1fae5; border: 1px solid #a7f3d0;
    padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}

/* 快捷工具区标题（把 ① 主操作区 与 ②~⑤ 工具区在视觉上分层） */
.appt-tools { margin-bottom: 16px; }
.appt-tools-head { display: flex; align-items: center; gap: 8px; margin: 0 0 11px 2px; }
.tools-head-icon { font-size: 16px; }
.tools-head-title { font-size: 14px; font-weight: 700; color: #334155; }
.tools-head-sub { font-size: 12px; color: #94a3b8; }
.appt-tools-head::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #e2e8f0, transparent); margin-left: 6px; }

/* 4 张互相独立的彩色卡片 */
.tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tool-card {
    --tool: #3b82f6; --tool-soft: #eff6ff; --tool-line: #bfdbfe; --tool-ink: #1d4ed8;
    background: #fff; border: 1px solid #e2e8f0; border-top: 3px solid var(--tool);
    border-radius: 12px; padding: 14px 14px 12px;
    display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
    transition: transform .18s ease, box-shadow .18s ease;
}
.tool-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,.11); }
.tool-blue   { --tool: #3b82f6; --tool-soft: #eff6ff; --tool-line: #bfdbfe; --tool-ink: #1d4ed8; }
.tool-purple { --tool: #8b5cf6; --tool-soft: #f5f3ff; --tool-line: #ddd6fe; --tool-ink: #6d28d9; }
.tool-amber  { --tool: #f59e0b; --tool-soft: #fffbeb; --tool-line: #fde68a; --tool-ink: #b45309; }
.tool-indigo { --tool: #6366f1; --tool-soft: #eef2ff; --tool-line: #c7d2fe; --tool-ink: #4338ca; }

.tool-card-head { display: flex; align-items: center; gap: 9px; }
.tool-icon {
    width: 34px; height: 34px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; border-radius: 9px;
    background: var(--tool-soft); border: 1px solid var(--tool-line);
}
.tool-title-wrap { flex: 1; min-width: 0; }
.tool-title { font-size: 13.5px; font-weight: 700; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tool-kicker { font-size: 11px; color: #94a3b8; margin-top: 1px; }

.tool-body { display: flex; align-items: center; gap: 8px; min-height: 38px; }
#page-appointments .tool-body .search-box { min-width: 0; width: 100%; flex: 1; box-sizing: border-box; }
#page-appointments .tool-body select { width: 100%; min-width: 0; box-sizing: border-box; }
.tool-action { width: 100%; justify-content: center; box-sizing: border-box; }

.tool-foot {
    font-size: 11.5px; line-height: 1.55; color: #64748b;
    background: var(--tool-soft); border: 1px solid var(--tool-line);
    border-radius: 7px; padding: 7px 9px;
}
.tool-foot b { color: var(--tool-ink); }

/* ⑥ 统一备注：与卡片同一套编号徽章，青色 chip */
.common-note-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #f0fdfa; border: 1px solid #99f6e4;
    border-radius: 8px; padding: 4px 8px 4px 6px; vertical-align: middle;
}
.cn-emoji { font-size: 14px; }
.cn-label { font-size: 12px; font-weight: 700; color: #0f766e; white-space: nowrap; }

@media (max-width: 1280px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
    .tool-grid { grid-template-columns: 1fr; }
    .appt-hero-head { flex-wrap: wrap; }
    .hero-pill { display: none; }
}

/* ===== 预约名单页 · 分区卡片式筛选 UI ===== */
#page-apptlist .roster-card { padding: 0; }
#page-apptlist .table-wrap { margin: 0 20px 20px; }
#page-apptlist #apptImportResult { margin-left: 20px; margin-right: 20px; }
.roster-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid #e2e8f0;
}
.roster-heading { display: flex; align-items: center; gap: 11px; }
.roster-title-icon {
    width: 38px; height: 38px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; border-radius: 10px;
    background: #eef2ff; border: 1px solid #c7d2fe;
}
.roster-heading h3 { margin: 0; font-size: 16px; font-weight: 700; color: #0f172a; }
.roster-subtitle { font-size: 12px; color: #64748b; margin-top: 2px; }
.roster-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.roster-action-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.roster-action-divider { width: 1px; height: 24px; background: #e2e8f0; }
.roster-actions .btn { white-space: nowrap; }

.roster-filters { padding: 16px 20px 0; }
.roster-filter-title { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.roster-filter-title .rft-main { font-size: 13px; font-weight: 700; color: #334155; }
.roster-filter-title .rft-tip { font-size: 12px; color: #94a3b8; }
.roster-filter-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #e2e8f0, transparent); margin-left: 6px; }

.roster-filter-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.roster-filter-card {
    --rc: #0d9488; --rc-soft: #f0fdfa; --rc-line: #99f6e4; --rc-ink: #0f766e;
    background: #fff; border: 1px solid #e2e8f0; border-top: 3px solid var(--rc);
    border-radius: 12px; padding: 13px 14px;
    display: flex; flex-direction: column; gap: 10px;
    box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.rfc-teal   { --rc: #0d9488; --rc-soft: #f0fdfa; --rc-line: #99f6e4; --rc-ink: #0f766e; }
.rfc-blue   { --rc: #3b82f6; --rc-soft: #eff6ff; --rc-line: #bfdbfe; --rc-ink: #1d4ed8; }
.rfc-violet { --rc: #8b5cf6; --rc-soft: #f5f3ff; --rc-line: #ddd6fe; --rc-ink: #6d28d9; }

.rfc-head { display: flex; align-items: center; gap: 9px; }
.rfc-icon {
    width: 34px; height: 34px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px; border-radius: 9px;
    background: var(--rc-soft); border: 1px solid var(--rc-line);
}
.rfc-head-text { flex: 1; min-width: 0; }
.rfc-title { font-size: 13.5px; font-weight: 700; color: #0f172a; }
.rfc-kicker { font-size: 11px; color: #94a3b8; margin-top: 1px; }
.rfc-tag {
    font-size: 11px; font-weight: 700; color: var(--rc-ink);
    background: var(--rc-soft); border: 1px solid var(--rc-line);
    padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.rfc-tag-main { background: var(--rc); color: #fff; border-color: var(--rc); }

.rfc-body { display: flex; align-items: center; gap: 7px; min-height: 38px; }
#page-apptlist .rfc-body input[type="date"] {
    flex: 1; min-width: 0; width: 100%; box-sizing: border-box;
    padding: 7px 8px; font-size: 13px;
    border: 1px solid #e2e8f0; border-radius: 7px;
}
#page-apptlist .rfc-body select { flex: 1; min-width: 0; width: 100%; box-sizing: border-box; }
.rfc-sep { font-size: 12px; color: #64748b; flex-shrink: 0; }
.rfc-foot {
    font-size: 11.5px; line-height: 1.5; color: #64748b;
    background: var(--rc-soft); border: 1px solid var(--rc-line);
    border-radius: 7px; padding: 7px 9px;
}
.rfc-foot b { color: var(--rc-ink); }

.roster-result-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin: 14px 0 16px; padding: 9px 13px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
}
.roster-result-left { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #475569; }
.roster-result-icon { font-size: 15px; }
.roster-count { font-weight: 600; color: #334155; }

@media (max-width: 1200px) { .roster-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
    .roster-filter-grid { grid-template-columns: 1fr; }
    .roster-header { align-items: flex-start; }
    .roster-action-divider { display: none; }
}
.appt-export-hint { font-size: 11px; color: #b45309; white-space: nowrap; }

/* 预约备注：粘贴图片自动上传 + 缩略图 */
.batch-note-cell { min-width: 170px; }
.batch-note-imgs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.batch-note-img { position: relative; display: inline-flex; }
.batch-note-img img { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; border: 1px solid #e2e8f0; cursor: zoom-in; }
.batch-note-img button { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; line-height: 14px; padding: 0; border: none; border-radius: 50%; background: #ef4444; color: #fff; font-size: 12px; cursor: pointer; }
.appt-note-imgs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.appt-note-thumb { width: 28px; height: 28px; object-fit: cover; border-radius: 4px; border: 1px solid #e2e8f0; cursor: zoom-in; }
.field-hint { color: #94a3b8; font-size: 12px; font-weight: 400; }
#appointmentModal .appt-note-imgs { margin-top: 6px; }

/* 预约列表空态：客户档案回查结果 */
.appt-empty-tip { font-size: 13px; color: #64748b; line-height: 1.8; margin-bottom: 8px; }
.appt-hint-table { margin-top: 8px; font-size: 13px; min-width: 620px; }
.appt-hint-table th, .appt-hint-table td { padding: 6px 10px; }

/* 客户管理页 - 同单位名单面板 */
.unit-members-panel {
    border-left: 4px solid #3b82f6;
    margin-bottom: 16px;
    background: linear-gradient(90deg, rgba(59,130,246,0.06), transparent);
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
}
.ump-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
}
.ump-header-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.ump-header strong { color: #1e293b; }
.ump-header .ump-sub-count { color: #94a3b8; font-size: 12px; font-weight: 400; }
.ump-title { font-size: 15px; color: #1e293b; }
.ump-close { margin-left: auto; }

/* 单位级信息汇总网格（顶部摘要框） */
.ump-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 8px;
    background: #fff;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    padding: 10px 12px;
}
.ump-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    min-width: 0;
    padding: 4px 6px;
    border-radius: 6px;
    background: #f8fafc;
    border-left: 3px solid #bfdbfe;
}
.ump-info-ico { flex: none; font-size: 13px; line-height: 1; }
.ump-info-label {
    flex: none;
    color: #64748b;
    font-size: 12px;
    white-space: nowrap;
}
.ump-info-label::after { content: '：'; }
.ump-info-val {
    color: #0f172a;
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* 状态统计条目独占一行，含多个彩色 chip */
.ump-info-status { grid-column: 1 / -1; border-left-color: #a5b4fc; }
.ump-info-status .ump-info-val { overflow: visible; white-space: normal; }
.ump-st-wrap { display: flex; flex-wrap: wrap; gap: 6px; }
.ump-st {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
}
.ump-st-appointed { background: #dcfce7; color: #15803d; }
.ump-st-unused    { background: #f1f5f9; color: #475569; }
.ump-st-refunded  { background: #fee2e2; color: #b91c1c; }
.ump-st-other     { background: #fef3c7; color: #b45309; }
.unit-members-panel .data-table th,
.unit-members-panel .data-table td {
    padding: 8px 12px;
    font-size: 13px;
}

/* 核销区客户信息卡片 */
.verify-customer-info {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 10px;
    font-size: 14px;
}
.vci-name {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}
.vci-name strong { font-size: 16px; color: #1e293b; }
.vci-phone { color: #64748b; font-size: 13px; }
.vci-detail { color: #475569; line-height: 1.6; }
.vci-action {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
    font-size: 13px;
    color: #64748b;
}

/* ===== Status Badge ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-booked { background: var(--primary-light); color: var(--primary); }
.status-checked { background: var(--success-light); color: var(--success); }
.status-report { background: var(--purple-light); color: var(--purple); }
.status-pending { background: var(--warning-light); color: var(--warning); }
.status-cancelled { background: var(--danger-light); color: var(--danger); }

/* ===== Pagination ===== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-btns { display: flex; gap: 4px; }

.page-btn {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Action Buttons ===== */
.action-btns { display: flex; gap: 4px; }

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn-view { background: var(--primary-light); color: var(--primary); }
.action-btn-view:hover { background: var(--primary); color: white; }
.action-btn-edit { background: var(--success-light); color: var(--success); }
.action-btn-edit:hover { background: var(--success); color: white; }
.action-btn-del { background: var(--danger-light); color: var(--danger); }
.action-btn-del:hover { background: var(--danger); color: white; }
.action-btn-pwd { background: #fef3c7; color: #b45309; }
.action-btn-pwd:hover { background: #f59e0b; color: white; }
.action-btn-cancel { background: #fff7ed; color: #ea580c; }
.action-btn-cancel:hover { background: #ea580c; color: white; }
.action-btn-restore { background: #eff6ff; color: #2563eb; }
.action-btn-restore:hover { background: #2563eb; color: white; }
.action-btn-sms { background: #ecfeff; color: #0891b2; }
.action-btn-sms:hover { background: #0891b2; color: white; }
.action-btn-extend { background: #f0fdf4; color: #16a34a; }
.action-btn-extend:hover { background: #16a34a; color: white; }

/* 退款注销弹窗 */
.cancel-info { font-size: 14px; color: var(--text-primary); background: var(--bg); padding: 10px 12px; border-radius: 8px; margin-bottom: 14px; }
.cancel-warn { font-size: 12px; color: #ea580c; margin-top: 10px; line-height: 1.5; }

/* ===== Import Page ===== */
.import-section { margin-bottom: 24px; }

.import-dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
}

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

.dropzone-title { font-size: 16px; font-weight: 600; color: var(--text); margin-top: 12px; }
.dropzone-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--success-light);
    border-radius: var(--radius);
    border: 1px solid #A7F3D0;
}

.file-detail { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.file-size { font-size: 12px; color: var(--text-muted); }

.import-preview { margin-top: 24px; }
.import-preview h4 { font-size: 15px; margin-bottom: 12px; }

.import-actions { display: flex; gap: 10px; margin-top: 16px; }

.import-result { padding: 14px 16px; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; background: var(--bg-soft, #f8fafc); font-size: 13px; }
.import-result .result-summary { font-size: 14px; margin-bottom: 8px; }
.import-result .result-warn { color: #b45309; margin: 8px 0; line-height: 1.8; }
.import-result .result-warn code { display: inline-block; background: #fef3c7; border-radius: 4px; padding: 1px 6px; margin: 0 4px 4px 0; font-size: 12px; }
.import-result .result-errors { margin-top: 8px; color: var(--text-muted, #64748b); }
.import-result .result-errors summary { cursor: pointer; }
.import-result .result-errors ul { margin: 6px 0 0; padding-left: 18px; }
.import-result .result-errors li { margin: 2px 0; }

.import-template h4 { font-size: 15px; margin-bottom: 8px; }

.template-table { margin-top: 12px; overflow-x: auto; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.modal-close {
    float: right; font-size: 22px; cursor: pointer;
    background: none; border: none; color: #999; line-height: 1;
}
.modal-close:hover { color: #333; }
.modal {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    inset: 0;
    z-index: 200;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}

/* 导出模板管理弹窗：卡片纯白不透明 */
#exportTplModal .modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

/* 过期体检卡 / 卡号查重弹窗：同样需要纯白不透明卡片底。
   这三个弹窗的 .modal 直接承载内容（无 .modal-content 包裹层），
   若不加白底，在暗色渲染环境（浏览器强制反色/阅读模式）下会变成深底、文字看不清。 */
#expiredModal .modal,
#dupModal .modal,
#exportTplModal .modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
/* 弹窗文字统一深色，杜绝被外部暗色样式影响 */
#expiredModal .modal,
#dupModal .modal,
#exportTplModal .modal,
#expiredModal .modal *,
#dupModal .modal *,
#exportTplModal .modal * {
    color: inherit;
}
#expiredModal .modal,
#dupModal .modal,
#exportTplModal .modal {
    color: var(--text);
}
#expiredModal .modal h1, #expiredModal .modal h2, #expiredModal .modal h3,
#dupModal .modal h1, #dupModal .modal h2, #dupModal .modal h3,
#exportTplModal .modal h1, #exportTplModal .modal h2, #exportTplModal .modal h3 {
    color: var(--text);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

.modal-sm { max-width: 420px; }
.modal-lg { max-width: 720px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-header h3 { font-size: 16px; font-weight: 600; }

.modal-body { padding: 24px; overflow-y: auto; }

/* 导出模板管理弹窗：内容区固定高度内部滚动，列区域也单独滚动 */
#exportTplModal .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(85vh - 110px);
    overflow-y: auto;
}
#exportTplModal .tpl-cols-wrap {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

.modal-footer.justify-center { justify-content: center; }

/* 弹窗通用布局修复：内容区内部滚动，footer 固定可见（避免内容过高时保存按钮被顶出视口） */
.modal-content > form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
.modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}
.modal-footer {
    flex: 0 0 auto;
}

/* ===== Form Elements ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }

.required { color: var(--danger); }

input[type="text"], input[type="number"], input[type="tel"], input[type="password"], input[type="date"], select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

textarea { resize: vertical; }

/* ===== Detail View ===== */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.detail-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.detail-item:nth-child(odd) { padding-right: 20px; }
.detail-item:nth-child(even) { padding-left: 20px; border-left: 1px solid var(--border); }

.detail-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.detail-value { font-size: 14px; font-weight: 500; }

.detail-full {
    grid-column: 1 / -1;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

/* 客户详情 · 字段级修改记录时间线 */
.detail-changes-section { margin-top: 20px; padding-top: 16px; border-top: 2px solid var(--border); }
.chg-loading { font-size: 13px; color: var(--text-muted); padding: 12px 0; }
.chg-empty { font-size: 13px; color: var(--text-muted); padding: 14px; background: var(--bg); border-radius: 8px; }
.chg-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 12px; }
.chg-count { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 6px; }
.chg-batch { border: 1px solid var(--border); border-left: 3px solid #2563EB; border-radius: 8px; margin-bottom: 12px; overflow: hidden; }
.chg-batch-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 12px; background: var(--bg); font-size: 12px; }
.chg-user { font-weight: 600; color: #1d4ed8; }
.chg-time { color: var(--text-secondary); }
.chg-items-num { margin-left: auto; color: var(--text-muted); background: #dbeafe; color: #1e40af; padding: 2px 8px; border-radius: 999px; font-size: 11px; }
.chg-items { padding: 6px 12px; }
.chg-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.chg-item:last-child { border-bottom: none; }
.chg-field { min-width: 90px; font-weight: 600; color: var(--text-primary); }
.chg-old { color: #b91c1c; background: #fef2f2; padding: 2px 8px; border-radius: 5px; text-decoration: line-through; text-decoration-color: #fca5a5; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chg-arrow { color: var(--text-muted); }
.chg-new { color: #15803d; background: #f0fdf4; padding: 2px 8px; border-radius: 5px; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Settings ===== */
.settings-section { margin-bottom: 8px; }
.settings-section h4 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.settings-item:last-child { border-bottom: none; }
.settings-label { font-weight: 500; font-size: 14px; }
.settings-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* jsform 对接 字段映射 */
.jsform-map-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.map-row { display: flex; align-items: center; gap: 8px; }
.map-label { flex: 0 0 110px; font-size: 13px; color: var(--text-muted); text-align: right; }
.map-arrow { color: #94a3b8; }
.map-input { flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
@media (max-width: 768px) { .jsform-map-editor { grid-template-columns: 1fr; } .map-label { flex-basis: 90px; } }
.jsform-notice { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 10px 14px; border-radius: 8px; font-size: 13px; line-height: 1.6; margin-bottom: 8px; }

/* ===== Confirm ===== */
.confirm-icon { margin-bottom: 16px; }

/* ===== Image Upload Area ===== */
.img-upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 13px;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 10px;
}
.img-upload-area:hover { border-color: var(--primary); background: #EFF6FF; color: var(--primary); }
.img-upload-area svg { flex-shrink: 0; }

/* 备注图片上传 */
.notes-img-upload {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.notes-img-upload .btn-sm {
    font-size: 12px;
    padding: 4px 10px;
}

.img-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
}
.img-preview-list .form-img-empty { font-size: 12px; color: var(--text-secondary); }

.form-img-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: default;
}
.form-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.form-img-item.pending { border-color: var(--primary); }
.form-img-del {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.55);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.form-img-item:hover .form-img-del { opacity: 1; }

/* Detail thumbnails */
.img-thumb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}
.img-thumb {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: zoom-in;
    transition: transform 0.15s, box-shadow 0.15s;
}
.img-thumb:hover { transform: scale(1.05); box-shadow: var(--shadow-lg); }

/* ===== Lightbox ===== */
.img-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
}
.img-lightbox img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}
.lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.15); }
.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    font-size: 40px;
    width: 50px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
    line-height: 1;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.8);
    font-size: 14px;
    background: rgba(0,0,0,0.4);
    padding: 4px 14px;
    border-radius: 20px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: white;
    z-index: 999;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.toast.show { transform: translateX(0); }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--primary); }

/* ===== Utility ===== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.link { font-size: 13px; }
.link:hover { text-decoration: underline; }

.mobile-only { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .mobile-only { display: inline-flex !important; }

    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }

    .page-toolbar { flex-direction: column; align-items: stretch; }
    .toolbar-left, .toolbar-right { flex-wrap: wrap; }
    .search-box { min-width: 100%; }

    .form-row { grid-template-columns: 1fr; }

    .modal-content { width: 95%; margin: 10px; }

    .detail-grid { grid-template-columns: 1fr; }
    .detail-item:nth-child(even) { padding-left: 0; border-left: none; }

    .pagination { flex-direction: column; gap: 12px; align-items: center; }

    .settings-item { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 24px; }

    .topbar { padding: 0 16px; }
    .topbar-title { font-size: 16px; }

    .login-card { padding: 32px 20px; }
}

.admin-only { /* controlled by JS, default display */ }
.hidden { display: none !important; }

/* ===== Role Badges ===== */
.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.perm-admin { color: #DC2626; }
.perm-operator { color: #D97706; }
.perm-viewer { color: #2563EB; }

/* ===== Permissions Grid ===== */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

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

.permission-item {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 16px;
    border: 1px solid var(--border);
}

.perm-role {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.perm-admin { color: #DC2626; }
.perm-operator { color: #D97706; }
.perm-viewer { color: #2563EB; }

.perm-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 角色权限说明：具体清单卡片 */
.perm-card { border-top: 3px solid var(--border); }
.perm-card-admin { border-top-color: #DC2626; }
.perm-card-operator { border-top-color: #D97706; }
.perm-card-viewer { border-top-color: #2563EB; }
.perm-sub { font-size: 12px; color: var(--text-muted); margin: -4px 0 10px; }
.perm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.perm-list li { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }
.perm-list li.yes { color: #15803d; }
.perm-list li.no { color: #b91c1c; }
.perm-list li.warn { color: #b45309; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 5px 8px; }
.perm-list li.warn b.perm-days-num { color: #b45309; font-weight: 700; }

/* 导出天数限制配置块 */
.export-days-config {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 16px; padding: 14px 16px;
    background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
}
.edc-icon {
    width: 40px; height: 40px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px; border-radius: 10px;
    background: #dbeafe; border: 1px solid #bfdbfe;
}
.edc-main { flex: 1; min-width: 220px; }
.edc-title { font-size: 14px; font-weight: 600; color: #0f172a; }
.edc-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-top: 2px; }
.edc-desc b { color: #b45309; }
.edc-control { display: flex; align-items: center; gap: 8px; }
.edc-control input { width: 90px; }
.edc-unit { font-size: 13px; color: var(--text-secondary); }

/* ===== Field Manager ===== */
.field-manager-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.field-manager-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F8FAFC;
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-secondary);
}

.field-config-table {
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
}

.field-config-table thead th {
    background: #F8FAFC;
    font-size: 12px;
    padding: 10px 12px;
}

.field-config-row {
    cursor: default;
    transition: background 0.15s;
}

.field-config-row:hover { background: #F0F9FF; }

.field-config-row.field-row-builtin {
    background: #FAFAFA;
}

.field-config-row.field-row-builtin:hover { background: #F1F5F9; }

.field-config-row.dragging {
    opacity: 0.5;
    background: #DBEAFE !important;
}

.field-config-row.drag-over {
    border-top: 2px solid var(--primary);
    background: #EFF6FF !important;
}

.drag-handle {
    cursor: grab !important;
    text-align: center;
    padding: 0 8px !important;
    color: #94A3B8;
    user-select: none;
}

.drag-handle:active { cursor: grabbing !important; }

.field-type-icon {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-right: 4px;
}

.field-name-code {
    background: #F1F5F9;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #475569;
}

.badge-type {
    background: #EDE9FE;
    color: #6D28D9;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
}

.sort-order-num {
    color: var(--text-muted);
    font-size: 12px;
    font-family: monospace;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #CBD5E1;
    border-radius: 20px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* Form divider for custom fields section */
.form-divider {
    position: relative;
    text-align: center;
    margin: 12px 0 8px;
}

.form-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.form-divider span {
    position: relative;
    background: white;
    padding: 0 10px;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== 开放接口页 ===== */
.open-wh-card {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #f8fafc;
}
.open-wh-head {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.open-wh-card input[type="text"] {
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
}

/* =====================================================================
   移动端适配（Mobile / Tablet Responsive Layer）
   目标：手机（<768）与平板（768~1024）可用，不破坏桌面端
   ===================================================================== */

/* 移动端专用工具类 */
.only-mobile { display: none !important; }

/* ---------- 平板 (≤1024) ---------- */
@media (max-width: 1024px) {
    :root { --sidebar-width: 232px; }

    .page-content { padding: 18px; }

    .topbar { padding: 0 16px; gap: 10px; }
    .topbar-title { font-size: 16px; }

    /* 宽表格允许横向滑动，避免撑破布局 */
    .table-container { -webkit-overflow-scrolling: touch; }
}

/* ---------- 手机 (≤768) ---------- */
@media (max-width: 768px) {
    :root {
        --topbar-height: 56px;
        --radius: 10px;
    }

    html, body { overflow-x: hidden; }
    body { font-size: 14px; }

    /* --- 侧边栏：抽屉式，带阴影与宽度收敛 --- */
    .sidebar {
        width: 264px;
        max-width: 84vw;
        box-shadow: 0 0 32px rgba(15,23,42,.28);
        z-index: 1000;
    }
    .sidebar.open { z-index: 1001; }
    .sidebar-overlay { z-index: 999; }
    .sidebar-overlay.show { display: block; }
    .sidebar-nav { padding: 10px; }
    .nav-item { padding: 12px 14px; font-size: 15px; }

    /* --- 顶栏 --- */
    .topbar {
        height: var(--topbar-height);
        padding: 0 12px;
        gap: 8px;
    }
    .topbar-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }
    .topbar-actions { gap: 8px; }

    /* 时钟在手机上只保留时间，日期隐藏 */
    .current-date { padding: 4px 8px; font-size: 12px; gap: 6px; }
    .current-date .clock-date { display: none; }

    /* --- 页面内容 --- */
    .page-content { padding: 12px; }

    /* --- 卡片 / 统计 --- */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
    .stat-card { padding: 14px 12px; gap: 10px; border-radius: 10px; }
    .stat-icon { width: 38px; height: 38px; border-radius: 10px; }
    .stat-icon svg { width: 18px; height: 18px; }
    .stat-value { font-size: 21px; }
    .stat-label { font-size: 12px; }
    .stat-sub { font-size: 10px; }

    .dashboard-grid { grid-template-columns: 1fr; gap: 14px; }
    .card-header { padding: 12px 14px; }
    .card-body { padding: 14px; }

    /* --- 工具栏：纵向排列，按钮等宽自适应 --- */
    .page-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
    .toolbar-left, .toolbar-right {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .search-box { min-width: 0; width: 100%; }
    .page-toolbar .btn { flex: 1 1 auto; min-width: 0; }

    /* --- 表格横向滚动，首列粘住 --- */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-left: -12px;
        margin-right: -12px;
        padding: 0 12px;
        border-radius: 0;
    }
    .data-table { min-width: 720px; }
    .data-table th, .data-table td { padding: 10px 12px; font-size: 13px; }
    .data-table th:first-child,
    .data-table td:first-child {
        position: sticky;
        left: 0;
        background: #fff;
        z-index: 2;
        box-shadow: 1px 0 0 var(--border);
    }
    .data-table thead th:first-child { background: #F8FAFC; z-index: 3; }
    .data-table tbody tr:hover td:first-child { background: #F8FAFC; }

    /* 表格卡片因 margin 负值需要恢复内边距 */
    .card:has(.table-container) { border-radius: 12px; }

    /* --- 弹窗：底部弹出式全宽 --- */
    .modal-overlay { align-items: flex-end; }
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 92vh;
        max-height: 92dvh;
        margin: 0;
        border-radius: 18px 18px 0 0;
        animation: mobileSheetIn .24s cubic-bezier(.22,1,.36,1);
    }
    .modal-sm, .modal-lg { max-width: 100%; }
    .modal-header {
        padding: 14px 16px;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 4;
        border-radius: 18px 18px 0 0;
    }
    .modal-header h3 { font-size: 15.5px; }
    .modal-body { padding: 16px; }
    .modal-footer {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
        background: #fff;
        z-index: 4;
        border-radius: 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .modal-footer .btn { flex: 1 1 auto; }

    @keyframes mobileSheetIn {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    /* --- 表单：单列 --- */
    .form-row { grid-template-columns: 1fr; gap: 0; }

    /* 输入框字号 ≥16px，避免 iOS 聚焦自动放大 */
    input[type="text"], input[type="number"], input[type="tel"],
    input[type="password"], input[type="date"], input[type="search"],
    select, textarea,
    .search-box input, .lf-input {
        font-size: 16px !important;
    }
    .lf-input { height: 50px; padding-left: 44px; }
    .lf-submit { height: 50px; font-size: 16px; }

    /* --- 明细 / 详情 --- */
    .detail-grid { grid-template-columns: 1fr; }
    .detail-item:nth-child(odd) { padding-right: 0; }
    .detail-item:nth-child(even) { padding-left: 0; border-left: none; }

    /* --- 分页 --- */
    .pagination { flex-direction: column; gap: 10px; align-items: center; }
    .pagination-btns { flex-wrap: wrap; justify-content: center; }

    /* --- 设置项 --- */
    .settings-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .settings-item > * { width: 100%; }

    /* --- 权限卡 --- */
    .permissions-grid { grid-template-columns: 1fr; }

    /* --- 体检预约页工具卡：单列 --- */
    .tool-grid { grid-template-columns: 1fr !important; }
    .appt-hero { padding: 18px 16px; }
    .appt-hero-actions .btn { flex: 1 1 auto; }

    /* --- 预约名单筛选卡：单列 --- */
    .roster-filter-grid { grid-template-columns: 1fr !important; }
    .roster-card { padding: 0 14px; }
    .roster-header { padding: 14px 0 10px; flex-direction: column; align-items: flex-start; gap: 10px; }
    .roster-actions { width: 100%; flex-wrap: wrap; }
    .roster-action-group { flex-wrap: wrap; width: 100%; }
    .roster-action-group .btn { flex: 1 1 auto; }
    .roster-result-bar { flex-wrap: wrap; gap: 8px; }

    /* --- 操作日志 --- */
    .log-detail-cell { max-width: 180px; }

    /* --- 单位成员面板 --- */
    .unit-members-panel { padding: 10px 12px; }

    /* 长文本/长卡号换行，避免横向溢出 */
    .data-table td { word-break: break-word; }

    .only-mobile { display: inline-flex !important; }
    .mobile-only { display: inline-flex !important; }
}

/* ---------- 小屏手机 (≤480) ---------- */
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 22px; }

    .topbar { padding: 0 10px; }

    /* 登录卡：窄屏彻底放松内边距 */
    .login-page { padding: 20px 14px; }
    .login-card { padding: 28px 20px 24px; border-radius: 18px; }
    .login-header { margin-bottom: 22px; }
    .login-header h1 { font-size: 19px; }
    .login-header p { font-size: 10.5px; }
    .login-logo svg { width: 44px; height: 44px; }
    .login-footer-note { font-size: 11px; }

    .modal-header { padding: 12px 14px; }
    .modal-body { padding: 14px; }
    .modal-footer { padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); }

    .page-content { padding: 10px; }
    .table-container { margin-left: -10px; margin-right: -10px; padding: 0 10px; }
}

/* ---------- 触摸设备：hover 态不粘滞 + 加大点击区 ---------- */
@media (hover: none) and (pointer: coarse) {
    .data-table tbody tr:hover { background: transparent; }
    .data-table tbody tr:hover td:first-child { background: #fff; }
    .nav-item:hover { background: transparent; color: var(--text-secondary); }
    .nav-item.active:hover { background: var(--primary-light); color: var(--primary); }
    .btn-icon:hover { background: transparent; color: var(--text-secondary); }

    .nav-item, .btn, .btn-icon, .nav-icon, .pagination-btns button {
        -webkit-tap-highlight-color: rgba(59,130,246,.12);
    }
    /* 触屏最小点击尺寸 40px */
    .pagination-btns button { min-width: 40px; min-height: 40px; }
    .btn-icon { min-width: 40px; min-height: 40px; }
}

/* ---------- 横屏手机：压缩纵向留白 ---------- */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
    .login-page { padding: 12px; align-items: flex-start; }
    .login-card { padding: 20px 24px; }
    .login-header { margin-bottom: 14px; }
    .login-logo { display: none; }
    .lf-field { margin-bottom: 12px; }
    .lf-options { margin-bottom: 14px; }
    .lf-input { height: 42px; line-height: 42px; }
    .lf-submit { height: 42px; }
    .login-footer-note { margin-top: 10px; }
}

/* =====================================================================
   移动端客户卡片列表（手机端替代横向滑动表格）
   ===================================================================== */
.cust-card-list { display: none; }
.cust-card-empty {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.cust-card {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(59,130,246,.10);
    transition: transform .12s, box-shadow .18s;
}
.cust-card:active { transform: scale(.985); box-shadow: 0 1px 2px rgba(15,23,42,.08); }

/* 卡片头部：序号 + 姓名 + 状态 */
.cust-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.cust-card-idx {
    flex: 0 0 24px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}
.cust-card-idwrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.cust-card-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cust-card-gender {
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg);
    border-radius: 5px;
    padding: 2px 7px;
}
.cust-card-head .status-badge { flex: 0 0 auto; }

/* 卡片主体：关键字段网格 */
.cust-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px 14px;
}
.cust-card-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
/* 长字段（单位名称、长卡号）独占整行，避免被两列挤成细条 */
.cust-card-meta-item.ccm-wide { grid-column: 1 / -1; }
.cust-card-meta-item.ccm-wide .ccm-val { word-break: break-word; }
.ccm-label {
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: .02em;
}
.ccm-val {
    font-size: 13.5px;
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}
.ccm-val .status-badge { font-size: 12px; padding: 2px 8px; }

/* 备注 */
.cust-card-note {
    padding: 10px 14px;
    margin: 0 14px 12px;
    background: var(--bg);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cust-card-note .ccm-label { font-size: 11px; }
.ccn-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    word-break: break-word;
    max-height: 72px;
    overflow: hidden;
}

/* 卡片底部：预约次数 + 操作 */
.cust-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}
.cust-card-appt { flex: 0 0 auto; }
.cust-card-appt .status-badge { font-size: 12px; }
.cust-card-appt > div { font-size: 11px !important; color: #94a3b8 !important; margin-top: 2px; }
.cust-card-actions { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }

.cust-card-act {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s;
    -webkit-tap-highlight-color: transparent;
}
.cust-card-act:active { background: var(--border); }
.cust-act-view { color: var(--primary); }
.cust-act-edit { color: #7c3aed; }
.cust-act-ext { color: var(--warning); }
.cust-act-sms { color: #0891b2; }
.cust-act-card { color: var(--danger); }
.cust-act-del { color: #dc2626; }

/* 手机端：卡片列表显示、表格隐藏 */
@media (max-width: 768px) {
    .cust-card-list { display: block !important; }
    #dataTable { display: none !important; }
    /* 同单位面板：表格隐藏、卡片显示 */
    .unit-members-panel .ump-table-wrap { display: none !important; }
    .ump-card-list { display: block !important; }
}

/* 极小屏：元数据单列，操作按钮更宽松 */
@media (max-width: 380px) {
    .cust-card-meta { grid-template-columns: 1fr; }
    .cust-card-act { width: 40px; height: 40px; }
}

/* =====================================================================
   同单位人员面板 · 移动端卡片（≤768px）
   ===================================================================== */
.ump-card-list { display: none; }

.ump-card {
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(59,130,246,.10);
    transition: transform .12s;
}
.ump-card:active { transform: scale(.985); }

.ump-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
}
.ump-card-idx {
    flex: 0 0 24px;
    width: 24px; height: 24px;
    border-radius: 6px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ump-card-name {
    font-size: 15.5px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ump-card-gender {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg);
    border-radius: 5px;
    padding: 2px 7px;
}
.ump-card-head .status-badge { flex: 0 0 auto; }

.ump-card-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px 14px;
}
.ump-card-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.umc-label { font-size: 11px; color: var(--text-muted); }
.umc-val {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    word-break: break-all;
}
.umc-val .status-badge { font-size: 12px; padding: 2px 8px; }

.ump-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
}
.umc-hint { font-size: 12px; color: var(--text-muted); }
.umc-arrow { color: var(--primary); font-size: 15px; }

@media (max-width: 768px) {
    .ump-card-list { display: block; }
    /* 同单位面板内的表格在移动端隐藏，改用卡片 */
    .unit-members-panel .table-container { display: none; }
    .unit-members-panel { padding: 10px 12px; }
    .ump-header { font-size: 13px; gap: 8px; }
    .ump-header-top { gap: 6px; }
    .ump-title { font-size: 14px; }
    /* 移动端摘要网格：两列紧凑排布，长文本自动折行 */
    .ump-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        padding: 8px;
    }
    .ump-info { font-size: 12px; padding: 3px 5px; gap: 4px; }
    .ump-info-label { font-size: 11px; }
    .ump-info-val { font-size: 12px; }
}
@media (max-width: 380px) {
    .ump-card-meta { grid-template-columns: 1fr; }
    /* 超小屏摘要改单列 */
    .ump-summary-grid { grid-template-columns: 1fr; }
}

/* ===== 过期体检卡提醒（看板提示条 + 明细弹窗） ===== */
.expired-alert {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    padding: 14px 18px;
    background: #fff7ed;
    border: 1px solid #fdba74;
    border-left: 4px solid #f97316;
    border-radius: 12px;
    flex-wrap: wrap;
}
.expired-alert .ea-icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.expired-alert .ea-body { flex: 1; min-width: 220px; }
.expired-alert .ea-title { font-size: 15px; font-weight: 600; color: #9a3412; }
.expired-alert .ea-title strong { font-size: 19px; color: #dc2626; margin: 0 2px; }
.expired-alert .ea-soon { font-weight: 500; color: #b45309; font-size: 13px; }
.expired-alert .ea-soon strong { font-size: 15px; color: #d97706; }
.expired-alert .ea-desc { font-size: 12.5px; color: #a16207; margin-top: 4px; }
.expired-alert .ea-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.exp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.exp-table thead th {
    position: sticky; top: 0; z-index: 1;
    background: #f8fafc; color: #475569; font-weight: 600;
    text-align: left; padding: 9px 10px; white-space: nowrap;
    border-bottom: 2px solid #e2e8f0;
}
.exp-table tbody td { padding: 9px 10px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.exp-table tbody tr:hover { background: #f8fafc; }
.exp-table .exp-company { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 768px) {
    .expired-alert { flex-direction: column; align-items: flex-start; padding: 12px 14px; gap: 10px; }
    .expired-alert .ea-actions { width: 100%; }
    #expiredModal .modal { max-width: 100% !important; max-height: 92vh !important; }
    .exp-table { font-size: 12px; min-width: 760px; }
}

/* ===== 卡号查重（弹窗） ===== */
.dup-toolbar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 16px; border-bottom: 1px solid #e2e8f0; background: #f8fafc;
}
.dup-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: #475569; cursor: pointer; white-space: nowrap; }
.dup-chk input { cursor: pointer; }
.dup-hint { font-size: 12.5px; color: #64748b; }
.dup-footer-tip { font-size: 12px; color: #94a3b8; margin-right: auto; }

.dup-group {
    margin-top: 14px; border: 1px solid #e2e8f0; border-radius: 10px;
    overflow: hidden; background: #fff;
}
.dup-group-head {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 9px 12px; background: #fef2f2; border-bottom: 1px solid #fecaca;
}
.dup-card { font-size: 13px; color: #334155; }
.dup-card code { background: #fff; border: 1px solid #fca5a5; border-radius: 5px;
    padding: 1px 7px; font-size: 13px; color: #b91c1c; font-weight: 600; }
.dup-count { font-size: 12px; font-weight: 700; color: #b91c1c;
    background: #fff; border: 1px solid #fca5a5; border-radius: 10px; padding: 1px 9px; }
.dup-tag { font-size: 11.5px; padding: 1px 8px; border-radius: 9px; font-weight: 600; }
.dup-tag-warn { background: #fef3c7; color: #b45309; }
.dup-tag-danger { background: #fee2e2; color: #b91c1c; }

.dup-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dup-table thead th {
    background: #f8fafc; color: #475569; font-weight: 600; text-align: left;
    padding: 7px 10px; white-space: nowrap; border-bottom: 1px solid #e2e8f0;
}
.dup-table tbody td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.dup-table tbody tr:last-child td { border-bottom: none; }
.dup-table tbody tr:hover { background: #f8fafc; }
.dup-row-first { background: #f0fdf4; }
.dup-row-first:hover { background: #ecfdf5; }
.dup-keep-dot { color: #10b981; font-size: 14px; }
.dup-badge { font-size: 10.5px; background: #dcfce7; color: #15803d;
    border-radius: 7px; padding: 0 5px; font-weight: 600; vertical-align: middle; }
.dup-company { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-danger-ghost { color: #dc2626; border-color: #fecaca; background: #fff; }
.btn-danger-ghost:hover { background: #fef2f2; border-color: #f87171; }

@media (max-width: 768px) {
    #dupModal .modal { max-width: 100% !important; max-height: 94vh !important; }
    .dup-toolbar { padding: 10px 12px; gap: 8px; }
    .dup-table { min-width: 780px; font-size: 12px; }
    .dup-footer-tip { display: none; }
}

/* ===== 在线录入（x-spreadsheet 电子表格） ===== */
/* 整页改成 flex 纵向布局，让表格吃掉剩余高度，一屏看完不用下拉 */
#page-sheet {
    padding: 0;
    display: none;
    flex-direction: column;
    /* 顶栏64 + page-content上下padding48 + sheet-bar约54 + 结果区/余量 = 172 */
    height: calc(100dvh - 172px);
    min-height: 420px;
}
#page-sheet.active { display: flex; }

/* 顶部操作条：三栏网格 —— 左标题 / 中按钮（视觉中心，第一眼就看到）/ 右草稿状态 */
.sheet-bar {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) auto minmax(80px, 1fr);
    align-items: center;
    gap: 12px; flex: 0 0 auto;
    padding: 8px 14px; margin-bottom: 8px;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
}
.sheet-bar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sheet-bar-title { font-size: 14px; font-weight: 700; color: #1e293b; white-space: nowrap; }
/* 按钮组居中：grid 第二列是 auto 宽度，margin 自动让它在整行居中 */
.sheet-bar-actions {
    display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap;
}
.sheet-bar-right {
    display: flex; align-items: center; justify-content: flex-end; min-width: 0;
    overflow: hidden;
}
.sheet-bar-hint {
    font-size: 12px; color: #64748b; display: inline-flex; align-items: center; gap: 5px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 自动保存状态小圆点：绿=已存草稿，黄=保存中，红=失败 */
.sbh-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #10b981;
    flex: 0 0 auto; transition: background .2s;
}
.sbh-dot.saving { background: #f59e0b; }
.sbh-dot.error { background: #ef4444; }
.sheet-bar-hint.error-text { color: #b91c1c; }

.sheet-bar-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.btn-xs { padding: 5px 10px; font-size: 12.5px; line-height: 1.3; border-radius: 7px; }
.sheet-count { font-size: 12.5px; color: #64748b; font-weight: 600; white-space: nowrap; }
.sheet-skipdup {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; color: #475569; cursor: pointer; user-select: none; white-space: nowrap;
}
.sheet-skipdup input { cursor: pointer; }

/* 表格容器：占满剩余高度，内部滚动（页面本身不拉伸） */
.sheet-wrap {
    flex: 1 1 auto; min-height: 0;
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    overflow: hidden; padding: 0;
    display: flex;
}
.xsheet-host { width: 100%; flex: 1 1 auto; min-height: 0; }
.xsheet-host .x-spreadsheet { border: none; font-size: 13px; width: 100%; }
/* 底部栏只有一个工作表标签（库把它写死在 constructor 里，没有开关选项）。
   纯录入场景不需要多工作表，隐藏它省出高度。 */
.xsheet-host .x-spreadsheet-bottombar { display: none !important; }

/* 表头样式由数据层 style 控制（canvas 渲染无法用 CSS 改表头），此处保留占位 */
.xs-header-row { font-weight: 700; }

.sheet-result {
    flex: 0 0 auto;
    margin-top: 8px; border-radius: 12px; padding: 12px 16px;
    background: #fff; border: 1px solid #e2e8f0;
    max-height: 30vh; overflow-y: auto;
}
.sheet-result-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sheet-result-title { font-size: 14px; font-weight: 700; color: #1e293b; }
.sheet-result-msg { font-size: 12.5px; color: #64748b; flex: 1; }
.sheet-result-stats { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; font-weight: 600; }
.sr-ok { color: #15803d; }
.sr-warn { color: #b45309; }
.sr-err { color: #b91c1c; }
.sheet-result-list { margin-top: 8px; font-size: 12.5px; }
.sheet-result-list b { color: #475569; }
.sheet-result-list ul { margin: 6px 0 0 18px; padding: 0; }
.sheet-result-list li { color: #64748b; line-height: 1.7; }
.sr-warn-list b { color: #b45309; }

@media (max-width: 768px) {
    #page-sheet { height: calc(100dvh - 120px); min-height: 400px; }
    /* 手机端三栏放不下 → 两行：①标题 ｜ 草稿状态 ②按钮整行居中 */
    .sheet-bar {
        grid-template-columns: 1fr auto;
        gap: 8px; padding: 8px 10px;
    }
    .sheet-bar-left { grid-column: 1; grid-row: 1; }
    .sheet-bar-right { grid-column: 2; grid-row: 1; justify-content: flex-end; }
    .sheet-bar-actions {
        grid-column: 1 / -1; grid-row: 2;
        width: 100%; gap: 5px; justify-content: center;
    }
    .sheet-bar-hint { font-size: 11px; }
    .btn-xs { padding: 6px 9px; font-size: 12px; }
    .sheet-result { max-height: 26vh; }
}

/* 中等宽度（769~1200）按钮多，收紧间距免得换行 */
@media (min-width: 769px) and (max-width: 1200px) {
    .sheet-bar { gap: 8px; padding: 8px 10px; }
    .sheet-bar-actions { gap: 5px; }
    .sheet-bar-hint { font-size: 11px; }
}
