/* 消防设施普查填报端样式（房间驱动版） */
:root {
  --primary: #2E75B6;
  --primary-dark: #1F4E79;
  --red: #C00000;
  --orange: #BF8F00;
  --green: #548235;
  --bg: #f2f5f9;
  --card: #ffffff;
  --border: #dde4ec;
  --text: #24303e;
  --muted: #7b8794;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }

/* 顶栏 */
.topbar { position: sticky; top: 0; z-index: 50; background: var(--primary-dark); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.brand { font-size: 17px; font-weight: 700; white-space: nowrap; }
a.brand { color: inherit; text-decoration: none; }
.site-name { font-size: 13px; opacity: .85; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-wrap { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.progress-bar { flex: 1; height: 8px; background: rgba(255,255,255,.25); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: #8bc34a; transition: width .3s; }
.progress-text { font-size: 12px; white-space: nowrap; }

main { max-width: 1100px; margin: 0 auto; padding: 14px 12px 90px; }
.card { background: var(--card); border-radius: 10px; padding: 18px; margin-bottom: 14px; box-shadow: 0 1px 3px rgba(30,50,80,.08); }
.card.narrow { max-width: 620px; margin-left: auto; margin-right: auto; }
.card h2 { font-size: 16px; margin-bottom: 12px; color: var(--primary-dark); }
.card h3 { font-size: 14px; margin: 14px 0 8px; }
.muted { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.muted-sm { color: var(--muted); font-size: 12px; font-weight: normal; }
.err { color: var(--red); font-size: 13px; margin-top: 6px; }

.input { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 15px; background: #fff; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(46,117,182,.15); }
label { display: block; font-size: 14px; margin-bottom: 10px; }
label .input { margin-top: 4px; }
.form-row { display: flex; gap: 12px; }
.form-row label { flex: 1; }

.btn { display: inline-block; padding: 9px 18px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); font-size: 14px; cursor: pointer; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-lg { padding: 12px 26px; font-size: 16px; }
.btn-block { display: block; width: 100%; margin-top: 10px; text-align: center; }
.btn[disabled] { opacity: .5; }

.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 14px 0 10px; display: flex; gap: 12px; justify-content: center; }

/* 场所信息 */
.site-info { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px 18px; font-size: 14px; }
.site-info b { color: var(--primary-dark); }
.site-info .tier-badge { display: inline-block; background: #fff3e0; color: #e65100; border-radius: 4px; padding: 1px 8px; font-size: 13px; }

/* 房间选择 */
.room-group-title { font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.room-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.room-chip { border: 1.5px solid var(--border); border-radius: 20px; padding: 7px 14px; font-size: 14px; cursor: pointer; background: #fff; user-select: none; transition: all .15s; }
.room-chip.on { border-color: var(--primary); background: #e8f1fa; color: var(--primary-dark); font-weight: 600; }
.room-chip.on::before { content: "✓ "; }
.room-chips-extra { display: contents; }
.room-chips-extra[hidden] { display: none; }
.room-more-toggle { margin-top: 10px; font-size: 13px; color: var(--primary); cursor: pointer; }
.mixed-preview { margin-top: 14px; background: #fff8e8; border: 1px solid #f0dcae; border-radius: 8px; padding: 12px; font-size: 13px; }
.mixed-preview b { color: var(--orange); }
.mode-switch { display: inline-flex; gap: 0; margin-left: 10px; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; vertical-align: middle; }
.mode-switch span { padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--muted); background: #fff; }
.mode-switch span.on { background: var(--primary); color: #fff; }

/* 系统排除 */
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.sys-chip { border: 1.5px solid var(--border); border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer; background: #fff; user-select: none; }
.sys-chip.on { border-color: var(--red); background: #fdeeee; color: var(--red); }
.sys-chip.on::before { content: "✕ 没有："; }

/* 房间页签 */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; -webkit-overflow-scrolling: touch; }
.tab { flex: 0 0 auto; padding: 8px 16px; border-radius: 8px 8px 0 0; background: #fff; border: 1px solid var(--border); border-bottom: none; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tab.on { background: var(--primary-dark); color: #fff; font-weight: 600; }
.tab .tab-cnt { font-size: 11px; opacity: .8; margin-left: 4px; }

/* 填报布局：左导航 + 右内容 */
.fill-layout { display: flex; gap: 12px; align-items: flex-start; }
.side-nav { width: 190px; flex: 0 0 auto; position: sticky; top: 60px; max-height: calc(100vh - 80px); overflow-y: auto; background: #fff; border-radius: 10px; padding: 8px; box-shadow: 0 1px 3px rgba(30,50,80,.08); }
.side-nav a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; cursor: pointer; margin-bottom: 2px; }
.side-nav a:hover { background: #f0f5fb; }
.side-nav a.on { background: #e8f1fa; color: var(--primary-dark); font-weight: 600; }
.side-nav .nav-cnt { font-size: 11px; color: var(--muted); background: #eef1f5; border-radius: 8px; padding: 0 6px; }
.side-nav .nav-cnt.done { background: #e2f0d9; color: var(--green); }
.fill-content { flex: 1; min-width: 0; }
.nav-anchor { scroll-margin-top: 70px; }

/* 设备项卡片 */
.item-card { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(30,50,80,.08); border-left: 4px solid transparent; }
.item-card.vis-show { border-left-color: var(--green); }
.item-card.vis-confirm { border-left-color: var(--orange); }
.item-card.flash { box-shadow: 0 0 0 2px var(--red); }
.item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-name { font-size: 15px; font-weight: 600; }
.item-unit { font-size: 12px; color: var(--muted); }
.req-badge { font-size: 12px; border-radius: 4px; padding: 1px 7px; }
.req-badge.show { background: #e2f0d9; color: var(--green); }
.req-badge.confirm { background: #fff3e0; color: #e65100; }
.def-toggle { font-size: 12px; color: var(--primary); cursor: pointer; border: none; background: none; }
.def-box { display: none; margin-top: 8px; padding: 8px 10px; background: #f6f8fb; border-radius: 6px; font-size: 12.5px; color: #566; line-height: 1.6; }
.def-box.open { display: block; }
.qty-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.qty-row label { margin: 0; font-size: 14px; white-space: nowrap; }
.qty-input { width: 90px; padding: 8px; border: 1.5px solid var(--border); border-radius: 6px; font-size: 16px; text-align: center; }
.qty-hint { font-size: 12px; color: var(--muted); }

/* 明细行 */
.rows-box { margin-top: 12px; }
.rows-head, .detail-row { display: grid; grid-template-columns: 28px 1fr 1fr 1.3fr 1fr .95fr 46px; gap: 6px; }
.rows-head { font-size: 12px; color: var(--muted); margin-bottom: 4px; padding: 0 2px; }
.detail-row { margin-bottom: 6px; align-items: center; }
.detail-row .input { padding: 7px 8px; font-size: 13.5px; }
.detail-row .row-no { font-size: 12px; color: var(--muted); text-align: center; }
.copy-btn { border: 1px solid var(--border); background: #f6f8fb; border-radius: 5px; font-size: 12px; color: var(--primary); cursor: pointer; padding: 6px 2px; }
.field { display: contents; }
.rows-tip { font-size: 12px; color: var(--orange); margin-top: 4px; }

/* B 码分区标题条（吸顶） */
.group-head { position: sticky; top: 52px; z-index: 30; scroll-margin-top: 110px; background: var(--primary-dark); color: #fff; font-size: 13.5px; font-weight: 600; padding: 7px 12px; border-radius: 6px; margin: 14px 0 10px; box-shadow: 0 1px 3px rgba(30,50,80,.2); }

/* 单位提示（灭火器按组等） */
.unit-tip { display: inline-block; background: #e8f1fa; color: var(--primary-dark); border-radius: 4px; padding: 1px 8px; font-size: 12px; }

/* check 型确认题选项 */
.check-opts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.check-opt { border: 1.5px solid var(--border); border-radius: 18px; padding: 7px 16px; font-size: 14px; cursor: pointer; background: #fff; user-select: none; }
.check-opt.on { border-color: var(--primary); background: #e8f1fa; color: var(--primary-dark); font-weight: 600; }
.check-opt.on::before { content: "✓ "; }

/* 定制行字段项（防火门）：标签式卡片网格 */
.rows-box.extra .detail-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 6px 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fafbfd; margin-bottom: 8px; }
.rows-box.extra .detail-row .field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
.rows-box.extra .detail-row .field::before { content: attr(data-label); }
.rows-box.extra .detail-row .row-no { grid-column: 1 / -1; text-align: left; font-weight: 600; }
.rows-box.extra .detail-row .copy-btn { grid-column: 1 / -1; padding: 7px; }

/* 提交检查 */
#submitSummary { font-size: 14px; line-height: 2; }
#submitSummary b { color: var(--primary-dark); }
.warn-item { font-size: 13px; color: var(--orange); background: #fff8e8; border-radius: 6px; padding: 8px 10px; margin: 6px 0; }

/* 已提交视图 */
.done-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--green); color: #fff; font-size: 32px; display: flex; align-items: center; justify-content: center; margin: 8px auto 14px; }
#doneSummary { font-size: 14px; line-height: 2; margin-bottom: 10px; }

/* 场所组织树 */
.tree-box { margin-top: 10px; max-height: 62vh; overflow-y: auto; }
.tree-box details { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: #fff; overflow: hidden; }
.tree-box summary { padding: 11px 12px; cursor: pointer; font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; list-style: none; }
.tree-box summary::-webkit-details-marker { display: none; }
.tree-box summary .cnt { font-size: 12px; color: var(--muted); font-weight: normal; }
.tree-box summary::before { content: "▸"; color: var(--primary); margin-right: 8px; transition: transform .15s; }
.tree-box details[open] > summary::before { transform: rotate(90deg); }
.tree-site { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px 9px 26px; border-top: 1px solid #eef1f5; text-decoration: none; color: var(--text); font-size: 14px; }
.tree-site:hover { background: #f0f5fb; }
.tree-site .t-meta { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tree-site .t-done { font-size: 11px; color: #2e7d32; font-weight: normal; margin-left: 6px; white-space: nowrap; }
.tree-empty { padding: 14px; font-size: 13px; color: var(--muted); }
/* 部门层（嵌套在单位 details 内）：去边框、缩进、字号略小 */
.tree-box details details { border: none; border-radius: 0; margin-bottom: 0; }
.tree-box details details > summary { padding: 8px 12px 8px 22px; font-size: 13px; font-weight: 500; color: #4a5568; }
.tree-box details details > summary .cnt { font-size: 11px; }
.tree-box details details .tree-site { padding-left: 40px; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 99; max-width: 80vw; }
.toast.show { opacity: 1; }

/* ---------- 手机端 ---------- */
@media (max-width: 760px) {
  .side-nav { position: sticky; top: 52px; z-index: 40; width: 100%; max-height: none; display: flex; overflow-x: auto; padding: 6px; margin-bottom: 8px; }
  .fill-layout { flex-direction: column; }
  .side-nav a { flex: 0 0 auto; white-space: nowrap; margin: 0 2px 0 0; }
  .form-row { flex-direction: column; gap: 0; }
  .rows-head { display: none; }
  .detail-row { grid-template-columns: 1fr 1fr; gap: 6px 8px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: #fafbfd; }
  .field { display: flex; flex-direction: column; gap: 2px; font-size: 11px; color: var(--muted); }
  .field::before { content: attr(data-label); }
  .detail-row .row-no { grid-column: 1 / -1; text-align: left; font-weight: 600; }
  .detail-row .copy-btn { grid-column: 1 / -1; padding: 7px; }
  .progress-wrap { min-width: 90px; }
  .group-head { top: 96px; }
}
