:root {
  color-scheme: light;
  --forest: #12342d;
  --forest-deep: #0b2722;
  --ink: #14221f;
  --muted: #53635d;
  --paper: #f4f4ed;
  --white: #ffffff;
  --amber: #f0b949;
  --red: #d92635;
  --blue: #0879e8;
  --line: #d4dbd3;
  --shadow: 0 8px 26px rgb(12 27 22 / 22%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--paper); color: var(--ink); }
body { overscroll-behavior: none; }
button, input { font: inherit; }
button { touch-action: manipulation; }
button:focus-visible, input:focus-visible { outline: 3px solid #0a74d9; outline-offset: 3px; }
[hidden] { display: none !important; }

.login-screen {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  padding: calc(24px + env(safe-area-inset-top)) 18px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto; background: radial-gradient(circle at 15% 0%, #285649 0, var(--forest) 44%, var(--forest-deep) 100%);
}
.login-card {
  width: min(100%, 460px); padding: 30px 26px 25px; border-radius: 24px;
  color: var(--ink); background: var(--white); box-shadow: 0 22px 60px rgb(0 0 0 / 30%);
}
.brand-lockup { display: flex; gap: 12px; align-items: center; margin-bottom: 30px; }
.brand-mark, .mini-mark {
  display: grid; place-items: center; flex: 0 0 auto; color: var(--forest-deep); background: var(--amber);
  font-weight: 900; letter-spacing: -.06em; border-radius: 13px;
}
.brand-mark { width: 48px; height: 48px; font-size: 25px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy span { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.brand-copy strong { color: var(--forest); font-size: 21px; line-height: 1.1; }
.eyebrow { margin: 0 0 8px; color: #52625b; font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.login-card h1 { margin: 0; color: var(--forest-deep); font-size: clamp(28px, 8vw, 36px); line-height: 1.08; letter-spacing: -.035em; }
.login-intro { margin: 12px 0 25px; color: #43514b; font-size: 16px; line-height: 1.5; }
#loginForm { display: grid; gap: 10px; }
#loginForm label { color: var(--ink); font-size: 14px; font-weight: 800; }
#passwordInput {
  width: 100%; min-height: 58px; padding: 12px 15px; border: 2px solid #77867f; border-radius: 12px;
  color: var(--ink); background: #fff; font-size: 18px; letter-spacing: .06em;
}
.button {
  min-height: 62px; display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  padding: 10px 15px; border: 0; border-radius: 14px; cursor: pointer; text-align: left;
  transition: transform 140ms cubic-bezier(.23,1,.32,1), filter 140ms ease-out, box-shadow 140ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.button:active { transform: scale(.98); }
.button:disabled { cursor: wait; filter: grayscale(.35); opacity: .8; }
.button-primary { color: #fff; background: #123f34; box-shadow: 0 4px 0 #09271f; }
.button-primary:hover { filter: brightness(1.08); }
.button-secondary { color: #15231f; background: #f4c45f; box-shadow: 0 4px 0 #c48c1d; }
.login-submit { width: 100%; margin-top: 8px; text-align: center; font-size: 17px; font-weight: 850; }
.form-message { min-height: 38px; margin: 2px 0 0; color: #47564f; font-size: 13px; line-height: 1.4; }
.form-message.is-error { color: #a31320; font-weight: 750; }
.login-footnote { display: flex; align-items: center; gap: 9px; margin-top: 24px; padding-top: 17px; border-top: 1px solid #dce1dc; color: #43514b; font-size: 13px; }
.lock-dot { width: 10px; height: 10px; border-radius: 50%; background: #23734b; box-shadow: 0 0 0 4px #e1f1e7; }
.contact-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; margin-top: 8px; padding-top: 8px; border-top: 1px solid #dce1dc; }
.developer-credit { color: #43514b; font-size: 10px; font-weight: 750; line-height: 1.25; }
.whatsapp-button { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 8px 12px; border: 2px solid #0b392e; border-radius: 10px; color: #fff; background: #0e5c43; box-shadow: 0 2px 5px rgb(12 27 22 / 18%); font-size: 12px; font-weight: 850; line-height: 1.2; text-align: center; text-decoration: none; touch-action: manipulation; }
.whatsapp-button:focus-visible { outline: 3px solid #0a74d9; outline-offset: 3px; }
.contact-footer-login { display: grid; grid-template-columns: 1fr; justify-items: start; gap: 7px; margin-top: 16px; }
.contact-footer-login .whatsapp-button { width: 100%; }

.app-shell { position: fixed; inset: 0; background: #e7e8df; }
.topbar {
  position: absolute; z-index: 600; inset: 0 0 auto; min-height: calc(64px + env(safe-area-inset-top));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; color: #fff; background: #102f28;
  box-shadow: 0 4px 16px rgb(0 0 0 / 25%);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.mini-mark { width: 39px; height: 39px; border-radius: 11px; font-size: 21px; }
.topbar-brand div { display: grid; gap: 1px; }
.topbar-brand strong { font-size: 17px; line-height: 1.05; }
.topbar-brand small { color: #d8e7de; font-size: 12px; font-weight: 600; }
.topbar-status { display: flex; align-items: center; }
.mode-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 10px; border: 1px solid rgb(255 255 255 / 36%); border-radius: 999px; color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .06em; white-space: nowrap; }
.mode-badge.is-online { background: #14573e; }
.mode-badge.is-offline { color: #2f2100; background: #ffd166; border-color: #ffd166; }
.mode-dot { width: 9px; height: 9px; border-radius: 50%; background: #7ee2a8; box-shadow: 0 0 0 2px rgb(255 255 255 / 18%); }
.mode-badge.is-offline .mode-dot { background: #9a5b00; }
.map-stage { position: absolute; inset: calc(64px + env(safe-area-inset-top)) 0 270px; overflow: hidden; background: #d8d7cb; }
#map { width: 100%; height: 100%; background: #d9d6c6; }
.map-base-control {
  position: absolute; z-index: 650; top: 10px; left: 10px; display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; width: min(340px, calc(100% - 20px));
}
.base-toggle {
  min-width: 0; min-height: 50px; display: grid; align-content: center; gap: 2px; padding: 5px 8px;
  border: 2px solid #53645b; border-radius: 10px; color: #17231e; background: rgb(255 255 255 / 97%);
  box-shadow: 0 2px 10px rgb(0 0 0 / 22%); text-align: center; cursor: pointer; touch-action: manipulation;
}
.base-toggle strong { font-size: 12px; font-weight: 900; line-height: 1.05; }
.base-toggle small { color: #43544b; font-size: 10px; font-weight: 750; line-height: 1.1; }
.base-toggle.is-active { border-color: #123f34; color: #fff; background: #123f34; }
.base-toggle.is-active small { color: #e3efe8; }
.base-toggle:disabled { cursor: not-allowed; filter: grayscale(.25); opacity: .55; }
.field-controls {
  position: absolute; z-index: 700; inset: auto 0 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #c9d0c8; background: #fbfbf7; box-shadow: 0 -6px 22px rgb(0 0 0 / 15%);
}
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.action-row .button { min-width: 0; justify-content: flex-start; }
.action-row .button strong, .action-row .button small { display: block; }
.action-row .button strong { font-size: 14px; line-height: 1.1; }
.action-row .button small { margin-top: 4px; font-size: 11px; font-weight: 650; line-height: 1.15; opacity: .92; }
.button-symbol { display: grid; place-items: center; width: 28px; height: 32px; flex: 0 0 28px; font-size: 26px; font-weight: 800; }
.target-symbol { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; font-size: 31px; font-weight: 600; line-height: 1; }
.layer-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.layer-toggle {
  min-height: 42px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; padding: 7px 8px;
  border: 1px solid #738078; border-radius: 10px; color: #26342f; background: #fff; font-size: 13px; font-weight: 800;
}
.layer-toggle.is-active { border: 2px solid #254f40; color: #102f28; background: #e5f0e9; }
.layer-key { display: inline-block; width: 19px; height: 4px; border-radius: 3px; background: #777; }
.key-axis { background: var(--red); }
.key-block { height: 11px; border: 2px solid #947516; background: #fff1af; }
.key-lot { height: 11px; border: 2px solid #188a91; background: #b9eded; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 28px; margin-top: 7px; color: #26342f; font-size: 12px; font-weight: 700; }
.map-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-counts { flex: 0 0 auto; color: #57645e; font-size: 11px; font-weight: 800; white-space: nowrap; }
.download-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 9px; min-height: 25px; color: #24332d; font-size: 11px; font-weight: 750; }
.contact-footer-map { min-height: 52px; margin-top: 6px; padding-top: 6px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 9px; background: #dce3dd; }
.progress-bar { display: block; width: 0; height: 100%; border-radius: inherit; background: #17744b; transition: width 120ms linear; }
#progressText { min-width: 106px; text-align: right; }

.axis-card {
  position: absolute; z-index: 550; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 3px;
  max-width: 440px; margin-inline: auto; padding: 14px 48px 14px 16px; border: 2px solid #fff; border-left: 7px solid var(--red);
  border-radius: 14px; color: #12211d; background: #fff; box-shadow: var(--shadow);
}
.axis-kicker { color: #53615b; font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.axis-code { color: #b71828; font-size: 25px; line-height: 1.05; }
.axis-street { color: #14221f; font-size: 16px; font-weight: 800; }
.axis-confirmation { color: #52615a; font-size: 12px; }
.axis-close { position: absolute; top: 8px; right: 10px; width: 40px; height: 40px; border: 0; border-radius: 50%; color: #1b2924; background: #edf0eb; font-size: 27px; line-height: 1; }
.toast {
  position: fixed; z-index: 2200; left: 16px; right: 16px; bottom: calc(210px + env(safe-area-inset-bottom));
  max-width: 520px; margin: 0 auto; padding: 13px 16px; border: 1px solid #fff; border-radius: 12px;
  color: #fff; background: #182722; box-shadow: var(--shadow); font-size: 14px; font-weight: 750; line-height: 1.35;
}
.leaflet-container { font-family: inherit; }
.leaflet-control-zoom a { width: 48px !important; height: 48px !important; line-height: 46px !important; font-size: 24px !important; color: #16221e !important; background: #fff !important; }
.leaflet-control-attribution { max-width: 60%; padding: 2px 5px !important; color: #1c2b25 !important; background: rgb(255 255 255 / 90%) !important; font-size: 9px !important; }
.axis-label { padding: 2px 5px !important; border: 1.5px solid #fff !important; border-radius: 5px !important; color: #fff !important; background: #be1c2a !important; box-shadow: 0 1px 4px rgb(0 0 0 / 55%) !important; font-size: 10px !important; font-weight: 900 !important; }
.axis-label:before { display: none !important; }
.gps-dot { width: 20px; height: 20px; border: 3px solid #fff; border-radius: 50%; background: #0879e8; box-shadow: 0 1px 8px rgb(0 0 0 / 70%); }

@media (min-width: 700px) {
  .map-stage { bottom: 270px; }
  .field-controls { left: 50%; right: auto; width: min(700px, 100%); transform: translateX(-50%); border: 1px solid #c9d0c8; border-radius: 18px 18px 0 0; }
  .map-base-control { top: 14px; left: 16px; width: min(380px, calc(100% - 32px)); }
}
@media (max-height: 650px) {
  .map-stage { bottom: 260px; }
  .field-controls { padding-top: 7px; }
  .action-row .button { min-height: 54px; }
  .layer-row { margin-top: 8px; }
  .status-row { margin-top: 4px; min-height: 22px; }
  .login-card { padding: 22px; }
  .brand-lockup { margin-bottom: 18px; }
}
@media (max-width: 430px) {
  .contact-footer-map { display: grid; grid-template-columns: 1fr; justify-items: stretch; gap: 4px; }
  .contact-footer-map .whatsapp-button { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
