html,
body {
    height: 100%;
    margin: 0;
    /* font-size: 50px; */
}

:root {
    --shell-bg: #e8eef5;
    --shell-surface: rgba(255, 255, 255, 0.94);
    --shell-surface-strong: #ffffff;
    --shell-panel: #0f172a;
    --shell-panel-muted: #162338;
    --shell-border: #d6e0ea;
    --shell-border-strong: #bfd0e0;
    --shell-text: #10233c;
    --shell-text-muted: #5b6b7d;
    --shell-accent: #0f766e;
    --shell-accent-soft: #dff7f1;
    --shell-accent-strong: #0b5ed7;
    --shell-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    --shell-radius-lg: 22px;
    --shell-radius-md: 16px;
    --shell-radius-sm: 12px;
    --shell-space-1: 0.4rem;
    --shell-space-2: 0.75rem;
    --shell-space-3: 1rem;
    --shell-space-4: 1.35rem;
    --shell-space-5: 1.75rem;
}

body {
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.08), transparent 26%),
        linear-gradient(180deg, #eef4f9 0%, #e7edf5 100%);
    color: var(--shell-text);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

.app-shell[hidden] {
    display: none !important;
}

/* Simple layout that actually works */
.app-container {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    background: transparent;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    /* Important for flexbox */
    position: relative;
}

.header {
    flex-shrink: 0;
}

.tab-content {
    flex: 1;
    padding: 22px;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, rgba(255, 255, 255, 0.98) 100%);
    position: relative;
    z-index: 1;
}

.tab-content.active {
    display: block !important;
}

#map-container {
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 400px;
    min-width: 0;
    /* Reserve space for right sidebars when visible */
    margin-right: 0;
    transition: margin-right 0.3s ease;
    position: relative;
    overflow: hidden;
    --map-right-panel-offset: 0px;
}

#map {
    display: block;
    position: absolute;
    inset: 0 var(--map-right-panel-offset, 0px) 0 0;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 0;
    transition: right 0.3s ease;
}

#map-controls {
    padding: 8px;
    border-bottom: 1px solid #ddd;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.map-provider-selector {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
    color: #666;
}

.map-provider-selector select {
    width: auto;
    padding: 4px 8px;
    font-size: 0.85em;
}

/* Legacy styles - kept for compatibility but not used */
#app {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: 100%;
}

#sidebar {
    padding: 12px;
    border-right: 1px solid #ddd;
    font-family: system-ui, sans-serif;
}

.row {
    margin-bottom: 8px;
}

input,
select,
button,
textarea {
    width: 100%;
    padding: 6px;
}

code {
    background: #f6f8fa;
    padding: 2px 4px;
    border-radius: 4px;
}

.main-content.route-workspace-active {
    display: grid;
    grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
}

.main-content.route-workspace-active .header {
    display: none !important;
}

.main-content.route-workspace-active #route-tab {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #d9e2ec;
    background: linear-gradient(180deg, #fcfdff 0%, #f5f7fb 100%);
    padding: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.main-content.route-workspace-active #map-container {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
}

.route-workspace-shell {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
    gap: 16px;
    padding: 16px 18px 18px;
    box-sizing: border-box;
    overflow: hidden;
}

.workspace-surface {
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.workspace-surface--soft {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.route-workspace-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.route-workspace-summary {
    margin: 0;
    max-width: 32rem;
    font-size: 13px;
    line-height: 1.5;
    color: #52606d;
}

.route-eyebrow {
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    font-weight: 700;
    color: #52606d;
}

.route-workspace-header h3,
.route-saved-header h4,
.route-details-header h4 {
    margin: 0;
    color: #102a43;
}

.route-subtitle {
    margin: 8px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: #52606d;
}

.route-mode-picker {
    min-width: 110px;
}

.route-mode-picker label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #486581;
}

.route-mode-picker select {
    min-height: 42px;
    border: 1px solid #bcccdc;
    border-radius: 12px;
    padding: 0 12px;
    font: inherit;
    background: #fff;
}

.route-workspace-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0;
    background: transparent;
}

.route-workspace-tab,
.route-toolbar-button,
.route-footer-button,
.route-stats-button,
.route-details-tab,
.route-more-menu-item {
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    background: #fff;
    color: #243b53;
    cursor: pointer;
    font: inherit;
}

.route-workspace-tab {
    min-height: 46px;
    padding: 0 14px;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.route-workspace-tab.active,
.route-details-tab.active {
    background: #102a43;
    color: #fff;
    border-color: #102a43;
}

.route-workspace-panel {
    display: none;
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
}

.route-workspace-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

#route-current-panel.route-workspace-panel.active {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    gap: 16px;
    align-content: stretch;
}

.route-current-toolbar,
.route-saved-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 0;
}

.route-current-toolbar {
    align-items: flex-start;
}

.route-current-toolbar-left,
.route-current-toolbar-right,
.route-save-actions,
.route-card-title-row,
.route-footer-actions,
.route-details-tabs,
.route-details-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.route-current-toolbar-right {
    margin-left: auto;
    min-width: 0;
    justify-content: flex-end;
}

.route-selection-summary {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid #d9e2ec;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    font-size: 12px;
    color: #52606d;
    text-align: right;
}

.route-toolbar-button,
.route-footer-button,
.route-stats-button {
    min-height: 42px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.route-stats-button:disabled,
.route-stats-button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.route-workspace-tab:hover,
.route-toolbar-button:hover,
.route-footer-button:hover,
.route-more-menu-item:hover,
.route-stats-button:hover,
.route-saved-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.route-toolbar-button-primary,
.route-details-actions .route-toolbar-button-primary {
    background: #0b6efd;
    color: #fff;
    border-color: #0b6efd;
}

.route-toolbar-button-success {
    background: #1f9d68;
    color: #fff;
    border-color: #1f9d68;
}

.route-toolbar-button-muted {
    background: #52606d;
    color: #fff;
    border-color: #52606d;
}

.route-toolbar-button-subtle {
    background: #e9eef5;
    color: #243b53;
    border-color: #cbd2d9;
}

.route-route-card {
    display: grid;
    flex: 1 1 auto;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto auto;
    min-height: 0;
    height: 100%;
    margin: 0;
    border: 1px solid #d9e2ec;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 24px 56px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.route-card-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.96) 100%);
}

.route-card-status {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    color: #0b6efd;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.route-card-title-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.route-card-date {
    order: 2;
    font-size: 12px;
    color: #52606d;
}

.route-card-title {
    order: 1;
    font-size: 18px;
    color: #102a43;
}

.route-stats-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    background: rgba(248, 251, 255, 0.72);
}

.route-stat {
    padding: 10px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #d9e2ec;
}

.route-stat-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7b8794;
}

.route-empty-state {
    margin: 20px;
    padding: 22px 18px;
    border: 1px dashed #bcccdc;
    border-radius: 16px;
    background: #f8fbff;
    text-align: center;
    color: #52606d;
}

.route-empty-state h4 {
    margin: 0 0 8px;
    color: #102a43;
}

.route-address-picker-card {
    margin: 0;
    min-height: 0;
    max-height: min(38vh, 420px);
    padding: 18px;
    border: 1px solid #d9e2ec;
    border-radius: 22px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
    display: grid;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 12px;
    overflow: hidden;
}

.route-address-picker-card[hidden],
.route-selection-summary[hidden],
#route-add-selected-button[hidden] {
    display: none !important;
}

.route-address-picker-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.route-address-picker-header h4 {
    margin: 0 0 4px;
    color: #102a43;
}

.route-address-picker-header p,
.route-address-picker-status {
    margin: 0;
    color: #52606d;
    font-size: 13px;
}

.route-address-picker-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.route-address-picker-controls {
    display: grid;
    gap: 6px;
}

.route-address-picker-controls label {
    font-size: 12px;
    font-weight: 700;
    color: #486581;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.route-address-picker-controls input {
    min-height: 42px;
    border: 1px solid #bcccdc;
    border-radius: 12px;
    padding: 0 12px;
    font: inherit;
}

.route-address-picker-list {
    display: grid;
    gap: 10px;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding-right: 4px;
}

.route-address-picker-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    padding: 12px;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}

.route-address-picker-row.selected {
    border-color: #0b6efd;
    box-shadow: 0 0 0 1px rgba(11, 110, 253, 0.18);
    background: #f4f8ff;
}

.route-address-picker-row input {
    margin-top: 4px;
}

.route-address-picker-body {
    display: grid;
    gap: 3px;
}

