/* 网格安全随手拍 —— 移动端优先样式 */
:root {
  --brand: #0b6cd0;
  --brand-d: #0757a8;
  --brand-l: #e9f2fd;
  --bg: #f2f4f8;
  --card: #ffffff;
  --text: #17202e;
  --muted: #6b7789;
  --line: #e6ebf2;
  --danger: #e0464b;
  --danger-l: #fdecec;
  --warn: #b87400;
  --warn-l: #fff4e0;
  --ok: #0f9d58;
  --ok-l: #e6f7ee;
  --r: 14px;
  --shadow: 0 2px 10px rgba(17, 38, 74, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px;
  background: linear-gradient(180deg, #0b6cd0 0%, #0a63bf 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(9, 70, 140, 0.18);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-weight: 700; font-size: 17px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 16px; font-weight: 600; letter-spacing: .3px; }
.brand-text small { font-size: 11px; opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .icon-btn { color: #fff; }

/* ---------- 主区域 ---------- */
.view {
  padding: 14px 14px calc(78px + var(--safe-b));
  min-height: 60vh;
}

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
}
.card + .card { margin-top: 12px; }

.block { margin-top: 18px; }
.block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 0 2px 10px;
}
.block-head h3 { font-size: 15px; font-weight: 600; }
.block-head a, .block-head button { font-size: 13px; color: var(--muted); }

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; font-weight: 600; }

/* ---------- 首页 ---------- */
.capture-btn {
  width: 100%;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 15px;
  margin: 2px 0 6px;
  border-radius: 16px;
  text-align: left;
  background: linear-gradient(135deg, #0b6cd0, #1487e2);
  color: #fff;
  box-shadow: 0 10px 22px rgba(11, 108, 208, .25);
}
.capture-btn:active { transform: scale(.995); }
.cap-ico {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px;
  background: rgba(255, 255, 255, .2);
}
.cap-ico svg { width: 24px; height: 24px; }
.cap-text { flex: 1; min-width: 0; }
.cap-text b { display: block; font-size: 17px; font-weight: 600; }
.cap-text em { display: block; font-style: normal; font-size: 12px; opacity: .85; margin-top: 2px; }
.capture-btn > svg { width: 17px; height: 17px; opacity: .75; flex: none; }

/* ---------- 添加到主屏幕 ---------- */
.install-bar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(66px + var(--safe-b));
  width: calc(100% - 24px);
  max-width: 616px;
  display: flex; align-items: center; gap: 9px;
  padding: 10px 11px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff6e3, #ffe9c9);
  border: 1px solid #f0c584;
  box-shadow: 0 8px 20px rgba(160, 100, 20, .18);
  z-index: 26;
}
.ib-ico {
  width: 36px; height: 36px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: #f59e0b; color: #fff;
}
.ib-ico svg { width: 20px; height: 20px; }
.ib-text { flex: 1; min-width: 0; }
.ib-text b { display: block; font-size: 13.5px; font-weight: 600; color: #7a4700; }
.ib-text em { display: block; font-style: normal; font-size: 11.5px; color: #a06a1a; margin-top: 1px; }
.ib-btn {
  flex: none;
  background: #f59e0b; color: #fff;
  padding: 8px 13px; border-radius: 9px;
  font-size: 13px; font-weight: 600;
}
.ib-close { flex: none; color: #b07a2a; font-size: 18px; line-height: 1; padding: 2px 3px; }

.steps { margin: 0; padding-left: 20px; }
.steps li { font-size: 13.5px; line-height: 1.9; color: var(--text); }

.ig-tip { font-size: 12.5px; color: var(--muted); margin: 0 0 4px; }
.ig-step {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
}
.ig-step:last-child { border-bottom: none; }
.ig-n {
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}
.ig-ic { width: 24px; height: 24px; flex: none; color: var(--brand); display: grid; place-items: center; }
.ig-ic svg { width: 20px; height: 20px; }
.ig-t { font-size: 14px; line-height: 1.5; }

/* ---------- 安装说明 ---------- */
.ig-tip { font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.ig-line { font-size: 14.5px; line-height: 1.7; color: var(--text); margin: 0; }

/* ---------- 记录卡片 ---------- */
.guide { margin-top: 4px; }
.guide-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.guide ol { margin: 0; padding-left: 20px; }
.guide li { font-size: 13px; line-height: 1.85; color: var(--muted); }
.guide li b { color: var(--text); font-weight: 600; }
.rec {
  display: flex; gap: 11px;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid transparent;
}
.rec:active { border-color: var(--brand-l); background: #fbfdff; }
.rec-thumb {
  width: 78px; height: 78px; flex: none;
  border-radius: 10px;
  object-fit: cover;
  background: #eef1f6;
  display: grid; place-items: center;
  color: #b9c3d2;
}
.rec-thumb svg { width: 24px; height: 24px; }
.rec-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rec-desc {
  font-size: 14px; margin: 5px 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-all;
}
.rec-meta { font-size: 11.5px; color: var(--muted); margin-top: auto; }

.tag {
  font-size: 11.5px; padding: 2px 7px; border-radius: 6px;
  background: var(--brand-l); color: var(--brand-d); font-weight: 500;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sess-del {
  margin-left: auto;
  font-size: 12px; color: var(--danger);
  background: var(--danger-l);
  border-radius: 7px; padding: 3px 9px;
}
.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 999px; font-weight: 500;
  white-space: nowrap;
}
.badge.warn { background: var(--warn-l); color: var(--warn); }
.badge.ok { background: var(--ok-l); color: var(--ok); }
.badge.level-重大 { background: var(--danger-l); color: var(--danger); }
.badge.level-较大 { background: var(--warn-l); color: var(--warn); }
.badge.level-一般 { background: #eef2f7; color: var(--muted); }

/* ---------- 筛选 ---------- */
.filters { display: flex; gap: 8px; margin-bottom: 12px; }
.filters select, .filters input {
  flex: 1; min-width: 0;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
}
.searchbar { position: relative; margin-bottom: 10px; }
.searchbar input {
  width: 100%; padding: 11px 12px 11px 36px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); font-size: 14px;
}
.searchbar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  z-index: 30;
}
.tabbar .tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 7px;
  color: var(--muted);
  font-size: 10.5px;
}
.tabbar .tab svg { width: 22px; height: 22px; }
.tabbar .tab.active { color: var(--brand); }
.tabbar .tab.active svg { stroke-width: 2.2; }
.tabbar .tab em { font-style: normal; }

/* ---------- 悬浮拍照按钮 ---------- */
.fab {
  position: fixed;
  left: 50%; margin-left: 254px;
  bottom: calc(82px + var(--safe-b));
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(11, 108, 208, .35);
  z-index: 25;
}
.fab:active { background: var(--brand-d); }
.fab svg { width: 25px; height: 25px; }
@media (max-width: 680px) {
  .fab { left: auto; right: 16px; margin-left: 0; }
}

/* ---------- 弹层（新增/详情） ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
  max-width: 640px; margin: 0 auto;
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(28px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet.hidden { display: none; }
.sheet-head {
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + var(--safe-t)) 12px 10px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
.sheet-head h2 { flex: 1; text-align: center; font-size: 16px; font-weight: 600; }
.sheet-head .text-btn { color: var(--brand); font-size: 15px; font-weight: 500; padding: 4px 6px; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px 20px; }
.sheet-foot {
  padding: 10px 14px calc(10px + var(--safe-b));
  background: var(--card);
  border-top: 1px solid var(--line);
}
.sheet-foot:empty { display: none; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 12.5px; color: var(--muted);
  margin: 0 0 6px 2px; font-weight: 500;
}
.field .req { color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 15px;
  appearance: none;
  outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(11,108,208,.1); }
textarea.input { min-height: 84px; resize: vertical; line-height: 1.5; }
select.input {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7789' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.seg {
  display: flex; gap: 6px;
  padding: 4px;
  background: #eaeef4;
  border-radius: 11px;
}
.seg button {
  flex: 1; padding: 8px 6px; border-radius: 8px;
  font-size: 13.5px; color: var(--muted); font-weight: 500;
  text-align: center;
}
.seg button.on { background: var(--card); color: var(--brand); box-shadow: 0 1px 4px rgba(20,40,80,.1); font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-size: 13px; color: var(--text);
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.chip.sm { font-size: 12px; padding: 4px 9px; background: #f6f8fb; color: var(--muted); border-color: transparent; }
.chip.sm.on { background: var(--brand-l); color: var(--brand-d); }

/* ---------- 照片 ---------- */
.file-input {
  position: fixed;
  left: -9999px; top: 0;
  width: 1px; height: 1px;
  opacity: 0;
  overflow: hidden;
}
label.btn, .ph-add { cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph {
  position: relative; aspect-ratio: 1 / 1;
  border-radius: 10px; overflow: hidden; background: #e9edf3;
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  display: grid; place-items: center; font-size: 14px; line-height: 1;
}
.ph-add {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1.5px dashed #c3cede;
  background: #f8fafd;
  color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  font-size: 11.5px;
}
.ph-add svg { width: 22px; height: 22px; }
.photo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }

/* ---------- 隐患条目 ---------- */
.item-card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 10px;
  border-left: 3px solid #cfe2f7;
}
.item-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.item-head span { font-size: 13px; font-weight: 600; color: var(--brand-d); }
.item-del { font-size: 12px; color: var(--muted); }
.mat-toggle {
  display: block; width: 100%; text-align: left;
  font-size: 12.5px; color: var(--brand);
  background: #f7f9fc; border-radius: 8px;
  padding: 7px 10px; margin-top: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mat-box { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.mat-box .block-head h4 { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* ---------- 物资 ---------- */
.mat-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 52px 44px 26px;
  gap: 6px; align-items: center; margin-bottom: 8px;
}
.mat-row .input { padding: 9px 8px; font-size: 13px; }
.mat-row input[type="number"]::-webkit-outer-spin-button,
.mat-row input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.mat-row input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.mat-del { color: var(--muted); font-size: 17px; text-align: center; }
.add-line {
  width: 100%; padding: 9px;
  border-radius: 10px; border: 1px dashed #c3cede;
  color: var(--brand); font-size: 13.5px; background: #f8fafd;
}

/* ---------- 详情 ---------- */
.detail-hero { border-radius: var(--r); overflow: hidden; background: #111; margin-bottom: 12px; }
.detail-hero img { width: 100%; max-height: 46vh; object-fit: contain; display: block; }
.thumbs { display: flex; gap: 7px; overflow-x: auto; padding: 8px 0 2px; }
.thumbs img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; flex: none; }
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 10px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; word-break: break-all; }

.actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: 11px;
  font-size: 15px; font-weight: 500;
  background: var(--card); color: var(--text);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { opacity: .85; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:active { background: var(--brand-d); }
.btn-danger { color: var(--danger); border-color: #f3cfd0; background: var(--danger-l); }
.btn-ok { color: #fff; background: var(--ok); border-color: var(--ok); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13.5px; border-radius: 9px; }
.btn[disabled] { opacity: .45; }
.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px; color: var(--text);
}
.icon-btn svg { width: 21px; height: 21px; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 13px 14px;
}
.stat .n { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 1px; }
.stat.accent .n { color: var(--brand); }
.stat.warn .n { color: var(--warn); }

.bars { display: grid; gap: 9px; }
.bar-row { font-size: 13px; }
.bar-top { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bar-top span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--brand); }
.bar-fill.pending { background: #f0a020; }

/* ---------- 设置 ---------- */
.list-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
}
.list-row:last-child { border-bottom: none; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.list-row .chev { color: #c3cede; }

/* ---------- toast / lightbox ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b));
  transform: translate(-50%, 10px);
  max-width: 80vw;
  padding: 10px 16px; border-radius: 10px;
  background: rgba(20,28,42,.92); color: #fff;
  font-size: 13.5px; line-height: 1.45;
  opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
  z-index: 90;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- 场次 ---------- */
.session-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 11px 14px 11px 15px;
  margin-bottom: 12px;
  border-left: 4px solid var(--brand);
}
.sb-body { flex: 1; min-width: 0; }
.sb-k { font-size: 11.5px; color: var(--muted); }
.sb-name {
  font-size: 15px; font-weight: 600; margin: 1px 0 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-meta {
  font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-action {
  display: flex; align-items: center; gap: 1px;
  color: var(--brand); font-size: 13px; flex: none;
}
.sb-action svg { width: 14px; height: 14px; }

.session-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--brand-l); color: var(--brand-d);
  border-radius: 10px; padding: 8px 12px; margin-bottom: 12px;
  font-size: 12.5px; font-weight: 500;
}
.session-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-chip em { font-style: normal; opacity: .7; font-size: 11.5px; flex: none; }

.stat-note {
  font-size: 12.5px; color: var(--muted);
  margin: 0 2px 10px;
}

.ph-empty { width: 100%; height: 100%; display: grid; place-items: center; color: #b9c3d2; }
.ph-empty svg { width: 22px; height: 22px; }

/* ---------- 功能建议 ---------- */
.sug-link { text-align: center; margin: 20px 0 4px; }
.sug-link button {
  font-size: 12.5px; color: var(--muted);
  border-bottom: 1px dashed #c9d3e0; padding-bottom: 1px;
}

.sug {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 11px 13px;
  margin-bottom: 9px;
}
.sug-top { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sug-top b { font-size: 13.5px; font-weight: 600; }
.sug-top em { font-style: normal; font-size: 11.5px; color: var(--muted); margin-right: auto; }
.sug-text {
  font-size: 14px; line-height: 1.55; margin: 7px 0 8px;
  white-space: pre-wrap; word-break: break-word;
}
.sug-act {
  font-size: 12px; color: var(--brand);
  background: var(--brand-l); padding: 4px 10px; border-radius: 7px;
}

/* ---------- 打印 ---------- */
.print-area { display: none; }

/* 隐藏 Netlify 免费版右下角徽标，避免遮挡底部导航 */
#nl-badge-frame { display: none !important; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  body { background: #fff; max-width: none; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block !important; color: #000; font-size: 12pt; }
  .print-area h1 { font-size: 16pt; text-align: center; margin: 0 0 4mm; letter-spacing: 1px; }
  .print-area .meta { text-align: center; font-size: 9pt; color: #444; margin-bottom: 6mm; }
  .print-area table { width: 100%; border-collapse: collapse; margin-bottom: 5mm; }
  .print-area th, .print-area td {
    border: 1px solid #333; padding: 2.2mm 2.5mm;
    font-size: 10pt; vertical-align: top; text-align: left;
  }
  .print-area th { width: 26mm; background: #f2f2f2; font-weight: 600; white-space: nowrap; }
  .print-area .photos { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; margin-bottom: 5mm; }
  .print-area .photos img { width: 100%; height: 62mm; object-fit: contain; border: 1px solid #999; }
  .print-area .sign { display: flex; justify-content: space-between; margin-top: 10mm; font-size: 10pt; }
  .print-area .foot { margin-top: 6mm; font-size: 8.5pt; color: #666; }
}

@media (min-width: 700px) {
  body { box-shadow: 0 0 30px rgba(0,0,0,.06); }
}

/* ---------- 月度统计 ---------- */
.month-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.month-bar .input { flex: 1; min-width: 0; }
.month-bar .btn { flex: none; }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn-danger { background: var(--danger-l); color: var(--danger); }

.table-card { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.m-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.m-table th, .m-table td {
  padding: 9px 10px; text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle; white-space: nowrap;
}
.m-table th { background: #f6f8fc; color: var(--muted); font-size: 12px; font-weight: 600; }
.m-table tr:last-child td { border-bottom: none; }
.m-table .gd { font-weight: 600; }
.m-table .num { color: var(--muted); font-variant-numeric: tabular-nums; }
.m-table .dates { white-space: normal; min-width: 130px; }
.m-table tr.warn-row { background: #fffaf0; }
.dchip {
  display: inline-block; margin: 2px 4px 2px 0;
  padding: 1px 6px; border-radius: 6px;
  background: #fdecec; color: #c0392b; font-size: 12px;
}
.follow-dates { text-align: right; max-width: 50%; white-space: normal; }

/* ---------- 电脑端 ---------- */
@media (min-width: 900px) {
  body {
    display: flex; flex-direction: column;
    max-width: 1180px; margin: 0 auto;
    box-shadow: 0 0 0 1px var(--line);
  }
  .topbar { order: 0; padding: 14px 24px; }
  #view { order: 2; flex: 1; }
  .tabbar {
    order: 1;
    position: static; left: auto; transform: none;
    max-width: none; border-top: none;
    border-bottom: 1px solid var(--line);
  }
  .tabbar .tab { flex-direction: row; gap: 8px; font-size: 14px; padding: 13px 0; }
  .tabbar .tab svg { width: 20px; height: 20px; }
  .view { padding: 22px 24px 60px; }
  .fab { left: auto; right: 40px; bottom: 40px; }
  .sheet {
    max-width: 760px; margin: 0 auto;
    top: 36px; bottom: 36px;
    border-radius: 16px;
    border-top: none;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(15, 25, 40, .28);
  }
  .install-bar { display: none; }
  .m-table { font-size: 14px; }
  .heat td { width: 26px; height: 26px; border-radius: 5px; }
  .heat { border-spacing: 5px; margin: 0 auto; }
  .heat-card { width: max-content; max-width: 100%; margin-left: auto; margin-right: auto; }
  .heat th { font-size: 12px; }
  .heat .hgrid { font-size: 13px; padding-right: 12px; }
  .month-bar { max-width: 560px; }
  .stat-grid.four { grid-template-columns: repeat(4, 1fr); }
}

.m-badges { display: block; margin-top: 3px; }
.m-badges .badge { margin-right: 4px; font-size: 11px; }

@media (max-width: 899px) {
  .stat-grid.four { grid-template-columns: repeat(2, 1fr); }
  .m-table { min-width: 0; }
  .m-table th:nth-child(4), .m-table td:nth-child(4),
  .m-table th:nth-child(5), .m-table td:nth-child(5) { display: none; }
  .m-table .dates { min-width: 96px; }
}
@media (min-width: 900px) {
  .m-badges { display: none; }
}

/* ---------- 月度仪表盘 ---------- */
.hero { display: flex; align-items: center; gap: 18px; }
.hero-ring { flex: none; }
.hero-main { flex: 1; min-width: 0; }
.hero-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.hero-desc { font-size: 15px; line-height: 1.65; margin: 0 0 10px; }
.ok-text { color: #1f9d55; }
.bad-text { color: var(--danger); }
.hero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hchip { font-size: 12px; padding: 3px 8px; border-radius: 8px; background: #eef4fb; color: #45607e; }
.hchip.warn { background: #fdf0e6; color: #b45309; }

.heat-card { padding: 10px 10px 12px; }
.heat-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 11px; }
.heat th { font-weight: 500; color: var(--muted); white-space: nowrap; text-align: center; }
.heat .hgrid {
  position: sticky; left: 0; z-index: 1;
  background: var(--card); text-align: left;
  padding-right: 8px; font-size: 12px; color: var(--text); white-space: nowrap;
}
.heat td { width: 15px; height: 15px; border-radius: 4px; background: #eef2f8; }
.heat td.ok { background: #38b26a; }
.heat td.bad { background: #ec5b5b; }

@media (max-width: 899px) {
  .hero { gap: 12px; padding: 14px; }
  .hero .donut { width: 84px; height: 84px; }
  .hero-desc { font-size: 14px; }
  .bname { width: 74px; font-size: 12.5px; }
  .heat { border-spacing: 2px; }
  .heat td { width: 10px; height: 10px; border-radius: 3px; }
  .heat .hgrid { font-size: 10.5px; padding-right: 4px; }
  .heat th { font-size: 9px; }
  .heat th.hmeet { padding-left: 6px; }
}

.heat tfoot td.sum {
  height: 16px; background: none;
  text-align: center; font-size: 10.5px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.heat tfoot td.sum.has { color: #c0392b; font-weight: 700; }

/* ---------- 月/周切换 ---------- */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: #eef2f8; border-radius: 10px; margin-bottom: 12px;
}
.seg-btn {
  border: none; background: none; padding: 6px 18px;
  font-size: 13px; border-radius: 8px; color: var(--muted);
  white-space: nowrap;
}
.seg-btn.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(15,25,40,.12); }

.week-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; }
.wchip {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 7px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text);
}
.wchip b { font-size: 13px; font-weight: 600; }
.wchip em { font-style: normal; font-size: 11px; color: var(--muted); }
.wchip.on { border-color: var(--brand); background: var(--brand-l); }
.wchip.on b { color: var(--brand-d); }
.wchip.nodata { opacity: .55; }
.wchip.nodata em { text-decoration: none; }
@media (min-width: 900px) {
  .heat-card.week .heat td { width: 36px; height: 36px; border-radius: 6px; }
}
.heat th.hmeet { padding-left: 14px; border-left: 1px solid var(--line); color: #b45309; }
.heat td.meet { margin-left: 14px; border-left: 1px solid var(--line); border-radius: 4px; }

/* ---------- 本场记录筛选 ---------- */
.filter-chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 2px 10px; margin: 0 -2px;
  -webkit-overflow-scrolling: touch;
}
.fchip {
  flex: none; border: 1px solid var(--line); background: #fff;
  color: var(--text); font-size: 12.5px;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap;
}
.fchip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }
.block-head .hint button {
  background: none; border: none; color: var(--brand);
  font-size: 12.5px; padding: 0 0 0 6px;
}

.lv-big { background: #fdecec !important; color: #c0392b !important; }
.lv-mid { background: #fdf0e6 !important; color: #b45309 !important; }
.lv-low { background: #eef4fb !important; color: #45607e !important; }

@media (max-width: 899px) {
  .sname { width: 74px; font-size: 12.5px; }
}
.stat-cols { display: block; }
@media (min-width: 900px) {
  .stat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
  .stat-cols .block { margin-bottom: 0; }
}

/* ---------- 统计：网格方块 & 分类占比 ---------- */
.grid-tiles {
  display: grid; gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}
.gtile {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
  border-left: 3px solid #38b26a;
}
.gtile.has-todo { border-left-color: #f3b73e; }
.gt-name { font-size: 13px; color: var(--text); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-num { font-size: 24px; font-weight: 700; line-height: 1.1; color: var(--text); }
.gt-num em { font-size: 12px; font-weight: 500; color: var(--muted); font-style: normal; margin-left: 2px; }
.gt-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.gtile.has-todo .gt-sub { color: #b45309; }

.share-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: #eef2f8; }
.share-bar i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--text); }
.legend i { width: 9px; height: 9px; border-radius: 3px; }
.legend b { font-weight: 600; }
.legend em { font-style: normal; color: var(--muted); font-size: 11.5px; }

@media (min-width: 900px) {
  .grid-tiles { grid-template-columns: repeat(4, 1fr); }
}
