:root {
    --bg: #f4f0e8;
    --panel: #1f3a5f;
    --panel-alt: #2f567f;
    --ink: #0d1b2a;
    --light: #f8f7f3;
    --accent: #ff7a18;
    --accent-2: #ffd166;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: "Space Grotesk", sans-serif;
    background: radial-gradient(circle at 10% 20%, #fdf8ef, #ece6d8 50%, #e1dbc9 100%);
    color: var(--ink);
}

body.login-page {
    position: relative;
    background: #0d1b2a;
}

.login-map-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.login-map-bg iframe {
    width: 100%;
    height: 100%;
    border: 0;
    filter: saturate(0.9) contrast(1.05) brightness(0.55);
    transform: scale(1.08);
    pointer-events: none;
}

body.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(135deg, rgba(8, 18, 30, 0.68), rgba(15, 36, 58, 0.58)),
        radial-gradient(circle at 20% 20%, rgba(255, 209, 102, 0.12), transparent 50%);
}

a {
    color: var(--accent);
    text-decoration: none;
}

button, input, select {
    font-family: inherit;
}

.flash-stack {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 1100;
}

.flash-item {
    background: var(--panel);
    color: var(--light);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 8px;
}

.auth-shell {
    min-height: 100%;
    display: grid;
    place-items: center;
    padding: 20px;
    position: relative;
    z-index: 2;
}

.auth-card {
    width: min(420px, 100%);
    background: linear-gradient(155deg, var(--panel), var(--panel-alt));
    color: var(--light);
    border-radius: var(--radius);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 30px 60px rgba(13, 27, 42, 0.25);
}

.auth-card input {
    padding: 11px;
    border-radius: 10px;
    border: none;
}

.auth-card input[readonly],
.auth-card input.invite-email-locked {
    background: rgba(216, 229, 245, 0.9);
    color: rgba(13, 27, 42, 0.92);
    border: 1px solid rgba(255, 209, 102, 0.8);
    box-shadow: inset 0 0 0 1px rgba(13, 27, 42, 0.08);
    cursor: not-allowed;
}

.invite-email-lock-note {
    margin: -2px 0 6px;
    font-size: 0.84rem;
    color: rgba(248, 247, 243, 0.86);
}

.auth-card button {
    margin-top: 6px;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: #111;
    font-weight: 700;
    cursor: pointer;
}

.dashboard-shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.dashboard-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dashboard-link-btn {
    background: #234d74;
    color: #fff;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 700;
}

.dashboard-head button {
    background: var(--panel);
    color: var(--light);
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
}

.dashboard-actions,
.dashboard-list {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(31, 58, 95, 0.1);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 18px;
}

.dashboard-create-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.dashboard-create-row input,
.dashboard-create-row select {
    padding: 10px;
    border: 1px solid rgba(31, 58, 95, 0.25);
    border-radius: 10px;
}

.dashboard-create-row button {
    border: none;
    border-radius: 10px;
    background: var(--accent);
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 700;
}

.map-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.map-card {
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, #fff, #f9f6ef);
    border: 1px solid rgba(31, 58, 95, 0.15);
    color: var(--ink);
}

.map-publish-state {
    font-weight: 700;
}

