/* Bridge between the redesign kit and the existing site scripts: the scripts open menus by toggling the .hidden class
   or .create-menu-open, so the kit's menus follow the same hooks until the scripts are rewritten. */
.hidden { display: none !important; }
.rd-menu { position: relative; }
.rd-menu > .menu__list { right: 0; left: auto; }
.create-menu-wrap:not(.create-menu-open) > .create-menu-panel { display: none; }
.rd-notif__head { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 12px 8px 12px 16px; border-bottom: 1px solid var(--line); }
.rd-notif__head > span { display: inline-flex; align-items: center; gap: 4px; }
#notifDropdown { z-index: 320; display: flex; flex-direction: column; min-width: 0; padding: 0; overflow: hidden; background: var(--surface); color: var(--ink); }
#notifDropdown.hidden { display: none; }
#notif-list { display: block; flex: 1 1 auto; min-width: 0; min-height: 0; max-height: none; padding: 8px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
#notifDropdown .rd-notif__item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; padding: 12px; border-radius: var(--r); color: var(--ink); white-space: normal; }
#notifDropdown .rd-notif__item:hover, #notifDropdown .rd-notif__item:focus-visible { background: var(--bg-soft); }
#notifDropdown .rd-notif__item.is-unread { background: var(--orange-soft); }
.rd-notif__pic { position: relative; width: 40px; height: 40px; }
.rd-notif__pic img { display: block; width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.rd-notif__type { position: absolute; right: -4px; bottom: -4px; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--surface); border-radius: 50%; background: var(--cta); color: var(--on-accent); font-size: 11px; }
.rd-notif__body { display: grid; gap: 4px; min-width: 0; line-height: var(--lh-small); }
.rd-notif__title, .rd-notif__preview { min-width: 0; overflow-wrap: anywhere; white-space: normal; font-size: var(--fs-small); }
.rd-notif__title { font-weight: var(--fw-button); }
.rd-notif__preview { color: var(--copy); }
.rd-notif__time { color: var(--quiet); font-size: var(--fs-caption); }
.rd-notif__foot { flex: none; padding: 8px; border-top: 1px solid var(--line); }
#notifDropdown .rd-notif__foot a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px; border-radius: 12px; color: var(--ink); font-size: var(--fs-small); font-weight: var(--fw-button); text-align: center; white-space: normal; }
.rd-notif__foot a:hover { background: var(--bg-soft); }
@media (max-width: 767px) {
    #notifDropdown { inset: 0 !important; width: 100% !important; max-width: none !important; height: 100dvh !important; max-height: none !important; margin: 0 !important; border-radius: 0 !important; background: var(--surface) !important; }
    #notif-list { max-height: none !important; padding: 8px !important; background: var(--surface); }
    .rd-notif__head { padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
    .rd-notif__foot { padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}
.rd-empty { margin: 0; padding: 24px 16px; color: var(--quiet); text-align: center; font-size: var(--fs-small); }
.hdr__me .avatar { overflow: hidden; }
.hdr__me .avatar img { width: 100%; height: 100%; object-fit: cover; }
html[data-theme="dark"] body #userMenuButton.site-profile-button {
    background: #242424 !important;
    border-color: rgba(255, 255, 255, .2) !important;
    color: #f2f2ef !important;
}

/* Shared shell pieces that used to live in the old sheets. */
.skip-link { position: fixed; left: 16px; top: -64px; z-index: 1000; padding: 12px 16px; border-radius: var(--r); background: var(--ink); color: var(--bg); font-weight: var(--fw-button); transition: top 160ms; }
.skip-link:focus { top: 16px; }
.tt-cookie { position: fixed; left: 16px; bottom: 16px; z-index: 900; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 16px; width: min(440px, calc(100% - 32px)); padding: 20px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.tt-cookie[hidden] { display: none; }
.tt-cookie__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-ink); }
.tt-cookie__icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tt-cookie__body strong { display: block; font: var(--fw-title) var(--fs-body)/var(--lh-body) var(--font-display); }
.tt-cookie__body p { margin: 4px 0 0; color: var(--copy); font-size: var(--fs-small); line-height: var(--lh-small); }
.tt-cookie__body a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.tt-cookie__actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.tt-cookie__button { flex: 1 1 auto; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: var(--fw-button); cursor: pointer; }
.tt-cookie__button--primary { border-color: var(--cta); background: var(--cta); color: var(--on-accent); }
#site-messages-toast { position: fixed; left: 50%; top: 80px; z-index: 1000; display: grid; gap: 8px; width: min(420px, calc(100vw - 24px)); transform: translateX(-50%); pointer-events: none; }
#site-messages-toast > div { padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); font-size: var(--fs-small); font-weight: var(--fw-button); }
#site-messages-toast .toast--error { border-color: var(--danger); color: var(--danger); }
#site-messages-toast .toast--ok { border-color: var(--ok); color: var(--ok); }
#site-messages-toast .toast--warn { border-color: var(--orange); color: var(--orange-ink); }
.auth-consent { display: grid; gap: 8px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg-soft); }
.auth-consent__label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; font-size: var(--fs-small); }
.auth-consent__label input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--cta); }
.auth-consent__summary { color: var(--copy); font-size: var(--fs-caption); }
.auth-consent__open { padding: 0; border: 0; background: none; color: var(--link); font-weight: var(--fw-button); cursor: pointer; }
.tt-signup-hint { display: block; margin-top: 4px; color: var(--quiet); font-size: var(--fs-caption); }

