/* Food Ratings application styles: the map app (/explore) and the secondary pages. Tokens and
   shared primitives (.rr-score, .rr-button, .rr-tag, .status-pill) live in design-system.css.
   Layout follows food-ratings-redesign/dist/explore.html: results | map | business information. */

/* htmx indicator styles are ours (includeIndicatorStyles is off for the CSP). */
.htmx-indicator { opacity: 0; visibility: hidden; transition: opacity .2s ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; visibility: visible; }

body { font-family: var(--rr-font); color: var(--rr-ink); }
a { color: var(--rr-brand); text-underline-offset: 3px; }
a:hover { color: var(--rr-brand-hover); }

.rr-demo-banner {
    display: flex; align-items: center; justify-content: center; gap: 8px; padding: 7px 16px;
    background: #fff4e0; color: #6b4300; border-bottom: 1px solid #f0d49c; font-size: 13px; font-weight: 600; line-height: 20px; text-align: center;
}
.rr-demo-banner .rr-icon { width: 16px; height: 16px; }

.rr-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 3000; max-width: calc(100% - 32px); }
.rr-toast-pill {
    padding: 10px 16px; border-radius: 10px; background: var(--rr-ink); color: #fff; font-size: 14px; line-height: 1.4;
    box-shadow: 0 10px 30px rgba(32, 36, 44, .25);
}

/* ---------- Brand header (map app and secondary pages) ---------- */
.app-header {
    position: relative; z-index: 20; flex: none; display: flex; align-items: center; gap: 35px;
    height: 76px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--rr-border);
}
.app-nav { display: flex; align-self: stretch; align-items: stretch; gap: 27px; margin-left: 20px; }
.app-nav a {
    display: flex; align-items: center; padding: 3px 2px 0; border-bottom: 3px solid transparent;
    color: var(--rr-muted); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.app-nav a:hover { color: var(--rr-ink); }
.app-nav a.current { color: var(--rr-brand); font-weight: 650; border-bottom-color: var(--rr-brand); }
.app-header-end { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.app-home { font-size: 14px; color: var(--rr-muted); text-decoration: none; }
.app-home:hover { color: var(--rr-ink); text-decoration: underline; }
.app-menu { display: none; position: relative; }
.app-menu > summary {
    display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--rr-border); border-radius: 10px;
    list-style: none; cursor: pointer; color: var(--rr-ink); background: #fff;
}
.app-menu > summary::-webkit-details-marker { display: none; }
.app-menu[open] > summary { background: var(--rr-canvas); }
.app-menu-list {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 220px; padding: 8px;
    display: flex; flex-direction: column; background: #fff; border: 1px solid var(--rr-border); border-radius: 12px;
    box-shadow: 0 14px 40px rgba(32, 36, 44, .14);
}
.app-menu-list a { padding: 11px 12px; border-radius: 8px; color: var(--rr-ink); font-size: 15px; text-decoration: none; }
.app-menu-list a:hover { background: var(--rr-canvas); color: var(--rr-ink); }

/* ---------- Map app shell ---------- */
body.rr-map-body { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--rr-canvas); }

/* Search toolbar: Business / Postcode / Area, field, All areas, Filters, Use my location. Everything
   above the map uses whole-pixel line heights: a fractional map offset puts Leaflet's tiles on
   half pixels and shows seams between them on high-density screens. */