.map-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.map-open-btn,
.map-publish-toggle-btn {
    border: none;
    border-radius: 9px;
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.map-open-btn {
    background: #234d74;
    color: #fff;
}

.map-publish-toggle-btn {
    background: var(--accent);
    color: #111;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.api-card {
    background: linear-gradient(135deg, #fff, #f5f8fb);
    border: 1px solid rgba(31, 58, 95, 0.14);
    border-radius: 12px;
    padding: 14px;
}

.api-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.api-status-ok {
    color: #0d6a42;
    font-weight: 700;
}

.api-status-bad {
    color: #9c1f1f;
    font-weight: 700;
}

.api-endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.api-endpoint-list a {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.75rem;
    color: #1b3a5c;
    overflow-wrap: anywhere;
}

.editor-root {
    --editor-topbar-height: 72px;
    display: grid;
    grid-template-columns: 88px 1fr;
    grid-template-rows: var(--editor-topbar-height) 1fr;
    grid-template-areas:
        "topbar topbar"
        "rail main";
    min-height: 100vh;
    animation: editorFade 0.45s ease;
    position: relative;
}

@keyframes editorFade {
    from {
        transform: translateY(12px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.editor-rail {
    grid-area: rail;
    background: linear-gradient(180deg, #122a42, #1a3b5b 55%, #234f74);
    color: var(--light);
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 8;
}

.brand {
    font-family: "IBM Plex Mono", monospace;
    color: var(--accent-2);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.rail-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 10px 8px;
    background: rgba(255, 255, 255, 0.09);
    color: var(--light);
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.rail-link {
    text-decoration: none;
    text-align: center;
}

.rail-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.rail-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rail-label {
    font-size: 11px;
    line-height: 1;
    letter-spacing: 0.02em;
}

.rail-btn:hover,
.rail-btn.is-active {
    background: var(--accent);
    color: #111;
}

.panel-backdrop {
    position: absolute;
    top: var(--editor-topbar-height);
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 6;
    background: rgba(7, 20, 33, 0.3);
}

.function-panel {
    position: absolute;
    top: var(--editor-topbar-height);
    left: 88px;
    width: min(420px, calc(100vw - 88px));
    height: calc(100% - var(--editor-topbar-height));
    background: linear-gradient(180deg, #f8f7f3, #efe8da);
    border-right: 1px solid rgba(31, 58, 95, 0.2);
    box-shadow: 14px 0 34px rgba(10, 26, 42, 0.2);
    transform: translateX(-104%);
    transition: transform 0.22s ease;
    z-index: 7;
    padding: 16px;
    overflow-y: auto;
}

.function-panel.is-open {
    transform: translateX(0);
}

.segment-detail-panel {
    width: min(520px, calc(100vw - 88px));
    z-index: 7;
}

.segdet-name {
    font-size: 1rem;
    font-weight: 800;
    color: #173451;
    line-height: 1.3;
}

.segdet-source {
    color: #6b7280;
    font-size: 0.78rem;
}

.segdet-field-label {
    display: block;
    margin-top: 8px;
    margin-bottom: 4px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.segdet-field-input {
    width: 100%;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid rgba(31, 58, 95, 0.25);
    background: #fff;
    color: #0f172a;
}

.segdet-attr-list {
    display: grid;
    gap: 6px;
    max-height: 44vh;
    overflow: auto;
    padding-right: 4px;
}

.segdet-attr-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 8px;
    align-items: start;
    border: 1px solid rgba(31, 58, 95, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    padding: 6px 8px;
}

.segdet-attr-key {
    font-size: 0.74rem;
    font-weight: 700;
    color: #334155;
    word-break: break-word;
}

.segdet-attr-val {
    font-size: 0.75rem;
    color: #0f172a;
    word-break: break-word;
}

.function-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.function-panel-head h2 {
    margin: 0;
    color: #173451;
}

.function-panel-head button {
    border: none;
    border-radius: 10px;
    padding: 8px 12px;
    background: #234d74;
    color: #fff;
    cursor: pointer;
}

.import-page {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    overflow: hidden;
    background: #e9e3d4;
}

.import-shell {
    width: 100%;
    height: 100vh;
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 0;
}

.import-sidebar {
    background: linear-gradient(180deg, #f8f7f3, #eee6d7);
    border-right: 1px solid rgba(31, 58, 95, 0.2);
    padding: 16px;
    overflow-y: auto;
    height: 100vh;
}

.import-sidebar h1 {
    margin: 0;
    color: #173451;
}

.step-list {
    margin: 12px 0 16px;
    padding-left: 20px;
    display: grid;
    gap: 7px;
}

.step-list li {
    color: #53697f;
}

.step-list li.is-active {
    color: #0e2b47;
    font-weight: 700;
}

.wizard-card {
    background: #fff;
    border: 1px solid rgba(31, 58, 95, 0.15);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wizard-card h2 {
    margin: 0;
    color: #1d3e5d;
}

.wizard-card input,
.wizard-card button {
    padding: 10px;
    border-radius: 10px;
}

.wizard-card button {
    border: none;
    background: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

.wizard-card progress {
    width: 100%;
    height: 12px;
}

.wizard-summary {
    white-space: pre-wrap;
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
    border: 1px dashed rgba(31, 58, 95, 0.3);
    border-radius: 10px;
    background: #f4f7fb;
    padding: 10px;
}

.wizard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.wizard-table th,
.wizard-table td {
    border-bottom: 1px solid rgba(31, 58, 95, 0.12);
    padding: 8px;
    text-align: left;
}

.wizard-back-link {
    color: #234d74;
    text-decoration: none;
}

.import-preview-wrap {
    min-height: 100vh;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#import-preview-map {
    width: 100%;
    height: 100vh;
}

.toolbar-block {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#panel-layers {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
}

#panel-layers .toolbar-block {
    flex: 0 0 auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
}

.layer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
    padding-right: 4px;
}

#panel-layers::-webkit-scrollbar {
    width: 10px;
}

#panel-layers::-webkit-scrollbar-thumb {
    background: rgba(35, 77, 116, 0.45);
    border-radius: 999px;
}

#panel-layers::-webkit-scrollbar-track {
    background: rgba(31, 58, 95, 0.08);
}

.layer-group {
    position: relative;
    border: 1px solid rgba(31, 58, 95, 0.2);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.58);
    overflow: hidden;
}

.layer-group.drag-over-before::before,
.layer-group.drag-over-after::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(233, 118, 40, 0.2), rgba(233, 118, 40, 0.95), rgba(233, 118, 40, 0.2));
    box-shadow: 0 0 0 1px rgba(233, 118, 40, 0.18);
    z-index: 3;
}

.layer-group.drag-over-before::before {
    top: 0;
}

.layer-group.drag-over-after::after {
    bottom: 0;
}

.layer-group > summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 10px;
    font-weight: 700;
    color: #173451;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(31, 58, 95, 0.08);
}

.layer-group-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.layer-group-actions {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.group-move-btn,
.layer-move-btn {
    border: 1px solid rgba(31, 58, 95, 0.2);
    background: rgba(255, 255, 255, 0.9);
    color: var(--ink);
    border-radius: 6px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
}

.group-move-btn:hover,
.layer-move-btn:hover {
    background: rgba(31, 58, 95, 0.08);
}

.layer-delete-btn {
    border: none;
    border-radius: 8px;
    padding: 4px 7px;
    background: #b91c1c;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.layer-group > summary::-webkit-details-marker {
    display: none;
}

.layer-group-count {
    font-size: 12px;
    opacity: 0.72;
    font-family: "IBM Plex Mono", monospace;
}

.layer-group-body {
    display: grid;
    gap: 6px;
    padding: 8px;
}

.layer-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    line-height: 1.25;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(31, 58, 95, 0.16);
    border-radius: 10px;
    padding: 8px;
    cursor: grab;
}

.layer-item.dragging {
    opacity: 0.7;
    cursor: grabbing;
    border-style: dashed;
}

.layer-item.drag-over {
    outline: 2px dashed rgba(233, 118, 40, 0.8);
    outline-offset: 2px;
}

.layer-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: rgba(31, 58, 95, 0.08);
    color: rgba(31, 58, 95, 0.8);
    font-size: 14px;
    line-height: 1;
    user-select: none;
    cursor: grab;
}

.layer-name {
    min-width: 120px;
    font-weight: 600;
}

.layer-swatch {
    width: 10px;
    height: 10px;
    border-radius: 99px;
    border: 1px solid rgba(0, 0, 0, 0.28);
    flex: 0 0 auto;
}

.layer-item-count {
    margin-left: auto;
    opacity: 0.72;
    font-family: "IBM Plex Mono", monospace;
    font-size: 12px;
}

.layer-item-actions {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    margin-left: 4px;
}

.layer-opacity-wrap {
    width: 100%;
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.layer-item input[type="range"] {
    width: 100%;
    padding: 0;
}

.layer-line-color-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-size: 12px;
}

.layer-line-color-wrap input[type="color"] {
    width: 26px;
    height: 20px;
    border: none;
    background: transparent;
    padding: 0;
}

.layer-label-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.layer-default-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.layer-default-actions button {
    padding: 8px;
    font-size: 12px;
}

.layer-default-actions button.secondary {
    background: #355f7d;
    color: #fff;
}

.toolbar-block button,
.toolbar-block select,
.toolbar-block input {
    padding: 10px;
    border-radius: 10px;
    border: none;
}

.toolbar-block button {
    background: var(--accent);
    color: #111;
    font-weight: 700;
    cursor: pointer;
}

.toolbar-block button.is-active {
    outline: 2px solid var(--accent-2);
    transform: translateY(-1px);
}

.editor-canvas-wrap {
    grid-area: main;
    position: relative;
    min-height: calc(100vh - var(--editor-topbar-height));
}

.map-load-progress {
    position: absolute;
    left: 102px;
    right: 14px;
    bottom: 14px;
    z-index: 12;
    background: rgba(16, 32, 49, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 8px 10px;
    box-shadow: 0 10px 28px rgba(2, 10, 19, 0.38);
    color: #f8f7f3;
}

.map-load-progress[hidden] {
    display: none;
}

.map-load-progress-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.75rem;
}

.map-load-progress-row strong {
    font-size: 0.74rem;
    font-weight: 700;
}

.map-load-progress-row span {
    font-family: "IBM Plex Mono", monospace;
    opacity: 0.92;
}

.map-load-progress-track {
    margin-top: 6px;
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    overflow: hidden;
}

.map-load-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #fbbf24, #22c55e);
    transition: width 0.16s linear;
}

.map-load-progress-track.is-indeterminate .map-load-progress-fill {
    width: 36% !important;
    animation: mapLoadIndeterminate 1.2s ease-in-out infinite;
}

@keyframes mapLoadIndeterminate {
    0% { transform: translateX(-110%); }
    50% { transform: translateX(80%); }
    100% { transform: translateX(260%); }
}

.editor-topbar {
    grid-area: topbar;
    position: sticky;
    top: 0;
    z-index: 60;
    background: linear-gradient(180deg, #122a42, #1a3b5b 55%, #234f74);
    color: #f8f7f3;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 14px;
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 4px 10px;
    align-items: center;
    transition: box-shadow 180ms ease, border-color 180ms ease;
}

.editor-topbar.is-scrolled {
    box-shadow: 0 10px 22px rgba(2, 10, 19, 0.45);
    border-bottom-color: rgba(255, 255, 255, 0.28);
}

.editor-topbar-title {
    font-weight: 700;
    font-size: 14px;
    grid-row: 1 / span 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.topbar-logout-form { margin: 0; padding: 0; }

.topbar-logout-btn {
    background: none;
    border: none;
    color: rgba(248, 247, 243, 0.55);
    font-size: 11px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: color 0.12s;
    line-height: 1;
}
.topbar-logout-btn:hover { color: #f8f7f3; }
.topbar-logout-btn svg { flex-shrink: 0; }

.editor-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.editor-topbar-actions button {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    background: var(--accent);
    color: #111;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
}

.editor-topbar-actions a {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    background: var(--accent);
    color: #111;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.editor-topbar-actions button.secondary {
    background: #2b557c;
    color: #fff;
}

.editor-topbar-actions a.secondary {
    background: #2b557c;
    color: #fff;
}

.editor-topbar-actions button.secondary.danger {
    background: #8f1d1d;
    color: #fff;
}

.editor-topbar-actions button.mode-active {
    background: #f2b705;
    color: #1b1b1b;
}

.editor-topbar-status {
    font-size: 12px;
    opacity: 0.9;
}

.wizard-step {
    background: #fff;
    border: 1px solid rgba(31, 58, 95, 0.15);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wizard-step h3 {
    margin: 0;
}

.wizard-step input,
.wizard-step button {
    padding: 10px;
    border-radius: 10px;
}

.wizard-step button {
    border: none;
    background: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

.wizard-step progress {
    width: 100%;
    height: 14px;
}

#wizard-summary {
    font-family: "IBM Plex Mono", monospace;
    font-size: 13px;
    background: #f4f7fb;
    border-radius: 10px;
    border: 1px dashed rgba(31, 58, 95, 0.2);
    padding: 10px;
    white-space: pre-wrap;
}

#editor-canvas {
    width: 100%;
    height: calc(100vh - var(--editor-topbar-height));
}

/* Feature attribute popup */
.feat-popup {
    font-family: "Space Grotesk", sans-serif;
    font-size: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.fp-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    justify-content: flex-end;
}

.fp-arr {
    border: none;
    background: #1b4965;
    color: #fff;
    border-radius: 6px;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
}

.fp-arr:hover {
    background: #2a6a99;
}

.fp-count {
    font-size: 11px;
    color: #4a6785;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
}

.fp-head {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
    color: #0d1b2a;
    line-height: 1.3;
}

.fp-src {
    display: inline-block;
    background: #1b4965;
    color: #fff;
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
}

.feat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    margin-top: 4px;
}

.feat-table tr:nth-child(even) {
    background: rgba(31, 58, 95, 0.05);
}

.feat-table .fp-key {
    color: #4a6785;
    font-weight: 600;
    padding: 2px 8px 2px 2px;
    white-space: nowrap;
    vertical-align: top;
}

.feat-table .fp-val {
    color: #0d1b2a;
    padding: 2px 2px;
    word-break: break-word;
}

.maplibregl-popup-content {
    padding: 10px 12px !important;
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(10, 26, 42, 0.18) !important;
}

@media (max-width: 900px) {
    .editor-root {
        --editor-topbar-height: 112px;
        grid-template-columns: 74px 1fr;
    }

    .editor-rail {
        padding: 10px 8px;
    }

    .function-panel {
        top: var(--editor-topbar-height);
        left: 74px;
        width: calc(100vw - 74px);
        height: calc(100% - var(--editor-topbar-height));
    }

    .panel-backdrop {
        top: var(--editor-topbar-height);
    }

    .map-load-progress {
        left: 84px;
        right: 10px;
        bottom: 10px;
    }

    .editor-topbar {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 5px;
    }

    .editor-topbar-title {
        grid-row: auto;
    }

    .import-page {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .import-shell {
        grid-template-columns: 1fr;
        height: auto;
    }

    .import-sidebar {
        min-height: 0;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid rgba(31, 58, 95, 0.2);
    }

    .import-preview-wrap,
    #import-preview-map {
        height: 65vh;
        min-height: 420px;
    }

    .dashboard-create-row {
        grid-template-columns: 1fr;
    }
}

/* --- Nohvis Ordinances overlay --- */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #1b3a5c;
}

.toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}

#ordinances-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-right: 2px;
}

