:root {
  --ink: #101214;
  --muted: #64707b;
  --line: rgba(16, 18, 20, 0.12);
  --paper: #fbfcf9;
  --mint: #baf4d4;
  --green: #0f8f67;
  --teal: #156f85;
  --coral: #ff775f;
  --amber: #f5bc3b;
  --blue: #2954d6;
  --danger: #c4362e;
  --shadow: 0 24px 80px rgba(16, 18, 20, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(186, 244, 212, 0.5), transparent 28rem),
    radial-gradient(circle at 86% 8%, rgba(255, 119, 95, 0.16), transparent 24rem),
    linear-gradient(180deg, #f7fbf5 0%, #ffffff 48%, #eef8f5 100%);
  font-family: "Emmanuel Sans", "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.appointment-shell {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 16px;
  width: min(1500px, calc(100vw - 28px));
  height: calc(100vh - 28px);
  margin: 14px auto;
}

.booking-panel,
.booking-card,
.leaflet-control-container .leaflet-control {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.booking-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-link img {
  width: 142px;
  display: block;
}

.dashboard-link,
.book-button,
.location-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease;
}

.dashboard-link {
  padding: 0 15px;
}

.dashboard-link:hover,
.book-button:hover,
.location-button:hover {
  transform: translateY(-2px);
  background: var(--green);
}

.intro-card,
.nearest-card,
.controls-card,
.hospital-section {
  padding: 16px;
}

.intro-card {
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  width: fit-content;
  margin: 0 0 10px;
  padding: 7px 10px;
  border: 1px solid rgba(15, 143, 103, 0.22);
  border-radius: 999px;
  color: var(--green);
  background: rgba(186, 244, 212, 0.46);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.45rem, 5vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
}

.intro-card p,
.nearest-card p,
.selectedHospitalMeta,
.location-status {
  color: var(--muted);
  line-height: 1.5;
}

.location-button {
  width: 100%;
  margin-top: 8px;
}

.location-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgba(16, 18, 20, 0.04);
  font-size: 0.88rem;
}

.location-status.is-good {
  color: var(--green);
  background: rgba(186, 244, 212, 0.32);
}

.location-status.is-error {
  color: var(--danger);
  background: rgba(196, 54, 46, 0.08);
}

.nearest-card {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(16, 18, 20, 0.96), rgba(21, 111, 133, 0.92)),
    var(--ink);
  color: #fff;
}

.nearest-card span,
.nearest-card p {
  color: rgba(255, 255, 255, 0.72);
}

.nearest-card strong {
  font-size: 1.25rem;
}

.controls-card {
  display: grid;
  grid-template-columns: 1fr 0.8fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  outline: 0;
}

input:focus,
select:focus {
  border-color: rgba(15, 143, 103, 0.52);
  box-shadow: 0 0 0 4px rgba(186, 244, 212, 0.36);
}

.hospital-section {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.hospital-list {
  min-height: 0;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0 2px 4px 0;
  overflow-y: auto;
  list-style: none;
}

.hospital-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.hospital-card:hover,
.hospital-card.is-selected {
  transform: translateY(-2px);
  border-color: rgba(15, 143, 103, 0.32);
  background: rgba(186, 244, 212, 0.32);
}

.hospital-card.is-nearest {
  border-color: rgba(245, 188, 59, 0.62);
}

.hospital-card-header,
.hospital-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hospital-type,
.nearest-badge,
.distance-badge {
  width: fit-content;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.hospital-type {
  color: var(--green);
  background: rgba(15, 143, 103, 0.1);
}

.nearest-badge {
  color: #5e4611;
  background: rgba(245, 188, 59, 0.22);
}

.distance-badge {
  color: var(--ink);
  background: rgba(16, 18, 20, 0.06);
}

.hospital-card strong {
  font-size: 1rem;
}

.hospital-card small {
  color: var(--muted);
  line-height: 1.4;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: var(--radius);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 500px;
  border-radius: var(--radius);
  background: #dbe7e2;
}

.map-label {
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 30px;
  padding: 0 9px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(16, 18, 20, 0.28);
  font-size: 0.72rem;
  font-weight: 900;
}

.map-label.nearest {
  color: var(--ink);
  background: var(--amber);
}

.booking-card {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 500;
  width: min(440px, calc(100% - 36px));
  padding: 18px;
}

.booking-card p {
  color: var(--muted);
  line-height: 1.45;
}

.booking-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.booking-form label:first-child,
.book-button,
.booking-message {
  grid-column: 1 / -1;
}

.book-button {
  width: 100%;
}

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

.booking-message {
  display: none;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(186, 244, 212, 0.32);
  font-size: 0.9rem;
  line-height: 1.4;
}

.booking-message.is-visible {
  display: block;
}

.booking-message.is-error {
  color: var(--danger);
  background: rgba(196, 54, 46, 0.08);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
}

.popup-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  background: var(--ink);
  font-weight: 800;
}

@media (max-width: 1040px) {
  body {
    overflow: auto;
  }

  .appointment-shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .booking-panel {
    max-height: none;
  }

  .map-stage {
    min-height: 680px;
  }
}

@media (max-width: 680px) {
  .appointment-shell {
    width: calc(100% - 20px);
    margin: 10px auto;
  }

  .panel-header,
  .controls-card,
  .booking-form {
    grid-template-columns: 1fr;
  }

  .panel-header {
    display: grid;
  }

  .dashboard-link {
    width: 100%;
  }

  .map-stage {
    min-height: 760px;
  }

  .booking-card {
    position: absolute;
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
  }
}
