:root {
  color-scheme: light;
  --forest: #12342d;
  --forest-deep: #0b2722;
  --ink: #14221f;
  --muted: #53635d;
  --paper: #f4f4ed;
  --white: #fff;
  --amber: #f0b949;
  --red: #d92635;
  --blue: #0879e8;
  --line: #d4dbd3;
  --shadow: 0 8px 26px rgb(12 27 22 / 24%);
  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; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 3px solid #0a74d9; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.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; }
.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); }
.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: grid; gap: 8px; }
.developer-credit { color: #43514b; font-size: 11px; font-weight: 750; line-height: 1.25; }
.whatsapp-button { width: 100%; min-width: 0; max-width: 100%; min-height: 44px; display: block; padding: 11px 8px; border: 2px solid #0b392e; border-radius: 10px; color: #fff; background: #0e5c43; box-shadow: 0 2px 5px rgb(12 27 22 / 18%); font-size: 13px; font-weight: 850; line-height: 1.2; text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; touch-action: manipulation; }
.whatsapp-button:focus-visible { outline: 3px solid #0a74d9; outline-offset: 3px; }
.contact-footer-login { justify-items: start; margin-top: 16px; padding-top: 8px; border-top: 1px solid #dce1dc; }
.contact-footer-login .whatsapp-button { width: 100%; }

.app-shell {
  position: fixed; inset: 0; z-index: 1; display: grid; grid-template-columns: minmax(0,1fr);
  grid-template-rows: calc(44px + env(safe-area-inset-top)) minmax(0,1fr) calc(48px + env(safe-area-inset-bottom));
  width: 100%; height: 100vh; height: 100dvh; overflow: hidden; background: #e7e8df;
}
.topbar {
  position: relative; z-index: 1100; grid-row: 1; min-width: 0; display: block;
  padding: env(safe-area-inset-top) 8px 0 10px; color: #fff; background: #102f28; box-shadow: 0 3px 10px rgb(0 0 0 / 22%);
}
.topbar-brand { width: 100%; min-width: 0; height: 44px; display: flex; align-items: center; gap: 8px; padding-right: 102px; }
.mini-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 18px; }
.topbar-copy { min-width: 0; flex: 1 1 auto; display: flex; align-items: baseline; gap: 7px; }
.topbar-copy strong { color: #fff; font-size: 16px; line-height: 1; }
.topbar-copy small { min-width: 0; overflow: hidden; color: #d8e7de; font-size: 11px; font-weight: 650; line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { position: absolute; right: 8px; bottom: 0; z-index: 2; height: 44px; display: flex; align-items: center; gap: 6px; }
.mode-badge { min-height: 32px; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 3px; color: #fff; font-size: 10px; font-weight: 900; letter-spacing: .05em; white-space: nowrap; }
.mode-dot { width: 9px; height: 9px; flex: 0 0 9px; border: 1px solid rgb(255 255 255 / 70%); border-radius: 50%; background: #65df94; box-shadow: 0 0 0 2px rgb(255 255 255 / 16%); }
.mode-badge.is-offline { color: #ffdb80; }
.mode-badge.is-offline .mode-dot { border-color: #ffe5a5; background: #e8a900; }
.more-trigger { position: relative; width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 1px solid rgb(255 255 255 / 40%); border-radius: 11px; color: #fff; background: #24463c; cursor: pointer; }
.more-trigger svg, .map-fab svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.more-trigger:active, .map-fab:active, .nav-action:active, .offline-action:active { transform: scale(.97); }
.update-dot { position: absolute; top: 4px; right: 4px; width: 10px; height: 10px; border: 2px solid #102f28; border-radius: 50%; background: #ffd23f; }

.map-stage { position: relative; z-index: 0; grid-row: 2; min-width: 0; min-height: 0; overflow: hidden; background: #d8d7cb; }
#map { width: 100%; height: 100%; background: #d9d6c6; }
.map-base-control { position: absolute; z-index: 820; top: 10px; left: 10px; display: grid; justify-items: start; gap: 7px; }
.map-fab { width: 44px; height: 44px; display: grid; place-items: center; border: 2px solid #26362f; border-radius: 12px; color: #14251f; background: rgb(255 255 255 / 98%); box-shadow: 0 2px 9px rgb(0 0 0 / 28%); cursor: pointer; }
.base-menu { width: min(236px, calc(100vw - 76px)); display: grid; gap: 6px; padding: 7px; border: 2px solid #26362f; border-radius: 13px; background: #fff; box-shadow: var(--shadow); }
.base-toggle { min-height: 44px; display: grid; align-content: center; justify-items: start; gap: 2px; padding: 5px 9px; border: 1px solid #56665e; border-radius: 9px; color: #15231f; background: #fff; text-align: left; cursor: pointer; }
.base-toggle strong { font-size: 13px; font-weight: 900; line-height: 1.1; }
.base-toggle small { color: #43544b; font-size: 10px; font-weight: 700; line-height: 1.15; }
.base-toggle.is-active { border: 2px solid #123f34; color: #fff; background: #123f34; }
.base-toggle.is-active small { color: #e3efe8; }
.base-toggle:disabled { cursor: not-allowed; filter: grayscale(.25); opacity: .56; }
.north-up-button { position: absolute; z-index: 810; top: 99px; right: 10px; color: #14251f; }
.north-up-button[hidden] { display: none !important; }
.north-up-button .compass-needle { fill: #d92635; stroke: #8e101c; stroke-width: .75; }
.north-up-button.is-active { border-color: #123f34; color: #fff; background: #123f34; }
.north-up-button.is-active .compass-needle { fill: #ffc84a; stroke: #fff; }

.axis-card {
  position: absolute; z-index: 800; left: 10px; right: 10px; bottom: 10px; display: grid; gap: 3px;
  max-width: 440px; margin-inline: auto; padding: 12px 48px 12px 14px; border: 2px solid #fff; border-left: 7px solid var(--red);
  border-radius: 13px; color: #12211d; background: rgb(255 255 255 / 98%); box-shadow: var(--shadow);
}
.axis-kicker { color: #53615b; font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.axis-code { color: #b71828; font-size: 23px; line-height: 1.05; }
.axis-street { color: #14221f; font-size: 15px; font-weight: 800; }
.axis-confirmation { color: #52615a; font-size: 12px; }
.axis-close { position: absolute; top: 6px; right: 7px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: #1b2924; background: #edf0eb; font-size: 27px; line-height: 1; }
.gps-status { position: absolute; z-index: 790; left: 9px; bottom: 8px; min-height: 30px; max-width: min(68vw, 270px); display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid #172a22; border-radius: 9px; color: #fff; background: #173e33; box-shadow: 0 2px 8px rgb(0 0 0 / 35%); font-size: 11px; font-weight: 850; line-height: 1.2; }
.gps-status[hidden] { display: none !important; }
.gps-status-dot { width: 8px; height: 8px; flex: 0 0 8px; border: 1px solid #fff; border-radius: 50%; background: #63e097; }
.gps-status[data-state="searching"] .gps-status-dot { background: #ffd34e; }
.gps-status[data-state="low"] { color: #211b08; background: #ffdf71; }
.gps-status[data-state="low"] .gps-status-dot { border-color: #58420a; background: #bd8200; }
.gps-status[data-state="denied"], .gps-status[data-state="outside"], .gps-status[data-state="error"] { color: #fff; background: #8f1d25; }
.gps-status[data-state="denied"] .gps-status-dot, .gps-status[data-state="outside"] .gps-status-dot, .gps-status[data-state="error"] .gps-status-dot { background: #ff7e81; }
.map-stage.has-axis-card .gps-status { display: none; }

.more-backdrop { position: absolute; z-index: 900; inset: calc(44px + env(safe-area-inset-top)) 0 calc(48px + env(safe-area-inset-bottom)); background: rgb(5 17 13 / 38%); }
.more-sheet {
  position: absolute; z-index: 1000; left: 8px; right: 8px; bottom: calc(48px + env(safe-area-inset-bottom) + 8px);
  max-height: min(72dvh, 590px); overflow-x: hidden; overflow-y: auto; padding: 7px 14px 14px; border: 2px solid #253e34;
  border-radius: 19px; color: var(--ink); background: #fff; box-shadow: 0 14px 38px rgb(0 0 0 / 38%); overscroll-behavior: contain;
}
.sheet-grabber { width: 38px; height: 4px; margin: 2px auto 8px; border-radius: 99px; background: #aab5ad; }
.sheet-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-eyebrow { color: #506259; font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.sheet-header h2 { margin: 1px 0 0; color: #102f28; font-size: 20px; line-height: 1.1; }
.sheet-close { width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid #77867f; border-radius: 50%; color: #17231e; background: #f2f4f0; font-size: 28px; line-height: 1; }
.data-summary { display: grid; gap: 4px; margin-top: 8px; padding: 9px 10px; border: 1px solid #cbd4cc; border-radius: 11px; color: #26342f; background: #f5f7f3; }
.summary-line { min-height: 20px; display: flex; align-items: center; gap: 7px; }
.summary-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: #32915c; }
.summary-dot[data-state="unprepared"] { background: #87928a; }
.map-status { overflow: hidden; color: #26342f; font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.map-status[data-state="unprepared"] { color: #3d5147; }
.map-status[data-state="ready"] { color: #3d5147; }
.map-status[data-state="stale"] { color: #765000; }
.map-status[data-state="downloading"] { color: #15583d; }
.map-status[data-state="partial"] { color: #854400; }
.map-status[data-state="no-internet"] { color: #36443e; }
.map-status[data-state="error"] { color: #a51522; }
.summary-dot[data-state="ready"] { background: #76857b; }
.summary-dot[data-state="stale"] { background: #f0bb28; box-shadow: 0 0 0 2px #fff0b3; }
.summary-dot[data-state="downloading"] { background: #1d8e5a; animation: status-pulse 900ms ease-in-out infinite alternate; }
.summary-dot[data-state="partial"] { background: #e88422; }
.summary-dot[data-state="no-internet"] { background: #849087; }
.summary-dot[data-state="error"] { background: #d62737; }
@keyframes status-pulse { to { opacity: .4; } }
.feature-counts-label { color: #53635d; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.feature-counts { color: #3e5148; font-size: 11px; font-weight: 850; }
.data-date { color: #53635d; font-size: 11px; font-weight: 650; }
.offline-action { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 6px 11px; border: 2px solid #815900; border-radius: 11px; color: #17231e; background: #f4c45f; box-shadow: 0 2px 0 #b98725; text-align: left; cursor: pointer; }
.offline-action-icon { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 8px; background: rgb(255 255 255 / 48%); font-size: 24px; font-weight: 900; }
.offline-action-copy { min-width: 0; display: grid; gap: 2px; }
.offline-action-copy strong { font-size: 13px; font-weight: 900; line-height: 1.1; }
.offline-action-copy small { color: #3e3829; font-size: 10px; font-weight: 750; line-height: 1.15; }
.offline-action.is-up-to-date { border-color: #67756d; color: #26342f; background: #e2e6e1; box-shadow: none; }
.offline-action.is-up-to-date .offline-action-icon { color: #35463e; background: #cdd5ce; }
.offline-action[data-state="unprepared"] { border-color: #758179; color: #26342f; background: #eef1ed; box-shadow: none; }
.offline-action[data-state="unprepared"] .offline-action-icon { color: #35463e; background: #dce2dc; }
.offline-action[data-state="partial"] { border-color: #8d4800; color: #33200b; background: #ffc072; box-shadow: 0 2px 0 #b96b12; }
.offline-action[data-state="error"] { border-color: #78131c; color: #fff; background: #a51f2a; box-shadow: 0 2px 0 #66121a; }
.offline-action[data-state="no-internet"] { border-color: #758179; color: #39463e; background: #e3e7e2; box-shadow: none; }
.offline-action[data-state="downloading"] { border-color: #15583d; color: #fff; background: #17744b; box-shadow: 0 2px 0 #0e4e32; }
.offline-action[data-state="downloading"] .offline-action-copy small { color: #ecfff3; }
.offline-action:disabled { cursor: default; }
.download-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; min-height: 24px; margin-top: 5px; color: #24332d; font-size: 10px; font-weight: 800; }
.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: 78px; text-align: right; }
.settings-group { display: grid; margin-top: 6px; border-top: 1px solid #dce1dc; }
.setting-row { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 2px; border-bottom: 1px solid #e0e5e0; cursor: pointer; }
.setting-row span { min-width: 0; display: grid; gap: 2px; }
.setting-row strong { color: #17251f; font-size: 12px; font-weight: 850; line-height: 1.1; }
.setting-row small { color: #53635d; font-size: 10px; line-height: 1.2; }
.setting-row input { width: 22px; height: 22px; flex: 0 0 22px; accent-color: #0d6044; }
.compass-note { min-width: 0; margin: 5px 2px 2px; color: #53635d; font-size: 10px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.contact-footer-map { width: 100%; min-width: 0; margin-top: 7px; padding-top: 7px; border-top: 1px solid #dce1dc; }

.field-controls { position: relative; z-index: 1100; grid-row: 3; width: 100%; min-width: 0; display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; align-items: center; gap: 4px; padding: 1px 6px calc(1px + env(safe-area-inset-bottom)); border-top: 1px solid #aebbb1; background: #fbfbf7; box-shadow: 0 -3px 10px rgb(0 0 0 / 12%); }
.nav-action { min-width: 0; width: 100%; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 2px 4px; border: 1px solid transparent; border-radius: 9px; color: #27362f; background: transparent; font-size: 12px; font-weight: 850; line-height: 1.05; cursor: pointer; }
.nav-action svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-action.is-active { border-color: #284b3e; color: #fff; background: #174739; }
.nav-action.gps-off { border-color: #284b3e; color: #174739; background: #f4f7f4; }
.nav-action.gps-off svg { color: #174739; }
.nav-action[data-layer="axes"] svg { color: #c62534; }
.nav-action[data-layer="axes"].is-active svg { color: #ff737d; }
.nav-action.layer-toggle:not(.is-active) { opacity: .78; }
.nav-action.gps-following { border-color: #0a5d3d; color: #fff; background: #0b6744; }
.nav-action.gps-centered { border-color: #284b3e; color: #fff; background: #174739; }
.nav-action.gps-searching { border-color: #865900; color: #241900; background: #ffd44f; }
.nav-action.gps-low { border-color: #7b5200; color: #241900; background: #ffdf71; }
.nav-action.gps-alert { border-color: #761821; color: #fff; background: #a51f2a; }
.nav-action:disabled { cursor: default; opacity: .55; }

.leaflet-container { font-family: inherit; }
.leaflet-control-zoom { margin-top: 8px !important; margin-right: 8px !important; border: 2px solid #26362f !important; border-radius: 10px !important; overflow: hidden; box-shadow: 0 2px 9px rgb(0 0 0 / 28%) !important; }
.leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 38px !important; font-size: 22px !important; font-weight: 900 !important; color: #16221e !important; background: #fff !important; }
.leaflet-control-attribution { max-width: min(62vw, 220px); padding: 2px 5px !important; color: #1c2b25 !important; background: rgb(255 255 255 / 92%) !important; font-size: 9px !important; line-height: 1.2 !important; white-space: normal; overflow-wrap: anywhere; }
.axis-label { padding: 3px 6px !important; border: 1.5px solid #fff !important; border-radius: 6px !important; color: #b71828 !important; background: rgb(255 255 255 / 95%) !important; box-shadow: 0 1px 4px rgb(0 0 0 / 50%) !important; font-size: 12px !important; font-weight: 950 !important; line-height: 1.1 !important; text-shadow: 0 1px 0 #fff, 1px 0 0 #fff, 0 -1px 0 #fff, -1px 0 0 #fff !important; }
.axis-label.is-obscured { visibility: hidden !important; }
.axis-label:before { display: none !important; }
.gps-icon-wrap { border: 0 !important; background: transparent !important; }
.gps-arrow-shell { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border: 2px solid #fff; border-radius: 50%; background: #0879e8; box-shadow: 0 1px 8px rgb(0 0 0 / 70%); }
.gps-arrow { width: 0; height: 0; margin-top: -2px; border-right: 6px solid transparent; border-bottom: 15px solid #fff; border-left: 6px solid transparent; filter: drop-shadow(0 1px 1px #06427d); }
.gps-center { position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: #053a70; }
.toast { position: fixed; z-index: 2200; left: 12px; right: 12px; bottom: calc(60px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; padding: 12px 14px; border: 1px solid #fff; border-radius: 12px; color: #fff; background: #182722; box-shadow: var(--shadow); font-size: 13px; font-weight: 800; line-height: 1.35; }

@media (max-width: 370px) {
  .topbar { padding-left: 8px; }
  .topbar-copy { gap: 5px; }
  .topbar-copy strong { font-size: 15px; }
  .topbar-copy small { font-size: 9px; }
  .topbar-actions { gap: 3px; }
  .mode-badge { gap: 3px; padding-inline: 2px; font-size: 10px; }
  .whatsapp-button { padding: 11px 7px; font-size: 11px; }
  .more-sheet { left: 5px; right: 5px; padding-right: 11px; padding-left: 11px; }
}
@media (max-height: 700px) {
  .app-shell { grid-template-rows: calc(44px + env(safe-area-inset-top)) minmax(0,1fr) calc(48px + env(safe-area-inset-bottom)); }
  .topbar { padding-bottom: 0; }
  .topbar-brand, .topbar-actions { height: 44px; }
  .field-controls { padding-bottom: calc(1px + env(safe-area-inset-bottom)); }
  .more-sheet { max-height: min(76dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 110px)); }
  .login-card { padding: 22px; }
  .brand-lockup { margin-bottom: 18px; }
  .nav-action { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