.ordinance-item {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(31, 58, 95, 0.18);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.78rem;
    line-height: 1.4;
    color: #1b3a5c;
}

.ordinance-item strong {
    display: block;
    margin-bottom: 2px;
}

.ordinance-item-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    font-weight: 600;
    margin-bottom: 2px;
}

.ordinance-vtypes {
    font-style: italic;
    color: #555;
}

.ordinance-status {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 1px 6px;
    border-radius: 99px;
    white-space: nowrap;
}

.ordinance-status--active {
    background: #d1fae5;
    color: #065f46;
}

.ordinance-status--inactive,
.ordinance-status--expired {
    background: #fee2e2;
    color: #991b1b;
}

.ordinance-status--unknown {
    background: #f3f4f6;
    color: #6b7280;
}

/* --- Ordinances: mode segmented tabs --- */
.ordinances-mode-tabs {
    display: flex;
    border: 1px solid rgba(31, 58, 95, 0.3);
    border-radius: 8px;
    overflow: hidden;
}

.ordinances-mode-tab {
    flex: 1;
    text-align: center;
    cursor: pointer;
    padding: 6px 4px;
    font-size: 0.72rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.5);
    color: #1b3a5c;
    transition: background 0.12s, color 0.12s;
    user-select: none;
}

.ordinances-mode-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.ordinances-mode-tab.is-active {
    background: #1b3a5c;
    color: #fff;
}

