/* ------------------------------------------------------------------
   Territory Map - application styles
   Loaded after Bootstrap and theme.css (the shared GlobalSearch Material theme, kept as
   shipped in /styling). Everything here is expressed in that theme's tokens, and the
   Bootstrap components the views use are restyled to match its Material look.
   ------------------------------------------------------------------ */
:root {
    /* App tokens, mapped onto the theme so inline var(--line) etc. in views keep working. */
    --ink: var(--text);
    --ink-2: var(--text-secondary);
    --muted: var(--text-secondary);
    --line: var(--divider);
    --line-strong: rgba(0, 0, 0, .24);
    --surface-2: var(--app-bg);
    --brand: var(--primary);
    --brand-dark: var(--primary);
    --primary-tint: rgba(21, 34, 69, .08);
    --primary-tint-strong: rgba(21, 34, 69, .14);
    --grid-rule: #dde2eb;
    --header-h: var(--toolbar-height);

    /* Bootstrap, steered onto the same palette and type. */
    --bs-body-font-family: Roboto, "Helvetica Neue", sans-serif;
    --bs-body-font-size: 14px;
    --bs-body-color: var(--text);
    --bs-body-bg: var(--app-bg);
    --bs-primary: #152245;
    --bs-primary-rgb: 21, 34, 69;
    --bs-secondary-color: rgba(0, 0, 0, .6);
    --bs-link-color: #152245;
    --bs-link-color-rgb: 21, 34, 69;
    --bs-link-hover-color: #0b1430;
    --bs-link-hover-color-rgb: 11, 20, 48;
    --bs-border-color: rgba(0, 0, 0, .12);
    --bs-border-radius: 4px;
    --bs-border-radius-sm: 4px;
    --bs-border-radius-lg: 4px;
    --bs-danger: #f44336;
    --bs-danger-rgb: 244, 67, 54;
    --bs-code-color: #37474f;
}

/* theme.css pins the body for single-screen apps; these pages scroll unless they are a
   full-height map workspace. */
body {
    overflow: auto;
    font-size: 14px;
    line-height: 20px;
}

body.app-fullbleed { overflow: hidden; }

a { text-decoration: none; }
a:hover { text-decoration: underline; }
.btn:hover, .mat-icon-button:hover, .admin-nav a:hover, .app-brand:hover { text-decoration: none; }

code {
    background: var(--field-bg);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12.5px;
}

/* ------------------------------------------------------------------ App bar */
.app-header {
    gap: 8px;
    position: relative;
    z-index: 1100;
    box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.app-brand:hover { color: inherit; }
.app-brand .app-logo img { height: 40px; }
.app-brand .toolbar-title { margin-left: 4px; }

.app-header-slot {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 16px;
}

.app-header-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.app-header .mat-icon-button { color: inherit; text-decoration: none; }
.app-header .avatar-button { cursor: default; }
.app-header .avatar-button::before { display: none; }

/* The public map picker sits on the navy bar. */
.app-header .form-select {
    max-width: 320px;
    background-color: rgba(255, 255, 255, .1);
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .5);
    border-radius: 4px 4px 0 0;
    color: #fff;
    font-size: 15px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

.app-header .form-select:hover { background-color: rgba(255, 255, 255, .16); }
.app-header .form-select:focus { box-shadow: none; border-bottom: 2px solid #fff; }
.app-header .form-select option { color: var(--text); background: var(--surface); }

/* Admin section links: text tabs on the bar, with the Material active underline. */
.admin-nav {
    display: flex;
    align-items: stretch;
    height: var(--toolbar-height);
}

.admin-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    color: rgba(255, 255, 255, .72);
    text-decoration: none;
    font: 500 14px/20px Roboto, sans-serif;
    letter-spacing: .0892857143em;
    text-transform: uppercase;
    position: relative;
    transition: background 150ms, color 150ms;
}

.admin-nav a .material-icons { font-size: 20px; }
.admin-nav a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.admin-nav a.is-active { color: #fff; }

.admin-nav a.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: #fff;
}

/* ------------------------------------------------------------------ Page body */
.app-main { min-height: calc(100vh - var(--header-h)); }

body.app-fullbleed .app-main {
    height: calc(100vh - var(--header-h));
    min-height: 0;
    overflow: hidden;
}

/* The server's status message, shown with the theme's snackbar. */
.app-toast { z-index: 1200; }

/* The shared confirm dialog has to clear the app bar (1100) and Leaflet's panes. */
#confirmDialog { z-index: 2000; }
#confirmDialog .dialog { margin: 0 16px; }

.page-pad {
    padding: 24px 24px 48px;
    max-width: 1180px;
}

.page-title {
    font: 400 24px/32px Roboto, sans-serif;
    letter-spacing: 0;
    margin: 0 0 4px;
}

.page-sub {
    color: var(--text-secondary);
    margin: 0 0 24px;
}

/* ------------------------------------------------------------------ Cards and stat tiles */
.card-panel {
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--level1);
    padding: 16px 24px 24px;
    margin-bottom: 24px;
}

