@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&display=swap");

:root {
  --paper: #f5f0e6;
  --paper-strong: #fcfaf4;
  --ink: #173e4d;
  --muted: #6f7f7c;
  --accent: #c98b2e;
  --winter: #4f7891;
  --success: #3d8b63;
  --warning: #a65332;
  --line: rgba(23, 62, 77, 0.16);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; background: var(--paper); color: var(--ink); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; }
html { -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; }
body, input, button, select, textarea { -webkit-tap-highlight-color: transparent; }

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0) 36%),
    repeating-linear-gradient(0deg, rgba(23, 62, 77, 0.025), rgba(23, 62, 77, 0.025) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(90deg, rgba(23, 62, 77, 0.018), rgba(23, 62, 77, 0.018) 1px, transparent 1px, transparent 28px),
    radial-gradient(circle at 74% 20%, rgba(208, 183, 117, 0.12), transparent 32rem),
    var(--paper);
}

.mobile-quick-actions {
  display: none;
}

.topbar, .app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: rgba(23, 62, 77, 0.14);
}

.topbar {
  min-height: 76px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(23, 62, 77, 0.18);
  background: rgba(245, 240, 230, 0.88);
  backdrop-filter: blur(14px);
}

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.eyebrow, .kicker, .metric-label, .readout-label {
  font: 500 10px "IBM Plex Mono", monospace;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}
.eyebrow { color: #79827d; font-size: 9px; margin-bottom: 2px; }
.brand-name { font: 600 24px "Cormorant Garamond", Garamond, serif; letter-spacing: -0.02em; }
.topbar-meta { color: #697978; font: 11px "IBM Plex Mono", monospace; display: flex; align-items: center; gap: 9px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(61, 139, 99, 0.14); }

.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: calc(100vh - 113px); }
.control-rail { padding: 34px 28px 28px 42px; border-right: 1px solid var(--line); background: rgba(245, 240, 230, 0.75); }
.rail-intro { padding-bottom: 10px; }
.rail-guide {
  padding: 12px 13px;
  border: 1px solid rgba(201, 139, 46, 0.24);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(201, 139, 46, 0.12), rgba(255, 253, 247, 0.82));
  box-shadow: 0 8px 18px rgba(23, 62, 77, 0.04);
}
.rail-guide strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font: 600 11px "IBM Plex Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.rail-guide p {
  margin: 0;
  color: #5f726f;
  font-size: 12px;
  line-height: 1.45;
}
.kicker { color: var(--accent); margin: 0 0 11px; }