/* --- Ordinances: county add row --- */
.ordinances-add-row {
    display: flex;
    gap: 6px;
}

.ordinances-add-row input {
    flex: 1;
    min-width: 0;
}

.ordinances-add-row button {
    flex-shrink: 0;
    padding: 6px 10px;
}

/* --- Ordinances: chips (selected county/municipality tags) --- */
.ordinances-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 0;
}

.ordinance-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1b3a5c;
    color: #fff;
    border-radius: 99px;
    padding: 2px 8px 2px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.ordinance-chip button {
    all: unset;
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.7;
    padding: 0 2px;
}

.ordinance-chip button:hover { opacity: 1; }

.ordinance-chip--sm {
    font-size: 0.68rem;
    padding: 1px 6px 1px 8px;
    background: #2d5f8a;
}

/* --- Ordinances: municipal checklist --- */
.ordinances-muni-checklist {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(31, 58, 95, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    padding: 4px 0;
}

.ordinances-muni-checklist-head {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #1b3a5c;
    padding: 6px 10px 4px;
    border-bottom: 1px solid rgba(31, 58, 95, 0.1);
}

.ordinances-muni-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    font-size: 0.77rem;
    cursor: pointer;
    color: #1b3a5c;
}

.ordinances-muni-row:hover { background: rgba(31, 58, 95, 0.06); }

