:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #1f2d3d;
  --muted: #7b8ba5;
  --border: #e6ecf3;
  --primary: #1e9fff;
  --primary-hover: #0d8ce8;
  --primary-soft: #e8f3ff;
  --success: #18a058;
  --success-soft: #e8f8ef;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --warn: #f08c00;
  --warn-soft: #fff3e0;
  --amber: #d9a400;
  --amber-soft: #fff8e0;
  --side-1: #0c2d52;
  --side-2: #11417a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 42, 80, .06), 0 1px 2px rgba(16, 42, 80, .04);
}

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

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

/* ==================================================================
   布局：左侧深蓝导航 + 右侧内容区
   ================================================================== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 216px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--side-1), var(--side-2));
  color: #c4d8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding-top: env(safe-area-inset-top);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e9fff, #0d6fd8);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(30, 159, 255, .4);
}
.brand-text h1 { font-size: 15px; font-weight: 650; color: #fff; letter-spacing: .5px; }
.brand-text .sub { font-size: 11px; color: #8fb0d8; margin-top: 1px; }

.side-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: #b7cde9;
  font-size: 14px;
  font-family: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab svg { width: 17px; height: 17px; flex-shrink: 0; }
.tab:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.tab.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(30, 159, 255, .35);
}
/* 待审核数量角标 */
.nav-badge {
  margin-left: auto;
  background: #ff5b5b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tab.active .nav-badge { background: #fff; color: var(--primary); }

.side-foot {
  padding: 10px 10px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .09);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-act {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 14px;
  border: none;
  background: transparent;
  color: #8fb0d8;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.side-act svg { width: 15px; height: 15px; flex-shrink: 0; }
.side-act:hover { color: #fff; background: rgba(255, 255, 255, .08); }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- 内容区顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 26px;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { font-size: 17px; font-weight: 650; letter-spacing: .3px; }
.status-box { display: flex; align-items: center; gap: 12px; }
.badge {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: var(--muted);
  white-space: nowrap;
}
.badge.on { background: var(--success-soft); color: var(--success); }
.next-run { font-size: 12px; color: var(--muted); white-space: nowrap; }
/* 当前登录者 */
.whoami {
  font-size: 12px;
  color: var(--side-1);
  background: var(--primary-soft);
  border-radius: 20px;
  padding: 4px 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- 容器 ---------- */
.container {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 26px 30px;
}

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

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 10px;
  flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; gap: 8px; }

.btn {
  padding: 7px 15px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all .15s;
}
.btn:hover { border-color: #c3d2e5; background: #f7fafd; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(30, 159, 255, .3);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: #fecaca; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 11px 14px;
  background: #f7f9fc;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f5faff; }
.table td.mono, .table td.num { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.w40 { width: 40px; } .w70 { width: 70px; } .w80 { width: 80px; } .w90 { width: 90px; }
.w100 { width: 100px; } .w110 { width: 110px; } .w120 { width: 120px; }
.w140 { width: 140px; } .w150 { width: 150px; } .w200 { width: 200px; }
.empty { text-align: center; color: var(--muted); padding: 34px !important; }

.name-cell { font-weight: 600; }
.link-name {
  cursor: pointer;
  border-bottom: 1px dashed var(--border);
}
.link-name:hover { color: var(--primary); border-bottom-color: var(--primary); }
.sub-text { font-size: 12px; color: var(--muted); }

/* 签到地点：单位名 + 地址两行，过长截断，鼠标悬停看完整内容 */
.table td.loc { max-width: 200px; }
.loc-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.pill-ok { background: var(--success-soft); color: var(--success); }
.pill-fail { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--primary-soft); color: var(--primary); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-off { background: #f1f5f9; color: var(--muted); }

.row-actions { display: flex; gap: 6px; }
.row-actions .link { white-space: nowrap; }
.link {
  border: none; background: transparent;
  color: var(--primary); cursor: pointer;
  font-size: 13px; font-family: inherit; padding: 2px 4px;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }

/* ---------- 设置 ---------- */
.settings { display: flex; flex-direction: column; gap: 16px; max-width: 780px; }
.set-group {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.set-group h3 {
  font-size: 14px; font-weight: 650;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  color: var(--side-1);
}
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 9px 0;
}
.set-label span { font-size: 14px; }
.set-label small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }

.input {
  padding: 7px 11px;
  border: 1px solid #d8e2ee;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30, 159, 255, .12); }
.w80 { width: 80px; } .w120 { width: 120px; }
.range { display: flex; align-items: center; gap: 8px; }
.tilde { color: var(--muted); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: #c9d6e6;
  border-radius: 24px;
  cursor: pointer;
  transition: .2s;
}
.slider::before {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.set-actions { display: flex; align-items: center; gap: 12px; }
.save-tip { font-size: 13px; color: var(--success); }

/* ---------- 配额提示条 ---------- */
.quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--primary-soft);
  border: 1px solid #cfe6ff;
  border-radius: var(--radius);
  padding: 10px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #0b5f9e;
}
.quota-bar b { font-size: 15px; }
.quota-bar[hidden] { display: none; }

/* 卡密：等宽字体，方便肉眼核对 */
.card-code { font-family: ui-monospace, Consolas, monospace; letter-spacing: .5px; }

/* ---------- 统计卡片 ---------- */
.stats {
  display: flex;
  align-items: stretch;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 150px;
  min-width: 150px;
}
.stat-ico {
  width: 42px; height: 42px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-ico svg { width: 20px; height: 20px; }
.stat-ico.is-blue   { background: var(--primary-soft); color: var(--primary); }
.stat-ico.is-green  { background: var(--success-soft); color: var(--success); }
.stat-ico.is-orange { background: var(--warn-soft); color: var(--warn); }
.stat-ico.is-red    { background: var(--danger-soft); color: var(--danger); }
.stat-ico.is-amber  { background: var(--amber-soft); color: var(--amber); }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stat.is-ok .stat-num { color: var(--success); }
.stat.is-warn .stat-num { color: var(--warn); }
.stat.is-err .stat-num { color: var(--danger); }
.stat.is-warn2 .stat-num { color: var(--amber); }
.stat.is-info .stat-num { color: var(--primary); }
.stat-note {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  padding-left: 4px;
  flex-basis: 100%;
}

/* ---------- 顶部告警横幅 ---------- */
.alert-banner {
  background: var(--amber-soft);
  border: 1px solid #f0e0a0;
  color: #8a6d00;
  border-radius: 8px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
/* display:flex 会盖掉 hidden 属性的默认隐藏，这里必须显式补回来 */
.alert-banner[hidden] { display: none; }
.alert-banner.is-err {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: #991b1b;
}
.banner-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  flex-shrink: 0;
}
.banner-close:hover { opacity: 1; }

.report-meta { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.last-run { font-size: 13px; text-align: right; max-width: 280px; }

/* ---------- 弹窗辅助 ---------- */
.modal-wide { width: 540px; }
.hint {
  font-size: 13px;
  color: #475569;
  background: var(--primary-soft);
  border: 1px solid #cfe6ff;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  line-height: 1.75;
}
.hint code {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
textarea.input {
  width: 100%;
  resize: vertical;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  line-height: 1.65;
}
select.input { cursor: pointer; }
.w180 { width: 180px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(10, 30, 60, .5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card);
  border-radius: 12px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 20px 50px rgba(10, 30, 60, .25);
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h2 { font-size: 15px; font-weight: 650; }
.modal-close {
  border: none; background: transparent;
  font-size: 22px; color: var(--muted);
  cursor: pointer; line-height: 1;
}
.modal-body { padding: 18px 20px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; margin-bottom: 5px; font-weight: 500; }
.field label i { color: var(--danger); font-style: normal; }
.field .input { width: 100%; }
.field small { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
}

/* ---------- 执行遮罩 ---------- */
.busy {
  position: fixed; inset: 0;
  background: rgba(238, 242, 247, .85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.busy.show { display: flex; }
.busy-card {
  background: var(--card);
  border-radius: 12px;
  padding: 26px 40px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(10, 30, 60, .12);
}
.spinner {
  width: 30px; height: 30px;
  margin: 0 auto 12px;
  border: 3px solid #dbe6f2;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.busy-card p { font-size: 14px; color: var(--muted); }

/* ---------- 登录页 ---------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, var(--side-1) 0%, var(--side-2) 55%, #1e9fff 130%);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  overflow-y: auto;
}
.auth-box {
  width: 400px;
  max-width: 92vw;
  background: var(--card);
  border-radius: 14px;
  padding: 30px 32px;
  box-shadow: 0 24px 60px rgba(5, 20, 40, .35);
}
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head .logo { display: flex; margin: 0 auto 12px; width: 44px; height: 44px; font-size: 20px; }
.auth-head h1 { font-size: 17px; font-weight: 650; margin-bottom: 3px; }
.auth-err {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-bottom: 6px;
}
/* 云数据库不可用时的提示 */
.db-down {
  background: #fff4e5;
  border: 1px solid #ffd8a8;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 13px;
  color: #8a4b08;
}
.db-down b { display: block; margin-bottom: 4px; font-size: 14px; }
.db-down p { margin: 0 0 6px; word-break: break-all; font-size: 12px; opacity: .85; }
.db-down small { font-size: 12px; opacity: .8; }
.db-down[hidden] { display: none; }

/* 管理员 / 学生 身份切换 */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  border-radius: 9px;
  padding: 4px;
  margin-bottom: 20px;
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: .15s;
}
.auth-tab:hover { color: var(--text); }
.auth-tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(16, 42, 80, .12);
}
.auth-alt {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.auth-alt a { color: var(--primary); cursor: pointer; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.btn-block { width: 100%; padding: 9px; font-size: 14px; }
.remember {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted);
  margin: 2px 0 4px; cursor: pointer;
}
.toast-wrap { margin-top: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  right: 24px; bottom: 24px;
  background: #22374f;
  color: #fff;
  padding: 11px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  transition: .25s;
  z-index: 80;
  max-width: 420px;
  pointer-events: none;
  line-height: 1.5;
  box-shadow: 0 8px 24px rgba(10, 30, 60, .25);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { background: var(--success); }
.toast.err { background: var(--danger); }

/* 移动端卡片首行的姓名，仅在窄屏显示 */
.chk-name { display: none; }

/* ==================================================================
   移动端 H5 适配（窄屏 ≤820px）
   侧栏变成顶部深蓝横条（横向滚动），表格变成「每行一张卡片」，
   用 td::before 的 data-label 补上列名，避免横向滚动。
   ================================================================== */
@media (max-width: 820px) {
  body {
    font-size: 14px;
    -webkit-text-size-adjust: 100%;
  }

  /* ---------- 侧栏 → 顶部深蓝横条 ---------- */
  .layout { display: block; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: max(6px, env(safe-area-inset-top)) 8px 6px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .side-brand { padding: 4px 8px; border-bottom: none; gap: 8px; }
  .logo { width: 30px; height: 30px; font-size: 14px; border-radius: 8px; }
  .brand-text { display: none; }
  .side-nav {
    flex-direction: row;
    padding: 4px 2px;
    gap: 2px;
    overflow: visible;
    flex: 0 0 auto;
  }
  .tab {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 11px;
    font-size: 13px;
    gap: 6px;
  }
  .tab svg { width: 15px; height: 15px; }
  .side-foot {
    margin-left: auto;
    flex-direction: row;
    padding: 4px 4px;
    border-top: none;
    gap: 2px;
    flex: 0 0 auto;
  }
  .side-act { padding: 8px 9px; }
  .side-act span { display: none; }
  .side-act svg { width: 16px; height: 16px; }

  /* ---------- 内容区顶栏 ---------- */
  .topbar {
    position: static;
    height: auto;
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .page-title { font-size: 16px; }
  .status-box { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .badge { font-size: 11px; padding: 4px 9px; }
  .next-run { display: none; }

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

  /* ---------- 统计卡片两列 ---------- */
  .stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat { padding: 10px 12px; min-width: 0; flex: none; gap: 10px; }
  .stat-ico { width: 36px; height: 36px; border-radius: 9px; }
  .stat-ico svg { width: 17px; height: 17px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 11px; }
  .stat-note {
    grid-column: 1 / -1;
    padding-left: 0;
    font-size: 11px;
    line-height: 1.5;
  }

  /* ---------- 工具栏纵向排列 ---------- */
  .toolbar { flex-direction: column; align-items: stretch; gap: 9px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  /* 按钮排成三列，避免最后剩一个按钮独占整行 */
  .toolbar-left {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .toolbar-left > .sub-text { grid-column: 1 / -1; }
  .toolbar-left .btn { width: 100%; min-height: 40px; padding: 8px 6px; font-size: 13px; }
  .toolbar-right { flex-wrap: wrap; gap: 8px; }
  .toolbar-right .btn { flex: 1 1 auto; min-height: 40px; }
  .toolbar-right .input, .toolbar-right select { width: 100%; flex: 1 1 100%; }
  .w80, .w120, .w140, .w180 { width: 100% !important; }

  /* ---------- 表格 → 卡片 ---------- */
  .table-wrap {
    box-shadow: none;
    background: transparent;
    border-radius: 0;
    overflow: visible;
  }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { display: none; }

  .table tbody tr {
    background: var(--card);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 4px 0;
    box-shadow: var(--shadow);
  }
  .table tbody tr:hover { background: var(--card); }

  .table td {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 12px;
    padding: 7px 14px;
    border-bottom: none;
    text-align: right;
    max-width: none !important;
  }
  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    flex-shrink: 0;
    margin-right: auto;
    text-align: left;
    padding-top: 2px;
  }
  /* 一格里有多段内容时纵向排列，避免挤成一行 */
  .table td > .cv {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 0;
  }

  /* 卡片首行：勾选框 + 姓名，兼作标题 */
  .table td.td-check {
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 11px 14px 7px;
    border-bottom: 1px solid #f1f5f9;
  }
  .table td.td-check::before { display: none; }
  .chk-name { display: inline; font-size: 15px; font-weight: 600; }
  /* 姓名已经放在卡片标题上了，正文里不用再重复一遍 */
  .table td.td-name { display: none; }

  /* 卡片底部：操作按钮条 */
  .table td.td-actions {
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 14px 8px;
    border-top: 1px solid #f1f5f9;
    margin-top: 4px;
  }
  .table td.td-actions::before { display: none; }

  .table td.empty {
    display: block;
    text-align: center;
    padding: 26px 14px !important;
    border-radius: 10px;
    background: var(--card);
    box-shadow: var(--shadow);
  }
  .table td.empty::before { display: none; }

  .row-actions { gap: 16px; }
  .link { font-size: 14px; padding: 4px 2px; }
  .loc-line { white-space: normal; text-align: right; line-height: 1.5; }
  .name-cell { font-size: 15px; }

  /* ---------- 设置页 ---------- */
  .settings { max-width: 100%; }
  .set-group { padding: 14px 16px; }
  .set-group h3 { font-size: 13px; }
  .set-row { flex-direction: column; align-items: flex-start; gap: 7px; }
  .set-row .input, .set-row .range { width: 100%; }
  .set-row .input.w80 { width: 100% !important; }
  .range { width: 100%; }
  .range .input { flex: 1; }
  .last-run { text-align: left; max-width: 100%; }
  .set-actions { flex-wrap: wrap; }

  /* ---------- 弹窗变底部抽屉 ---------- */
  .modal-mask.show { align-items: flex-end; }
  .modal, .modal-wide {
    width: 100%;
    max-width: 100%;
    border-radius: 14px 14px 0 0;
    max-height: 92vh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }

  /* 16px 防止 iOS 聚焦时自动放大页面 */
  .input, select, textarea { font-size: 16px !important; }

  .btn { min-height: 38px; }
  .report-meta { font-size: 12px; line-height: 1.6; }
  .auth-box { padding: 24px 20px; width: 100%; max-width: 100%; }
  .toast { right: 12px; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: none; font-size: 13px; }
}

/* 超窄屏（≤380px）再收紧一点 */
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 7px; }
  .stat-num { font-size: 18px; }
  .container { padding: 10px; }
  .tab { padding: 8px 9px; font-size: 12px; }
  .toolbar-left .btn, .toolbar-right .btn { font-size: 12px; padding: 7px 10px; }
}
