/* Kambana OS - Maps */
.app-maps .maps-root { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #aad3df; }
.app-maps .maps-map { position: absolute; inset: 0; z-index: 0; background: var(--surface-2); font: inherit; }
.app-maps .maps-map.leaflet-container { font-family: var(--font); }
.app-maps.measuring .maps-map, .app-maps .measuring .maps-map { cursor: crosshair; }
.app-maps .measuring .maps-banner.show { bottom: 92px; }
.app-maps .maps-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
.app-maps .maps-dark .maps-map { background: #1d2230; }

.app-maps .maps-loading { position: absolute; inset: 0; z-index: 900; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: var(--surface); color: var(--text-2); font-size: 13px; }

/* floating panel */
.app-maps .maps-panel {
  position: absolute; left: 12px; top: 12px; z-index: 800; width: 360px; max-height: calc(100% - 24px);
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: var(--surface); color: var(--text); box-shadow: 0 12px 34px -12px rgba(0, 0, 0, .45), 0 0 0 1px var(--line);
}
.app-maps .maps-searchrow { display: flex; align-items: center; gap: 2px; height: 50px; flex: 0 0 auto; padding: 0 6px 0 14px; }
.app-maps .maps-search-ic { color: var(--text-3); display: grid; }
.app-maps .maps-search-input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--text); font-size: 14.5px; padding: 0 8px; height: 100%; }
.app-maps .maps-search-input::placeholder { color: var(--text-3); }
.app-maps .maps-search-input::-webkit-search-cancel-button { display: none; }
.app-maps .maps-dirbtn { color: var(--accent); }
.app-maps .maps-minbtn { display: none; }
.app-maps .maps-panel.dir-mode .maps-searchrow { display: none; }
.app-maps [hidden] { display: none !important; }
.app-maps .maps-pbody { flex: 1 1 auto; min-height: 0; overflow-y: auto; border-top: 1px solid var(--line); padding: 6px 6px 8px; }
.app-maps .maps-pbody:empty { display: none; }
.app-maps .maps-panel.dir-mode .maps-pbody { border-top: 0; }
.app-maps .maps-panel.min .maps-pbody { display: none; }

