/* Drømmehuset — bright, sunny family dashboard */

:root {
    /* Color palette */
    --bg: #fffaf3;
    --surface: #ffffff;
    --surface-solid: #ffffff;
    --surface-2: #fff3e3;
    --surface-hover: #ffeccf;
    --border: #f1e3d0;
    --border-hover: #e6cfb1;
    --text: #2b2d42;
    --text-dim: #767b95;
    --accent: #ff7a59;
    --accent-2: #ffc93c;
    --accent-hover: #ff6340;
    --accent-gradient: linear-gradient(135deg, #ff7a59, #ffc93c);
    --accent-glow: rgba(255, 122, 89, 0.22);
    --sky: #4cc9f0;
    --mint: #2ec4b6;
    --green: #0f9d58;
    --green-bg: rgba(46, 196, 182, 0.16);
    --yellow: #b7791f;
    --yellow-bg: rgba(255, 201, 60, 0.24);
    --red: #e11d48;
    --red-bg: rgba(225, 29, 72, 0.1);
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 12px 40px rgba(43, 45, 66, 0.12);
    --shadow-card: 0 4px 18px rgba(43, 45, 66, 0.08);

    /* Fonts */
    --font-display: 'Sora', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    background-image:
        radial-gradient(ellipse 80% 50% at 10% 0%, rgba(255, 201, 60, 0.18) 0%, transparent 100%),
        radial-gradient(ellipse 60% 70% at 90% 100%, rgba(76, 201, 240, 0.12) 0%, transparent 100%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    letter-spacing: -0.025em;
    line-height: 1.3;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.1rem;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(43, 45, 66, 0.10);
}
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.78rem; }
.btn-accent {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 15px var(--accent-glow);
}
.btn-accent:hover {
    box-shadow: 0 6px 25px rgba(255, 122, 89, 0.4);
    transform: translateY(-1px);
    filter: brightness(1.1);
}

/* ===== Main ===== */
.main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem;
    animation: pageEnter 0.3s ease both;
}

/* ===== Page Transitions ===== */
.main.enter-from-right { animation: slideFromRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.main.enter-from-left  { animation: slideFromLeft 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.main.enter-from-below { animation: slideFromBelow 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }

.main.exit-next    { animation: slideOutLeft 0.2s ease both; pointer-events: none; }
.main.exit-prev    { animation: slideOutRight 0.2s ease both; pointer-events: none; }
.main.exit-back    { animation: slideOutRight 0.22s cubic-bezier(0.4, 0, 0.2, 1) both; pointer-events: none; }
.main.exit-forward { animation: fadeOutUp 0.18s ease both; pointer-events: none; }

@keyframes pageEnter {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideFromRight {
    from { opacity: 0; transform: translateX(50px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideFromLeft {
    from { opacity: 0; transform: translateX(-50px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideFromBelow {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideOutLeft {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(-50px); }
}
@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(50px); }
}
@keyframes fadeOutDown {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(15px); }
}
@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-15px); }
}

/* ===== Map Section ===== */
.map-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-card);
    animation: fadeInUp 0.3s ease both;
}
#viewingsMap {
    width: 100%;
    height: 260px;
    border-radius: var(--radius-lg);
}
.map-marker-custom {
    background: transparent !important;
    border: none !important;
}
/* Dark popup styling */
.dark-popup .leaflet-popup-content-wrapper {
    background: var(--surface-solid);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(43, 45, 66, 0.17);
}
.dark-popup .leaflet-popup-tip {
    background: var(--surface-solid);
    border: 1px solid var(--border);
}
.dark-popup .leaflet-popup-content {
    margin: 10px 14px;
}
.dark-tooltip {
    background: var(--surface-solid) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    font-family: var(--font-body) !important;
    font-size: 0.75rem !important;
    box-shadow: 0 4px 15px rgba(43, 45, 66, 0.14) !important;
}
.dark-tooltip::before {
    border-top-color: var(--surface-solid) !important;
}
.dark-popup a:hover {
    text-decoration: underline !important;
}
.leaflet-control-zoom a {
    background: var(--surface-solid) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.leaflet-control-zoom a:hover {
    background: var(--surface-hover) !important;
}

/* ===== Glass Panels ===== */
.calendar-section, .listings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
}
.calendar-section h2, .listings-section h2 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--text-dim);
    font-weight: 600;
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    display: flex;
    flex-direction: column;
    min-width: 105px;
    transition: border-color 0.2s;
}
.stat:hover { border-color: var(--border-hover); }
.stat-num {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
}
.stat-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    margin-top: 0.1rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.stat-completed { color: var(--green); }
.stat-running { color: var(--yellow); }
.stat-failed { color: var(--red); }

