:root {
  --primary: #0e7490;
  --primary-dark: #155e75;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --compliant: #16a34a;
  --partial: #d97706;
  --non: #dc2626;
  --na: #94a3b8;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 16px; }

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, var(--primary-dark) 100%);
  color: #fff;
  padding: 28px 0 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

h1 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }

.subtitle { color: #cbd5e1; font-size: 0.85rem; margin-top: 2px; }

.btn {
  border: none; border-radius: 8px; padding: 9px 14px; font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(0.98); }
.btn-print { background: #fff; color: var(--primary-dark); }
.btn-reset { background: rgba(255,255,255,0.12); color: #e2e8f0; border: 1px solid rgba(255,255,255,0.25); }

/* ---------- Progress ---------- */
.progress-wrap { margin: 18px 0 12px; }
.progress-bar { height: 10px; background: rgba(255,255,255,0.15); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #4ade80, #22c55e); border-radius: 999px; transition: width .3s ease; }
.progress-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 0.8rem; color: #cbd5e1; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.toolbar input[type="search"] {
  flex: 1 1 260px; padding: 9px 12px; border-radius: 8px; border: none; font-size: 0.88rem;
  background: rgba(255,255,255,0.95); color: var(--text); outline: none;
}
.toolbar select {
  padding: 9px 10px; border-radius: 8px; border: none; font-size: 0.85rem;
  background: rgba(255,255,255,0.95); color: var(--text); cursor: pointer;
}
select:focus, input:focus { box-shadow: 0 0 0 2px rgba(56,189,248,0.5); }

/* ---------- Discipline chips ---------- */
.discipline-panel {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed rgba(255,255,255,0.25);
}
.discipline-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: rgba(255,255,255,0.85); }
.discipline-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid rgba(255,255,255,0.4); background: transparent; color: #fff;
  border-radius: 999px; padding: 4px 12px; font-size: 0.75rem; font-weight: 600;
  cursor: pointer; transition: all .12s; opacity: 0.65;
}
.chip:hover { opacity: 1; background: rgba(255,255,255,0.15); }
.chip.active { background: #fff; color: var(--primary-dark); border-color: #fff; opacity: 1; }

/* ---------- Section nav (quick-jump) ---------- */
.section-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  gap: 6px;
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 16px;
  overflow-x: auto;
  background: var(--primary-dark);
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  scrollbar-width: none;
}
.section-nav::-webkit-scrollbar { display: none; }
.section-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.section-btn:hover { background: rgba(255,255,255,0.22); }
.section-btn.active { background: #fff; color: var(--primary-dark); border-color: #fff; }
.section-btn.dim { opacity: 0.35; pointer-events: none; }

.back-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary-dark);
  color: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: all .2s;
}
.back-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ---------- Section header ---------- */
.section-header {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 26px 0 4px; padding-bottom: 8px; border-bottom: 2px solid var(--primary-dark);
  scroll-margin-top: 64px;
}
.section-title { font-size: 1.1rem; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.01em; }
.section-count { font-size: 0.78rem; color: var(--muted); background: #ecfeff; padding: 2px 9px; border-radius: 999px; }

/* ---------- Items ---------- */
.item-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
  transition: box-shadow .15s;
}
.item-card:hover { box-shadow: 0 4px 12px rgba(2,6,23,0.06); }
.item-card.status-compliant { border-left-color: var(--compliant); }
.item-card.status-partial { border-left-color: var(--partial); }
.item-card.status-non { border-left-color: var(--non); }
.item-card.status-na { border-left-color: var(--na); opacity: 0.75; }

.item-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.item-id { font-weight: 800; font-size: 0.9rem; color: var(--primary-dark); background: #ecfeff; padding: 2px 8px; border-radius: 6px; }
.disc-badge {
  font-weight: 800; font-size: 0.72rem; color: #fff; background: var(--primary);
  padding: 2px 8px; border-radius: 6px; letter-spacing: 0.03em; flex: none;
}
.item-title { font-weight: 600; font-size: 1rem; }
.item-iso { font-size: 0.72rem; color: var(--muted); background: #f1f5f9; padding: 2px 7px; border-radius: 5px; }

.item-req { margin-top: 8px; font-size: 0.92rem; color: #1e293b; }

.item-evidence { margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.item-evidence details { margin-top: 4px; }
.item-evidence summary { cursor: pointer; color: var(--primary-dark); font-weight: 500; font-size: 0.8rem; user-select: none; }
.item-evidence ul { margin: 8px 0 0 20px; }
.item-evidence li { margin-bottom: 5px; }

/* ---------- Status buttons ---------- */
.status-row { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.status-btn {
  border: 1px solid var(--border); background: #f8fafc; border-radius: 7px;
  padding: 6px 12px; font-size: 0.8rem; font-weight: 600; cursor: pointer; color: var(--muted);
  transition: all .12s;
}
.status-btn:hover { border-color: #94a3b8; }
.status-btn.active { background: var(--text); color: #fff; border-color: var(--text); }
.status-btn.active.btn-c { background: var(--compliant); border-color: var(--compliant); }
.status-btn.active.btn-p { background: var(--partial); border-color: var(--partial); }
.status-btn.active.btn-n { background: var(--non); border-color: var(--non); }
.status-btn.active.btn-a { background: var(--na); border-color: var(--na); }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 0.95rem; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 40px; padding: 18px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.78rem; text-align: center; }

/* ---------- Print ---------- */
@media print {
  .site-header { position: static; background: #fff !important; color: #000 !important; padding: 0 0 10px; box-shadow: none; }
  h1 { color: #000; font-size: 1.2rem; }
  .subtitle, .toolbar, .btn, .section-nav, .back-top, .item-evidence details, .site-footer { display: none; }
  .progress-wrap { margin: 10px 0; }
  .progress-bar { background: #e2e8f0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .progress-fill { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .progress-labels { color: #000; }
  .status-row { display: none; }
  .item-card { break-inside: avoid; border: 1px solid #cbd5e1; border-left-width: 4px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .section-title { color: #000; }
  .section-count { background: #f1f5f9; color: #334155; }
  .item-status-mark { font-size: 0.8rem; font-weight: 700; }
  .item-evidence { display: block !important; }
  .item-evidence ul { margin-top: 6px; }
  body { background: #fff; }
  main { padding-top: 8px; }
}

/* ---------- Mobile (tablet & phone) ---------- */
@media (max-width: 768px) {
  .site-header { position: static; padding: 20px 0 16px; }
  .toolbar { flex-direction: column; }
  .toolbar input[type="search"] { flex: 1 1 auto; width: 100%; }
  .toolbar select { flex: 1 1 auto; width: 100%; }
  .btn-reset { width: 100%; }
  .discipline-panel { flex-direction: column; align-items: flex-start; }
  .chip-name { display: none; }
  .chip { padding: 6px 12px; font-size: 0.8rem; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.1rem; }
  .progress-labels { flex-direction: column; gap: 2px; }
  .item-card { padding: 12px; }
  .status-row { display: grid; grid-template-columns: 1fr 1fr; }
  .status-btn { text-align: center; padding: 9px 6px; }
  .section-header { align-items: flex-start; }
}