.location-panel, .control-section { padding: 18px 0; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 17px; font-size: 13px; font-weight: 600; }
.section-intro {
  margin: -8px 0 14px;
  color: #6d7d7a;
  font-size: 12px;
  line-height: 1.45;
}
.badge {
  margin-left: auto; padding: 2px 7px; border: 1px solid rgba(23, 62, 77, 0.2);
  border-radius: 999px; color: #687776; font: 9px "IBM Plex Mono", monospace;
}
.sage-badge { background: #dce9dc; border-color: #9cbea6; color: #286047; }

.location-select, .control-field { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #53686b; font-size: 12px; }
.location-select select, .field-value input, .coordinate-fields input {
  border: 1px solid #b7c4bc;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.96);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.location-select select { min-width: 132px; padding: 9px 10px; }
.coordinate-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.coordinate-fields label { color: #84908a; font: 9px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.coordinate-fields input { width: 100%; margin-top: 5px; padding: 9px 10px; }
.place-search { margin-top: 12px; }
.place-search label { display: block; color: #84908a; font: 9px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px; }
.place-search-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.place-search-row input {
  width: 100%; padding: 9px 10px; border: 1px solid #b7c4bc; border-radius: 8px;
  background: rgba(255, 253, 247, 0.96); color: var(--ink);
}
.place-search-row .button { white-space: nowrap; }

.control-field {
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(23, 62, 77, 0.08);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.52);
}
.field-value { display: flex; align-items: baseline; gap: 5px; }
.field-value input {
  width: 84px; padding: 8px 10px; text-align: right;
  font: 600 13px "IBM Plex Mono", monospace;
}
.location-select select:focus,
.field-value input:focus,
.coordinate-fields input:focus,
.place-search-row input:focus {
  outline: none;
  border-color: rgba(201, 139, 46, 0.9);
  box-shadow: 0 0 0 3px rgba(201, 139, 46, 0.16);
}
.field-value input::placeholder,
.coordinate-fields input::placeholder,
.place-search-row input::placeholder {
  color: #98a39f;
}
.field-value small, .range-field output small { color: #84908a; font: 10px "IBM Plex Mono", monospace; }

.range-field { display: block; padding-top: 14px; color: #53686b; font-size: 12px; }
.range-field output { float: right; color: var(--ink); font: 600 12px "IBM Plex Mono", monospace; }
.range-field input[type="range"] { width: 100%; margin-top: 14px; accent-color: var(--accent); }
.orientation-scale, .time-scale { display: flex; justify-content: space-between; margin-top: 8px; color: #87908b; font: 9px "IBM Plex Mono", monospace; }

.season-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #e4e5dc; padding: 3px; border-radius: 5px; }
.season-switch button {
  border: 0; padding: 7px; border-radius: 3px; background: transparent; color: #71807c;
}
.season-switch button.active { background: #fdfaf2; color: var(--ink); box-shadow: 0 2px 7px rgba(23, 62, 77, 0.08); font-weight: 600; }

.calculated-distance {
  margin-top: 12px; padding: 10px 12px; border: 1px solid #b5c9ba; border-left: 3px solid var(--success);
  background: rgba(235, 245, 235, 0.72); display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center;
}
.calculated-distance.secondary { border-left-color: var(--accent); background: rgba(251, 245, 225, 0.72); }
.calculated-distance span, .calculated-distance small { color: #39634b; font: 9px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.calculated-distance.secondary span, .calculated-distance.secondary small { color: #7f6a32; }
.calculated-distance strong { color: #286047; font: 600 18px "IBM Plex Mono", monospace; }
.calculated-distance.secondary strong { color: #8a6419; }
.calculated-distance small { grid-column: 1 / -1; color: #779183; text-transform: none; letter-spacing: 0; }

.micro-note { margin: 14px 0 0; color: #74837f; font-size: 11px; line-height: 1.5; }
.micro-note[data-tone="ok"] { color: #2f7752; }
.micro-note[data-tone="warn"] { color: #a65332; }

.button {
  border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  transition: transform 160ms cubic-bezier(.23, 1, .32, 1), background-color 180ms, border-color 180ms;
}
.button:active { transform: scale(0.98); }
.button-primary { height: 40px; padding: 0 14px; background: var(--accent); color: #fffaf0; font-weight: 600; }
.button-outline { height: 40px; padding: 0 14px; border-color: #c4cec8; background: rgba(255, 253, 247, 0.45); color: #53686b; }
.button-ghost { height: 40px; padding: 0 12px; border-color: #d8e0db; background: rgba(255, 253, 247, 0.45); color: #75817d; }
.button-ghost.is-on { color: var(--accent); background: #ede3c9; }
.button-outline.is-active,
.button-primary.is-active {
  border-color: rgba(23, 62, 77, 0.22);
  background: #173e4d;
  color: #fffaf0;
}
.button.is-hidden { display: none; }

.rail-actions { display: flex; gap: 8px; padding-top: 8px; }
.rail-actions-compact { padding-top: 10px; }
.rail-actions-install { padding-top: 14px; }
.rail-actions .button { flex: 1 1 auto; min-height: 42px; }
.install-hint {
  margin-top: 10px; color: #5e6f6a; font-size: 12px; line-height: 1.5;
  padding: 12px 13px; border: 1px solid rgba(23, 62, 77, 0.12); border-radius: 10px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: 0 8px 20px rgba(23, 62, 77, 0.04);
}
.install-hint strong {
  display: block; margin-bottom: 4px; color: #173e4d;
  font: 600 11px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.07em;
}
.install-hint span { display: block; }
.install-hint b { color: #8a6419; }
.location-panel, .control-section, .map-card, .insight-strip {
  scroll-margin-top: 14px;
}
.assumption-note {
  margin-top: 26px; padding: 11px 0 10px 13px; border-left: 2px solid var(--accent);
  display: grid; gap: 4px; color: #75817d; font-size: 10px; line-height: 1.35;
}
.assumption-note strong { color: var(--ink); font: 600 10px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.08em; }

.canvas-zone { padding: 34px 42px 40px; min-width: 0; }
.canvas-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.canvas-head h2 { margin: 0; color: var(--ink); font: 600 48px "Cormorant Garamond", Garamond, serif; }
.scale-chip { color: #75817d; font: 10px "IBM Plex Mono", monospace; }

.map-card, .sun-arc-card {
  overflow: hidden; border: 1px solid #c5cec7; border-radius: 6px; background: rgba(255, 253, 247, 0.78);
  box-shadow: 0 14px 44px rgba(23, 62, 77, 0.08);
}
.map-toolbar, .map-caption {
  min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
}
.map-toolbar { border-bottom: 1px solid #d7ddd5; }
.toolbar-legend { display: flex; gap: 16px; color: #667775; font-size: 12px; }
.toolbar-legend span { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-swatch { width: 12px; height: 7px; display: inline-block; border-radius: 1px; }
.legend-swatch.building { background: var(--ink); }
.legend-swatch.shadow { background: #d9aa55; }
.legend-swatch.tracker { background: var(--success); }
.map-readout { display: flex; align-items: baseline; gap: 8px; font-family: "IBM Plex Mono", monospace; }
.readout-label { color: #87908b; font-size: 10px; }
.map-readout strong { color: var(--ink); font-size: 15px; }
.readout-sep { color: #bfcbc4; margin: 0 3px; }

.map-wrap { position: relative; padding: 12px 13px 8px; background: #fcfaf4; }
.site-map-underlay {
  position: absolute; inset: 12px 13px 8px 13px; z-index: 0;
  border: 1px solid rgba(23, 62, 77, 0.18); border-radius: 0; overflow: hidden;
  background: #e9e2d3;
  cursor: default;
}
.site-map-underlay .leaflet-tile-pane { opacity: 1.0; }
.site-map-underlay .leaflet-control-container { opacity: 0.92; }
.site-map-underlay .leaflet-overlay-pane svg { filter: drop-shadow(0 0 1px rgba(23, 62, 77, 0.14)); }
.site-map-underlay,
.site-map-underlay .leaflet-container,
.site-map-underlay .leaflet-pane,
.site-map-underlay .leaflet-interactive,
.site-map-underlay .leaflet-grab,
.site-map-underlay .leaflet-dragging,
.site-map-underlay .leaflet-crosshair {
  cursor: default !important;
}
.site-map-underlay path.map-building-footprint {
  vector-effect: non-scaling-stroke;
  cursor: default !important;
}
.svg-handle {
  pointer-events: all;
  transition: r 0.1s ease, fill 0.1s ease, stroke-width 0.1s;
}
.svg-handle:hover {
  r: 1.2;
  fill: #fff !important;
  stroke-width: 0.25 !important;
}

.shadow-map {
  width: 100%;
  height: auto;
  min-height: 350px;
  max-height: 85vh;
  display: block;
  position: relative; z-index: 2;
  border: 1px solid rgba(23, 62, 77, 0.18); background: rgba(248, 245, 237, 0.28);
  pointer-events: none;
}
.shadow-map.loading-map {
  cursor: wait;
}
.shadow-map.loading-map * {
  cursor: wait !important;
}
.map-center-pin {
  position: absolute; left: 50%; top: 50%; z-index: 2;
  width: 0; height: 0; transform: translate(-50%, -50%);
  pointer-events: none;
}
.map-center-ring {
  position: absolute; left: 50%; top: 50%;
  border-radius: 50%; transform: translate(-50%, -50%);
}
.map-center-ring.ring-outer {
  width: 30px; height: 30px;
  border: 1px solid rgba(23, 62, 77, 0.34);
  background: rgba(255, 253, 247, 0.18);
  backdrop-filter: blur(1px);
}
.map-center-ring.ring-inner {
  width: 18px; height: 18px;
  border: 1px solid rgba(61, 139, 99, 0.55);
  background: rgba(255, 253, 247, 0.1);
}
.map-center-dot {
  position: absolute; left: 50%; top: 50%;
  width: 8px; height: 8px; transform: translate(-50%, -50%);
  border-radius: 50%; background: rgba(61, 139, 99, 0.94);
  border: 1.5px solid rgba(248, 244, 234, 0.98);
  box-shadow: 0 0 0 1px rgba(23, 62, 77, 0.16);
}
.map-center-cross {
  position: absolute; left: 50%; top: 50%;
  background: rgba(23, 62, 77, 0.38); transform: translate(-50%, -50%);
}
.map-center-cross.cross-h { width: 38px; height: 1px; }
.map-center-cross.cross-v { width: 1px; height: 38px; }
.map-label { font-family: "IBM Plex Mono", monospace; fill: #5f7479; font-size: 0.8px; letter-spacing: 0.03em; font-weight: 600; }
.map-overlay-top {
  position: absolute; top: 24px; right: 28px; z-index: 3;
  display: flex; align-items: center; gap: 8px;
}
.map-layer-chip {
  padding: 4px 8px; border: 1px solid rgba(23, 62, 77, 0.18); border-radius: 999px;
  color: #5f7479; background: rgba(255, 253, 247, 0.82); font: 10px "IBM Plex Mono", monospace;
}
.map-scale { position: absolute; bottom: 17px; left: 27px; z-index: 3; display: flex; align-items: center; gap: 4px; color: #84908a; font: 9px "IBM Plex Mono", monospace; }
.map-scale i { width: 35px; height: 1px; background: #748580; display: block; }
.map-scale i.long { width: 35px; }

.map-coords-badge {
  padding: 4px 8px; border: 1px solid rgba(23, 62, 77, 0.18); border-radius: 999px;
  color: #5f7479; background: rgba(255, 253, 247, 0.72); font: 10px "IBM Plex Mono", monospace;
}
.layer-toggle-btn {
  padding: 4px 8px; border: 1px solid rgba(23, 62, 77, 0.18); border-radius: 999px; cursor: pointer;
  color: #173e4d; background: rgba(255, 253, 247, 0.95); font: 10px "IBM Plex Sans", sans-serif; font-weight: 500;
  transition: all 0.2s;
}
.layer-toggle-btn:hover { background: #fff; transform: scale(1.02); }
.site-map-note {
  position: absolute; left: 27px; top: 24px; z-index: 3; margin: 0;
  color: #74817c; background: rgba(255, 253, 247, 0.82); padding: 4px 8px;
  border-radius: 999px; border: 1px solid rgba(23, 62, 77, 0.12); font: 10px "IBM Plex Mono", monospace;
}
.map-orientation-control {
  position: absolute; left: 27px; top: 54px; z-index: 3;
  background: rgba(255, 253, 247, 0.9); padding: 8px 12px;
  border-radius: 8px; border: 1px solid rgba(23, 62, 77, 0.12);
  display: flex; flex-direction: column; gap: 4px;
  width: min(520px, calc(100% - 54px));
}
.map-orientation-control output {
  font: 11px "IBM Plex Sans", sans-serif; color: #173e4d; font-weight: 500; display: flex; justify-content: space-between;
}
.map-orientation-control input[type="range"] {
  width: 160px; margin: 4px 0;
}
.map-orientation-control .orientation-scale {
  display: flex; justify-content: space-between; font: 9px "IBM Plex Mono", monospace; color: #74817c; margin-top: -2px;
}
.map-solar-inline {
  display: grid;
  grid-template-columns: 160px auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.map-season-switch {
  min-width: 0;
}
.map-season-switch button {
  min-height: 38px;
}
.map-play-button {
  min-height: 38px;
  white-space: nowrap;
}
.map-progress-inline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.map-progress-inline span {
  color: #74817c;
  font: 9px "IBM Plex Mono", monospace;
  text-transform: uppercase;
}
.map-progress-inline input[type="range"] {
  width: 100%;
  margin: 0;
}

.map-caption { border-top: 1px solid #d7ddd5; color: #74817c; font: 12px "IBM Plex Mono", monospace; }
.ok-caption { color: var(--success); }
.warning-caption { color: var(--warning); }

.animation-bar {
  display: grid; grid-template-columns: auto minmax(220px, 1fr); gap: 16px; align-items: center;
  padding: 12px 16px; border-top: 1px solid #d7ddd5; background: rgba(245, 240, 230, 0.72);
}
.animation-time { display: grid; gap: 2px; min-width: 86px; }
.animation-time strong { color: var(--ink); font: 600 17px "IBM Plex Mono", monospace; }
.animation-time span, .recommendation-readout span { color: #87908b; font: 8px "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: 0.06em; }
.recommendation-readout {
  display: grid;
  gap: 3px;
}
.recommendation-readout strong { color: #286047; font: 600 10px "IBM Plex Mono", monospace; }

.metrics-row {
  display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 15px;
  border-top: 1px solid #bfcac2; border-bottom: 1px solid #bfcac2; background: rgba(255, 253, 247, 0.48);
}
.metric-card {
  position: relative; padding: 15px 18px 14px; border-right: 1px solid #d2dad3;
}
.metric-card:last-child { border-right: 0; }
.metric-card::before { content: "—"; position: absolute; top: 11px; right: 15px; color: var(--accent); font: 12px "IBM Plex Mono", monospace; }
.metric-label { display: block; color: #84908b; font-size: 9px; margin-bottom: 7px; }
.metric-card strong { display: block; color: var(--ink); font: 26px "IBM Plex Mono", monospace; }
.metric-card strong small { color: #7b8985; font-size: 13px; }
.metric-context { display: block; color: #7f8c87; font-size: 10px; margin-top: 4px; }
.metric-card.good { background: rgba(242, 248, 241, 0.62); }
.metric-card.alert { background: rgba(251, 240, 233, 0.6); }
.metric-card.alert strong { color: var(--warning); font-size: 21px; }
.metric-card.good strong { color: #2f7752; font-size: 21px; }

.insight-strip {
  position: relative; display: flex; align-items: center; gap: 13px; margin-top: 14px;
  padding: 14px 16px; border: 1px solid #dccaa2; border-left: 3px solid var(--accent);
  background: rgba(251, 245, 225, 0.72); border-radius: 2px;
}
.insight-strip::before {
  content: "NOTA DE CAMPO / LEITURA SOLAR";
  position: absolute; top: -8px; left: 11px; padding: 0 6px; background: var(--paper);
  color: #a6752a; font: 8px "IBM Plex Mono", monospace; letter-spacing: 0.1em;
}
.insight-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #ead8a9; color: #a56c17; flex: 0 0 auto; }
.insight-strip strong { display: block; color: #58491e; font-size: 12px; }
.insight-strip p { margin: 4px 0 0; color: #8a7950; font-size: 10px; }
.insight-strip .button { margin-left: auto; }

.app-footer {
  min-height: 37px; padding: 0 42px; border-top: 1px solid rgba(23, 62, 77, 0.14);
  color: #84908a; font: 9px "IBM Plex Mono", monospace;
}

@media (max-width: 1050px) {
  .workspace { grid-template-columns: 290px minmax(0, 1fr); }
  .control-rail { padding-left: 24px; padding-right: 20px; }
  .canvas-zone { padding-left: 25px; padding-right: 25px; }
  .map-solar-inline { grid-template-columns: 1fr; }
  .map-play-button { width: 100%; }
  .animation-bar { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 760px) {
  html, body {
    min-height: 100dvh;
  }
  body {
    overflow: hidden;
  }
  .app-shell {
    min-height: 100dvh;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: calc(86px + env(safe-area-inset-bottom, 0));
    display: flex;
    flex-direction: column;
  }
  .mobile-quick-actions {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0));
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid rgba(23, 62, 77, 0.12);
    border-radius: 16px;
    background: rgba(255, 253, 247, 0.92);
    box-shadow: 0 12px 34px rgba(23, 62, 77, 0.14);
    backdrop-filter: blur(14px);
  }
  .mobile-quick-actions #quickInstallButton {
    grid-column: 1 / -1;
  }
  .mobile-quick-actions .button {
    min-height: 48px;
    width: 100%;
    border-radius: 12px;
    padding: 0 8px;
    font-size: 13px;
    font-weight: 600;
  }
  .workspace {
    display: flex;
    flex-direction: column-reverse;
    flex: 1;
    overflow: hidden;
  }
  .topbar { padding: 0 18px; flex: 0 0 auto; }
  .topbar-meta { display: none; }
  
  /* Ocultar textos para poupar espaço */
  .rail-intro, .assumption-note, .canvas-head, .site-map-note, .app-footer, .map-caption { display: none !important; }
  
  .canvas-zone {
    padding: 8px 8px 0;
    flex: 0 0 58dvh;
    min-height: 52dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .map-card {
    flex: 1;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    border-radius: 14px;
    overflow: hidden;
  }
  .map-wrap {
    flex: 1;
    border: none;
    border-radius: 0;
    padding: 0;
    min-height: 0;
  }
  .shadow-map {
    min-height: 0;
    height: 100% !important;
    max-height: none;
  }
  .site-map-underlay { inset: 0; }
  .map-toolbar { display: none; } /* Ocultar barra superior do mapa em mobile */
  
  .control-rail {
    padding: 12px 14px 18px;
    flex: 1 1 auto;
    overflow-y: auto;
    border-right: 0;
    border-top: 1px solid var(--line);
    scroll-padding-bottom: 120px;
    -webkit-overflow-scrolling: touch;
  }
  .control-rail::after {
    content: "";
    display: block;
    height: 96px;
  }
  
  .map-overlay-top { top: 10px; right: 10px; flex-direction: column; align-items: end; }
  .map-orientation-control {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 12px;
    width: auto;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 253, 247, 0.94);
    box-shadow: 0 10px 26px rgba(23, 62, 77, 0.14);
  }
  .map-orientation-control output {
    font-size: 12px;
    gap: 10px;
  }
  .map-orientation-control input[type="range"] {
    width: 100%;
    margin: 6px 0 2px;
  }
  .map-scale { bottom: 10px; left: 10px; }
  
  .map-solar-inline {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .map-season-switch {
    order: 1;
  }
  .map-play-button {
    order: 2;
    width: 100%;
  }
  .map-progress-inline {
    grid-template-columns: 1fr;
    gap: 4px;
    order: 3;
  }
  .map-progress-inline span {
    display: none;
  }
  .animation-bar {
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    border-radius: 0;
    border-top: 1px solid #d7ddd5;
    background: rgba(252, 248, 240, 0.96);
  }
  .animation-bar > * { margin: 0; min-width: 0; }
  .animation-time {
    align-content: center;
  }
  .recommendation-readout {
    padding-top: 8px;
  }
  
  .metrics-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 8px;
    gap: 6px;
    border-top: 1px solid #d7ddd5;
  }
  .metric-card {
    padding: 10px 8px;
    text-align: center;
    border-right: 0;
    border-radius: 10px;
    background: rgba(255, 253, 247, 0.72);
  }
  .metric-label { font-size: 8px; margin-bottom: 2px; }
  .metric-card strong { font-size: 16px; }
  .metric-context { display: none; }
  
  .insight-strip { display: none; } /* Ocultar banner de insight para poupar espaço */
  
  .location-panel,
  .control-section {
    padding: 14px 0;
  }
  .section-heading {
    margin-bottom: 10px;
    font-size: 14px;
  }
  .section-intro {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.35;
  }
  .place-search-row, .coordinate-fields { grid-template-columns: 1fr 1fr; gap: 8px; }
  .control-section { margin-bottom: 20px; }
  .location-select,
  .control-field {
    gap: 8px;
  }
  .location-select select,
  .field-value input,
  .coordinate-fields input {
    min-height: 46px;
    font-size: 16px;
  }
  .field-value {
    width: 100%;
    justify-content: flex-end;
  }
  .field-value input {
    width: 110px;
  }
  .range-field input[type="range"] {
    min-height: 34px;
  }
  
  .rail-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .rail-actions .button {
    flex: 1;
    min-height: 46px;
  }
  .install-hint { font-size: 11px; }
}

@media (max-width: 520px) {
  .topbar { min-height: 68px; padding: 10px 14px; }
  .brand-name { font-size: 18px; }
  .canvas-zone {
    flex-basis: 55dvh;
    min-height: 50dvh;
  }
  .map-wrap { padding: 0; }
  .site-map-underlay { inset: 0; }
  .map-overlay-top { top: 6px; right: 6px; gap: 4px; }
  .map-scale { bottom: 6px; left: 6px; }
  .site-map-note { top: 12px; left: 14px; right: 14px; max-width: none; font-size: 9px; }
  .map-orientation-control {
    left: 8px;
    right: 8px;
    bottom: 8px;
    padding: 9px 10px;
  }
  .map-layer-chip { display: none; }
  .map-coords-badge { font-size: 9px; }
  .map-caption { font-size: 10px; }
  .map-season-switch button,
  .map-play-button { min-height: 40px; }
  .animation-bar { padding: 10px 12px; gap: 10px; grid-template-columns: 1fr; }
  .animation-time strong { font-size: 16px; }
  .recommendation-readout { padding-top: 10px; }
  .metric-card { padding: 13px 14px 12px; }
  .metric-card strong { font-size: 22px; }
  .app-footer { padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0)); }
  .install-hint { padding: 11px 12px; border-radius: 9px; }
  .micro-note { font-size: 10px; }
  .mobile-quick-actions {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0));
    padding: 8px;
    gap: 6px;
  }
  .mobile-quick-actions .button {
    min-height: 44px;
    padding: 0 6px;
    font-size: 12px;
  }
  .coordinate-fields,
  .place-search-row {
    grid-template-columns: 1fr;
  }
  .location-select,
  .control-field {
    align-items: flex-start;
    flex-direction: column;
  }
  .location-select select,
  .field-value input {
    width: 100%;
  }
  .field-value {
    justify-content: stretch;
  }
  .layer-toggle-btn,
  .map-coords-badge {
    padding: 6px 9px;
  }
}
