:root {
  --primary: #2f5bea;
  --primary-dark: #2347c6;
  --primary-soft: #eef2ff;
  --primary-border: #c9d4f5;
  --ink: #0b1b33;
  --text: #24324a;
  --muted: #66758c;
  --line: #e4e8f0;
  --background: #f6f8fb;
  --white: #ffffff;
  --red: #e5383b;
  --red-dark: #a3191c;
  --red-soft: #fdecec;
  --orange: #f08c00;
  --orange-dark: #8a4f00;
  --orange-soft: #fff4e0;
  --green: #12a150;
  --green-dark: #0b6b35;
  --green-soft: #e7f7ee;
  --grey: #94a3b8;
  --radius: 14px;
  --radius-small: 10px;
  --shadow: 0 1px 2px rgba(11, 27, 51, 0.05), 0 8px 24px rgba(11, 27, 51, 0.07);
  --shadow-large: 0 24px 60px rgba(11, 27, 51, 0.18);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  letter-spacing: -0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-icon] {
  display: inline-flex;
}

.hidden {
  display: none !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.logo-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--white);
  background: linear-gradient(135deg, var(--primary), #5b7cff);
}

.logo-mark .icon {
  width: 18px;
  height: 18px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s;
}

.header-link:hover {
  color: var(--ink);
}

.header-link .icon {
  width: 18px;
  height: 18px;
}

.button {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-small);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s, border-color 0.2s, color 0.2s;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  color: var(--white);
  background: var(--primary);
  box-shadow: 0 6px 16px rgba(47, 91, 234, 0.28);
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line);
}

.button-secondary:hover {
  border-color: #cbd3e1;
}

.button-success {
  color: var(--white);
  background: var(--green);
  box-shadow: 0 6px 16px rgba(18, 161, 80, 0.25);
}

.button-danger {
  color: var(--white);
  background: var(--red);
  box-shadow: 0 6px 16px rgba(229, 56, 59, 0.28);
}

.button-ghost {
  color: var(--muted);
  background: transparent;
}

.button-ghost:hover {
  color: var(--ink);
  background: var(--background);
}

.button-block {
  width: 100%;
  height: 50px;
}

.button-icon {
  width: 44px;
  padding: 0;
}

.link-button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea.input {
  height: auto;
  min-height: 90px;
  padding: 12px 14px;
  resize: vertical;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.form-error {
  min-height: 20px;
  margin: 0;
  font-size: 14px;
  color: var(--red);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 27, 51, 0.45);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow-large);
  transform: translateY(12px) scale(0.97);
  transition: transform 0.3s var(--ease);
}

.modal-backdrop.visible .modal {
  transform: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.modal-header p {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-center {
  text-align: center;
}

.modal-center p {
  margin: 10px 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.modal-icon {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border-radius: 50%;
  color: var(--red);
  background: var(--red-soft);
}

.modal-icon .icon {
  width: 30px;
  height: 30px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.modal-actions .button {
  flex: 1;
}

.toast-area {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  color: var(--white);
  background: var(--ink);
  box-shadow: var(--shadow-large);
  animation: toast-in 0.35s var(--ease);
}

.toast-danger {
  background: var(--red);
}

.toast.leaving {
  animation: toast-out 0.3s var(--ease) forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.fade-up {
  animation: fade-up 0.6s var(--ease) both;
}

.delay-1 {
  animation-delay: 0.08s;
}

.delay-2 {
  animation-delay: 0.16s;
}

.delay-3 {
  animation-delay: 0.24s;
}

.site-footer {
  padding: 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.home-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 500px at 10% -10%, #e1e8ff 0%, transparent 60%),
    radial-gradient(700px 420px at 100% 0%, #fde6e6 0%, transparent 55%),
    var(--background);
}

.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px 40px;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
}

.pill .icon {
  width: 16px;
  height: 16px;
}

.hero h1 {
  max-width: 780px;
  margin-top: 22px;
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.hero h1 span {
  color: var(--primary);
}

.hero-text {
  max-width: 560px;
  margin: 20px 0 44px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--muted);
}

.choices {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 330px));
  justify-content: center;
  gap: 18px;
}

.choice {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 20px;
  text-align: left;
  color: inherit;
  background: var(--white);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s;
}

.choice:hover {
  transform: translateY(-4px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-large);
}

.choice-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--primary);
  background: var(--primary-soft);
}

.choice-icon .icon {
  width: 24px;
  height: 24px;
}

.choice-icon.red {
  color: var(--red);
  background: var(--red-soft);
}

.choice-title {
  margin-top: 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.choice-text {
  font-size: 15px;
  line-height: 1.5;
  color: var(--muted);
}

.choice-link {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 8px;
  font-weight: 600;
  color: var(--primary);
}

.choice-link .icon {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease);
}

.choice:hover .choice-link .icon {
  transform: translateX(4px);
}

.page {
  max-width: 820px;
  margin: 0 auto;
  padding: 44px 20px 80px;
}

.page-title h1 {
  font-size: 36px;
  letter-spacing: -0.03em;
}

.page-title p {
  margin: 10px 0 0;
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
}

.notice .icon {
  color: var(--primary);
}

.notice a {
  margin-left: auto;
  font-weight: 600;
}

.form-card {
  margin-top: 28px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.form-section + .form-section {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.form-section h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 17px;
}

.section-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--background);
}