.route-address-picker-name {
    font-weight: 700;
    color: #102a43;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-address-picker-meta,
.route-address-picker-address,
.route-address-picker-empty {
    color: #52606d;
    font-size: 12px;
}

.route-address-picker-meta,
.route-address-picker-address {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-stop-list,
.route-saved-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 18px 20px;
}

.route-stop-card {
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.route-stop-row {
    display: grid;
    grid-template-columns: 28px 36px minmax(88px, 108px) minmax(0, 1fr) 28px;
    gap: 10px;
    align-items: start;
    padding: 12px;
}

.route-drag-handle,
.route-stop-remove {
    width: 28px;
    min-height: 28px;
    padding: 0;
    font-size: 16px;
    color: #486581;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    font: inherit;
}

.route-stop-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: #e8eef5;
    color: #102a43;
    font-size: 14px;
    font-weight: 700;
}

.route-drag-handle {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    letter-spacing: -0.12em;
    font-weight: 700;
}

.route-stop-schedule {
    display: grid;
    gap: 2px;
    align-self: stretch;
    align-content: start;
}

.route-time-chip,
.route-length-chip {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: fit-content;
    min-height: auto;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.route-time-chip {
    font-size: 0.98rem;
    line-height: 1.1;
    font-weight: 800;
    color: #102a43;
}

.route-length-chip {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #6b7c93;
}

.route-stop-name-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 3px;
    width: 100%;
    min-width: 0;
    min-height: auto;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.route-stop-address {
    display: block;
    font-size: 0.98rem;
    line-height: 1.3;
    font-weight: 700;
    color: #102a43;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
}

.route-stop-meta {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    color: #7b8794;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.route-drag-handle:hover,
.route-stop-remove:hover,
.route-time-chip:hover,
.route-length-chip:hover,
.route-stop-name-button:hover {
    color: #0f766e;
}

.route-drag-handle:focus-visible,
.route-stop-remove:focus-visible,
.route-time-chip:focus-visible,
.route-length-chip:focus-visible,
.route-stop-name-button:focus-visible {
    outline: 2px solid rgba(15, 118, 110, 0.28);
    outline-offset: 3px;
    border-radius: 10px;
}

.route-travel-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px 12px 56px;
    color: #52606d;
    font-size: 12px;
}

.route-inline-editor {
    margin: 0 12px 12px 52px;
    padding: 14px;
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
    display: grid;
    gap: 12px;
}

.route-inline-editor-time-fields,
.route-inline-editor-length-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.route-inline-editor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-top: 1px solid rgba(188, 204, 220, 0.9);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.route-inline-editor-input {
    min-height: 40px;
    border: 1px solid #bcccdc;
    border-radius: 10px;
    background: #fff;
    color: #102a43;
    font: inherit;
}

.route-inline-editor-input-time {
    width: 68px;
    text-align: center;
    padding: 0 10px;
}

.route-inline-editor-input-length {
    width: 96px;
    text-align: right;
    padding: 0 12px;
}

.route-inline-editor-separator,
.route-inline-editor-unit {
    color: #52606d;
    font-weight: 700;
}

.route-inline-editor-toggle,
.route-inline-editor-button {
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid #bcccdc;
    border-radius: 10px;
    background: #f8fafc;
    color: #334155;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.route-inline-editor-toggle {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

.route-inline-editor-button:hover,
.route-inline-editor-toggle:hover {
    border-color: #94a3b8;
    background: #fff;
}

.route-inline-editor-button:focus-visible,
.route-inline-editor-toggle:focus-visible,
.route-inline-editor-input:focus-visible {
    outline: 2px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.route-inline-editor-button:not(.route-inline-editor-button-primary) {
    background: #fff;
}

.route-inline-editor-button-primary {
    border-color: #1d4ed8;
    background: #2563eb;
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.route-inline-editor-button-primary:hover {
    border-color: #1e40af;
    background: #1d4ed8;
}

.route-inline-editor-label {
    font-size: 12px;
    font-weight: 700;
    color: #486581;
}

.route-travel-rule {
    flex: 1;
    height: 1px;
    background: #d9e2ec;
}

.route-save-form {
    margin: 0 20px 18px;
    padding: 16px;
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 255, 0.94) 100%);
    display: grid;
    gap: 14px;
}

.route-save-form[hidden] {
    display: none !important;
}

.route-save-field {
    display: grid;
    gap: 8px;
}

.route-save-form label span {
    font-size: 12px;
    font-weight: 700;
    color: #486581;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.route-save-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.route-save-field input,
.route-save-field select {
    min-height: 44px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid #bcccdc;
    border-radius: 12px;
    padding: 0 12px;
    background: #fff;
    color: #102a43;
    font: inherit;
}

.route-save-field select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #486581 50%),
        linear-gradient(135deg, #486581 50%, transparent 50%);
    background-position:
        calc(100% - 18px) calc(50% - 3px),
        calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

.route-save-member-status {
    margin: -4px 0 0;
    font-size: 12px;
    color: #52606d;
}

.route-save-member-status[data-variant="loading"] {
    color: #1d4ed8;
}

.route-save-member-status[data-variant="error"] {
    color: #b42318;
}

.route-save-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.route-footer-actions {
    padding: 16px 20px 20px;
    border-top: 1px solid #e2e8f0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 251, 255, 0.9) 100%);
}

.route-more-menu-shell {
    position: relative;
}

.route-more-menu-shell.is-open #route-more-button {
    background: #102a43;
    color: #fff;
    border-color: #102a43;
}

.route-more-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 196px;
    padding: 10px;
    border: 1px solid #d6e0ea;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 44px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
    display: grid;
    gap: 6px;
    z-index: 80;
    transform-origin: bottom right;
}

.route-more-menu[hidden] {
    display: none !important;
}

.route-more-menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.route-more-menu-item:disabled,
.route-more-menu-item[aria-disabled="true"] {
    opacity: 0.52;
    cursor: not-allowed;
    box-shadow: none;
}

.route-saved-list {
    display: grid;
    gap: 10px;
}

#route-saved-list {
    padding: 2px 0 0;
}

.route-delete-dialog-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(17, 24, 39, 0.2);
    backdrop-filter: blur(2px);
    z-index: 400;
}

.route-delete-dialog-overlay[hidden] {
    display: none !important;
}

.route-delete-dialog {
    width: min(420px, 100%);
    border-radius: 20px;
    padding: 20px;
    background: #fffdfa;
    border: 1px solid #eadfcd;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
}

.route-delete-dialog h4 {
    margin: 4px 0 8px;
    font-size: 1.1rem;
    color: #1f2937;
}

.route-delete-dialog-copy {
    margin: 0;
    color: #4b5563;
    line-height: 1.5;
}

.route-delete-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.workspace-section-label {
    margin: 0 0 6px;
    color: #2563eb;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.history-workspace-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 18px;
    min-height: 100%;
    height: 100%;
}

.teams-workspace-shell {
    display: grid;
    gap: 18px;
}

.future-workspace-shell {
    display: grid;
    gap: 18px;
}

.teams-summary-card,
.teams-members-card {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.teams-summary-card {
    padding: 20px 22px;
}

.teams-summary-card--hero {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.teams-summary-heading {
    display: block;
}

.teams-summary-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.teams-summary-title {
    margin: 0;
    color: #102a43;
}

.teams-summary-copy {
    margin: 10px 0 0;
    color: #52606d;
    line-height: 1.6;
    max-width: 42rem;
}

.teams-refresh-button {
    flex-shrink: 0;
    padding: 0 16px;
}

.teams-summary-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.teams-summary-stat {
    padding: 14px 16px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid #d9e2ec;
}

.teams-summary-stat__label {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.teams-summary-stat__value {
    color: #102a43;
    font-size: 26px;
    font-weight: 700;
}

.teams-members-card {
    padding: 20px 22px;
}

.teams-members-status {
    padding: 14px 16px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid #d9e2ec;
    color: #243b53;
}

.teams-members-status[data-variant="loading"] {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.teams-members-status[data-variant="error"] {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.teams-members-status[data-variant="empty"] {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.teams-members-list {
    display: grid;
    gap: 14px;
}

.teams-member-card {
    padding: 16px 18px;
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    background: #f8fbff;
}

.teams-member-card--current {
    border-color: #93c5fd;
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}

.teams-member-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.teams-member-card__name {
    margin: 0;
    color: #102a43;
}

.teams-member-card__username {
    margin: 6px 0 0;
    color: #52606d;
}

.teams-member-card__badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.teams-member-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #243b53;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.teams-member-badge--accent {
    background: #dbeafe;
    color: #1d4ed8;
}

.teams-member-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin-top: 14px;
    color: #52606d;
    font-size: 14px;
}

.future-workspace-card {
    padding: 20px 22px;
}

.future-workspace-card--hero {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.future-workspace-title {
    margin: 0;
    color: #102a43;
}

.future-workspace-copy {
    margin: 10px 0 0;
    color: #52606d;
    line-height: 1.6;
    max-width: 48rem;
}

.future-workspace-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.future-workspace-list__item {
    padding: 14px 16px;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #f8fbff;
    color: #243b53;
    font-weight: 600;
}

.history-summary-card,
.history-card,
.segments-pane-intro,
.segments-admin-intro,
.teams-summary-card,
.teams-members-card,
.future-workspace-card {
    background: #fff;
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
}

.history-summary-card {
    padding: 18px 20px;
}

.history-summary-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

@media (max-width: 720px) {
    .teams-member-card__header {
        flex-direction: column;
    }

    .teams-summary-actions {
        justify-content: flex-start;
    }

    .teams-summary-stats {
        grid-template-columns: 1fr;
    }

    .teams-member-card__badges {
        justify-content: flex-start;
    }
}

.history-summary-stat {
    padding: 14px 16px;
    border-radius: 14px;
    background: #f8fbff;
    border: 1px solid #d9e2ec;
}

.history-summary-stat__label {
    display: block;
    margin-bottom: 4px;
    color: #64748b;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.history-workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.6fr);
    gap: 18px;
    min-height: 0;
    height: 100%;
}

#history-tab {
    min-height: 0;
    height: 100%;
}

#history-tab.active {
    display: flex !important;
    flex-direction: column;
}

.history-card {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}

.history-card--disclosure {
    padding: 0;
}

.workspace-disclosure {
    border-radius: inherit;
}

.workspace-disclosure[open] {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.workspace-disclosure__summary {
    list-style: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    cursor: pointer;
}

.workspace-disclosure__summary::-webkit-details-marker {
    display: none;
}

.workspace-disclosure__meta {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workspace-disclosure__icon {
    color: #52606d;
    font-size: 0.82rem;
    font-weight: 700;
    transition: transform 0.2s ease;
}

.workspace-disclosure[open] .workspace-disclosure__icon {
    transform: rotate(180deg);
}

.workspace-disclosure__body {
    display: grid;
    gap: 12px;
    padding: 0 20px 18px;
}

.history-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.history-card__title,
.segments-pane-intro__title,
.segments-admin-intro__title {
    margin: 0;
    color: #0f172a;
}

.history-search-controls {
    display: grid;
    gap: 8px;
}

.history-search-controls input {
    min-height: 44px;
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    padding: 0 12px;
    font: inherit;
}

.history-search-actions,
.history-quick-actions {
    display: grid;
    gap: 8px;
}

.history-search-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.history-quick-actions {
    grid-template-columns: 1fr;
}

.history-action-button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.history-action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.history-action-button-primary {
    background: #0b6efd;
    color: #fff;
}

.history-action-button-secondary {
    background: #0f766e;
    color: #fff;
}

.history-action-button-success {
    background: #1f9d68;
    color: #fff;
}

.history-action-button-muted {
    background: #52606d;
    color: #fff;
}

.history-action-button-danger {
    background: #c53030;
    color: #fff;
}

.history-results-surface {
    flex: 1;
    min-height: 320px;
    overflow-y: auto;
    border: 1px solid #d9e2ec;
    border-radius: 14px;
    background: #fff;
}

.history-results-empty {
    padding: 20px;
    text-align: center;
    color: #666;
}

.history-results-empty__icon {
    font-size: 1.4rem;
}

.history-results-empty__title {
    margin-top: 8px;
    font-weight: 700;
    color: #243b53;
}

.history-results-empty__meta {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #52606d;
}

.history-item {
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
}

.history-item:last-child {
    border-bottom: none;
}

.history-item__content {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.history-item__body {
    flex: 1;
    min-width: 0;
}

.history-query {
    font-weight: 700;
    font-size: 0.92rem;
    color: #102a43;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-address {
    margin: 3px 0;
    font-size: 0.82rem;
    color: #52606d;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    font-size: 0.72rem;
    color: #7b8794;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-delete-button {
    min-height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: 10px;
    background: #fee2e2;
    color: #b42318;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
}

.segments-workspace-shell {
    display: flex;
    height: calc(100vh - 60px);
    background: #f8f9fa;
    border: 1px solid #d9e2ec;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.08);
}

.segments-filter-pane {
    width: 300px;
    background: #fff;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.segments-pane-intro {
    margin: 16px 16px 0;
    padding: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.segments-pane-intro__copy,
.segments-admin-intro__copy {
    margin: 8px 0 0;
    color: #52606d;
    line-height: 1.5;
}

.segments-search-toolbar {
    margin: 12px 16px 0;
    padding: 16px;
    display: grid;
    gap: 10px;
}

.segments-manage-disclosure {
    margin: 12px 16px 0;
}

.segments-search-input {
    width: 100%;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    font: inherit;
    box-sizing: border-box;
}

.segments-manage-button {
    min-height: 40px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #0f766e 0%, #0b5ed7 100%);
    color: #fff;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.segments-filter-list-shell {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fff;
}

.segments-filter-list-frame {
    border-top: 1px solid #e2e8f0;
    padding-top: 12px;
}

.segments-filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.segments-filter-action-button {
    min-height: 38px;
    padding: 8px 12px;
    border: none;
    border-radius: 10px;
    color: #fff;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.segments-filter-action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
}

.segments-filter-action-button--muted {
    background: #6c757d;
}

.segments-filter-action-button--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.segments-filter-summary {
    font-size: 0.72rem;
    color: #6c757d;
    text-align: center;
}

.segments-filter-empty {
    padding: 24px 16px;
    text-align: center;
    color: #6c757d;
}

.segments-filter-empty--error {
    color: #b42318;
}

.segments-filter-empty__icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.65;
}

.segments-filter-empty__title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #243b53;
}

.segments-filter-empty--error .segments-filter-empty__title {
    color: #b42318;
}

.segments-filter-empty__copy {
    margin-top: 6px;
    font-size: 0.76rem;
    line-height: 1.5;
}

.segments-filter-hero {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 14px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0f766e 0%, #0b5ed7 100%);
    color: #fff;
}

.segments-filter-hero__icon {
    font-size: 1rem;
}

.segments-filter-hero__title {
    font-size: 0.95rem;
    font-weight: 700;
}

.segments-filter-hero__copy {
    margin-top: 2px;
    font-size: 0.72rem;
    opacity: 0.92;
}

.segments-map-panel {
    flex: 1;
    position: relative;
    background: #fff;
    border-left: 1px solid #e2e8f0;
}

.segments-map-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #52606d;
    font-size: 1rem;
    text-align: center;
}

.segments-admin-shell {
    display: grid;
    gap: 20px;
    padding: 16px 20px 24px;
}

.segments-admin-intro {
    display: grid;
    gap: 8px;
    padding: 20px 22px;
    border: 1px solid #d9e2ec;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.segments-admin-create-card,
.segments-admin-stats-card,
.segments-admin-list-card,
.segments-admin-actions-card {
    border: 1px solid #d9e2ec;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.segments-admin-create-section.collapsible-search {
    border: 0;
    background: transparent;
}

.segments-admin-create-toggle.collapsible-search-header {
    width: 100%;
    border: 0;
    background: linear-gradient(135deg, #1f9d68 0%, #0f766e 100%);
    color: #fff;
}

.segments-admin-create-toggle .collapsible-search-title,
.segments-admin-create-toggle .collapsible-search-toggle {
    color: inherit;
}

.segments-admin-form {
    gap: 14px;
    padding: 20px;
}

.segments-admin-field {
    display: grid;
    gap: 8px;
}

.segments-admin-field label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #486581;
}

.segments-admin-field input,
.segments-admin-field select,
.segments-admin-field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    background: #fff;
    color: #102a43;
    font: inherit;
    box-sizing: border-box;
}

.segments-admin-field textarea {
    min-height: 92px;
    resize: vertical;
}

.segments-admin-preview {
    min-height: 18px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8fbff;
    color: #52606d;
    font-size: 0.82rem;
}

.segments-admin-primary-button,
.segments-admin-secondary-button {
    min-height: 42px;
    border: none;
    border-radius: 12px;
    padding: 0 16px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
}

.segments-admin-primary-button {
    background: linear-gradient(135deg, #1f9d68 0%, #0f766e 100%);
    color: #fff;
    box-shadow: 0 12px 28px rgba(15, 118, 110, 0.18);
}

.segments-admin-secondary-button {
    background: #0b6efd;
    color: #fff;
}

.segments-admin-secondary-button--muted {
    background: #52606d;
}

.segments-admin-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 22px 0;
}

.segments-admin-card-header--stacked {
    padding-bottom: 16px;
}

.segments-admin-stats-card {
    padding: 0 0 22px;
    background: linear-gradient(135deg, #1d4ed8 0%, #0f766e 100%);
    color: #fff;
}

.segments-admin-stats-card .workspace-section-label,
.segments-admin-stats-card .segments-admin-intro__title,
.segments-admin-stats-card .segments-admin-intro__copy {
    color: inherit;
}

.segments-admin-stats-card .segments-admin-intro__copy {
    opacity: 0.82;
}

.segments-admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 0 22px;
}

.segments-admin-stat {
    padding: 14px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.18);
    text-align: center;
    backdrop-filter: blur(8px);
}

.segments-admin-stat__label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.82;
}

.segments-admin-stat strong {
    font-size: 1.25rem;
}

.segments-admin-list-card {
    padding-bottom: 22px;
}

.segments-admin-list-surface {
    max-height: 520px;
    overflow-y: auto;
    margin: 18px 22px 0;
    padding: 18px;
    border: 1px solid #d9e2ec;
    border-radius: 18px;
    background: #f8fbff;
}

.segments-admin-empty {
    padding: 34px 18px;
    border: 1px dashed #bcccdc;
    border-radius: 18px;
    text-align: center;
    background: #fff;
    color: #52606d;
}

.segments-admin-empty__icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.segments-admin-empty__title {
    margin-bottom: 6px;
    font-size: 1rem;
    font-weight: 700;
    color: #102a43;
}

.segments-admin-empty__copy {
    font-size: 0.9rem;
    line-height: 1.5;
}

.segments-admin-actions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.route-saved-row {
    display: grid;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    background: #fff;
}

.route-saved-row-renaming {
    align-items: stretch;
}

.route-saved-open {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.route-saved-actions {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.route-saved-action {
    border: 1px solid #cbd2d9;
    background: #f8fafc;
    color: #243b53;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.route-saved-action-primary {
    background: #0b6efd;
    border-color: #0b6efd;
    color: #fff;
}

.route-saved-action-danger {
    background: #fff5f5;
    border-color: #f3c4c4;
    color: #b42318;
}

.route-saved-rename-form {
    display: grid;
    gap: 10px;
    width: 100%;
}

.route-saved-rename-label {
    font-size: 12px;
    font-weight: 700;
    color: #486581;
}

.route-saved-rename-input {
    width: 100%;
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    color: #102a43;
    background: #fff;
}

.route-saved-date {
    font-size: 12px;
    color: #7b8794;
}

.route-saved-name {
    font-size: 15px;
    font-weight: 700;
    color: #102a43;
    overflow-wrap: anywhere;
}

.route-saved-meta {
    font-size: 12px;
    color: #52606d;
    overflow-wrap: anywhere;
}

.route-legacy-tools {
    margin: 0;
    border: 1px solid #d9e2ec;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    padding: 14px 16px;
    display: grid;
    gap: 14px;
}

.route-legacy-tools[hidden] {
    display: none !important;
}

.route-legacy-tools summary {
    cursor: pointer;
    font-weight: 700;
    color: #243b53;
}

.route-legacy-row {
    display: grid;
    gap: 8px;
}

.route-legacy-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.route-legacy-actions--stack {
    margin-top: 0;
}

.route-legacy-note {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #52606d;
}

.route-legacy-note--inline {
    font-size: 12px;
}

.route-legacy-panel,
.route-legacy-subpanel {
    margin-top: 8px;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    padding: 10px;
    background: #fff;
}

.route-legacy-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.route-legacy-inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #486581;
}

.route-legacy-inline-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.route-legacy-results {
    display: grid;
    gap: 6px;
}

.route-details-drawer {
    position: absolute;
    top: 24px;
    right: 24px;
    bottom: 24px;
    width: min(360px, calc(100% - 48px));
    display: flex;
    flex-direction: column;
    border: 1px solid #d9e2ec;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
    z-index: 20;
    overflow: hidden;
}

.route-details-drawer[hidden] {
    display: none !important;
}

.main-content:not(.route-workspace-active) .route-details-drawer {
    display: none !important;
}

.route-details-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 18px 18px 12px;
    border-bottom: 1px solid #e2e8f0;
}

.route-details-close {
    border: none;
    background: transparent;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #52606d;
}

.route-details-tabs {
    padding: 12px 18px 0;
}

.route-details-tab {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
}

.route-details-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    color: #243b53;
}

.route-details-section {
    display: grid;
    gap: 12px;
}

.route-details-field {
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.route-details-field-label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7b8794;
}

.route-details-field-value {
    font-size: 14px;
    line-height: 1.5;
    color: #102a43;
}

.route-details-actions {
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 18px 18px;
    border-top: 1px solid #e2e8f0;
    background: rgba(248, 251, 255, 0.9);
}

.route-map-marker {
    width: 40px;
    height: 40px;
}

.route-map-marker-draft .app-map-marker__chip {
    border-style: dashed;
}

.route-map-marker-saved .app-map-marker__chip {
    border-style: solid;
}

@media (max-width: 1100px) {
    .main-content.route-workspace-active {
        grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .main-content.route-workspace-active {
        display: flex;
        flex-direction: column;
    }

    .main-content.route-workspace-active .header {
        order: 0;
    }

    .main-content.route-workspace-active #route-tab {
        border-right: none;
        border-bottom: 1px solid #d9e2ec;
        max-height: 52vh;
        order: 1;
        overflow-y: auto;
    }

    .main-content.route-workspace-active #map-container {
        min-height: 48vh;
        order: 2;
    }

    .route-workspace-shell {
        height: auto;
        min-height: 0;
        padding: 0;
        overflow: visible;
    }

    #route-current-panel.route-workspace-panel.active {
        grid-template-rows: auto auto auto auto;
        overflow: visible;
    }

    .route-route-card {
        height: auto;
    }

    .route-address-picker-card {
        max-height: none;
    }

    .route-stop-list,
    .route-saved-list {
        max-height: min(52vh, 560px);
    }

    .route-details-drawer {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto;
    }

    .history-workspace-grid {
        grid-template-columns: 1fr;
    }

    .history-summary-stats {
        grid-template-columns: 1fr;
    }
}

