:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #6f6f6f;
  --paper: #f8f8f6;
  --cream: #efefec;
  --line: #dededb;
  --green: #c8161d;
  --deep-green: #0b0b0b;
  --soft-green: #f5e3e4;
  --coral: #e21b23;
  --soft-coral: #fde6e7;
  --shadow: 0 18px 50px rgba(0, 0, 0, .18);
}

* { box-sizing: border-box; }
html { background: #202020; }
body {
  margin: 0;
  min-height: 100vh;
  background: #202020;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.gated .app-shell,
body.gated .toast {
  display: none;
}
body:not(.gated) .access-gate {
  display: none;
}
.access-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top, #2a1014, #090909 62%);
}
.access-card {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 28px;
  background: #f8f8f6;
  box-shadow: var(--shadow);
}
.access-card h1 {
  margin: 6px 0 10px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 38px;
  letter-spacing: -1.4px;
}
.access-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}
.access-card form {
  display: grid;
  gap: 13px;
  margin-top: 18px;
}
.access-card label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}
.access-card input {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.access-error {
  min-height: 20px;
  margin: 0;
  color: var(--coral) !important;
  font-weight: 800;
}
.access-home {
  display: block;
  margin-top: 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 0 70px rgba(0, 0, 0, .4);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(22px, env(safe-area-inset-top)) 22px 12px;
}
.brand { display: flex; gap: 11px; align-items: center; }
.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 15px;
  background: var(--deep-green);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 22px;
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, serif; font-size: 22px; font-weight: 500; letter-spacing: -.5px; }
h2 { font-family: Georgia, serif; font-size: 36px; font-weight: 500; letter-spacing: -1.3px; line-height: 1.06; }
h3 { margin-top: 4px; font-size: 18px; }
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
}
.icon-button svg { width: 20px; fill: var(--green); }
main { padding: 8px 18px 102px; }
.view { display: none; animation: reveal .24s ease; }
.view.active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }

.status-row, .section-heading, .location-row, .contact-item, .settings-card, .activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.status-row { padding: 10px 2px 17px; }
.status-title { margin-top: 5px; font-size: 14px; font-weight: 750; }
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 5px;
  border-radius: 50%;
  background: #67b590;
  box-shadow: 0 0 0 4px rgba(103, 181, 144, .16);
}
.demo-pill {
  padding: 6px 9px;
  border-radius: 99px;
  background: var(--soft-coral);
  color: #b14b39;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .7px;
  text-transform: uppercase;
}
.privacy-strip {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid #cfe2dc;
  border-radius: 14px;
  background: var(--soft-green);
  color: var(--ink);
  text-align: left;
}
.sharing-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}
.hero-card {
  padding: 22px 18px 18px;
  overflow: hidden;
  border-radius: 27px;
  background: var(--deep-green);
  color: #fff;
  text-align: center;
  box-shadow: var(--shadow);
}
.hero-kicker { margin-bottom: 8px; color: #ef9c9f; font-size: 12px; font-weight: 700; }
.hero-copy { max-width: 330px; margin: 12px auto 2px; color: #d7d7d7; font-size: 13px; line-height: 1.55; }
.sos-wrap {
  position: relative;
  display: grid;
  width: 188px;
  height: 188px;
  margin: 20px auto 12px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--coral) 0deg, rgba(255,255,255,.14) 0deg);
  transition: background .08s linear;
}
.sos-wrap::before {
  position: absolute;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: var(--deep-green);
  content: "";
}
.sos-button {
  position: relative;
  display: grid;
  width: 148px;
  height: 148px;
  z-index: 1;
  place-items: center;
  align-content: center;
  border: 6px solid rgba(255,255,255,.28);
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.sos-button:active { transform: scale(.98); }
.sos-label { font-size: 40px; font-weight: 850; letter-spacing: 1px; line-height: 1; }
.sos-hint { margin-top: 9px; font-size: 10px; font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase; }
.sos-instruction { color: #d4d4d4; font-size: 11px; }
.safeguard-strip {
  margin-top: 11px;
  padding: 11px 13px;
  border-left: 4px solid var(--coral);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .06);
}
.safeguard-strip strong { color: var(--ink); font-size: 12px; }
.safeguard-strip small { margin-top: 3px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 15px 0; }
.quick-card {
  display: flex;
  min-height: 88px;
  gap: 9px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}
.quick-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--soft-green);
  color: var(--green);
  font-size: 17px;
  font-weight: 800;
}
strong { display: block; font-size: 14px; }
small { display: block; color: var(--muted); font-size: 11px; line-height: 1.45; }
.section-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fff;
}
.text-button { border: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 800; }
.avatar-stack { display: flex; margin: 16px 0; }
.avatar {
  display: grid;
  width: 39px;
  height: 39px;
  margin-right: -6px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--soft-green);
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}
.avatar:nth-child(2n) { background: #f9e6df; color: #ad5c4d; }
.location-row { justify-content: flex-start; gap: 10px; padding-top: 13px; border-top: 1px solid var(--line); }
.location-icon { color: var(--coral); font-size: 25px; }

.page-heading { padding: 16px 2px 20px; }
.page-heading h2 { margin: 6px 0 8px; }
.page-heading p:last-child { color: var(--muted); font-size: 13px; line-height: 1.5; }
.contact-list, .activity-list { display: grid; gap: 9px; }
.contact-item, .activity-item {
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.contact-left, .activity-left { display: flex; min-width: 0; gap: 11px; align-items: center; }
.contact-item .avatar { margin: 0; border: 0; }
.geo-avatar { background: var(--deep-green); color: #fff; font-size: 18px; }
.page-subheading { margin: 22px 2px 10px; }
.page-subheading h3 { margin-top: 4px; }
.verified { margin-top: 3px; color: var(--green); font-size: 10px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.remove-button { border: 0; background: transparent; color: #b56254; font-size: 18px; }
.primary-button, .secondary-button, .outline-button {
  width: 100%;
  margin-top: 15px;
  padding: 14px 18px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 800;
}
.primary-button { border: 0; background: var(--green); color: #fff; }
.secondary-button { border: 0; background: var(--soft-green); color: var(--green); }
.outline-button { border: 1px solid var(--green); background: transparent; color: var(--green); }
.compact { width: auto; margin: 0; padding: 9px 12px; font-size: 12px; white-space: nowrap; }
.fine-print { margin: 14px 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.consent-panel { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.consent-panel small { margin-top: 5px; }
.zone-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
.zone-pill { padding: 7px 10px; border-radius: 99px; background: var(--soft-green); color: var(--green); font-size: 12px; font-weight: 800; }
.plain-list { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; }
.plain-list li { padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.plain-list small { margin-top: 3px; }
.activity-item { justify-content: flex-start; }
.activity-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--soft-green); color: var(--green); font-weight: 900; }
.activity-item.alert .activity-icon { background: var(--soft-coral); color: #c15643; }
.activity-access { margin-bottom: 12px; }
.empty-state { padding: 30px 12px; color: var(--muted); font-size: 13px; line-height: 1.6; text-align: center; }
.settings-card { gap: 12px; margin-bottom: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.settings-card small { margin-top: 4px; }
select { padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--green); font-size: 12px; font-weight: 700; }
.switch { position: relative; width: 43px; height: 24px; flex: 0 0 auto; }
.switch input { width: 0; height: 0; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 20px; background: #ced9d5; transition: .2s; }
.switch span::after { position: absolute; width: 18px; height: 18px; top: 3px; left: 3px; border-radius: 50%; background: #fff; content: ""; transition: .2s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(19px); }

.bottom-nav {
  position: fixed;
  bottom: 0;
  display: grid;
  width: min(100%, 460px);
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 10px max(11px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
}
.nav-item { display: grid; gap: 3px; place-items: center; border: 0; background: transparent; color: #8da09d; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item small { font-size: 10px; }
.nav-item.active { color: var(--green); }
.nav-item.active small { color: var(--green); font-weight: 800; }
.modal-backdrop { position: fixed; inset: 0; z-index: 5; display: grid; place-items: end center; background: rgba(8, 29, 27, .48); }
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(100%, 460px);
  padding: 22px 20px max(24px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.modal h2 { margin: 5px 0 9px; font-size: 30px; }
.modal p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 18px; }
.modal-actions button { margin-top: 0; }
.form-field { display: grid; gap: 5px; margin-top: 12px; color: var(--ink); font-size: 12px; font-weight: 800; }
.form-field input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink); }
.countdown { margin: 14px 0 5px; color: var(--coral); font-family: Georgia, serif; font-size: 54px; line-height: 1; text-align: center; }
.alert-sent { text-align: center; }
.alert-sent .activity-icon { width: 56px; height: 56px; margin: 0 auto 12px; background: var(--soft-coral); color: var(--coral); font-size: 26px; }
.delivery-list { display: grid; gap: 7px; margin: 17px 0 0; padding: 0; list-style: none; }
.delivery-item { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.delivery-status { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: #eef2ef; color: var(--muted); font-size: 18px; font-weight: 900; }
.delivery-status.sent { background: #fff4e8; color: #b46b36; }
.delivery-status.delivered { background: var(--soft-green); color: var(--green); font-size: 13px; }
.pin-drop { margin-top: 11px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pin-drop small { margin-top: 3px; }
.pin-drop.captured { border-color: #cfe2dc; background: var(--soft-green); }
.pin-drop.unavailable { border-color: #f2d8d1; background: var(--soft-coral); }
.pin-drop a { color: var(--green); font-weight: 800; }
.evidence-drop { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.evidence-drop small { margin-top: 3px; }
.evidence-drop.captured { border-color: #e9b9bb; background: var(--soft-coral); }
.evidence-drop.requesting { border-color: #e9b9bb; }
.evidence-drop.unavailable { background: #f2f2f0; }
.incident-id { margin-top: 13px; color: var(--muted); font-size: 10px !important; letter-spacing: .7px; text-align: center; text-transform: uppercase; }
.toast {
  position: fixed;
  bottom: 91px;
  left: 50%;
  z-index: 8;
  max-width: min(390px, calc(100% - 32px));
  padding: 11px 15px;
  border-radius: 12px;
  background: var(--deep-green);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: .24s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