.segmented label {
  flex: 1;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s, box-shadow 0.2s;
}

.segmented span .icon {
  width: 18px;
  height: 18px;
}

.segmented input:checked + span {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 1px 3px rgba(11, 27, 51, 0.12);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--primary);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  cursor: pointer;
}

.switch-row strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}

.switch-row small {
  font-size: 13px;
  color: var(--muted);
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: none;
}

.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d5dbe6;
  pointer-events: none;
  transition: background 0.2s;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s var(--ease);
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.location-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px dashed var(--primary-border);
  border-radius: var(--radius);
  background: #f8faff;
}

.location-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.location-status.success {
  color: var(--green);
  font-weight: 600;
}

.location-status.error {
  color: var(--red);
}

.form-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.form-hint {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--muted);
}

.sos-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(700px 500px at 50% 30%, #fde9e9 0%, transparent 65%),
    var(--background);
}

.sos-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
}

.sos-person {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.sos-person strong {
  display: block;
  margin-bottom: 4px;
  font-size: 20px;
  color: var(--ink);
}

.sos-ready {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sos-button-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 48px 0 36px;
}

.sos-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--red);
  opacity: 0.25;
  animation: sos-ring 2.4s var(--ease) infinite;
}

.sos-ring.second {
  animation-delay: 1.2s;
}

@keyframes sos-ring {
  from {
    opacity: 0.35;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.55);
  }
}

.sos-button {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 50%;
  font-size: 58px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--white);
  background: radial-gradient(circle at 30% 30%, #ff6b6e, var(--red) 60%, #c4262a);
  box-shadow: 0 20px 50px rgba(229, 56, 59, 0.45), inset 0 -6px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 0.2s var(--ease);
}

.sos-button:hover {
  transform: scale(1.03);
}

.sos-button:active {
  transform: scale(0.96);
}

.sos-hint {
  max-width: 330px;
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.status-card {
  width: 100%;
  max-width: 440px;
  margin-top: 32px;
  padding: 36px 28px;
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow-large);
  animation: fade-up 0.5s var(--ease) both;
}

.status-card h2 {
  font-size: 24px;
}

.status-card p {
  margin: 10px 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.status-card .button {
  margin-top: 24px;
}

.status-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: 50%;
}

.status-icon .icon {
  width: 34px;
  height: 34px;
}

.status-icon.success {
  color: var(--green);
  background: var(--green-soft);
  animation: pop 0.5s var(--ease) both;
}

.status-icon.error {
  color: var(--red);
  background: var(--red-soft);
}

.status-icon.waiting {
  background: var(--primary-soft);
}

.status-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 26px;
  text-align: left;
}

.status-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--muted);
}

.status-step-dot {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: none;
  border: 2px solid var(--line);
  border-radius: 50%;
  color: var(--white);
  transition: background 0.3s, border-color 0.3s;
}

