:root {
  --bg: #f2f1ed;
  --surface: #ffffff;
  --border: #e0ddd4;
  --border2: #c8c5ba;
  --text: #1a1917;
  --muted: #6a6760;
  --accent: #1e5c3a;
  --accent-hover: #174d31;
  --accent-light: #e3efe8;
  --hi-bg: #fff2ec;
  --hi-text: #8b3318;
  --hi-border: #f5c0a8;
  --done-bg: #e8f2ec;
  --r: 8px;
  --rl: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ── TOP BAR ── */
.topbar {
  background: var(--accent);
  color: #fff;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; letter-spacing: -1px;
  flex-shrink: 0;
}
.topbar h1 { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.topbar-sub { font-size: 11px; opacity: .65; display: none; }
@media(min-width:480px) { .topbar-sub { display: block; } }
.counter-pill {
  background: rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
}

/* ── GLOBAL PROGRESS ── */
.global-progress { height: 3px; background: rgba(255,255,255,.2); position: sticky; top: 54px; z-index: 99; }
.global-progress-fill { height: 3px; background: #7dd4a8; transition: width .4s; }

/* ── LAYOUT ── */
.container { max-width: 720px; margin: 0 auto; padding: 20px 14px 100px; }

/* ── PC NAV TABS ── */
.pc-tabs-wrap {
  margin-bottom: 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.pc-tabs-wrap::-webkit-scrollbar { display: none; }
.pc-tabs { display: flex; gap: 6px; min-width: max-content; padding-bottom: 2px; }
.pc-tab {
  padding: 7px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--border2);
  background: var(--surface); color: var(--muted);
  white-space: nowrap; transition: all .15s;
  position: relative; font-family: Arial, sans-serif;
}
.pc-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pc-tab.complete::after {
  content: '✓'; position: absolute; top: -4px; right: -4px;
  width: 14px; height: 14px; background: #3da06e; color: #fff;
  border-radius: 50%; font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  line-height: 14px; text-align: center;
}
.add-pc-btn {
  padding: 7px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  cursor: pointer; border: 1.5px dashed var(--border2);
  background: transparent; color: var(--muted);
  white-space: nowrap; transition: all .15s; font-family: Arial, sans-serif;
}
.add-pc-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── CARDS ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 16px 18px; margin-bottom: 16px;
}
.card-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .7px; margin-bottom: 13px;
}

/* ── META GRID ── */
.meta-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
@media(max-width:420px) { .meta-grid { grid-template-columns: 1fr; } }
.meta-field label {
  display: block; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.meta-field input, .meta-field select {
  width: 100%; border: 1px solid var(--border2); border-radius: var(--r);
  padding: 9px 11px; font-size: 14px; color: var(--text);
  background: var(--bg); font-family: Arial, sans-serif;
  appearance: none; -webkit-appearance: none;
}
.meta-field input:focus, .meta-field select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.meta-field.full { grid-column: span 2; }
@media(max-width:420px) { .meta-field.full { grid-column: span 1; } }

/* ── STATS ── */
.stats-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 16px; }
@media(max-width:400px) { .stats-row { grid-template-columns: repeat(2,1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 10px 8px; text-align: center;
}
.stat-num { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 10px; color: var(--muted); margin-top: 2px; line-height: 1.3; }

/* ── PROGRESS ── */
.prog-wrap { margin-bottom: 16px; }
.prog-track { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.prog-fill { height: 7px; background: var(--accent); border-radius: 4px; transition: width .3s; }
.prog-label { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ── CHECKLIST SECTION ── */
.section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rl); margin-bottom: 12px; overflow: hidden;
}
.sec-head {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; background: #f8f7f4; border-bottom: 1px solid var(--border);
}
.sec-icon { font-size: 16px; line-height: 1; }
.sec-title { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; }
.sec-badge {
  font-size: 11px; color: var(--muted); background: var(--bg);
  border: 1px solid var(--border); border-radius: 12px; padding: 2px 9px;
}
.item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 15px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
  -webkit-tap-highlight-color: transparent;
}
.item:last-child { border-bottom: none; }
.item:active { background: #f0f0ec; }
.item.checked { background: var(--done-bg); }
.item.checked .item-text { text-decoration: line-through; color: var(--muted); }
.cb {
  width: 20px; height: 20px; min-width: 20px;
  border: 2px solid var(--border2); border-radius: 5px;
  margin-top: 1px; display: flex; align-items: center; justify-content: center;
  transition: all .15s; background: #fff; flex-shrink: 0;
}
.item.checked .cb { background: var(--accent); border-color: var(--accent); }
.item.checked .cb::after {
  content: ''; display: block; width: 5px; height: 10px;
  border: 2.5px solid #fff; border-top: none; border-left: none;
  transform: rotate(42deg) translateY(-1px);
}
.item-body { flex: 1; min-width: 0; }
.item-text { font-size: 13px; color: var(--text); line-height: 1.45; }
.item-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.badge-hi {
  display: inline-block; font-size: 9px; font-weight: 700;
  background: var(--hi-bg); color: var(--hi-text); border: 1px solid var(--hi-border);
  border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: 2px; white-space: nowrap;
}

/* ── FINDINGS ── */
.findings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
@media(max-width:480px) { .findings-grid { grid-template-columns: 1fr; } }
.ff { grid-column: span 2; }
.ff.half { grid-column: span 1; }
@media(max-width:480px) { .ff.half { grid-column: span 1; } }
.ff label {
  display: block; font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.ff select, .ff textarea {
  width: 100%; border: 1px solid var(--border2); border-radius: var(--r);
  padding: 9px 11px; font-size: 14px; color: var(--text);
  background: var(--bg); font-family: Arial, sans-serif;
  appearance: none; -webkit-appearance: none;
}
.ff textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
.ff select:focus, .ff textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 14px; display: flex; gap: 10px;
  z-index: 100; box-shadow: 0 -2px 12px rgba(0,0,0,.08);
}
.btn {
  padding: 11px 18px; border-radius: var(--r);
  font-size: 14px; font-weight: 700; cursor: pointer;
  border: 1.5px solid transparent; font-family: Arial, sans-serif;
  transition: all .15s; display: flex; align-items: center; gap: 6px;
  justify-content: center; flex: 1; min-width: 0; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent); flex: 0 0 auto; }
.btn-outline:hover, .btn-outline:active { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border2); flex: 0 0 auto; }
.btn-ghost:hover { background: var(--border); }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #1a1917; color: #fff; padding: 10px 20px;
  border-radius: 24px; font-size: 13px; font-weight: 600;
  opacity: 0; transition: all .3s; pointer-events: none;
  z-index: 999; white-space: nowrap; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── PC SUMMARY TABLE ── */
.pc-summary {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--rl); padding: 16px 18px; margin-bottom: 16px; display: none;
}
.pc-summary.visible { display: block; }
.pc-sum-title { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 10px; }
.pc-sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; gap: 8px;
}
.pc-sum-row:last-child { border-bottom: none; }
.pc-sum-id { font-weight: 700; color: var(--text); flex: 1; }
.pc-sum-user { color: var(--muted); flex: 1; text-align: center; font-size: 12px; }
.pc-sum-pct { font-weight: 700; color: var(--accent); min-width: 40px; text-align: right; }
.pc-sum-edit {
  font-size: 11px; padding: 3px 10px; border: 1px solid var(--border2);
  border-radius: 6px; cursor: pointer; background: transparent; color: var(--muted); font-family: Arial, sans-serif;
}
.pc-sum-del {
  font-size: 11px; padding: 3px 10px; border: 1px solid var(--hi-border);
  border-radius: 6px; cursor: pointer; background: transparent; color: var(--hi-text); font-family: Arial, sans-serif; margin-left: 4px;
}

/* ── DESKTOP CENTERING ── */
@media(min-width:600px) {
  .bottom-nav {
    max-width: 720px; left: 50%; transform: translateX(-50%);
    border-radius: var(--rl) var(--rl) 0 0;
    border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  }
}