/* Route workspace final overrides against legacy global form/layout rules. */
.main-content.route-workspace-active {
    display: grid !important;
    grid-template-columns: minmax(340px, 430px) minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
}

.main-content.route-workspace-active .header {
    grid-column: 1 / -1;
}

.main-content.route-workspace-active #route-tab {
    width: auto;
    max-width: none;
    max-height: none;
    height: 100%;
    min-height: 0;
    align-self: stretch;
}

.main-content.route-workspace-active .route-workspace-shell button,
.main-content.route-workspace-active .route-workspace-shell select {
    width: auto;
}

.main-content.route-workspace-active .route-workspace-shell input,
.main-content.route-workspace-active .route-workspace-shell textarea,
.main-content.route-workspace-active .route-save-form input {
    width: 100%;
}

.main-content.route-workspace-active .route-workspace-tabs,
.main-content.route-workspace-active .route-stats-summary {
    width: auto;
}

.main-content.route-workspace-active .route-current-toolbar-left,
.main-content.route-workspace-active .route-save-actions,
.main-content.route-workspace-active .route-footer-actions,
.main-content.route-workspace-active .route-details-tabs {
    flex-wrap: wrap;
}

.main-content.route-workspace-active .route-current-toolbar-left .route-toolbar-button,
.main-content.route-workspace-active .route-footer-actions .route-footer-button,
.main-content.route-workspace-active .route-details-actions .route-toolbar-button {
    flex: 0 0 auto;
}

.main-content.route-workspace-active .route-mode-picker select {
    width: 100%;
}

@media (max-width: 900px) {
    .main-content.route-workspace-active {
        display: flex !important;
        flex-direction: column !important;
    }
}

/* Auth modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    min-width: 320px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

#auth-modal.auth-entry-screen {
    background:
        radial-gradient(circle at top left, rgba(45, 212, 191, 0.2), transparent 32%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.2), transparent 30%),
        linear-gradient(135deg, #0f172a 0%, #152238 42%, #1f3a5f 100%);
    padding: 24px;
    box-sizing: border-box;
    overflow-y: auto;
}

.auth-entry-panel {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
    gap: 32px;
    align-items: stretch;
    padding: clamp(20px, 3vw, 36px);
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 30px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.6) 0%, rgba(15, 23, 42, 0.34) 100%);
    box-shadow: 0 30px 80px rgba(2, 6, 23, 0.42);
    backdrop-filter: blur(14px);
}

.auth-entry-copy {
    color: #f8fafc;
    padding: 40px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-entry-eyebrow,
.auth-card-eyebrow {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 12px;
    font-weight: 700;
}

.auth-entry-eyebrow {
    color: #93c5fd;
}

.auth-entry-copy h1 {
    margin: 0 0 16px;
    font-size: clamp(2.1rem, 4vw, 3.3rem);
    line-height: 1.05;
}

.auth-entry-description {
    margin: 0;
    max-width: 34rem;
    color: rgba(248, 250, 252, 0.78);
    font-size: 1.02rem;
    line-height: 1.6;
}

.auth-entry-points {
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 12px;
    max-width: 32rem;
}

.auth-entry-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(191, 219, 254, 0.16);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.22);
    color: rgba(248, 250, 252, 0.92);
    line-height: 1.5;
}

.auth-entry-points li::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #34d399 0%, #38bdf8 100%);
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.12);
    flex-shrink: 0;
}

.auth-entry-proof {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    max-width: 34rem;
}

.auth-entry-proof__item {
    display: grid;
    gap: 6px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(191, 219, 254, 0.14);
}

.auth-entry-proof__item strong {
    color: #f8fafc;
    font-size: 0.95rem;
}

.auth-entry-proof__item span {
    color: rgba(226, 232, 240, 0.86);
    font-size: 0.9rem;
    line-height: 1.5;
}

.auth-entry-card {
    align-self: center;
    width: min(420px, 100%);
    min-width: 0;
    padding: 2rem;
    box-sizing: border-box;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.97) 100%);
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.28);
}

.auth-entry-card__header {
    margin-bottom: 18px;
}

.auth-card-eyebrow {
    color: #2563eb;
}

.auth-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-card-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #ecfeff;
    border: 1px solid #bae6fd;
    color: #0f766e;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-entry-card h3 {
    margin: 0;
    margin-bottom: 8px;
}

.auth-card-subtitle {
    margin: 0 0 16px;
    color: #475569;
    line-height: 1.5;
}

.auth-form-stack {
    display: grid;
    gap: 12px;
}

.modal-content:not(.auth-entry-card) h3 {
    margin-top: 0;
    text-align: center;
}

.app-form-stack .app-form-control,
.modal-content:not(.auth-entry-card) input {
    width: 100%;
    margin: 0;
}

.auth-form-field {
    display: grid;
    gap: 7px;
}

.auth-form-label {
    color: #334155;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-entry-card .app-form-control {
    min-height: 50px;
    padding: 0.85rem 0.95rem;
    border-color: #cbd5e1;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
}

.auth-form-button {
    width: 100%;
    min-height: 48px;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
    font-size: 0.94rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.auth-form-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.auth-form-button--primary {
    background: linear-gradient(135deg, #0f766e 0%, #0b5ed7 100%);
    color: #fff;
    box-shadow: 0 18px 34px rgba(11, 94, 215, 0.18);
}

.auth-form-button--secondary {
    background: #f8fafc;
    color: #0f4c81;
    border-color: #cbd5e1;
}

.auth-form-note--compact {
    margin: 2px 0 0;
    font-size: 0.84rem;
    text-align: center;
}

.auth-card-footer {
    display: grid;
    gap: 4px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #e2e8f0;
}

.auth-card-footer__title {
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-card-footer__text {
    color: #64748b;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Modal overlay for segment management */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content:not(.auth-entry-card) button {
    width: 100%;
    margin: 0.25rem 0;
    padding: 0.8rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.modal-content:not(.auth-entry-card) button:first-of-type {
    background: #007bff;
    color: white;
}

.modal-content:not(.auth-entry-card) button:first-of-type:hover {
    background: #0056b3;
}

.modal-content:not(.auth-entry-card) button:last-of-type {
    background: #f8f9fa;
    color: #007bff;
    border: 1px solid #ddd;
}

.modal-content:not(.auth-entry-card) button:last-of-type:hover {
    background: #e2e6ea;
}

.app-modal-overlay {
    padding: 24px;
    box-sizing: border-box;
}

.app-modal-card {
    width: min(560px, 100%);
    max-height: min(80vh, 720px);
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 22px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

.app-modal-card--wide {
    width: min(680px, 100%);
}

.app-modal-title {
    margin: 0;
    color: #102a43;
    font-size: 1.2rem;
}

.app-modal-copy {
    margin: 6px 0 0;
    color: #52606d;
    font-size: 0.92rem;
    line-height: 1.5;
}

.app-modal-body {
    display: grid;
    gap: 14px;
    min-height: 0;
}

.app-modal-scroll {
    overflow-y: auto;
    min-height: 0;
}

.app-modal-section {
    display: grid;
    gap: 8px;
}

.app-modal-label {
    font-size: 12px;
    font-weight: 700;
    color: #486581;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.app-modal-field,
.app-modal-field-row input,
.app-modal-field-row select,
.app-modal-field-row textarea {
    width: 100%;
    box-sizing: border-box;
}

.app-modal-field-row {
    display: grid;
    gap: 8px;
}

.app-form-stack {
    display: grid;
    gap: 12px;
}

.app-form-field {
    display: grid;
    gap: 6px;
}

.app-form-field--compact {
    justify-items: start;
}

.app-form-label {
    color: var(--shell-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-form-control,
.app-form-field-row input,
.app-form-field-row select,
.app-form-field-row textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: 42px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--shell-text);
    font: inherit;
}

.app-form-control:focus,
.app-form-field-row input:focus,
.app-form-field-row select:focus,
.app-form-field-row textarea:focus {
    outline: none;
    border-color: #7eb1e9;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.app-form-control--compact {
    width: min(124px, 100%);
}

.app-form-note {
    margin: 0;
    color: #52606d;
    font-size: 0.78rem;
    line-height: 1.55;
}

.app-form-note[hidden] {
    display: none !important;
}

.app-form-note--warning {
    color: #b45309;
}

.app-form-checkbox-list {
    display: grid;
    gap: 10px;
}

.app-form-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    background: #fff;
    color: var(--shell-text);
    cursor: pointer;
    line-height: 1.4;
}

.app-form-checkbox-item input[type="checkbox"] {
    margin: 2px 0 0;
}

.app-form-actions {
    display: grid;
    gap: 10px;
}

.app-form-actions--inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.app-form-button {
    width: 100%;
    min-height: 42px;
    padding: 0.72rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.app-form-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.app-form-button--info {
    background: #12749c;
}

.app-form-button--muted {
    background: #52606d;
}

.app-form-button--danger {
    background: #c53030;
}

.app-form-button--success {
    background: #1f9d5b;
}

.app-modal-field-row input,
.app-modal-field-row select,
.app-modal-field-row textarea {
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    background: #fff;
    color: #102a43;
    font: inherit;
}

.app-modal-field-row textarea {
    min-height: 84px;
    resize: vertical;
}

.app-modal-field-inline {
    display: grid;
    grid-template-columns: 60px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
}

.app-modal-list {
    max-height: 160px;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid #d9e2ec;
    border-radius: 16px;
    background: #f8fbff;
}

.app-modal-list-item {
    padding: 6px 0;
    color: #243b53;
    font-size: 0.92rem;
}

.app-modal-empty {
    padding: 18px 16px;
    border: 1px dashed #bcccdc;
    border-radius: 16px;
    background: #f8fbff;
    text-align: center;
    color: #52606d;
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.app-modal-button {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #cbd2d9;
    border-radius: 12px;
    background: #fff;
    color: #243b53;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
}

.app-modal-button--primary {
    background: #0b6efd;
    border-color: #0b6efd;
    color: #fff;
}

.app-modal-button--success {
    background: #1f9d68;
    border-color: #1f9d68;
    color: #fff;
}

.app-modal-button--muted {
    background: #52606d;
    border-color: #52606d;
    color: #fff;
}

.app-modal-highlight {
    padding: 14px 16px;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid #d9e2ec;
}

.app-modal-highlight strong {
    display: block;
    margin-bottom: 4px;
    color: #102a43;
}

.assignment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    background: #fff;
}

.assignment-remove-button {
    min-width: 28px;
    height: 28px;
    border: none;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.user-info {
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-display-user-info {
    display: grid !important;
    gap: 14px;
    position: relative;
    margin: 0;
    padding: 18px;
    border: 1px solid rgba(191, 208, 224, 0.92);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(245, 250, 255, 0.92) 100%);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.map-display-user-info::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 20px 0 0 20px;
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.7) 0%, rgba(11, 94, 215, 0.55) 100%);
}

.map-display-user-info__identity {
    display: grid;
    gap: 6px;
    min-width: 0;
    padding-left: 14px;
}

.map-display-user-info__eyebrow {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.map-display-user-info__label {
    min-width: 0;
    color: var(--shell-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.map-display-user-info__logout {
    width: auto;
    min-height: 40px;
    justify-self: start;
    margin-left: 14px;
    padding: 0 14px;
    border: 1px solid rgba(184, 28, 28, 0.18);
    border-radius: 999px;
    background: rgba(254, 242, 242, 0.96);
    color: #b42318;
    font-size: 0.85rem;
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.map-display-user-info__logout:hover,
.map-display-user-info__logout:focus-visible {
    background: #fee2e2;
    border-color: rgba(184, 28, 28, 0.28);
    color: #991b1b;
    outline: none;
}

.shell-user-info {
    margin-bottom: 0;
    padding: 0.7rem 0.75rem;
    min-width: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    color: #f8fbff;
    gap: 10px;
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.shell-user-info__label {
    font-weight: 600;
    max-width: 11rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shell-user-info__logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #dbe7f5;
    font-weight: 700;
    white-space: nowrap;
    border-radius: 12px;
    padding: 0.45rem 0.55rem;
    transition: background 0.2s ease, color 0.2s ease;
}

.shell-user-info__logout:hover,
.shell-user-info__logout:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    outline: none;
}

.shell-user-info__logout-icon {
    width: 18px;
    height: 18px;
}

.shell-user-info__logout-label {
    white-space: nowrap;
}

.logout-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font-size: 0.82em;
}

/* Sidebar-specific user info styling */
.sidebar .user-info {
    margin: 0;
}

.sidebar .logout-btn {
    color: inherit;
}

#app-header {
    display: none !important;
    min-height: 0;
}

.app-shell-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 16px 20px 14px;
    margin-right: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(244, 247, 251, 0.96) 100%);
    border-bottom: 1px solid var(--shell-border);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
    backdrop-filter: blur(18px);
    transition: margin-right 0.3s ease;
}

.address-sidebar.visible~.main-content .app-shell-header {
    margin-right: 360px;
}

.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 10px 14px;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    background: linear-gradient(180deg, rgba(9, 14, 23, 0) 0%, rgba(9, 14, 23, 0.28) 100%);
}

.sidebar-utilities {
    display: grid;
    gap: 8px;
}

.sidebar-footer .shell-utility-button {
    width: 100%;
    justify-content: flex-start;
    min-height: 46px;
    border-radius: 14px;
    border-color: rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.05);
    color: #e5eef8;
    box-shadow: none;
}