.ordinances-muni-selectall {
    font-weight: 700;
    border-bottom: 1px solid rgba(31, 58, 95, 0.08);
}

/* --- Ordinances: municipal selection summary --- */
.ordinances-muni-summary {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ordinances-muni-group strong {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #1b3a5c;
    margin-bottom: 3px;
}

.ordinances-muni-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ordinances-muni-bulk-row {
    display: flex;
    gap: 6px;
}

.ordinances-muni-bulk-row button {
    flex: 1;
    font-size: 0.75rem;
    padding: 6px 4px;
}

/* ── Ordinance detail overlay panel ─────────────────────────────────────────── */
.ord-detail-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 92vw;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 900;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ord-detail-panel[hidden] { display: none; }

.ord-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 16px 12px;
    background: #1b3a5c;
    color: #fff;
    flex-shrink: 0;
}

.ord-detail-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ord-detail-header-text strong {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ord-detail-header-text small {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.65);
}

#ord-detail-close {
    all: unset;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    color: rgba(255,255,255,0.7);
    padding: 0 4px;
    flex-shrink: 0;
}
#ord-detail-close:hover { color: #fff; }

.ord-detail-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 4px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    overflow-x: auto;
}

.ord-selector-btn {
    flex-shrink: 0;
    padding: 5px 10px;
    border-radius: 8px;
    border: none;
    background: #f3f4f6;
    color: #374151;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
}
.ord-selector-btn.is-active { background: #e67e22; color: #fff; }

.ord-detail-body {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.ord-detail-meta {
    padding: 12px 16px 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ord-detail-meta-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1b3a5c;
    line-height: 1.35;
}

.ord-detail-vtypes {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ord-vtype-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
    background: #e0e7ef;
    color: #1b3a5c;
    text-transform: uppercase;
}
.ord-vtype-badge--atv, .ord-vtype-badge--utv { background: #fef3c7; color: #92400e; }
.ord-vtype-badge--snowmobile { background: #dbeafe; color: #1e40af; }
.ord-vtype-badge--motorcycle { background: #d1fae5; color: #065f46; }

.ord-tab-bar {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.ord-tab-btn {
    flex: 1;
    padding: 8px 4px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.12s, border-color 0.12s;
}
.ord-tab-btn.is-active { color: #e67e22; border-bottom-color: #e67e22; }

.ord-tab-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Flip viewer */
.ord-flip-viewer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px;
    gap: 10px;
}

.ord-flip-img-wrap {
    width: 100%;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 200px;
}

.ord-flip-img {
    width: 100%;
    height: auto;
    display: block;
}

.ord-flip-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ord-flip-prev, .ord-flip-next {
    all: unset;
    cursor: pointer;
    font-size: 1.5rem;
    color: #1b3a5c;
    padding: 4px 10px;
    border-radius: 8px;
    background: #f3f4f6;
    line-height: 1;
    transition: background 0.1s;
}
.ord-flip-prev:hover, .ord-flip-next:hover { background: #e0e7ef; }
.ord-flip-prev:disabled, .ord-flip-next:disabled { opacity: 0.3; cursor: default; }

.ord-flip-page-label {
    font-size: 0.78rem;
    color: #6b7280;
    min-width: 60px;
    text-align: center;
}

/* Extracted text */
.ord-extracted-text {
    font-family: ui-monospace, monospace;
    font-size: 0.72rem;
    line-height: 1.55;
    color: #374151;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 12px 16px;
    background: #f9fafb;
    border: none;
    margin: 0;
    flex: 1;
}

.ord-viewer-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #9ca3af;
    font-size: 0.8rem;
    padding: 40px 20px;
    flex: 1;
    line-height: 1.6;
}

/* ── Nohvis Ordinances toggle switch ──────────────────────────────────────── */
.ord-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ord-toggle-label {
    font-weight: 700;
    font-size: 0.85rem;
    color: #1b3a5c;
}

.ord-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
    cursor: pointer;
}

.ord-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.ord-switch-track {
    position: absolute;
    inset: 0;
    border-radius: 99px;
    background: #cbd5e1;
    transition: background 0.2s;
}

.ord-switch-track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    transition: transform 0.2s;
}

.ord-switch input:checked + .ord-switch-track {
    background: #e67e22;
}

.ord-switch input:checked + .ord-switch-track::after {
    transform: translateX(18px);
}

.papermaps-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(31, 58, 95, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.papermaps-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    font-size: 0.76rem;
    color: #1b3a5c;
    border-radius: 6px;
}

.papermaps-row:hover {
    background: rgba(31, 58, 95, 0.06);
}

.papermaps-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.papermaps-row-meta {
    margin-left: auto;
    font-size: 0.68rem;
    color: #64748b;
}

/* ── Base layer button grid ──────────────────────────────────────────────── */
.base-layer-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.base-layer-btn {
    padding: 9px 6px !important;
    border-radius: 9px !important;
    border: 2px solid transparent !important;
    background: rgba(255, 255, 255, 0.18) !important;
    color: #e0eaf5 !important;
    font-size: 0.78rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    text-align: center;
}

.base-layer-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
}

.base-layer-btn.is-active {
    background: rgba(230, 126, 34, 0.25) !important;
    border-color: #e67e22 !important;
    color: #fff !important;
    outline: none !important;
    transform: none !important;
}

/* Map panel divider + overlays section */
.map-panel-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 2px 0;
}

.map-section-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 2px;
}

.ord-toggle-sublabel {
    display: block;
    font-size: 0.68rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 1px;
}

.ord-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

/* ── Map Settings Modal ────────────────────────────────────────────────────── */
.map-settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.map-settings-overlay[hidden] { display: none; }

.map-settings-modal {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.22);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-settings-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 14px;
    border-bottom: 1px solid #e5e7eb;
    background: #1b3a5c;
    color: #fff;
}

