:root {
  --ink: #14141a;
  --paper: #f6f4ef;
  --paper-card: #ffffff;
  --signal: #ff4b3e;
  --line: rgba(20, 20, 26, 0.12);
  --line-strong: rgba(20, 20, 26, 0.22);
  --text-muted: #6b6a66;

  --accent: #1f3a5f;
  --accent-strong: #14263f;
  --accent-tint: #e8edf3;
  --accent-text-on-tint: #1f3a5f;
  --tagline: "Regulatory & compliance record";
}

body[data-view="consumer"] {
  --accent: #6f9a00;
  --accent-strong: #4d6c00;
  --accent-tint: #eef7d6;
  --accent-text-on-tint: #4d6c00;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.font-display { font-family: "Oswald", "Inter", sans-serif; }
.font-mono { font-family: "IBM Plex Mono", monospace; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  background: var(--ink);
  color: #fff;
  flex-wrap: wrap;
  border-bottom: 3px solid var(--signal);
}
.brand-block { display: flex; align-items: baseline; gap: 10px; }
.brand-mark {
  font-family: "Oswald", sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 1px;
}
.brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.55);
  font-family: "IBM Plex Mono", monospace;
}
.product-picker {
  padding: 7px 12px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: #fff; font-size: 13px; max-width: 320px;
}
.product-picker option { color: #111; }

.view-toggle {
  margin-left: auto; display: flex; gap: 2px; background: rgba(255,255,255,0.1);
  padding: 3px; border-radius: 8px;
}
.toggle-btn {
  padding: 8px 16px; border-radius: 6px; border: none;
  background: transparent; color: rgba(255,255,255,0.65); cursor: pointer;
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px;
  font-family: "Inter", sans-serif;
}
.toggle-btn.active { background: #fff; color: var(--ink); }
body[data-view="consumer"] .toggle-btn.active { background: var(--accent); color: #fff; }

/* ---------- Layout ---------- */
.passport-root { max-width: 760px; margin: 0 auto; padding: 28px 18px 64px; }
.loading { text-align: center; color: var(--text-muted); padding: 60px 0; font-family: "IBM Plex Mono", monospace; font-size: 13px; }

/* ---------- Passport ticket card ---------- */
.ticket-card {
  background: var(--paper-card); border-radius: 14px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(20,20,26,0.08), 0 8px 24px rgba(20,20,26,0.04);
  margin-bottom: 22px; border: 1px solid var(--line);
}
.ticket-top { display: flex; }
.ticket-main { flex: 1; padding: 22px 22px 18px; min-width: 0; }
.ticket-stub {
  width: 168px; flex-shrink: 0; padding: 20px 16px;
  background: var(--accent-tint); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center;
  position: relative;
}
.ticket-perforation {
  width: 0; border-left: 2px dashed var(--line-strong); position: relative;
}
.ticket-perforation::before, .ticket-perforation::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  background: var(--paper); left: -9px;
}
.ticket-perforation::before { top: -8px; }
.ticket-perforation::after { bottom: -8px; }

.eyebrow {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--accent); font-weight: 500; margin-bottom: 6px;
}
.product-name { font-family: "Oswald", sans-serif; font-size: 26px; font-weight: 600; margin: 0 0 4px; line-height: 1.1; }
.brand-line { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
.dpp-id { font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--text-muted); }

.spec-chips { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.spec-chip {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; padding: 4px 9px;
  border: 1px solid var(--line-strong); border-radius: 5px; color: var(--ink);
  background: var(--paper);
}

.stamp {
  width: 68px; height: 68px; border-radius: 50%; border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  transform: rotate(-8deg); color: var(--accent); font-family: "Oswald", sans-serif;
  font-weight: 600; font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase;
  line-height: 1.15; background: var(--paper-card);
}
.stamp .check { font-size: 20px; line-height: 1; margin-bottom: 2px; }

.qr-frame {
  background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--line);
}
.qr-frame img { width: 96px; height: 96px; display: block; }

.ticket-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 22px; border-top: 1px dashed var(--line-strong);
  font-family: "IBM Plex Mono", monospace; font-size: 11px; color: var(--text-muted);
}

