/* ===========================================================
   Cluster markers (DOM elements rendered via maplibregl.Marker)
   =========================================================== */
.tm-cluster {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 700;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    cursor: pointer;
    border: 3px solid rgba(255, 255, 255, 0.95);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.35),
        0 2px 4px rgba(0, 0, 0, 0.2),
        inset 0 -2px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tm-cluster:hover {
    transform: scale(1.12);
    box-shadow:
        0 6px 18px rgba(0, 0, 0, 0.45),
        0 3px 6px rgba(0, 0, 0, 0.25),
        inset 0 -2px 6px rgba(0, 0, 0, 0.15);
}

.tm-cluster--sm {
    width: 38px;
    height: 38px;
    font-size: 12px;
    background: radial-gradient(circle at 30% 30%, #6EE7B7, #10B981);
}

.tm-cluster--md {
    width: 48px;
    height: 48px;
    font-size: 14px;
    background: radial-gradient(circle at 30% 30%, #FCD34D, #F59E0B);
}

.tm-cluster--lg {
    width: 58px;
    height: 58px;
    font-size: 15px;
    background: radial-gradient(circle at 30% 30%, #FCA5A5, #DC2626);
}

.tm-cluster--xl {
    width: 70px;
    height: 70px;
    font-size: 16px;
    background: radial-gradient(circle at 30% 30%, #C4B5FD, #7C3AED);
}

/* MapLibre's default Marker — give it a subtle drop shadow + pointer cursor */
.maplibregl-marker {
    cursor: pointer;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    transition: filter 0.15s ease;
}
.maplibregl-marker:hover {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.tm-map-view {
    min-height: 240px;
    background-color: #e5e7eb;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Background applied to every map layer (container, canvas wrapper, and
   the WebGL canvas itself) so a window resize can't expose page-white
   behind the canvas at any compositing depth. Combined with the map's
   preserveDrawingBuffer:true, this fully eliminates the white flash. */
.tm-map-view .maplibregl-map,
.tm-map-view .maplibregl-canvas-container,
.tm-map-view .maplibregl-canvas {
    background-color: #e5e7eb;
}

.tm-map-edit-content {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.tm-map-edit-body {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tm-map-edit-map {
    flex: 1 1 auto;
    min-height: 280px;
}

/* Stops-list panel beside the map (Σταθμοί Γραμμής): a scrollable, collapsible
   list of jump-to-stop rows on the left, the map filling the rest. */
.tm-stops-split {
    display: flex;
    flex: 1 1 auto;
    min-height: 280px;
    gap: 0.75rem;
}
.tm-stops-split .tm-map-edit-map {
    min-height: 0;
}

.tm-stops-list {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--rz-border);
    border-radius: 8px;
    padding: 0.5rem 0.5rem 0.25rem;
    background: var(--rz-base-background-color, #fff);
}
.tm-stops-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
    padding: 0 0.25rem 0.4rem;
    border-bottom: 1px solid var(--rz-border);
}
.tm-stops-list-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rz-text-secondary-color, #6b7280);
}
.tm-stops-list-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

/* A single stop row — modern card-style: badge + name, hover + active states. */
.tm-stop-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    user-select: none;
}
.tm-stop-item:hover {
    background: var(--rz-base-200, rgba(0, 0, 0, 0.05));
}
.tm-stop-item.is-active {
    background: var(--rz-primary-lighter, rgba(37, 99, 235, 0.12));
    border-left-color: var(--rz-primary, #2563eb);
}
.tm-stop-badge {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--rz-primary, #2563eb);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1;
}
/* First stop = origin, last = terminus. */
.tm-stop-badge.is-start { background: var(--rz-success, #16a34a); }
.tm-stop-badge.is-end   { background: var(--rz-danger, #dc2626); }
.tm-stop-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.tm-stop-name {
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tm-stop-edge-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--rz-text-secondary-color, #6b7280);
}
/* Fly-to hint icon — hidden at rest, revealed on hover / when active. */
.tm-stop-go {
    flex: 0 0 auto;
    opacity: 0;
    font-size: 1.05rem;
    color: var(--rz-text-secondary-color, #6b7280);
    transition: opacity 0.15s ease;
}
.tm-stop-item:hover .tm-stop-go,
.tm-stop-item.is-active .tm-stop-go {
    opacity: 0.75;
}

/* Collapsed state: hide the list; a slim chevron re-opens it. */
.tm-stops-split.is-collapsed .tm-stops-list {
    display: none;
}
.tm-stops-expand {
    flex: 0 0 auto;
    align-self: flex-start;
}

/* Collapse/expand chevron — the default text+light button is almost
   invisible in light mode, so force a clear icon colour + a hover affordance. */
.tm-stops-toggle,
.tm-stops-toggle * {
    color: var(--rz-text-color, #1f2937) !important;
}
.tm-stops-toggle {
    border-radius: 6px;
}
.tm-stops-toggle:hover {
    background: var(--rz-base-200, rgba(0, 0, 0, 0.08)) !important;
}

/* Radzen dialogs wrap their content in a transformed positioning layer.
   MapLibre popups inside a transformed parent get rasterized on subpixel
   positions, which makes the text look blurry. Forcing the popup onto its
   own GPU layer with antialiased text rendering restores crisp glyphs. */
.maplibregl-popup-content {
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Fixed white box + dark text in BOTH themes. The popup floats on the
       basemap, which is always a light style, so it should match the map —
       not the app chrome. Pinning the text dark also fixes the original
       dark-mode bug, where it inherited the theme's light text and rendered
       near-white-on-white (the "white tooltip"). */
    background: #fff;
    color: #1f2937;
}

/* The popup tip is a CSS triangle whose color is set per anchor side; point
   the visible edge at the same white as the content box. */
.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
    border-bottom-color: #fff;
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
    border-top-color: #fff;
}
.maplibregl-popup-anchor-left .maplibregl-popup-tip {
    border-right-color: #fff;
}
.maplibregl-popup-anchor-right .maplibregl-popup-tip {
    border-left-color: #fff;
}

/* Close button "×" pinned dark so it stays legible on the white popup. */
.maplibregl-popup-content .maplibregl-popup-close-button {
    color: #1f2937;
}

/* ===========================================================
   Native mapbox-gl-draw buttons + our custom shape buttons.
   The library ships English icons + glyphs that don't match the
   Lucide style; we override their background images. !important is
   needed because the upstream stylesheet uses !important too.
   =========================================================== */
.mapbox-gl-draw_point,
.mapbox-gl-draw_line,
.mapbox-gl-draw_polygon,
.mapbox-gl-draw_trash,
.tm-ctrl-rectangle,
.tm-ctrl-circle {
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 20px 20px !important;
}
.mapbox-gl-draw_point {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 7-8 13-8 13s-8-6-8-13a8 8 0 0 1 16 0Z'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3C/svg%3E") !important;
}
.mapbox-gl-draw_line {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='6' y1='18' x2='18' y2='6'/%3E%3Ccircle cx='6' cy='18' r='2.2' fill='%231f2937'/%3E%3Ccircle cx='18' cy='6' r='2.2' fill='%231f2937'/%3E%3C/svg%3E") !important;
}
.mapbox-gl-draw_polygon {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 3 21 9.5 17.5 20 6.5 20 3 9.5'/%3E%3C/svg%3E") !important;
}
.mapbox-gl-draw_trash {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6'/%3E%3Cpath d='M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E") !important;
}
.tm-ctrl-rectangle {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='6' width='18' height='12' rx='1.5'/%3E%3C/svg%3E") !important;
}
.tm-ctrl-circle {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3C/svg%3E") !important;
}
/* Selected-tool highlight for the native draw buttons (point/line/polygon) and
   our custom rectangle/circle — same blue inset ring + tint as the toggle
   controls (tm-drawing-tools etc.), so an active tool is obvious. !important
   overrides mapbox-gl-draw's own (much fainter) .active background. */
.mapbox-gl-draw_point.active,
.mapbox-gl-draw_line.active,
.mapbox-gl-draw_polygon.active,
.tm-ctrl-rectangle.active,
.tm-ctrl-circle.active,
.tm-ctrl-labels.active,
.tm-ctrl-dark-mode.active {
    background-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45) !important;
}

/* Promote every control button to its own compositing layer. When the
   user drags the dialog resize handle, the dialog reflows rapidly and
   without this the SVG background-images briefly disappear/redraw
   between frames — what shows up as flickering icons. translateZ keeps
   each button on a stable GPU layer so the bitmap survives reflow. */
.maplibregl-ctrl-group button {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ===========================================================
   Drawing editor controls: point numbers, insert point, undo, redo
   =========================================================== */
.maplibregl-ctrl-group.tm-drawing-tools button,
.maplibregl-ctrl-group.tm-marker-tools button,
.maplibregl-ctrl-group.tm-terrain-globe-tools button {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 18px;
}

.maplibregl-ctrl-group.tm-drawing-tools button.active,
.maplibregl-ctrl-group.tm-marker-tools button.active,
.maplibregl-ctrl-group.tm-terrain-globe-tools button.active {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45);
}

.maplibregl-ctrl-group.tm-drawing-tools button:disabled,
.maplibregl-ctrl-group.tm-marker-tools button:disabled,
.maplibregl-ctrl-group.tm-terrain-globe-tools button:disabled {
    cursor: not-allowed;
    opacity: 0.38;
}

/* Icon set — Lucide-style (lucide.dev): 24×24 viewBox, 2px stroke,
   rounded caps/joins, no fills, single ink color (#1f2937 — slate-800).
   Monochrome by design — active state is conveyed via the button's
   background tint + inset blue shadow, not the icon itself. */

.tm-ctrl-vertex-labels {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='10' y1='10' x2='14' y2='14'/%3E%3Ccircle cx='7' cy='8' r='3.2'/%3E%3Ccircle cx='17' cy='16' r='3.2'/%3E%3Ctext x='7' y='9.6' text-anchor='middle' font-size='4.5' font-family='Arial' font-weight='700' fill='%231f2937' stroke='none'%3E1%3C/text%3E%3Ctext x='17' y='17.6' text-anchor='middle' font-size='4.5' font-family='Arial' font-weight='700' fill='%231f2937' stroke='none'%3E2%3C/text%3E%3C/svg%3E");
}

.tm-ctrl-insert-vertex {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 19L12 8L21 16'/%3E%3Ccircle cx='12' cy='8' r='3.4' fill='%23ffffff'/%3E%3Cline x1='12' y1='6' x2='12' y2='10'/%3E%3Cline x1='10' y1='8' x2='14' y2='8'/%3E%3C/svg%3E");
}

/* Single extend-line button — replaces the old start/end pair.
   Click opens an ExtendActionsPopover beside the button with two
   options ("Από την αρχή" / "Από το τέλος"). */
.tm-ctrl-extend-line {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='3' y1='12' x2='21' y2='12'/%3E%3Cpolyline points='6 9 3 12 6 15'/%3E%3Cpolyline points='18 9 21 12 18 15'/%3E%3Ccircle cx='12' cy='12' r='1.8' fill='%231f2937'/%3E%3C/svg%3E");
}

.tm-ctrl-move-drawing {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='5 9 2 12 5 15'/%3E%3Cpolyline points='9 5 12 2 15 5'/%3E%3Cpolyline points='15 19 12 22 9 19'/%3E%3Cpolyline points='19 9 22 12 19 15'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cline x1='12' y1='2' x2='12' y2='22'/%3E%3C/svg%3E");
}

/* "Βαθμονόμηση" — top: noisy polyline; bottom: simplified polyline;
   small downward chevron between them suggests transformation. */
.tm-ctrl-calibrate {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7L6 4L9 8L12 5L15 8L18 4.5L21 7'/%3E%3Cpath d='M3 19L12 16L21 19'/%3E%3Cpolyline points='10 11 12 13 14 11'/%3E%3C/svg%3E");
}

.tm-ctrl-snap {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 15l-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15'/%3E%3Cpath d='M5 8l4 4'/%3E%3Cpath d='M12 15l4 4'/%3E%3C/svg%3E");
}

.tm-ctrl-measure-labels {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.3 8.7L8.7 21.3c-1 1-2.5 1-3.4 0l-2.6-2.6c-1-1-1-2.5 0-3.4L15.3 2.7c1-1 2.5-1 3.4 0l2.6 2.6c1 1 1 2.5 0 3.4Z'/%3E%3Cpath d='M7.5 10.5l2 2'/%3E%3Cpath d='M10.5 7.5l2 2'/%3E%3Cpath d='M13.5 4.5l2 2'/%3E%3Cpath d='M4.5 13.5l2 2'/%3E%3C/svg%3E");
}

.tm-ctrl-undo {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14L4 9L9 4'/%3E%3Cpath d='M4 9H14.5A5.5 5.5 0 0 1 20 14.5A5.5 5.5 0 0 1 14.5 20H11'/%3E%3C/svg%3E");
}

.tm-ctrl-redo {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 14L20 9L15 4'/%3E%3Cpath d='M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13'/%3E%3C/svg%3E");
}

.tm-ctrl-fit-markers {
    /* Now a standalone right-side control (was in the marker-tools group), so it
       needs its own icon positioning like the home button. */
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 18px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 8V5a2 2 0 0 1 2-2h3'/%3E%3Cpath d='M16 3h3a2 2 0 0 1 2 2v3'/%3E%3Cpath d='M21 16v3a2 2 0 0 1-2 2h-3'/%3E%3Cpath d='M8 21H5a2 2 0 0 1-2-2v-3'/%3E%3Cpath d='M12 9c-1.7 0-3 1.3-3 3 0 2.5 3 5 3 5s3-2.5 3-5c0-1.7-1.3-3-3-3z'/%3E%3Ccircle cx='12' cy='12' r='1' fill='%231f2937'/%3E%3C/svg%3E");
}

.tm-ctrl-clusters {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='8' r='4'/%3E%3Ccircle cx='17' cy='9' r='3.2'/%3E%3Ccircle cx='12' cy='17' r='4.4'/%3E%3C/svg%3E");
}

.tm-ctrl-home {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 18px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9L12 2L21 9V20A2 2 0 0 1 19 22H5A2 2 0 0 1 3 20Z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
}

.tm-ctrl-home:disabled,
.tm-ctrl-home--at-home {
    opacity: 0.4;
    cursor: default;
}

.tm-ctrl-labels {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 18px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h10l5 6-5 6H3z'/%3E%3Cline x1='7' y1='12' x2='13' y2='12'/%3E%3C/svg%3E");
}
/* .tm-ctrl-labels.active styling is shared with the draw-tool selection rule
   above (with !important so the tint survives hover) — see the grouped rule. */

.tm-ctrl-greece {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 18px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
}

/* Light/dark basemap toggle — "contrast" icon (circle with one half filled). */
.tm-ctrl-dark-mode {
    background-position: center;
    background-repeat: no-repeat;
    background-size: 18px 18px;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 3a9 9 0 0 1 0 18z' fill='%231f2937' stroke='none'/%3E%3C/svg%3E");
}

.tm-ctrl-dark-mode.active {
    background-color: rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.45);
}

/* Dark mode: the map container gets .tm-dark (toggled in changeBasemap). The
   on-map controls are white panels with dark monochrome icons, so a single
   invert flips them to dark panels with light icons. hue-rotate(180deg) cancels
   invert's hue shift on the blue "active" tint (icons are grey, so unaffected),
   keeping the active state blue. Attribution/geocoder are left alone. */
/* The style switcher is a <select>; an invert filter on it corrupts the native
   option-list popup (the items render with un-inverted colors), so exclude it
   here and theme it explicitly further down. */
.tm-dark .maplibregl-ctrl-group:not(.tm-style-switcher) {
    filter: invert(1) hue-rotate(180deg);
}

/* On the Fiord theme (medium blue-grey), a full invert makes the white panels
   pure black — too heavy against the map. Make the button fill semi-transparent
   so the basemap shows through: after the invert it becomes translucent dark and
   picks up Fiord's blue, reading as a panel that belongs to the map rather than a
   black block. Icons stay opaque (they're separate background-images), so they
   remain crisp/light. Tune the 0.5 alpha for lighter/darker panels. */
.tm-dark .maplibregl-ctrl-group:not(.tm-style-switcher) {
    background-color: transparent !important;
}
.tm-dark .maplibregl-ctrl-group button:not(.active) {
    background-color: rgba(255, 255, 255, 0.5) !important;
}
/* Selected (.active) buttons would otherwise fall back to the faint active tint
   (~8% after invert) and look MORE see-through than unselected ones. Give them a
   slightly more solid panel than the rest; the blue ring still marks selection. */
.tm-dark .maplibregl-ctrl-group button.active {
    background-color: rgba(255, 255, 255, 0.62) !important;
}

/* Coordinate readout (bottom-right) isn't a button group — theme it directly. */
.tm-dark .tm-coords {
    background: rgba(17, 24, 39, 0.85);
    color: #e5e7eb;
}

/* Basemap dropdown — themed explicitly (not via the invert filter) so the open
   option list stays dark with light text. Also swap the chevron to a light one. */
.tm-dark .maplibregl-ctrl-group.tm-style-switcher,
.tm-dark .tm-style-select {
    background-color: #1f2937;
    color: #e5e7eb;
}
.tm-dark .tm-style-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23cbd5e1' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.tm-dark .tm-style-select:hover { background-color: #374151; }
.tm-dark .tm-style-select option {
    background-color: #1f2937;
    color: #e5e7eb;
}

/* Content panels (popups, search, action popovers) hold text/colored content,
   so they get explicit dark colors rather than the invert filter used for the
   monochrome icon buttons. All are children of the .tm-dark map container. */

/* Marker / line popups — was pinned white; flip to dark with light text. */
.tm-dark .maplibregl-popup-content {
    background: #1f2937;
    color: #e5e7eb;
}
.tm-dark .maplibregl-popup-content .maplibregl-popup-close-button { color: #e5e7eb; }
.tm-dark .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.tm-dark .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.tm-dark .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: #1f2937; }
.tm-dark .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.tm-dark .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.tm-dark .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: #1f2937; }
.tm-dark .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: #1f2937; }
.tm-dark .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: #1f2937; }

/* Geocoder search box + suggestions. */
.tm-dark .maplibregl-ctrl-geocoder { background: #1f2937; }
.tm-dark .maplibregl-ctrl-geocoder--input { color: #e5e7eb; }
.tm-dark .maplibregl-ctrl-geocoder--input::placeholder { color: #9ca3af; }
.tm-dark .maplibregl-ctrl-geocoder--icon { fill: #9ca3af; }
.tm-dark .maplibregl-ctrl-geocoder .suggestions {
    background: #1f2937;
    color: #e5e7eb;
}
.tm-dark .maplibregl-ctrl-geocoder .suggestions > .active > a,
.tm-dark .maplibregl-ctrl-geocoder .suggestions > li > a:hover { background: #374151; }
.tm-dark .maplibregl-ctrl-geocoder--suggestion-title { color: #e5e7eb; }
.tm-dark .maplibregl-ctrl-geocoder--suggestion-address { color: #9ca3af; }

/* Draw "Ολοκλήρωση/Άκυρο" + "Επέκταση γραμμής" popovers (incl. arrow). */
.tm-dark .tm-draw-actions,
.tm-dark .tm-draw-actions::before,
.tm-dark .tm-draw-actions .tm-action-btn { background: #1f2937; }
.tm-dark .tm-draw-actions .tm-action-btn { color: #e5e7eb; }
.tm-dark .tm-draw-actions .tm-action-btn + .tm-action-btn { border-left-color: rgba(255, 255, 255, 0.12); }
.tm-dark .tm-draw-actions .tm-action-btn.tm-finish { color: #34d399; }
.tm-dark .tm-draw-actions .tm-action-btn.tm-cancel { color: #f87171; }
.tm-dark .tm-draw-actions .tm-action-btn.tm-finish:hover { background: #064e3b; }
.tm-dark .tm-draw-actions .tm-action-btn.tm-cancel:hover { background: #7f1d1d; }
.tm-dark .tm-extend-actions .tm-action-btn:hover { background: #1e3a8a; color: #bfdbfe; }

.tm-ctrl-heatmap {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.07-2.14-.22-4.05 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.15.43-2.29 1-3a2.5 2.5 0 0 0 2.5 2.5z'/%3E%3C/svg%3E");
}

.tm-ctrl-terrain {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3L12 11L17 6L22 21H2L8 3Z'/%3E%3C/svg%3E");
}

.tm-ctrl-globe {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 2a14.5 14.5 0 0 0 0 20'/%3E%3Cpath d='M12 2a14.5 14.5 0 0 1 0 20'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3C/svg%3E");
}

.tm-ctrl-hillshade {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 3L12 11L17 6L22 21H2L8 3Z'/%3E%3Cpath d='M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19'/%3E%3C/svg%3E");
}

.tm-ctrl-buildings-3d {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 22V4A2 2 0 0 1 8 2H16A2 2 0 0 1 18 4V22Z'/%3E%3Cpath d='M6 12H4A2 2 0 0 0 2 14V20A2 2 0 0 0 4 22H6'/%3E%3Cpath d='M18 9H20A2 2 0 0 1 22 11V20A2 2 0 0 1 20 22H18'/%3E%3Cline x1='10' y1='7' x2='14' y2='7'/%3E%3Cline x1='10' y1='12' x2='14' y2='12'/%3E%3Cline x1='10' y1='17' x2='14' y2='17'/%3E%3C/svg%3E");
}

/* Brief inline message shown on the map (e.g. when 3D buildings is unavailable
   on the current basemap). Auto-removes after a few seconds. */
.tm-inline-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    z-index: 4;
    max-width: 360px;
    text-align: center;
    animation: tm-hint-in 0.2s ease-out;
}

.maplibregl-canvas.tm-insert-vertex-active {
    cursor: crosshair !important;
}

.tm-side-panel {
    height: 760px;
    overflow: hidden;
}

.tm-side-panel .rz-card-body,
.tm-side-panel .rz-tabview,
.tm-side-panel .rz-tabview-panels,
.tm-side-panel .rz-tabview-panel {
    height: 100%;
}

.tm-side-panel .rz-tabview-panel {
    overflow: auto;
}

.tm-panel-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--rz-border);
    border-radius: 6px;
    background: var(--rz-base-50);
}

.tm-panel-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tm-panel-main strong,
.tm-panel-main span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tm-panel-main span {
    color: var(--rz-text-secondary-color);
    font-size: 12px;
}

.tm-panel-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ===========================================================
   Floating Finish / Cancel popover — anchored next to the active
   draw button (Leaflet Geoman style). Positioned via JS by
   DrawActionsPopover.setMode, vertically centered on its anchor.
   =========================================================== */
.tm-draw-actions {
    position: absolute;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    background: #fff;
    border-radius: 6px;
    transform: translateY(-50%);
    z-index: 5;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.22),
        0 0 0 1px rgba(0, 0, 0, 0.06);
    pointer-events: auto;
}

/* Arrow pointing back to the anchor button. */
.tm-draw-actions::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    width: 12px;
    height: 12px;
    background: #fff;
    transform: translateY(-50%) rotate(45deg);
    box-shadow: -1px 1px 2px rgba(0, 0, 0, 0.06);
}

.tm-draw-actions .tm-action-btn {
    position: relative; /* sit above the ::before arrow */
    background: #fff;
    border: 0;
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1f2937;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
    box-sizing: border-box;
    line-height: 1;
}

.tm-draw-actions .tm-action-btn + .tm-action-btn {
    border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.tm-draw-actions .tm-action-btn.tm-finish { color: #047857; }
.tm-draw-actions .tm-action-btn.tm-cancel { color: #b91c1c; }

.tm-draw-actions .tm-action-btn.tm-finish:hover { background: #ecfdf5; }
.tm-draw-actions .tm-action-btn.tm-cancel:hover { background: #fef2f2; }

/* Extend-line popover variant — uppercase labels lose readability for
   Greek text, so we use sentence case and a subtle blue hover tint. */
.tm-extend-actions .tm-action-btn {
    text-transform: none;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 8px 16px;
}
.tm-extend-actions .tm-action-btn:hover {
    background: #eff6ff;
    color: #1d4ed8;
}

/* ===========================================================
   Vehicles view: left checklist + map
   =========================================================== */
.tm-vehicles-split {
    display: flex;
    gap: 1rem;
    height: 72vh;
    min-height: 480px;
}
.tm-vehicles-list {
    flex: 0 0 260px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--rz-border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--rz-base-background-color, #fff);
}
.tm-vehicles-list-header {
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--rz-border);
}
.tm-vehicles-scroll {
    overflow-y: auto;
    padding: 0.25rem;
}
.tm-vehicle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 4px;
}
.tm-vehicle-item:hover { background: var(--rz-base-200, #f3f4f6); }
.tm-vehicle-item.is-active { background: rgba(37, 99, 235, 0.1); }
/* Short colored bar showing a line's color in the lines-map checklist. */
.tm-line-swatch {
    width: 18px;
    height: 4px;
    border-radius: 2px;
    flex: 0 0 auto;
}
.tm-vehicle-name {
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-vehicle-name:hover { text-decoration: underline; }
.tm-vehicles-map {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;   /* anchor for the floating window overlay */
    display: flex;        /* let the tab workspace fill the area */
}

/* Wrapper around the stops-dialog map so the window overlay has a positioned
   ancestor to fill. Takes the flex slot the MapView used to hold directly. */
.tm-stops-map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
}
.tm-stops-map-wrap .tm-map-edit-map {
    flex: 1 1 auto;
    min-height: 0;
}

/* Modern vehicle popup: bold title + a tidy label/value grid. Colors inherit
   from .maplibregl-popup-content, so it adapts to light/dark automatically. */
.tm-veh-popup-wrap .maplibregl-popup-content {
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.tm-veh-popup { min-width: 184px; font-size: 12px; line-height: 1.35; }
.tm-veh-popup__title {
    font-weight: 700;
    font-size: 13.5px;
    padding-right: 22px;   /* room for the (bigger) close button */
    margin-bottom: 7px;
}
/* Bigger, easier-to-hit close button for the vehicle popup. */
.tm-veh-popup-wrap .maplibregl-popup-close-button {
    width: 26px;
    height: 26px;
    font-size: 20px;
    line-height: 24px;
    padding: 0;
    border-radius: 6px;
    color: #6b7280;
}
.tm-veh-popup-wrap .maplibregl-popup-close-button:hover {
    background: rgba(0, 0, 0, 0.07);
    color: inherit;
}
.tm-dark .tm-veh-popup-wrap .maplibregl-popup-close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}
.tm-veh-popup__grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 16px;
    align-items: center;          /* vertically center icon+label with the value */
}
.tm-veh-popup__label {
    color: #6b7280;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;          /* center the icon against the label text */
    gap: 6px;
    line-height: 1;
}
.tm-veh-popup__ico {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
    /* Nudge up ~1px: text sits slightly high in its line box, so a strictly
       center-aligned icon optically reads a touch low. */
    transform: translateY(-1px);
    opacity: 0.85;
}
.tm-veh-popup__value {
    font-weight: 600;
    text-align: right;
    white-space: nowrap;          /* never wrap — the popup widens to fit instead */
    font-variant-numeric: tabular-nums;
}
/* Speed is the key live metric — make it stand out. */
.tm-veh-popup__value--speed { font-size: 14.5px; font-weight: 700; }
.tm-dark .tm-veh-popup__label { color: #9ca3af; }

/* Optional description line under the popup title (e.g. for stops). */
.tm-veh-popup__desc { color: #6b7280; margin-top: 2px; }
.tm-dark .tm-veh-popup__desc { color: #9ca3af; }

/* Popup action buttons (bottom-left): e.g. Καρτέλα Γραμμής / Τροχιά / Καρτέλα Στάσης. */
.tm-veh-popup__actions {
    display: flex;
    gap: 6px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.tm-dark .tm-veh-popup__actions { border-top-color: rgba(255, 255, 255, 0.12); }
.tm-popup-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 6px;
    background: transparent;
    color: #374151;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.tm-popup-action:hover { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tm-popup-action__ico { width: 16px; height: 16px; }
.tm-dark .tm-popup-action { color: #cbd5e1; border-color: rgba(255, 255, 255, 0.18); }
.tm-dark .tm-popup-action:hover { background: #1e3a8a; color: #bfdbfe; border-color: #1e40af; }

/* Live vehicle HTML markers (maplibregl.Marker custom element). Circular badge
   so DB photos and the default icon both read cleanly on the map. */
.tm-vehicle-marker {
    width: 36px;
    height: 36px;
    cursor: pointer;
    /* No `position` here: MapLibre sets position:absolute on the marker element
       and positions it via transform. Overriding it (e.g. to relative) drifts the
       marker off its point. The absolute label below anchors to that absolute box. */
}
.tm-vehicle-marker img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    display: block;
}

/* Stop markers — same look/size as the original (circular badge with white
   border); the icon (StationIcon data URI) is a colored station circle. */
.tm-stop-marker {
    width: 36px;
    height: 36px;
    cursor: pointer;
    /* See .tm-vehicle-marker: no `position` override — MapLibre owns it. */
}
.tm-stop-marker img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: #fff;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    display: block;
}

/* Permanent name label beside a marker. Hidden by default; the labels toggle
   adds .tm-labels-on to the map container to reveal them. Absolutely positioned
   so it doesn't shift the icon off its coordinate. */
.tm-marker-label {
    position: absolute;
    left: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%);
    /* `pre` keeps single-line labels on one line AND honours "\n" in the text,
       so a Label like "ΚΗΥ-1023\n42 km/h" renders on two lines. */
    white-space: pre;
    background: rgba(255, 255, 255, 0.92);
    color: #1f2937;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    display: none;
}
.tm-labels-on .tm-marker-label { display: block; }
.tm-dark .tm-marker-label { background: rgba(31, 41, 55, 0.92); color: #e5e7eb; }

/* ===========================================================
   In-map floating windows (Τροχιά, Καρτέλα Γραμμής, Καρτέλα Στάσης)
   Rendered by MapWindowHost; drag + z-order handled in map-windows.js.
   =========================================================== */
.tm-map-window-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;        /* windows are clamped to the map area */
    pointer-events: none;    /* let map clicks through... */
    z-index: 5;
}
.tm-map-window {
    position: absolute;
    pointer-events: auto;    /* ...except over a window */
    display: flex;
    flex-direction: column;
    max-height: calc(100% - 24px);
    background: #fff;
    color: #1f2937;
    border: 1px solid #d4d9e0;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    font-size: 0.85rem;
    animation: tm-win-in 0.14s ease-out;
}
@keyframes tm-win-in {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}
.tm-map-window__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.45rem 0.45rem 0.75rem;
    background: linear-gradient(180deg, #f8fafc, #eef2f7);
    border-bottom: 1px solid #e2e8f0;
    cursor: grab;
    user-select: none;
    touch-action: none;      /* let pointer drag work on touch */
}
.tm-map-window__header.is-dragging { cursor: grabbing; }
.tm-map-window__title {
    flex: 1 1 auto;
    min-width: 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-map-window__close {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
}
.tm-map-window__close:hover { background: #e2e8f0; color: #0f172a; }
.tm-map-window__body {
    padding: 0.75rem;
    overflow: auto;
    color: #1f2937;
}
/* RadzenText colors itself from the Radzen app theme (--rz-text-color), which
   may be light and would vanish on the white card. Force the window content to
   inherit the card's own readable color instead; secondary text gets a softer
   but still-legible tone. */
.tm-map-window__body :is(p, span, strong, h1, h2, h3, h4, h5, h6,
    .rz-text-subtitle1, .rz-text-subtitle2, .rz-text-body1, .rz-text-body2,
    .rz-text-caption, .rz-text-overline) {
    color: inherit !important;
}
.tm-map-window__body .rz-color-text-secondary { color: #6b7280 !important; }

/* Compact key/value grid for window/tab content (speed, GPS time, …). */
.tm-win-kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 3px 12px;
    margin: 0 0 8px;
    font-size: 0.84rem;
}
.tm-win-kv__k { color: #6b7280; }
/* Window bodies force their text to inherit (see the !important rule above), so
   the label colour needs !important there to win; tabs have no such rule. */
.tm-map-window__body .tm-win-kv__k { color: #6b7280 !important; }
.tm-win-kv__v { font-weight: 600; }
.tm-dark-ctx .tm-win-kv__k { color: #94a3b8; }

/* Dark theme: the map JS adds .tm-dark-ctx to the wrapper that holds both the
   map and this window layer (see reflectDarkContext in maplibre-app.js). */
.tm-dark-ctx .tm-map-window {
    background: #1f2937;
    color: #e5e7eb;
    border-color: #374151;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}
.tm-dark-ctx .tm-map-window__body { color: #e5e7eb; }
.tm-dark-ctx .tm-map-window__header {
    background: linear-gradient(180deg, #273343, #1f2937);
    border-bottom-color: #374151;
}
.tm-dark-ctx .tm-map-window__close { color: #94a3b8; }
.tm-dark-ctx .tm-map-window__close:hover { background: #374151; color: #f1f5f9; }
/* Keep Radzen's secondary text readable on the dark card. */
.tm-dark-ctx .tm-map-window__body .rz-color-text-secondary { color: #94a3b8 !important; }
.tm-dark-ctx .tm-map-window__body .tm-win-kv__k { color: #94a3b8 !important; }

/* ===========================================================
   Tabbed-document workspace (MapTabHost): a pinned "Χάρτης" tab + closable
   Καρτέλα tabs. The map pane is kept alive (shown/hidden, not destroyed).
   =========================================================== */
.tm-tabs {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}
.tm-tabs__strip {
    flex: 0 0 auto;
    display: flex;
    align-items: stretch;
    gap: 2px;
    padding: 6px 8px 0;
    overflow-x: auto;
    overflow-y: hidden;   /* overflow-x:auto would otherwise force overflow-y to auto,
                             and the active tab's -1px margin triggers a stray scrollbar */
    border-bottom: 1px solid #d4d9e0;
    background: #eef2f7;
    scrollbar-width: thin;
}
.tm-tabs__tab {
    position: relative;
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: 230px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-top: 2px solid transparent;   /* reserves space for the active accent */
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: transparent;
    color: #64748b;
    font-size: 0.82rem;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background .12s ease, color .12s ease;
}
.tm-tabs__tab:hover { background: rgba(255, 255, 255, 0.6); color: #334155; }
.tm-tabs__tab.is-active {
    background: #fff;
    border-color: #d4d9e0;
    border-top-color: #2563EB;   /* accent IS the top border, so it follows the rounded corners */
    color: #0f172a;
    font-weight: 600;
    margin-bottom: -1px;        /* merge into the white body, hiding the strip border */
    box-shadow: 0 -1px 6px rgba(15, 23, 42, 0.06);
}
/* RadzenIcon renders an <i> glyph. Scope to the LEADING icon (direct child)
   so the close-button icon isn't affected. */
.tm-tabs__tab > i { font-size: 17px; line-height: 1; }
.tm-tabs__tab.is-active > i { color: #2563EB; }
.tm-tabs__label {
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-tabs__close {
    position: relative;
    width: 22px;
    height: 22px;
    margin: 0 -4px 0 2px;
    border-radius: 50%;
    color: #94a3b8;
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}
/* The × is two centered, rotated bars — guaranteed dead-center in the circle,
   with no font-glyph bearing to throw it off. */
.tm-tabs__close::before,
.tm-tabs__close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 11px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
}
.tm-tabs__close::before { transform: translate(-50%, -50%) rotate(45deg); }
.tm-tabs__close::after  { transform: translate(-50%, -50%) rotate(-45deg); }
.tm-tabs__close:hover { background: #e2e8f0; color: #0f172a; }
.tm-tabs__body {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    background: #fff;
}
.tm-tabs__pane {
    display: none;
    height: 100%;
    min-height: 0;
    color: #1f2937;   /* readable base text (cards otherwise inherit a light color) */
}
.tm-tabs__pane.is-active { display: block; }
/* Καρτέλα panes (everything except the map home pane) scroll and get padding. */
.tm-tabs__pane:not(:first-child) {
    overflow: auto;
    padding: 1rem 1.15rem;
}

/* Dark theme (wrapper carries .tm-dark-ctx — see reflectDarkContext). */
.tm-dark-ctx .tm-tabs__strip { background: #1b2532; border-bottom-color: #374151; }
.tm-dark-ctx .tm-tabs__tab { color: #94a3b8; }
.tm-dark-ctx .tm-tabs__tab:hover { background: rgba(255, 255, 255, 0.07); color: #e2e8f0; }
.tm-dark-ctx .tm-tabs__tab.is-active {
    background: #1f2937;
    border-color: #374151;
    border-top-color: #3b82f6;
    color: #f1f5f9;
    box-shadow: none;
}
.tm-dark-ctx .tm-tabs__tab.is-active > i { color: #60a5fa; }
.tm-dark-ctx .tm-tabs__close:hover { background: #374151; color: #f1f5f9; }
.tm-dark-ctx .tm-tabs__body { background: #1f2937; }
.tm-dark-ctx .tm-tabs__pane { color: #e5e7eb; }

/* Καρτέλα content building blocks (shared light/dark). */
.tm-tab-card__title {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    font-weight: 700;
}
.tm-tab-card__note { font-size: 0.82rem; color: #6b7280; }
.tm-dark-ctx .tm-tab-card__note { color: #94a3b8; }

.tm-card-subhead { margin: 0.9rem 0 0.4rem; font-size: 0.85rem; font-weight: 700; }
.tm-card-loading { display: flex; align-items: center; gap: 8px; color: #6b7280; font-size: 0.85rem; }
.tm-dark-ctx .tm-card-loading { color: #94a3b8; }
.tm-card-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.tm-card-table th, .tm-card-table td {
    text-align: left;
    padding: 3px 10px 3px 0;
    border-bottom: 1px solid #eef2f7;
    white-space: nowrap;
}
.tm-card-table th { color: #6b7280; font-weight: 600; }
.tm-dark-ctx .tm-card-table th { color: #94a3b8; }
.tm-dark-ctx .tm-card-table th,
.tm-dark-ctx .tm-card-table td { border-bottom-color: #374151; }

/* ===========================================================
   Style switcher dropdown (bottom-right)
   =========================================================== */
.maplibregl-ctrl-group.tm-style-switcher {
    overflow: hidden;
}
.tm-style-select {
    border: 0;
    background: #fff;
    padding: 6px 28px 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23374151' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 10px 6px;
}
.tm-style-select:hover { background-color: #f9fafb; }

/* ===========================================================
   Live coordinates readout (bottom-right)
   =========================================================== */
.maplibregl-ctrl.tm-coords {
    background: rgba(17, 24, 39, 0.78);
    color: #fff;
    padding: 5px 10px;
    font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
    font-size: 11px;
    line-height: 1;
    border-radius: 4px;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.3px;
}

/* ===========================================================
   Edit hint banner (shown once after first shape is drawn)
   =========================================================== */
/* ===========================================================
   Live measurement HUD shown while drawing or with a line/polygon selected.
   =========================================================== */
.tm-measure-hud {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: baseline;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(17, 24, 39, 0.88);
    color: #fff;
    border-radius: 18px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 3;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.tm-measure-hud--visible {
    display: flex;
}

.tm-measure-hud__label {
    opacity: 0.72;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tm-measure-hud__value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tm-edit-hint {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 10px 36px 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    max-width: 480px;
    line-height: 1.4;
    z-index: 3;
    animation: tm-hint-in 0.25s ease-out;
}
.tm-edit-hint strong { color: #34d399; margin-right: 4px; }
.tm-hint-close {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: #9ca3af;
    transition: color 0.12s ease;
    user-select: none;
}
.tm-hint-close:hover { color: #fff; }

@keyframes tm-hint-in {
    from { opacity: 0; transform: translate(-50%, -8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Geocoder — give it the same shadow as our other controls */
.maplibregl-ctrl-geocoder {
    width: min(380px, calc(100vw - 92px)) !important;
    min-width: min(320px, calc(100vw - 92px)) !important;
    max-width: calc(100vw - 92px) !important;
    box-shadow:
        0 2px 6px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(0, 0, 0, 0.06) !important;
}

/* Drop the browser's focus rectangle when the search box is focused. */
.maplibregl-ctrl-geocoder--input:focus {
    outline: none;
    box-shadow: none;
}

.maplibregl-ctrl-geocoder--input::-webkit-search-cancel-button,
.maplibregl-ctrl-geocoder--input::-webkit-search-decoration {
    display: none;
    -webkit-appearance: none;
}

.maplibregl-ctrl-geocoder--input::-ms-clear {
    display: none;
}

/* ===========================================================
   Calibration dialog ("Βαθμονόμηση")
   =========================================================== */
.tm-calibration-body {
    padding: 0.25rem 0.25rem 0.5rem;
}

.tm-calibration-previews {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.tm-calibration-card {
    display: flex;
    flex-direction: column;
    background: #f4f6f9;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    overflow: hidden;
}

.tm-calibration-card__title {
    padding: 0.4rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: rgba(0, 0, 0, 0.65);
    background: rgba(0, 0, 0, 0.04);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.tm-calibration-card__plot {
    background: #ffffff;
    height: 220px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
}

.tm-calibration-card__plot svg {
    display: block;
}

.tm-calibration-card__footer {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    color: rgba(0, 0, 0, 0.7);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.02);
}

.tm-calibration-controls {
    padding: 0.25rem 0.25rem 0;
}

.tm-calibration-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.9rem;
    background: #eef2ff;
    border: 1px solid rgba(79, 70, 229, 0.15);
    border-radius: 4px;
    font-size: 0.85rem;
    color: rgba(0, 0, 0, 0.78);
}

.tm-calibration-summary__sep {
    color: rgba(0, 0, 0, 0.35);
    margin: 0 0.35rem;
}