.map-settings-modal-head h2 {
    font-size: 1rem;
    font-weight: 700;
}

.map-settings-modal-head button {
    all: unset;
    cursor: pointer;
    font-size: 1.4rem;
    line-height: 1;
    color: rgba(255,255,255,0.7);
    padding: 0 4px;
}
.map-settings-modal-head button:hover { color: #fff; }

.map-settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.map-settings-section {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.map-settings-section:last-child { border-bottom: none; }

.map-settings-section h3 {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 2px;
}

.map-settings-section label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1b3a5c;
}

.map-settings-section input[type="text"],
.map-settings-section textarea,
.map-settings-section select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #1b3a5c;
    background: #fff;
    transition: border-color 0.12s;
}

.map-settings-section input:focus,
.map-settings-section textarea:focus,
.map-settings-section select:focus {
    outline: none;
    border-color: #e67e22;
}

.map-settings-section textarea { resize: vertical; min-height: 60px; }

.map-settings-layer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.map-settings-hint {
    font-size: 0.78rem;
    color: #6b7280;
    line-height: 1.4;
}

.map-settings-url-row {
    display: flex;
    gap: 8px;
}

.map-settings-url-row input {
    flex: 1;
    background: #f9fafb;
    cursor: text;
}

.map-settings-url-row button {
    flex-shrink: 0;
    padding: 8px 14px;
    background: #1b3a5c;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}
.map-settings-url-row button:hover { background: #2d5f8a; }

.map-settings-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 14px 20px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

.map-settings-footer button {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
}

#map-settings-cancel {
    background: #f3f4f6;
    color: #374151;
}
#map-settings-cancel:hover { background: #e5e7eb; }

#map-settings-save {
    background: #e67e22;
    color: #fff;
}
#map-settings-save:hover { background: #d35400; }

#top-settings-btn svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
}

/* ── Layer style row (width / dash / border) ──────────────────────────────── */
.layer-style-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 5px 4px 2px;
    border-top: 1px solid rgba(31, 58, 95, 0.08);
    width: 100%;
}