.sidebar-footer .shell-utility-overflow {
    width: 100%;
}

.sidebar-footer .shell-utility-more-menu {
    left: calc(100% + 10px);
    right: auto;
    min-width: 200px;
    top: auto;
    bottom: 0;
    border-color: rgba(148, 163, 184, 0.2);
    background: linear-gradient(180deg, rgba(14, 25, 39, 0.98) 0%, rgba(18, 34, 54, 0.98) 100%);
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.42);
}

.sidebar-footer .shell-utility-button:hover,
.sidebar-footer .shell-utility-button:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(148, 163, 184, 0.32);
    color: #ffffff;
    outline: none;
}

.sidebar-footer .shell-utility-button.active {
    background: linear-gradient(135deg, rgba(15, 118, 110, 0.88) 0%, rgba(11, 94, 215, 0.88) 100%);
    border-color: rgba(15, 118, 110, 0.45);
    color: #ffffff;
    box-shadow: 0 12px 28px rgba(11, 94, 215, 0.2);
}

.sidebar-footer .shell-utility-button-subtle {
    color: #c7d5e4;
}

.sidebar.expanded .sidebar-footer .shell-utility-more-menu {
    left: 0;
    right: auto;
    top: auto;
    bottom: calc(100% + 8px);
}

.sidebar.collapsed .sidebar-footer .shell-utility-button {
    justify-content: center;
    width: 48px;
    min-width: 48px;
    min-height: 48px;
    padding: 0;
    margin-inline: auto;
}

.sidebar.collapsed .sidebar-footer .shell-utility-button__label,
.sidebar.collapsed .shell-user-info__label,
.sidebar.collapsed .shell-user-info__logout-label {
    display: none;
}

.sidebar.collapsed .sidebar-footer .shell-utility-overflow {
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .shell-user-info {
    width: 52px;
    margin-inline: auto;
    padding: 0;
    border: none;
    background: transparent;
    display: grid !important;
    justify-items: center;
    gap: 8px;
}

.sidebar.collapsed .shell-user-info__logout {
    width: 40px;
    height: 40px;
    justify-content: center;
    padding: 0;
}

.mobile-sidebar-peek__icon {
    width: 18px;
    height: 18px;
}

.mobile-sidebar-peek,
.mobile-sidebar-backdrop {
    display: none;
}

.mobile-sidebar-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
}

.app-shell-header__context {
    min-width: 0;
}

.app-shell-header__path {
    margin: 0 0 4px;
    color: #7b8794;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    display: none;
}

