:root {
  color-scheme: light;
  --paper: #f2eee3;
  --paper-deep: #e7ddc8;
  --brand-navy: #0c3049;
  --brand-cyan: #1ea5e5;
  --brand-orange: #f0a127;
  --brand-orange-deep: #d9890b;
  --mint-deep: #1f9d72;
  --ink: #21303d;
  --muted: #5c6570;
  --panel: rgba(255, 255, 251, 0.92);
  --line: rgba(12, 48, 73, 0.1);
  --accent: var(--brand-orange);
  --accent-deep: var(--brand-orange-deep);
  --shadow: 0 18px 40px rgba(26, 44, 58, 0.1);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Barlow Condensed", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(240, 161, 39, 0.08), transparent 14%),
    var(--paper);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(280px, 1fr) auto;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

.topbar,
.stats-strip,
.sheet,
.map-overlay-card {
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 0;
}

.sheet h2 {
  margin: 0;
  font-family: "Teko", sans-serif;
  font-size: clamp(2.1rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--brand-navy);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 62px;
  height: 62px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  overflow: hidden;
}

.brand-mark__image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-mark__fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--brand-navy), #154766);
  color: #fff;
  font-family: "Teko", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.brand-mark--fallback {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.brand-mark--fallback .brand-mark__fallback {
  display: grid;
}

.brand-name,
.brand-subtitle {
  margin: 0;
  line-height: 1;
}

.brand-name {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: "Barlow Condensed", sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--brand-navy);
  text-transform: uppercase;
}

.brand-name__for {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  margin-top: 2px;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-orange-deep);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-orange-deep);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat-card {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brand-orange);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.map-stage {
  position: relative;
  min-height: 44vh;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(245, 238, 227, 0.95));
  border: 1px solid rgba(12, 48, 73, 0.08);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 44vh;
}

#map .leaflet-tile {
  filter: saturate(0.94) contrast(1.03) brightness(1.01);
}

#map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 12px 0 0 0;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 1.2;
  color: rgba(31, 36, 48, 0.72);
}

#map .leaflet-control-attribution a {
  color: rgba(31, 36, 48, 0.82);
}

.walker-marker-shell {
  background: transparent;
  border: 0;
}

.walker-marker {
  position: relative;
  width: 52px;
  height: 66px;
}

.walker-marker__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 10px 18px rgba(12, 48, 73, 0.18));
}

.walker-marker__shadow {
  position: absolute;
  left: 14px;
  bottom: 4px;
  width: 22px;
  height: 6px;
  border-radius: 999px;
  background: rgba(12, 48, 73, 0.2);
  filter: blur(2px);
}

.walker-marker__pulse {
  position: absolute;
  left: 12px;
  bottom: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(30, 165, 229, 0.2);
  animation: walker-pulse 1.9s ease-out infinite;
}

@keyframes walker-pulse {
  0% {
    transform: scale(0.82);
    opacity: 0.85;
  }

  70% {
    transform: scale(1.75);
    opacity: 0;
  }

  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

.map-overlay-card {
  position: absolute;
  left: 14px;
  right: 14px;
  top: 14px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-top: 3px solid var(--brand-orange);
  border-radius: 18px;
  box-shadow: var(--shadow);
  z-index: 500;
}

.card-title {
  margin: 0 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

#locationSummary {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.35;
}

.plant-fab {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  min-width: 132px;
  padding: 16px 24px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand-navy), #082336);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: "Teko", sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  box-shadow: 0 18px 32px rgba(12, 48, 73, 0.24);
  z-index: 500;
}

.sheet {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-top: 3px solid var(--brand-orange);
  border-radius: 28px 28px 0 0;
  box-shadow: var(--shadow);
  padding: 14px 14px 22px;
}

.sheet-handle {
  width: 48px;
  height: 5px;
  margin: 2px auto 12px;
  background: rgba(31, 36, 48, 0.14);
  border-radius: 999px;
}

.sheet-header,
.recent-header,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-banner {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.93rem;
}

.status-banner.neutral {
  background: rgba(31, 36, 48, 0.06);
  color: var(--ink);
}

.status-banner.success {
  background: rgba(31, 157, 114, 0.16);
  color: #15553f;
}

.status-banner.error {
  background: rgba(239, 107, 41, 0.18);
  color: #7a3414;
}

.scanner-panel {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 20px;
}

.scanner-panel.hidden {
  display: none;
}

.scanner-view {
  min-height: 240px;
  overflow: hidden;
  border-radius: 18px;
  background: #10131a;
  margin-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

.field span {
  font-size: 0.82rem;
  color: var(--brand-navy);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid rgba(12, 48, 73, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  padding: 13px 14px;
  color: var(--ink);
}

.field textarea {
  resize: vertical;
}

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

.primary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 999px;
  padding: 0 18px;
  font-weight: 700;
  font-family: "Teko", sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.03em;
}

.primary-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 24px rgba(239, 107, 41, 0.28);
}

.success-button {
  background: linear-gradient(180deg, var(--mint-deep), #0f7b5d);
  box-shadow: 0 12px 24px rgba(15, 123, 93, 0.24);
}

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

.ghost-button {
  background: rgba(12, 48, 73, 0.08);
  color: var(--brand-navy);
}

.recent-section {
  margin-top: 18px;
}

.recent-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.recent-item {
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-orange);
}

.recent-item strong,
.recent-item p {
  display: block;
  margin: 0;
}

.recent-item p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}

.leaflet-control-zoom {
  border: 0;
  margin: 0 14px 14px 0;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(12, 48, 73, 0.18);
}

#map .leaflet-bar a,
#map .leaflet-bar a:hover,
#map .leaflet-bar a:focus {
  border: 0;
}

#map .leaflet-control-zoom a {
  width: 44px;
  height: 44px;
  line-height: 44px;
  background: rgba(255, 252, 245, 0.96);
  color: var(--brand-navy);
  font-family: "Teko", sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  text-indent: 0;
  transition:
    background-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

#map .leaflet-control-zoom a + a {
  border-top: 1px solid rgba(12, 48, 73, 0.1);
}

#map .leaflet-control-zoom a:hover,
#map .leaflet-control-zoom a:focus-visible {
  background: rgba(240, 161, 39, 0.14);
  color: var(--brand-navy);
  box-shadow: inset 0 0 0 1px rgba(240, 161, 39, 0.24);
}

#map .leaflet-control-zoom a:active {
  background: var(--brand-orange);
  color: #fff;
  transform: scale(0.98);
}

#map .leaflet-control-zoom a.leaflet-disabled,
#map .leaflet-control-zoom a.leaflet-disabled:hover {
  background: rgba(238, 233, 221, 0.92);
  color: rgba(92, 101, 112, 0.58);
  box-shadow: none;
}

.leaflet-touch .leaflet-bar a {
  width: 44px;
  height: 44px;
  line-height: 44px;
}

@media (max-width: 640px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .brand-lockup {
    gap: 10px;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
  }

  .brand-name {
    font-size: 1.15rem;
  }

  .leaflet-control-zoom {
    margin: 0 12px 12px 0;
    border-radius: 16px;
  }

  #map .leaflet-control-zoom a,
  .leaflet-touch .leaflet-bar a {
    width: 42px;
    height: 42px;
    line-height: 42px;
  }

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

  .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .plant-fab,
  .primary-button,
  .ghost-button {
    width: 100%;
  }
}