.layer-style-ctrl {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #1b3a5c;
    cursor: pointer;
}

.layer-style-ctrl > span {
    font-weight: 600;
    white-space: nowrap;
}

.layer-num-input {
    width: 42px;
    padding: 2px 4px;
    border: 1px solid #c9d4df;
    border-radius: 5px;
    font-size: 0.75rem;
    text-align: center;
    background: #fff;
    color: #1b3a5c;
}

.layer-num-input:focus {
    outline: none;
    border-color: #e67e22;
}

.layer-dash-select {
    padding: 2px 4px;
    border: 1px solid #c9d4df;
    border-radius: 5px;
    font-size: 0.72rem;
    background: #fff;
    color: #1b3a5c;
    cursor: pointer;
    max-width: 90px;
}

.layer-dash-select:focus {
    outline: none;
    border-color: #e67e22;
}

/* ── Layer Attributes Panel ────────────────────────────────────────────────── */
.layer-attrs-btn {
    margin-left: auto;
    padding: 3px 9px;
    border-radius: 6px;
    border: 1px solid rgba(31,58,95,0.25);
    background: rgba(255,255,255,0.7);
    color: #1b3a5c;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s;
    flex-shrink: 0;
}
.layer-attrs-btn:hover { background: #e0e7ef; }

.layer-attr-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px;
    max-width: 90vw;
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 910;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.layer-attr-panel[hidden] { display: none; }

.layer-attr-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1b3a5c;
    color: #fff;
    flex-shrink: 0;
}
.layer-attr-header strong { font-size: 0.9rem; }
#layer-attr-close {
    all: unset; cursor: pointer; font-size: 1.3rem;
    color: rgba(255,255,255,0.7); padding: 0 4px;
}
#layer-attr-close:hover { color: #fff; }

.layer-attr-body {
    flex: 1;
    overflow-y: auto;
}

.layer-attr-section {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}
.layer-attr-section h4 {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 10px;
}