/* ===== FullCalendar Overrides ===== */
#calendar {
    --fc-border-color: var(--border);
    --fc-page-bg-color: transparent;
    --fc-neutral-bg-color: var(--surface-2);
    --fc-today-bg-color: rgba(255, 122, 89, 0.06);
    --fc-event-text-color: #fff;
}
.fc .fc-toolbar-title {
    font-family: var(--font-display) !important;
    font-size: 1.1rem !important;
    font-weight: 600 !important;
    color: var(--text);
    letter-spacing: -0.02em;
}
.fc .fc-button {
    background: var(--surface-2) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
    font-family: var(--font-body) !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    transition: all 0.15s ease !important;
    border-radius: 8px !important;
}
.fc .fc-button:hover {
    background: var(--surface-hover) !important;
    border-color: var(--border-hover) !important;
}
.fc .fc-button-active {
    background: var(--accent-gradient) !important;
    border-color: transparent !important;
    box-shadow: 0 2px 10px var(--accent-glow) !important;
}
.fc .fc-button-group { gap: 4px; }
.fc .fc-button-group > .fc-button { border-radius: 8px !important; margin-left: 0 !important; }
.fc .fc-toolbar.fc-header-toolbar { gap: 8px; flex-wrap: wrap; }
.fc .fc-col-header-cell {
    color: var(--text-dim);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.fc .fc-daygrid-day-number {
    color: var(--text-dim);
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 400;
}
.fc .fc-day-today .fc-daygrid-day-number {
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 15px var(--accent-glow);
}
.fc .fc-daygrid-day {
    cursor: pointer;
    transition: background 0.2s ease;
}
.fc .fc-daygrid-day:hover { background: rgba(255, 122, 89, 0.04); }
.fc .fc-daygrid-day.day-selected { background: rgba(255, 122, 89, 0.1); }

/* Calendar events */
.fc .fc-event {
    border-radius: 4px;
    padding: 2px 5px;
    cursor: pointer;
    border: none;
    margin-bottom: 1px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.fc .fc-event:hover {
    transform: scale(1.03);
    box-shadow: 0 2px 8px rgba(43, 45, 66, 0.12);
}
.fc .fc-daygrid-event-dot { display: none; }
.fc .fc-daygrid-event { white-space: nowrap; overflow: hidden; }
.fc .fc-daygrid-day-events { padding: 0 3px; }
.fc .fc-daygrid-more-link {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

/* Event content */
.ev-new { font-size: 0.55rem; font-weight: 700; background: var(--accent); color: #fff; padding: 0 3px; border-radius: 2px; margin-right: 2px; vertical-align: 1px; letter-spacing: 0.03em; }
.ev-time { font-size: 0.68rem; font-weight: 600; opacity: 0.9; margin-right: 3px; }
.ev-street { font-size: 0.63rem; font-weight: 400; opacity: 0.85; }

/* Week view */
.fc .fc-timegrid-event { border-radius: 4px; border: none; }
.fc .fc-timegrid-event .ev-time { font-size: 0.65rem; }
.fc .fc-timegrid-event .ev-street { font-size: 0.6rem; }
.fc .fc-timegrid-slot { height: 2.2em; }
.fc .fc-timegrid-axis,
.fc .fc-timegrid-slot-label { font-size: 0.7rem; color: var(--text-dim); }

/* ===== Day Header & Nav ===== */
.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.day-header h2 {
    font-size: 1rem;
    font-weight: 600;
}
.day-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.day-nav { display: flex; gap: 0.35rem; }
.day-actions { display: flex; gap: 0.5rem; }

.empty-state-inline {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-dim);
}

/* Day listing items with checkbox */
.day-item {
    margin-bottom: 0.6rem;
}
.day-item .card { margin-bottom: 0; }
.day-item .card-img-wrap { position: relative; }
.card-img-inner { width: 100%; height: 100%; position: relative; }
.card-img-inner img { width: 100%; height: 100%; object-fit: cover; }
.viewing-check {
    position: absolute;
    bottom: 4px;
    left: 4px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    z-index: 2;
    opacity: 0.7;
    transition: opacity 0.15s;
    margin: 0;
}
.viewing-check:checked { opacity: 1; }
.viewing-check:hover { opacity: 1; }
.day-item:has(.viewing-check:not(:checked)) .card {
    opacity: 0.45;
}

/* No-PDF indicator */
.card.no-pdf .card-summary h3,
.card.no-pdf .card-summary .card-address,
.card.no-pdf .card-summary-text {
    font-style: italic;
}
.badge-no-pdf {
    font-size: 0.6rem;
    font-style: normal;
    background: rgba(251, 191, 36, 0.15);
    color: var(--yellow);
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
}
.badge-new {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
    z-index: 2;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 122, 89, 0.4);
}

/* Magnifier overlay on photos to open the gallery */
.img-zoom-overlay {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border-radius: 999px;
    background: rgba(15, 17, 21, 0.78);
    color: #f5f7fb;
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    cursor: pointer;
    z-index: 3;
    transition: transform 0.15s ease, background 0.15s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.img-zoom-overlay:hover { transform: scale(1.08); background: rgba(255, 122, 89, 0.85); }
.img-zoom-overlay svg { display: block; }
.img-zoom-count { font-size: 0.72rem; font-weight: 600; }
.card-img-zoom { bottom: 4px; right: 4px; padding: 3px 5px; gap: 2px; }
.card-img-zoom svg { width: 12px; height: 12px; }
.card-img-zoom .img-zoom-count { font-size: 0.6rem; }

/* Detail-page main image button wrapper (transparent shell around <img>) */
.detail-img-btn {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}
.detail-img-btn .detail-img { display: block; width: 100%; height: auto; border-radius: 16px; }
.detail-img-btn:hover .img-zoom-overlay { transform: scale(1.08); background: rgba(255, 122, 89, 0.85); }

/* ===== Gallery modal (Swiper coverflow) ===== */
.gallery-modal {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(6, 8, 12, 0.96);
    display: flex; align-items: center; justify-content: center;
    animation: galleryFadeIn 0.2s ease;
}
.gallery-modal[hidden] { display: none; }
@keyframes galleryFadeIn { from { opacity: 0; } to { opacity: 1; } }

.gallery-close {
    position: absolute; top: 16px; right: 20px; z-index: 10001;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(255, 255, 255, 0.08); color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 1.6rem; line-height: 1; cursor: pointer;
    backdrop-filter: blur(8px);
    transition: background 0.15s ease, transform 0.15s ease;
}
.gallery-close:hover { background: rgba(239, 68, 68, 0.8); transform: scale(1.06); }

.gallery-progress {
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: rgba(255, 255, 255, 0.05); z-index: 10001;
    opacity: 1; transition: opacity 0.4s ease;
}
.gallery-progress-bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #ff7a59, #a78bfa);
    transition: width 0.25s ease;
    box-shadow: 0 0 12px rgba(255, 122, 89, 0.6);
}

.gallery-swiper { width: 100%; height: 100%; padding: 60px 0; }
.gallery-swiper .swiper-slide {
    width: 72%;
    max-width: 1200px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
}
.gallery-swiper .swiper-slide img {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    border-radius: 14px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    display: block;
    cursor: zoom-in;
    transition: filter 0.2s ease;
}
.gallery-swiper .swiper-slide:not(.swiper-slide-active) img { cursor: pointer; }
.gallery-swiper .swiper-zoom-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80vh;
    background: transparent;
}
/* Snappy zoom in/out. Swiper applies scale() on the inner image inline,
   so override the transition on every element it might land on. */
.gallery-swiper .swiper-zoom-container,
.gallery-swiper .swiper-zoom-container > img,
.gallery-swiper .swiper-zoom-target {
    transition: transform 0.25s cubic-bezier(0.2, 0, 0.1, 1) !important;
    will-change: transform;
}
/* When Swiper sets the zoomed state, swap cursor to grab/zoom-out */
.gallery-swiper .swiper-slide-zoomed img { cursor: zoom-out; cursor: grab; }
.gallery-swiper .swiper-slide-zoomed img:active { cursor: grabbing; }
/* Coverflow draws slide-shadow-left/right divs sized to the slide box,
   which appear landscape behind portrait photos. We disable them in JS
   too, but hide here as a belt-and-braces guard. */
.gallery-swiper .swiper-slide-shadow-left,
.gallery-swiper .swiper-slide-shadow-right,
.gallery-swiper .swiper-slide-shadow-top,
.gallery-swiper .swiper-slide-shadow-bottom { display: none !important; }

.gallery-swiper .swiper-button-prev,
.gallery-swiper .swiper-button-next {
    color: #fff;
    background: rgba(15, 17, 21, 0.6);
    width: 52px; height: 52px; border-radius: 50%;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.15s ease, transform 0.15s ease;
}
.gallery-swiper .swiper-button-prev:hover,
.gallery-swiper .swiper-button-next:hover { background: rgba(255, 122, 89, 0.7); transform: scale(1.06); }
.gallery-swiper .swiper-button-prev:after,
.gallery-swiper .swiper-button-next:after { font-size: 1.2rem; font-weight: 700; }

.gallery-swiper .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.4);
    opacity: 1;
}
.gallery-swiper .swiper-pagination-bullet-active {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.gallery-counter {
    position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
    z-index: 10001;
    padding: 6px 14px; border-radius: 999px;
    background: rgba(15, 17, 21, 0.75); color: #f5f7fb;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--font-display);
    font-size: 0.78rem; font-weight: 500; letter-spacing: 0.04em;
    backdrop-filter: blur(8px);
}

@media (max-width: 720px) {
    .gallery-swiper .swiper-slide { width: 90%; }
    .gallery-swiper .swiper-button-prev,
    .gallery-swiper .swiper-button-next { width: 40px; height: 40px; }
}

/* Inactive listing (no longer on Finn) — shown with strikethrough */
.card.inactive .card-summary h3,
.card.inactive .card-summary .card-address,
.card.inactive .card-summary-text,
.card.inactive .card-meta,
.card.inactive .card-badges {
    text-decoration: line-through;
    text-decoration-thickness: 1px;
    text-decoration-color: rgba(232, 235, 244, 0.55);
}
.card.inactive {
    opacity: 0.6;
}
.card.inactive .badge-inactive { text-decoration: none; }
.card.inactive .card-img-wrap img { filter: grayscale(0.7); }
.badge-inactive {
    font-size: 0.6rem;
    font-style: normal;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-dim);
    padding: 1px 5px;
    border-radius: 3px;
    vertical-align: middle;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* FullCalendar event for inactive listing */
.fc-event.ev-inactive { opacity: 0.55 !important; }
.fc-event.ev-inactive .ev-street,
.fc-event.ev-inactive .ev-time { text-decoration: line-through; }

/* ===== Listing Cards ===== */
.listing-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 70vh;
    overflow-y: auto;
}
.card {
    display: block;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.25s ease;
    margin-bottom: 0.6rem;
    animation: fadeInUp 0.3s ease both;
}
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.06s; }
.card:nth-child(4) { animation-delay: 0.08s; }
.card:nth-child(5) { animation-delay: 0.10s; }
.card:nth-child(6) { animation-delay: 0.12s; }