.status-step-dot .icon {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}

.status-step.done {
  color: var(--ink);
  font-weight: 600;
}

.status-step.done .status-step-dot {
  border-color: var(--green);
  background: var(--green);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid #d7e0fb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: scale(0.5);
  }
  70% {
    transform: scale(1.1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.map-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-page .site-header {
  position: relative;
  flex: none;
  height: 60px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kraj-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
}

.kraj-chip .icon {
  width: 15px;
  height: 15px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  background: var(--ink);
}

.button-flood.active {
  color: var(--orange-dark);
  background: var(--orange-soft);
  border-color: #f7c77a;
}

.map-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 360px 1fr 0;
  transition: grid-template-columns 0.35s var(--ease);
}

.map-layout.panel-open {
  grid-template-columns: 360px 1fr 400px;
}

.people-list {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-right: 1px solid var(--line);
}

.list-top {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
}

.search > [data-icon] {
  position: absolute;
  top: 13px;
  left: 14px;
  color: var(--muted);
}

.search > [data-icon] .icon {
  width: 18px;
  height: 18px;
}

.search .input {
  padding-left: 42px;
}

.list-origin {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.list-origin .icon {
  width: 14px;
  height: 14px;
}

.list-body {
  flex: 1;
  overflow-y: auto;
  padding: 4px 12px 16px;
}

.group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 6px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.group-count {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--background);
}

.group-title.sos {
  color: var(--red);
}

.group-title.sos .group-count {
  background: var(--red-soft);
}

.group-title.preventive {
  color: var(--orange-dark);
}

.group-title.preventive .group-count {
  background: var(--orange-soft);
}

.group-title.helped {
  color: var(--green-dark);
}

.person-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  text-align: left;
  color: inherit;
  background: transparent;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.person-row:hover {
  background: var(--background);
}

.person-row.selected {
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: none;
  border-radius: 50%;
  background: var(--grey);
}

.status-dot.sos {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-soft);
}

.status-dot.preventive {
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.status-dot.helping {
  background: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.status-dot.helped {
  background: var(--green);
}

.person-text {
  flex: 1;
  min-width: 0;
}

.person-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.person-name b {
  font-weight: 800;
}

.person-meta {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 12.5px;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
}

.person-distance {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: var(--ink);
}

.empty-list {
  padding: 40px 20px;
  font-size: 14px;
  text-align: center;
  color: var(--muted);
}

.map-area {
  position: relative;
  min-width: 0;
}

#map {
  position: absolute;
  inset: 0;
  background: #eef1f5;
}

.map-dim {
  position: absolute;
  inset: 0;
  z-index: 500;
  background: rgba(11, 27, 51, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 400;
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend .status-dot {
  width: 10px;
  height: 10px;
  box-shadow: none;
}

.nearest-card {
  display: none;
}

.pin-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin {
  width: 18px;
  height: 18px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--grey);
  box-shadow: 0 2px 6px rgba(11, 27, 51, 0.35);
  transition: transform 0.2s var(--ease);
}

.pin.sos {
  width: 26px;
  height: 26px;
  background: var(--red);
  animation: pin-pulse 1.8s infinite;
}

.pin.preventive {
  width: 22px;
  height: 22px;
  background: var(--orange);
}

.pin.helping {
  width: 24px;
  height: 24px;
  background: var(--primary);
}

.pin.helped {
  background: var(--green);
}

.pin.selected {
  transform: scale(1.25);
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

@keyframes pin-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(229, 56, 59, 0.55);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(229, 56, 59, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(229, 56, 59, 0);
  }
}

.my-location {
  width: 18px;
  height: 18px;
  border: 3px solid var(--white);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 8px rgba(47, 91, 234, 0.2);
}

.panel {
  min-width: 0;
  overflow-y: auto;
  background: var(--white);
  border-left: 1px solid var(--line);
}

.panel-content {
  width: 400px;
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.panel-name {
  font-size: 23px;
  line-height: 1.2;
}

.panel-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.age-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  background: var(--ink);
}

.age-badge small {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.8;
}

.disability-tag {
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.status-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--muted);
  background: var(--background);
}

.status-banner strong {
  display: block;
  font-size: 15px;
}

.status-banner.sos {
  color: var(--red-dark);
  background: var(--red-soft);
}

.status-banner.preventive {
  color: var(--orange-dark);
  background: var(--orange-soft);
}

.status-banner.helping {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.status-banner.helped {
  color: var(--green-dark);
  background: var(--green-soft);
}

.stat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.stat-tile {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.stat-tile span {
  font-size: 12px;
  color: var(--muted);
}

.stat-tile strong {
  display: block;
  margin-top: 2px;
  font-size: 22px;
  color: var(--ink);
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 22px;
}

.detail {
  display: flex;
  gap: 12px;
}

.detail-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  color: var(--muted);
  background: var(--background);
}

.detail-icon .icon {
  width: 18px;
  height: 18px;
}

.detail-label {
  font-size: 12px;
  color: var(--muted);
}

.detail-value {
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
}

.detail-value.warning {
  font-weight: 700;
  color: var(--red);
}

.helpers {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.helpers h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.helpers h3 .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}

.helper-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.helper-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--primary-soft);
}