/* Feed posts: stats strip, media grid for quick posts. */
.fp__stats { display: block; margin: -24px 24px 0; position: relative; z-index: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); color: var(--ink); }
.fp__stats dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
.fp__stats dt { color: var(--quiet); font-size: var(--fs-caption); }
.fp__stats dd { margin: 0; font: var(--fw-title) var(--fs-small)/1.3 var(--font-display); font-variant-numeric: tabular-nums; }
.fp__media { display: block; margin-top: 16px; aspect-ratio: 16 / 9; overflow: hidden; background: var(--bg-soft); }
.fp__media img, .fp__media .minimap-container { display: block; width: 100%; height: 100%; object-fit: cover; }
.fp__grid { display: grid; gap: 2px; margin-top: 16px; aspect-ratio: 16 / 9; overflow: hidden; }
.fp__grid--1 { grid-template-columns: 1fr; } .fp__grid--2, .fp__grid--4 { grid-template-columns: repeat(2, 1fr); } .fp__grid--3 { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); } .fp__grid--3 .fp__cell:first-child { grid-row: span 2; } .fp__grid--many { grid-template-columns: repeat(3, 1fr); }
.fp__cell { display: block; overflow: hidden; background: var(--bg-soft); } .fp__cell img, .fp__cell video { width: 100%; height: 100%; object-fit: cover; }
.fp__video { display: grid; place-items: center; height: 100%; background: var(--ink-fixed); color: var(--on-accent); font-size: var(--fs-caption); }
/* Video cards start with a real preview and use the provider's own player. */
.qp .car__track > .fp-video { position: relative; overflow: hidden; background: #121922; }
.qp[data-view="tiles"] .car[data-car] .car__track > .fp-video { aspect-ratio: 16 / 9; align-self: center; }
.qp[data-view="car"] .car[data-car] .car__track > .fp-video { width: calc(var(--h) * 16 / 9); }
.qp .car__track > .fp-video img,
.qp .car__track > .fp-video video,
.qp .car__track > .fp-video iframe { display: block; width: 100%; height: 100%; border: 0; }
.qp .car__track > .fp-video img { object-fit: cover; }
.qp[data-view] .car[data-car] .car__track > .fp-video video { object-fit: contain; background: #121922; }
.fp-video__fallback { display: grid; place-items: center; width: 100%; height: 100%; color: #fff; }
.fp-video__preview { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .12); }
.fp-video__preview[hidden] { display: none; }
.fp-video__preview:focus-visible { outline: 3px solid var(--focus, #ff671d); outline-offset: -3px; }
.fp-video__play { display: grid; place-items: center; width: 68px; height: 48px; border-radius: 14px; color: #fff; background: rgba(18, 25, 34, .85); transition: background .18s ease, transform .18s ease; }
.fp-video__play svg { width: 28px; height: 28px; }
.fp-video__preview:hover .fp-video__play { background: var(--cta, #c73f00); transform: scale(1.05); }
@media (prefers-reduced-motion: reduce) { .fp-video__play { transition: none; } }
.composer__link { display: flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--field-edge); border-radius: var(--r-sm); background: var(--surface); color: var(--quiet); }
.composer__top { display: flex; align-items: center; gap: 12px; }
.composer__top .avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-more { display: grid; justify-items: center; padding: 24px 0 48px; }
.tabs a { display: inline-flex; align-items: center; min-height: 50px; padding: 0 12px; color: var(--ink-2); font-weight: var(--fw-button); border-bottom: 2px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--orange); }
.ftr__lang { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-small); color: var(--quiet); }
.ftr__lang .select { min-height: 36px; width: auto; }
/* Stopgap for old partials that still carry bare inline icons without sizes. */
svg[viewBox]:not([width]):not([class]):not([height]) { width: 1.25em; height: 1.25em; }
.jr-feeds { margin-bottom: 16px; }

/* Popups that stay hidden until a script opens them, restyled on the kit. */
.telegram-updates-modal[hidden], .route-completion-people-modal[hidden] { display: none; }
.telegram-updates-modal { position: fixed; inset: 0; z-index: 950; display: grid; place-items: center; padding: 16px; }
.telegram-updates-modal__backdrop { position: absolute; inset: 0; background: var(--scrim-45, var(--black-18)); }
.telegram-updates-modal__dialog { position: relative; display: grid; justify-items: start; gap: 12px; width: min(440px, 100%); padding: 32px 24px 24px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
.telegram-updates-modal__close { position: absolute; right: 12px; top: 12px; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--bg-soft); color: var(--ink); font-size: 1.5rem; cursor: pointer; }
.telegram-updates-modal__icon svg { width: 32px; height: 32px; stroke: var(--orange-ink); fill: none; }
.telegram-updates-modal__eyebrow { color: var(--orange-ink); font-size: var(--fs-caption); font-weight: var(--fw-button); }
.telegram-updates-modal__dialog h2 { margin: 0; font-size: var(--fs-h4); }
.telegram-updates-modal__dialog p { margin: 0; color: var(--copy); font-size: var(--fs-small); }
.telegram-updates-modal__cta { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: 999px; background: var(--cta); color: var(--on-accent); font-weight: var(--fw-button); }
.telegram-updates-modal__dismiss { min-height: 44px; padding: 0 16px; border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.tabbar__plus { color: var(--cta); }
.ftr__link { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.ftr__link:hover { color: var(--ink); text-decoration: underline; }
.ftr__base { padding-right: 160px; }

/* Modals built by the site scripts (share, feedback, delete): same ids and toggling classes, styled on the kit by structure. */
.flex { display: flex; }
#share-post-modal, #feedback-modal, #delete-confirm-modal { position: fixed; inset: 0; z-index: 9999; align-items: center; justify-content: center; padding: 16px; background: var(--black-18); backdrop-filter: blur(4px); transition: opacity 240ms var(--ease-out); }
#share-post-modal.hidden, #feedback-modal.hidden, #delete-confirm-modal.hidden { display: none !important; }
#delete-confirm-modal.opacity-0 { opacity: 0; }
#share-post-modal > div, #feedback-modal > div, #delete-modal-content { display: flex; flex-direction: column; width: min(480px, 100%); max-height: 92vh; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); }
#delete-modal-content { align-items: center; gap: 12px; padding: 32px 24px 24px; text-align: center; width: min(400px, 100%); }
#delete-modal-content > div:first-child { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--orange-soft); color: var(--danger); }
#delete-modal-content > div:first-child svg { width: 28px; height: 28px; }
#delete-post-title { margin: 0; font: var(--fw-title) var(--fs-h4)/var(--lh-h4) var(--font-display); }
#delete-post-text { margin: 0 0 8px; color: var(--copy); font-size: var(--fs-small); }
#delete-modal-content > div:last-child { display: flex; gap: 12px; width: 100%; }
#delete-post-form { display: flex; flex: 1; }
#delete-post-cancel, #delete-post-submit, #share-copy-link-btn, #feedback-submit-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink); font: var(--fw-button) var(--fs-small)/1 var(--font-text); cursor: pointer; }
#delete-post-cancel { flex: 1; }
#delete-post-submit { width: 100%; border-color: var(--danger); background: var(--danger); color: var(--on-accent); }
#share-copy-link-btn, #feedback-submit-btn { width: 100%; border-color: var(--cta); background: var(--cta); color: var(--on-accent); }
#share-post-modal > div > div:first-child, #feedback-modal > div > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
#share-post-modal p:first-child, #feedback-modal p:first-child { margin: 0; color: var(--quiet); font-size: var(--fs-caption); }
#share-post-modal h3, #feedback-modal h3 { margin: 4px 0 0; font: var(--fw-title) var(--fs-h4)/var(--lh-h4) var(--font-display); }
#share-post-modal > div > div:first-child > button, #feedback-modal > div > div:first-child > button { display: grid; place-items: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: 50%; background: var(--bg-soft); color: var(--ink); cursor: pointer; }
#share-post-modal > div > div:first-child svg, #feedback-modal > div > div:first-child svg { width: 20px; height: 20px; }
#share-post-modal > div > div:last-child { display: grid; gap: 12px; padding: 20px; overflow-y: auto; }
#feedback-modal > div > div:last-child { overflow-y: auto; }
#feedback-form { display: grid; gap: 16px; padding: 20px; }
#feedback-form label[for] { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: var(--fs-caption); font-weight: var(--fw-ui); }
#feedback-form input[type="text"], #feedback-form select, #feedback-form textarea, #share-chat-search { width: 100%; min-height: 44px; padding: 10px 16px; border: 1px solid var(--field-edge); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: var(--fw-text) var(--fs-body)/var(--lh-body) var(--font-text); }
#feedback-form textarea { resize: vertical; }
#feedback-form input:focus, #feedback-form select:focus, #feedback-form textarea:focus, #share-chat-search:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-a-18); }
#feedback-form label:has(input[type="file"]) { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--line-2); border-radius: 999px; cursor: pointer; }
#feedback-file-name { color: var(--quiet); font-size: var(--fs-caption); }
#share-post-message, #feedback-message { margin: 0; padding: 12px 16px; border-radius: var(--r); background: var(--bg-soft); font-size: var(--fs-small); }
#feedback-modal > div > div:last-child > div:last-child { padding: 20px; border-top: 1px solid var(--line); }
#feedback-list { display: grid; gap: 8px; }
.space-y-2 > * + *, .space-y-3 > * + *, .space-y-4 > * + * { margin-top: 8px; }
:root { --danger: #b42318; }
:root[data-theme="dark"] { --danger: #ff8a7a; }
.menu__list > button, .user-menu-content > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); font-size: var(--fs-small); text-align: left; cursor: pointer; }
.menu__list > button:hover, .user-menu-content > button:hover { background: var(--bg-soft); }
.user-menu-content { display: contents; }
.menu__list .theme-toggle-row { justify-content: space-between; }
.theme-toggle-switch { display: inline-flex; width: 36px; height: 20px; padding: 2px; border-radius: 999px; background: var(--line-2); }
.theme-toggle-knob { width: 16px; height: 16px; border-radius: 50%; background: var(--surface); transition: transform 160ms var(--ease-out); }
[aria-pressed="true"] > .theme-toggle-switch { background: var(--cta); } [aria-pressed="true"] > .theme-toggle-switch .theme-toggle-knob { transform: translateX(16px); }
.language-switcher--menu { display: grid; gap: 4px; padding: 8px 12px; }
.language-switcher__label { color: var(--quiet); font-size: var(--fs-caption); }
/* quick post composer (profile, feed): the card, the field and the action row on the kit */
.quick-post-card { position: relative; z-index: 5; margin-bottom: 24px; padding: 16px 20px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.quick-post-card #quick-text-input { width: 100%; min-height: 44px; padding: 8px 0 20px; border: 0; background: none; color: var(--ink); font: inherit; resize: none; outline: none; }
.quick-post-card #quick-text-input::placeholder { color: var(--quiet); }
.quick-post-card #char-counter { color: var(--quiet); font-size: var(--fs-caption); }
.quick-post-card .quick-action-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; min-width: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--fs-small); cursor: pointer; }
.quick-post-card .quick-action-btn:hover { border-color: var(--ink); color: var(--ink); }
.quick-post-card .custom-dropdown-menu { position: absolute; z-index: 40; padding: 8px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-lg); }
.s-row__img { display: block; flex: none; width: 72px; height: 72px; overflow: hidden; border-radius: var(--r-sm, 10px); background: var(--bg-soft); }
.s-row__img img { width: 100%; height: 100%; object-fit: cover; }
.s-row__img.avatar { width: 48px; height: 48px; border-radius: 50%; }