a.card, a.card:visited, a.card:hover, a.card:active { text-decoration: none; color: var(--text); }
a.card h3 { color: var(--text); }
a.card .card-summary-text { color: var(--text-dim); }
a.card .card-address { color: var(--accent); }
.card:hover {
    border-color: rgba(255, 122, 89, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(43, 45, 66, 0.10), 0 0 0 1px rgba(255, 122, 89, 0.1);
}

.card-header {
    display: flex;
    gap: 0.85rem;
    padding: 0.85rem;
    cursor: pointer;
}
.card-img-wrap {
    width: 84px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface);
}
.card-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    color: var(--text-dim);
}

.card-summary { flex: 1; min-width: 0; }
.card-summary h3 {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-address {
    font-size: 0.78rem;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    display: block;
}
a.card-address:hover { color: var(--accent-hover); text-decoration: underline; }
.card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.25rem;
}
.card-meta .price { font-weight: 600; }
.card-badges { display: flex; gap: 0.35rem; margin-top: 0.35rem; flex-wrap: wrap; }

/* ===== Badges ===== */
.badge {
    font-family: var(--font-body);
    font-size: 0.64rem;
    font-weight: 500;
    padding: 0.18rem 0.55rem;
    border-radius: 99px;
    background: var(--surface);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.score-good {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15), rgba(34, 197, 94, 0.08));
    color: var(--green);
    border-color: rgba(52, 211, 153, 0.2);
}
.score-mid {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(234, 179, 8, 0.08));
    color: var(--yellow);
    border-color: rgba(251, 191, 36, 0.2);
}
.score-low {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.15), rgba(249, 115, 22, 0.08));
    color: #fb923c;
    border-color: rgba(249, 115, 22, 0.2);
}
.score-bad {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.15), rgba(239, 68, 68, 0.08));
    color: var(--red);
    border-color: rgba(248, 113, 113, 0.2);
}
.badge-viewing {
    background: linear-gradient(135deg, rgba(255, 122, 89, 0.15), rgba(76, 201, 240, 0.08));
    color: var(--accent);
    border-color: rgba(255, 122, 89, 0.2);
}