.card-panel h2 {
    font: 400 20px/32px Roboto, sans-serif;
    margin: 0 0 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: 4px;
    box-shadow: var(--level1);
    padding: 12px 16px;
}

.stat-value {
    font: 500 28px/36px Roboto, sans-serif;
    color: var(--primary);
}

.stat-label {
    font: 400 12px/16px Roboto, sans-serif;
    color: var(--text-secondary);
}

/* ------------------------------------------------------------------ Buttons
   Bootstrap's .btn rendered as Material buttons: uppercase 500 label, 4px radius, a
   currentColor state layer on hover. */
.btn {
    --bs-btn-font-family: Roboto, sans-serif;
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: 14px;
    --bs-btn-line-height: 20px;
    --bs-btn-padding-x: 16px;
    --bs-btn-padding-y: 8px;
    --bs-btn-border-radius: 4px;
    --bs-btn-focus-box-shadow: 0 0 0 3px rgba(21, 34, 69, .25);
    letter-spacing: .0892857143em;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 36px;
}

.btn-sm {
    --bs-btn-font-size: 13px;
    --bs-btn-padding-x: 12px;
    --bs-btn-padding-y: 5px;
    min-height: 32px;
}

.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    opacity: 0;
    transition: opacity 150ms;
    pointer-events: none;
}

.btn:hover::before { opacity: .08; }
.btn:active::before { opacity: .16; }

/* Raised primary */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--primary);
    --bs-btn-active-border-color: var(--primary);
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-bg: rgba(0, 0, 0, .12);
    --bs-btn-disabled-border-color: transparent;
    --bs-btn-disabled-color: var(--text-hint);
    box-shadow: var(--level2);
}

.btn-primary:active { box-shadow: var(--level8); }

.btn-dark {
    --bs-btn-bg: #323232;
    --bs-btn-border-color: #323232;
    --bs-btn-hover-bg: #323232;
    --bs-btn-hover-border-color: #323232;
}

/* Stroked buttons: thin divider outline, coloured label. */
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger {
    --bs-btn-border-color: var(--divider);
    --bs-btn-hover-bg: transparent;
    --bs-btn-hover-border-color: var(--divider);
    --bs-btn-active-bg: transparent;
    --bs-btn-active-border-color: var(--divider);
    --bs-btn-disabled-border-color: var(--divider);
    background: var(--surface);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary);
    --bs-btn-hover-color: var(--primary);
    --bs-btn-active-color: var(--primary);
}

.btn-outline-secondary {
    --bs-btn-color: var(--text);
    --bs-btn-hover-color: var(--text);
    --bs-btn-active-color: var(--text);
}

.btn-outline-danger {
    --bs-btn-color: var(--warn);
    --bs-btn-hover-color: var(--warn);
    --bs-btn-active-color: var(--warn);
}

/* ------------------------------------------------------------------ Form fields
   Bootstrap controls drawn as Material "filled" fields: grey fill, square bottom edge,
   an underline that thickens to navy on focus. */
