:root {
  --navy: #14213d;
  --navy-2: #1f2f56;
  --gold: #fca311;
  --bg: #f2f4f8;
  --ink: #1a1d24;
  --muted: #5c6470;
  --line: #d9dee7;
  --white: #ffffff;
  --green: #1d7a46;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

h1, h2 { margin: 0 0 0.35em; }
small { color: var(--muted); }
a { color: var(--navy-2); }

/* ---------- shared ---------- */

.shield {
  width: 52px; height: 52px; flex: none;
  border-radius: 50% 50% 50% 50% / 42% 42% 58% 58%;
  background: var(--navy);
  color: var(--gold);
  display: grid; place-items: center;
  font-size: 26px;
  border: 3px solid var(--gold);
}
.shield.small { width: 36px; height: 36px; font-size: 17px; border-width: 2px; }

.btn-primary, .btn-secondary {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  border: 0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: var(--navy-2); }
.btn-secondary { background: var(--white); color: var(--navy); border: 1px solid var(--line); }

.pill {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.pill-demo { background: #fff3d6; color: #8a5b00; border: 1px solid #f0c464; }
.pill-live { background: #ddf2e4; color: var(--green); border: 1px solid #9fd4b0; }
.pill-officer { background: #dde7f7; color: var(--navy-2); }
.pill-supervisor { background: #f3ddf7; color: #6b2a78; }

/* ---------- public contact page ---------- */

.card-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}
.card-page.center { text-align: center; padding-top: 64px; }

.badge-header {
  display: flex; gap: 14px; align-items: center;
  background: var(--navy);
  color: var(--white);
  padding: 16px;
  border-radius: 14px;
  margin-bottom: 18px;
}
.badge-header h1 { font-size: 18px; }
.badge-header .sub { margin: 0; color: #c9d3e8; font-size: 14px; }

.lede { font-size: 16px; color: var(--ink); }

.contact-form { display: grid; gap: 16px; margin-top: 8px; }

.recipient-picker {
  border: 0; padding: 0; margin: 0;
  display: grid; gap: 10px;
}
.recipient-picker legend { font-weight: 700; margin-bottom: 8px; }
.recipient {
  display: flex; gap: 12px; align-items: center;
  background: var(--white);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}
.recipient:has(input:checked) { border-color: var(--navy); background: #eef2fa; }
.recipient input { width: 20px; height: 20px; accent-color: var(--navy); }
.recipient span { display: grid; }
.recipient small { color: var(--muted); }

.field { display: grid; gap: 6px; font-weight: 600; }
.field .optional { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  font: inherit;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}
.field textarea { resize: vertical; }

.disclaimer {
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.success-check {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--green);
  color: var(--white);
  font-size: 40px;
  display: grid; place-items: center;
}

/* ---------- dashboard ---------- */

.topbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--navy);
  color: var(--white);
  padding: 14px 22px;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .thin { font-weight: 300; color: #c9d3e8; }
.topbar .pill { margin-left: auto; }

.dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 900px) { .dashboard { grid-template-columns: 1fr; } }

table.units {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}
table.units th, table.units td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.units th { background: #e8ecf4; font-size: 13px; }
table.units .actions a { display: block; font-size: 14px; }

.add-unit { margin-top: 14px; }
.add-unit summary { cursor: pointer; font-weight: 600; }
.unit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.unit-form input {
  font: inherit; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px;
}
.unit-form button { grid-column: 1 / -1; }

.live-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

.feed { display: grid; gap: 12px; }
.feed .empty { color: var(--muted); }

.msg {
  background: var(--white);
  border-radius: 12px;
  border-left: 4px solid var(--navy);
  padding: 12px 16px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}
.msg.supervisor { border-left-color: #9438a5; }
.msg header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.msg header time { margin-left: auto; color: var(--muted); font-size: 12px; }
.msg p { margin: 8px 0; font-size: 15px; }
.msg footer { font-size: 13px; color: var(--muted); }
.msg .status { text-transform: uppercase; font-size: 11px; letter-spacing: 0.04em; }

.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 12px 0 28px; }

/* ---------- unit filtering ---------- */

.unit-link { text-decoration: none; color: var(--navy); }
.unit-link:hover strong { text-decoration: underline; }
table.units tr.active-row td { background: #eef2fa; }
table.units tr.active-row td:first-child { box-shadow: inset 4px 0 0 var(--gold); }

.clear-filter {
  font-size: 14px;
  font-weight: 400;
  margin-left: 8px;
}

.feed-hint { color: var(--muted); font-size: 13px; margin: -4px 0 12px; }

/* clickable message cards */
.msg-link { text-decoration: none; color: inherit; display: block; }
.msg-link .msg { transition: transform 0.08s ease, box-shadow 0.08s ease; }
.msg-link:hover .msg, .msg-link:focus-visible .msg {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgb(0 0 0 / 16%);
}

/* ---------- message detail (in-car / phone readability) ---------- */

.topbar .back-link { margin-left: auto; color: var(--white); font-size: 15px; }

.detail-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.detail-meta {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-meta .detail-unit { font-size: 20px; font-weight: 800; color: var(--navy); }
.detail-meta time { margin-left: auto; color: var(--muted); }

.detail-card {
  background: var(--white);
  border-radius: 16px;
  border-left: 8px solid var(--navy);
  padding: 24px 28px;
  box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
}
.detail-card.supervisor { border-left-color: #9438a5; }
.detail-body {
  margin: 0;
  font-size: clamp(20px, 3.5vw, 28px);
  line-height: 1.45;
  overflow-wrap: break-word;
}

.detail-facts {
  display: grid; gap: 8px;
  margin: 20px 0;
  font-size: 16px;
}
.detail-facts > div { display: flex; gap: 10px; }
.detail-facts dt { flex: 0 0 90px; font-weight: 700; color: var(--muted); }
.detail-facts dd { margin: 0; }
.detail-facts .status { text-transform: uppercase; font-size: 13px; letter-spacing: 0.04em; }

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 24px 0;
}
@media (max-width: 560px) { .detail-actions { grid-template-columns: 1fr; } }

.btn-call, .btn-text {
  display: block;
  text-align: center;
  padding: 20px;
  border-radius: 14px;
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}
.btn-call { background: var(--green); color: var(--white); }
.btn-call:hover { background: #16693b; }
.btn-text { background: var(--navy); color: var(--white); }
.btn-text:hover { background: var(--navy-2); }

.no-callback {
  background: #fff3d6;
  border: 1px solid #f0c464;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 16px;
}

.detail-nav { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

/* ---------- printable QR sticker ---------- */

.print-sheet { display: grid; place-items: center; gap: 20px; padding: 40px 16px; }

.sticker {
  width: 340px;
  background: var(--white);
  border: 6px solid var(--navy);
  border-radius: 18px;
  padding: 22px;
  text-align: center;
}
.sticker-head {
  display: flex; gap: 12px; align-items: center; text-align: left;
  margin-bottom: 14px;
}
.sticker img { width: 100%; image-rendering: pixelated; }
.sticker-cta {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--navy);
  margin: 10px 0 4px;
}
.sticker-fine { font-size: 12px; color: var(--muted); margin: 0; }

@media print {
  .no-print { display: none; }
  body { background: var(--white); }
}
