/* Путешествия (travel.html) */
body[data-page="travel"] {
    --tr-land: #d5dbe3;
    --tr-land-stroke: #ffffff;
    --tr-card: var(--color-bg-card, #fff);
    --tr-border: var(--color-border, #e5e7eb);
    --tr-muted: var(--color-text-muted, #6b7280);
    --tr-text: var(--color-text-primary, #111827);
    --tr-soft: var(--color-bg-secondary, #f8fafc);
}
[data-theme="dark"] body[data-page="travel"] {
    --tr-land: #2b3a52;
    --tr-land-stroke: #0b1220;
}
[data-theme="paper"] body[data-page="travel"] {
    --tr-land: #ddd2bf;
    --tr-land-stroke: #fffaf3;
}

body[data-page="travel"] #mainContent { padding-bottom: 96px; }
.tr-muted { color: var(--tr-muted); font-size: 0.9em; }
.tr-hint { color: var(--tr-muted); font-size: 12px; margin: 6px 2px 12px; }
.tr-spacer { flex: 1; }
.tr-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 11px;
    border: 1px solid var(--tr-border);
    border-radius: 10px;
    background: var(--tr-card);
    color: var(--tr-text);
    font: inherit;
    font-size: 15px;
}
.tr-input:focus { outline: 2px solid var(--color-focus-ring, #93c5fd); outline-offset: 0; }
textarea.tr-input { resize: vertical; min-height: 64px; }

/* ---- итоги ---- */
.tr-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin: 4px 0 14px;
}
.tr-stat {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 10px;
    align-items: baseline;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--tr-border);
    border-radius: 14px;
    background: var(--tr-card);
    color: var(--tr-text);
    cursor: pointer;
    font: inherit;
}
.tr-stat:hover { border-color: var(--color-primary, #3b82f6); }
.tr-stat-icon { grid-row: 1 / span 3; font-size: 26px; align-self: center; }
.tr-stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; }
.tr-stat-value small { font-size: 14px; font-weight: 600; color: var(--tr-muted); }
.tr-stat-label { font-size: 13px; color: var(--tr-muted); }
.tr-stat-sub { font-size: 11px; color: var(--tr-muted); opacity: 0.85; }

/* ---- вкладки ---- */
.tr-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    border-radius: 14px;
    background: var(--tr-soft);
    border: 1px solid var(--tr-border);
    margin-bottom: 14px;
}
.tr-tab {
    flex: 1;
    padding: 9px 8px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--tr-muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.tr-tab.active { background: var(--tr-card); color: var(--tr-text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08); }

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

/* ---- хороплет ---- */
.tr-choropleth-wrap {
    position: relative;
    border-radius: 16px;
    background: var(--tr-card);
    border: 1px solid var(--tr-border);
    overflow: hidden;
}
.tr-choropleth {
    display: block;
    width: 100%;
    height: auto;
    max-height: 62vh;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
    cursor: grab;
}
.tr-shape {
    fill: var(--tr-land);
    stroke: var(--tr-land-stroke);
    stroke-width: 0.6;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    transition: fill 0.15s;
}
.tr-shape:hover { filter: brightness(0.92); }
.tr-shape.is-visited { fill: var(--c); }
.tr-shape.is-lived { fill: var(--c); stroke: var(--tr-text); stroke-width: 1.2; }
.tr-shape.is-want { fill: color-mix(in srgb, var(--c) 28%, var(--tr-land)); stroke: var(--c); stroke-dasharray: 3 2; stroke-width: 1; }

.tr-map-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--tr-muted);
    border-top: 1px solid var(--tr-border);
    flex-wrap: wrap;
}
.tr-map-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.tr-lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; background: #3b82f6; }
.tr-lg.is-lived { box-shadow: inset 0 0 0 1.5px var(--tr-text); }
.tr-lg.is-want { background: color-mix(in srgb, #3b82f6 28%, var(--tr-land)); outline: 1px dashed #3b82f6; }
.tr-zoom { margin-left: auto; gap: 4px !important; }
.tr-zoom button {
    width: 28px; height: 28px;
    border-radius: 8px;
    border: 1px solid var(--tr-border);
    background: var(--tr-soft);
    color: var(--tr-text);
    font-size: 16px;
    cursor: pointer;
}

.tr-area-toolbar, .tr-picker-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 8px;
}
.tr-picker-bar[hidden] { display: none; }
.tr-area-toolbar [hidden] { display: none; }
.tr-area-total { flex: 1; display: flex; align-items: center; justify-content: space-between; font-size: 17px; font-weight: 700; color: var(--tr-muted); }
.tr-badge {
    font-size: 14px;
    padding: 2px 8px;
    border-radius: 8px;
    border: 1.5px solid var(--tr-muted);
    color: var(--tr-text);
}
.tr-seg { display: inline-flex; border: 1px solid var(--tr-border); border-radius: 10px; overflow: hidden; flex-shrink: 0; }
.tr-seg button {
    padding: 7px 11px;
    border: 0;
    background: var(--tr-card);
    color: var(--tr-muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.tr-seg button.active { background: var(--color-primary, #3b82f6); color: #fff; }

.tr-group { margin-bottom: 6px; border-radius: 12px; overflow: hidden; border: 1px solid var(--tr-border); background: var(--tr-card); }
.tr-group-head {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 9px 12px;
    border: 0;
    background: color-mix(in srgb, var(--c) 12%, var(--tr-card));
    color: var(--c);
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
}
.tr-group-count { display: inline-flex; gap: 8px; align-items: center; }
.tr-caret { font-style: normal; font-size: 16px; }
.tr-area-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-top: 1px solid var(--tr-border);
    cursor: pointer;
}
.tr-area-row:hover { background: var(--tr-soft); }
.tr-flag { font-size: 26px; line-height: 1; width: 36px; text-align: center; flex-shrink: 0; }
.tr-flag-ru {
    font-size: 11px;
    font-weight: 700;
    color: var(--tr-muted);
    border: 1px solid var(--tr-border);
    border-radius: 6px;
    padding: 5px 0;
}
.tr-area-row.is-visited .tr-flag-ru, .tr-area-row.is-lived .tr-flag-ru { color: #fff; background: var(--c, #22c55e); border-color: transparent; }
.tr-group .tr-area-row.is-visited .tr-flag-ru, .tr-group .tr-area-row.is-lived .tr-flag-ru { background: var(--c); }
.tr-area-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tr-area-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-area-name small { font-size: 12px; color: var(--tr-muted); }
.tr-area-row.is-visited .tr-area-name small, .tr-area-row.is-lived .tr-area-name small { color: #16a34a; }
.tr-area-row.is-want .tr-area-name small { color: #d97706; }
.tr-sil-wrap { width: 40px; flex-shrink: 0; }
.tr-sil { width: 40px; height: 26px; display: block; }
.tr-sil path { fill: var(--c, #94a3b8); }
.tr-tick {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 2px solid var(--c, #94a3b8);
    background: transparent;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
}
.tr-tick.on { background: var(--c, #22c55e); }

.tr-empty {
    padding: 22px 16px;
    text-align: center;
    color: var(--tr-muted);
    border: 1px dashed var(--tr-border);
    border-radius: 14px;
    line-height: 1.5;
}

/* ---- карточка территории (bottom sheet) ---- */
.tr-sheet, .tr-modal {
    position: fixed;
    inset: 0;
    z-index: 60000;
    background: rgba(2, 6, 23, 0.45);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.tr-sheet[hidden], .tr-modal[hidden], .tr-lightbox[hidden], .tr-toast[hidden] { display: none; }
.tr-sheet-card {
    position: relative;
    width: min(560px, 100%);
    max-height: 80vh;
    overflow: auto;
    background: var(--tr-card);
    color: var(--tr-text);
    border-radius: 20px 20px 0 0;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
}
.tr-x {
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 0;
    background: var(--tr-soft);
    color: var(--tr-text);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.tr-sheet-head { display: flex; align-items: center; gap: 12px; padding-right: 40px; }
.tr-sheet-head h3 { margin: 0; font-size: 20px; }
.tr-sheet-head small { color: var(--tr-muted); }
.tr-sheet-flag { font-size: 40px; line-height: 1; }
.tr-sheet-sil .tr-sil { width: 60px; height: 40px; }
.tr-sheet-sil .tr-sil path { fill: var(--color-primary, #3b82f6); }
.tr-status-row { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.tr-status-row button {
    flex: 1;
    padding: 9px 6px;
    border-radius: 10px;
    border: 1px solid var(--tr-border);
    background: var(--tr-soft);
    color: var(--tr-text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}
.tr-status-row button.active { background: var(--color-primary, #3b82f6); border-color: transparent; color: #fff; }
.tr-sheet-sec { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tr-muted); margin: 12px 0 4px; }
.tr-sheet-body { margin-bottom: 12px; }
.tr-mini {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border: 0;
    border-bottom: 1px solid var(--tr-border);
    background: transparent;
    color: var(--tr-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.tr-mini span:nth-child(2) { flex: 1; }
.tr-mini small { color: var(--tr-muted); }

/* ---- места ---- */
.tr-places-top { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.tr-places-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.tr-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tr-chips:empty { display: none; }
.tr-chip {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid var(--tr-border);
    background: var(--tr-card);
    color: var(--tr-text);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.tr-chip small { color: var(--tr-muted); }
.tr-chip.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 16%, var(--tr-card)); }
.tr-leaflet {
    position: relative;
    height: 56vh;
    min-height: 320px;
    border-radius: 16px;
    border: 1px solid var(--tr-border);
    overflow: hidden;
    z-index: 0;
}
.tr-leaflet-small { height: 240px; min-height: 0; margin: 8px 0 2px; }
.tr-pin-wrap { background: none; border: 0; }
.tr-pin {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--c);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    font-size: 15px;
    line-height: 1;
}
.tr-pin.is-want { border-style: dashed; opacity: 0.8; }
.tr-popup-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.tr-popup-sub { color: #64748b; font-size: 12px; }
.tr-popup-notes { margin-top: 6px; font-size: 12px; }
.tr-popup-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tr-popup-actions button, .tr-popup-actions a {
    padding: 5px 9px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
}

.tr-place-list { display: flex; flex-direction: column; gap: 6px; }
.tr-place-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 12px;
    border: 1px solid var(--tr-border);
    background: var(--tr-card);
    cursor: pointer;
}
.tr-place-row:hover { border-color: var(--color-primary, #3b82f6); }
.tr-place-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--c) 16%, var(--tr-card));
    font-size: 17px;
    flex-shrink: 0;
}
.tr-place-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tr-place-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-place-name small { color: var(--tr-muted); font-size: 12px; }
.tr-pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--tr-soft); color: var(--tr-muted); }
.tr-pill.ok { background: color-mix(in srgb, #22c55e 18%, var(--tr-card)); color: #16a34a; }

/* ---- визиты ---- */
.tr-visits-top { display: flex; gap: 10px; margin-bottom: 12px; }
.tr-year { font-size: 22px; font-weight: 800; margin: 18px 2px 8px; }
.tr-year small { font-size: 13px; color: var(--tr-muted); font-weight: 600; }
.tr-visit {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--tr-border);
    background: var(--tr-card);
    margin-bottom: 8px;
    cursor: pointer;
}
.tr-visit:hover { border-color: var(--color-primary, #3b82f6); }
.tr-visit-icon { font-size: 26px; line-height: 1.2; width: 32px; text-align: center; flex-shrink: 0; }
.tr-visit-main { flex: 1; min-width: 0; }
.tr-visit-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tr-visit-head b { font-size: 16px; }
.tr-visit-date { font-size: 13px; color: var(--tr-muted); white-space: nowrap; }
.tr-visit-where { font-size: 13px; color: var(--tr-muted); margin-top: 2px; }
.tr-visit-stars { color: #f59e0b; letter-spacing: 1px; margin-top: 2px; }
.tr-visit-stars span { color: var(--tr-border); }
.tr-visit-notes { font-size: 14px; margin-top: 6px; white-space: pre-line; }
.tr-thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tr-thumb {
    position: relative;
    width: 72px; height: 72px;
    border-radius: 10px;
    background: var(--tr-soft) center / cover no-repeat;
    flex-shrink: 0;
    cursor: zoom-in;
}
.tr-thumb:not(.loaded)::after { content: '📷'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0.4; }
.tr-thumb.broken::after { content: '🚫'; }
.tr-thumb-more { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--tr-muted); cursor: pointer; }
.tr-thumb-more::after { content: none !important; }
.tr-thumb-pending { opacity: 0.75; cursor: default; }
.tr-thumb-pending button {
    position: absolute; top: 2px; right: 2px;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 0;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    cursor: pointer;
}
.tr-visit-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tr-visit-tags:empty { display: none; }
.tr-tag {
    font-size: 12px;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid var(--tr-border);
    background: var(--tr-soft);
    color: var(--tr-text);
    text-decoration: none;
}
.tr-tag:hover { border-color: var(--color-primary, #3b82f6); }
.tr-tag-planner { color: #0284c7; }

/* ---- модалки ---- */
.tr-modal { align-items: center; padding: 16px; }
.tr-modal-card {
    position: relative;
    width: min(620px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: var(--tr-card);
    color: var(--tr-text);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
}
#trPlaceModal { z-index: 60010; }
.tr-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tr-modal-head h3 { margin: 0; font-size: 19px; }
.tr-modal-head .tr-x { position: static; }
.tr-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--tr-muted); }
.tr-field[hidden] { display: none; }
.tr-field .tr-muted { font-weight: 400; }
.tr-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tr-where { font-size: 14px; font-weight: 500; color: var(--tr-text); padding: 9px 0; }
.tr-where small { color: var(--tr-muted); }
.tr-geo-search { display: flex; gap: 8px; }
.tr-geo-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.tr-geo-item {
    text-align: left;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--tr-border);
    background: var(--tr-soft);
    color: var(--tr-text);
    font: inherit;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}
.tr-geo-item small { color: var(--tr-muted); font-size: 12px; }
.tr-cat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tr-cat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 7px 2px;
    border-radius: 10px;
    border: 1.5px solid var(--tr-border);
    background: var(--tr-card);
    color: var(--tr-text);
    font: inherit;
    cursor: pointer;
}
.tr-cat span { font-size: 20px; }
.tr-cat small { font-size: 10.5px; font-weight: 500; line-height: 1.15; text-align: center; color: var(--tr-muted); }
.tr-cat.active { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--tr-card)); }
.tr-cat.active small { color: var(--tr-text); }
.tr-stars { display: flex; gap: 4px; }
.tr-stars button {
    border: 0;
    background: none;
    font-size: 26px;
    color: var(--tr-border);
    cursor: pointer;
    padding: 0 2px;
}
.tr-stars button.on { color: #f59e0b; }
.tr-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.tr-link-row { display: grid; grid-template-columns: 1fr 140px 32px; gap: 6px; align-items: center; }
.tr-link-row .tr-x { position: static; }
.tr-photo-grid { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.tr-file-btn { align-self: flex-start; cursor: pointer; }
.tr-check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 4px 0 12px; cursor: pointer; }
.tr-check[hidden] { display: none; }
.tr-check input { width: 18px; height: 18px; margin-top: 1px; }
.tr-from-task {
    padding: 9px 12px;
    border-radius: 10px;
    background: color-mix(in srgb, #0ea5e9 12%, var(--tr-card));
    font-size: 13px;
    margin-bottom: 12px;
}
.tr-modal-foot {
    display: flex;
    gap: 8px;
    align-items: center;
    position: sticky;
    bottom: -18px;
    margin: 8px -18px -18px;
    padding: 12px 18px;
    background: var(--tr-card);
    border-top: 1px solid var(--tr-border);
}

/* ---- лайтбокс ---- */
.tr-lightbox {
    position: fixed;
    inset: 0;
    z-index: 60020;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tr-lightbox img { max-width: 94vw; max-height: 82vh; object-fit: contain; border-radius: 6px; }
.tr-lightbox .tr-x { background: rgba(255, 255, 255, 0.15); color: #fff; z-index: 2; }
.tr-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 64px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 34px;
    cursor: pointer;
}
.tr-lb-prev { left: 10px; }
.tr-lb-next { right: 10px; }
.tr-lb-bar {
    position: absolute;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0;
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    color: #e2e8f0;
    font-size: 13px;
    flex-wrap: wrap;
    padding: 0 12px;
}
.tr-lb-bar a, .tr-lb-bar button { color: #e2e8f0; background: none; border: 0; font: inherit; cursor: pointer; text-decoration: underline; }

.tr-toast {
    position: fixed;
    left: 50%;
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    z-index: 60030;
    padding: 10px 16px;
    border-radius: 12px;
    background: #0f172a;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    max-width: calc(100vw - 32px);
}
.tr-toast.is-error { background: #b91c1c; }

/* ---- мобильные ---- */
@media (max-width: 768px) {
    .tr-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
    .tr-stat-label { font-size: 11px; }
    .tr-stat { grid-template-columns: 1fr; padding: 9px 10px; text-align: center; justify-items: center; }
    .tr-stat-icon { grid-row: auto; font-size: 18px; }
    .tr-stat-value { font-size: 19px; }
    .tr-stat-sub { display: none; }
    .tr-stat:nth-child(n+5) { display: none; }
    .tr-tab span { display: none; }
    .tr-tab { font-size: 20px; padding: 7px 4px; }
    .tr-tab { white-space: nowrap; }
    .tr-tab.active { flex: 2.4; }
    .tr-tab.active span { display: inline; font-size: 14px; }
    .tr-leaflet { height: 48vh; }
    .tr-modal { padding: 0; align-items: flex-end; }
    .tr-modal-card { border-radius: 18px 18px 0 0; max-height: 94vh; padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
    .tr-cat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tr-row { grid-template-columns: 1fr; gap: 0; }
    .tr-link-row { grid-template-columns: 1fr 32px; }
    .tr-link-row [data-lf="title"] { grid-row: 2; }
    .tr-thumb { width: 64px; height: 64px; }
}
.tr-status-row button[hidden] { display: none; }
[data-theme="dark"] .tr-tiles-scheme { filter: invert(0.92) hue-rotate(180deg) brightness(0.95) contrast(0.9); }
.tr-visits-top .btn, .tr-places-actions .btn, .tr-area-toolbar .btn { white-space: nowrap; flex-shrink: 0; }
.tr-field > .btn { align-self: flex-start; }

/* ---- ЮНЕСКО ---- */
.tr-un-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.tr-un-count { flex: 1; text-align: center; font-size: 15px; color: var(--tr-muted); white-space: nowrap; }
.tr-un-count b { color: var(--tr-text); font-size: 18px; }
.tr-un-progress { height: 6px; border-radius: 999px; background: var(--tr-soft); border: 1px solid var(--tr-border); overflow: hidden; margin-bottom: 10px; }
.tr-un-progress i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #f59e0b); border-radius: inherit; }
#trUnMap[hidden], .tr-hint[hidden], #trUnListWrap[hidden] { display: none; }
#trUnMap { height: 62vh; }
.tr-un-country { cursor: default; }
.tr-un-icon {
    width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--c);
    background: color-mix(in srgb, var(--c) 12%, var(--tr-card));
    font-size: 16px;
    flex-shrink: 0;
}
.tr-un-row.is-visited .tr-un-icon, .tr-un-row.is-lived .tr-un-icon { background: var(--c); }
.tr-un-row .tr-area-name b { white-space: normal; }
.tr-un-row.is-visited .tr-area-name small { color: #16a34a; }
.tr-un-badge {
    width: 52px; height: 52px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--c);
    background: color-mix(in srgb, var(--c) 14%, var(--tr-card));
    font-size: 24px;
    flex-shrink: 0;
}
.tr-un-facts { margin-top: 12px; border-top: 1px solid var(--tr-border); }
.tr-un-facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--tr-border); font-size: 14px; }
.tr-un-facts span { color: var(--tr-muted); }
.tr-un-facts b { text-align: right; }
.tr-un-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tr-un-actions a { text-decoration: none; }
@media (max-width: 768px) {
    .tr-un-top { gap: 6px; }
    .tr-un-top .tr-seg button { padding: 7px 8px; }
    .tr-un-count { order: 3; flex-basis: 100%; }
    #trUnMap { height: 56vh; }
}
.tr-cat-switch { margin-bottom: 10px; }
.tr-cat-switch .tr-chip.active { background: var(--color-primary, #3b82f6); border-color: transparent; color: #fff; }
.tr-cat-switch .tr-chip.active small { color: rgba(255, 255, 255, 0.85); }
#trUnType[hidden] { display: none; }
@media (max-width: 768px) {
    .tr-cat-switch { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .tr-cat-switch .tr-chip { flex-shrink: 0; }
}
.tr-un-filters { margin-bottom: 0; }
/* Фильтр — одной строкой: статус и чипы рядом, мельче */
#trUnFilters { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
#trUnFilters .tr-seg { align-self: center; border-radius: 999px; }
#trUnFilters .tr-seg button { padding: 5px 10px; font-size: 12.5px; }
#trUnFilters .tr-chip { font-size: 12.5px; padding: 4px 9px; }
#trUnFilters .tr-chips { flex: 1 1 0; min-width: 240px; }
button.tr-un-country { cursor: pointer; }
.tr-un-filters .tr-chip { font-size: 12.5px; padding: 5px 10px; }
.tr-un-filters .tr-chip.active { background: color-mix(in srgb, var(--color-primary, #3b82f6) 16%, var(--tr-card)); border-color: var(--color-primary, #3b82f6); }
#trUnType[hidden] { display: none; }
@media (max-width: 768px) {
    .tr-un-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .tr-un-filters .tr-chip { flex-shrink: 0; }
}

/* ==== Шапка как в Mark O'Travel: ☰ — название — действия ==== */
.tr-bar {
    position: sticky;
    top: 0;
    z-index: 500;
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin: 0 -12px 10px;
    background: color-mix(in srgb, var(--tr-card) 70%, transparent);
    border-radius: 0 0 18px 18px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.tr-round, .tr-act {
    position: relative;
    width: 44px; height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--tr-border);
    background: var(--tr-card);
    color: var(--tr-text);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.tr-round svg, .tr-act svg, .tr-title svg {
    width: 22px; height: 22px;
    fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.tr-title {
    justify-self: center;
    display: inline-flex; align-items: center; gap: 4px;
    max-width: 100%;
    border: 0; background: none;
    color: var(--tr-text);
    font: inherit; font-size: 19px; font-weight: 800;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 12px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-title svg { width: 18px; height: 18px; color: var(--tr-muted); flex-shrink: 0; }
.tr-title:hover { background: var(--tr-soft); }
.tr-pill {
    display: inline-flex; gap: 2px;
    padding: 3px;
    border-radius: 999px;
    border: 1px solid var(--tr-border);
    background: var(--tr-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    min-width: 44px;
}
.tr-pill:empty { visibility: hidden; }
.tr-pill .tr-act { width: 38px; height: 38px; border: 0; box-shadow: none; background: transparent; }
.tr-pill .tr-act.active { background: var(--color-primary, #3b82f6); color: #fff; }
.tr-dot {
    position: absolute; top: 6px; right: 6px;
    width: 8px; height: 8px; border-radius: 50%;
    background: #f97316;
    border: 2px solid var(--tr-card);
}
.tr-filters { margin: -2px 0 12px; display: flex; flex-direction: column; gap: 8px; }
.tr-filters[hidden] { display: none; }
.tr-filters .tr-seg { align-self: flex-start; }

/* ==== Меню разделов ==== */
.tr-nav-card { padding-top: 22px; }
.tr-nav-sec { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tr-muted); margin: 6px 4px 6px; }
.tr-nav-sec ~ .tr-nav-sec { margin-top: 16px; }
.tr-nav-item {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px;
    border: 0; border-radius: 12px;
    background: transparent;
    color: var(--tr-text);
    font: inherit; font-size: 16px; text-align: left;
    cursor: pointer;
}
.tr-nav-item:hover { background: var(--tr-soft); }
.tr-nav-item.active { background: color-mix(in srgb, var(--color-primary, #3b82f6) 14%, var(--tr-card)); font-weight: 700; }
.tr-nav-icon { font-size: 22px; width: 28px; text-align: center; }
.tr-nav-label { flex: 1; }
.tr-nav-count { font-size: 13px; color: var(--tr-muted); font-variant-numeric: tabular-nums; }
.tr-nav-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.tr-nav-grid .tr-nav-item { flex-wrap: wrap; row-gap: 0; padding: 10px; }
.tr-nav-grid .tr-nav-count { width: 100%; padding-left: 40px; font-size: 12px; }

/* ==== Легенда и масштаб — поверх карты, без отдельной строки ==== */
.tr-choropleth-wrap .tr-map-legend {
    position: absolute; inset: 0;
    padding: 0; border: 0;
    pointer-events: none;
}
.tr-legend-keys {
    position: absolute; left: 10px; bottom: 8px;
    display: inline-flex; gap: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tr-card) 85%, transparent);
    font-size: 11px;
}
.tr-legend-keys > span { display: inline-flex; align-items: center; gap: 4px; }
.tr-choropleth-wrap .tr-zoom {
    position: absolute; right: 8px; top: 8px;
    display: flex; flex-direction: column; gap: 4px !important;
    margin: 0;
    pointer-events: auto;
}
.tr-choropleth-wrap .tr-zoom button { width: 30px; height: 30px; background: color-mix(in srgb, var(--tr-card) 90%, transparent); }
.tr-area-toolbar { margin: 12px 0 8px; }
.tr-un-top { margin-bottom: 6px; }
.tr-un-count { text-align: left; font-size: 14px; }

@media (max-width: 768px) {
    .tr-bar { grid-template-columns: 42px 1fr auto; gap: 6px; }
    .tr-round { width: 42px; height: 42px; }
    .tr-title { font-size: 18px; }
    .tr-legend-keys { font-size: 10px; gap: 7px; padding: 3px 7px; left: 6px; bottom: 6px; }
    .tr-choropleth-wrap .tr-zoom button { width: 28px; height: 28px; font-size: 15px; }
}

/* Карта мира/России без карточки — как в референсе; на телефоне от края до края экрана */
.tr-choropleth-wrap { background: transparent; border: 0; border-radius: 0; overflow: visible; }
@media (max-width: 768px) {
    body[data-page="travel"] { overflow-x: hidden; } /* страховка от 100vw */
    .tr-choropleth-wrap {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }
    .tr-choropleth { max-height: none; }
    .tr-legend-keys { left: 12px; }
    .tr-choropleth-wrap .tr-zoom { right: 10px; }
}

/* ==== Карта каталога на весь экран (как «Наследие» в Mark O'Travel) ==== */
body.tr-immersive #trUnMap { height: calc(100vh - 230px); min-height: 420px; }
body.tr-immersive #trUnHint, body.tr-immersive .tr-un-progress { display: none; }
@media (max-width: 768px) {
    body.tr-immersive { overflow: hidden; }
    body.tr-immersive #trUnMap {
        position: fixed;
        top: 0; left: 0; right: 0;
        bottom: 0;
        height: auto; min-height: 0;
        border: 0; border-radius: 0;
        z-index: 400;
    }
    /* шапка — поверх карты, без подложки; кнопки — тёмное полупрозрачное стекло */
    body.tr-immersive .tr-bar {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 34px);
        left: 12px; right: 12px;
        margin: 0;
        padding: 0;
        background: none;
        -webkit-backdrop-filter: none; backdrop-filter: none;
        z-index: 450;
    }
    body.tr-immersive .tr-round,
    body.tr-immersive .tr-pill {
        background: rgba(15, 23, 42, 0.38);
        border-color: rgba(255, 255, 255, 0.28);
        color: #fff;
        -webkit-backdrop-filter: blur(12px) saturate(1.4);
        backdrop-filter: blur(12px) saturate(1.4);
        box-shadow: none;
    }
    body.tr-immersive .tr-pill .tr-act { color: #fff; }
    body.tr-immersive .tr-pill .tr-act.active { background: rgba(255, 255, 255, 0.28); }
    body.tr-immersive .tr-title {
        color: #fff;
        text-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
        background: rgba(15, 23, 42, 0.38);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
        border-radius: 999px;
        padding: 8px 14px;
    }
    body.tr-immersive .tr-un-count {
        display: inline-block;
        padding: 3px 12px;
        border-radius: 999px;
        background: rgba(15, 23, 42, 0.32);
        -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    }
    body.tr-immersive .tr-un-top { display: flex; justify-content: center; }
    body.tr-immersive .tr-un-count { flex: 0 0 auto; }
    body.tr-immersive .tr-title svg { color: rgba(255, 255, 255, 0.85); }
    body.tr-immersive .tr-title:hover { background: rgba(15, 23, 42, 0.5); }
    /* «0 из 3 339 парков» — текстом над кнопками, как в оригинале */
    body.tr-immersive .tr-un-top {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 6px);
        left: 0; right: 0;
        margin: 0;
        z-index: 450;
        pointer-events: none;
    }
    body.tr-immersive .tr-un-count { text-align: center; color: #fff; font-size: 14px; text-shadow: 0 1px 5px rgba(0, 0, 0, 0.6); }
    body.tr-immersive .tr-un-count b { color: #fff; font-size: 15px; }
    /* фильтр под воронкой — полоской чипов под шапкой */
    body.tr-immersive .tr-filters {
        position: fixed;
        top: calc(env(safe-area-inset-top, 0px) + 88px);
        left: 0; right: 0;
        margin: 0;
        padding: 0 12px;
        z-index: 450;
    }
    body.tr-immersive .tr-filters .tr-chip,
    body.tr-immersive .tr-filters .tr-seg button {
        background: rgba(15, 23, 42, 0.38);
        border-color: rgba(255, 255, 255, 0.28);
        color: #fff;
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    }
    body.tr-immersive .tr-filters .tr-seg { border-color: rgba(255, 255, 255, 0.28); }
    body.tr-immersive .tr-filters .tr-seg button.active,
    body.tr-immersive .tr-filters .tr-chip.active { background: rgba(255, 255, 255, 0.85); color: #0f172a; }
    body.tr-immersive .leaflet-control-layers { border-radius: 50%; overflow: hidden; background: rgba(15, 23, 42, 0.45); border: 1px solid rgba(255, 255, 255, 0.3); }
    body.tr-immersive .leaflet-bottom.leaflet-left { bottom: 6px; }
}

.tr-full-map[hidden], .tr-un-progress[hidden], .tr-seg button[hidden], #trAddPlaceInline[hidden] { display: none; }
#trAddPlaceInline { flex-shrink: 0; margin: 0; }

.tr-title svg { transition: transform 0.15s; }
.tr-title.open svg { transform: rotate(180deg); }

/* ==== Выпадающие меню (☰ — разделы, заголовок — каталоги) ==== */
.tr-bar { position: sticky; }
.tr-pop {
    position: absolute;
    top: calc(100% + 6px);
    z-index: 600;
    width: min(320px, calc(100vw - 24px));
    max-height: min(70vh, 560px);
    overflow-y: auto;
    padding: 6px;
    border-radius: 18px;
    background: var(--tr-card);
    border: 1px solid var(--tr-border);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
}
.tr-pop[hidden] { display: none; }
.tr-pop-left { left: 12px; }
.tr-pop-center { left: 50%; transform: translateX(-50%); }
.tr-pop-item {
    width: 100%;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px;
    border: 0; border-radius: 12px;
    background: transparent;
    color: var(--tr-text);
    font: inherit; font-size: 16px; text-align: left;
    cursor: pointer;
}
.tr-pop-item:hover { background: var(--tr-soft); }
/* «Мои места» — над каталогами, отделены чертой */
.tr-pop-sep { height: 1px; margin: 4px 12px; background: var(--tr-border); }
.tr-pop-item.active { background: color-mix(in srgb, var(--color-primary, #3b82f6) 14%, var(--tr-card)); font-weight: 700; }
.tr-pop-icon { font-size: 21px; width: 28px; text-align: center; flex-shrink: 0; }
.tr-pop-label { flex: 1; }
.tr-pop-count { font-size: 13px; color: var(--tr-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-round.open { background: var(--color-primary, #3b82f6); color: #fff; border-color: transparent; }

@media (max-width: 768px) {
    body.tr-immersive .leaflet-bottom { bottom: var(--tr-nav-h, 0px); }
    body.tr-immersive .leaflet-bottom.leaflet-left { bottom: calc(var(--tr-nav-h, 0px) + 6px); }
    /* меню поверх карты — тёмное стекло, как кнопки */
    body.tr-immersive .tr-pop {
        background: rgba(15, 23, 42, 0.72);
        border-color: rgba(255, 255, 255, 0.18);
        -webkit-backdrop-filter: blur(16px) saturate(1.4);
        backdrop-filter: blur(16px) saturate(1.4);
    }
    body.tr-immersive .tr-pop-item { color: #fff; }
    body.tr-immersive .tr-pop-item:hover { background: rgba(255, 255, 255, 0.1); }
    body.tr-immersive .tr-pop-item.active { background: rgba(255, 255, 255, 0.18); }
    body.tr-immersive .tr-pop-count { color: rgba(255, 255, 255, 0.7); }
    body.tr-immersive .tr-pop-left { left: 0; }
    body.tr-immersive .tr-round.open { background: rgba(255, 255, 255, 0.3); }
}

/* ==== Телефон: без шапки сайта — раздел начинается сразу с панели кнопок (Мир/Россия «на весь экран») ==== */
@media (max-width: 768px) {
    body[data-page="travel"] { padding-top: env(safe-area-inset-top, 0px); }
    body[data-page="travel"] .container > header { display: none; }
    body[data-page="travel"]:not(.tr-immersive) .tr-bar { top: env(safe-area-inset-top, 0px); margin-top: 0; }
    body[data-page="travel"] .tr-choropleth-wrap { margin-top: -4px; }
    body[data-page="travel"] .tr-area-toolbar { margin-top: 6px; }
}
@media (max-width: 768px) {
    /* масштаб — в правый нижний угол строкой: справа сверху кнопки закрывали Чукотку */
    .tr-choropleth-wrap .tr-zoom { top: auto; bottom: 6px; right: 10px; flex-direction: row; }
}

/* ==== Нижняя панель модалок: прилипает к самому низу (раньше из-под неё было видно поля) ==== */
.tr-modal-card { padding-bottom: 0; }
.tr-modal-foot {
    bottom: 0;
    margin: 12px -18px 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
}
@media (max-width: 768px) {
    .tr-modal-card { padding-bottom: 0; }
}
/* Поле даты в iOS Safari держит свою минимальную ширину и вылезает за край */
.tr-modal input[type="date"] { -webkit-appearance: none; appearance: none; min-width: 0; display: block; }
.tr-modal input[type="date"]::-webkit-date-and-time-value { text-align: left; }

/* ==== Форма посещения: группы-карточки ==== */
.tr-vform { width: min(520px, 100%); }
.tr-vform .tr-modal-head { margin-bottom: 10px; }
.tr-vform .tr-modal-head h3 { font-size: 18px; }
.tr-vgroup {
    display: block;
    margin-bottom: 10px;
    border-radius: 14px;
    background: var(--tr-soft);
    border: 1px solid var(--tr-border);
    overflow: hidden;
}
.tr-vline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 4px 12px;
    cursor: pointer;
}
.tr-vline + .tr-vline { border-top: 1px solid var(--tr-border); }
.tr-vline[hidden] { display: none; }
.tr-vlab {
    flex-shrink: 0;
    width: 108px;
    font-size: 14px;
    font-weight: 600;
    color: var(--tr-muted);
}
.tr-vinput {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--tr-text);
    font: inherit;
    font-size: 16px; /* меньше 16 — iOS приближает страницу при фокусе */
    padding: 8px 0;
    outline: none;
}
select.tr-vinput { -webkit-appearance: none; appearance: none; text-overflow: ellipsis; cursor: pointer; }
.tr-vinput::placeholder { color: var(--tr-muted); opacity: 0.7; }
.tr-vdates { flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
.tr-vdates .tr-vinput { font-size: 15px; }
.tr-vform .tr-stars { margin-left: auto; gap: 2px; }
.tr-vform .tr-stars button { font-size: 24px; padding: 0 1px; }
.tr-vnotes { display: block; padding: 12px; resize: vertical; min-height: 64px; }
.tr-vmedia { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.tr-vmedia .tr-links:empty, .tr-vmedia .tr-photo-grid:empty { display: none; }
.tr-vmedia .tr-links, .tr-vmedia .tr-photo-grid { margin: 0; }
.tr-vmedia .tr-link-row .tr-input { padding: 7px 9px; font-size: 15px; background: var(--tr-card); }
.tr-vactions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tr-vbtn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 40px;
    border-radius: 10px;
    border: 1px dashed var(--tr-border);
    background: var(--tr-card);
    color: var(--tr-text);
    font: inherit; font-size: 14px; font-weight: 600;
    cursor: pointer;
}
.tr-vbtn:hover { border-color: var(--color-primary, #3b82f6); }
/* переключатель «в планере» */
.tr-vswitch { margin: 0 0 4px; }
.tr-vswitch .tr-vlab { width: auto; flex: 1; color: var(--tr-text); display: flex; flex-direction: column; }
.tr-vswitch .tr-vlab small { font-weight: 400; font-size: 12px; color: var(--tr-muted); margin-top: 1px; }
.tr-vswitch input[type="checkbox"] {
    -webkit-appearance: none; appearance: none;
    flex-shrink: 0;
    width: 48px; height: 28px;
    margin: 0;
    border-radius: 999px;
    background: var(--tr-border);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.tr-vswitch input[type="checkbox"]::after {
    content: '';
    position: absolute; top: 3px; left: 3px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}
.tr-vswitch input[type="checkbox"]:checked { background: #22c55e; }
.tr-vswitch input[type="checkbox"]:checked::after { transform: translateX(20px); }
.tr-vdel { border: 0; background: none; color: #dc2626; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; padding: 8px 4px; }
@media (max-width: 768px) {
    .tr-vlab { width: 96px; font-size: 13px; }
    .tr-vform .tr-modal-foot .btn { padding: 10px 16px; }
}
/* строки формы: значение по центру строки, без лишней высоты (select в WebKit прижимал текст к верху) */
.tr-vline { min-height: 46px; padding: 0 12px; }
.tr-vline > .tr-vinput, .tr-vdates .tr-vinput {
    height: 44px;
    line-height: 44px;
    padding-top: 0; padding-bottom: 0;
    align-self: center;
}
.tr-vline > select.tr-vinput { line-height: normal; }
.tr-vdates .tr-vinput { line-height: normal; }
/* пустая дата: Safari показывает сегодняшнюю — приглушаем, чтобы не казалась заполненной */
.tr-vinput.is-empty { color: var(--tr-muted); opacity: 0.55; }
/* общее «input, textarea, select { margin-bottom: 15px }» из styles.css раздувало строки формы */
.tr-vform .tr-vinput, .tr-vform .tr-link-row .tr-input { margin: 0; border-radius: 0; }
.tr-vform .tr-vswitch input[type="checkbox"] { margin: 0; border-radius: 999px; border: 0; padding: 0; }
/* дата в WebKit не центрируется по line-height — выравниваем отступами */
.tr-vdates .tr-vinput { height: auto; padding: 12px 0; }
.tr-vform .tr-link-row .tr-input { border-radius: 8px; }
@media (max-width: 768px) {
    body.tr-immersive .tr-pop-sep { background: rgba(255, 255, 255, 0.2); }
}

/* Значки фильтра: статус — svg, категории — эмодзи; на телефоне только значки */
.tr-fic { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; margin-right: 4px; }
#trUnFilters .tr-seg button[data-filter="want"].active .tr-fic { fill: currentColor; }
#trUnFilters .tr-chip { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 768px) {
    #trUnFilters .tr-ftx { display: none; }
    #trUnFilters .tr-fic { margin-right: 0; width: 18px; height: 18px; vertical-align: -4px; }
    #trUnFilters .tr-seg button { padding: 6px 11px; }
    #trUnFilters .tr-chip { padding: 5px 9px; gap: 3px; font-size: 13px; }
    #trUnFilters .tr-cic { font-size: 17px; line-height: 1; }
    #trUnFilters .tr-chip small { font-size: 11px; }
}

/* Телефон: значки фильтра одной высоты и с одинаковым шагом; у «Моих мест» нет счётчика
   над шапкой (число — в меню заголовка), шапка и фильтр поднимаются на его место */
@media (max-width: 768px) {
    #trUnFilters { gap: 8px; }
    #trUnFilters .tr-chips { gap: 8px; }
    #trUnFilters .tr-seg { height: 36px; box-sizing: border-box; }
    #trUnFilters .tr-seg button { height: 100%; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; padding: 0 12px; }
    #trUnFilters .tr-chip { height: 36px; box-sizing: border-box; padding: 0 11px; justify-content: center; min-width: 44px; }
    #trUnFilters .tr-seg button[hidden] { display: none; } /* «Не был» у своих мест */
    body.tr-immersive #trUnFilters .tr-chip small { color: rgba(255, 255, 255, 0.85); }
    body.tr-immersive #trUnFilters .tr-chip.active small { color: #0f172a; }
    body.tr-immersive.tr-layer-my .tr-un-top { display: none; }
    body.tr-immersive.tr-layer-my .tr-filters { top: calc(env(safe-area-inset-top, 0px) + 62px); }
}

/* Телефон: значки категорий — одной плашкой, как «Все / Был / Хочу»: без зазоров и прокрутки.
   Влезает рядом со статусом — стоит рядом, нет — уходит строкой ниже на всю ширину */
@media (max-width: 768px) {
    body.tr-layer-my .tr-un-top { display: none; } /* «N мест посещено» — и в списке */
    #trUnFilters .tr-seg button { min-width: 38px; padding: 0 9px; }
    #trUnFilters .tr-chips.tr-un-filters {
        flex: 1 1 auto;
        min-width: min-content; /* не сжимать значки — лучше перенести плашку строкой ниже */
        flex-wrap: nowrap;
        overflow: hidden;
        gap: 0;
        padding: 0;
        height: 36px;
        box-sizing: border-box;
        border: 1px solid var(--tr-border);
        border-radius: 999px;
        background: var(--tr-card);
    }
    #trUnFilters .tr-chips.tr-un-filters .tr-chip {
        flex: 1 1 auto;
        min-width: 0;
        height: 100%;
        padding: 0 5px;
        gap: 2px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }
    #trUnFilters .tr-chips.tr-un-filters .tr-chip + .tr-chip { border-left: 1px solid var(--tr-border); }
    #trUnFilters .tr-chips.tr-un-filters .tr-chip.active { background: color-mix(in srgb, var(--c) 22%, var(--tr-card)); }
    body.tr-immersive #trUnFilters .tr-chips.tr-un-filters {
        background: rgba(15, 23, 42, 0.38);
        border-color: rgba(255, 255, 255, 0.28);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    }
    body.tr-immersive #trUnFilters .tr-chips.tr-un-filters .tr-chip { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
    body.tr-immersive #trUnFilters .tr-chips.tr-un-filters .tr-chip + .tr-chip { border-left-color: rgba(255, 255, 255, 0.2); }
    body.tr-immersive #trUnFilters .tr-chips.tr-un-filters .tr-chip.active { background: rgba(255, 255, 255, 0.85); }
}

/* Телефон: статус в шапке — название ужимается (многоточие), кнопки статуса компактнее */
#trTitle { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 768px) {
    .tr-bar.has-seg { grid-template-columns: 42px minmax(0, 1fr) auto auto; gap: 6px; }
    .tr-bar.has-seg .tr-title { font-size: 16px; padding: 8px 5px; gap: 2px; justify-self: stretch; justify-content: center; min-width: 0; }
    .tr-bar.has-seg .tr-title svg { width: 15px; height: 15px; }
    .tr-bar.has-seg #trUnFilter { height: 42px; box-sizing: border-box; border-radius: 999px; }
    .tr-bar.has-seg #trUnFilter button { height: 100%; min-width: 32px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
    .tr-bar.has-seg #trUnFilter button[hidden] { display: none; }
    .tr-bar.has-seg #trUnFilter .tr-ftx { display: none; }
    .tr-bar.has-seg #trUnFilter .tr-fic { width: 18px; height: 18px; margin: 0; vertical-align: -4px; }
    .tr-bar.has-seg #trUnFilter button[data-filter="want"].active .tr-fic { fill: currentColor; }
    .tr-bar.has-seg .tr-pill .tr-act { width: 34px; }
    .tr-bar.has-seg { gap: 5px; }
    body.tr-immersive .tr-bar.has-seg #trUnFilter {
        border-color: rgba(255, 255, 255, 0.28);
        background: rgba(15, 23, 42, 0.38);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    }
    body.tr-immersive .tr-bar.has-seg #trUnFilter button { background: transparent; color: #fff; }
    body.tr-immersive .tr-bar.has-seg #trUnFilter button.active { background: rgba(255, 255, 255, 0.85); color: #0f172a; }
}

/* Без ☰: название слева открывает общее меню (разделы + каталоги). Шапка на карте всегда на
   одной высоте, счётчик каталога «3 из 1 274» — под ней, фильтр — под счётчиком */
.tr-bar { grid-template-columns: minmax(0, 1fr) auto; }
.tr-bar .tr-title { justify-self: start; }
.tr-pop-item { padding: 7px 12px; }
.tr-pop-sep { margin: 3px 12px; }
@media (max-width: 768px) {
    .tr-bar { grid-template-columns: minmax(0, 1fr) auto; }
    .tr-bar.has-seg { grid-template-columns: minmax(0, 1fr) auto auto; }
    .tr-bar.has-seg .tr-title { justify-self: start; }
    .tr-bar.has-seg #trUnFilter button[data-filter="rest"] { display: none; } /* пунктирный круг путали со «Все» */
    body.tr-immersive .tr-bar { top: calc(env(safe-area-inset-top, 0px) + 8px); z-index: 460; } /* меню поверх счётчика и фильтра */
    body.tr-immersive .tr-un-top { top: calc(env(safe-area-inset-top, 0px) + 60px); }
    body.tr-immersive .tr-filters { top: calc(env(safe-area-inset-top, 0px) + 92px); }
    body.tr-immersive.tr-layer-my .tr-filters { top: calc(env(safe-area-inset-top, 0px) + 62px); }
}

/* Визиты места: в попапе на карте и под местом в списке «Моих мест» */
.tr-pv-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.tr-pv { padding: 6px 8px; border-radius: 10px; background: rgba(100, 116, 139, 0.1); cursor: pointer; }
.tr-pv:hover { background: rgba(100, 116, 139, 0.18); }
.tr-pv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 12px; }
.tr-pv-stars { color: #f59e0b; letter-spacing: -1px; }
.tr-pv-title { color: #64748b; }
.tr-pv-thumbs { display: flex; gap: 4px; margin-top: 5px; }
.tr-pv-thumbs .tr-thumb { width: 44px; height: 44px; border-radius: 7px; flex: 0 0 auto; }
.tr-place-visits { display: block; margin-top: 4px; }
.tr-pv-date { display: inline-block; font-size: 12px; color: var(--color-primary, #3b82f6); cursor: pointer; }
.tr-place-visits .tr-pv-thumbs { margin-top: 4px; }
/* Метка места с фото — значок в углу */
.tr-pin { position: relative; }
.tr-pin-photo {
    position: absolute; right: -7px; top: -7px;
    font-size: 10px; font-style: normal; line-height: 1;
    padding: 2px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
button.tr-tag { font-family: inherit; cursor: pointer; }
#trVisitCats .tr-chip { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 768px) { #trVisitCats .tr-ftx { display: none; } }

/* Фильтр «где» — компактный выпадающий список-плашка (страна / субъект РФ) */
.tr-where-sel {
    -webkit-appearance: none; appearance: none;
    height: 36px; box-sizing: border-box;
    margin: 0; /* глобальное select { margin-bottom } из styles.css */
    max-width: 210px;
    padding: 0 28px 0 12px;
    border-radius: 999px;
    border: 1px solid var(--tr-border);
    background: var(--tr-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 9px center / 14px;
    color: var(--tr-text);
    font: inherit; font-size: 13px;
    text-overflow: ellipsis; white-space: nowrap; overflow: hidden;
    cursor: pointer;
}
.tr-where-sel[hidden] { display: none; }
.tr-where-sel.active { border-color: var(--color-primary, #3b82f6); background-color: color-mix(in srgb, var(--color-primary, #3b82f6) 14%, var(--tr-card)); }
#trVisitsFilters { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
#trVisitsFilters .tr-input { flex: 1 1 100%; }
@media (max-width: 768px) {
    .tr-where-sel { font-size: 16px; max-width: 46vw; } /* <16px — iOS приближает страницу при выборе */
    body.tr-immersive .tr-where-sel {
        border-color: rgba(255, 255, 255, 0.28);
        background-color: rgba(15, 23, 42, 0.38);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
        color: #fff;
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    }
    body.tr-immersive .tr-where-sel.active { background-color: rgba(255, 255, 255, 0.85); color: #0f172a; }
}
.tr-sec-link { float: right; border: 0; background: none; padding: 0; font: inherit; font-size: 12px; color: var(--color-primary, #3b82f6); cursor: pointer; text-transform: none; letter-spacing: 0; }
#trVisitsFilters .tr-chip { height: 36px; box-sizing: border-box; padding: 0 10px; }
#trVisitsFilters .tr-input { margin: 0; }

/* Телефон: фильтр «где» — круглый значок в шапке (🌍 / флаг / номер региона), список — системный */
.tr-where-btn[hidden] { display: none; }
@media (max-width: 768px) {
    #trWhereMy, #trWhereVisits { display: none; }
    .tr-bar { grid-template-columns: minmax(0, 1fr); grid-auto-flow: column; grid-auto-columns: auto; }
    .tr-bar.has-seg { grid-template-columns: minmax(0, 1fr); }
    .tr-bar.has-where .tr-title-ic { display: none; } /* значок раздела уступает место флагу */
    .tr-where-btn {
        position: relative;
        width: 42px; height: 42px; box-sizing: border-box;
        display: inline-flex; align-items: center; justify-content: center;
        border-radius: 50%;
        border: 1px solid var(--tr-border);
        background: var(--tr-card);
        font-size: 22px; line-height: 1;
        overflow: hidden;
    }
    .tr-where-btn.active { border-color: var(--color-primary, #3b82f6); }
    .tr-where-num { font-size: 15px; font-weight: 800; letter-spacing: -0.02em; color: var(--tr-text); }
    .tr-where-btn select {
        position: absolute; inset: 0;
        width: 100%; height: 100%;
        margin: 0; padding: 0; border: 0;
        opacity: 0; font-size: 16px; /* 16px — iOS не приближает страницу */
        -webkit-appearance: none; appearance: none;
        cursor: pointer;
    }
    body.tr-immersive .tr-where-btn {
        background: rgba(15, 23, 42, 0.38);
        border-color: rgba(255, 255, 255, 0.28);
        -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    }
    body.tr-immersive .tr-where-btn.active { border-color: #fff; }
    body.tr-immersive .tr-where-num { color: #fff; }
}

/* Блок «Связи» (entity-links.js) в попапе места и карточке объекта */
.tr-popup .tr-links-host { margin: 6px 0 0; }
.tr-popup .el-chip-open { max-width: 170px; }
.tr-links-host:empty { display: none; }

/* «✨ Вдохновляет» — золотой переключатель, как рамка моментов в планере */
.tr-moment-switch input[type="checkbox"]:checked { background: #d4a62a; }

/* ==== Окно места: всё в одном, компактно (поиск → карта-сворачивашка → группы iOS) ==== */
.tr-modal-card { -webkit-backdrop-filter: blur(28px) saturate(1.3); backdrop-filter: blur(28px) saturate(1.3); } /* полупрозрачные темы: попап карты не просвечивает */
.tr-pform { width: min(540px, 100%); }
.tr-psearch {
    display: flex; align-items: center; gap: 6px;
    height: 44px; padding: 0 4px 0 12px;
    border-radius: 12px;
    background: var(--tr-soft);
    border: 1px solid var(--tr-border);
}
.tr-psearch:focus-within { border-color: var(--color-primary, #3b82f6); }
.tr-psearch svg { width: 17px; height: 17px; flex-shrink: 0; fill: none; stroke: var(--tr-muted); stroke-width: 2.2; stroke-linecap: round; }
.tr-psearch input {
    flex: 1; min-width: 0; height: 100%;
    margin: 0; padding: 0; border: 0; background: none; outline: none;
    color: var(--tr-text); font: inherit; font-size: 16px;
}
.tr-psearch input::-webkit-search-cancel-button { display: none; }
.tr-psearch input::placeholder { color: var(--tr-muted); opacity: 0.75; }
.tr-psearch button {
    flex-shrink: 0; height: 34px; padding: 0 12px;
    border: 0; border-radius: 9px;
    background: var(--tr-card); color: var(--tr-text);
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tr-pform .tr-geo-results { margin: 6px 0 0; }
.tr-pform .tr-geo-results:empty { display: none; }
.tr-pform .tr-geo-item { padding: 7px 10px; }
.tr-pform .tr-geo-item b { font-size: 14px; }
.tr-geo-item em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--tr-muted); margin-left: 4px; }
.tr-geo-mine { border-style: dashed; }
.tr-geo-mine em { color: #16a34a; }
.tr-geo-note { padding: 4px 2px; font-size: 13px; }
.tr-geo-ya {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 10px;
    border: 1px solid color-mix(in srgb, #fc3f1d 35%, var(--tr-border));
    color: var(--tr-text); text-decoration: none; font-size: 14px; font-weight: 600;
}
.tr-geo-ya span { display: flex; flex-direction: column; min-width: 0; }
.tr-geo-ya small { font-weight: 400; font-size: 12px; color: var(--tr-muted); }
.tr-ya {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 20px; height: 20px; border-radius: 50%;
    background: #fc3f1d; color: #fff; font-size: 12px; font-weight: 800; line-height: 1;
}
.tr-vlab-ya { display: inline-flex; align-items: center; gap: 6px; }
.tr-vlab-ya .tr-ya { width: 17px; height: 17px; font-size: 10.5px; }

/* карта: шапка-строка с «где», по нажатию сворачивается */
.tr-pmap { margin-top: 10px; }
.tr-pmap-bar {
    display: flex; align-items: center; gap: 8px; width: 100%;
    min-height: 42px; padding: 0 12px;
    border: 0; background: none; color: var(--tr-text);
    font: inherit; font-size: 14px; text-align: left; cursor: pointer;
}
.tr-pmap-where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-pmap-where small { color: var(--tr-muted); }
.tr-pmap-chev { color: var(--tr-muted); font-size: 15px; transition: transform 0.2s; }
.tr-pmap .tr-leaflet-small { height: 220px; margin: 0; border: 0; border-top: 1px solid var(--tr-border); border-radius: 0; }
.tr-pmap.is-collapsed .tr-leaflet-small { display: none; }
.tr-pmap.is-collapsed .tr-pmap-chev { transform: rotate(180deg); }
@media (max-width: 768px) { .tr-pmap .tr-leaflet-small { height: 190px; } }

/* строка-кнопка в группе: категория, событие */
button.tr-vline { width: 100%; border: 0; background: none; color: var(--tr-text); font: inherit; text-align: left; }
.tr-vline + .tr-cat-grid, .tr-vline + .tr-pv-events { border-top: 1px solid var(--tr-border); }
.tr-cat-grid + .tr-vline, .tr-pv-events + .tr-vline { border-top: 1px solid var(--tr-border); }
.tr-vval { flex: 1; min-width: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-vchev { color: var(--tr-muted); font-size: 18px; transition: transform 0.2s; }
.tr-vpick[aria-expanded="true"] .tr-vchev, .tr-vpick.is-open .tr-vchev { transform: rotate(90deg); }
.tr-pform .tr-cat-grid { padding: 8px; }
.tr-pform .tr-cat-grid[hidden] { display: none; }
.tr-pform .tr-cat { padding: 6px 2px; }
@media (max-width: 768px) { .tr-pform .tr-cat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* сегмент «Был / Хочу» */
.tr-seg { display: flex; margin-left: auto; padding: 2px; border-radius: 10px; background: color-mix(in srgb, var(--tr-border) 70%, transparent); }
.tr-seg button {
    border: 0; background: none; color: var(--tr-muted);
    padding: 6px 14px; border-radius: 8px;
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.tr-seg button.active { background: var(--tr-card); color: var(--tr-text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }

/* блок «Посещение» */
.tr-pvisit[hidden] { display: none; }
.tr-vcap { margin: 14px 4px 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--tr-muted); }
.tr-vcap small { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.tr-pv-chip {
    display: inline-flex; align-items: center; gap: 4px; max-width: 100%;
    padding: 3px 4px 3px 9px; border-radius: 999px;
    background: color-mix(in srgb, #0ea5e9 14%, var(--tr-card));
    font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.tr-pv-chip button { border: 0; background: none; color: var(--tr-muted); font-size: 16px; line-height: 1; padding: 0 4px; cursor: pointer; }
.tr-pv-events { padding: 6px 8px 8px; }
.tr-pv-events[hidden] { display: none; }
.tr-pv-events .tr-vinput { height: 38px; padding: 0 10px; border-radius: 9px; background: var(--tr-card); font-size: 15px; }
.tr-pv-elist { max-height: 220px; overflow: auto; margin-top: 6px; display: flex; flex-direction: column; }
.tr-pv-erow {
    display: flex; align-items: center; gap: 10px;
    padding: 7px 6px; border: 0; border-radius: 8px; background: none;
    color: var(--tr-text); font: inherit; text-align: left; cursor: pointer;
}
.tr-pv-erow:hover { background: var(--tr-card); }
.tr-pv-edate { flex-shrink: 0; width: 52px; font-size: 12px; font-weight: 700; color: var(--tr-muted); }
.tr-pv-edate.is-future { color: #0284c7; }
.tr-pv-etitle { min-width: 0; font-size: 14px; display: flex; flex-direction: column; }
.tr-pv-etitle small { font-size: 12px; color: var(--tr-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-pv-empty { padding: 8px 6px; font-size: 13px; }
.tr-vline[hidden] { display: none; }
.tr-pvisit .tr-vswitch { margin: 0; }

/* ссылки: открыть карточку Яндекса */
.tr-vopen {
    flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--tr-card); color: var(--tr-text); text-decoration: none; font-weight: 700;
}
.tr-vopen[hidden] { display: none; }

/* «Связи» в окне */
.tr-plinks { padding: 8px 10px; }
.tr-plinks[hidden] { display: none; }
.tr-pform .tr-plinks .el-block { margin: 0; }
.tr-modal-foot { -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
/* глобальные input-стили (рамка, фон) рисовали «ящики» внутри строк группы */
.tr-pform input.tr-vinput, .tr-pform textarea.tr-vinput { border: 0; background: transparent; box-shadow: none; border-radius: 0; }
.tr-pform .tr-pv-events input.tr-vinput { background: var(--tr-card); border-radius: 9px; }
