/* ============================================================
   RoadHelp — map-first app shell (Stage 1 frontend reset)
   Fullscreen map + floating header/panels/FABs + drawers/modals.
   Fully scoped: .rha-body / .rha-* classes only.
   ============================================================ */

.rha-body {
    margin: 0; padding: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f2f4f6; color: #1c2126;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
.rha-body, .rha-body * { box-sizing: border-box; }

/* ---------- design tokens ---------- */
.rha-shell, .rha-seo {
    --acc: #0f7b4d;           /* Locpit green accent */
    --acc-dark: #0b5e3b;
    --blue: #1565c0;
    --sos: #e53935;
    --green: #34a853; --red: #e53935; --orange: #f57c00;
    --yellow: #f2b90d; --purple: #8e44ad; --gray: #9aa3ad;
    --panel: #ffffff;
    --line: #e4e8ec;
    --muted: #67717c;
    --shadow: 0 6px 24px rgba(16, 24, 32, .14);
    --shadow-sm: 0 2px 10px rgba(16, 24, 32, .10);
    --r: 14px;
}

.rha-hidden { display: none !important; }
.rha-flex { flex: 1; }
.rha-min0 { min-width: 0; }
.rha-w100 { width: 100%; }
.rha-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }

/* ============================================================
   SHELL: fullscreen map, everything floats above it
   ============================================================ */
.rha-shell { position: relative; height: 100vh; height: 100dvh; min-height: 420px; overflow: hidden; }
.rha-map { position: absolute; inset: 0; z-index: 1; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px !important; background: rgba(255,255,255,.85) !important; padding: 2px 6px !important; border-radius: 6px 0 0 0; }
.leaflet-control-attribution a { color: var(--muted) !important; text-decoration: none; }

/* ---------- floating header ---------- */
.rha-header {
    position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 10px; right: 10px; z-index: 30;
    height: 52px; display: flex; align-items: center; gap: 10px;
    background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow-sm);
    padding: 0 10px;
}
.rha-logo { display: flex; align-items: center; flex: 0 0 auto; }
.rha-logo img { display: block; height: 26px; width: auto; } /* natural ratio */
.rha-title { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rha-user { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rha-user a { color: var(--blue); text-decoration: none; }
.rha-iconbtn {
    flex: 0 0 auto; width: 36px; height: 36px; border: none; border-radius: 10px;
    background: #eef1f4; font-size: 16px; font-weight: 700; cursor: pointer; color: #1c2126;
}
.rha-iconbtn:hover { background: #e2e7ec; }

/* ---------- floating left panel ---------- */
.rha-panel {
    position: absolute; z-index: 25;
    top: calc(env(safe-area-inset-top, 0px) + 74px); left: 10px; bottom: 10px;
    width: 356px; max-width: calc(100vw - 20px);
    background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow);
    transform: translateX(-115%); transition: transform .22s ease;
    overflow: hidden;
}
.rha-shell.rha-panel-open .rha-panel { transform: translateX(0); }
.rha-panel-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 10px; }
.rha-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.rha-sec:last-child { border-bottom: none; }
.rha-sec-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 10px; }
.rha-note { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }

/* ---------- right desktop panel ---------- */
.rha-right {
    position: absolute; z-index: 24;
    top: 72px; right: 10px; bottom: 10px; width: 300px; max-width: calc(100vw - 20px);
    background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow);
    transition: transform .22s ease; overflow: hidden;
}
.rha-right.rha-right-hidden { transform: translateX(115%); }
.rha-placeholder { background: #f6f8fa; border: 1px dashed var(--line); border-radius: 10px; padding: 12px; font-size: 13px; color: var(--muted); }
.rha-placeholder p { margin: 0 0 8px; }
.rha-placeholder p:last-child { margin-bottom: 0; }

/* ---------- FABs (floating map controls) ---------- */
.rha-fabs { position: absolute; right: 10px; top: calc(env(safe-area-inset-top, 0px) + 78px); z-index: 20; display: flex; flex-direction: column; gap: 8px; }
.rha-fab {
    width: 44px; height: 44px; border: none; border-radius: 12px;
    background: var(--panel); box-shadow: var(--shadow-sm); font-size: 18px; cursor: pointer;
}
.rha-fab:hover { background: #f2f5f8; }
.rha-fab-sos { background: var(--sos); color: #fff; }
.rha-fab-sos:hover { background: #c62828; }
/* keep FABs clear of the open right panel on desktop */
@media (min-width: 992px) { .rha-shell.rha-right-open .rha-fabs { right: 320px; } }

/* ---------- mode bar ---------- */
.rha-modebar {
    position: absolute; z-index: 28; left: 50%; transform: translateX(-50%);
    bottom: 24px; max-width: calc(100vw - 24px);
    background: #1c2126; color: #fff; border-radius: 12px; box-shadow: var(--shadow);
    padding: 12px 16px; display: flex; align-items: center; gap: 14px; font-size: 14px; font-weight: 600;
}
.rha-modebar-cancel { background: none; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }

/* ---------- empty state ---------- */
.rha-empty { position: absolute; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; pointer-events: none; padding: 16px; }
.rha-empty-card {
    pointer-events: auto; background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow);
    padding: 20px; max-width: 340px; width: 100%; text-align: center;
}
.rha-empty-card p { font-size: 14px; font-weight: 600; margin: 0 0 14px; line-height: 1.45; }

/* ---------- bottom mobile navigation ---------- */
.rha-nav {
    position: absolute; z-index: 26; left: 10px; right: 10px; bottom: 10px;
    display: none; gap: 6px;
    background: var(--panel); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px;
}
.rha-nav-item {
    flex: 1; border: none; background: none; border-radius: 10px; padding: 8px 4px;
    font-size: 11px; font-weight: 700; color: var(--muted); cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.rha-nav-item span { font-size: 18px; }
.rha-nav-item.rha-on { background: #e9f5ef; color: var(--acc); }

/* ============================================================
   CONTROLS
   ============================================================ */
.rha-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
    background: #fff; color: #1c2126; font-size: 14px; font-weight: 700; cursor: pointer;
    margin-bottom: 8px; line-height: 1.2;
}
.rha-btn:hover { background: #f4f6f8; }
.rha-btn:active { transform: scale(.985); }
.rha-btn-primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.rha-btn-primary:hover { background: var(--acc-dark); }
.rha-btn-sos { background: #fff; border-color: var(--sos); color: var(--sos); }
.rha-btn-sos:hover { background: #fdeceb; }
.rha-btn-sosfill { background: var(--sos); border-color: var(--sos); color: #fff; }
.rha-btn-sosfill:hover { background: #c62828; }
.rha-btn-danger { border-color: var(--sos); color: var(--sos); }
.rha-btn-sm { padding: 9px 10px; font-size: 12px; flex: 1; margin-bottom: 0; }
.rha-link { background: none; border: none; color: var(--blue); font-size: 13px; cursor: pointer; padding: 4px 0; }

.rha-input {
    width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px;
    font-size: 14px; background: #fff; color: inherit; outline: none; margin-bottom: 8px;
}
.rha-input:focus { border-color: var(--acc); }
textarea.rha-input { resize: vertical; min-height: 48px; }
.rha-row2 { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; }

.rha-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rha-chip {
    padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px;
    background: #fff; font-size: 12px; font-weight: 600; cursor: pointer; color: #374151; white-space: nowrap;
}
.rha-chip.rha-on { background: var(--acc); border-color: var(--acc); color: #fff; }

.rha-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; color: #374151; line-height: 1.45; margin: 8px 0 12px; }
.rha-consent input { margin-top: 2px; width: 18px; height: 18px; flex: 0 0 auto; }

/* searchable city combobox */
.rha-combo { position: relative; }
.rha-combo-list {
    position: absolute; top: calc(100% - 6px); left: 0; right: 0; z-index: 10;
    background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm);
    max-height: 260px; overflow-y: auto; padding: 4px;
}
.rha-combo-item {
    display: flex; flex-direction: column; align-items: flex-start; width: 100%;
    border: none; background: none; border-radius: 8px; padding: 8px 10px;
    cursor: pointer; text-align: left; font: inherit; color: inherit;
}
.rha-combo-item:hover { background: #eef4f0; }
.rha-combo-item b { font-size: 13px; }
.rha-combo-item small { font-size: 11px; color: var(--muted); }
.rha-combo-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }

/* large draggable search-center pin (teardrop + pulsing ring) */
.rha-center-pin { position: relative; width: 44px; height: 52px; cursor: grab; }
.rha-center-pin:active { cursor: grabbing; }
.rha-center-core {
    position: absolute; left: 50%; top: 6px; width: 34px; height: 34px; margin-left: -17px;
    background: var(--acc); border: 3px solid #fff; border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg); box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.rha-center-core::after {
    content: ''; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px;
    margin: -5px 0 0 -5px; background: #fff; border-radius: 50%;
}
.rha-center-ring {
    position: absolute; left: 50%; bottom: 0; width: 26px; height: 26px; margin-left: -13px;
    border-radius: 50%; background: rgba(15,123,77,.35); pointer-events: none;
    animation: rha-center-ring 1.8s ease-out infinite;
}
@keyframes rha-center-ring { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(2.4); opacity: 0; } }

/* mode cursors + hint (shell-level classes set by setMode) */
.rha-mode-selectCenter .rha-map, .rha-mode-addStation .rha-map,
.rha-mode-sosLocation .rha-map, .rha-mode-queueLocation .rha-map { cursor: crosshair; }
.rha-mode-selectCenter .rha-map .leaflet-grab, .rha-mode-addStation .rha-map .leaflet-grab,
.rha-mode-sosLocation .rha-map .leaflet-grab, .rha-mode-queueLocation .rha-map .leaflet-grab { cursor: crosshair; }

/* combobox keyboard-active row */
.rha-combo-item.rha-active { background: #e9f5ef; box-shadow: inset 0 0 0 1px var(--acc); }

/* stats loading state */
.rha-stats.rha-loading { opacity: .45; pointer-events: none; }

/* Stage 4: body scroll lock while a drawer/modal is open (mobile keyboard fix) */
body.rha-lock { overflow: hidden; }

/* my-location FAB: navigation arrow like in nav apps */
.rha-fab-nav { color: var(--blue); }
.rha-nav-arrow { display: inline-block; transform: rotate(-45deg); font-size: 18px; line-height: 1; }

/* mobile-only helper */
.rha-mobile-only { display: none; }
@media (max-width: 991px) { .rha-mobile-only { display: block; } }

/* ad slot wrapper: never break layout */
.rha-adwrap { max-width: 100%; overflow: hidden; margin: 10px 0; }
.rha-adwrap > * { max-width: 100% !important; }

/* smart selection */
.rha-smart summary::-webkit-details-marker { display: none; }
.rha-smart-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.rha-smart-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; display: flex; flex-direction: column; gap: 3px; }
.rha-smart-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.rha-smart-h b { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rha-smart-card small { font-size: 11px; color: var(--muted); }
.rha-smart-btns { display: flex; gap: 8px; margin-top: 6px; }
.rha-smart-btns .rha-btn { flex: 1; margin-bottom: 0; }
.rha-smart-ad { margin: 2px 0; }
.rha-sb { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.rha-sb-g { background: #e6f4ea; color: #1e7d3e; } .rha-sb-r { background: #fdeceb; color: #c62828; }
.rha-sb-o { background: #fef3e2; color: #b45309; } .rha-sb-b { background: #e8f0fe; color: var(--blue); }
.rha-sb-gray { background: #f0f2f4; color: var(--muted); }

/* radius chat */
.rha-chat-msgs { min-height: 180px; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin: 8px 0; background: #fafbfc; border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
@media (max-width: 991px) { .rha-chat-msgs { min-height: 220px; max-height: 320px; } }
.rha-chat-m { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 12px; }
.rha-chat-m b { font-size: 11px; margin-right: 6px; }
.rha-chat-m span { color: var(--muted); font-size: 10px; }
.rha-chat-sys { background: #fdf6ec; border-color: #f0dcb8; }
.rha-chat-form input { margin-bottom: 6px; }

/* document links (legacy) */
.rha-doclinks { display: flex; flex-direction: column; gap: 7px; }
.rha-doclinks a { font-size: 13px; color: var(--blue); text-decoration: none; }
.rha-doclinks a:hover { text-decoration: underline; }

/* Stage 4.1: pulsing blue "my location" marker — unmistakable */
.rha-userpin { position: relative; width: 36px; height: 36px; }
.rha-userpin-dot { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--blue); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0,0,0,.45); }
.rha-userpin-ring { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%; background: rgba(21,101,192,.35); animation: rha-userping 1.8s ease-out infinite; pointer-events: none; }
@keyframes rha-userping { 0% { transform: scale(.5); opacity: .9; } 100% { transform: scale(2.2); opacity: 0; } }

/* labeled save button under the station title */
.rha-savebtn { display: inline-flex; margin: 0 0 10px; color: #8a6d00; border-color: #e5c100; background: #fffdf2; }
.rha-savebtn:hover { background: #fff8dc; }
.rha-savebtn.rha-on { background: #fff3bf; border-color: #d4b106; font-weight: 800; }

/* binding refine buttons in SOS/queue forms */
.rha-bind-btns { display: flex; gap: 8px; margin: -2px 0 10px; }
.rha-bind-btns .rha-btn { flex: 1; margin-bottom: 0; }

/* owner verification blocks */
.rha-owner { background: #e6f4ea; border: 1px solid #bfe3cc; border-radius: 10px; padding: 9px 12px; font-size: 12px; font-weight: 700; color: #1e7d3e; margin: 8px 0; }
.rha-ownerask { background: #f6f8fa; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.rha-ownerask b { font-size: 13px; }
.rha-ownerask p { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }

/* saved stations drawer */
.rha-saved-list { display: flex; flex-direction: column; gap: 8px; }
.rha-saved-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.rha-saved-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.rha-saved-btns .rha-btn { margin-bottom: 0; padding: 8px 10px; }

/* dark brand/service menu block at the bottom of the left panel */
.rha-brandmenu { background: #fafbfc; border: 1px solid var(--line); color: #374151; border-radius: 14px; margin: 12px 12px 16px; padding: 16px; }
.rha-brandmenu-head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; margin-bottom: 10px; }
.rha-brandmenu-head b { color: #1c2126; font-size: 15px; }
.rha-brandmenu-sub { color: var(--acc) !important; font-weight: 800; font-size: 12px; letter-spacing: .6px; text-decoration: none; padding: 0 !important; border: none !important; }
.rha-brandmenu-sub:hover, .rha-brandmenu-sub:focus { color: var(--acc-dark) !important; text-decoration: underline; }
.rha-brandmenu p { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin: 0 0 6px; text-align: center; }
.rha-brandmenu-sec { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--muted); margin: 14px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.rha-brandmenu a { display: block; color: #374151; text-decoration: none; font-size: 13.5px; padding: 7px 0; border-bottom: 1px solid #f0f2f4; }
.rha-brandmenu a:last-child { border-bottom: none; }
.rha-brandmenu a:hover, .rha-brandmenu a:focus { color: var(--acc-dark); }

/* mobile: "Чат" tab shows the community panel as a bottom sheet */
@media (max-width: 991px) {
    .rha-shell.rha-chat-open .rha-right {
        display: block; position: absolute; z-index: 27;
        left: 0; right: 0; bottom: 0; top: auto; width: auto; max-width: none;
        height: min(88dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 72px));
        max-height: 88dvh; border-radius: 18px 18px 0 0; transform: none;
        overflow: hidden; box-shadow: var(--shadow);
    }
    .rha-shell.rha-chat-open .rha-right .rha-panel-scroll {
        height: 100%; max-height: none;
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); /* bottom nav clearance */
    }
    .rha-shell.rha-chat-open .rha-right-toggle { display: none; }
}

/* ---------- stats ---------- */
.rha-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rha-stat {
    border: 1px solid var(--line); border-radius: 12px; background: #fafbfc;
    padding: 10px 4px; cursor: pointer; text-align: center; font: inherit; color: inherit;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.rha-stat:hover { background: #f0f3f6; }
.rha-stat.rha-on { border-color: var(--acc); background: #e9f5ef; box-shadow: inset 0 0 0 1px var(--acc); }
.rha-stat b { font-size: 19px; line-height: 1.1; }
.rha-stat span { font-size: 10px; color: var(--muted); font-weight: 600; }
.rha-cg b { color: #1e7d3e; } .rha-cy b { color: #a1720b; } .rha-co b { color: #b45309; } .rha-cr b { color: #c62828; }

/* ---------- legend ---------- */
.rha-legend { margin-top: 10px; font-size: 12px; }
.rha-legend summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.rha-legend-items { display: flex; flex-direction: column; gap: 7px; padding: 10px 0 2px; }
.rha-legend-items span { display: inline-flex; align-items: center; gap: 8px; color: #374151; }
.rha-blink { animation: rha-blink 1.4s ease-out infinite; }
@keyframes rha-blink { 0%,100% { box-shadow: 0 0 0 2px rgba(229,57,53,.15); } 50% { box-shadow: 0 0 0 5px rgba(229,57,53,.35); } }

/* ---------- nearest list ---------- */
.rha-list { display: flex; flex-direction: column; gap: 6px; }
.rha-list-item {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 10px 12px;
    cursor: pointer; font: inherit; color: inherit;
}
.rha-list-item:hover { background: #f4f7f9; }
.rha-list-item.rha-active { border-color: var(--acc); background: #e9f5ef; box-shadow: inset 0 0 0 1px var(--acc); }
.rha-list-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rha-list-main b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rha-list-main small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rha-list-dist { font-size: 11px; font-weight: 700; color: var(--acc); white-space: nowrap; }

/* ---------- dots / pins / pulse ---------- */
.rha-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.rha-dot-lg { width: 16px; height: 16px; }
.rha-green { background: var(--green); } .rha-red { background: var(--red); } .rha-orange { background: var(--orange); }
.rha-yellow { background: var(--yellow); } .rha-purple { background: var(--purple); } .rha-gray { background: var(--gray); }
.rha-blue { background: var(--blue); }

.rha-pin {
    position: relative; width: 26px; height: 26px; border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer;
}
.rha-pin.rha-user { border-radius: 50%; transform: none; background: var(--blue); }
.rha-pulse { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; border-radius: 50%; transform: translate(-50%,-50%); opacity: 0; pointer-events: none; }
/* strong selected-station highlight: bigger pin + neon outline + pulsing halo */
.rha-pin.rha-sel { transform: rotate(-45deg) scale(1.35); border-color: #fff; box-shadow: 0 0 0 3px rgba(21,101,192,.85), 0 0 14px rgba(21,101,192,.7), 0 2px 8px rgba(0,0,0,.4); }
.rha-pin.rha-sel .rha-pulse { opacity: 1; animation: rha-pulse 1.4s ease-out infinite; }
.rha-pulse-green { background: rgba(52,168,83,.5); } .rha-pulse-red { background: rgba(229,57,53,.5); }
.rha-pulse-orange { background: rgba(245,124,0,.5); } .rha-pulse-yellow { background: rgba(242,185,13,.5); }
.rha-pulse-purple { background: rgba(142,68,173,.5); } .rha-pulse-gray { background: rgba(154,163,173,.5); }
.rha-pulse-blue { background: rgba(21,101,192,.5); }
@keyframes rha-pulse { 0% { transform: translate(-50%,-50%) scale(1); opacity: .7; } 100% { transform: translate(-50%,-50%) scale(3.4); opacity: 0; } }

/* SOS pin: bigger, urgent double rings */
.rha-pin-sos { width: 34px; height: 34px; border-width: 3px; }
.rha-ring { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; border-radius: 50%; background: rgba(229,57,53,.45); transform: translate(-50%,-50%); pointer-events: none; animation: rha-sos 1.6s ease-out infinite; }
.rha-ring2 { animation-delay: .45s; }
@keyframes rha-sos { 0% { transform: translate(-50%,-50%) scale(1); opacity: .8; } 60% { opacity: .25; } 100% { transform: translate(-50%,-50%) scale(3.8); opacity: 0; } }

/* ============================================================
   DRAWERS
   ============================================================ */
.rha-drawer {
    position: absolute; z-index: 40;
    background: var(--panel); box-shadow: var(--shadow);
    padding: 14px 18px 22px; overflow-y: auto; overscroll-behavior: contain;
    /* mobile default: bottom sheet */
    left: 0; right: 0; bottom: 0; border-radius: 18px 18px 0 0; max-height: 78%;
}
@media (min-width: 992px) {
    .rha-drawer { left: auto; right: 12px; bottom: 12px; top: 72px; width: 400px; border-radius: var(--r); max-height: none; }
}
.rha-drawer-handle { width: 42px; height: 4px; background: #d5dade; border-radius: 4px; margin: 0 auto 12px; }
@media (min-width: 992px) { .rha-drawer-handle { display: none; } }
.rha-close {
    position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
    border: none; border-radius: 50%; background: #eef1f4; cursor: pointer; font-size: 13px; z-index: 2;
}
.rha-drawer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-right: 34px; }
.rha-h { font-size: 17px; font-weight: 800; margin: 0 0 10px; padding-right: 30px; }
.rha-drawer-head .rha-h { margin: 0; padding: 0; }
.rha-sub { font-size: 12px; color: var(--muted); }
.rha-meta { font-size: 13px; color: #374151; margin-bottom: 3px; }
.rha-status { font-size: 14px; font-weight: 800; margin: 10px 0 2px; }
.rha-trust { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rha-trust.rha-tc-ok { color: #1e7d3e; } .rha-trust.rha-tc-warn { color: var(--purple); }
.rha-text { font-size: 14px; line-height: 1.5; margin: 8px 0 12px; }
.rha-block-sep { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.rha-msg { font-size: 13px; margin-top: 8px; min-height: 18px; }
.rha-msg.rha-ok { color: #1e7d3e; } .rha-msg.rha-err { color: var(--sos); }

/* report buttons */
.rha-repgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.rha-repbtn { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.rha-repbtn.rha-rg { color: #1e7d3e; } .rha-repbtn.rha-rr { color: #c62828; }
.rha-repbtn.rha-ro { color: #b45309; } .rha-repbtn.rha-rb { color: var(--blue); }
.rha-repbtn.rha-on { border-color: currentColor; background: #f2f8f4; box-shadow: inset 0 0 0 1px currentColor; }
.rha-fuelchips { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; font-size: 14px; }
.rha-fuelchips label { display: inline-flex; align-items: center; gap: 5px; }

/* Locpit ad slots (station card + right panel) */
.rha-adslot { background: #f2f8f4; border: 1px solid #d7eadf; border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.rha-adslot-title { font-size: 13px; font-weight: 800; color: var(--acc-dark); margin-bottom: 4px; }
.rha-adslot p { font-size: 12px; color: #374151; margin: 0 0 10px; line-height: 1.45; }
.rha-adslot-btn { text-decoration: none; background: var(--acc); border-color: var(--acc); color: #fff; }
.rha-adslot-btn:hover { background: var(--acc-dark); color: #fff; }

/* latest user reports */
.rha-reports { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.rha-report { background: #f6f8fa; border-left: 3px solid var(--gray); border-radius: 10px; padding: 9px 11px; font-size: 13px; }
.rha-report-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.rha-report-h span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rha-report small { color: var(--muted); font-size: 11px; }
.rha-report.rha-rep-g { border-left-color: var(--green); } .rha-report.rha-rep-g b { color: #1e7d3e; }
.rha-report.rha-rep-r { border-left-color: var(--red); } .rha-report.rha-rep-r b { color: #c62828; }
.rha-report.rha-rep-o { border-left-color: var(--orange); } .rha-report.rha-rep-o b { color: #b45309; }
.rha-report.rha-rep-b { border-left-color: var(--blue); } .rha-report.rha-rep-b b { color: var(--blue); }

/* comment char counter + richer list meta */
.rha-com-counter { text-align: right; font-size: 11px; color: var(--muted); margin: -4px 0 6px; }
.rha-list-meta { color: var(--acc-dark) !important; }

/* comments */
.rha-comments { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.rha-comment { background: #f6f8fa; border-radius: 10px; padding: 9px 11px; font-size: 13px; line-height: 1.4; }
.rha-comment-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.rha-comment-h span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rha-authbtns { display: flex; gap: 8px; margin-top: 8px; margin-bottom: 8px; }

/* ad view */
.rha-tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 4px 12px; border-radius: 999px; margin-bottom: 8px; }
.rha-tag-g { background: #e6f4ea; color: #1e7d3e; } .rha-tag-r { background: #fdeceb; color: #c62828; }
.rha-contacts { display: flex; gap: 8px; margin: 10px 0 12px; }
.rha-contact { flex: 1; text-align: center; padding: 12px; border-radius: 12px; font-weight: 700; font-size: 14px; text-decoration: none; color: #fff; }
.rha-contact-phone { background: var(--blue); } .rha-contact-telegram { background: #229ed9; } .rha-contact-whatsapp { background: #25d366; }
.rha-ad-banner { background: #fff8e1; border: 1px dashed #f0c14b; border-radius: 12px; padding: 12px; margin-bottom: 10px; font-size: 13px; }
.rha-ad-banner a { color: #1c2126; text-decoration: none; font-weight: 600; }

/* SOS form */
.rha-toggle2 { display: flex; gap: 8px; margin-bottom: 12px; }
.rha-tgl { flex: 1; padding: 12px 8px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: 13px; font-weight: 800; cursor: pointer; color: #374151; }
.rha-tgl.rha-on { border-color: var(--acc); color: var(--acc); background: #e9f5ef; }
.rha-bind { font-size: 12px; background: #f0f3f6; border-radius: 10px; padding: 9px 11px; margin-bottom: 10px; color: #374151; }
.rha-emerg { background: #fff4f2; border: 1px solid #f6c9c2; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.rha-emerg-title { font-size: 11px; font-weight: 800; color: #b3352b; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
.rha-emerg-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.rha-emerg-grid span { background: #fff; border: 1px solid #f0d6d2; border-radius: 999px; padding: 4px 10px; font-size: 12px; color: #374151; }
.rha-emerg-grid b { color: #c62828; margin-right: 4px; }

/* routes: icon left + text right; row 1 = YaNav/Google, row 2 = 2GIS centered */
.rha-routes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rha-route { display: flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: #f7f9fb; color: #1c2126; font-weight: 700; font-size: 14px; text-decoration: none; min-width: 0; }
.rha-route img { width: 26px; height: 26px; object-fit: contain; flex: 0 0 auto; }
.rha-route span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rha-route:hover { background: #eaf2fc; }
.rha-route-wide { grid-column: 1 / -1; justify-self: center; width: 60%; min-width: 180px; }

/* share: five equal icons in one row */
.rha-share { display: flex; flex-wrap: nowrap; gap: 10px; justify-content: center; align-items: center; margin: 10px 0; }
.rha-share-btn { flex: 0 0 auto; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; border-radius: 12px; border: 1px solid var(--line); background: #fff; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.rha-share-btn img { width: 28px; height: 28px; object-fit: contain; display: block; }
.rha-share-btn:hover, .rha-share-btn:focus { transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* ============================================================
   MODALS
   ============================================================ */
.rha-modal {
    position: fixed; inset: 0; z-index: 60; background: rgba(12, 18, 24, .5);
    display: flex; align-items: center; justify-content: center; padding: 18px; overflow-y: auto;
}
.rha-modal-card {
    position: relative; background: #fff; border-radius: 16px; box-shadow: var(--shadow);
    max-width: 380px; width: 100%; padding: 24px; text-align: center; margin: auto;
}
.rha-modal-card p { font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.rha-modal-icon { font-size: 38px; margin-bottom: 8px; }
.rha-modal-wide { max-width: 680px; text-align: left; max-height: 86vh; overflow-y: auto; }
.rha-faq details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.rha-faq summary { font-weight: 600; font-size: 14px; cursor: pointer; }
.rha-faq p { font-size: 13px; margin: 8px 0 0; color: #374151; }

/* ---------- toast ---------- */
.rha-toast {
    position: fixed; z-index: 70; bottom: 84px; left: 50%; transform: translateX(-50%);
    background: #1c2126; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 13px;
    max-width: 92vw; text-align: center; box-shadow: var(--shadow);
}

/* ============================================================
   COMPACT SEO BLOCK (below the shell)
   ============================================================ */
.rha-seo { max-width: 860px; margin: 0 auto; padding: 28px 16px 42px; }
.rha-seo h1 { font-size: 21px; margin: 0 0 12px; }
.rha-seo p { font-size: 14px; line-height: 1.6; color: #374151; }
.rha-seo-faq { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #fff; margin: 16px 0; }
.rha-seo-faq > summary { font-weight: 700; font-size: 14px; cursor: pointer; }
.rha-seo-faq details { border-bottom: 1px solid var(--line); padding: 8px 0; }
.rha-seo-faq details:last-child { border-bottom: none; }
.rha-seo-faq details summary { font-size: 13px; font-weight: 600; cursor: pointer; }
.rha-seo-faq details p { font-size: 13px; margin: 6px 0 0; }
.rha-seo-nav h2 { font-size: 16px; margin: 20px 0 8px; }
.rha-seo-links { display: flex; flex-wrap: wrap; gap: 8px; }
.rha-seo-links a { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; color: var(--acc); text-decoration: none; }
.rha-seo-links a:hover { background: #e9f5ef; }
.rha-seo-disclaimer { background: #fff8e1; border: 1px solid #f0c14b; border-radius: 12px; padding: 14px; font-size: 13px; line-height: 1.5; color: #5f4b00; }
.rha-seo-brand { font-size: 13px; color: var(--muted); margin-top: 18px; }
.rha-seo-brand a { color: var(--acc); font-weight: 700; text-decoration: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.rha-desktop-only { display: block; }
@media (max-width: 991px) {
    .rha-desktop-only { display: none; }
    .rha-right { display: none; } /* right panel is desktop-only in Stage 1 */
    .rha-nav { display: flex; }
    .rha-header { height: 48px; }
    .rha-logo img { height: 22px; }
    .rha-title { font-size: 13px; }
    .rha-user { display: none; }
    .rha-fabs { top: 70px; }
    .rha-fab { width: 42px; height: 42px; }
    /* left panel becomes a full-height drawer sliding over the map */
    .rha-panel { top: 68px; bottom: 66px; width: min(356px, calc(100vw - 20px)); }
    .rha-modebar { bottom: 76px; }
    .rha-drawer { max-height: 72%; padding-bottom: 30px; }
    .rha-toast { bottom: 130px; }
    .rha-empty-card { max-width: 300px; }
}
@media (max-width: 380px) { .rha-title { display: none; } }

/* ============ Stage 4.5 additions ============ */
/* queue offer marker: slow soft expanding circle every ~2s (no flashing) */
.rha-pin-queue { width: 32px; height: 32px; }
.rha-qring { position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; border-radius: 50%; background: rgba(52,168,83,.35); transform: translate(-50%,-50%); pointer-events: none; animation: rha-qring 2s ease-out infinite; }
@keyframes rha-qring { 0% { transform: translate(-50%,-50%) scale(.8); opacity: .7; } 70% { opacity: .2; } 100% { transform: translate(-50%,-50%) scale(2.6); opacity: 0; } }

/* fuel-available station: green rings (livelier than queue, calmer than SOS) + fuel badge */
.rha-pin-fuel { width: 30px; height: 30px; }
.rha-fring { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; border-radius: 50%; background: rgba(52,168,83,.45); transform: translate(-50%,-50%); pointer-events: none; animation: rha-fring 1.6s ease-out infinite; }
.rha-fring2 { animation-delay: .8s; }
@keyframes rha-fring { 0% { transform: translate(-50%,-50%) scale(.9); opacity: .8; } 100% { transform: translate(-50%,-50%) scale(2.8); opacity: 0; } }
.rha-fuelbadge { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); font-size: 13px; line-height: 1; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }

/* Yandex ID button: icon left, centered text */
.rha-yabtn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 0 auto 8px; }
.rha-yabtn img { width: 22px; height: 22px; object-fit: contain; flex: 0 0 auto; }
.rha-yabtn span { flex: 1; text-align: center; }

/* chat sheet close (X) — mobile only */
.rha-chatclose { display: none; }
@media (max-width: 991px) {
    .rha-shell.rha-chat-open .rha-chatclose { display: flex; align-items: center; justify-content: center; position: absolute; top: 10px; right: 12px; z-index: 3; }
    /* bottom nav must stay above the chat sheet so tabs keep working */
    .rha-shell.rha-chat-open .rha-nav { z-index: 30; }
}

/* clickable system chat events */
.rha-chat-click { cursor: pointer; }
.rha-chat-click:hover { background: #fbf0dc; }