.helper-chip .avatar {
  width: 26px;
  height: 26px;
  font-size: 10px;
  background: var(--primary);
}

.helpers-empty {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 860px) {
  .hide-on-mobile {
    display: none !important;
  }

  .site-header {
    padding: 0 14px;
  }

  .map-layout,
  .map-layout.panel-open {
    position: relative;
    display: block;
  }

  .people-list {
    display: none;
  }

  .map-area {
    position: absolute;
    inset: 0;
  }

  .legend {
    display: none;
  }

  .leaflet-control-zoom {
    display: none;
  }

  .panel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 600;
    width: calc(100% - 48px);
    border-left: 0;
    box-shadow: none;
    transform: translateX(100%);
    transition: transform 0.35s var(--ease);
  }

  .map-layout.panel-open .panel {
    transform: none;
    box-shadow: var(--shadow-large);
  }

  .map-layout.panel-open .map-dim {
    opacity: 1;
    pointer-events: auto;
  }

  .panel-content {
    width: auto;
    padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  }

  .nearest-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    z-index: 450;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 0;
    border-radius: 16px;
    text-align: left;
    color: inherit;
    background: var(--white);
    box-shadow: var(--shadow-large);
    cursor: pointer;
    animation: fade-up 0.4s var(--ease) both;
  }

  .nearest-card .status-dot {
    width: 14px;
    height: 14px;
  }

  .nearest-card .person-text {
    font-size: 14px;
  }

  .nearest-card .person-distance {
    font-size: 16px;
  }

  .toast-area {
    left: 12px;
    right: 12px;
    top: 70px;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 700px) {
  .hero {
    padding-top: 48px;
  }

  .hero-text {
    font-size: 16px;
  }

  .choices {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-card {
    padding: 20px;
  }

  .location-box {
    flex-direction: column;
    align-items: stretch;
  }

  .page-title h1 {
    font-size: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.section-hint {
  margin: -6px 0 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.location-picker {
  position: relative;
  z-index: 0;
  isolation: isolate;
  height: 340px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #eef1f5;
}

.location-picker.leaflet-container {
  cursor: crosshair;
}

.home-pin {
  width: 24px;
  height: 24px;
  border: 4px solid var(--white);
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 6px rgba(47, 91, 234, 0.25), 0 4px 10px rgba(11, 27, 51, 0.35);
  cursor: grab;
  animation: pop 0.35s var(--ease) both;
}

@media (max-width: 700px) {
  .location-picker {
    height: 280px;
  }
}

.flood-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  margin-top: 32px;
  animation: fade-up 0.5s var(--ease) both;
}

.band {
  width: 260px;
  padding: 14px;
  border-radius: 46px;
  background: linear-gradient(160deg, #273449, #0b1220);
  box-shadow: 0 30px 60px rgba(11, 27, 51, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: band-in 0.6s var(--ease) both, band-glow 2.2s ease-in-out 0.6s infinite;
}

@keyframes band-in {
  0% {
    opacity: 0;
    transform: scale(0.9) rotate(-2deg);
  }
  60% {
    transform: scale(1.03) rotate(1deg);
  }
  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes band-glow {
  0%,
  100% {
    box-shadow: 0 30px 60px rgba(11, 27, 51, 0.35), 0 0 0 0 rgba(240, 140, 0, 0);
  }
  50% {
    box-shadow: 0 30px 60px rgba(11, 27, 51, 0.35), 0 0 0 14px rgba(240, 140, 0, 0.18);
  }
}

.band-screen {
  min-height: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 20px;
  border-radius: 34px;
  color: var(--white);
  background: #0f172a;
}

.band-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

.band-battery {
  position: relative;
  width: 22px;
  height: 11px;
  border: 2px solid #4ade80;
  border-radius: 3px;
}

.band-battery::after {
  content: "";
  position: absolute;
  top: 2px;
  right: -5px;
  width: 2px;
  height: 3px;
  border-radius: 1px;
  background: #4ade80;
}

.band-icon {
  display: grid;
  place-items: center;
  margin: 6px auto 0;
}

.band-icon .icon {
  width: 34px;
  height: 34px;
}

.band-icon.orange {
  color: #fbbf24;
  animation: pop 0.5s var(--ease) both;
}

.band-icon.green {
  color: #4ade80;
  animation: pop 0.5s var(--ease) both;
}

.band-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.02em;
}

.band-text {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  color: #cbd5e1;
}

.band-button {
  width: 100%;
  min-height: 50px;
  padding: 8px 12px;
  border: 0;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: transform 0.15s var(--ease), filter 0.2s;
}

.band-button:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.band-button:active {
  transform: scale(0.97);
}

.band-button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.band-button.green {
  background: #16a34a;
}

.band-button.orange {
  background: #d97706;
}

.band-button.red {
  background: #dc2626;
}

.band-button.outline {
  margin-top: auto;
  color: #e2e8f0;
  background: transparent;
  border: 1px solid #475569;
}

.flood-caption {
  max-width: 380px;
  text-align: center;
}

.flood-caption h2 {
  font-size: 20px;
}

.flood-caption p {
  margin: 8px 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.pin.needhelp {
  width: 24px;
  height: 24px;
  background: var(--orange);
  animation: pin-pulse-orange 1.8s infinite;
}

.pin.safe {
  background: #5fbf88;
}

@keyframes pin-pulse-orange {
  0% {
    box-shadow: 0 0 0 0 rgba(240, 140, 0, 0.55);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(240, 140, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(240, 140, 0, 0);
  }
}

.status-dot.needhelp {
  background: var(--orange);
  box-shadow: 0 0 0 4px #fde3b8;
}

.status-dot.safe {
  background: #5fbf88;
}

.status-banner.needhelp {
  color: var(--orange-dark);
  background: #ffe8c2;
}

.status-banner.safe {
  color: var(--green-dark);
  background: var(--green-soft);
}

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 1100;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 16px;
  font-size: 13px;
  color: var(--white);
  background: var(--ink);
}

.demo-banner > [data-icon] .icon {
  width: 16px;
  height: 16px;
  color: #fbbf24;
}

.demo-banner-message {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.demo-banner-message strong {
  color: #fbbf24;
}

.demo-banner-reset {
  flex: none;
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s;
}

.demo-banner-reset:hover {
  background: rgba(255, 255, 255, 0.12);
}

.site-header {
  top: 36px;
}

.map-page .site-header {
  top: 0;
}

.map-page .demo-banner {
  position: relative;
  flex: none;
}

.toast-area {
  top: 112px;
}

.form-note {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.legend {
  flex-wrap: wrap;
  max-width: calc(100% - 32px);
  row-gap: 6px;
}

.legend > span {
  white-space: nowrap;
}

@media (max-width: 860px) {
  .demo-banner {
    height: 46px;
    gap: 10px;
    padding: 0 10px;
    font-size: 12px;
    line-height: 1.3;
  }

  .demo-banner-message {
    white-space: normal;
  }

  .site-header {
    top: 46px;
  }

  .map-page .site-header {
    top: 0;
  }

  .toast-area {
    top: 108px;
  }
}
