:root {
    color-scheme: light;
    --ink: #1d2923;
    --muted: #758179;
    --line: #e2e8e3;
    --panel: #ffffff;
    --canvas: #edf1ee;
    --forest: #1d6849;
    --forest-deep: #164c36;
    --leaf: #7e9f63;
    --blue: #386b82;
    --amber: #c58a20;
    --red: #c45049;
    --sidebar-width: 336px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { display: block; overflow: hidden; background: var(--canvas); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

#login-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: #edf1ee;
}
.login-shell {
    width: min(100%, 390px);
    padding: 30px;
    background: #fff;
    border: 1px solid #dfe6e0;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(30, 52, 39, .08);
}
.login-brand, .sidebar-brand, .map-brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    color: #fff;
    background: var(--forest);
    border-radius: 8px;
    font-size: 18px;
}
.login-overline, .sidebar-brand-copy > p, .list-heading > div > p {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 1px;
}
.brand-title { margin: 0; color: var(--ink); font-size: 22px; font-weight: 800; line-height: 1.2; }
.login-divider { height: 1px; margin: 24px 0 22px; background: var(--line); }
.login-heading { margin: 0; color: var(--ink); font-size: 19px; font-weight: 750; }
.login-copy { margin: 7px 0 23px; color: var(--muted); font-size: 13px; }
.field-label { display: block; margin: 0 0 7px; color: #536158; font-size: 11px; font-weight: 750; }
.login-input {
    width: 100%;
    height: 46px;
    padding: 0 12px;
    color: var(--ink);
    background: #f7f9f7;
    border: 1px solid #dce4dd;
    border-radius: 6px;
    outline: 0;
}
.login-input:focus { background: #fff; border-color: var(--forest); box-shadow: 0 0 0 3px rgba(29,104,73,.11); }
.login-submit, .login-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    height: 46px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 750;
}
.login-submit { margin-top: 11px; color: #fff; background: var(--forest-deep); border: 1px solid var(--forest-deep); }
.login-submit:hover { background: var(--forest); }
.login-error { min-height: 16px; margin: 10px 0 0; color: #b4433c; font-size: 11px; line-height: 1.45; }
.login-divider-bottom { margin: 14px 0; }
.login-note { margin: 0 0 11px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.login-preview { color: #314c3c; background: #f4f7f4; border: 1px solid #dfe7e0; }
.login-preview:hover { background: #eaf1eb; }
.login-footer { position: absolute; bottom: 18px; margin: 0; color: #849087; font-size: 9px; font-weight: 750; letter-spacing: 1px; text-align: center; }
.login-footer span { margin: 0 4px; color: var(--leaf); }

#app-content { position: relative; display: none; width: 100%; height: 100dvh; min-height: 0; overflow: hidden; background: var(--canvas); }
#map-container { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; background: #dfe7e2; }
.leaflet-container { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.leaflet-control-attribution { font-size: 9px !important; }
.glass { background: rgba(255,255,255,.97); border: 1px solid rgba(222,230,223,.95); box-shadow: 0 4px 16px rgba(26,43,32,.08); backdrop-filter: blur(8px); }

#top-bar {
    position: absolute;
    top: 16px !important;
    right: 16px !important;
    left: calc(var(--sidebar-width) + 32px) !important;
    z-index: 4000;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 56px;
}
.map-brand {
    width: 150px;
    min-width: 128px;
    height: 56px;
    padding: 0 11px;
    background: rgba(255,255,255,.96);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(26,43,32,.08);
}
.map-brand .brand-mark { width: 34px; height: 34px; flex-basis: 34px; font-size: 14px; }
.map-brand b, .map-brand small { display: block; }
.map-brand b { font-size: 13px; font-weight: 800; }
.map-brand small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.map-search {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 130px;
    height: 46px;
    flex: 1 1 auto;
    padding: 0 13px;
    color: #849087;
    border-radius: 8px;
}
.map-search input { width: 100%; min-width: 0; padding: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 12px; font-weight: 550; }
.map-search input::placeholder { color: #89938c; }
.map-search:focus-within { border-color: #9eb3a3; box-shadow: 0 0 0 3px rgba(29,104,73,.1); }
.map-icon-button {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    color: var(--forest-deep);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(26,43,32,.08);
}
.map-icon-button:hover { color: #fff; background: var(--forest); border-color: var(--forest); }
.map-icon-button.is-satellite { color: #fff; background: var(--forest); border-color: var(--forest); }
.desktop-commands { display: flex; align-items: center; gap: 5px; height: 46px; padding: 4px; background: rgba(255,255,255,.97); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(26,43,32,.08); }
.desktop-commands button { display: grid; place-items: center; width: 36px; height: 36px; color: #536158; background: transparent; border: 0; border-radius: 5px; }
.desktop-commands button:hover { color: var(--forest-deep); background: #eff4ef; }
.desktop-commands .quick-add { display: flex; gap: 7px; width: auto; padding: 0 11px; color: #fff; background: var(--forest-deep); font-size: 11px; font-weight: 750; }
.desktop-commands .quick-add:hover { color: #fff; background: var(--forest); }

#list-drawer {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 16px;
    z-index: 4500;
    display: flex;
    width: var(--sidebar-width);
    max-height: none;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border: 1px solid #dfe6e0;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(28,48,35,.12);
}
.sidebar-brand { min-height: 70px; padding: 14px 14px 12px; border-bottom: 1px solid #edf1ed; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; flex-basis: 38px; }
.sidebar-brand-copy { min-width: 0; flex: 1; }
.sidebar-brand-copy h1 { overflow: hidden; margin: 0; color: var(--ink); font-size: 14px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-brand-copy h1 span { color: var(--muted); font-size: 10px; font-weight: 550; }
.mode-badge { padding: 4px 6px; color: #4d6555; background: #eff4ef; border: 1px solid #dce7dd; border-radius: 5px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.session-exit { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 28px; color: #7d5a58; background: #fff7f6; border: 1px solid #f0d9d6; border-radius: 6px; font-size: 11px; }
.session-exit:hover { color: #fff; background: var(--red); border-color: var(--red); }
.demo-banner { display: none; align-items: center; gap: 8px; padding: 9px 14px; color: #725822; background: #fbf6e8; border-bottom: 1px solid #eee3c2; font-size: 10px; font-weight: 650; line-height: 1.4; }
body.is-demo #demo-banner { display: flex; }
body.is-demo #modeBadge { color: #795c18; background: #fbf6e8; border-color: #eee3c2; }
.sidebar-summary { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; margin: 12px 12px 4px; padding: 12px; background: #f6f8f6; border: 1px solid #e8ede8; border-radius: 7px; }
.summary-total span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 650; }
.summary-total strong { color: var(--ink); font-size: 23px; line-height: 1; }
.summary-status { display: flex; gap: 10px; }
.summary-status span { display: flex; align-items: center; gap: 4px; color: #526057; font-size: 10px; }
.legend-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; }
.legend-dot.healthy { background: #38815a; }
.legend-dot.warning { background: #d5a13a; }
.legend-dot.dead { background: #ce5b52; }
.list-heading { display: flex; align-items: center; justify-content: space-between; min-height: 60px; margin: 6px 12px 0; padding: 8px 2px; border-bottom: 1px solid #e9eeea; }
.list-heading h2 { display: flex; align-items: center; gap: 7px; margin: 0; color: var(--ink); font-size: 13px; font-weight: 800; }
.list-heading h2 span { display: inline-grid; place-items: center; min-width: 21px; height: 20px; padding: 0 5px; color: #53645a; background: #eff3ef; border-radius: 4px; font-size: 10px; }
.close-list { display: none; width: 32px; height: 32px; color: #6a786e; background: transparent; border: 0; border-radius: 6px; font-size: 18px; }
.tree-list { display: flex; min-height: 0; flex: 1 1 auto; flex-direction: column; gap: 6px; overflow-x: hidden; overflow-y: auto; padding: 10px 12px 16px !important; overscroll-behavior: contain; }
.tree-list > div { margin: 0 !important; padding: 11px 10px !important; background: #fff; border-color: #e8ede8 !important; border-radius: 7px !important; box-shadow: none !important; }
.tree-list > div:hover { background: #f6f9f6 !important; border-color: #cddbcf !important; }
.tree-list h4 { color: #25342a !important; font-size: 12px !important; }
.tree-list p { max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-list button { border-radius: 6px !important; box-shadow: none !important; }
.tree-row { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 78px; padding: 10px; color: var(--ink); text-align: left; background: #fff; border: 1px solid #e8ede8; border-radius: 7px; }
.tree-row:hover { background: #f6f9f6; border-color: #cddbcf; }
.tree-row-main { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.tree-row-title { overflow: hidden; color: #25342a; font-size: 12px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.tree-row-street { overflow: hidden; color: #78847c; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.tree-row-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tree-row-status { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.tree-row-status .legend-dot { width: 7px; height: 7px; flex-basis: 7px; }
.tree-row-status.is-healthy { color: #397451; }
.tree-row-status.is-warning { color: #a8791c; }
.tree-row-status.is-warning .legend-dot { background: #d5a13a; }
.tree-row-status.is-dead { color: #b94e47; }
.tree-row-status.is-dead .legend-dot { background: #ce5b52; }
.tree-row-time { overflow: hidden; color: #8a948d; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.tree-row-arrow { margin-left: 10px; color: #aab4ac; font-size: 10px; }
.tree-list-empty { margin: 18px 6px; color: #7d8980; font-size: 11px; text-align: center; }
.load-more { width: 100%; min-height: 38px; color: #305e43; background: #f2f6f2; border: 1px solid #dfe8df; border-radius: 6px; font-size: 10px; font-weight: 750; }
.load-more:hover { background: #e8f0e9; }

.map-legend { position: absolute; right: 16px; bottom: 18px; z-index: 3500; display: flex; align-items: center; gap: 13px; min-height: 38px; padding: 0 12px; color: #4d5c52; background: rgba(255,255,255,.96); border: 1px solid #dfe6e0; border-radius: 7px; box-shadow: 0 4px 14px rgba(26,43,32,.08); font-size: 10px; }
.map-legend > span:not(.legend-title) { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-legend .legend-title { color: #29382e; font-weight: 750; }

#bottom-nav { display: none; }
.nav-btn { min-width: 44px; flex: 1 1 0; padding: 5px 0; color: #68766d; background: transparent; border: 0; font-size: 9px; font-weight: 700; }
.nav-btn i { display: block; margin-bottom: 4px; font-size: 17px; }
.nav-btn:hover { color: var(--forest); }
.fab { display: grid; place-items: center; width: 48px; height: 48px; flex: 0 0 48px; color: #fff; background: var(--forest); border: 0; border-radius: 8px; font-size: 19px; }

.tree-div-icon { background: transparent; border: 0; will-change: transform; }
.tree-div-icon i { text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.tree-label { z-index: 1; }
.map-cluster-icon { display: grid; place-items: center; background: transparent; border: 0; }
.map-cluster-icon span { display: grid; place-items: center; width: 38px; height: 38px; padding: 0 3px; color: #fff; background: #1d6849; border: 2px solid rgba(255,255,255,.96); border-radius: 50%; box-shadow: 0 2px 8px rgba(20,40,27,.24); font-size: 10px; font-weight: 800; line-height: 1; }
.tools-content { display: flex; width: min(760px, 100%); max-width: 760px; max-height: min(92dvh, 900px); flex-direction: column; overflow: hidden; }
.tools-header { position: sticky; top: 0; z-index: 2; display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; min-height: 68px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); text-align: left; }
.tools-header h3 { margin: 0; color: var(--ink); font-size: 16px; font-weight: 800; }
.tools-overline { margin: 0 0 3px; color: var(--muted); font-size: 9px; font-weight: 800; }
.tools-scroll { min-height: 0; flex: 1 1 auto; overflow-x: hidden; overflow-y: auto; padding: 18px 20px 22px; overscroll-behavior: contain; text-align: center; }
.icon-action { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 36px; color: #526158; background: #f5f7f5; border: 1px solid #e1e7e1; border-radius: 6px; }
.icon-action:hover { color: #fff; background: var(--forest); border-color: var(--forest); }
.tool-section { margin: 0 0 16px; padding: 15px; background: #fff; border: 1px solid #e4eae4; border-radius: 7px; }
.route-tool { background: #f6f9f6; border-color: #dce7dd; text-align: left; }
.tool-section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; color: var(--forest); }
.tool-section-heading p { margin: 0 0 3px; color: #758179; font-size: 9px; font-weight: 800; }
.tool-section-heading h4 { margin: 0; color: var(--ink); font-size: 15px; font-weight: 800; }
.tool-section-heading > i { display: grid; place-items: center; width: 34px; height: 34px; color: var(--forest); background: #e8f0e9; border-radius: 6px; }
.tool-field-label { display: block; margin: 10px 0 5px; color: #59665c; font-size: 10px; font-weight: 750; }
.route-picker { position: relative; }
.route-picker input, .route-origin-row input { width: 100%; height: 42px; padding: 0 11px; color: var(--ink); background: #fff; border: 1px solid #d8e1d9; border-radius: 6px; outline: 0; font-size: 12px; }
.route-picker input:focus, .route-origin-row input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(29,104,73,.1); }
.route-tree-results { position: absolute; top: calc(100% + 4px); right: 0; left: 0; z-index: 20; max-height: 220px; overflow-y: auto; background: #fff; border: 1px solid #dfe6e0; border-radius: 6px; box-shadow: 0 8px 22px rgba(26,43,32,.14); }
.route-tree-option { display: block; width: 100%; padding: 10px 11px; color: var(--ink); background: #fff; border: 0; border-bottom: 1px solid #edf1ed; text-align: left; }
.route-tree-option:last-child { border-bottom: 0; }
.route-tree-option:hover, .route-tree-option:focus { background: #f3f7f3; outline: 0; }
.route-tree-option strong, .route-tree-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-tree-option strong { font-size: 11px; font-weight: 750; }
.route-tree-option small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.route-tree-selected { display: flex; align-items: center; gap: 8px; margin-top: 7px; padding: 8px 10px; color: #27563a; background: #eaf3ec; border: 1px solid #d6e6d8; border-radius: 6px; font-size: 10px; font-weight: 700; }
.route-tree-selected i { color: var(--forest); }
.route-origin-row { display: flex; align-items: center; gap: 6px; }
.route-origin-row input { min-width: 0; flex: 1; }
.route-origin-status { min-height: 14px; margin: 6px 0 0; color: #77847a; font-size: 9px; line-height: 1.4; }
.route-form-actions { display: flex; gap: 7px; margin-top: 12px; }
.route-primary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; flex: 1; color: #fff; background: var(--forest-deep); border: 1px solid var(--forest-deep); border-radius: 6px; font-size: 11px; font-weight: 750; }
.route-primary:hover { background: var(--forest); }
.route-primary:disabled { opacity: .6; cursor: wait; }
.route-secondary { display: grid; place-items: center; width: 42px; flex: 0 0 42px; color: #8a514e; background: #fff; border: 1px solid #e8d7d4; border-radius: 6px; }
.route-provider-note { margin: 8px 0 0; color: #8a948d; font-size: 8px; line-height: 1.45; }
.route-panel { position: absolute; top: 84px; right: 16px; z-index: 4200; display: flex; width: min(360px, calc(100vw - 28px)); max-height: calc(100dvh - 145px); flex-direction: column; overflow: hidden; background: rgba(255,255,255,.98); border: 1px solid #dfe6e0; border-radius: 7px; box-shadow: 0 8px 26px rgba(23,42,29,.2); }
.route-panel.hidden { display: none; }
.route-panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 13px 9px; border-bottom: 1px solid #edf1ed; }
.route-panel-title { min-width: 0; }
.route-panel-title strong { display: block; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.route-panel-kicker { display: block; margin-bottom: 3px; color: var(--forest); font-size: 8px; font-weight: 850; }
.route-summary { display: flex; align-items: baseline; gap: 8px; padding: 9px 13px 6px; color: #536158; font-size: 10px; }
.route-summary strong { color: var(--forest-deep); font-size: 16px; font-weight: 850; }
.route-panel-actions { display: flex; gap: 7px; padding: 0 13px 8px; }
.route-panel-actions a, .route-panel-actions button { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 9px; color: #4f5e53; background: #f5f7f5; border: 1px solid #e3e9e3; border-radius: 5px; font-size: 9px; font-weight: 700; text-decoration: none; }
.route-panel-actions a:hover, .route-panel-actions button:hover { color: var(--forest); background: #edf4ee; }
.route-steps { min-height: 0; max-height: min(40vh, 380px); overflow-y: auto; margin: 0; padding: 4px 14px 12px 32px; color: #46544a; }
.route-panel.is-collapsed .route-summary, .route-panel.is-collapsed .route-panel-actions, .route-panel.is-collapsed .route-steps { display: none; }
.route-steps li { padding: 7px 0 7px 3px; border-bottom: 1px solid #eef1ee; font-size: 10px; line-height: 1.45; }
.route-steps li::marker { color: var(--forest); font-weight: 800; }
.route-step-distance { display: block; margin-top: 2px; color: #879188; font-size: 8px; }
.route-stop-icon { display: grid; place-items: center; color: #fff; background: var(--forest); border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.route-stop-icon.is-destination { background: #c45049; }
.modal-container { padding: 12px; background: rgba(23,35,27,.46); backdrop-filter: blur(3px); }
.modal-content { max-width: 480px; border: 1px solid #e1e7e1; border-radius: 8px; box-shadow: 0 18px 60px rgba(20,36,25,.22); }
.view-image-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #5c7563; background: #e1e9e2; }
.view-image-placeholder.hidden { display: none; }
.view-image-placeholder i { font-size: 34px; }
.view-image-placeholder span { font-size: 10px; font-weight: 700; }
.view-image-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); gap: 7px; padding-bottom: 2px; }
.view-image-gallery.hidden { display: none; }
.view-gallery-item { position: relative; display: block; aspect-ratio: 1; overflow: hidden; padding: 0; background: #eef2ee; border: 1px solid #dfe6e0; border-radius: 5px; }
.view-gallery-item img { display: block; width: 100%; height: 100%; object-fit: cover; }
.view-gallery-item span { position: absolute; right: 0; bottom: 0; left: 0; overflow: hidden; padding: 3px 4px; color: #fff; background: rgba(20,35,25,.7); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.modal-content > [class*="rounded-"] { border-radius: 6px !important; }
.modal-content input, .modal-content select, .modal-content textarea { border-radius: 6px !important; }
.modal-content button { border-radius: 6px !important; }
#toast { top: auto; bottom: 24px; padding: 11px 16px; color: #fff; background: #24372a; border: 1px solid rgba(255,255,255,.12); border-radius: 6px; box-shadow: 0 6px 24px rgba(24,43,30,.18); font-size: 12px; }

@media (max-width: 1080px) and (min-width: 901px) {
    :root { --sidebar-width: 300px; }
    .map-brand { width: 120px; min-width: 120px; padding: 0 8px; gap: 7px; }
    .map-brand small { display: none; }
    .desktop-commands { gap: 1px; }
    .desktop-commands button { width: 32px; }
    .desktop-commands .quick-add { padding: 0 8px; }
    .map-legend { gap: 8px; font-size: 9px; }
}

@media (max-width: 960px) and (min-width: 901px) {
    .map-brand { display: none; }
}

@media (max-width: 900px) {
    :root { --sidebar-width: 0px; }
    body, #app-content { height: 100dvh; }
    #top-bar { top: max(10px, env(safe-area-inset-top)) !important; right: 10px !important; left: 10px !important; height: 48px; gap: 6px; }
    .map-brand, .desktop-commands { display: none; }
    .map-search { height: 44px; padding: 0 11px; gap: 8px; }
    .map-search input { font-size: 12px; }
    .map-search input::placeholder { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .map-icon-button { width: 44px; height: 44px; flex-basis: 44px; }
    #list-drawer { top: auto; right: 10px; bottom: calc(78px + env(safe-area-inset-bottom)); left: 10px; display: none; width: auto; max-height: min(68dvh, 580px); border-radius: 8px; }
    .sidebar-brand { min-height: 60px; padding: 10px 12px; }
    .sidebar-brand .brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
    .sidebar-summary { margin-top: 8px; padding: 9px 10px; }
    .close-list { display: inline-grid; place-items: center; }
    .list-heading { min-height: 53px; }
    .tree-list { padding-bottom: 12px !important; }
    #bottom-nav { position: absolute; right: 10px; bottom: max(9px, env(safe-area-inset-bottom)); left: 10px; z-index: 5000; display: flex; align-items: center; justify-content: space-around; height: 64px; padding: 5px 6px; background: rgba(255,255,255,.97); border: 1px solid #dde5de; border-radius: 8px; box-shadow: 0 8px 24px rgba(27,44,33,.15); }
    #bottom-nav .nav-btn { height: 50px; }
    #bottom-nav .nav-btn i { font-size: 16px; }
    #bottom-nav .fab { width: 48px; height: 48px; border-radius: 8px; box-shadow: none; }
    .map-legend { right: 10px; bottom: calc(84px + env(safe-area-inset-bottom)); gap: 9px; min-height: 32px; padding: 0 9px; font-size: 9px; }
    .map-legend .legend-title { display: none; }
    .map-legend > span:not(.legend-title) { gap: 4px; }
    .modal-container { align-items: flex-end; padding: 8px; }
    .modal-content { width: 100%; max-width: 560px; max-height: calc(94dvh - env(safe-area-inset-top)); border-radius: 8px; }
    .tools-content { max-height: calc(96dvh - env(safe-area-inset-top)); }
    .tools-header { min-height: 62px; padding: 10px 14px; }
    .tools-scroll { padding: 13px 12px 18px; }
    .route-panel { top: calc(64px + env(safe-area-inset-top)); right: 10px; left: 10px; width: auto; max-height: min(46dvh, 430px); }
    .route-steps { max-height: min(25dvh, 220px); }
    #viewModal { align-items: flex-end; }
    #viewModal .modal-content { max-height: 90dvh; }
    #statsModal .modal-content { height: min(82dvh, 720px); }
    #toast { right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); left: 12px; width: max-content; max-width: calc(100% - 24px); margin: auto; }
}

@media (max-width: 390px) {
    .map-legend { gap: 6px; font-size: 8px; }
    .summary-status { gap: 7px; }
    .summary-status span { font-size: 9px; }
    .login-shell { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Bounded list pages keep DOM/memory independent of the inventory size. */
.list-filters { padding: 10px 14px; flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.list-filters label { display: block; color: #59665e; font-size: 10px; font-weight: 700; }
.list-filters select, .route-street-select { width: 100%; min-width: 0; height: 36px; margin-top: 4px; padding: 0 8px; color: var(--ink); background: #f7f9f7; border: 1px solid #dce4dd; border-radius: 5px; font-size: 11px; text-overflow: ellipsis; }
.list-filter-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 8px; }
.filter-reset { margin-top: 7px; color: #35677b; background: none; border: 0; font-size: 10px; }
.list-pagination { display: flex; align-items: center; gap: 7px; min-height: 50px; flex: 0 0 auto; padding: 7px 12px; border-top: 1px solid var(--line); background: #f8faf8; }
.list-pagination > span { flex: 1; color: #626e65; font-size: 11px; font-variant-numeric: tabular-nums; }
.list-pagination .icon-action { width: 34px; height: 34px; flex-basis: 34px; }
button:disabled { cursor: default; opacity: .45; }
.tree-list[aria-busy="true"] { opacity: .55; pointer-events: none; }
.sidebar-brand-copy h1 { white-space: normal; overflow: visible; font-size: 13px; }
.sidebar-brand-copy h1 span { display: block; margin-top: 3px; }
.sidebar-summary { border: 0; background: transparent; margin-top: 4px; margin-bottom: 0; }
.tool-section { padding: 0 0 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
.route-search-message { padding: 12px; font-size: 11px; color: var(--muted); }
.gps-quality-hint { margin: 0 0 8px; font-size: 10px; line-height: 1.5; color: #356481; }
.ai-audit-result { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 8px; font-size: 11px; line-height: 1.6; text-align: left; }
.ai-audit-result.hidden { display: none; }
.ai-audit-result p { margin: 6px 0; }
.ai-audit-result .audit-summary { font-weight: 700; color: #225039; }
.ai-audit-result .audit-note { color: #758179; font-size: 10px; }
.ai-audit-result strong { display: block; margin-top: 10px; }
.audit-row { display: block; width: 100%; min-height: 34px; padding: 5px 0; border: 0; border-bottom: 1px solid var(--line); color: #25689e; text-align: left; }
.alignment-preview { position: absolute; right: 16px; bottom: 65px; z-index: 4600; width: min(360px,calc(100% - 32px)); padding: 14px; border: 1px solid #d8d4c5; border-radius: 7px; background: #fff; box-shadow: 0 4px 16px #0002; font-size: 12px; }
.alignment-preview.hidden { display: none; }
.alignment-preview p { margin: 8px 0 12px; line-height: 1.55; }
.alignment-preview > div { display: flex; gap: 8px; }
.alignment-preview button { min-height: 38px; padding: 0 12px; border: 1px solid #dce4dd; border-radius: 5px; }
.alignment-preview button:first-child { color: white; background: #1d6849; }
@media(max-width:900px) { .alignment-preview { bottom: 120px; right: 12px; } }
.route-tree-selected { overflow-wrap: anywhere; }
.navigation-guidance { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; padding: 12px 14px; color: #fff; background: #175dac; }
.navigation-guidance.hidden { display: none; }
.navigation-guidance > i { flex: 0 0 24px; font-size: 23px; text-align: center; }
.navigation-guidance > div { min-width: 0; }
.navigation-guidance strong { display: block; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.navigation-guidance span { display: block; margin-top: 4px; color: #dceaff; font-size: 10px; font-variant-numeric: tabular-nums; }
.navigation-controls { display: flex; flex: 0 0 auto; gap: 7px; padding: 10px 13px; }
.navigation-controls .route-primary { background: #2478df; border-color: #2478df; min-height: 38px; }
.navigation-controls .icon-action { width: 38px; height: 38px; flex-basis: 38px; }
.icon-action[aria-pressed="true"] { color: #145cb7; background: #e9f2ff; border-color: #9bbef0; }
.route-endpoint-note { margin: 0; padding: 5px 13px; color: #84601e; font-size: 10px; line-height: 1.4; }
.route-endpoint-note:empty { display: none; }
.route-panel-header, .route-summary, .route-panel-actions, .route-endpoint-note { flex: 0 0 auto; }
.route-panel.is-collapsed .route-endpoint-note { display: none; }
.route-panel.is-collapsed .navigation-controls { padding-top: 8px; padding-bottom: 8px; }
.route-panel { max-height: calc(100dvh - 145px); }
.route-steps { flex: 1 1 auto; }
.navigation-position { border: 0; background: none; will-change: transform; }
.navigation-dot { position: absolute; inset: 5px; display: block; border: 3px solid white; border-radius: 50%; background: #4285f4; box-shadow: 0 1px 4px #2455a877; }
.navigation-heading { position: absolute; inset: 0; transform-origin: center; will-change: transform; }
.navigation-beam { position: absolute; bottom: 14px; left: -41px; width: 110px; height: 95px; clip-path: polygon(50% 100%, 0 0, 100% 0); background: linear-gradient(to top, #4285f47a, #4285f400); opacity: 0; }
.navigation-arrow { position: absolute; top: -4px; left: 7px; color: #1764cf; font-size: 22px; text-shadow: 0 1px 1px white; opacity: 0; }
.has-heading .navigation-beam, .has-heading .navigation-arrow { opacity: 1; }
.navigation-position.is-stale { opacity: .45; }
*:focus-visible { outline: 2px solid #2478df; outline-offset: 2px; }
* { letter-spacing: 0 !important; }
@media (max-width: 900px) {
    #list-drawer { max-height: calc(100dvh - 150px - env(safe-area-inset-bottom)); }
    .list-filters { padding: 8px 12px; }
    .route-panel { max-height: min(58dvh, 480px); }
    .route-steps { max-height: 22dvh; }
    .route-panel.is-collapsed { max-height: 40dvh; }
    .sidebar-brand-copy h1 { font-size: 13px; }
}
@media (max-width: 900px) and (max-height: 650px) {
    .sidebar-summary { display: none; }
    .list-heading { min-height: 40px; }
}