.app-shell-header__eyebrow {
    margin: 0 0 6px;
    color: var(--shell-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    display: none;
}

.app-shell-header__title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.app-shell-header__title {
    margin: 0;
    color: var(--shell-text);
    font-size: 1.55rem;
    line-height: 1.1;
}

.app-shell-header__status {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    background: #d9edf9;
    color: #125aa1;
    font-size: 0.74rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-shell-header__description {
    margin: 6px 0 0;
    max-width: 38rem;
    color: var(--shell-text-muted);
    line-height: 1.4;
    font-size: 0.92rem;
    display: none;
}

.app-shell-header__utilities {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    min-width: 0;
}

.app-shell-header__session-label {
    display: none;
}

.app-shell-header__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.shell-utility-overflow {
    position: relative;
}

.shell-utility-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 8px;
    border: 1px solid var(--shell-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 6px;
    z-index: 40;
}

.shell-utility-more-menu[hidden] {
    display: none !important;
}

.shell-utility-button-menu {
    width: 100%;
    justify-content: flex-start;
}

.app-active-visit-slot {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: min(320px, 100%);
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--shell-border);
    border-radius: var(--shell-radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 250, 253, 1) 100%);
    color: var(--shell-text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.app-active-visit-slot__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background: var(--shell-accent-soft);
    color: var(--shell-accent);
    font-size: 1rem;
    flex-shrink: 0;
}

.app-active-visit-slot__body {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.app-active-visit-slot__eyebrow {
    color: var(--shell-accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.app-active-visit-slot__title {
    color: var(--shell-text);
    font-size: 0.88rem;
    line-height: 1.2;
}

.app-active-visit-slot__meta {
    color: var(--shell-text-muted);
    font-size: 0.76rem;
    line-height: 1.35;
}

.app-active-visit-slot[data-visit-state="inactive"] {
    display: none;
}

.app-active-visit-slot[data-visit-state="active"] {
    border-color: #9cd8c9;
    background: linear-gradient(180deg, #eefcf8 0%, #ffffff 100%);
    display: flex;
}

.shell-utility-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--shell-text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    width: auto;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.shell-utility-button:hover {
    background: #eef6ff;
    border-color: #9dc4eb;
    color: var(--shell-accent-strong);
}

.shell-utility-button.active {
    background: #dcecff;
    border-color: #7eb1e9;
    color: var(--shell-accent-strong);
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.18);
}

.shell-utility-button-subtle {
    color: #475569;
}

.shell-utility-button[hidden] {
    display: none !important;
}

.shell-utility-button__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}

.shell-utility-button__label {
    white-space: nowrap;
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: currentColor;
}

.sidebar-icon__svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-icon__svg--fill {
    fill: currentColor;
    stroke: none;
}

/* Sidebar styles */
.sidebar {
    background: linear-gradient(180deg, var(--shell-panel) 0%, var(--shell-panel-muted) 100%);
    color: white;
    transition: width 0.3s ease;
    overflow: visible;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.expanded {
    width: 232px;
}

/* Flexbox handles layout automatically when sidebar width changes */

/* Flexbox handles layout automatically */

.sidebar-header {
    padding: 16px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 60px;
}

.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.18);
    color: #f8fbff;
    font-size: 17px;
    cursor: pointer;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 8px;
    border-radius: 12px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(148, 163, 184, 0.3);
    outline: none;
}

.sidebar-title {
    font-weight: 700;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
    min-width: 0;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    justify-content: center;
    grid-template-columns: 44px;
    padding-inline: 10px;
}

.sidebar.collapsed .sidebar-toggle {
    margin-inline: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 11px 12px;
    min-height: 48px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    border: none;
    background: none;
    color: white;
    width: 100%;
    text-align: left;
    border-radius: 14px;
    margin-bottom: 6px;
}

.nav-item:hover {
    background-color: rgba(148, 163, 184, 0.14);
}

.nav-item.active {
    background: linear-gradient(135deg, #0f766e 0%, #0b5ed7 100%);
    color: #ffffff;
    box-shadow: 0 14px 28px rgba(11, 94, 215, 0.22);
}

.nav-icon {
    min-width: 20px;
    margin-right: 12px;
    text-align: center;
    color: #d8e5f2;
}

.nav-text {
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.3s ease;
    font-weight: 600;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    width: 52px;
    min-width: 52px;
    min-height: 52px;
    padding: 0;
    margin-inline: auto;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
    color: #e5eef8;
}

.sidebar.collapsed .nav-item::after {
    content: attr(data-nav-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    opacity: 0;
    pointer-events: none;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.94);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 16px 28px rgba(15, 23, 42, 0.26);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 20;
}

.sidebar.collapsed .nav-item:hover::after,
.sidebar.collapsed .nav-item:focus-visible::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* Modern segment management styles */
.segment-key-group {
    margin-bottom: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.segment-key-header {
    padding: 16px 20px;
    font-weight: 600;
    font-size: 14px;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-left: 4px solid #ffd700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.segment-value-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.segment-value-item:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.segment-value-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.segment-value-checkbox {
    margin-right: 12px;
    cursor: pointer;
    transform: scale(1.2);
    accent-color: #667eea;
}

.segment-value-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.segment-value-label {
    flex: 1;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.segment-value-count {
    color: #7f8c8d;
    font-size: 12px;
    margin-left: 12px;
    background: rgba(127, 140, 141, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 500;
}

/* Segment management specific styles */
.key-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    overflow: hidden;
}

.key-item:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.key-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.key-info strong {
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.key-info code {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.key-description {
    color: #6c757d;
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.4;
}

.key-actions {
    display: flex;
    gap: 8px;
}

.key-actions button {
    background: white;
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    color: #495057;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.key-actions button:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.key-values {
    padding: 16px 20px;
}

.values-list {
    margin-bottom: 12px;
}

.values-count {
    color: #6c757d;
    font-size: 12px;
    text-align: right;
    font-weight: 500;
}

.key-group {
    display: grid;
    gap: 14px;
}

.key-group + .key-group {
    margin-top: 24px;
}

.key-group__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: #334e68;
    font-size: 0.95rem;
    font-weight: 700;
}

.segment-value-item.key-values-item {
    background: rgba(102, 126, 234, 0.02);
    margin: 4px 0;
    border-radius: 8px;
    transition: all 0.2s ease;
    justify-content: space-between;
    gap: 12px;
}

.segment-value-item.key-values-item:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.key-values {
    display: grid;
    gap: 10px;
}

.key-values[hidden] {
    display: none;
}

.values-list {
    display: grid;
    gap: 8px;
}

.key-values-item__label {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    flex: 1;
}

.key-values-item__checkbox {
    margin: 0;
}

.value-actions {
    display: flex;
    position: static;
    background: transparent;
    border-radius: 20px;
    box-shadow: none;
    padding: 0;
    gap: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.value-actions button {
    background: white;
    border: 1px solid #dee2e6;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.value-actions button:hover {
    transform: scale(1.1);
}

.value-actions button:first-child {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.value-actions button:first-child:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.value-actions button:last-child {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.value-actions button:last-child:hover {
    background: #c82333;
    border-color: #c82333;
}

.key-values-item:hover .value-actions,
.key-values-item:focus-within .value-actions {
    opacity: 1;
    pointer-events: auto;
}

.value-tag {
    transition: all 0.2s ease;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: var(--kv-value-bg, #f8f9fa);
    color: var(--kv-value-color, #243b53);
    padding: 8px 12px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.value-tag:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.key-values-empty {
    padding: 18px 16px;
    border: 1px dashed #cbd2d9;
    border-radius: 14px;
    background: #fff;
    text-align: center;
    color: #52606d;
    font-size: 0.9rem;
}

/* Input focus effects for create form */
#kv-key-name:focus,
#kv-display-name:focus,
#kv-description:focus,
#kv-control-type:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    outline: none;
}

/* Button hover effects */
button[onclick*="createSegmentKey"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.4) !important;
}

.key-actions button:hover:first-child {
    background: #20c997 !important;
    border-color: #20c997 !important;
}

/* Quick action buttons hover */
button[onclick*="showKVSegmentsOnMap"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 123, 255, 0.4) !important;
}

button[onclick*="exportKVSegmentsData"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.4) !important;
}

/* Animation for key items appearing */
.key-item {
    animation: slideInUp 0.3s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading state styles */
.loading-state {
    opacity: 0.7;
    pointer-events: none;
    filter: grayscale(20%);
}

/* Enhanced modal styles for segment value editing */
.modal-overlay {
    backdrop-filter: blur(4px);
}

.modal-content {
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.loading-message,
.empty-message {
    padding: 15px;
    text-align: center;
    color: #95a5a6;
    font-size: 12px;
    font-style: italic;
}

/* Flexbox handles this automatically */

.tab-content {
    overflow-y: auto;
    max-height: calc(100vh - 50px);
    display: none;
}

.tab-content.active {
    display: block;
}

/* Address Sidebar Styles */
.address-sidebar {
    position: fixed;
    top: 0;
    right: -360px;
    width: 360px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    border-left: 1px solid var(--shell-border);
    box-shadow: none;
    z-index: 999;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.address-sidebar.visible {
    right: 0;
}

.address-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--shell-border);
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.address-sidebar-heading {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.address-sidebar-eyebrow {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.address-sidebar-subtitle {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.address-sidebar-toolbar {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.address-sidebar-overflow {
    position: relative;
}

.address-sidebar-overflow-toggle,
.address-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid var(--shell-border);
    background: rgba(255, 255, 255, 0.95);
    color: var(--shell-text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.95rem;
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.address-sidebar-overflow-toggle {
    background: #e8f3ff;
    color: #125aa1;
}

.address-sidebar-overflow-toggle:hover,
.address-sidebar-overflow-toggle.active,
.address-sidebar-close:hover {
    background: #f0f7ff;
    border-color: #9dc4eb;
    color: var(--shell-accent-strong);
    transform: translateY(-1px);
}

.address-sidebar-overflow-toggle__icon {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.address-sidebar-overflow-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 250px;
    padding: 10px;
    border: 1px solid var(--shell-border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
    display: grid;
    gap: 10px;
    z-index: 45;
}

.address-sidebar-overflow-menu[hidden] {
    display: none !important;
}

.address-sidebar-overflow-item {
    width: 100%;
    min-height: 40px;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    background: #f8fbff;
    color: var(--shell-text);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}

.address-sidebar-overflow-item:hover,
.address-sidebar-overflow-item:focus-visible {
    outline: none;
    border-color: #9dc4eb;
    background: #edf6ff;
}

.address-sidebar-overflow-upload {
    display: grid;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(191, 208, 224, 0.8);
}

.address-field--compact {
    gap: 8px;
}

.address-panel-hint--menu {
    margin: 0;
}

.address-sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.address-sidebar-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 12px 0;
    flex-shrink: 0;
}

.address-sidebar-tabs[hidden],
.address-sidebar-tab[hidden] {
    display: none !important;
}

.address-sidebar-tab {
    min-height: 36px;
    padding: 0 14px;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    background: #f8fbff;
    color: var(--shell-text-muted);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.address-sidebar-tab.is-active,
.address-sidebar-tab[aria-selected="true"] {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.address-panel-card--selected {
    margin: 12px 12px 0;
    border: 1px solid rgba(15, 118, 110, 0.18);
    background: linear-gradient(180deg, #f6fffc 0%, #ffffff 100%);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
    flex-shrink: 0;
}

#address-selected-panel[hidden] {
    display: none !important;
}

.address-panel-card__body--selected {
    display: grid;
    gap: 12px;
}

.address-selected-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.route-sidebar-stage__summary {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.address-sidebar[data-workspace-mode="route"] .address-sidebar-eyebrow {
    color: var(--shell-accent);
}

/* Collapsible Search Section */
.collapsible-search {
    border-bottom: 1px solid var(--shell-border);
    background: rgba(255, 255, 255, 0.78);
    flex-shrink: 0;
}

.collapsible-search-header {
    padding: 12px 16px;
    background: rgba(244, 248, 252, 0.96);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--shell-border);
}

.collapsible-search-header:hover {
    background: #edf3f9;
}

.collapsible-search-title {
    font-weight: 700;
    color: var(--shell-text);
}

.collapsible-search-toggle {
    font-size: 14px;
    color: var(--shell-text-muted);
    transition: transform 0.2s ease;
}

.collapsible-search.expanded .collapsible-search-toggle {
    transform: rotate(180deg);
}

.collapsible-search-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(255, 255, 255, 0.72);
}

.collapsible-search.expanded .collapsible-search-content {
    max-height: min(52vh, calc(100vh - 240px));
    overflow-y: auto;
}

.search-content-inner {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.address-workspace-stack {
    display: grid;
    gap: 12px;
}

.address-panel-card {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--shell-border);
    border-radius: 16px;
    background: var(--shell-surface-strong);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.address-panel-card--disclosure {
    gap: 0;
    overflow: hidden;
}

.address-panel-card__toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.address-panel-card__toggle--minimal {
    grid-template-columns: minmax(0, 1fr) auto;
}

.address-panel-card__header {
    display: grid;
    gap: 4px;
}

.address-panel-card__eyebrow {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.address-panel-card__title {
    margin: 0;
    color: var(--shell-text);
    font-size: 0.95rem;
    line-height: 1.2;
}

.address-panel-card__summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #edf4fb;
    color: #486581;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.address-panel-card__toggle-icon {
    color: var(--shell-text-muted);
    font-size: 0.86rem;
    transition: transform 0.2s ease;
}

.address-panel-card--disclosure.is-expanded .address-panel-card__toggle-icon {
    transform: rotate(180deg);
}

.address-panel-card__body {
    display: grid;
    gap: 12px;
    padding-top: 12px;
}

.address-panel-card__body[hidden] {
    display: none !important;
}

.address-panel-card--marker-detail {
    gap: 0;
}

.address-panel-card__body--marker-detail {
    min-height: 0;
    gap: 14px;
    overflow-y: auto;
    padding-right: 2px;
}

.marker-address-detail {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.marker-address-detail__nav-list {
    display: grid;
    gap: 8px;
}

.marker-address-detail__nav-button {
    display: grid;
    gap: 3px;
    justify-items: start;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--shell-text);
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.marker-address-detail__nav-button:hover,
.marker-address-detail__nav-button:focus-visible {
    border-color: #7eb1e9;
    background: #eef7ff;
    transform: translateY(-1px);
    outline: none;
}

.marker-address-detail__nav-label {
    font-size: 0.82rem;
    font-weight: 700;
}

.marker-address-detail__nav-meta {
    color: var(--shell-text-muted);
    font-size: 0.76rem;
    line-height: 1.4;
}

.marker-address-detail__subpanel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid rgba(126, 177, 233, 0.34);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(238, 247, 255, 0.92) 100%);
}

.marker-address-detail__back-button {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--shell-text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.marker-address-detail__back-button:hover,
.marker-address-detail__back-button:focus-visible,
.marker-address-detail__breadcrumb-link:hover,
.marker-address-detail__breadcrumb-link:focus-visible {
    border-color: #7eb1e9;
    color: #0b5ed7;
    background: #eef7ff;
    outline: none;
}

.marker-address-detail__back-button:hover,
.marker-address-detail__back-button:focus-visible {
    transform: translateY(-1px);
}

.marker-address-detail__breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
}

.marker-address-detail__breadcrumb-root {
    color: var(--shell-text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.marker-address-detail__breadcrumb-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 10px;
    border: 1px solid rgba(126, 177, 233, 0.22);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #0b5ed7;
    cursor: pointer;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.marker-address-detail__breadcrumb-separator,
.marker-address-detail__breadcrumb-current {
    color: var(--shell-text-muted);
    font-size: 0.76rem;
}

.marker-address-detail__breadcrumb-current {
    color: var(--shell-text);
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.marker-address-detail__header {
    display: grid;
    gap: 6px;
}

.marker-address-detail__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.marker-address-detail__name {
    margin: 0;
    color: var(--shell-text);
    font-size: 1rem;
    line-height: 1.25;
}

.marker-address-detail__address,
.marker-address-detail__secondary {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.83rem;
    line-height: 1.5;
}

.marker-address-detail__coordinates {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.marker-address-detail__panel,
.marker-address-detail__section,
.marker-address-detail__history-list {
    display: grid;
    gap: 10px;
}

.marker-address-detail__field {
    display: grid;
    gap: 4px;
    padding: 11px 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
}

.marker-address-detail__field-label {
    color: var(--shell-text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.marker-address-detail__field-value {
    color: var(--shell-text);
    font-size: 0.82rem;
    line-height: 1.45;
}

.marker-address-detail__history-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.94);
}

.marker-address-detail__history-title {
    color: var(--shell-text);
    font-size: 0.84rem;
    font-weight: 700;
}

.marker-address-detail__history-meta,
.marker-address-detail__history-note {
    color: var(--shell-text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.address-marker-hover-popup .leaflet-popup-content-wrapper {
    border: 1px solid rgba(126, 177, 233, 0.32);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
}

.address-marker-hover-popup .leaflet-popup-content {
    margin: 10px 12px;
    color: var(--shell-text);
    font-size: 0.8rem;
    line-height: 1.45;
}

.address-marker-hover-popup .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
}

.marker-address-detail__empty-state {
    display: grid;
    gap: 6px;
    justify-items: start;
    padding: 14px;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 14px;
    background: rgba(248, 250, 252, 0.88);
}

.marker-address-detail__empty-title {
    margin: 0;
    color: var(--shell-text);
    font-size: 0.84rem;
    font-weight: 700;
}

.marker-address-detail__empty-meta {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.78rem;
    line-height: 1.45;
}

.marker-address-detail__empty {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.address-field-grid {
    display: grid;
    gap: 10px;
}

.address-field {
    display: grid;
    gap: 6px;
}

.address-field-label {
    color: var(--shell-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.address-control {
    box-sizing: border-box;
    min-height: 42px;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    background: #ffffff;
    color: var(--shell-text);
    font: inherit;
}

.address-control:focus {
    outline: none;
    border-color: #7eb1e9;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.address-control-file {
    padding: 0.5rem;
}

.address-control-file::file-selector-button {
    margin-right: 10px;
    padding: 0.55rem 0.8rem;
    border: none;
    border-radius: 10px;
    background: #e8f3ff;
    color: #125aa1;
    font-weight: 700;
    cursor: pointer;
}

.address-sort-toggle {
    margin: 0;
    padding: 0;
    border: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.address-sort-toggle__option {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.address-sort-toggle__option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.address-sort-toggle__option span {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    background: #f8fbff;
    color: var(--shell-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.address-sort-toggle__option input:checked + span {
    border-color: #0f172a;
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.14);
}

.address-sort-toggle__option input:focus-visible + span {
    outline: none;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.address-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.address-action-row>* {
    flex: 1 1 0;
}

.address-action-button {
    width: 100%;
    min-height: 42px;
    padding: 0.7rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 12px;
    background: #e2e8f0;
    color: var(--shell-text);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.address-action-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.address-action-button-primary {
    background: linear-gradient(135deg, #0f766e 0%, #0b5ed7 100%);
    color: #ffffff;
}

.address-action-button-secondary {
    background: #d9eef8;
    color: #125aa1;
}

.address-action-button-success {
    background: #def7e5;
    color: #156a3b;
}

.address-action-button-warning {
    background: #fff1dc;
    color: #a04a00;
}

.address-action-button-danger {
    background: #ffe3e3;
    color: #b42318;
}

.address-action-button-tertiary {
    background: #e8f3ff;
    border-color: #c7ddef;
    color: #125aa1;
}

.address-action-button.active,
.address-action-button-tertiary.active {
    background: #143d78;
    border-color: #143d78;
    color: #ffffff;
}

.address-panel-hint {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.75rem;
    line-height: 1.45;
}

.address-selection-panel {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--shell-border-strong);
    border-radius: 16px;
    background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.address-selection-panel[hidden] {
    display: none !important;
}

.address-selection-summary,
.address-selection-group {
    display: grid;
    gap: 6px;
}

.address-selection-label,
.address-selection-group__label {
    margin: 0;
    color: var(--shell-text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.address-selection-counter {
    color: var(--shell-text);
    font-size: 0.92rem;
    line-height: 1.2;
}

.address-selection-toolbar {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.tool-btn {
    width: 100%;
    min-height: 38px;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--shell-border);
    border-radius: 11px;
    background: #ffffff;
    color: var(--shell-text-muted);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.tool-btn.active {
    background: linear-gradient(135deg, #0f766e 0%, #0b5ed7 100%);
    border-color: transparent;
    color: #ffffff;
}

.address-bulk-actions {
    display: grid;
    gap: 8px;
}

/* Address List in Sidebar */
.address-sidebar .address-list {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    gap: 10px;
    padding: 14px;
    margin: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow-x: hidden;
    overflow-y: auto;
}

.address-sidebar .address-list.overflow-visibility-surface.has-overflow::before,
.address-sidebar .address-list.overflow-visibility-surface.has-overflow::after {
    display: none;
}

#address-search-section[hidden] ~ #address-list-sidebar {
    flex: 0 1 auto;
    max-height: min(42vh, calc(100vh - 360px));
}

.address-sidebar .address-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 13px;
    border: 1px solid var(--shell-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    min-width: 0;
}

.address-sidebar .address-item:hover {
    transform: translateY(-1px);
    border-color: var(--shell-border-strong);
    background: #f8fbff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.address-sidebar .address-item.selected {
    background: #eef7ff;
    border-color: #7eb1e9;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.16);
}

.address-sidebar .address-item.map-focused {
    border-color: #0b5ed7;
    background: linear-gradient(180deg, #f1f7ff 0%, #ffffff 100%);
    box-shadow: 0 0 0 2px rgba(11, 94, 215, 0.14);
}

.address-list-state {
    display: grid;
    gap: 4px;
    justify-items: center;
    padding: 1.4rem 1rem;
    border: 1px dashed var(--shell-border-strong);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.address-sidebar .address-list > .address-list-state:only-child {
    min-height: 100%;
    align-content: center;
}

.address-list-state--error {
    border-color: #f2b8b5;
    background: #fff4f4;
}

.address-list-state__title {
    color: var(--shell-text);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
}

.address-list-state__meta {
    color: var(--shell-text-muted);
    font-size: 0.8rem;
    line-height: 1.35;
    max-width: 34ch;
}

.address-list-state__action {
    max-width: 220px;
}

.address-pagination {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid var(--shell-border);
    background: linear-gradient(180deg, #ffffff 0%, #f5f8fb 100%);
}

.pagination.address-pagination {
    display: none;
}

.address-pagination__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.address-pagination__info {
    color: var(--shell-text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.address-pagination__results {
    color: var(--shell-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.address-pagination__controls {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.address-pagination__button {
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--shell-border);
    border-radius: 10px;
    background: #fff;
    color: var(--shell-text);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.address-pagination__button:hover:not(:disabled) {
    background: #f8fbff;
    border-color: #9dc4eb;
    color: var(--shell-accent-strong);
}

.address-pagination__button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Debug overlay responsive positioning */
#debug-overlay {
    transition: right 0.3s ease;
}

.address-sidebar.visible~#debug-overlay {
    right: 420px !important;
    /* 400px sidebar + 20px margin */
}

.map-display-sidebar.visible~#debug-overlay {
    right: 440px !important;
    /* 420px sidebar + 20px margin */
}

/* Map Display Sidebar */
.map-display-sidebar {
    position: fixed;
    top: 0;
    right: -380px;
    width: 380px;
    height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(244, 249, 253, 0.98) 0%, rgba(235, 242, 249, 0.98) 100%);
    border-left: 1px solid var(--shell-border-strong);
    box-shadow: -18px 0 48px rgba(15, 23, 42, 0.1);
    z-index: 1000;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-display-sidebar.visible {
    right: 0;
}

.map-display-sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(191, 208, 224, 0.8);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 249, 252, 0.9) 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.map-display-sidebar-title {
    letter-spacing: 0.01em;
    font-weight: 700;
    font-size: 1rem;
    color: var(--shell-text);
}

.map-display-sidebar-close {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--shell-text-muted);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.map-display-sidebar-close:hover,
.map-display-sidebar-close:focus-visible {
    background: #ffffff;
    border-color: #a7bdd0;
    color: var(--shell-text);
    transform: translateY(-1px);
    outline: none;
}

.map-display-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: grid;
    align-content: start;
    gap: 16px;
}

.map-display-section {
    position: relative;
    margin-bottom: 0;
    padding: 18px;
    border: 1px solid rgba(191, 208, 224, 0.92);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

.map-display-section::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 20px 0 0 20px;
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.7) 0%, rgba(11, 94, 215, 0.55) 100%);
}

.map-display-section h4 {
    margin: 0 0 12px;
    padding-left: 14px;
    color: var(--shell-text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.map-display-section__copy {
    margin: 0 0 14px;
    padding-left: 14px;
    color: var(--shell-text-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.map-display-control {
    margin-bottom: 0;
}

.map-display-control:last-child {
    margin-bottom: 0;
}

.map-display-control label {
    display: block;
}

.map-segment-controls,
.map-segment-stats {
    display: grid;
    gap: 12px;
}

.map-display-sidebar .app-form-field,
.map-display-sidebar .app-form-checkbox-list,
.map-display-sidebar .app-form-actions,
.map-display-sidebar .app-form-note,
.map-display-sidebar #segment-filters {
    padding-left: 14px;
}

.map-display-sidebar .app-form-control {
    border-color: rgba(191, 208, 224, 0.92);
    background: #fdfefe;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.map-display-sidebar .app-form-control:focus {
    border-color: #7eb1e9;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.16);
}

.map-display-sidebar .app-form-checkbox-item {
    border-color: rgba(191, 208, 224, 0.88);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.map-display-sidebar .app-form-button {
    box-shadow: 0 12px 22px rgba(15, 23, 42, 0.08);
}

.map-segment-controls[hidden],
.map-segment-stats[hidden] {
    display: none !important;
}

.map-segment-controls__summary {
    margin: 0;
    color: #1d4d8b;
    font-size: 0.8rem;
    font-weight: 700;
}

.map-segment-controls__footer {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(18, 116, 156, 0.16);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(239, 248, 255, 0.92) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.map-segment-list {
    display: grid;
    gap: 12px;
}

.map-segment-group {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 16px;
    background: #ffffff;
    overflow: hidden;
}

.map-segment-group[open] {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.map-segment-group__summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 10px;
    padding: 14px 16px;
}

.map-segment-group__header {
    min-width: 0;
}

.map-segment-group__title {
    margin: 0;
    color: #102a43;
    font-size: 0.9rem;
    font-weight: 700;
}

.map-segment-group__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
}

.map-segment-group__key {
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(11, 93, 215, 0.08);
    color: #0b5ed7;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.68rem;
    font-weight: 700;
}

.map-segment-group__description {
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.45;
}

.map-segment-group__value-count {
    color: #52606d;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.map-segment-group__values {
    display: grid;
    gap: 8px;
}

.map-segment-choice {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.map-segment-choice:hover {
    border-color: rgba(11, 93, 215, 0.28);
    background: rgba(239, 248, 255, 0.84);
    transform: translateY(-1px);
}

.map-segment-choice input[type="checkbox"] {
    margin: 0;
    inline-size: 18px;
    block-size: 18px;
    accent-color: #0b5ed7;
    flex: 0 0 auto;
}

.map-segment-choice__swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    flex: 0 0 auto;
    border: 2px solid rgba(255, 255, 255, 0.94);
    background: var(--segment-choice-color, #94a3b8);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
}

.map-segment-choice__body {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.map-segment-choice__label {
    overflow: hidden;
    color: #102a43;
    font-size: 0.85rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-segment-choice__meta {
    overflow: hidden;
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-segment-stats__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.map-segment-stat-card {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: #ffffff;
}

.map-segment-stat-card__label {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.map-segment-stat-card__value {
    color: #102a43;
    font-size: 1.05rem;
    font-weight: 700;
}

.map-segment-breakdown__list {
    display: grid;
    gap: 10px;
}

.map-segment-breakdown__group {
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
}

.map-segment-breakdown__title {
    color: #102a43;
    font-size: 0.84rem;
    font-weight: 700;
}

.map-segment-breakdown__rows {
    display: grid;
    gap: 6px;
}

.map-segment-breakdown__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.map-segment-breakdown__name {
    min-width: 0;
    overflow: hidden;
    color: #52606d;
    font-size: 0.8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-segment-breakdown__count {
    flex: 0 0 auto;
    color: #102a43;
    font-size: 0.8rem;
    font-weight: 700;
}

/* Right sidebars are now positioned as overlays - no margin adjustments needed */

/* Help Overlay Styles */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.help-overlay.visible {
    display: flex;
}

.help-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    position: relative;
    margin: 20px;
}

.help-header {
    padding: 24px 24px 0 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.help-title {
    font-size: 24px;
    font-weight: bold;
    color: #111827;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-subtitle {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

.help-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #6b7280;
    transition: background-color 0.2s;
}

.help-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.help-body {
    padding: 0 24px 24px 24px;
}

.help-section {
    margin-bottom: 24px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section ul {
    margin: 0;
    padding-left: 20px;
    color: #6b7280;
}

.help-section li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.help-footer {
    padding: 16px 24px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    border-radius: 0 0 12px 12px;
    text-align: center;
}

.help-footer-text {
    font-size: 14px;
    color: #6b7280;
    margin: 0;
}

/* Address management styles */
.address-list {
    flex: 1;
    overflow-y: auto;
    border: 1px solid var(--shell-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.95);
    min-height: 200px;
}

.address-item {
    padding: 0.9rem;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.address-item:hover {
    background: #f8fbff;
}

.address-item:last-child {
    border-bottom: none;
}

.address-info {
    flex: 1;
    min-width: 0;
    padding-right: 0;
}

.address-name {
    margin: 0 0 0.35rem;
    color: var(--shell-text);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.address-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 0.45rem;
}

body.hide-address-row-badges #address-list-sidebar .address-details,
body.hide-address-row-badges #address-list .address-details {
    display: none;
}

.address-line,
.coordinates {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overflow-visibility-surface {
    position: relative;
    --overflow-visibility-fade-height: 16px;
}

.overflow-visibility-surface.has-overflow::before,
.overflow-visibility-surface.has-overflow::after {
    content: "";
    position: sticky;
    left: 0;
    display: block;
    width: 100%;
    height: var(--overflow-visibility-fade-height);
    pointer-events: none;
    z-index: 2;
}

.overflow-visibility-surface.overflow-top::before {
    top: 0;
    margin-bottom: calc(-1 * var(--overflow-visibility-fade-height));
    background: linear-gradient(180deg, rgba(241, 245, 249, 0.96) 0%, rgba(241, 245, 249, 0) 100%);
}

.overflow-visibility-surface.overflow-bottom::after {
    bottom: 0;
    margin-top: calc(-1 * var(--overflow-visibility-fade-height));
    background: linear-gradient(0deg, rgba(241, 245, 249, 0.98) 0%, rgba(241, 245, 249, 0) 100%);
}

.address-type {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-right: 0;
}

.address-type.clinic {
    background: #d4edda;
    color: #155724;
}

.address-type.pharmacy {
    background: #d1ecf1;
    color: #0c5460;
}

.address-type.hospital {
    background: #f8d7da;
    color: #721c24;
}

.address-type.office {
    background: #fff3cd;
    color: #856404;
}

.address-line {
    color: var(--shell-text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.coordinates {
    margin-top: 0.35rem;
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.35;
}

/* Geocoding status styles */
.geocoding-status {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-size: 0.66rem;
    margin-left: 0;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.geocoding-status.success {
    background: #d4edda;
    color: #155724;
}

.geocoding-status.manual {
    background: #d1ecf1;
    color: #0c5460;
}

.geocoding-status.failed {
    background: #f8d7da;
    color: #721c24;
}

.geocoding-status.pending {
    background: #fff3cd;
    color: #856404;
}

.address-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    align-self: flex-start;
    gap: 0.45rem;
}

.address-map-focus-button,
.address-detail-button {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--shell-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.address-map-focus-button:hover,
.address-map-focus-button:focus-visible,
.address-detail-button:hover,
.address-detail-button:focus-visible {
    border-color: #7eb1e9;
    background: #eef7ff;
    color: #0b5ed7;
    transform: translateY(-1px);
    outline: none;
}

.address-map-focus-button:disabled,
.address-detail-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.address-map-focus-button svg,
.address-detail-button svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.address-actions input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--shell-accent-strong);
    cursor: pointer;
}

.address-actions input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.address-actions .select-btn {
    background: #007bff;
    color: white;
}

.address-actions .edit-btn {
    background: #ffc107;
    color: #212529;
}

.address-actions .delete-btn {
    background: #dc3545;
    color: white;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 0.5rem;
}

.pagination button {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--shell-border);
    background: #ffffff;
    color: var(--shell-text);
    cursor: pointer;
    border-radius: 10px;
    width: auto;
    font-weight: 700;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Enhanced address management styles */
.bulk-actions {
    background: #f8f9fa;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    display: none;
}

.bulk-actions.show {
    display: block;
}

/* Address selection styles */
.address-item {
    border: 1px solid var(--shell-border);
    border-radius: 14px;
    transition: all 0.2s ease;
}

.address-item.selected {
    background-color: #eef7ff !important;
    border-color: #7eb1e9 !important;
}

/* Multi-select tool styles */
.tool-btn {
    border: 1px solid var(--shell-border);
    border-radius: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

.tool-btn.active {
    border-color: transparent;
    box-shadow: 0 8px 18px rgba(11, 94, 215, 0.18);
}

/* Special styling for explicit marker move mode */
#markerMoveToggle.active {
    background-color: #fd7e14 !important;
    border-color: #fd7e14;
    box-shadow: 0 2px 4px rgba(253, 126, 20, 0.4);
    animation: drag-pulse 2s infinite;
}

@keyframes drag-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Marker drag mode styles */
.leaflet-marker-draggable {
    cursor: grab !important;
}

.leaflet-marker-draggable:active {
    cursor: grabbing !important;
}

/* Enhanced visual feedback for drag mode markers */
.drag-mode-active .leaflet-marker-icon {
    filter: drop-shadow(0 0 3px rgba(253, 126, 20, 0.6));
    transition: filter 0.2s ease;
}

.drag-mode-active .leaflet-marker-icon:hover {
    filter: drop-shadow(0 0 6px rgba(253, 126, 20, 0.8));
    transform: scale(1.1);
}

/* Selection panel animations */
#multiSelectPanel {
    animation: slideDown 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideDown {
    from {
        max-height: 0;
        opacity: 0;
    }

    to {
        max-height: 300px;
        opacity: 1;
    }
}

/* Statistics panel styles */
#addressStatsPanel {
    animation: slideDown 0.3s ease-out;
}

.stat-card {
    transition: all 0.2s ease;
    cursor: default;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Map marker styles */
.segment-marker,
.selected-segment-marker,
.route-map-marker-wrapper,
.selected-marker-icon,
.normal-marker-icon {
    background: transparent !important;
    border: none !important;
    overflow: visible !important;
}

.app-map-marker {
    position: relative;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.app-map-marker::before {
    content: '';
    position: absolute;
    inset: 2px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(241, 123, 123, 0.42) 0%, rgba(241, 123, 123, 0.24) 46%, rgba(241, 123, 123, 0) 78%);
    opacity: 0;
    transform: scale(0.76);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}

.app-map-marker__chip {
    --app-marker-chip-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--app-marker-accent, #007bff);
    border: 2px solid rgba(15, 23, 42, 0.18);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: var(--app-marker-chip-transform);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.app-map-marker__chip--map-pin {
    --app-marker-chip-transform: rotate(-45deg);
    width: 24px;
    height: 24px;
    border-radius: 50% 50% 50% 0;
    border: none;
    box-shadow: 0 3px 7px rgba(15, 23, 42, 0.14), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.app-map-marker__glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    line-height: 1;
}

.app-map-marker__shape {
    position: relative;
    display: inline-block;
}

.app-map-marker__shape--pin {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: currentColor;
}

.app-map-marker__shape--pin::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 7px;
    width: 2px;
    height: 5px;
    border-radius: 999px;
    background: currentColor;
}

.app-map-marker__shape--map-pin-hole {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #fff;
    transform: rotate(45deg);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.app-map-marker__shape--circle {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    border: 2px solid currentColor;
    box-sizing: border-box;
}

.app-map-marker__shape--square {
    width: 9px;
    height: 9px;
    background: currentColor;
}

.app-map-marker__shape--diamond {
    width: 8px;
    height: 8px;
    background: currentColor;
    transform: rotate(45deg);
}

.app-map-marker__shape--triangle {
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 9px solid currentColor;
}

.app-map-marker__symbol {
    font-size: 12px;
    font-weight: 700;
}

.app-map-marker__badge {
    position: absolute;
    top: 1px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    border: 2px solid #fff;
    background: var(--app-marker-accent, #007bff);
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.18);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-map-marker__badge--draft {
    background: #f08c00;
}

.app-map-marker__badge--saved {
    background: #2f9e44;
}

.app-map-marker--selected .app-map-marker__chip {
    transform: var(--app-marker-chip-transform) scale(1.16);
    box-shadow: 0 0 0 3px rgba(241, 123, 123, 0.24), 0 0 16px rgba(223, 87, 87, 0.38), 0 4px 10px rgba(15, 23, 42, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.app-map-marker--selected::before {
    opacity: 1;
    transform: scale(1.36);
}

.selected-segment-marker {
    filter: drop-shadow(0 0 10px rgba(223, 87, 87, 0.32));
}

.segment-marker:hover .app-map-marker__chip,
.selected-segment-marker:hover .app-map-marker__chip {
    transform: var(--app-marker-chip-transform) scale(1.08);
}

.route-map-marker .app-map-marker__chip {
    width: 24px;
    height: 24px;
}

.marker-inner {
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 14px;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

.group-tag {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 8px;
    font-size: 0.6em;
    background: #e9ecef;
    color: #495057;
    margin: 0.1rem;
}

.address-item input[type="checkbox"] {
    margin-right: 0.5rem;
    width: auto;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Modal enhancements */
.modal-content:not(.auth-entry-card) input,
.modal-content:not(.auth-entry-card) select,
.modal-content:not(.auth-entry-card) textarea {
    margin-bottom: 0.5rem;
    box-sizing: border-box;
}

.modal-content:not(.auth-entry-card) button[type="submit"] {
    background: #007bff;
    color: white;
}

.modal-content:not(.auth-entry-card) button[type="button"] {
    background: #6c757d;
    color: white;
}

/* Address groups styles */
.address-groups-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    margin-top: 0.5rem;
}

.group-item {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-item:last-child {
    border-bottom: none;
}

.group-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* Removed custom cluster overrides to rely on vendor MarkerCluster CSS */

/* Responsive Design - Mobile and Tablet Support */
@media screen and (max-width: 1024px) {

    /* Tablet adjustments */
    .address-sidebar {
        width: 300px;
    }

    .map-display-sidebar {
        width: 320px;
    }

    #pagination-controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    #pagination-controls button {
        min-width: 80px;
    }
}

@media screen and (max-width: 768px) {

    #auth-modal.auth-entry-screen {
        align-items: flex-start;
        padding: 16px;
    }

    .auth-entry-panel {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 18px;
        border-radius: 24px;
    }

    .auth-entry-copy {
        padding: 0;
    }

    .auth-entry-copy h1 {
        font-size: clamp(1.85rem, 8vw, 2.6rem);
    }

    .auth-entry-description {
        font-size: 0.96rem;
    }

    .auth-entry-points {
        gap: 10px;
        margin-top: 20px;
    }

    .auth-entry-points li {
        align-items: flex-start;
        padding: 11px 12px;
    }

    .auth-entry-proof {
        grid-template-columns: 1fr;
    }

    .auth-entry-card {
        width: 100%;
        padding: 1.5rem;
    }

    .auth-card-title-row {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .auth-card-status {
        min-height: 24px;
    }

    .auth-form-button {
        min-height: 46px;
    }

    .auth-card-footer {
        margin-top: 14px;
        padding-top: 14px;
    }

    .app-shell-header {
        flex-direction: column;
        align-items: stretch;
        padding: 14px 14px 12px;
        margin-right: 0;
        gap: 12px;
        border-radius: 0 0 18px 18px;
    }

    .app-shell-header__utilities {
        min-width: 0;
        align-items: stretch;
    }

    .app-shell-header__actions {
        justify-content: stretch;
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .app-active-visit-slot {
        width: 100%;
    }

    .app-shell-header__eyebrow,
    .app-shell-header__path,
    .app-shell-header__description,
    .app-shell-header__session-label {
        display: none;
    }

    .app-shell-header__title {
        font-size: 1.3rem;
    }

    .app-shell-header__title-row {
        justify-content: space-between;
        align-items: center;
    }

    .app-shell-header__status {
        font-size: 0.68rem;
        padding: 4px 8px;
    }

    .workspace-disclosure__summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .workspace-disclosure__meta {
        display: none;
    }

    .segments-admin-shell {
        padding: 14px 14px 90px;
    }

    .segments-admin-card-header {
        flex-direction: column;
    }

    .segments-admin-stats-grid,
    .segments-admin-actions-grid {
        grid-template-columns: 1fr 1fr;
    }

    .segments-admin-list-surface {
        margin: 16px 14px 0;
    }

    .app-modal-overlay {
        padding: 14px;
    }

    .app-modal-card {
        width: 100%;
        max-height: min(84vh, 720px);
        padding: 18px;
        border-radius: 18px;
    }

    .app-modal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .app-modal-field-inline {
        grid-template-columns: 1fr;
    }

    .shell-utility-button {
        justify-content: flex-start;
        min-height: 48px;
        padding: 11px 12px;
        border-radius: 14px;
        width: 100%;
    }

    .shell-utility-button__icon {
        width: 20px;
        min-width: 20px;
        height: 20px;
        margin-right: 12px;
    }

    .shell-utility-button__label {
        display: inline;
        font-weight: 600;
    }

    .shell-user-info {
        min-width: 0;
        justify-content: space-between;
    }

    .shell-user-info {
        min-width: 0;
    }

    .history-search-actions {
        grid-template-columns: 1fr;
    }

    .history-item__content,
    .route-current-toolbar,
    .route-address-picker-header,
    .route-workspace-header {
        flex-direction: column;
        align-items: stretch;
    }

    .app-shell-header {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px 8px;
    }

    .app-shell-header__path,
    .app-shell-header__eyebrow,
    .app-shell-header__description,
    .app-shell-header__session-label,
    .app-active-visit-slot__eyebrow,
    .app-active-visit-slot__meta {
        display: none;
    }

    .app-shell-header__context,
    .app-shell-header__utilities,
    .shell-user-info {
        width: 100%;
        min-width: 0;
    }

    .app-shell-header__title-row {
        gap: 8px;
    }

    .app-shell-header__title {
        font-size: 1.12rem;
    }

    .app-shell-header__status {
        padding: 4px 8px;
        font-size: 0.68rem;
    }

    .app-shell-header__utilities {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
    }

    .app-shell-header__actions {
        justify-content: flex-start;
        gap: 6px;
    }

    .app-active-visit-slot {
        width: 100%;
        padding: 0.62rem 0.72rem;
        gap: 8px;
    }

    .app-active-visit-slot[data-visit-state="inactive"] {
        display: none;
    }

    .app-active-visit-slot__icon {
        width: 1.7rem;
        height: 1.7rem;
        font-size: 0.9rem;
    }

    .app-active-visit-slot__title {
        font-size: 0.84rem;
        line-height: 1.2;
    }

    .shell-user-info {
        width: auto;
        margin-left: auto;
        padding: 0.52rem 0.7rem;
        gap: 10px;
        border-radius: 12px;
    }

    .shell-user-info__label {
        max-width: 140px;
        font-size: 0.82rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .shell-user-info__logout {
        font-size: 0.76rem;
        padding: 0;
    }

    .app-container {
        display: block;
    }

    .sidebar {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(286px, 84vw);
        height: 100dvh;
        z-index: 1200;
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        box-shadow: 24px 0 48px rgba(15, 23, 42, 0.28);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed,
    .sidebar.expanded {
        width: min(286px, 84vw);
    }

    .sidebar.collapsed .sidebar-title,
    .sidebar.collapsed .nav-text {
        opacity: 1;
    }

    .sidebar.collapsed .sidebar-header {
        justify-content: space-between;
    }

    .sidebar.collapsed .nav-item {
        justify-content: flex-start;
        padding-inline: 12px;
    }

    .sidebar.collapsed .nav-icon {
        margin-right: 12px;
    }

    .sidebar.collapsed .nav-item::after {
        display: none;
    }

    .mobile-sidebar-peek {
        position: fixed;
        top: 50%;
        left: -2px;
        z-index: 1180;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 94px;
        min-height: 94px;
        padding: 0 4px 0 7px;
        border: 1px solid rgba(148, 163, 184, 0.28);
        border-left: none;
        border-radius: 0 16px 16px 0;
        background: rgba(11, 18, 32, 0.96);
        color: #ffffff;
        box-shadow: 14px 0 28px rgba(15, 23, 42, 0.24);
        backdrop-filter: blur(10px);
        transform: translateY(-50%);
        transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
        touch-action: none;
    }

    .mobile-sidebar-peek:hover,
    .mobile-sidebar-peek:focus-visible {
        background: rgba(15, 23, 42, 0.98);
        border-color: rgba(148, 163, 184, 0.38);
        outline: none;
    }

    .mobile-sidebar-peek--dragging {
        transition: none;
    }

    .mobile-sidebar-peek__icon {
        width: 14px;
        height: 14px;
        opacity: 0.92;
    }

    .sidebar.mobile-dragging {
        transition: none;
    }

    .mobile-sidebar-backdrop--dragging {
        transition: none;
    }

    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1150;
        display: block;
        background: rgba(15, 23, 42, 0.26);
        backdrop-filter: blur(2px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body[data-mobile-sidebar-open="true"] .mobile-sidebar-backdrop:not([hidden]) {
        opacity: 1;
        pointer-events: auto;
    }

    .main-content {
        min-height: 100dvh;
        padding-bottom: 0;
    }

    .address-sidebar,
    .map-display-sidebar {
        position: fixed;
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        width: auto !important;
        height: min(78vh, 680px);
        border: 1px solid var(--shell-border);
        border-radius: 22px;
        box-shadow: var(--shell-shadow);
        z-index: 1001;
        transform: translateY(calc(100% + 24px));
        transition: transform 0.28s ease;
    }

    .address-sidebar.visible,
    .map-display-sidebar.visible {
        transform: translateY(0);
    }

    .address-sidebar.visible~.main-content #map-container,
    .map-display-sidebar.visible~.main-content #map-container {
        margin-right: 0;
    }

    .address-sidebar-header,
    .map-display-sidebar-header {
        padding: 12px 14px;
    }

    .address-sidebar-subtitle {
        display: none;
    }

    .map-display-sidebar-title {
        font-size: 15px;
    }

    /* Mobile-friendly search controls */
    .search-content-inner {
        gap: 10px;
        padding: 10px;
    }

    .address-panel-card {
        gap: 10px;
        padding: 12px;
        border-radius: 14px;
    }

    .address-sidebar-tabs {
        padding: 10px 10px 0;
    }

    .address-sidebar-tab {
        flex: 1 1 0;
        justify-content: center;
    }

    .address-panel-card--selected {
        margin: 10px 10px 0;
    }

    .address-panel-card__toggle {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .address-panel-card__summary {
        display: none;
    }

    .address-field-grid,
    .address-bulk-actions {
        gap: 8px;
    }

    .address-action-button,
    .tool-btn,
    .address-control,
    .app-form-control,
    .app-form-button,
    .auth-form-button {
        min-height: 40px;
        font-size: 0.8rem;
    }

    .address-selection-toolbar {
        gap: 6px;
    }

    .app-form-actions--inline,
    .map-segment-stats__grid {
        grid-template-columns: 1fr;
    }

    .map-segment-group__summary {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .map-segment-group .workspace-disclosure__meta,
    .map-segment-choice__meta {
        display: none;
    }

    .address-sidebar .address-list {
        padding: 10px;
        gap: 8px;
    }

    .address-sidebar .address-item {
        padding: 10px 11px;
    }

    .address-actions {
        flex-direction: row;
        justify-content: flex-end;
        align-self: center;
        flex-shrink: 0;
    }

    .address-pagination {
        padding: 10px;
        align-items: stretch;
    }

    .address-pagination__controls {
        grid-template-columns: 1fr;
    }

    .address-pagination__button {
        width: 100%;
    }

    /* Mobile pagination controls */
    #pagination-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 15px;
    }

    #pagination-controls .flex {
        justify-content: center;
    }

    #pagination-controls button {
        padding: 12px 20px;
        font-size: 16px;
    }

    /* Tab content adjustments */
    .tab-content {
        padding: 12px;
    }

    .route-workspace-tabs,
    .route-stats-summary {
        grid-template-columns: 1fr;
    }

    .route-route-card,
    .route-address-picker-card {
        margin: 14px 0 0;
    }

    .route-current-toolbar,
    .route-saved-header {
        padding-left: 0;
        padding-right: 0;
    }

    .route-legacy-tools {
        margin: 14px 0 0;
    }

    .route-selection-summary {
        text-align: left;
    }

    .segments-workspace-shell {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(240px, 36vh);
        height: auto;
    }

    .segments-filter-pane {
        width: auto;
        min-width: 0;
        border-right: none;
    }

    .segments-filter-list-shell {
        max-height: 36vh;
    }

    .segments-map-panel {
        min-height: 240px;
        border-left: none;
        border-top: 1px solid #e2e8f0;
    }

    .shell-utility-more-menu {
        left: 0;
        right: 0;
        min-width: 0;
    }

    /* Map container adjustments */
    #map-container {
        min-height: 100dvh;
        height: 100dvh;
    }

    /* Status section adjustments */
    .status-section {
        flex-direction: column;
        gap: 10px;
    }

    .status-item {
        text-align: center;
    }
}

@media screen and (max-width: 480px) {

    #auth-modal.auth-entry-screen {
        padding: 12px;
    }

    .auth-entry-panel {
        gap: 14px;
        padding: 14px;
        border-radius: 20px;
    }

    .auth-entry-copy h1 {
        margin-bottom: 12px;
        line-height: 1.1;
    }

    .auth-entry-proof__item {
        padding: 14px;
    }

    .auth-entry-card {
        padding: 1.1rem;
        border-radius: 20px;
    }

    .auth-entry-card__header {
        margin-bottom: 14px;
    }

    .auth-card-subtitle,
    .auth-card-footer__text {
        font-size: 0.88rem;
    }

    .auth-entry-card .app-form-control {
        min-height: 46px;
        padding: 0.8rem 0.85rem;
    }

    /* Small mobile adjustments */
    .tab-content {
        padding: 5px;
    }

    .search-content-inner {
        gap: 8px;
        padding: 8px;
    }

    .address-panel-card {
        padding: 10px;
    }

    .address-selection-toolbar {
        grid-template-columns: 1fr;
    }

    .route-legacy-actions,
    .route-legacy-panel__header,
    .route-legacy-inline-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .address-panel-card__toggle {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .history-item {
        padding: 10px 12px;
    }

    .address-action-row--split>*,
    .address-action-row>* {
        flex-basis: 100%;
    }

    .address-action-button,
    .tool-btn,
    .address-control {
        min-height: 38px;
        font-size: 16px;
    }

    #map-container {
        min-height: 100dvh;
        height: 100dvh;
    }

    .sidebar-header {
        padding: 10px;
    }

    .address-sidebar-header,
    .map-display-sidebar-header {
        padding: 10px;
    }

    /* Stack help modal content */
    .help-modal-content {
        width: 95%;
        margin: 10px;
        max-height: 90vh;
    }

    .help-section {
        margin-bottom: 16px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

    /* Touch device optimizations */
    button,
    .nav-item,
    .close-sidebar {
        min-height: 44px;
        /* iOS touch target minimum */
        padding: 12px;
    }

    .sidebar-toggle {
        padding: 15px;
    }

    /* Larger tap targets for map controls */
    .leaflet-control-layers,
    .leaflet-control-zoom {
        font-size: 18px;
    }

    .leaflet-control-zoom-in,
    .leaflet-control-zoom-out {
        width: 44px;
        height: 44px;
        line-height: 42px;
    }
}

/* Landscape phone orientation */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .main-content {
        height: auto;
        min-height: 100dvh;
    }

    .sidebar.collapsed {
        height: 100dvh;
    }

    #map-container {
        min-height: 100dvh;
        height: 100dvh;
    }
}
.crm-workspace-shell {
    display: grid;
    gap: 1rem;
}

.crm-workspace-hero {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.crm-workspace-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 0.75rem;
    min-width: min(100%, 280px);
}

.crm-metric-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.03);
}

.crm-metric-card__label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.7;
}

.crm-metric-card__value {
    display: block;
    margin-top: 0.35rem;
    font-size: 1.6rem;
}

.crm-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
    align-items: end;
}

.crm-filter-actions {
    justify-content: flex-start;
}

.crm-fields-card {
    display: grid;
    gap: 1rem;
}

.crm-fields-card__header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.crm-field-form {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) minmax(180px, 1fr) auto;
    gap: 0.8rem;
    align-items: center;
}

.crm-field-feedback {
    border-radius: 12px;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(236, 240, 247, 0.9);
}

.crm-field-feedback[data-tone="error"] {
    border-color: rgba(220, 53, 69, 0.45);
    color: #ffd7dc;
}

.crm-field-table {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
        rgba(7, 12, 22, 0.72);
    overflow: hidden;
}

.crm-field-table__header,
.crm-field-row {
    display: grid;
    grid-template-columns: 28px minmax(180px, 1.8fr) minmax(76px, 0.7fr) minmax(100px, 0.8fr) minmax(110px, 0.9fr) minmax(80px, 0.7fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
}

.crm-field-table__header {
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(236, 240, 247, 0.62);
}

.crm-field-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.crm-field-row:last-child {
    border-bottom: 0;
}

.crm-field-row__handle {
    display: inline-grid;
    grid-template-columns: repeat(2, 6px);
    gap: 4px;
    width: 16px;
    opacity: 0.55;
}

.crm-field-row__handle span {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: currentColor;
}

.crm-field-row__name {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.crm-field-row__name strong {
    font-size: 0.95rem;
}

.crm-field-row__name span {
    font-size: 0.78rem;
    opacity: 0.66;
}

.crm-field-row__type {
    display: inline-flex;
    justify-self: start;
    align-items: center;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: rgba(13, 110, 253, 0.16);
    color: #b3d1ff;
    font-size: 0.8rem;
}

.crm-field-row__filter {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.85rem;
}

.crm-field-row__filter input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.crm-field-row__action {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    font: inherit;
    cursor: pointer;
    transition: transform 120ms ease, opacity 120ms ease;
}

.crm-field-row__action:hover {
    transform: translateY(-1px);
}

.crm-field-row__action--muted {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(236, 240, 247, 0.94);
}

.crm-field-row__action--danger {
    background: rgba(220, 53, 69, 0.16);
    color: #ffd7dc;
}

.crm-results-card {
    display: grid;
    gap: 1rem;
}

.crm-results-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.crm-results-title {
    margin: 0.2rem 0 0;
}

.crm-results-copy {
    max-width: 34rem;
    margin: 0;
    opacity: 0.78;
}

.crm-feedback {
    border-radius: 12px;
    padding: 0.85rem 1rem;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.crm-feedback[data-tone="error"] {
    border-color: rgba(220, 53, 69, 0.45);
    color: #ffd7dc;
}

.crm-feedback[data-tone="info"] {
    border-color: rgba(13, 110, 253, 0.4);
    color: #d5e7ff;
}

.crm-customer-list {
    display: grid;
    gap: 0.85rem;
}

.crm-customer-card {
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(7, 12, 22, 0.72);
    padding: 1rem;
    display: grid;
    gap: 0.85rem;
}

.crm-customer-card__header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

.crm-customer-card__title {
    margin: 0;
}

.crm-customer-card__meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.crm-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
}

.crm-status-badge[data-status="current_customer"] {
    background: rgba(40, 167, 69, 0.18);
    color: #a6f3ba;
}

.crm-status-badge[data-status="prospect"] {
    background: rgba(255, 193, 7, 0.18);
    color: #ffe28a;
}

.crm-status-badge[data-status="stale_customer"] {
    background: rgba(255, 133, 27, 0.18);
    color: #ffc68a;
}

.crm-status-badge[data-status="former_customer"] {
    background: rgba(108, 117, 125, 0.22);
    color: #d5d9de;
}

.crm-status-badge[data-status="target"] {
    background: rgba(13, 110, 253, 0.18);
    color: #a8cfff;
}

.crm-location-list {
    display: grid;
    gap: 0.7rem;
}

.crm-location-card {
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.85rem 0.9rem;
    display: grid;
    gap: 0.45rem;
}

.crm-location-card__title {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.crm-location-card__address,
.crm-location-card__meta {
    margin: 0;
    opacity: 0.8;
}

.crm-location-card__source {
    margin-top: 0.35rem;
    padding-top: 0.7rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 0.65rem;
}

.crm-location-card__source-title {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.65;
    color: rgba(236, 240, 247, 0.62);
}

.crm-account-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0.65rem;
}

.crm-account-grid__item {
    margin: 0;
    padding: 0.7rem 0.75rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: grid;
    gap: 0.35rem;
    min-width: 0;
}

.crm-account-grid__label {
    margin: 0;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(236, 240, 247, 0.62);
}

.crm-account-grid__value {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .crm-field-form {
        grid-template-columns: 1fr;
    }

    .crm-field-table__header {
        display: none;
    }

    .crm-field-row {
        grid-template-columns: 24px 1fr;
        gap: 0.75rem;
        align-items: start;
    }

    .crm-field-row__name,
    .crm-field-row__type,
    .crm-field-row__filter,
    .crm-field-row__action {
        grid-column: 2;
    }

    .crm-workspace-summary {
        width: 100%;
    }
}