.form-label {
    font: 400 12px/16px Roboto, sans-serif;
    letter-spacing: .0333em;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-control,
.form-select {
    background-color: var(--field-bg);
    border: 0;
    border-bottom: 1px solid var(--field-underline);
    border-radius: 4px 4px 0 0;
    font: 400 16px/24px Roboto, sans-serif;
    letter-spacing: .03125em;
    color: var(--text);
    padding: 12px 16px 11px;
    transition: background-color 150ms, border-color 150ms;
}

.form-select { padding-right: 40px; }

.form-control:hover,
.form-select:hover { background-color: var(--field-bg-hover); }

.form-control:focus,
.form-select:focus {
    background-color: var(--field-bg-hover);
    border-bottom: 2px solid var(--primary);
    padding-bottom: 10px;
    box-shadow: none;
    color: var(--text);
}

.form-control::placeholder { color: var(--text-hint); }

.form-control-sm,
.form-select-sm {
    font-size: 14px;
    line-height: 20px;
    padding: 8px 12px 7px;
    min-height: 0;
}

.form-control-sm:focus,
.form-select-sm:focus { padding-bottom: 6px; }

.form-select-sm { padding-right: 36px; }

.form-control-color {
    padding: 6px;
    width: 52px;
    height: auto;
}

.input-group-text {
    background: var(--field-bg);
    border: 0;
    border-bottom: 1px solid var(--field-underline);
    border-radius: 4px 0 0 0;
    color: var(--text-secondary);
}

.input-group > .form-control:not(:first-child) { border-top-left-radius: 0; }

/* Invalid fields: red underline, as .mat-form-field.invalid. */
.form-control.input-validation-error,
.form-select.input-validation-error,
.form-control.is-invalid {
    border-bottom: 2px solid var(--warn);
    padding-bottom: 10px;
}

.text-danger, .field-validation-error { color: var(--warn) !important; }

.form-text {
    font: 400 12px/16px Roboto, sans-serif;
    color: var(--text-secondary);
}

/* Checkboxes and switches in the theme's navy. */
.form-check-input {
    border: 2px solid rgba(0, 0, 0, .54);
    border-radius: 2px;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(21, 34, 69, .2);
}

.form-switch .form-check-input { border-radius: 2em; border-width: 1px; }

.alert {
    border: 0;
    border-radius: 4px;
    box-shadow: var(--level1);
}

.alert-danger { background: #fdecea; color: #b71c1c; }
.alert-warning { background: #fff4e5; color: #8a4b00; }

.badge {
    font: 500 11px/16px Roboto, sans-serif;
    letter-spacing: .04em;
    border-radius: 10px;
    padding: 1px 8px;
    text-transform: uppercase;
}

.text-bg-success-subtle {
    background: rgba(81, 163, 81, .14) !important;
    color: #2e7d32 !important;
}

.badge-private {
    background: rgba(21, 34, 69, .1);
    color: var(--primary);
}

/* Map visibility choice: three selectable rows, the chosen one tinted. */
.visibility-options {
    display: grid;
    gap: 8px;
}

.visibility-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    cursor: pointer;
    transition: background 150ms, border-color 150ms;
}

.visibility-option:hover { background: rgba(0, 0, 0, .04); }
.visibility-option .form-check-input { margin: 0; flex-shrink: 0; border-radius: 50%; }
.visibility-option .material-icons { color: var(--accent); }

.visibility-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-tint);
}

.text-bg-secondary {
    background: #eceff1 !important;
    color: var(--text-secondary) !important;
}

/* ------------------------------------------------------------------ Tables (the theme's data-grid look) */
.table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(33, 150, 243, .06);
    --bs-table-border-color: var(--grid-rule);
    font-size: 13px;
}

.table-tight > :not(caption) > * > * {
    padding: 10px 12px;
    border-bottom-color: var(--grid-rule);
}

.table-tight thead th {
    font: 700 12px/16px Roboto, sans-serif;
    color: #181d1f;
    letter-spacing: 0;
    text-transform: none;
    height: 48px;
    white-space: nowrap;
    border-bottom-width: 1px;
}

.table-tight tbody tr:hover > * { background: rgba(33, 150, 243, .06); }
.table-tight tbody tr:last-child > * { border-bottom: 0; }