.budget-ok { color: var(--green); }
.budget-over { color: var(--red); }

/* ===== Card Body (expandable) ===== */
.card-body {
    display: none;
    padding: 0 0.85rem 0.85rem;
    border-top: 1px solid var(--border);
}
.card.expanded .card-body { display: block; }

.analysis-summary { font-size: 0.85rem; margin: 0.75rem 0; line-height: 1.7; }
.analysis-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 0.75rem 0;
}
.pros h3, .pros h4 { color: var(--green); font-size: 0.82rem; margin-bottom: 0.35rem; }
.cons h3, .cons h4 { color: var(--red); font-size: 0.82rem; margin-bottom: 0.35rem; }
.pros ul, .cons ul { list-style: none; font-size: 0.82rem; }
.pros li { padding: 0.15rem 0; }
.cons li { padding: 0.15rem 0; }
.pros li::before { content: "+ "; color: var(--green); font-weight: 700; }
.cons li::before { content: "- "; color: var(--red); font-weight: 700; }

.analysis-section { margin: 0.85rem 0; }
.analysis-section h3, .analysis-section h4 {
    font-size: 0.82rem;
    color: var(--accent);
    margin-bottom: 0.3rem;
}
.analysis-section p { font-size: 0.82rem; color: var(--text-dim); line-height: 1.7; }
.analysis-section ul { list-style: none; padding: 0; margin: 0; font-size: 0.82rem; }
.analysis-section ul li { padding: 0.3rem 0; color: var(--text-dim); line-height: 1.6; border-bottom: 1px solid var(--border); }
.analysis-section ul li:last-child { border-bottom: none; }
.analysis-section ul li::before { content: "\25B6  "; color: var(--accent); font-size: 0.6rem; }

.no-analysis { font-size: 0.82rem; color: var(--text-dim); padding: 0.75rem 0; }

.recommendation-banner {
    background: linear-gradient(135deg, rgba(255, 122, 89, 0.06), rgba(76, 201, 240, 0.03));
    border: 1px solid rgba(255, 122, 89, 0.15);
    border-radius: var(--radius);
    padding: 0.85rem 1.1rem;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
}
.recommendation-banner strong { color: var(--accent); }

.key-findings-list { list-style: none; font-size: 0.85rem; }
.key-findings-list li { padding: 0.3rem 0; border-bottom: 1px solid var(--border); }
.key-findings-list li::before { content: "\25B6  "; color: var(--accent); font-size: 0.65rem; }

/* ===== Filter Bar ===== */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.filter-bar select {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem 0.5rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
}
.filter-check {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

/* ===== Detail Page ===== */
.detail-page { max-width: 920px; margin: 0 auto; }

.detail-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.back-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.15s;
}
.back-link:hover { color: var(--text); }
.detail-nav { display: flex; gap: 0.4rem; }

.detail-header {
    display: flex;
    gap: 1.75rem;
    margin-bottom: 2rem;
}
.detail-media {
    width: 400px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.detail-img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}
.detail-map,
#detailMap {
    width: 100%;
    height: 220px !important;
    min-height: 220px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.detail-info h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.detail-address {
    color: var(--text-dim);
    margin-bottom: 1rem;
    text-decoration: none;
}

.detail-key-facts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.fact {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.55rem 0.85rem;
    transition: border-color 0.2s;
}
.fact:hover { border-color: var(--border-hover); }
.fact-label {
    display: block;
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.fact-value {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
}

.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.detail-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-card);
    animation: fadeInUp 0.4s ease both;
}
.detail-section:nth-of-type(1) { animation-delay: 0.05s; }
.detail-section:nth-of-type(2) { animation-delay: 0.1s; }
.detail-section:nth-of-type(3) { animation-delay: 0.15s; }
.detail-section:nth-of-type(4) { animation-delay: 0.2s; }
.detail-section:nth-of-type(5) { animation-delay: 0.25s; }

