:root {
    --ink: #203741;
    --muted: #61757e;
    --accent: #166f72;
    --accent-hover: #10595c;
    --line: #d9e3e5;
    --surface: #fff;
    --canvas: #f2f6f6;
    --control-size: 48px;
    --radius: 12px;
    --shadow: 0 4px 20px #20374114;
    --sidebar-width: 440px;
    font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; }
body:has(#map) { overflow: hidden; }
button, input { font: inherit; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid #269fa9; outline-offset: 3px; }
[hidden], .d-none { display: none !important; }
.invisible { visibility: hidden; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.025em; margin: 0 0 16px; }
h1 { font-size: clamp(28px, 5vw, 38px); }
h2 { font-size: 24px; }
h3, h4 { font-size: 20px; }
h6 { font-size: 14px; font-weight: 500; margin: 10px 0; }
p { margin: 0 0 20px; }
.btn, .vacancies-button, .offices-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: var(--control-size); padding: 10px 16px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--surface); color: var(--ink);
    font-size: 15px; font-weight: 600; line-height: 1.3; text-decoration: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: #edf4f4; border-color: #abc4c7; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: white; }
.btn-outline-danger { color: #a32936; border-color: #e5bdc3; }
.icon-button, .toolbar-button, .map-location-button { width: var(--control-size); flex: 0 0 var(--control-size); padding: 0; font-size: 19px; }
.toolbar-button[aria-expanded="true"] { background: #e0efef; border-color: var(--accent); color: var(--accent); }
.toolbar-label { display: none; }
#map { width: 100%; height: 100vh; height: 100dvh; }
.map-toolbar {
    position: fixed; z-index: 20; top: max(20px, env(safe-area-inset-top));
    left: max(20px, env(safe-area-inset-left)); width: min(600px, calc(100% - 40px));
    display: flex; align-items: center; gap: 6px; padding: 6px;
    border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow); backdrop-filter: blur(12px); transition: left .2s;
}
.toolbar-actions, .search-actions { display: flex; align-items: center; gap: 8px; }
.map-toolbar .toolbar-actions { gap: 2px; padding-right: 6px; border-right: 1px solid var(--line); }
.map-toolbar .toolbar-button { width: 44px; min-height: 44px; flex-basis: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); box-shadow: none; }
.map-toolbar .toolbar-button:hover, .map-toolbar .toolbar-button[aria-expanded="true"] { color: var(--accent); background: #e8f1f0; }
.map-toolbar .icon-button { width: 44px; min-height: 44px; flex-basis: 44px; border: 0; border-radius: 8px; }
.map-toolbar .search-form { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.map-toolbar:has(.search-form:focus-within) { border-color: #abc4c7; box-shadow: var(--shadow), 0 0 0 2px #166f7210; }
.search-form { display: flex; flex: 1; min-width: 0; padding: 4px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.search-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px #166f721a; }
.search-form input { width: 100%; min-width: 0; padding: 0 12px; border: 0; background: transparent; color: var(--ink); outline: none; }
.search-form input::placeholder { color: var(--muted); }
.search-actions { gap: 4px; }
#clear-search-button { border-color: transparent; color: var(--muted); }
#clear-search-button.invisible { display: none; }
input::-webkit-search-cancel-button, input::-webkit-calendar-picker-indicator { display: none; }
.active-red .search-form { border-color: #bd4252; }
.map-location-button { margin: 0 10px 12px 0; box-shadow: var(--shadow); }
#toolbar-container.shifted { left: calc(var(--sidebar-width) + 20px); }
.sidebar {
    position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(var(--sidebar-width), 100%);
    height: 100vh; height: 100dvh; background: var(--canvas); box-shadow: var(--shadow);
    display: flex; flex-direction: column; transform: translateX(-105%); visibility: hidden;
    transition: transform .2s, visibility .2s; outline: none;
}
.sidebar.active { transform: translateX(0); visibility: visible; }
.sidebar-content { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: max(24px, env(safe-area-inset-top)) 20px 20px; overflow-wrap: anywhere; }
.close-sidebar-btn-container { flex: none; padding: 12px 20px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.close-sidebar { width: 100%; }
.close-sidebar span { font-size: 24px; line-height: 1; }
.form-check > div { display: flex; align-items: center; gap: 12px; min-height: 48px; }
input[type="checkbox"] { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--accent); cursor: pointer; }
.form-check-label { flex: 1; padding: 12px 0; cursor: pointer; }
#filters-sidebar form { margin-bottom: 28px; }
#filters-sidebar h4 { color: var(--muted); font-size: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; margin-bottom: 16px; overflow-wrap: anywhere; box-shadow: 0 2px 8px #20374105; }
.card > .view { display: flex; justify-content: center; padding: 4px 0 20px; }
.card img { max-width: 100%; max-height: 72px; object-fit: contain; }
.card h2, .card-title { font-size: 22px; margin: 0 0 12px; }
.card h3 { font-size: 18px; margin-top: 24px; }
.card-title a { text-decoration: none; }
.card-text { margin: 20px 0; font-size: 15px; }
.card ul { padding-left: 20px; }
.card .navbar-nav { list-style: none; padding: 0; margin: 0; }
.card .nav-link { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 10px 0; font-size: 14px; text-decoration: none; }
.card .nav-link:hover { text-decoration: underline; }
.card .nav-link i { padding-top: 4px; }
.card .navbar { margin-top: 12px; }
.vacancies-button, .offices-button { width: 100%; text-align: left; background: #f1f6f6; color: var(--accent); }
.vacancies-button > span, .offices-button > span { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px; }
.vacancies-button:hover, .offices-button:hover { background: #e2eeee; }
.collapsed .vacancies-arrow-icon, .collapsed .offices-arrow-icon { transform: rotate(180deg); }
.collapse:not(.show) { display: none; }
#vacancy-city { flex: 0 1 100px; min-width: 0; color: var(--muted); }
.vacancy-name { flex: 1; min-width: 0; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grey-text, .text-muted { color: var(--muted); }
mark { padding: 0; color: inherit; background: #ffe89e; }
.legend-image-container { float: left; display: flex; justify-content: center; align-items: center; width: 52px; height: 52px; margin-right: 12px; }
.loader { position: fixed; inset: 0; z-index: 30; background: #20374133; transition: opacity .3s; }
.loader.loaded { opacity: 0; pointer-events: none; }
#map-error { position: fixed; z-index: 50; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(400px, calc(100% - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: white; text-align: center; box-shadow: var(--shadow); }
#map-error .btn, #map-error a { margin-top: 16px; }
#current-marker { position: absolute; pointer-events: none; border-radius: 50%; }
.animated-marker { animation: marker-pulse .5s; }
@keyframes marker-pulse { from { width: 20px; height: 20px; margin: -10px; background: #166f7260; } to { width: 800px; height: 800px; margin: -400px; background: transparent; } }
.catalog-main { max-width: 1040px; margin: 40px auto; padding: 0 24px 32px; }
.catalog-intro { max-width: 640px; color: var(--muted); }
.catalog-back { margin-bottom: 24px; }
.catalog-search { display: flex; gap: 8px; margin: 28px 0 16px; }
.catalog-search input { flex: 1; min-width: 0; min-height: var(--control-size); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; background: white; }
.catalog-fields { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 20px; }
.catalog-fields label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; cursor: pointer; }
#results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: 16px; align-items: start; }
#results .card { margin: 0; }
#status { color: var(--muted); margin: 16px 0; min-height: 24px; }
#next { display: flex; margin: 24px auto 0; }
@media (max-width: 1100px) {
    #toolbar-container.shifted { visibility: hidden; pointer-events: none; }
    .sidebar-open > .time-machine, .sidebar-open > .map-controls-panel, .sidebar-open > .map-controls-restore { visibility: hidden; pointer-events: none; }
}
@media (max-width: 600px) {
    .map-toolbar { top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); width: calc(100% - max(12px, env(safe-area-inset-left)) - max(12px, env(safe-area-inset-right))); flex-direction: column; align-items: stretch; gap: 4px; }
    .search-form { order: -1; flex: none; }
    .map-toolbar .toolbar-actions { align-self: stretch; gap: 2px; padding: 4px 0 0; border-right: 0; border-top: 1px solid var(--line); }
    .map-toolbar .toolbar-button { width: auto; flex: 1; padding: 0 6px; font-size: 16px; }
    .toolbar-label { display: inline; font-size: 12px; }
    .sidebar-content { padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); }
    .card { padding: 16px; }
    .catalog-main { margin: 20px auto; padding: 0 16px 24px; }
    .catalog-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
    .catalog-fields label { font-size: 13px; }
    .catalog-back { margin-bottom: 20px; }
    #next { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* One shared surface for archive navigation, location, camera and zoom. */
.map-controls-panel { position: fixed; z-index: 10; right: max(16px, env(safe-area-inset-right)); bottom: max(28px, env(safe-area-inset-bottom)); width: 300px; max-width: calc(100vw - 32px); border: 1px solid #dce3e3; border-radius: 14px; background: rgba(255, 255, 255, .96); box-shadow: 0 4px 18px #1c30351a; backdrop-filter: blur(12px); }
.map-controls-panel .time-machine { position: relative; right: auto; bottom: auto; width: 100%; max-width: none; padding: 12px 14px 4px; border: 0; border-radius: 14px 14px 0 0; background: transparent; box-shadow: none; backdrop-filter: none; }
.map-controls-actions { display: flex; align-items: center; gap: 4px; margin: 0 12px; padding: 4px 0; border-top: 1px solid #e3eaea; }
.map-control-button { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #53666c; cursor: pointer; }
.map-control-button:hover:not(:disabled), .map-control-button[aria-expanded="true"] { background: #eef4f3; color: #297b78; }
.map-control-button:focus-visible { outline: 2px solid #39847f; outline-offset: -2px; }
.map-zoom-out { margin-left: auto; }
.map-pan-controls { position: absolute; bottom: calc(100% + 8px); left: 0; display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); padding: 6px; border: 1px solid #dce3e3; border-radius: 12px; background: #fff; box-shadow: 0 4px 20px #1c30351c; }
.map-pan-controls [data-direction="north"] { grid-area: 1 / 2; }
.map-pan-controls [data-direction="west"] { grid-area: 2 / 1; }
.map-pan-controls [data-direction="east"] { grid-area: 2 / 3; }
.map-pan-controls [data-direction="south"] { grid-area: 3 / 2; }

.map-controls-collapse svg { width: 16px; height: 16px; }
.map-controls-restore { position: fixed; z-index: 10; right: max(16px, env(safe-area-inset-right)); bottom: max(28px, env(safe-area-inset-bottom)); border: 1px solid #dce3e3; border-radius: 12px; background: rgba(255, 255, 255, .96); box-shadow: 0 2px 12px #1c30351a; }

/* The same navigation and panel visibility in both map modes. */
.mode-switch { display: flex; gap: 2px; flex-shrink: 0; }
.mode-switch a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 10px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.mode-switch a:hover, .mode-switch a[aria-current="page"] { background: #e0efef; color: var(--accent); }
.map-controls-hidden :is(.map-toolbar, .map-controls-panel, [data-map-chrome]) { display: none !important; }
@media(max-width:600px) {
    .map-toolbar .mode-switch { flex: 1; }
    .map-toolbar .mode-switch a { flex: 1; }
    .map-toolbar .toolbar-actions > .toolbar-button { flex: 0 0 44px; padding: 0; }
    .map-toolbar .toolbar-label { display: none; }
}