/* ------------------------------------------------------------------
   Map workspace: sidebar + map, both full height
   ------------------------------------------------------------------ */
.workspace {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: 100%;
    min-height: 0;
}

.workspace.workspace-wide { grid-template-columns: 380px 1fr; }

.workspace-side {
    background: var(--surface);
    border-right: 1px solid var(--divider);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.workspace-side-scroll {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
}

.workspace-map {
    position: relative;
    min-height: 0;
}

.map-canvas {
    position: absolute;
    inset: 0;
    background: #d4d4d7;
}

.side-block {
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
}

.side-block:last-child { border-bottom: 0; }

/* The theme's overline / section title. */
.side-label {
    font: 500 12px/16px Roboto, sans-serif;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

/* ------------------------------------------------------------------ Territory legend (drawer-list style) */
.legend-list {
    list-style: none;
    margin: 0;
    padding: 4px 0;
}

.legend-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--text);
}

.legend-item:hover { background: rgba(0, 0, 0, .04); }

.legend-item.is-active {
    background: rgba(96, 125, 139, .16);
    box-shadow: inset 3px 0 0 var(--primary);
}

.legend-item.is-dimmed { opacity: .45; }

.swatch {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    margin-top: 3px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}

.swatch-lg { width: 20px; height: 20px; border-radius: 4px; }

.legend-text {
    flex: 1 1 auto;
    min-width: 0;
}

.legend-name {
    display: block;
    font-size: 15px;
    font-weight: 500;
    line-height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legend-meta {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The theme's .page-tag pill. */
.legend-count {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    background: #eceff1;
    border-radius: 10px;
    padding: 1px 8px;
}

/* ------------------------------------------------------------------ Segmented control (Material button toggle) */
/* Spans the sidebar, one row: the options share the width rather than wrapping. */
.segmented {
    display: flex;
    width: 100%;
    border: 1px solid var(--divider);
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface);
}

.segmented button {
    flex: 1 1 auto;
    border: 0;
    border-left: 1px solid var(--divider);
    background: none;
    padding: 0 8px;
    height: 36px;
    font: 500 12.5px/36px Roboto, sans-serif;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 150ms;
}

.segmented button:first-child { border-left: 0; }
.segmented button:hover { background: rgba(0, 0, 0, .04); }

.segmented button.is-active {
    background: var(--primary-tint-strong);
    color: var(--primary);
}

/* ------------------------------------------------------------------ Map overlays */
.map-hint {
    position: absolute;
    z-index: 500;
    left: 12px;
    bottom: 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 4px;
    padding: 8px 14px;
    font-size: 13px;
    box-shadow: var(--level4);
    pointer-events: none;
    max-width: 340px;
}

.map-readout {
    position: absolute;
    z-index: 500;
    right: 12px;
    top: 12px;
    background: var(--surface);
    border-radius: 4px;
    padding: 10px 14px;
    box-shadow: var(--level4);
    pointer-events: none;
    min-width: 190px;
    max-width: 280px;
}

.map-readout .r-region {
    font-weight: 500;
    font-size: 15px;
    line-height: 20px;
}

.map-readout .r-territory {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.map-readout .r-empty {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

.map-busy {
    position: absolute;
    inset: 0;
    z-index: 600;
    display: none;
    place-items: center;
    background: rgba(250, 250, 250, .72);
    font-weight: 500;
    color: var(--text-secondary);
}

.map-busy.is-on { display: grid; }

/* Leaflet controls in the theme's elevation and radius. */
.leaflet-bar,
.leaflet-control-layers {
    border: 0 !important;
    border-radius: 4px !important;
    box-shadow: var(--level2) !important;
}

.leaflet-bar a { color: var(--text); }
.leaflet-container { font-family: Roboto, "Helvetica Neue", sans-serif; }

/* ------------------------------------------------------------------ Popups (Material menu surface) */
.leaflet-popup-content-wrapper {
    border-radius: 4px;
    box-shadow: var(--level8);
}

.leaflet-popup-content {
    margin: 12px 16px;
    min-width: 220px;
    font: 400 14px/20px Roboto, sans-serif;
}

.leaflet-popup-content p { margin: 0; }

.tp-region {
    font: 500 11px/16px Roboto, sans-serif;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.tp-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font: 500 16px/24px Roboto, sans-serif;
    margin: 2px 0 6px;
}

.tp-manager { font-weight: 500; }
.tp-role { color: var(--text-secondary); }

/* One block per contact in the popup; the role leads as an overline. */
.tp-contact { margin-top: 10px; }

.tp-contact + .tp-contact {
    padding-top: 10px;
    border-top: 1px solid var(--divider);
}

.tp-contact-role {
    font: 500 11px/16px Roboto, sans-serif;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--accent);
}

.tp-rows {
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--divider);
    display: grid;
    gap: 2px;
    font-size: 13px;
}

.tp-contact .tp-rows {
    margin-top: 4px;
    padding-top: 0;
    border-top: 0;
}

.tp-rows a { color: var(--primary); text-decoration: none; }
.tp-rows a:hover { text-decoration: underline; }

.tp-note {
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ------------------------------------------------------------------ Territory form */
.contact-row {
    padding: 16px;
    margin-bottom: 8px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    background: var(--app-bg);
}

.contact-row .form-control,
.contact-row .form-select { background-color: var(--surface); }

.contact-row .new-person {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px dashed var(--divider);
}
.contact-row .btn .material-icons { font-size: 18px; }
.btn .material-icons { font-size: 18px; margin-left: -4px; }
.contact-row .form-control:hover,
.contact-row .form-control:focus { background-color: var(--field-bg); }

/* Inline edit on the contact list: the row swaps for a tinted strip of fields. */
.contact-edit-row > td {
    background: var(--primary-tint) !important;
    padding: 12px 16px !important;
}

.quick-edit-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 12px;
}

.quick-edit .form-control { background-color: var(--surface); }

@media (max-width: 900px) {
    .quick-edit-grid { grid-template-columns: 1fr 1fr; }
}

/* A territory a contact is on, in the contact list: the theme's chip, small. */
.use-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 4px 4px 0;
    padding: 2px 10px;
    border-radius: 16px;
    background: #eceff1;
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
}