/* ---------- Section list (spec-sheet rows) ---------- */
.section-list { display: flex; flex-direction: column; gap: 8px; }
.section-card {
  background: var(--paper-card); border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); transition: border-color 0.15s ease;
}
.section-card.open { border-color: var(--line-strong); }
.section-card-header {
  display: flex; align-items: center; gap: 14px; padding: 15px 18px;
  cursor: pointer; user-select: none;
}
.section-index {
  font-family: "IBM Plex Mono", monospace; font-size: 12px; color: var(--accent);
  width: 22px; flex-shrink: 0;
}
.section-card-header .icon { font-size: 18px; flex-shrink: 0; }
.section-card-header .title {
  font-family: "Oswald", sans-serif; font-weight: 600; font-size: 15px; flex: 1;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.chevron { transition: transform 0.2s ease; color: var(--text-muted); font-size: 14px; }
.section-card.open .chevron { transform: rotate(90deg); color: var(--accent); }
.section-card-body {
  display: none; padding: 2px 18px 20px 54px; font-size: 14px; color: var(--ink);
  border-top: 1px solid var(--line);
}
.section-card.open .section-card-body { display: block; padding-top: 14px; }

/* ---------- Key/value rows ---------- */
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--text-muted); }
.kv-value { font-weight: 500; text-align: right; font-family: "IBM Plex Mono", monospace; font-size: 12.5px; }

/* ---------- Materials ---------- */
.material-bar-row { margin-bottom: 10px; }
.material-bar-label { font-size: 12px; color: var(--ink); margin-bottom: 4px; font-weight: 500; }
.material-bar-track { background: var(--line); border-radius: 3px; height: 8px; overflow: hidden; }
.material-bar-fill { background: var(--accent); height: 100%; }

/* ---------- Supply chain ---------- */
.stage-list { list-style: none; padding: 0; margin: 0; }
.stage-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px dashed var(--line-strong); cursor: pointer;
}
.stage-item:last-child { border-bottom: none; }
.stage-item.disabled { color: var(--text-muted); cursor: default; }
.stage-status { font-size: 11px; font-family: "IBM Plex Mono", monospace; text-transform: uppercase; }
.stage-status.verified { color: var(--accent); font-weight: 500; }
.stage-status.na { color: var(--text-muted); }

.doc-list { list-style: none; padding: 0; margin: 10px 0 0; }
.doc-list li {
  padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}

.btn-evidence {
  margin-top: 12px; padding: 9px 16px; border-radius: 7px; border: none;
  background: var(--ink); color: #fff; font-size: 12px; cursor: pointer;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
}
body[data-view="consumer"] .btn-evidence { background: var(--accent); }

.chip {
  display: inline-block; background: var(--accent-tint); color: var(--accent-text-on-tint);
  border-radius: 5px; padding: 4px 10px; font-size: 11px; margin: 2px 4px 2px 0;
  font-family: "IBM Plex Mono", monospace; font-weight: 500;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,20,26,0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--paper-card); border-radius: 14px; max-width: 480px; width: 100%;
  padding: 24px; position: relative; max-height: 80vh; overflow-y: auto;
  border: 1px solid var(--line);
}
.modal h2 {
  font-family: "Oswald", sans-serif; text-transform: uppercase; font-size: 16px;
  margin-top: 0; letter-spacing: 0.4px;
}
.modal-close { position: absolute; top: 14px; right: 16px; border: none; background: none; font-size: 16px; cursor: pointer; color: var(--text-muted); }

@media (max-width: 560px) {
  .ticket-top { flex-direction: column-reverse; }
  .ticket-stub { width: auto; flex-direction: row; }
  .ticket-perforation { display: none; }
  .topbar { padding: 12px 16px; }
  .view-toggle { margin-left: 0; width: 100%; }
  .toggle-btn { flex: 1; }
}
