/* 装迹本 v2 · 风格 B 红绿灯付款闸门高对比工地控制面板 */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #EEF0F2;
  --card: #FFFFFF;
  --ink: #111827;
  --muted: #4B5563;
  --subtle: #6B7280;
  --line: rgba(17, 24, 39, 0.10);
  --red: #D92D20;
  --red-soft: #FEF2F2;
  --amber: #D97706;
  --amber-soft: #FFFBEB;
  --green: #059669;
  --green-soft: #ECFDF5;
  --radius: 16px;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

.num { font-variant-numeric: tabular-nums; }

/* 顶部深炭黑粘性控制 HUD */
.sticky-hud {
  position: sticky;
  top: 0;
  z-index: 25;
  background: rgba(17, 24, 39, 0.97);
  color: #F9FAFB;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brand-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: #FFFFFF;
}

.plan-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.plan-badge.free {
  background: rgba(255, 255, 255, 0.14);
  color: #E5E7EB;
}
.plan-badge.pro {
  background: rgba(16, 185, 129, 0.22);
  color: #6EE7B7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.hud-lights {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #F9FAFB;
}

.lamp {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.20);
  flex-shrink: 0;
}
.lamp.on-r { background: #EF4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.28); }
.lamp.on-y { background: #F59E0B; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.28); }
.lamp.on-g { background: #10B981; box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28); }

.bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #D1D5DB;
}
.bar-meta strong { color: #FFFFFF; }

.reserve-alert {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
}
.reserve-alert.safe { background: rgba(16, 185, 129, 0.18); color: #6EE7B7; }
.reserve-alert.danger { background: rgba(239, 68, 68, 0.24); color: #FCA5A5; }

.track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  display: flex;
}
.fill-paid { background: #10B981; transition: width 0.24s ease; }
.fill-risk { background: #EF4444; transition: width 0.24s ease; }

/* 主内容区：移动单栏，桌面 1080px 舒展双栏控制面板 */
.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 14px 104px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.col-audit, .col-gates {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

@media (min-width: 960px) {
  .main {
    padding: 20px 20px 108px;
    grid-template-columns: minmax(0, 1.32fr) minmax(0, 1fr);
    gap: 18px;
  }
  .col-gates {
    position: sticky;
    top: 104px;
  }
}

/* 盘口设置卡 */
.setup-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.setup-lbl {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.pill-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #F9FAFB;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pill.active {
  background: #111827;
  color: #FFFFFF;
  border-color: #111827;
}

.budget-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.budget-input {
  width: 118px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(17, 24, 39, 0.18);
  background: #F9FAFB;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.budget-input:focus {
  outline: 2px solid #111827;
  background: #FFFFFF;
}

/* 闸门卡片通用 */
.gate-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.gate-banner {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}
.gate-banner.st-red { background: var(--red-soft); }
.gate-banner.st-amber { background: var(--amber-soft); }
.gate-banner.st-green { background: var(--green-soft); }
.gate-banner.st-locked { background: #F3F4F6; }

.gate-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.signal-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.bg-r { background: var(--red); }
.bg-y { background: var(--amber); }
.bg-g { background: var(--green); }
.bg-k { background: #4B5563; }

.gate-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}
.gate-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.gate-status-pill {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
}
.sp-r { background: #FEE2E2; color: #B91C1C; }
.sp-y { background: #FEF3C7; color: #B45309; }
.sp-g { background: #D1FAE5; color: #047857; }
.sp-k { background: #E5E7EB; color: #374151; }

.gate-body {
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 分组筛选条 */
.filter-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-chip {
  min-height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #F9FAFB;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.filter-chip.active {
  background: #111827;
  color: #FFFFFF;
  border-color: #111827;
}

/* 单项查漏卡 */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #FAFAFA;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.check-item.is-miss { border-color: rgba(217, 45, 32, 0.36); background: #FFF7F7; }
.check-item.is-vague { border-color: rgba(217, 119, 6, 0.36); background: #FFFDF2; }
.check-item.is-ok { border-color: rgba(5, 150, 105, 0.25); background: #FFFFFF; }

.check-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.check-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.item-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.08);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 1px;
}

.check-name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.check-cost {
  font-size: 12px;
  font-weight: 800;
  color: var(--red);
  white-space: nowrap;
  flex-shrink: 0;
}

.check-safe {
  font-size: 12px;
  font-weight: 700;
  color: var(--green);
  white-space: nowrap;
  flex-shrink: 0;
}

.check-pitfall {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.switch-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.sw-btn {
  min-height: 44px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
}
.sw-btn.on-ok { background: var(--green); color: #FFFFFF; border-color: var(--green); }
.sw-btn.on-vague { background: var(--amber); color: #FFFFFF; border-color: var(--amber); }
.sw-btn.on-miss { background: var(--red); color: #FFFFFF; border-color: var(--red); }

.clause-tip {
  font-size: 12px;
  line-height: 1.5;
  color: #374151;
  background: rgba(255, 255, 255, 0.85);
  border-left: 3px solid #111827;
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
}

/* 锁定预览区 */
.locked-zone {
  border: 1px dashed rgba(17, 24, 39, 0.25);
  border-radius: 12px;
  padding: 12px;
  background: #F9FAFB;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.locked-zone-head {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.locked-preview-row {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  font-size: 13px;
}
.lp-left {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.lp-right {
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  white-space: nowrap;
  flex-shrink: 0;
}
.locked-more-note {
  font-size: 12px;
  color: var(--subtle);
}

.empty-hint {
  padding: 18px;
  text-align: center;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  background: var(--green-soft);
  border-radius: 12px;
}

/* 施工阶段验收条与红绿灯放行按钮 */
.verify-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.45;
  transition: background 0.15s ease;
}
.verify-row.done {
  background: var(--green-soft);
  border-color: rgba(5, 150, 105, 0.35);
  color: #065F46;
  font-weight: 600;
}
.verify-row.is-disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.verify-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
  flex-shrink: 0;
}

.gate-cta {
  min-height: 50px;
  width: 100%;
  border-radius: 12px;
  border: none;
  font-size: 14.5px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  transition: transform 0.15s ease, background 0.2s ease;
}
.gate-cta.locked {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1.5px solid #FCA5A5;
}
.gate-cta.unlocked {
  background: var(--green);
  color: #FFFFFF;
}
.gate-cta.paid {
  background: #111827;
  color: #FFFFFF;
}
.gate-cta.paywall-gate {
  background: #F3F4F6;
  color: #111827;
  border: 1px solid rgba(17, 24, 39, 0.18);
}
.gate-cta.shake { animation: shake 0.32s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.more-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 12px;
  background: #F3F4F6;
  font-size: 12.5px;
  line-height: 1.45;
}
.more-strip.unlocked-bar {
  background: var(--green-soft);
  color: #065F46;
  font-weight: 600;
}
.more-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: none;
  background: #111827;
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

/* 底部双键栏（严格无 4 Tab Dock） */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bottom-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.act-btn {
  min-height: 48px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid #111827;
  padding: 0 10px;
}
.act-btn.light { background: #FFFFFF; color: #111827; }
.act-btn.dark { background: var(--red); border-color: var(--red); color: #FFFFFF; }
.act-btn.pro-btn { background: #111827; border-color: #111827; color: #FFFFFF; }

/* 弹窗 */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.62);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  z-index: 50;
}
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal-bg.open { display: flex; }

.sheet-modal {
  background: #FFFFFF;
  width: 100%;
  max-width: 600px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.sheet-head h3 { margin: 0; font-size: 17px; font-weight: 800; }

.x-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #F9FAFB;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.paper-sheet {
  border: 1.5px solid #111827;
  border-radius: 10px;
  padding: 14px;
  background: #FFFFFF;
  font-size: 13px;
  line-height: 1.65;
}
.paper-meta {
  padding-bottom: 8px;
  border-bottom: 1px solid #E5E7EB;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.paper-sheet h4 { margin: 12px 0 6px; font-size: 13.5px; }
.paper-sheet ul { margin: 0; padding-left: 18px; }
.paper-sign {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #9CA3AF;
  font-size: 12px;
  color: #374151;
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.export-sub-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.sub-btn {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #F9FAFB;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  padding: 0 6px;
}

/* 小红书个人售卖解锁弹窗 */
.xhs-guide-box {
  background: #FFF7F7;
  border: 1px solid rgba(217, 45, 32, 0.25);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.55;
  color: #7F1D1D;
  margin-bottom: 12px;
}

.xhs-steps {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.xhs-steps li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #111827;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.unlock-benefits {
  background: #F9FAFB;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.65;
  margin-bottom: 14px;
  color: #374151;
}

.code-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.code-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid #111827;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.code-input:focus {
  outline: 2px solid var(--green);
  border-color: var(--green);
}

.unlock-feedback {
  min-height: 20px;
  font-size: 12.5px;
  font-weight: 700;
}
.unlock-feedback.err { color: var(--red); }
.unlock-feedback.ok { color: var(--green); }

.toast {
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #FFFFFF;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  z-index: 70;
  display: none;
  max-width: 92vw;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.toast.show { display: block; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* 纯白省墨打印模式 */
@media print {
  body { background: #FFFFFF !important; }
  .sticky-hud, .main, .bottom-bar, .toast, #unlockModal, .sheet-head, .export-grid, .export-sub-row {
    display: none !important;
  }
  #onePageModal {
    position: static !important;
    display: block !important;
    background: #FFFFFF !important;
    padding: 0 !important;
  }
  .sheet-modal {
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  .paper-sheet {
    border: 1px solid #000000 !important;
  }
}