.search-bar { flex: none; position: relative; z-index: 10; padding: 18px 24px; background: #fff; border-bottom: 1px solid var(--rr-border); }
.search-row { display: flex; align-items: center; gap: 13px; }
.search-modes { display: flex; flex: none; align-items: center; padding: 4px; border-radius: 9px; background: var(--rr-canvas); }
.mode-radio, .view-radio { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.search-modes label {
    padding: 10px 13px; border-radius: 6px; color: var(--rr-muted); font-size: 14px; font-weight: 550; line-height: 20px;
    cursor: pointer; white-space: nowrap; user-select: none;
}
.search-modes label:hover { color: var(--rr-ink); }
.mode-radio:checked + label { background: #fff; color: var(--rr-brand); box-shadow: 0 2px 6px rgba(32, 36, 44, .08); }
.mode-radio:focus-visible + label, .view-radio:focus-visible + label { outline: 3px solid var(--rr-focus); outline-offset: 1px; }

.search-field {
    flex: 1 1 280px; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 14px;
    border: 1px solid #d9dce1; border-radius: 10px; background: #fff;
}
.search-field:focus-within { border-color: #c98a77; box-shadow: 0 0 0 3px rgba(189, 62, 42, .14); }
.search-field > .rr-icon { color: var(--rr-muted); }
.search-field input, .search-field select {
    flex: 1; min-width: 0; width: 100%; height: 39px; padding: 0; border: 0; background-color: transparent;
    color: var(--rr-ink); font: inherit; font-size: 15px;
}
.search-field select { cursor: pointer; }
.search-field input:focus-visible, .search-field select:focus-visible { outline: none; }
.search-field input:disabled { cursor: not-allowed; }
.search-field .rr-button { min-height: 39px; padding: 9px 20px; }
/* One field per mode. Without :has() support the business search stays usable. */
.rr-mode-input { display: none; }
.rr-mode-businesses { display: flex; }
#rr-search:has(#rr-mode-postcode:checked) .rr-mode-businesses,
#rr-search:has(#rr-mode-area:checked) .rr-mode-businesses { display: none; }
#rr-search:has(#rr-mode-postcode:checked) .rr-mode-postcode,
#rr-search:has(#rr-mode-area:checked) .rr-mode-area { display: flex; }
#rr-search:has(#rr-mode-postcode:checked) .all-areas,
#rr-search:has(#rr-mode-area:checked) .all-areas { display: none; }

.all-areas { display: flex; flex: none; align-items: center; gap: 7px; min-height: 44px; margin: 0; color: var(--rr-muted); font-size: 14px; white-space: nowrap; cursor: pointer; }
.all-areas input { width: 17px; height: 17px; accent-color: var(--rr-brand); }
.search-tools { display: flex; flex: none; gap: 8px; margin-left: auto; }
.search-tools .rr-button { padding: 10px 14px; }
.filter-count {
    display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--rr-brand); color: #fff; font-size: 12px; font-weight: 700;
}
.filter-count:empty { display: none; }

.filters-panel { margin-top: 2px; }
.filters-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 16px; padding-top: 16px; }
.filter-field label { display: block; margin-bottom: 5px; color: var(--rr-muted); font-size: 13px; font-weight: 600; line-height: 20px; }
.filter-field .form-select { min-height: 44px; border-radius: 9px; border-color: #d9dce1; font-size: 14px; }
.filter-actions { display: flex; align-items: flex-end; }
.filters-help { margin: 12px 0 0; color: var(--rr-muted); font-size: 13px; line-height: 20px; }

.app-notice {
    flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 24px;
    background: #fff9ef; border-bottom: 1px solid #e8d7b8; color: #785225; font-size: 13px; line-height: 20px;
}
.app-notice .rr-icon { width: 17px; height: 17px; }
.app-notice a { color: inherit; font-weight: 600; }
.app-notice--danger { background: #fdecee; border-color: #f2c6cc; color: #8f1f2d; }
.app-notice--secondary { background: var(--rr-canvas); border-color: var(--rr-border); color: #4b5563; }
.app-notice--success { background: #eef1f8; border-color: #cfd8e8; color: #263c64; }

.mobile-views { display: none; }

/* Workspace: results | map, plus the business information pane when a place is open. */
.app-workspace { position: relative; flex: 1; min-height: 0; display: grid; grid-template-columns: 380px minmax(0, 1fr); }
.app-workspace:has(> #rr-detail:not([hidden])) { grid-template-columns: 320px minmax(240px, 1fr) 365px; }

/* ---------- Results panel ---------- */
.results-panel {
    position: relative; z-index: 2; min-width: 0; min-height: 0; display: flex; flex-direction: column;
    background: #fff; border-right: 1px solid var(--rr-border);
}
#rr-message { flex: none; }
#rr-message:empty { display: none; }
.search-message {
    display: flex; align-items: flex-start; gap: 8px; margin: 14px 16px 2px; padding: 10px 12px; border-radius: 9px;
    background: #fff4e0; border: 1px solid #f0d49c; color: #6b4300; font-size: 14px; line-height: 1.45;
}
.search-message .rr-icon { width: 17px; height: 17px; margin-top: 1px; }
.results-region { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.results-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.results-body > * { flex: none; }
.results-body > .result-list { flex: 1 1 auto; min-height: 120px; overflow-y: auto; overscroll-behavior: contain; }
.results-body > .empty-state { flex: 1 1 auto; overflow-y: auto; }

.results-heading { padding: 24px 23px 19px; border-bottom: 1px solid var(--rr-border); }
.results-eyebrow {
    display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
    color: var(--rr-brand); font-size: 11px; font-weight: 750; letter-spacing: 1.4px; text-transform: uppercase;
}
.results-eyebrow span { min-width: 0; color: var(--rr-muted); font-size: 11px; font-weight: 550; letter-spacing: .4px; text-align: right; }
.results-heading h1 { margin: 9px 0 4px; font-size: 25px; font-weight: 700; line-height: 1.25; letter-spacing: -.9px; overflow-wrap: anywhere; }
.results-range { margin: 0; color: var(--rr-muted); font-size: 13px; }
.results-notice { margin: 8px 0 0; color: var(--rr-muted); font-size: 13px; line-height: 1.5; }
.results-warning {
    margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; background: #fff9ef; border: 1px solid #e8d7b8;
    color: #785225; font-size: 13px; line-height: 1.45;
}
.data-status { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; color: #5f6976; font-size: 12px; }
.data-status > .rr-icon { width: 16px; height: 16px; color: var(--rr-brand); }
.data-status .status-pill { font-size: 11px; padding: 3px 9px; }
.info-dot {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border: 1px solid #b8c0ca; border-radius: 50%;
    background: #fff; color: var(--rr-muted); font: italic 13px Georgia, serif; text-decoration: none;
}
.info-dot:hover { color: var(--rr-brand); border-color: var(--rr-brand); }
.active-filters { padding: 8px 23px; background: var(--rr-soft); color: #9e3020; font-size: 13px; line-height: 1.5; border-bottom: 1px solid #f6dccd; }

.result-list { margin: 0; padding: 0; list-style: none; }
.rr-item { border-bottom: 1px solid var(--rr-border); }
.result-item {
    display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 20px 23px 20px 20px; margin: 0;
    border: 0; border-left: 3px solid transparent; border-radius: 0; background: #fff; color: var(--rr-ink);
    font: inherit; text-align: left; cursor: pointer;
}
.result-item:hover, .rr-item.is-hovered .result-item { background: #fcf6f2; border-left-color: var(--rr-brand); }
.rr-item.is-selected .result-item { background: #fff5ef; border-left-color: var(--rr-brand); }
.result-item:focus-visible { outline-offset: -3px; }
.result-item > .rr-score { margin-top: 2px; }
.result-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.result-name { font-size: 16px; font-weight: 680; line-height: 1.4; letter-spacing: -.3px; overflow-wrap: anywhere; }
.result-meta { margin-top: 3px; color: var(--rr-muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.result-rating { margin-top: 6px; font-size: 14px; line-height: 1.4; }
.result-rating strong { font-weight: 620; }
.result-date { margin-top: 2px; color: var(--rr-muted); font-size: 13px; }
.result-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.result-tag { padding: 3px 8px; border-radius: 5px; background: var(--rr-canvas); color: #4b5563; font-size: 12px; font-weight: 600; }
.result-tag--pending { background: #eef1f8; color: #415576; }
.result-chevron { align-self: center; margin-left: auto; color: #9096a0; }

.pagination-bar {
    display: flex; justify-content: center; align-items: center; gap: 8px; padding: 10px 16px;
    background: #fff; border-top: 1px solid var(--rr-border);
}
.page-button {
    display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--rr-border);
    border-radius: 8px; background: #fff; color: var(--rr-ink); font: inherit; font-size: 17px; cursor: pointer;
}
button.page-button:hover { background: var(--rr-canvas); border-color: #cfd3d9; }
span.page-button { color: #c2c7ce; cursor: default; }
.page-button .rr-icon { width: 17px; height: 17px; }
.page-status { margin: 0 8px; color: var(--rr-muted); font-size: 13px; white-space: nowrap; }
.result-foot { margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--rr-border); background: #fafbfc; color: var(--rr-muted); font-size: 12px; text-align: center; }

.empty-state { padding: 32px 23px; }
.empty-state h1, .empty-state h2 { margin: 12px 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -.4px; }
.empty-state p, .empty-state li { color: var(--rr-muted); font-size: 14px; line-height: 1.6; }
.empty-state p { margin: 8px 0; }
.empty-state ul { margin: 8px 0 0; padding-left: 20px; }
.empty-state code { color: var(--rr-ink); }
.loading-line { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--rr-muted); font-size: 14px; }

/* ---------- Map panel ---------- */
.map-panel { position: relative; min-width: 0; overflow: hidden; background: #e7e7df; isolation: isolate; }
.rr-map { position: absolute; inset: 0; background: #e8e6df; }
.rr-map.rr-no-tiles {
    background-color: #f1f2f4;
    background-image: linear-gradient(#e2e5ea 1px, transparent 1px), linear-gradient(90deg, #e2e5ea 1px, transparent 1px);
    background-size: 48px 48px;
}
.leaflet-container { font-family: var(--rr-font); }
.leaflet-container a { color: var(--rr-brand); }
.leaflet-control-attribution { font-size: 11px; }
.leaflet-top.leaflet-right .leaflet-control { margin-top: 18px; margin-right: 18px; }
.leaflet-bar, .leaflet-touch .leaflet-bar { border: 1px solid #dcdfe3; border-radius: 10px; box-shadow: 0 5px 20px rgba(32, 36, 44, .08); overflow: hidden; }
.leaflet-bar a, .leaflet-touch .leaflet-bar a {
    width: 40px; height: 40px; line-height: 40px; color: var(--rr-ink); font: 400 22px/40px var(--rr-font);
}
.leaflet-bar a:first-child, .leaflet-bar a:last-child { border-radius: 0; }
.leaflet-bar a:hover { background: var(--rr-canvas); color: var(--rr-ink); }

.map-top {
    position: absolute; top: 18px; left: 18px; right: 76px; z-index: 1000; display: flex; flex-direction: column;
    align-items: center; gap: 8px; pointer-events: none;
}
.map-top > * { pointer-events: auto; }
#rr-search-area { box-shadow: 0 5px 20px rgba(116, 50, 32, .16); }
.map-pill {
    display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: #fff;
    border: 1px solid var(--rr-border); box-shadow: 0 3px 12px rgba(32, 36, 44, .08); font-size: 13px; text-align: center;
}
.map-notice {
    max-width: 520px; padding: 9px 12px; border-radius: 8px; background: rgba(255, 249, 239, .97); border: 1px solid #e8d7b8;
    color: #785225; font-size: 13px; line-height: 1.45; text-align: center; box-shadow: 0 3px 12px rgba(32, 36, 44, .05);
}

/* Rating pins are circles with the rating text; clusters are white stacked pills with a count, so a
   count can never be read as a rating. */
.rr-pin {
    display: flex; align-items: center; justify-content: center; width: 30px !important; height: 30px !important;
    border-radius: 50%; border: 2px solid #fff; color: #fff; font-size: 13px; font-weight: 750; line-height: 1;
    box-shadow: 0 2px 6px rgba(32, 36, 44, .45); cursor: pointer; font-variant-numeric: tabular-nums;
}
/* The colour comes from the rr-pin--* class in design-system.css (the script always sets one). */
.rr-pin.is-hovered { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--rr-ink); }
.rr-pin.is-selected { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--rr-brand), 0 4px 12px rgba(32, 36, 44, .4); z-index: 1000 !important; }
.rr-cluster span {
    display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; border-radius: 8px;
    background: #fff; color: var(--rr-ink); border: 2px solid var(--rr-ink); font-size: 12px; font-weight: 700;
    box-shadow: 3px 3px 0 #9aa3b2, 0 2px 6px rgba(32, 36, 44, .3); cursor: pointer;
}
.leaflet-marker-icon:focus-visible { outline: 3px solid var(--rr-focus); outline-offset: 3px; }
.leaflet-tooltip.rr-tip {
    max-width: 16rem; padding: 9px 11px; border: 0; border-radius: 9px; white-space: normal; color: var(--rr-ink);
    box-shadow: 0 8px 24px rgba(32, 36, 44, .22);
}
.rr-tip strong { display: block; font-size: 14px; }
.rr-tip span { display: block; color: #4b5563; font-size: 12px; line-height: 1.45; }

.selected-map-place {
    position: absolute; left: 18px; bottom: 86px; z-index: 1000; display: flex; align-items: center; gap: 11px;
    max-width: calc(100% - 36px); padding: 10px 15px 10px 10px; border: 1px solid #fff; border-radius: 11px; background: #fff;
    color: var(--rr-ink); font: inherit; text-align: left; box-shadow: 0 5px 24px rgba(32, 36, 44, .14); cursor: pointer;
}
.selected-map-place:hover { background: #fffaf7; }
.selected-map-place .rr-score { flex-basis: 32px; width: 32px; height: 34px; border-radius: 7px; font-size: 19px; }
.selected-map-place b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.selected-map-place small { display: block; margin-top: 2px; color: var(--rr-muted); font-size: 12px; }

.rating-key {
    position: absolute; left: 18px; bottom: 30px; z-index: 1000; max-width: min(430px, calc(100% - 36px)); padding: 12px 15px;
    border: 1px solid #fff; border-radius: 12px; background: rgba(255, 255, 255, .96); box-shadow: 0 8px 30px rgba(32, 36, 44, .08);
}
.rating-key[open] { z-index: 1001; max-height: calc(100% - 120px); overflow: auto; }
.rating-key > summary { display: flex; align-items: center; min-height: 24px; font-size: 13px; font-weight: 650; cursor: pointer; }
.key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 17px; margin: 14px 0 0; padding: 0; list-style: none; }
.key-grid li { display: flex; align-items: center; gap: 8px; font-size: 12px; line-height: 1.35; }
.rating-key > p { max-width: 300px; margin: 12px 0 0; color: var(--rr-muted); font-size: 11px; }
.you-dot { flex: none; width: 16px; height: 16px; margin: 0 5px; border-radius: 50%; background: var(--rr-you); border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(32, 36, 44, .35); }
.cluster-sample {
    flex: none; display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 4px; border-radius: 6px;
    background: #fff; color: var(--rr-ink); border: 2px solid var(--rr-ink); box-shadow: 2px 2px 0 #9aa3b2; font-size: 11px; font-weight: 700;
}

/* ---------- Business information pane ---------- */
.business-details {
    position: relative; z-index: 5; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    background: #fff; border-left: 1px solid var(--rr-border); outline: none;
}
.details-header { position: relative; padding: 24px 22px 16px; }
.details-header .rr-tag { margin-bottom: 14px; font-size: 11px; letter-spacing: .7px; }
.details-header h2 { margin: 0; padding-right: 30px; font-size: 24px; font-weight: 720; line-height: 1.25; letter-spacing: -.8px; outline: none; overflow-wrap: anywhere; }
.details-header > p { margin: 6px 0 0; color: var(--rr-muted); font-size: 14px; }
.details-close {
    position: absolute; right: 16px; top: 18px; display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
    border: 1px solid var(--rr-border); border-radius: 9px; background: #fff; color: #687486; cursor: pointer;
}
.details-close:hover { background: var(--rr-soft); color: var(--rr-brand); }
.details-content { padding: 0 22px 26px; }
.detail-alert {
    margin: 0 0 14px; padding: 10px 12px; border-radius: 9px; background: var(--rr-canvas); border: 1px solid var(--rr-border);
    font-size: 13px; line-height: 1.5;
}
.detail-alert--warning { background: #fff4e0; border-color: #f0d49c; color: #6b4300; font-weight: 600; }
.detail-rating-card {
    display: flex; align-items: center; gap: 13px; padding: 17px 14px; border: 1px solid #dfe5ef; border-radius: 12px; background: #f5f7fb;
}
.detail-rating-card strong { display: block; font-size: 19px; letter-spacing: -.4px; line-height: 1.3; }
.detail-rating-card span:not(.rr-score) { display: block; margin-top: 3px; color: var(--rr-muted); font-size: 13px; }
.detail-pending { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0 0; color: #415576; font-size: 13px; }
.rr-tag--pending { background: #eef1f8; color: #415576; }
.detail-section { margin-top: 24px; }
.detail-section h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; letter-spacing: -.15px; }
.detail-section > p { margin: 5px 0; font-size: 14px; line-height: 1.6; }
.detail-section a:not(.rr-button) { color: var(--rr-brand); overflow-wrap: anywhere; }
.detail-section a .rr-icon { width: 14px; height: 14px; vertical-align: -2px; }
.inspection-findings { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); margin: 0; }
.inspection-findings dt, .inspection-findings dd { margin: 0; padding: 11px 0; border-bottom: 1px dashed #e0e4eb; font-size: 13px; line-height: 1.55; }
.inspection-findings dt { padding-right: 10px; font-weight: 500; }
.inspection-findings dd { text-align: right; color: #506078; }
.inspection-findings dd strong { color: var(--rr-ink); font-weight: 650; }
.detail-help { margin: 10px 0 0 !important; color: var(--rr-muted); font-size: 13px !important; line-height: 1.6 !important; }
.detail-help .rr-icon { width: 15px; height: 15px; vertical-align: -3px; }
.detail-section address { margin: 0; font-size: 14px; font-style: normal; line-height: 1.6; }
.detail-section address span { display: block; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.detail-actions .rr-button { min-height: 40px; padding: 9px 13px; font-size: 13px; }
.detail-actions .rr-icon { width: 16px; height: 16px; }
.copy-status { margin-top: 8px; color: var(--rr-muted); font-size: 13px; }
.copy-status:empty { display: none; }
.copy-field { display: block; width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid #d9dce1; border-radius: 7px; font: inherit; font-size: 13px; color: var(--rr-ink); }
.right-to-reply { margin: 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--rr-border); font-size: 14px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.council-link { font-size: 14px; }
.record-fields { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 13px; line-height: 1.5; }
.record-fields dt { color: var(--rr-muted); font-weight: 500; }
.record-fields dd { margin: 0; overflow-wrap: anywhere; }
.detail-history { margin: 0; padding: 0; list-style: none; }
.detail-history li { padding: 10px 0; border-bottom: 1px solid var(--rr-border); font-size: 14px; }
.detail-history li:last-child { border-bottom: 0; }
.detail-history-date { color: var(--rr-muted); font-size: 12px; }
.detail-history p { margin: 3px 0 0; color: #4b5563; font-size: 13px; }
.detail-note { margin: 24px 0 0; padding: 12px; border-radius: 9px; background: var(--rr-canvas); color: var(--rr-muted); font-size: 12px; line-height: 1.6; }

/* ---------- Large desktop ---------- */
@media (min-width: 1600px) {
    .app-workspace:has(> #rr-detail:not([hidden])) { grid-template-columns: 360px minmax(300px, 1fr) 400px; }
    .details-header, .details-content { padding-left: 24px; padding-right: 24px; }
    .inspection-findings dt, .inspection-findings dd { font-size: 14px; }
}

/* ---------- Smaller desktop and tablet ---------- */
@media (max-width: 1200px) {
    .app-header { height: 65px; padding: 0 20px; gap: 20px; }
    .app-nav { margin-left: 6px; gap: 20px; }
    .search-bar { padding: 12px 20px; }
    .search-row { flex-wrap: wrap; gap: 10px; }
    .search-field { flex-basis: 360px; }
    .search-modes label { padding: 9px 10px; }
    .app-workspace { grid-template-columns: 340px minmax(0, 1fr); }
    .result-item { padding: 16px 20px 16px 17px; }
    .results-heading { padding: 18px 20px; }
    .results-heading h1 { font-size: 23px; }
    .result-foot { padding: 8px 16px; }
}
@media (min-width: 1101px) and (max-width: 1250px) {
    .app-workspace:has(> #rr-detail:not([hidden])) { grid-template-columns: 285px minmax(200px, 1fr) 335px; }
    .details-header { padding: 20px 17px 15px; }
    .details-content { padding: 0 17px 22px; }
    .results-heading { padding-left: 17px; padding-right: 17px; }
    .results-eyebrow span { display: none; }
}
@media (max-width: 1050px) {
    .app-home { display: none; }
}
@media (max-width: 900px) {
    .app-nav { display: none; }
    .app-menu { display: block; }
}
/* Tablet: the search field gets the first line; All areas and the tools wrap below it. */
@media (min-width: 701px) and (max-width: 1100px) {
    .search-field { flex-basis: calc(100% - 270px); }
}
/* Tablet: the business information opens over the map instead of squeezing a third column. */
@media (min-width: 701px) and (max-width: 1100px) {
    .app-workspace, .app-workspace:has(> #rr-detail:not([hidden])) { grid-template-columns: 300px minmax(0, 1fr); }
    .business-details { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 52%); box-shadow: -12px 0 35px rgba(32, 36, 44, .1); }
    .app-workspace:has(> #rr-detail:not([hidden])) .map-top { right: 52%; align-items: flex-start; }
    .results-eyebrow span { display: none; }
}
/* Narrow tablets (and 200% zoom): the pane takes the results column's place, so the whole map stays
   in view; closing it brings the list back. */
@media (min-width: 701px) and (max-width: 900px) {
    .business-details { left: 0; right: auto; width: 300px; border-left: 0; border-right: 1px solid var(--rr-border); box-shadow: 12px 0 35px rgba(32, 36, 44, .1); }
    .app-workspace:has(> #rr-detail:not([hidden])) .results-panel { visibility: hidden; }
    .app-workspace:has(> #rr-detail:not([hidden])) .map-top { right: 76px; align-items: center; }
}

/* ---------- Phones: List / Map tabs, business information as a full view ---------- */
@media (max-width: 700px) {
    .app-header { height: 60px; padding: 0 14px; gap: 10px; }
    .app-header .rr-brand img { height: 30px; }
    .app-header-end { gap: 8px; }
    .search-bar { padding: 10px 14px 12px; }
    .search-row { gap: 9px; }
    .search-modes { width: 100%; }
    .search-modes label { flex: 1; padding: 9px 6px; text-align: center; }
    .search-field { flex: 1 1 100%; }
    .search-field input, .search-field select { font-size: 16px; } /* 16px stops iOS zooming on focus */
    .search-field .rr-button { padding: 9px 14px; }
    .all-areas { min-height: 40px; font-size: 14px; }
    .search-tools .rr-button { min-height: 40px; padding: 8px 11px; font-size: 13px; }
    .filters-grid { grid-template-columns: 1fr 1fr; gap: 10px 12px; }
    .app-notice { padding: 8px 14px; }

    .mobile-views { flex: none; display: flex; gap: 6px; padding: 8px 14px; background: #fff; border-bottom: 1px solid var(--rr-border); }
    .mobile-views label {
        flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; border-radius: 8px;
        background: var(--rr-canvas); color: var(--rr-muted); font-size: 14px; font-weight: 600; cursor: pointer;
    }
    .mobile-views .rr-icon { width: 17px; height: 17px; }
    .view-radio:checked + label { background: var(--rr-ink); color: #fff; }

    /* Both panels keep their size (the map stays measurable); the tab picks the visible one. */
    .app-workspace, .app-workspace:has(> #rr-detail:not([hidden])) { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
    .results-panel, .map-panel { grid-area: 1 / 1; border-right: 0; }
    body:has(#rr-view-map:checked) .results-panel { visibility: hidden; }
    body:has(#rr-view-list:checked) .map-panel { visibility: hidden; }
    .business-details { position: absolute; inset: 0; width: 100%; border-left: 0; }
    .app-workspace:has(> #rr-detail:not([hidden])) .results-panel,
    .app-workspace:has(> #rr-detail:not([hidden])) .map-panel { visibility: hidden; }

    .results-heading { padding: 16px 16px 14px; }
    .results-heading h1 { font-size: 22px; }
    .results-eyebrow span { display: none; }
    .result-item { padding: 15px 16px 15px 13px; }
    .result-foot { display: none; }
    .map-top { top: 12px; left: 12px; right: 66px; }
    .leaflet-top.leaflet-right .leaflet-control { margin-top: 12px; margin-right: 12px; }
    .rating-key { left: 12px; right: 12px; bottom: 28px; max-width: none; padding: 10px 13px; }
    .key-grid { gap: 8px 12px; }
    .selected-map-place { left: 12px; bottom: 80px; max-width: calc(100% - 24px); }
    .details-header { padding: 18px 16px 14px; }
    .details-header h2 { font-size: 24px; padding-right: 40px; }
    .details-close { top: 12px; right: 12px; width: 44px; height: 44px; }
    .details-content { padding: 0 16px 28px; }
    .inspection-findings dt, .inspection-findings dd { font-size: 14px; }
    .detail-actions .rr-button { font-size: 14px; }
}
@media (max-width: 520px) {
    .app-header-end > .status-pill { display: none; }
}
@media (max-width: 370px) {
    .filters-grid { grid-template-columns: 1fr; }
    .search-tools { flex-wrap: wrap; margin-left: 0; }
}

/* Short windows and browser zoom (200% text on a laptop): the results panel scrolls as one, so the
   heading never squeezes the list to nothing, and paging stays at hand. */
@media (max-height: 700px), (max-width: 700px) {
    .results-region { display: block; overflow-y: auto; overscroll-behavior: contain; }
    .results-body { display: block; }
    .results-body > .result-list { overflow: visible; min-height: 0; }
    .pagination-bar { position: sticky; bottom: 0; z-index: 1; }
}
@media (max-height: 650px) and (min-width: 701px) {
    .search-bar { padding-top: 10px; padding-bottom: 10px; }
    .results-heading { padding-top: 12px; padding-bottom: 12px; }
    .data-status { margin-top: 6px; }
    .result-foot { display: none; }
    .result-item { padding-top: 13px; padding-bottom: 13px; }
    .rating-key { bottom: 24px; }
    .key-grid { gap: 6px 14px; }
}

/* Very short windows (200% zoom on a laptop, phones held sideways): the page scrolls instead of
   squeezing the workspace under the header and search bar; the workspace keeps a full screen. */
@media (max-height: 520px) {
    body.rr-map-body { height: auto; min-height: 100vh; overflow: visible; }
    .app-workspace { flex: none; height: max(100vh, 360px); height: max(100dvh, 360px); }
}

/* ---------- Secondary pages (changes, coverage, about) ---------- */
body.rr-page-body { min-height: 100vh; display: flex; flex-direction: column; background: var(--rr-canvas); }
.page { flex: 1; padding: 40px 0 64px; }
.page-wrap { width: min(1180px, calc(100% - 48px)); margin: 0 auto; }
.page-wrap--narrow { width: min(820px, calc(100% - 48px)); }
.page-head { margin-bottom: 26px; }
.eyebrow { display: block; color: var(--rr-brand); font-size: 12px; font-weight: 750; letter-spacing: 1.4px; text-transform: uppercase; }
.page-head h1 { margin: 10px 0 8px; font-size: clamp(30px, 4vw, 40px); font-weight: 720; line-height: 1.15; letter-spacing: -1.4px; }
.page-lead { max-width: 720px; margin: 0; color: var(--rr-muted); font-size: 17px; line-height: 1.6; }
.panel { padding: 20px 22px; border: 1px solid var(--rr-border); border-radius: 14px; background: #fff; }
.panel + .panel { margin-top: 16px; }
.notice {
    margin: 0 0 16px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rr-border); background: #fff;
    font-size: 14px; line-height: 1.55;
}
.notice--warning { background: #fff9ef; border-color: #e8d7b8; color: #785225; }
.notice--danger { background: #fdecee; border-color: #f2c6cc; color: #8f1f2d; }
.notice--success { background: #eef1f8; border-color: #cfd8e8; color: #263c64; }
.notice--info { background: #eef3fa; border-color: #cddbee; color: #2e4b75; }

/* Change feed */
.changes-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 12px 16px; align-items: end; }
.changes-filters label { display: block; margin-bottom: 5px; color: var(--rr-muted); font-size: 13px; font-weight: 600; }
.changes-filters .form-select { min-height: 44px; border-radius: 9px; border-color: #d9dce1; }
.changes-loading { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--rr-muted); font-size: 13px; }
#rr-changes { margin-top: 20px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.day-chips li { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--rr-border); background: #fff; font-size: 13px; }
.day-chips b { font-weight: 650; }
.changes-count { margin: 0 0 10px; color: var(--rr-muted); font-size: 14px; }
.change-feed { margin: 0 0 16px; padding: 0; list-style: none; border: 1px solid var(--rr-border); border-radius: 14px; background: #fff; overflow: hidden; }
.change-feed > li { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--rr-border); }
.change-feed > li:last-child { border-bottom: 0; }
.change-badges { display: flex; flex: none; align-items: center; gap: 4px; color: #9096a0; }
.change-badges .rr-icon { width: 15px; height: 15px; }
.change-body { flex: 1; min-width: 0; }
.change-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.change-top a { font-size: 16px; font-weight: 680; color: var(--rr-ink); text-decoration: none; overflow-wrap: anywhere; }
.change-top a:hover { color: var(--rr-brand); text-decoration: underline; }
.change-top time { color: var(--rr-muted); font-size: 13px; white-space: nowrap; }
.change-meta { margin: 2px 0 0; color: var(--rr-muted); font-size: 13px; }
.change-desc { margin: 6px 0 0; font-size: 14px; }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.pager a, .pager span {
    display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border: 1px solid var(--rr-border);
    border-radius: 8px; background: #fff; color: var(--rr-ink); font-size: 14px; text-decoration: none;
}
.pager a:hover { background: var(--rr-canvas); }
.pager [aria-current] { background: var(--rr-brand); border-color: var(--rr-brand); color: #fff; font-weight: 650; }
.page-note { margin: 18px 0 0; color: var(--rr-muted); font-size: 13px; line-height: 1.6; }

/* Coverage */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { padding: 18px 18px 16px; border: 1px solid var(--rr-border); border-radius: 14px; background: #fff; }
.stat-label { color: var(--rr-muted); font-size: 12px; font-weight: 650; letter-spacing: .8px; text-transform: uppercase; }
.stat-value { margin: 8px 0 4px; font-size: 22px; font-weight: 720; letter-spacing: -.5px; line-height: 1.2; }
.stat-note { margin: 0; color: var(--rr-muted); font-size: 13px; line-height: 1.5; }
.table-panel { border: 1px solid var(--rr-border); border-radius: 14px; background: #fff; overflow-x: auto; }
.table-panel .table { margin: 0; font-size: 14px; --bs-table-bg: transparent; }
.table-panel .table th, .table-panel .table td { padding: 11px 14px; vertical-align: top; }
.table-panel thead th { color: var(--rr-muted); font-size: 12px; font-weight: 650; letter-spacing: .5px; text-transform: uppercase; white-space: nowrap; background: #fafbfc; }
.table-panel caption { padding: 12px 14px; caption-side: bottom; color: var(--rr-muted); font-size: 13px; }
.table-panel .num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-note { display: block; margin-top: 3px; color: var(--rr-muted); font-size: 12px; }
.cell-error { display: block; margin-top: 3px; color: #8f1f2d; font-size: 12px; overflow-wrap: anywhere; }

/* About */
.prose { font-size: 16px; line-height: 1.7; }
.prose h2 { margin: 34px 0 10px; font-size: 22px; font-weight: 700; letter-spacing: -.5px; }
.prose p, .prose ul { margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.key-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(6, auto); grid-auto-flow: column; gap: 10px 24px; margin: 6px 0 18px; padding: 18px 20px; list-style: none; border: 1px solid var(--rr-border); border-radius: 14px; background: #fff; }
.key-list li { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 15px; line-height: 1.4; }

/* Footer of the secondary pages */
.page-footer { flex: none; border-top: 1px solid var(--rr-border); background: #fff; }
.page-footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 28px; padding: 22px 0; }
.page-footer .rr-brand img { height: 30px; }
.page-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 14px; }
.page-footer nav a { color: var(--rr-muted); text-decoration: none; }
.page-footer nav a:hover { color: var(--rr-ink); text-decoration: underline; }
.page-footer p { flex-basis: 100%; margin: 0; color: var(--rr-muted); font-size: 12px; line-height: 1.6; }

/* Credit footer of the map and the component showcase. The map fills the screen, so there the
   credit is one slim line beneath it (whole-pixel line height, like everything around the map). */
.credit-footer { flex: none; padding: 22px 16px; border-top: 1px solid var(--rr-border); background: #fff; }
.rr-map-body .credit-footer { padding: 4px 16px; }
.rr-map-body .rr-credit { font-size: 12px; line-height: 18px; }
.rr-map-body .rr-credit br { display: none; }

@media (max-width: 900px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .changes-filters { grid-template-columns: 1fr 1fr; }
    .changes-filters .filter-authority { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
    .page { padding: 28px 0 48px; }
    .page-wrap, .page-wrap--narrow { width: calc(100% - 32px); }
    .page-lead { font-size: 16px; }
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
    .key-list { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-flow: row; }
    .change-feed > li { padding: 14px; gap: 12px; }
    .changes-filters { grid-template-columns: minmax(0, 1fr); }
}
