:root {
    --primary: #2c5aa0;
    --primary-light: #e6f0ff;
    --secondary: #e8b339;
    --success: #52c41a;
    --danger: #f5222d;
    --warning: #fa8c16;
    --bg: #f5f7fa;
    --card: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --sidebar-width: 220px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

.sidebar {
    width: var(--sidebar-width);
    background: #1e3a5f;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}

.logo {
    padding: 20px;
    font-size: 20px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon { font-size: 24px; }

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

/* 导航分组标题 */
.nav-group {
    padding: 12px 20px 4px;
    font-size: 11px;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.38);
    text-transform: none;
}
.nav-group:first-child { padding-top: 0; }

.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.user-card {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.user-name { font-weight: 600; margin-bottom: 4px; }
.user-role { font-size: 12px; color: rgba(255,255,255,0.6); margin-bottom: 10px; }

.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    background: #fff;
    padding: 20px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header h1 { font-size: 22px; color: #1f2937; }

.dashboard { padding: 24px 28px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.stat-label { color: var(--text-secondary); font-size: 14px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.panel {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.quick-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.quick-btn {
    display: inline-block;
    padding: 12px 20px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

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

.task-list { display: flex; flex-direction: column; gap: 12px; }

.task-item {
    padding: 14px;
    background: #fafbfc;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.task-title { font-weight: 500; margin-bottom: 6px; }
.task-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 12px; }

.empty { color: var(--text-secondary); text-align: center; padding: 30px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cf1322; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #389e0d; }

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

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

/* 筛选按钮选中态 */
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-btn.active:hover { background: #1e3a5f; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

/* 表格 */
.table-container { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th { background: #f8fafc; font-weight: 600; }
tr:hover { background: #f9fafb; }

/* 状态标签 */
.status-open { color: var(--primary); }
.status-assigned { color: var(--warning); }
.status-completed { color: var(--success); }
.status-cancelled { color: var(--danger); }

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active { display: flex; }

.modal-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

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

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

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

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

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

.page-header h2 { font-size: 20px; }

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    font-size: 14px;
}

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

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

/* 登录页 */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5aa0 100%);
}

.login-box {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h2 { text-align: center; margin-bottom: 24px; color: var(--primary); }

@media (max-width: 768px) {
    .sidebar { display: none; }
    .main { margin-left: 0; }
}

/* ============ 移动端 / 呼救强化 ============ */

/* 大号一键呼救卡片（首页） */
.sos-hero {
    background: linear-gradient(135deg, #cf1322 0%, #a8071a 100%);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 6px 20px rgba(207,19,34,0.28);
    text-align: center;
}
.btn-sos-big {
    width: 100%;
    border: none;
    border-radius: 14px;
    background: #fff;
    color: #cf1322;
    padding: 18px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-family: inherit;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform .08s;
}
.btn-sos-big:active { transform: scale(0.96); }
.sos-icon { font-size: 42px; line-height: 1; animation: sosPulse 1.3s infinite; }
@keyframes sosPulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
.sos-main { font-size: 26px; font-weight: 800; letter-spacing: 2px; }
.sos-sub { font-size: 13px; color: #666; }
.sos-hero-note {
    color: #fff; opacity: .9; font-size: 12px; margin-top: 10px;
}

/* 手机底部导航（窄屏显示，宽屏隐藏） */
.mobile-nav {
    display: none;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
}
.mnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 11px;
    gap: 1px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.mnav-ico { font-size: 22px; line-height: 1; }
.mnav-item.active { color: var(--primary); }
.mnav-sos {
    background: linear-gradient(180deg,#cf1322,#a8071a);
    color: #fff;
    margin: -12px 4px 0;
    border-radius: 14px 14px 6px 6px;
    height: 64px;
    font-size: 12px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(207,19,34,.45);
    animation: sosPulse 1.5s infinite;
}
.mnav-sos.active { color:#fff; }

/* 已呼救遮罩 */
.sos-active-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(168,7,26,0.92);
    z-index: 1001;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
.sos-active-overlay.show { display: flex; }
.sos-active-box { text-align: center; color: #fff; padding: 30px; }
.sos-pulse { font-size: 80px; animation: sosPulse 1s infinite; }
.sa-title { font-size: 26px; font-weight: 800; margin: 14px 0 6px; }
.sa-sub { font-size: 15px; opacity: .9; margin-bottom: 24px; }
.sa-safe {
    background: rgba(255,255,255,0.9); color: #a8071a; border: none;
    padding: 12px 28px; font-size: 16px; border-radius: 24px;
}
/* 呼救后的拨打按钮 */
.sa-dial-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.call-dial {
    display: inline-block;
    padding: 12px 18px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    background: #fff;
    color: #a8071a;
    box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
.call-dial.call-120 { background: #ff4d4f; color: #fff; }
.call-dial:active { transform: scale(.95); }
/* 呼救遮罩内：自动通知提示 + 家属联系区 */
.sa-notify-hint {
    margin: 4px 0 10px; font-size: 13px; color: #ffe7ba;
    background: rgba(255,255,255,.12); border-radius: 10px; padding: 6px 10px;
    display: inline-block;
}
.sa-fam-title { margin-top: 14px; font-size: 13px; opacity: .85; text-align: left; width: 100%; }
.sa-fam-list { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 6px; }
.fam-line {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: rgba(255,255,255,.10); border-radius: 10px; padding: 8px 10px;
}
.fam-name { flex: 1; font-weight: 700; font-size: 14px; min-width: 90px; }
.mini-dial {
    border: none; cursor: pointer; text-decoration: none;
    background: #fff; color: #a8071a; font-size: 12px; font-weight: 700;
    padding: 6px 10px; border-radius: 8px;
}
.mini-dial:active { transform: scale(.95); }

/* 设置项开关 */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; inset: 0;
    background: #ccc; border-radius: 26px; transition: .2s;
}
.slider::before {
    content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: #52c41a; }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* 手机顶部用户条 */
.mobile-topbar {
    display: none;
    position: sticky;
    top: 0;
    left: 0; right: 0;
    align-items: center;
    gap: 8px;
    background: #fff;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    z-index: 850;
    font-size: 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.main-header { /* 桌面/移动通用 */
}
/* 窄屏时主体顶部让位给 sticky topbar */
@media (max-width: 768px) {
    .mobile-topbar { display: flex; }
    .main-header { padding-top: 4px; }
}

/* 窄屏自适应 */
@media (max-width: 768px) {
    .mobile-nav { display: flex; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .dashboard, .page-content { padding: 14px 12px 80px; }
    .main-header { padding: 14px 12px; }
    .main-header h1 { font-size: 18px; }
    .modal-content { width: 96%; }
    .content-grid { grid-template-columns: 1fr; }
    .header-actions .btn { font-size: 13px; padding: 8px 12px; }
}

/* 管理中心导出筛选条 */
.export-sel {
    font-size: 13px; padding: 6px 8px; border: 1px solid var(--border,#d6dee8);
    border-radius: 6px; background: #fff; color: #1f2937; max-width: 160px;
}
.export-date {
    font-size: 13px; padding: 5px 6px; border: 1px solid var(--border,#d6dee8);
    border-radius: 6px; background: #fff; color: #1f2937;
}
.export-sel:focus, .export-date:focus { outline: none; border-color: #2c5aa0; }

/* ============================================================
   手机 APP 化（≤768px）
   目标：从"PC 页面加补丁"改为真正的 APP 三件套
        顶部栏（标题+菜单） / 内容区（卡片流式） / 底部 Tab（含呼救）
   原则：拇指可达、字号够大、点击目标 ≥44px、不横向滚动、贴合刘海与安全区
   ============================================================ */
:root {
    --topbar-h: 50px;
    --tabbar-h: 56px;
}

/* —— 全局触控与滚动手感 —— */
html { -webkit-text-size-adjust: 100%; }
body {
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}
/* iOS 聚焦输入框时字号 <16px 会触发整页缩放，统一 16px 规避 */
input, select, textarea { font-size: 16px; }
img, table, pre { max-width: 100%; }

/* —— 顶部 APP 栏（脚本注入，宽屏隐藏） —— */
.app-topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 880;
    align-items: center;
    gap: 6px;
    height: calc(var(--topbar-h) + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 6px 0;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5aa0 100%);
    color: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,.14);
}
.tb-icon {
    width: 40px; height: 40px; flex: 0 0 40px;
    background: none; border: none; color: #fff;
    font-size: 20px; line-height: 1; cursor: pointer;
    border-radius: 10px; font-family: inherit;
}
.tb-icon:active { background: rgba(255,255,255,.2); }
.tb-title {
    flex: 1; min-width: 0; text-align: center;
    font-size: 17px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* —— 全量导航抽屉 —— */
.drawer-mask {
    display: none;
    position: fixed; inset: 0;
    z-index: 1200;
    background: rgba(0,0,0,.45);
}
.drawer-mask.show { display: block; }
.drawer {
    position: fixed; top: 0; bottom: 0; left: 0;
    width: 80%; max-width: 320px;
    z-index: 1201;
    background: #1e3a5f;
    color: #fff;
    display: flex; flex-direction: column;
    transform: translateX(-101%);
    transition: transform .26s cubic-bezier(.32,.72,.3,1);
    padding-top: env(safe-area-inset-top);
    box-shadow: 4px 0 20px rgba(0,0,0,.25);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,.12);
}
.drw-avatar {
    width: 42px; height: 42px; flex: 0 0 42px;
    border-radius: 50%; background: #2c5aa0;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; font-weight: 700;
}
.drw-user { flex: 1; min-width: 0; }
.drw-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drw-role { font-size: 12px; opacity: .7; }
.drawer-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 0 24px; }
.drw-group { padding: 14px 18px 6px; font-size: 12px; color: rgba(255,255,255,.45); }
.drw-item {
    display: flex; align-items: center; gap: 12px;
    margin: 2px 8px; padding: 13px 14px;
    border-radius: 10px;
    color: rgba(255,255,255,.88);
    text-decoration: none; font-size: 16px;
}
.drw-item:active, .drw-item.active { background: rgba(255,255,255,.15); color: #fff; }
.drw-ico { font-size: 19px; width: 26px; text-align: center; }
body.drawer-open { overflow: hidden; }

/* ============================================================
   窄屏重排：以下规则仅在手机宽度生效
   ============================================================ */
@media (max-width: 768px) {
    /* —— 骨架 —— */
    .app-topbar { display: flex; }
    .mobile-topbar { display: none !important; }   /* 旧用户条已由 APP 顶栏取代 */
    .app { min-height: 100dvh; }
    .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); }

    /* 页面大标题已由顶部栏承担，此处只留操作按钮 */
    .main-header { padding: 10px 12px; }
    .main-header h1 { display: none; }
    .page-header { margin-bottom: 14px; }
    .page-header h2 { font-size: 18px; }

    /* —— 底部 Tab 栏 —— */
    .mobile-nav {
        display: flex;
        height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
        box-shadow: 0 -2px 14px rgba(0,0,0,.08);
    }
    .mnav-item { font-size: 11px; gap: 2px; min-height: 44px; }
    .mnav-ico { font-size: 21px; }
    .mnav-item.active { font-weight: 600; }
    .mnav-sos { height: 52px; margin: -14px 6px 0; border-radius: 16px; font-size: 11px; }

    /* —— 内容密度与字号 —— */
    body { font-size: 16px; }
    .dashboard, .page-content { padding: 12px 12px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px); overflow-x: hidden; }
    .content-grid { grid-template-columns: 1fr; gap: 12px; }
    .panel { padding: 14px; border-radius: 14px; margin-bottom: 12px; }
    .panel-title { font-size: 16px; margin-bottom: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; border-radius: 12px; }
    .stat-value { font-size: 24px; }
    .stat-label { font-size: 13px; }
    .task-item { padding: 14px; border-radius: 12px; }
    .task-title { font-size: 16px; }
    .empty { padding: 36px 16px; font-size: 15px; }

    /* —— 触控目标 ≥44px —— */
    .btn { min-height: 44px; padding: 12px 18px; font-size: 16px; }
    .btn-sm { min-height: 38px; padding: 9px 14px; font-size: 15px; }
    .quick-btn { min-height: 44px; padding: 12px 18px; font-size: 15px; }
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 15px; margin-bottom: 8px; }
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 12px 14px; font-size: 16px; border-radius: 10px;
    }

    /* —— 页签：横向滑动，避免挤成两行 —— */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        gap: 0;
        margin-bottom: 14px;
    }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { flex: 0 0 auto; min-height: 44px; padding: 12px 14px; font-size: 15px; }

    /* —— 宽表 → 卡片（data-label 由 app.js 自动注入） —— */
    .table-container { overflow-x: visible; }
    table.tb-card,
    table.tb-card tbody,
    table.tb-card tbody tr,
    table.tb-card tbody td { display: block; width: 100%; }
    table.tb-card thead { display: none; }
    table.tb-card { border: 0; font-size: 15px; }
    table.tb-card tbody tr {
        position: relative;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 10px;
        padding: 10px 12px 6px;
        box-shadow: 0 1px 4px rgba(0,0,0,.04);
    }
    table.tb-card tbody tr::before {
        content: "#" attr(data-idx);
        position: absolute; right: 12px; top: 8px;
        font-size: 11px; color: #9ca3af;
    }
    table.tb-card tbody td {
        display: flex; gap: 10px; align-items: flex-start;
        border: 0; padding: 5px 0; text-align: left;
    }
    table.tb-card tbody td::before {
        content: attr(data-label);
        flex: 0 0 78px;
        color: var(--text-secondary);
        font-size: 13px; line-height: 1.7;
    }
    table.tb-card tbody td:empty { display: none; }
    table.tb-card tbody tr:hover { background: #fff; }

    /* —— 弹窗 → 底部抽屉 —— */
    .modal { align-items: flex-end; }
    .modal-content {
        width: 100%; max-width: none;
        border-radius: 18px 18px 0 0;
        max-height: 88vh;
        max-height: 88dvh;
        padding-bottom: env(safe-area-inset-bottom);
        animation: sheetUp .24s cubic-bezier(.32,.72,.3,1);
    }
    @keyframes sheetUp {
        from { transform: translateY(40px); opacity: .5; }
        to   { transform: none; opacity: 1; }
    }
    .sheet-handle { padding: 10px 0 2px; text-align: center; cursor: pointer; }
    .sheet-bar { display: inline-block; width: 44px; height: 4px; border-radius: 2px; background: #d1d5db; }
    .modal-header { padding: 12px 16px; }
    .modal-body { padding: 16px; max-height: 62vh; overflow-y: auto; }
    .modal-footer {
        padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
        gap: 10px;
    }
    .modal-footer .btn { flex: 1; min-height: 48px; font-size: 16px; }
    .btn-close { font-size: 30px; padding: 0 6px; }

    /* —— 首页呼救大卡 —— */
    .sos-hero { padding: 14px; margin-bottom: 14px; }
    .btn-sos-big { padding: 20px 12px; }
    .sos-main { font-size: 28px; }
    .sos-sub { font-size: 14px; }

    /* —— 杜绝横向溢出 —— */
    /* 页面里大量用 inline 的 flex + max-width:520~620px 做并排布局，
       手机上 flex 容器不换行、子项 min-width:auto 又不许收缩，于是整页被撑宽。
       这里统一：窄屏下 inline flex 容器一律换行、宽容器改满宽、子项允许收缩。 */
    .app, .main { min-width: 0; }
    div[style*="display:flex"],
    div[style*="display: flex"] { flex-wrap: wrap !important; }
    [style*="max-width:5"],
    [style*="max-width:6"],
    [style*="max-width:7"],
    [style*="max-width:8"] { max-width: 100% !important; min-width: 0 !important; }

    /* —— 表单字段单列 —— */
    /* 不少页面用 inline 的 flex + min-width 做多列排布，窄屏下会挤成一条或溢出，
       这里统一改为整行显示：手机上竖排单列既好读也好点。 */
    [style*="min-width:1"],
    [style*="min-width:2"] {
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }
    /* 横向滚动的图表/长内容允许其自身横滑，但不得撑破页面 */
    .table-container { max-height: none; }
}

/* 超窄屏（≤360px，如 iPhone SE / 老人机）再收一档 */
@media (max-width: 360px) {
    .stats-grid { gap: 8px; }
    .stat-card { padding: 12px; }
    .stat-value { font-size: 21px; }
    .mnav-item { font-size: 10px; }
    .mnav-ico { font-size: 19px; }
    .tb-title { font-size: 16px; }
}