.detail-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.viewings-list { display: flex; flex-direction: column; gap: 0.5rem; }
.viewing-item {
    display: flex;
    gap: 1rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    font-size: 0.85rem;
    border: 1px solid var(--border);
}
.viewing-date { font-weight: 600; font-family: var(--font-display); }
.viewing-time { color: var(--text-dim); }

.tg-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.tg-table th {
    text-align: left;
    color: var(--text-dim);
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.tg-table td {
    padding: 0.55rem 0.6rem;
    border-bottom: 1px solid var(--border);
}
.tg-table td:first-child { font-weight: 600; color: var(--text); }
.tg-table td:last-child { color: var(--text-dim); }
.tg-table tr.tg-warning td:last-child { color: var(--red); }

.analysis-meta {
    display: flex;
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border);
    font-size: 0.68rem;
    color: var(--text-dim);
    opacity: 0.7;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ===== System Details ===== */
.system-details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 0.75rem;
}
.system-details summary {
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-dim);
    user-select: none;
    font-weight: 500;
}
.system-details summary:hover { color: var(--text); }
.system-details[open] summary { border-bottom: 1px solid var(--border); }
.system-details-content { padding: 0.85rem 1rem; }
.system-run-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}
.system-run-info strong { color: var(--text); }

/* ===== Card Summary Text ===== */
.card-summary-text {
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 0.35rem;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ===== Today Header ===== */
.today-header { margin-bottom: 1.5rem; }
.today-header h1 { font-size: 1.5rem; font-weight: 700; }
.today-date { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.15rem; }

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-top: 1.5rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.empty-state h2 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.empty-state p {
    color: var(--text-dim);
    font-size: 0.9rem;
    max-width: 500px;
    margin: 0 auto 0.75rem;
}
.empty-hint { margin-top: 1.5rem !important; }
.empty-state .btn { margin-top: 0.5rem; }
.empty-meta {
    margin-top: 1.5rem !important;
    font-size: 0.75rem !important;
    color: var(--text-dim);
}

/* ===== Report Page ===== */
.report-page { max-width: 800px; }
.report-page h1 { font-size: 1.3rem; margin-bottom: 1rem; }
.report-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.report-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-dim);
}
.report-status {
    font-weight: 700;
    font-size: 0.78rem;
    padding: 0.2rem 0.7rem;
    border-radius: 99px;
}
.status-completed { background: var(--green-bg); color: var(--green); }
.status-running { background: var(--yellow-bg); color: var(--yellow); }
.status-failed { background: var(--red-bg); color: var(--red); }
.report-stats { display: flex; gap: 2rem; }
.report-stat { text-align: center; }
.report-stat-num {
    display: block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
}
.report-stat span { font-size: 0.75rem; color: var(--text-dim); }
.report-error {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--red-bg);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--red);
}

/* ===== Animations ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
    .detail-header { flex-direction: column; }
    .detail-media { width: 100%; }
    .detail-img { width: 100%; height: 200px; }
    .analysis-cols { grid-template-columns: 1fr; }
    .stats-bar { gap: 0.5rem; }
    .stat { min-width: 90px; padding: 0.5rem 0.75rem; }
    .stat-num { font-size: 1.2rem; }
    .main { padding: 1rem; }
    .detail-top-bar { flex-wrap: wrap; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(43, 45, 66, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(43, 45, 66, 0.15); }

/* ===== Analysis Tabs ===== */
.analysis-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border);
}
.analysis-tab {
    padding: 0.65rem 1.4rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.analysis-tab:hover { color: var(--text); }
.analysis-tab-disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }
.analysis-tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}
.badge-sm { font-size: 0.65rem; padding: 1px 5px; }
.badge-processing { background: var(--surface-2); color: var(--text-dim); animation: pulse-badge 1.5s ease-in-out infinite; }
@keyframes pulse-badge { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

.tab-panel { display: none; }
.tab-panel.active { display: block; padding-top: 0.5rem; }

/* ===== Deep Analysis ===== */
.deep-analysis-section { border-top: 2px solid var(--accent); }

.btn-deep {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    color: #fff;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}
.btn-deep:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3); }
.btn-deep:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-deep-requested { background: var(--surface-2); }

.deep-request-box { text-align: center; padding: 2.5rem 1rem; }
.deep-request-icon { color: var(--text-dim); margin-bottom: 1rem; opacity: 0.5; }
.deep-request-box h3 { font-size: 1.05rem; margin-bottom: 0.6rem; font-weight: 600; }
.deep-request-desc { color: var(--text-dim); font-size: 0.85rem; max-width: 480px; margin: 0 auto 1.25rem; line-height: 1.5; }
.deep-request-hint { color: var(--text-dim); font-size: 0.72rem; margin-top: 0.75rem; }
.deep-request-no-pdf { color: var(--yellow); font-style: italic; }

