/* RakshaQR – simple styles. Colours match the pitch deck. */
:root {
  --red: #D62828;
  --red-dark: #9D0208;
  --ink: #1F2937;
  --muted: #5C677D;
  --line: #E2E5EA;
  --bg: #F6F7F9;
  --card: #FFFFFF;
  --dark: #111418;
  --amber: #FFB703;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; color: var(--ink);
  background: rgba(255, 255, 255, .82);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid rgba(21, 24, 29, .08);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.brand b { color: var(--red); }
.topbar nav { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.topbar nav a:hover { color: var(--red); }
.topbar nav a.nav-cta { background: var(--red); color: #fff; padding: 7px 14px; border-radius: 999px; font-weight: 700; }
.topbar nav a.nav-cta:hover { background: var(--red-dark); color: #fff; }

/* ---------- layout ---------- */
.container { max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 20px; }
.narrow { max-width: 440px; margin: 24px auto; }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
@media (max-width: 760px) {
  .dash { grid-template-columns: 1fr; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}

/* ---------- text ---------- */
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 18px 0 8px; }
.card > h2:first-child, .card > form > h2:first-child { margin-top: 0; }
.kicker { color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin: 0 0 6px; }
.lead { font-size: 18px; color: var(--muted); max-width: 560px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
code { font-size: 13px; background: #EEF0F3; padding: 2px 6px; border-radius: 4px; word-break: break-all; }

/* ---------- hero (bystander mode) ---------- */
.hero { text-align: center; padding: 28px 8px 20px; }
.hero h1 { font-size: 36px; }
.hero .lead { margin: 0 auto 22px; }
.tip { color: var(--muted); font-size: 15px; margin-top: 16px; }
.badge-ok { display: inline-block; background: #E8F7EC; color: #1E6B35; font-weight: 700; padding: 4px 12px; border-radius: 999px; margin-bottom: 10px; }
.note { border-left: 0; background: #FDECEC; border-color: #F5C2C2; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 2px solid transparent;
  font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; text-align: center;
}
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-dark:hover { background: #2A313B; }
.btn-outline { background: #fff; color: var(--red); border-color: var(--red); }
.btn-outline:hover { background: #FDECEC; }
.btn-big { font-size: 22px; padding: 18px 34px; width: 100%; max-width: 420px; border-radius: 12px; }
.call-row { display: flex; gap: 12px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 18px; font-weight: 500; }
input, select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #C9CED6; border-radius: 8px; background: #fff;
}
input[type="radio"] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 3px solid #F5C2C2; border-color: var(--red); }
form .btn { margin-top: 18px; }
fieldset.dnr { border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px 4px; margin-top: 16px; }
fieldset.dnr legend { font-weight: 700; padding: 0 6px; }

.flash { background: #FFF4D6; border: 1px solid #F5D78A; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }

/* ---------- dashboard right column ---------- */
.qr-card { text-align: center; }
.qr-card img { display: block; margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 8px; }
.preview dl { margin: 8px 0 0; display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; }
.preview dt { color: var(--muted); font-size: 14px; }
.preview dd { margin: 0; font-weight: 600; }
.preview dd.big { font-size: 22px; color: var(--red); }

/* ===================== full app additions ===================== */
.wide-ish { max-width: 560px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.photo-box {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px;
  min-height: 160px; border: 2px dashed #C9CED6; border-radius: 12px; cursor: pointer;
  color: var(--muted); font-weight: 600; padding: 12px; background: #FAFBFC;
}
.photo-box img { max-width: 100%; max-height: 260px; border-radius: 8px; }
p.ok, .ok { color: #1E6B35; font-weight: 600; }
p.warn { color: #9A5B00; font-weight: 600; }
details { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
summary { cursor: pointer; font-weight: 600; }
.hero.tight { padding-top: 12px; }
.muted-card { background: #F1F3F6; color: var(--muted); }
.victim { border: 2px solid var(--red); }
.victim dl, .record { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0 0 12px; }
.victim dt, .record dt { color: var(--muted); }
.victim dd, .record dd { margin: 0; font-weight: 600; }
dd.big { font-size: 24px; color: var(--red); }
dd.dnr-yes { color: #fff; background: var(--red); display: inline-block; padding: 0 10px; border-radius: 6px; width: fit-content; }
.steps { padding-left: 20px; margin: 0; }
.steps li { margin-bottom: 8px; }
.cpr-row { display: flex; gap: 18px; align-items: center; }
.cpr-row ul { margin: 0; padding-left: 18px; }
.cpr-heart {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: 50%; background: var(--red);
  box-shadow: 0 0 0 0 rgba(214, 40, 40, .5);
}
.cpr-heart.on { animation: beat 0.545s infinite; }        /* 60 / 110 bpm = 0.545 s */
@keyframes beat {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(214, 40, 40, .5); }
  30% { transform: scale(0.82); box-shadow: 0 0 0 14px rgba(214, 40, 40, 0); }
  100% { transform: scale(1); }
}
.leave { background: #E8F7EC; border-color: #BFE5C9; }

/* hospital */
.hosp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.alert-row { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; }
.alert-row:hover { border-color: var(--red); }
.grow { flex: 1; min-width: 0; }
.faded { opacity: .6; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; vertical-align: middle; }
.pill.verified { background: #E8F7EC; color: #1E6B35; }
.pill.unverified { background: #FFF4D6; color: #8A5A00; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.actions .btn { margin: 0; }
.triage { border: 2px solid var(--dark); }
.triage ol { margin: 0; padding-left: 20px; font-weight: 600; }
.triage li { margin-bottom: 6px; }
.scene { width: 100%; border-radius: 8px; }
.map { height: 220px; border-radius: 8px; margin-bottom: 8px; background: #EEF0F3; }
audio { width: 100%; }
@media (max-width: 560px) {
  .alert-row { flex-wrap: wrap; }
  .victim dl, .record { grid-template-columns: 1fr; }
  .cpr-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .topbar { padding: 10px 14px; }
  .topbar nav { gap: 10px; }
  .topbar nav a { font-size: 14px; }
  .topbar nav a.nav-cta { padding: 5px 10px; }
  .brand { font-size: 18px; }
}

/* admin */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.small-stats { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; }
.stat .num { font-size: 32px; font-weight: 800; line-height: 1.1; }
.small-stats .num { font-size: 22px; }
.stat .lbl { font-weight: 700; margin-top: 4px; }
.small-stats .lbl { font-size: 13px; }
.stat .sub { color: var(--muted); font-size: 13px; }
.stat.red { border-color: #F5C2C2; background: #FDECEC; }
.stat.red .num { color: var(--red); }
@media (max-width: 900px) { .small-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 600px) { .stats, .small-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.table-wrap { overflow-x: auto; padding: 8px 16px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid #EEF0F3; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.inline-form { display: flex; gap: 6px; margin: 0; }
.inline-form input { width: 130px; padding: 6px 8px; }
.btn-sm { min-height: 34px; padding: 4px 10px; font-size: 14px; margin: 0 !important; }
.add-hosp summary { font-size: 17px; }
.warn-text { color: #9A5B00; }
td code, td.nowrap { white-space: nowrap; }