.use-chip:hover { background: #e0e0e0; text-decoration: none; }
.use-chip .swatch { width: 10px; height: 10px; margin-top: 0; border-radius: 50%; }

.color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.color-chip {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .2);
}

.color-chip.is-active { box-shadow: 0 0 0 2px var(--primary); }

/* ------------------------------------------------------------------ Coverage editor */
.palette-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 2px;
}

.palette-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px;
    border: 0;
    border-radius: 4px;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}

.palette-item:hover { background: rgba(0, 0, 0, .04); }

.palette-item.is-active {
    background: rgba(96, 125, 139, .16);
    box-shadow: inset 3px 0 0 var(--primary);
}

.palette-item .p-name {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.palette-item .p-count {
    margin-left: auto;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
}

.swatch-eraser {
    background: repeating-linear-gradient(45deg, #fff 0 4px, #cfd8dc 4px 8px);
}

.region-rows {
    display: grid;
    gap: 1px;
}

.region-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    background: none;
    border: 0;
    text-align: left;
    width: 100%;
    color: var(--text);
}

.region-row:hover { background: rgba(0, 0, 0, .04); }
.region-row .rr-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.region-row .rr-owner {
    margin-left: auto;
    flex: 0 0 auto;
    color: var(--text-secondary);
    font-size: 11px;
    max-width: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brush-on .leaflet-container { cursor: crosshair; }

/* ------------------------------------------------------------------ Small screens (theme breakpoint) */
@media (max-width: 1100px) {
    .admin-nav a .nav-text { display: none; }
    .admin-nav a { padding: 0 12px; }
}

@media (max-width: 900px) {
    .app-brand .toolbar-title { display: none; }
    .app-header-slot { margin-left: 4px; }
    .page-pad { padding: 16px 16px 32px; }

    .workspace, .workspace.workspace-wide {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 45%) minmax(0, 55%);
    }

    .workspace-side {
        border-right: 0;
        border-bottom: 1px solid var(--divider);
    }
}