.deep-status-processing { text-align: center; padding: 2.5rem 0; }
.deep-status-processing p { color: var(--muted); margin: 0.5rem 0; }
.deep-status-sub { font-size: 0.75rem; }
.deep-spinner {
    width: 32px; height: 32px; margin: 0 auto 1rem;
    border: 3px solid rgba(43, 45, 66, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tg-deep-cards { display: grid; gap: 0.75rem; }
.tg-deep-card {
    background: rgba(43, 45, 66, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
}
.tg-deep-warn { border-left: 3px solid #f59e0b; }
.tg-deep-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.tg-deep-rating { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; background: rgba(43, 45, 66, 0.06); }
.tg-deep-meta { display: flex; gap: 1.2rem; font-size: 0.8rem; color: var(--muted); margin: 0.4rem 0; flex-wrap: wrap; }
.tg-deep-livability, .tg-deep-viewing { font-size: 0.82rem; margin: 0.3rem 0 0; color: var(--muted); }

/* Keep h2.fc-toolbar-title inline so the Explore button sits beside it,
   not below it. (Default <h2> is display:block, which wraps the next item.) */
.fc .fc-toolbar-title {
    display: inline-block !important;
    vertical-align: middle;
    margin-right: 0.6rem;
}
.fc .fc-explore-button { vertical-align: middle; }
/* Explore button living in FullCalendar's header next to the month title */
.fc .fc-explore-button {
    background: var(--accent-gradient) !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 10px var(--accent-glow) !important;
    border-radius: 8px !important;
    margin: 0 !important;
}
.fc .fc-explore-button:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* ===== Explore mode ===== */
.explore-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: calc(100vh - 2rem);
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}
.explore-top-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.explore-top-bar h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}
.explore-top-right { margin-left: auto; }
.explore-day-label {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--text-dim);
    padding: 4px 12px;
    border-radius: 999px;
    background: rgba(43, 45, 66, 0.04);
    border: 1px solid var(--border);
}

/* Day strip */
.explore-strip-section {
    flex-shrink: 0;
}
.explore-strip {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem 0.25rem;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
}
.explore-strip::-webkit-scrollbar { height: 8px; }
.explore-strip::-webkit-scrollbar-thumb { background: rgba(43, 45, 66, 0.15); border-radius: 4px; }
.explore-strip-day {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: var(--font-body);
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    scroll-snap-align: start;
}
.explore-strip-day:hover {
    transform: translateY(-2px);
    border-color: var(--border-hover);
    background: var(--surface-hover);
}
.explore-strip-day.selected {
    border-color: var(--accent);
    background: rgba(255, 122, 89, 0.08);
    box-shadow: 0 0 0 1px var(--accent), 0 6px 18px rgba(255, 122, 89, 0.18);
}
.explore-strip-day.past { opacity: 0.55; }
.explore-strip-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}
.explore-strip-weekday {
    font-family: var(--font-display);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}
.explore-strip-monthday {
    font-size: 0.95rem;
    font-weight: 600;
}
.explore-strip-thumbs {
    display: flex;
    gap: 3px;
    align-items: center;
    margin-bottom: 0.5rem;
}
.explore-strip-thumb {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    object-fit: cover;
    background: var(--surface-2);
    display: inline-block;
}
.explore-strip-thumb-inactive { filter: grayscale(0.7); opacity: 0.55; }
.explore-strip-thumb-empty { background: rgba(43, 45, 66, 0.04); border: 1px dashed var(--border); }
.explore-strip-more {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-left: 3px;
}
.explore-strip-count {
    font-size: 0.72rem;
    color: var(--text-dim);
}

/* Map */
.explore-map-section {
    flex: 1;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    min-height: 400px;
}
.explore-map {
    /* MapLibre forces position: relative on this element, so absolute+inset
       would collapse it to 0 height. Use width/height 100% on the parent
       instead. The parent (.explore-map-section) gives us the dimensions. */
    width: 100%;
    height: 100%;
}
.explore-map-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-weight: 600;
    background: rgba(255, 250, 243, 0.7);
    z-index: 2;
}
/* `display: flex/inline-flex` above wins over the UA [hidden] rule.
   Restore it explicitly so JS toggling .hidden actually hides the overlays. */
.explore-map-loading[hidden],
.explore-map-empty[hidden] { display: none !important; }
.explore-map-loading {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 4px 14px rgba(43, 45, 66, 0.25);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    box-shadow: 0 6px 20px rgba(43, 45, 66, 0.12);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.explore-map-loading::before {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    border-right-color: transparent;
    animation: explore-spin 0.8s linear infinite;
}
@keyframes explore-spin {
    to { transform: rotate(360deg); }
}

/* Billboards + pin (always visible, perspective-scaled via --marker-scale).
   Two-layer transform: outer = perspective scale, inner = entry bounce so the
   two transforms compose multiplicatively without fighting each other. */
.explore-marker {
    cursor: pointer;
    transform-origin: 50% 100%;
    transform: scale(var(--marker-scale, 1));
    transition: filter 0.12s ease;
    will-change: transform;
}
.explore-marker:hover { filter: drop-shadow(0 0 6px rgba(255, 122, 89, 0.7)); z-index: 5; }
.explore-marker-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    transform-origin: 50% 100%;
    animation: explore-marker-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes explore-marker-pop {
    0%   { opacity: 0; transform: scale(0)    translateY(14px); }
    60%  { opacity: 1; transform: scale(1.15) translateY(0); }
    100% { opacity: 1; transform: scale(1)    translateY(0); }
}
.explore-marker-card {
    /* Solid background — no backdrop-filter blur here; that was the single
       biggest GPU cost with many markers redrawing during map pan/zoom. */
    background: #fff;
    border: 1px solid rgba(43, 45, 66, 0.14);
    border-radius: 8px;
    padding: 3px 7px 3px 3px;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(43, 45, 66, 0.3);
    margin-bottom: 5px;
    white-space: nowrap;
    color: var(--text);
    line-height: 1.15;
}
.explore-marker-thumb {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    background: var(--surface-2);
}
.explore-marker-meta {
    display: flex;
    flex-direction: column;
    font-family: var(--font-display);
    font-size: 0.66rem;
}
.explore-marker-price { font-weight: 700; }
.explore-marker-score { font-weight: 600; font-size: 0.6rem; }
.explore-marker-pin {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.65), 0 0 10px currentColor;
    position: relative;
}
/* Tiny stem connecting card to pin */
.explore-marker-pin::before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    width: 1px;
    height: 3px;
    background: rgba(255, 255, 255, 0.45);
}
.explore-marker-inactive .explore-marker-card { opacity: 0.55; filter: grayscale(0.6); }
.explore-marker-inactive .explore-marker-pin { opacity: 0.65; border-color: rgba(255,255,255,0.5); }