.lattr-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
}
.lattr-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1b3a5c;
    white-space: nowrap;
}
.lattr-row input[type="color"] {
    width: 36px; height: 28px; padding: 1px 2px;
    border: 1px solid #d1d5db; border-radius: 6px; cursor: pointer;
}
.lattr-row input[type="checkbox"] {
    width: 16px; height: 16px; cursor: pointer; accent-color: #e67e22;
}
.lattr-num {
    width: 64px; padding: 4px 6px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.82rem; text-align: center; color: #1b3a5c;
}
.lattr-num:focus { outline: none; border-color: #e67e22; }
.lattr-select {
    padding: 4px 6px;
    border: 1px solid #d1d5db; border-radius: 6px;
    font-size: 0.8rem; color: #1b3a5c; cursor: pointer;
}
.lattr-select:focus { outline: none; border-color: #e67e22; }

.lattr-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}
.lattr-slider-row input[type="range"] {
    flex: 1;
    accent-color: #e67e22;
}
.lattr-slider-row span {
    font-size: 0.72rem;
    color: #6b7280;
    min-width: 80px;
    text-align: right;
}

.lattr-hint {
    font-size: 0.74rem;
    color: #6b7280;
    line-height: 1.4;
    margin-top: 6px;
}

/* Topbar "Nav" button — distinct orange with arrow icon */
.nav-topbar-btn {
    border: none;
    border-radius: 8px;
    padding: 7px 10px;
    background: #e8550a;
    color: #fff !important;
    font-weight: 700;
    cursor: pointer;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.nav-topbar-btn:hover { background: #c94908; }
.nav-topbar-btn.is-active { background: #c94908; outline: 2px solid #ffd166; }

/* Nav panel — wider than default function panels, same slide animation */
.nav-function-panel {
    width: min(460px, calc(100vw - 88px));
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.nav-function-panel .function-panel-head {
    background: linear-gradient(135deg, #1a3b5b, #234f74);
    color: #f8f7f3;
    padding: 14px 16px;
    flex-shrink: 0;
    margin-bottom: 0;
}

.nav-function-panel .function-panel-head h2 {
    color: #f8f7f3;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.nav-function-panel .function-panel-head button[data-panel-close] {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
}
.nav-function-panel .function-panel-head button[data-panel-close]:hover {
    background: rgba(255,255,255,0.28);
}

/* Panel body scroll */
.nav-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nav-hint {
    font-size: 0.76rem;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
    padding: 8px 10px;
    background: rgba(31,58,95,0.05);
    border-radius: 8px;
    border-left: 3px solid rgba(31,58,95,0.2);
}

/* Waypoint block */
.nav-waypoint {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-waypoint-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1b3a5c;
}

.nav-pin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    font-family: "IBM Plex Mono", monospace;
}
.nav-pin-a { background: #22c55e; }
.nav-pin-b { background: #ef4444; }

.nav-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-input {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid rgba(31,58,95,0.2);
    border-radius: 9px;
    font-size: 0.83rem;
    background: rgba(255,255,255,0.85);
    color: var(--ink);
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.nav-input:focus {
    outline: none;
    border-color: #e8550a;
    box-shadow: 0 0 0 3px rgba(232,85,10,0.12);
}

.nav-map-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(31,58,95,0.08);
    border: 1.5px solid rgba(31,58,95,0.18);
    border-radius: 9px;
    cursor: pointer;
    color: #1b3a5c;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.nav-map-btn:hover { background: rgba(31,58,95,0.15); }
.nav-map-btn.is-active {
    background: #e8550a;
    border-color: #e8550a;
    color: #fff;
}

.nav-coord-tag {
    display: block;
    font-size: 0.7rem;
    font-family: "IBM Plex Mono", monospace;
    color: #6b7280;
    min-height: 1.1em;
    padding-left: 28px;
}

/* Autocomplete dropdown */
.nav-autocomplete {
    background: #fff;
    border: 1px solid rgba(31,58,95,0.18);
    border-radius: 10px;
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    z-index: 20;
}
.nav-geocode-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    font-size: 0.79rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(31,58,95,0.06);
    cursor: pointer;
    color: var(--ink);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: inherit;
}
.nav-geocode-item:last-child { border-bottom: none; }
.nav-geocode-item:hover { background: rgba(31,58,95,0.06); }

/* Swap button */
.nav-swap-row {
    display: flex;
    justify-content: center;
    margin: -4px 0;
}
.nav-swap-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid rgba(31,58,95,0.2);
    background: #fff;
    color: #1b3a5c;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.2s;
}
.nav-swap-btn:hover { background: rgba(31,58,95,0.08); transform: rotate(180deg); }

/* Pick-mode banner */
.nav-pick-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: rgba(232,85,10,0.1);
    border: 1px solid rgba(232,85,10,0.3);
    border-radius: 9px;
    font-size: 0.78rem;
    color: #b84000;
    font-weight: 600;
    animation: navPulse 2s ease infinite;
}
@keyframes navPulse {
    0%, 100% { border-color: rgba(232,85,10,0.3); }
    50%       { border-color: rgba(232,85,10,0.7); }
}
.nav-pick-cancel-btn {
    margin-left: auto;
    border: 1px solid rgba(184,64,0,0.35);
    border-radius: 6px;
    background: transparent;
    color: #b84000;
    padding: 2px 8px;
    font-size: 0.74rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
}

/* Action row */
.nav-actions {
    display: flex;
    gap: 8px;
}
.nav-plan-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    background: #e8550a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, opacity 0.15s;
}
.nav-plan-btn:hover:not(:disabled) { background: #c94908; }
.nav-plan-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.nav-clear-btn {
    padding: 10px 14px;
    background: rgba(31,58,95,0.1);
    color: #1b3a5c;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.nav-clear-btn:hover { background: rgba(31,58,95,0.18); }

/* Results section */
#nav-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-result-error {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    background: rgba(239,68,68,0.07);
    border: 1px solid rgba(239,68,68,0.28);
    border-radius: 10px;
    padding: 12px;
    color: #b91c1c;
    font-size: 0.82rem;
    line-height: 1.5;
}

/* Distance card */
.nav-distance-card {
    background: linear-gradient(135deg, #1a3b5b, #234f74);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    color: #fff;
}
.nav-dist-stat {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex: 1;
    justify-content: center;
}
.nav-dist-val {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: "IBM Plex Mono", monospace;
    line-height: 1;
}
.nav-dist-unit {
    font-size: 0.85rem;
    opacity: 0.75;
    font-weight: 600;
}
.nav-dist-sep {
    width: 1px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    flex-shrink: 0;
}

/* Municipalities card */
.nav-munis-card {
    background: #fff;
    border: 1px solid rgba(31,58,95,0.14);
    border-radius: 12px;
    overflow: hidden;
}
.nav-munis-title {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1b3a5c;
    background: rgba(31,58,95,0.04);
    border-bottom: 1px solid rgba(31,58,95,0.1);
}
.nav-munis-list {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 40px;
}
.nav-munis-loading {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    color: #6b7280;
}
.nav-munis-none {
    font-size: 0.77rem;
    color: #9ca3af;
    line-height: 1.5;
}
.nav-muni-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(31,58,95,0.05);
    border-radius: 8px;
    border: 1px solid rgba(31,58,95,0.1);
}
.nav-muni-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1b3a5c;
    flex: 1;
}
.nav-muni-type {
    font-size: 0.69rem;
    font-weight: 700;
    color: #fff;
    background: #1b3a5c;
    border-radius: 4px;
    padding: 1px 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.nav-muni-county {
    font-size: 0.71rem;
    color: #6b7280;
}

/* Spinner animation */
.nav-spin {
    animation: navSpinAnim 1s linear infinite;
    transform-origin: center;
}
@keyframes navSpinAnim {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