.app-maps .maps-quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 6px 4px; }
.app-maps .maps-sec { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 4px; font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.app-maps .maps-sec-act { font-size: 12px; }
.app-maps .maps-row { width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border: 0; background: none; border-radius: 11px; text-align: left; color: var(--text); }
.app-maps .maps-row:hover, .app-maps .maps-row:focus-visible { background: var(--hover); outline: none; }
.app-maps .maps-row-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--tile); color: var(--text-2); }
.app-maps .maps-row.sm { padding: 6px 8px; }
.app-maps .maps-row.sm .maps-row-ic { width: 28px; height: 28px; }
.app-maps .maps-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-maps .maps-row-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-maps .maps-row-text small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-maps .maps-row-meta { font-size: 11.5px; color: var(--text-3); flex: 0 0 auto; }
.app-maps .maps-row-star { color: #f5b301; display: grid; }
.app-maps .maps-hint { display: flex; gap: 9px; align-items: flex-start; margin: 8px 6px 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.app-maps .maps-hint .ic { margin-top: 1px; color: var(--accent); }
.app-maps .maps-hint.sm { font-size: 11.5px; padding: 8px 10px; }
.app-maps .maps-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; text-align: center; color: var(--text-2); font-size: 12.5px; }
.app-maps .maps-state b { color: var(--text); font-size: 14px; }
.app-maps .maps-state .ic { color: var(--text-3); }
.app-maps .maps-state.err .ic { color: #e5484d; }
.app-maps .maps-state.sm { padding: 8px; }
.app-maps .maps-state .btn { margin-top: 6px; }
.app-maps .maps-credit { padding: 10px 10px 4px; font-size: 11px; color: var(--text-3); line-height: 1.4; }
.app-maps .maps-credit a { color: inherit; }
.app-maps .maps-back { display: flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 8px 8px 6px; border-radius: 8px; }
.app-maps .maps-back:hover { color: var(--text); }

/* place card */
.app-maps .maps-place { padding: 8px 8px 6px; }
.app-maps .maps-place-head { display: flex; align-items: flex-start; gap: 12px; }
.app-maps .maps-place-ic { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; background: linear-gradient(150deg, #4ade80, #0f766e); }
.app-maps .maps-place-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.app-maps .maps-place-title h2 { margin: 1px 0 0; font-size: 18px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.app-maps .maps-place-addr { margin: 10px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.app-maps .maps-place-actions { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.app-maps .maps-place-actions .btn { flex: 1 1 auto; }
.app-maps .maps-place-actions .btn .ic { display: inline; }
.app-maps .maps-place-actions .maps-saved { color: #d99a00; }
.app-maps .maps-place-actions .maps-saved .ic { fill: #f5b301; stroke: #d99a00; }
.app-maps .maps-place-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 12px; }
.app-maps .maps-coord { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--tile); color: var(--text-2); font-family: var(--mono); font-size: 11.5px; padding: 5px 9px; border-radius: 8px; }
.app-maps .maps-coord:hover { background: var(--tile-hover); color: var(--text); }

/* directions */
.app-maps .maps-dir-head { display: flex; align-items: center; gap: 8px; padding: 4px 2px 8px; }
.app-maps .maps-modes { flex: 1; display: flex; }
.app-maps .maps-modes button { flex: 1; justify-content: center; }
.app-maps .maps-dir-fields { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0 44px 6px 6px; }
.app-maps .maps-dir-field { display: flex; align-items: center; gap: 10px; }
.app-maps .maps-dir-field .input { flex: 1; min-width: 0; height: 36px; }
.app-maps .maps-dir-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; border: 3px solid var(--text-2); }
.app-maps .maps-dir-dot.to { border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border-color: #e5484d; background: #e5484d; }
.app-maps .maps-dir-field:first-child::after { content: ''; position: absolute; left: 11px; top: 30px; height: 18px; border-left: 2px dotted var(--text-3); }
.app-maps .maps-swap { position: absolute; right: 4px; top: 22px; }
.app-maps .maps-sum { display: flex; align-items: center; gap: 12px; margin: 6px 4px 4px; padding: 12px; border-radius: 14px; background: rgba(var(--accent-rgb), .12); }
.app-maps .maps-sum > div { flex: 1; display: flex; flex-direction: column; }
.app-maps .maps-sum b { font-size: 18px; font-family: var(--font-display); font-weight: 600; }
.app-maps .maps-sum small { font-size: 12px; color: var(--text-2); }
.app-maps .maps-sum-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); }
.app-maps .maps-steps { list-style: none; margin: 6px 0 0; padding: 0; }
.app-maps .maps-step { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 0; background: none; border-radius: 10px; text-align: left; color: var(--text); font-size: 13px; }
.app-maps .maps-step:hover { background: var(--hover); }
.app-maps .maps-step-ic { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; background: var(--tile); color: var(--text-2); }
.app-maps .maps-step-text { flex: 1; min-width: 0; line-height: 1.35; }
.app-maps .maps-step small { font-size: 11.5px; color: var(--text-3); flex: 0 0 auto; }

/* right-side buttons */
.app-maps .maps-fabs { position: absolute; right: 12px; bottom: 34px; z-index: 800; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.app-maps .maps-fabgroup { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .4), 0 0 0 1px var(--line); }
.app-maps .maps-fab { width: 42px; height: 42px; border: 0; display: grid; place-items: center; background: var(--surface); color: var(--text); border-radius: 14px; box-shadow: 0 6px 18px -6px rgba(0, 0, 0, .4), 0 0 0 1px var(--line); transition: background .12s, color .12s; }
.app-maps .maps-fab:hover { background: var(--surface-2); }
.app-maps .maps-fabgroup .maps-fab { border-radius: 0; box-shadow: none; }
.app-maps .maps-fabgroup .maps-fab + .maps-fab { border-top: 1px solid var(--line); }
.app-maps .maps-fab.on { color: var(--accent); }
.app-maps .maps-fab.busy .ic { animation: spin 1s linear infinite; }

/* measure bar + banner */
.app-maps .maps-measurebar { position: absolute; left: 50%; bottom: 26px; z-index: 850; transform: translate(-50%, 170%); display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 16px; background: var(--surface); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45), 0 0 0 1px var(--line); transition: transform .25s var(--ease), visibility .25s; max-width: calc(100% - 24px); visibility: hidden; }
.app-maps .maps-measurebar.show { transform: translate(-50%, 0); visibility: visible; }
.app-maps .maps-mb-ic { color: var(--accent); display: grid; }
.app-maps .maps-mb-text { display: flex; flex-direction: column; min-width: 0; margin-right: 6px; }
.app-maps .maps-mb-text b { font-size: 14px; white-space: nowrap; }
.app-maps .maps-mb-text small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-maps .maps-banner { position: absolute; left: 50%; bottom: 30px; z-index: 850; transform: translate(-50%, 160%); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-radius: 14px; background: #1f2533; color: #fff; font-size: 12.5px; max-width: min(520px, calc(100% - 140px)); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .5); transition: transform .25s var(--ease), opacity .2s, visibility .25s; opacity: 0; visibility: hidden; }
.app-maps .maps-banner.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.app-maps .maps-banner .icon-btn { color: #fff; width: 28px; height: 28px; }
.app-maps .maps-banner .icon-btn:hover { background: rgba(255, 255, 255, .12); }

/* map markers + vectors */
.app-maps .maps-pin-wrap, .app-maps .maps-dot-wrap, .app-maps .maps-star-wrap, .app-maps .maps-here-wrap, .app-maps .maps-end-wrap { background: none; border: 0; }
.app-maps .maps-pin { position: relative; width: 34px; height: 34px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg); background: #e5484d; box-shadow: 0 4px 10px rgba(0, 0, 0, .35), inset 0 0 0 2px rgba(255, 255, 255, .9); display: grid; place-items: center; animation: maps-drop .35s var(--ease); }
.app-maps .maps-pin span { transform: rotate(45deg); color: #fff; display: grid; }
.app-maps .maps-pin.dest { background: #e5484d; }
.app-maps .maps-dot { width: 16px; height: 16px; border-radius: 50%; background: #e5484d; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.app-maps .maps-star { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #f5b301; color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.app-maps .maps-star .ic { fill: #fff; }
.app-maps .maps-here { width: 22px; height: 22px; border-radius: 50%; background: #3b82f6; border: 4px solid #fff; box-shadow: 0 0 0 0 rgba(59, 130, 246, .6), 0 2px 6px rgba(0, 0, 0, .35); animation: maps-pulse 2s infinite; }
.app-maps .maps-acc { fill: #3b82f6; fill-opacity: .12; stroke: #3b82f6; stroke-opacity: .5; }
.app-maps .maps-end { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid #1f2937; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.app-maps .maps-route-casing { stroke: #fff; stroke-opacity: .95; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-maps .maps-route-line { stroke: #2b7de9; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.app-maps .maps-route-bike { stroke: #16a34a; }
.app-maps .maps-route-foot { stroke: #7c3aed; stroke-dasharray: 1 10; stroke-width: 7; }
.app-maps .maps-measure-line { stroke: #111827; fill: none; }
.app-maps .maps-measure-pt { stroke: #111827; fill: #fff; }
.app-maps .maps-dark .maps-measure-line { stroke: #fbbf24; }
.app-maps .maps-measure-tip { font-family: var(--font); font-weight: 700; font-size: 12px; border-radius: 8px; padding: 3px 8px; }

/* Leaflet controls in Kambana OS colours */
.app-maps .leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--text); font-size: 10.5px; border-radius: 8px 0 0 0; padding: 1px 6px; }
.app-maps .leaflet-control-attribution a { color: var(--text); }
.app-maps .leaflet-control-scale-line { background: color-mix(in srgb, var(--surface) 75%, transparent); color: var(--text); border-color: var(--text-2); font-size: 10.5px; }
.app-maps .leaflet-bottom.leaflet-left { z-index: 700; }
.app-maps .leaflet-container a.leaflet-popup-close-button { color: var(--text-2); }

@keyframes maps-drop { from { transform: rotate(-45deg) translate(-8px, -14px); opacity: 0; } }
@keyframes maps-pulse { 0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, .55), 0 2px 6px rgba(0, 0, 0, .35); } 70% { box-shadow: 0 0 0 16px rgba(59, 130, 246, 0), 0 2px 6px rgba(0, 0, 0, .35); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0), 0 2px 6px rgba(0, 0, 0, .35); } }

/* phone + narrow windows: panel spans the top, collapsible */
[data-layout="mobile"] .app-maps .maps-panel, .app-maps.maps-narrow .maps-panel { left: 8px; right: 8px; top: 8px; width: auto; max-height: 55%; }
[data-layout="mobile"] .app-maps .maps-minbtn, .app-maps.maps-narrow .maps-minbtn { display: grid; }
[data-layout="mobile"] .app-maps .maps-fabs { bottom: 30px; right: 8px; }
[data-layout="mobile"] .app-maps .maps-banner { max-width: calc(100% - 80px); left: 8px; transform: translate(0, 160%); }
[data-layout="mobile"] .app-maps .maps-banner.show { transform: none; }
[data-layout="mobile"] .app-maps .maps-measurebar, .app-maps.maps-narrow .maps-measurebar { top: auto; bottom: 30px; left: 8px; right: 60px; transform: translateY(160%); }
[data-layout="mobile"] .app-maps .maps-measurebar.show, .app-maps.maps-narrow .maps-measurebar.show { transform: none; }