/* Popup */
.maplibregl-popup.explore-popup .maplibregl-popup-content {
    background: #fff;
    color: var(--text);
    border-radius: 14px;
    padding: 0;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(43, 45, 66, 0.35);
    overflow: hidden;
    min-width: 280px;
    /* Grow-from-marker entrance: scale up from the side facing the marker
       with a small overshoot. Origin is set per anchor below. */
    animation: explore-popup-grow 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    transform-origin: 50% 100%;
}
.maplibregl-popup.explore-popup .maplibregl-popup-tip {
    /* The tip is a separate triangle; fade it in so it doesn't pop. */
    animation: explore-popup-tip 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
/* Match transform-origin to the popup's anchor so the growth radiates
   from the marker, regardless of which side the popup opens to. */
.maplibregl-popup-anchor-top.explore-popup    .maplibregl-popup-content { transform-origin: 50% 0%; }
.maplibregl-popup-anchor-bottom.explore-popup .maplibregl-popup-content { transform-origin: 50% 100%; }
.maplibregl-popup-anchor-left.explore-popup   .maplibregl-popup-content { transform-origin: 0% 50%; }
.maplibregl-popup-anchor-right.explore-popup  .maplibregl-popup-content { transform-origin: 100% 50%; }
.maplibregl-popup-anchor-top-left.explore-popup     .maplibregl-popup-content { transform-origin: 0% 0%; }
.maplibregl-popup-anchor-top-right.explore-popup    .maplibregl-popup-content { transform-origin: 100% 0%; }
.maplibregl-popup-anchor-bottom-left.explore-popup  .maplibregl-popup-content { transform-origin: 0% 100%; }
.maplibregl-popup-anchor-bottom-right.explore-popup .maplibregl-popup-content { transform-origin: 100% 100%; }
@keyframes explore-popup-grow {
    0%   { opacity: 0; transform: scale(0.05); }
    55%  { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes explore-popup-tip {
    0%, 30% { opacity: 0; }
    100%    { opacity: 1; }
}
.maplibregl-popup.explore-popup .maplibregl-popup-tip {
    border-top-color: #fff;
    border-bottom-color: #fff;
}
.maplibregl-popup.explore-popup .maplibregl-popup-close-button {
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    color: var(--text);
    font-size: 1.5rem;
    line-height: 34px;
    box-shadow: 0 2px 10px rgba(43, 45, 66, 0.4);
    z-index: 4;
}
.maplibregl-popup.explore-popup .maplibregl-popup-close-button:hover { background: var(--accent); color: #fff; }
.explore-pop {
    display: flex;
    flex-direction: column;
}
.explore-pop-photo-wrap {
    position: relative;
    width: 100%;
    background: var(--surface-2);
}
.explore-pop-photo {
    position: relative;
    padding: 0; border: 0; background: transparent;
    cursor: pointer;
    aspect-ratio: 16/10;
    overflow: hidden;
    width: 100%;
    display: block;
}
.explore-pop-img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.3s ease, opacity 0.18s ease;
}
.explore-pop-photo:hover .explore-pop-img { transform: scale(1.04); }

/* Prev/Next photo nav buttons overlaid on the popup hero image */
.explore-pop-photo-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(15, 17, 21, 0.75);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 1.25rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.explore-pop-photo-wrap:hover .explore-pop-photo-nav { opacity: 1; }
.explore-pop-photo-nav:hover { background: rgba(255, 122, 89, 0.85); }
.explore-pop-photo-prev { left: 8px; }
.explore-pop-photo-next { right: 8px; }
.explore-pop-photo-counter {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 3;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(15, 17, 21, 0.78);
    color: #f5f7fb;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-display);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.03em;
}
.explore-pop-body { padding: 0.75rem 0.85rem 0.9rem; }
.explore-pop-title {
    font-size: 0.92rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.explore-pop-address {
    font-size: 0.78rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}
.explore-pop-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.7rem;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}
.explore-pop-price { color: var(--text); font-weight: 600; }
.explore-pop-score { font-weight: 600; }
.explore-pop-viewing {
    color: var(--text);
    background: rgba(255, 122, 89, 0.12);
    padding: 1px 6px;
    border-radius: 4px;
}
.explore-pop-summary {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.4;
    margin-bottom: 0.65rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.explore-pop-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.explore-pop-actions .btn-sm {
    padding: 4px 10px;
    font-size: 0.74rem;
}

/* MapLibre controls: dark theme tweaks */
.maplibregl-ctrl-group {
    background: rgba(255, 255, 255, 0.95) !important;
}
.maplibregl-ctrl-attrib {
    background: rgba(255, 255, 255, 0.8) !important;
    color: var(--text-dim);
}
.maplibregl-ctrl-attrib a { color: var(--accent); }

/* ===== Site header ===== */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; max-width: 1400px; margin: 0 auto; padding: 1rem 1.5rem 0.25rem; }
.site-brand { display: flex; flex-direction: column; text-decoration: none; color: var(--text); }
.site-title { font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.02em; }
.site-couple { font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.site-nav { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.site-nav a { padding: 0.4rem 0.8rem; border-radius: 999px; color: var(--text-dim); text-decoration: none; font-weight: 600; font-size: 0.85rem; }
.site-nav a:hover, .site-nav a.active { background: var(--surface-2); color: var(--text); }
@media (max-width: 600px) { .site-header { padding: 0.75rem 1rem 0; } .site-title { font-size: 1.15rem; } }

/* ===== Login ===== */
.login-card { max-width: 380px; margin: 12vh auto 0; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); text-align: center; }
.login-card h1 { margin: 0.5rem 0 0.25rem; }
.login-card p { color: var(--text-dim); margin-bottom: 1.25rem; }
.login-card input[type=password] { width: 100%; padding: 0.75rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; background: var(--surface-2); color: var(--text); }
.login-card .btn { width: 100%; justify-content: center; margin-top: 0.75rem; padding: 0.75rem; }
.login-error { color: var(--red); margin-top: 0.75rem; font-weight: 600; }

/* ===== Dream list ===== */
.dream-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: 1rem 0; }
.dream-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0.4rem 0.9rem; border-radius: 999px; font: inherit; font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.chip span { color: var(--text-dim); font-weight: 500; margin-left: 0.2rem; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active span { color: rgba(255, 255, 255, 0.85); }
.dream-sort { font-size: 0.85rem; color: var(--text-dim); display: flex; gap: 0.4rem; align-items: center; }
.dream-sort select { font: inherit; padding: 0.35rem 0.6rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.dream-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1.1rem; }
.dream-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; text-decoration: none; color: var(--text); box-shadow: var(--shadow-card); transition: transform 0.15s ease, box-shadow 0.15s ease; }
.dream-card[hidden] { display: none; }
.dream-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.dream-card-hidden { opacity: 0.55; }
.dream-photo { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.dream-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.dream-kind { position: absolute; left: 0.6rem; top: 0.6rem; background: rgba(255, 255, 255, 0.92); color: var(--text); font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.55rem; border-radius: 999px; }
.dream-score { position: absolute; right: 0.6rem; top: 0.6rem; width: 2.3rem; height: 2.3rem; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; box-shadow: 0 2px 8px rgba(43, 45, 66, 0.25); }
.dream-score.score-good { background: var(--mint); }
.dream-score.score-mid { background: var(--accent-2); color: var(--text); }
.dream-score.score-low { background: var(--accent); }
.dream-body { padding: 0.85rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.dream-body h3 { font-size: 1rem; }
.dream-address { color: var(--text-dim); font-size: 0.82rem; }
.dream-price { font-weight: 700; font-family: var(--font-display); }
.dream-facts { display: flex; flex-wrap: wrap; gap: 0.3rem; font-size: 0.78rem; }
.dream-facts span { background: var(--surface-2); padding: 0.15rem 0.5rem; border-radius: 999px; }
.dream-facts .fit-yes { background: var(--green-bg); }
.dream-facts .fit-warn { background: var(--red-bg); }
.dream-foot { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: auto; padding-top: 0.4rem; font-size: 0.78rem; }
.afford { font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; }
.afford-green { background: var(--green-bg); color: var(--green); }
.afford-amber { background: var(--yellow-bg); color: var(--yellow); }
.afford-red { background: var(--red-bg); color: var(--red); }
.dream-viewing, .dream-pending { color: var(--text-dim); }
.dream-hidden-link { text-align: center; margin: 1.5rem 0; }
.dream-hidden-link a { color: var(--accent); font-weight: 600; }
@media (max-width: 600px) { .dream-grid { grid-template-columns: 1fr; } }

/* ===== Family fit (listing detail) ===== */
.fit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.room-plan { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.room-plan td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border); }
.room-plan td:last-child { font-weight: 600; color: var(--accent); text-align: right; }
.fit-flags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; }
.fit-flag { padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.82rem; background: var(--surface-2); color: var(--text-dim); }
.fit-flag.on { background: var(--green-bg); color: var(--green); font-weight: 600; }
.fit-flag.warn { background: var(--red-bg); color: var(--red); font-weight: 600; }
.fact-help { display: block; margin-top: 0.35rem; font-size: 0.72rem; line-height: 1.35; color: var(--text-dim); font-weight: 400; }

/* ===== Map 'photo' for listings without pictures ===== */
.map-thumb { position: absolute; inset: 0; overflow: hidden; background: #2f3b2f; }
.map-mosaic { position: absolute; left: 50%; top: 50%; width: 768px; height: 768px; display: grid; grid-template-columns: repeat(3, 256px); }
.map-mosaic span { position: relative; width: 256px; height: 256px; }
.dream-photo .map-mosaic img { position: absolute; inset: 0; width: 256px; height: 256px; object-fit: fill; }
.map-pin { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(255, 122, 89, 0.35); }
