/* ============================================================
   martelo-drawer.css — shared drawer styles (single source of truth).
   2026-05-08: regenerated brute-force from explorar.html canonical
   inline drawer CSS to ensure 100% pixel-identical rendering across
   explorar / index / blog / calculadora / landing pages.
   ============================================================ */

/* Keep main navbar above detail-view overlay on desktop */
        @media (min-width: 769px) {
            nav#main-nav { z-index: 10002; }
        }

        /* ===== Detail View — Backdrop + Side Panel ===== */
        .detail-view {
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 10001;
            background: rgba(0, 0, 0, 0);
            backdrop-filter: blur(0px);
            -webkit-backdrop-filter: blur(0px);
            pointer-events: none;
            visibility: hidden;
            transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, visibility 0s linear 0.5s;
        }
        .detail-view.open {
            background: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(6px);
            -webkit-backdrop-filter: blur(6px);
            pointer-events: auto;
            visibility: visible;
            transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, visibility 0s linear 0s;
        }

        /* Panel matches navbar pill width exactly — curtain drop.
           Navbar wrapper #main-nav has padding 20px 40px (desktop) / 12px 16px (mobile),
           so we mirror the same horizontal gutters here for perfect alignment. */
        .dv-panel {
            position: absolute;
            top: 44px;
            left: 40px;
            right: 40px;
            bottom: 80px;
            max-width: 1400px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            background: var(--bg-primary);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 0 0 16px 16px;
            box-shadow: 0 8px 40px rgba(0,0,0,0.35);
            overflow: hidden;
            opacity: 0;
            transform: translateY(-100%);
            transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
        }
        @media (max-width: 768px) {
            .dv-panel {
                left: 16px;
                right: 16px;
            }
        }
        .detail-view.open .dv-panel {
            opacity: 1;
            transform: translateY(0);
        }
        [data-theme="light"] .dv-panel {
            border: 1px solid rgba(0,0,0,0.1);
            box-shadow: 0 8px 40px rgba(0,0,0,0.12);
        }
        [data-theme="light"] .dv-images { background: #e2e8f0; }

        /* Drawer navbar - breadcrumb strip */
        .dv-navbar {
            padding: 10px 10px;
            margin-top: 34px;
            flex-shrink: 0;
            z-index: 10;
            border-bottom: 1px solid rgba(255,255,255,0.06);
        }
        [data-theme="light"] .dv-navbar {
            border-bottom: 1px solid rgba(0,0,0,0.08);
        }
        .dv-navbar .nav-container {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: transparent;
            border: none;
            border-radius: 0;
            max-width: none;
            margin: 0;
            padding: 8px 16px !important;
        }
        [data-theme="light"] .dv-navbar .nav-container {
            background: transparent;
            border: none;
            border-radius: 0;
        }
        .dv-nav-left {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        .dv-breadcrumb-sep {
            color: var(--text-muted);
            opacity: 0.4;
            font-size: 0.9rem;
            font-weight: 300;
            user-select: none;
        }
        .dv-nav-back {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            font-size: 0.8rem;
            font-weight: 500;
            padding: 4px 8px;
            border-radius: 6px;
            transition: all 0.2s;
        }
        .dv-nav-back:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
        [data-theme="light"] .dv-nav-back:hover { background: rgba(0,0,0,0.05); }
        .dv-nav-back svg { width: 14px; height: 14px; }
        .dv-nav-ref {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .dv-ref-badge {
            padding: 3px 8px;
            border-radius: 6px;
            font-size: 0.65rem;
            font-weight: 700;
        }
        .dv-ref-badge.lo { background: rgba(34,197,94,0.15); color: #22c55e; }
        .dv-ref-badge.np { background: rgba(234,179,8,0.15); color: #eab308; }
        .dv-ref-num { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
        .dv-nav-right {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }
        .dv-nav-timer {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 4px 10px;
            border-radius: 6px;
            font-size: 0.72rem;
            font-weight: 600;
        }
        .dv-nav-timer.active { background: rgba(34,197,94,0.1); color: #22c55e; }
        .dv-nav-timer.urgent { background: rgba(239,68,68,0.1); color: #ef4444; }
        .dv-nav-timer.ended { background: rgba(100,116,139,0.1); color: #94a3b8; }
        .dv-nav-timer.open-ended { background: rgba(139,92,246,0.12); color: #a78bfa; }
        .dv-row-value.open-ended { color: #a78bfa; font-weight: 600; }
        .dv-nav-btn {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 5px 12px;
            border: none;
            border-radius: 8px;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            text-decoration: none;
            transition: all 0.2s;
        }
        .dv-nav-btn.primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
        .dv-nav-btn.primary:hover { opacity: 0.85; }
        .dv-nav-btn.secondary {
            color: var(--text-muted);
            background: var(--btn-secondary-bg);
            border: 1px solid var(--btn-secondary-border);
        }
        .dv-nav-btn.secondary:hover { color: var(--text-primary); }
        /* "Ver página" — prominent indigo-tinted to stand out from secondary buttons */
        .dv-nav-btn.page-full {
            background: rgba(99, 102, 241, 0.1);
            color: #6366f1;
            border: 1px solid rgba(99, 102, 241, 0.3);
        }
        .dv-nav-btn.page-full:hover {
            background: rgba(99, 102, 241, 0.18);
            border-color: rgba(99, 102, 241, 0.5);
        }
        [data-theme="dark"] .dv-nav-btn.page-full {
            background: rgba(99, 102, 241, 0.18);
            color: #a5b4fc;
            border-color: rgba(99, 102, 241, 0.4);
        }
        [data-theme="dark"] .dv-nav-btn.page-full:hover {
            background: rgba(99, 102, 241, 0.28);
        }
        .dv-error-msg { color: #ef4444; text-align: center; padding: 20px; }
        .dv-nav-btn svg { width: 14px; height: 14px; }
        .dv-nav-btn.fav-btn svg { transition: all 0.2s; }
        .dv-nav-btn.fav-btn:hover svg { color: #ef4444; }
        .dv-nav-btn.fav-btn.is-fav { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.2); }
        .dv-nav-btn.fav-btn.is-fav svg { fill: #ef4444; stroke: #ef4444; color: #ef4444; }
        .dv-nav-brand {
            display: flex;
            align-items: center;
            gap: 8px;
            text-decoration: none;
            color: var(--text-primary);
            font-weight: 600;
            font-size: 0.9rem;
        }
        .dv-nav-brand img { width: 24px; height: 24px; border-radius: 4px; }

        /* Main content area */
        .dv-main {
            flex: 1;
            display: flex;
            overflow: hidden;
            min-height: 0;
            width: 100%;
            max-width: 100%;
            padding: 0;
        }

        /* Left: Images - scrollable vertical gallery */
        .dv-images {
            width: 50%;
            flex-shrink: 0;
            background: #0f172a;
            position: relative;
            overflow: hidden;
        }
        .dv-img-scroll {
            width: 100%;
            height: 100%;
            display: flex;
            overflow-x: auto;
            overflow-y: hidden;
            scroll-snap-type: x mandatory;
            scroll-behavior: smooth;
            -webkit-overflow-scrolling: touch;
        }
        .dv-img-scroll::-webkit-scrollbar { display: none; }
        .dv-img-scroll { scrollbar-width: none; }
        .dv-img-item {
            min-width: 100%;
            width: 100%;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            scroll-snap-align: start;
            position: relative;
            overflow: hidden;
        }
        .dv-img-bg {
            position: absolute;
            inset: 0;
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            filter: blur(30px) brightness(0.5);
            transform: scale(1.1);
            z-index: 0;
        }
        .dv-img-item img {
            width: 100%;
            height: 100%;
            object-fit: contain;
            display: block;
            position: relative;
            z-index: 1;
        }
        .dv-img-placeholder {
            font-size: 4rem;
            opacity: 0.15;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            min-height: 300px;
            gap: 16px;
            background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(168, 85, 247, 0.06));
            color: var(--text-muted);
        }
        .dv-img-counter {
            position: absolute;
            bottom: 12px;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0,0,0,0.7);
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.7rem;
            font-weight: 500;
            z-index: 5;
        }
        .dv-img-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 38px; height: 38px;
            background: rgba(255,255,255,0.9);
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            z-index: 5;
        }
        .dv-img-nav:hover { background: white; transform: translateY(-50%) scale(1.1); }
        .dv-img-nav.prev { left: 12px; }
        .dv-img-nav.next { right: 12px; }
        .dv-img-nav svg { width: 18px; height: 18px; color: #1e293b; }

        /* Right: Details */
        .dv-details {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 28px 24px;
            border-left: 1px solid var(--border-color);
            min-width: 0;
        }
        /* Header row: type + título + values */
        .dv-header-row {
            display: flex;
            flex-direction: column;
            gap: 16px;
            margin-bottom: 20px;
            min-width: 0;
            overflow: hidden;
        }
        .dv-header-info {
            flex: 1;
            min-width: 0;
            overflow: hidden;
        }
        .dv-type { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
        .dv-título {
            font-size: 0.95rem;
            color: var(--text-dimmed);
            line-height: 1.5;
            margin-bottom: 0;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        /* 2026-05-08: legal-rights warning banner — only renders when an
           imóvel sells a partial/usufruct/superficie interest. Designed
           to grab attention WITHOUT being abrasive. Amber tint = "warning",
           not "error" (the sale itself is legitimate, just needs disclosure). */
        .dv-legal-banner {
            margin-top: 12px;
            padding: 10px 14px;
            background: rgba(245, 158, 11, 0.08);
            border: 1px solid rgba(245, 158, 11, 0.25);
            border-left: 3px solid #f59e0b;
            border-radius: 8px;
        }
        [data-theme="light"] .dv-legal-banner {
            background: rgba(245, 158, 11, 0.06);
            border-color: rgba(245, 158, 11, 0.3);
        }
        .dv-legal-banner-title {
            font-size: 0.72rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            color: #f59e0b;
            margin-bottom: 6px;
        }
        [data-theme="light"] .dv-legal-banner-title { color: #b45309; }
        .dv-legal-banner-badges {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }
        .dv-legal-badge {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.78rem;
            font-weight: 600;
            line-height: 1.3;
            white-space: nowrap;
        }
        .dv-legal-badge-icon {
            font-size: 0.95rem;
            line-height: 1;
            opacity: 0.9;
        }
        .dv-legal-badge.color-amber {
            background: rgba(245, 158, 11, 0.18);
            color: #fbbf24;
            border: 1px solid rgba(245, 158, 11, 0.35);
        }
        .dv-legal-badge.color-blue {
            background: rgba(59, 130, 246, 0.18);
            color: #60a5fa;
            border: 1px solid rgba(59, 130, 246, 0.35);
        }
        .dv-legal-badge.color-purple {
            background: rgba(139, 92, 246, 0.18);
            color: #a78bfa;
            border: 1px solid rgba(139, 92, 246, 0.35);
        }
        .dv-legal-badge.color-gray {
            background: rgba(100, 116, 139, 0.18);
            color: #94a3b8;
            border: 1px solid rgba(100, 116, 139, 0.35);
        }
        .dv-legal-badge.color-green {
            background: rgba(34, 197, 94, 0.18);
            color: #4ade80;
            border: 1px solid rgba(34, 197, 94, 0.35);
        }
        [data-theme="light"] .dv-legal-badge.color-amber { color: #b45309; }
        [data-theme="light"] .dv-legal-badge.color-blue { color: #1e40af; }
        [data-theme="light"] .dv-legal-badge.color-purple { color: #6d28d9; }
        [data-theme="light"] .dv-legal-badge.color-gray { color: #475569; }
        [data-theme="light"] .dv-legal-badge.color-green { color: #166534; }
        .dv-legal-badge.color-red {
            background: rgba(239, 68, 68, 0.18);
            color: #f87171;
            border: 1px solid rgba(239, 68, 68, 0.35);
        }
        .dv-legal-badge.color-teal {
            background: rgba(20, 184, 166, 0.18);
            color: #2dd4bf;
            border: 1px solid rgba(20, 184, 166, 0.35);
        }
        [data-theme="light"] .dv-legal-badge.color-red { color: #b91c1c; }
        [data-theme="light"] .dv-legal-badge.color-teal { color: #0f766e; }

        /* 2026-05-08 b: info pills row (origem-venda + predio + caract + arrendado).
           Renders BELOW the warn banner / title, ABOVE the values block.
           Smaller chips than legal-badges, neutral tone — informational only. */
        .dv-info-pills {
            margin-top: 10px;
            display: flex;
            flex-wrap: wrap;
            gap: 5px;
        }
        .dv-info-pill {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 3px 8px;
            border-radius: 10px;
            font-size: 0.72rem;
            font-weight: 500;
            line-height: 1.3;
            white-space: nowrap;
        }
        .dv-info-pill .dv-legal-badge-icon { font-size: 0.85rem; }
        .dv-info-pill.color-amber  { background: rgba(245,158,11,0.12); color: #fcd34d; border: 1px solid rgba(245,158,11,0.25); }
        .dv-info-pill.color-blue   { background: rgba(59,130,246,0.12); color: #93c5fd; border: 1px solid rgba(59,130,246,0.25); }
        .dv-info-pill.color-purple { background: rgba(139,92,246,0.12); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.25); }
        .dv-info-pill.color-gray   { background: rgba(100,116,139,0.14); color: #cbd5e1; border: 1px solid rgba(100,116,139,0.25); }
        .dv-info-pill.color-green  { background: rgba(34,197,94,0.12); color: #86efac; border: 1px solid rgba(34,197,94,0.25); }
        .dv-info-pill.color-teal   { background: rgba(20,184,166,0.12); color: #5eead4; border: 1px solid rgba(20,184,166,0.25); }
        .dv-info-pill.color-red    { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }
        [data-theme="light"] .dv-info-pill.color-amber  { color: #b45309; background: rgba(245,158,11,0.08); }
        [data-theme="light"] .dv-info-pill.color-blue   { color: #1e40af; background: rgba(59,130,246,0.08); }
        [data-theme="light"] .dv-info-pill.color-purple { color: #6d28d9; background: rgba(139,92,246,0.08); }
        [data-theme="light"] .dv-info-pill.color-gray   { color: #475569; background: rgba(100,116,139,0.08); }
        [data-theme="light"] .dv-info-pill.color-green  { color: #166534; background: rgba(34,197,94,0.08); }
        [data-theme="light"] .dv-info-pill.color-teal   { color: #0f766e; background: rgba(20,184,166,0.08); }
        [data-theme="light"] .dv-info-pill.color-red    { color: #b91c1c; background: rgba(239,68,68,0.08); }

        /* Values - responsive grid */
        .dv-values {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            gap: 8px;
        }
        .dv-val-card {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 10px;
            padding: 12px 16px;
            min-width: 0;
            overflow: hidden;
        }
        .dv-val-card.main {
            background: rgba(34,197,94,0.06);
            border-color: rgba(34,197,94,0.15);
        }
        .dv-val-label {
            font-size: 0.6rem;
            color: var(--text-dimmed);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 3px;
        }
        .dv-val-num {
            font-size: 0.95rem;
            font-weight: 700;
            color: var(--text-primary);
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .dv-val-card.main .dv-val-num { font-size: 1.1rem; color: #22c55e; }
        .dv-val-num.empty { color: var(--text-dimmed); font-weight: 400; }

        /* Sections grid (2026-05-06 redesign): card-style sections in 2 cols.
           Was: flat rows in unwrapped grid that read like a spreadsheet.
           Now: each section a card with subtle border + padding,
           prose sections (descrição/observações/ónus) span full width with
           color-coded warn/danger variants. */
        /* 2026-05-07 Design 1 — DATA SHEET (Idealista-like).
           Sem card chrome, sem sombra. Cada secção é um bloco a fluir:
           header indigo pequeno + factos label/valor inline a wrap-arem
           horizontalmente. Secções separadas por linha hairline.
           Apenas Observações/Ónus mantêm fundo warn/danger para destaque. */
        .dv-columns {
            display: block;
            min-width: 0;
        }
        .dv-section {
            margin: 0;
            min-width: 0;
            background: transparent;
            border: none;
            border-radius: 0;
            padding: 12px 0;
            box-shadow: none;
        }
        .dv-section + .dv-section {
            border-top: 1px solid rgba(99,102,241,0.10);
        }
        [data-theme="light"] .dv-section { background: transparent; border: none; }
        [data-theme="light"] .dv-section + .dv-section { border-top-color: rgba(99,102,241,0.10); }
        /* Warn/Danger blocks (Observações, Ónus) keep coloured backdrop
           but are NOT separated by the hairline above. */
        .dv-section.full-width.warn,
        .dv-section.full-width.danger {
            margin-top: 12px;
            padding: 12px 14px;
            border-top: none;
            border-radius: 6px;
        }
        .dv-section + .dv-section.full-width.warn,
        .dv-section + .dv-section.full-width.danger { border-top: none; }
        .dv-section.full-width.warn {
            background: rgba(245,158,11,0.06);
            border-left: 3px solid #f59e0b;
        }
        .dv-section.full-width.danger {
            background: rgba(239,68,68,0.06);
            border-left: 3px solid #ef4444;
        }
        .dv-section-title {
            font-size: 0.7rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: #6366f1;
            margin: 0 0 8px;
            padding: 0;
            border: none;
        }
        [data-theme="light"] .dv-section-title { color: #6366f1; }
        .dv-section.full-width.warn .dv-section-title { color: #b45309; }
        .dv-section.full-width.danger .dv-section-title { color: #b91c1c; }
        /* Inline rows — facts flow horizontally with wrap. Each .dv-row
           is one Label-Value pair; multiple rows in a section flow side
           by side (no more vertical stack). */
        .dv-section .dv-row {
            display: inline-flex;
            align-items: baseline;
            gap: 6px;
            padding: 0;
            margin: 0 28px 4px 0;
            font-size: 0.84rem;
            line-height: 1.45;
            border: none !important;
        }
        .dv-row + .dv-row { padding-top: 0; margin-top: 0 0 4px 0; }
        .dv-row-label {
            color: var(--text-muted);
            font-size: 0.74rem;
            font-weight: 500;
            flex-shrink: 0;
        }
        .dv-row-value {
            font-weight: 600;
            color: var(--text-primary);
            text-align: left;
            word-break: break-word;
        }
        .dv-row-value.empty { color: var(--text-dimmed); font-weight: 400; }
        .dv-row-value a { color: #6366f1; text-decoration: none; }
        .dv-row-value a:hover { text-decoration: underline; }

        /* Datas: same inline-pair pattern, just delegates to .dv-row */
        .dv-dates-inline { display: flex; flex-wrap: wrap; gap: 0 28px; }
        .dv-date-cell {
            display: inline-flex;
            align-items: baseline;
            gap: 6px;
            margin-bottom: 4px;
        }
        .dv-date-cell .dv-row-label { font-size: 0.74rem; font-weight: 500; }
        .dv-date-cell .dv-row-value { text-align: left; font-size: 0.84rem; font-weight: 600; }
        .dv-prose {
            font-size: 0.8rem;
            color: var(--text-secondary, #cbd5e1);
            line-height: 1.6;
            white-space: pre-wrap;
            word-break: break-word;
        }
        [data-theme="light"] .dv-prose { color: #475569; }

        /* CTA */
        .dv-cta {
            background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
            border: 1px solid rgba(99,102,241,0.2);
            border-radius: 12px;
            padding: 16px;
            text-align: center;
            grid-column: 1 / -1;
        }
        .dv-cta-title { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
        .dv-cta-text { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 10px; line-height: 1.4; }
        .dv-cta-btn {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 8px 20px;
            background: #6366f1;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }
        .dv-cta-btn:hover { background: #4f46e5; transform: translateY(-1px); }

        /* Loading */
        .dv-loading {
            display: none;
            flex: 1;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 12px;
            color: var(--text-muted);
            font-size: 0.9rem;
        }
        .dv-loading.active { display: flex; }
        .dv-spinner {
            width: 36px; height: 36px;
            border: 3px solid rgba(99,102,241,0.2);
            border-top-color: #6366f1;
            border-radius: 50%;
            animation: dv-spin 0.7s linear infinite;
        }
        @keyframes dv-spin { to { transform: rotate(360deg); } }

        /* Responsive */
        @media (max-width: 1024px) {
            .stats-bar {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 768px) {
            .explore-hero {
                padding: 120px 20px 40px;
            }

            .explore-hero h1 {
                font-size: 1.8rem;
            }

            .explore-hero p {
                font-size: 1rem;
            }

            .stats-bar {
                grid-template-columns: repeat(2, 1fr);
                padding: 20px;
                gap: 16px;
            }

            .stat-card {
                padding: 16px;
            }

            .stat-value {
                font-size: 1.5rem;
            }

            .explore-main {
                padding: 0 16px 60px;
            }

            .events-grid {
                grid-template-columns: 1fr;
                gap: 16px;
            }

            .section-header {
                flex-direction: column;
                gap: 16px;
                align-items: flex-start;
            }

            .filters-panel {
                width: 100%;
                gap: 8px;
                flex-wrap: wrap;
            }

            .search-bar {
                max-width: none;
                flex: 1 1 0;
                min-width: 0;
            }

            .search-bar-input {
                font-size: 16px;
                padding: 14px 16px 14px 42px;
            }

            /* Show advanced search toggle on mobile */
            .advanced-search-toggle {
                display: flex;
                min-height: 44px;
            }

            /* ── Mobile Bottom Sheet ── */
            /* 2026-05-08 v2: top bar mobile = SINGLE ROW.
               [search bar (flex 1)] [📍 44x44] [⚙ filtros 44x44]
               Os 4 selects (distrito/concelho/freguesia/sort) são reparented
               para o popover via _syncMobileFilterLayout() — não aparecem
               no top bar em mobile. */
            .filters-panel {
                display: grid;
                grid-template-columns: 1fr 44px 44px;
                gap: 8px;
                flex-wrap: unset;
                align-items: center;
            }
            .filters-panel .search-bar {
                grid-column: 1;
                margin-bottom: 0;
            }
            /* Esconde os 4 selects primary QUANDO estão como filhos diretos
               do .filters-panel. Quando reparented para dentro do popover
               (.advanced-filters-panel é descendente de .filters-panel,
               por isso o descendant selector apanhava-os também), o rule
               com `>` evita o false-match. */
            .filters-panel > .filter-select.primary-filter {
                display: none !important;
            }
            .filters-panel .filter-location-btn.inline-icon {
                width: 44px;
                height: 44px;
                padding: 0;
                grid-column: 2;
            }
            .filters-panel .filter-location-btn.inline-icon .location-btn-label {
                display: none;
            }
            .filters-panel .advanced-search-toggle {
                width: 44px;
                height: 44px;
                padding: 0;
                gap: 0;
                justify-content: center;
                grid-column: 3;
                position: relative;
            }
            /* Esconde label "Filtros" em mobile, fica só icon */
            .filters-panel .advanced-search-toggle .advanced-search-toggle-label {
                display: none;
            }
            /* Badge de count fica como dot no canto da icon button */
            .filters-panel .advanced-search-toggle .advanced-filters-count.visible {
                position: absolute;
                top: -4px;
                right: -4px;
                min-width: 16px;
                padding: 2px 5px;
                font-size: 0.62rem;
                background: #6366f1;
                color: #fff;
            }
            /* 2026-05-08: tipo chips redundantes em mobile (há Tipo select no popover) */
            .quick-filters { display: none !important; }

            /* The advanced-filters-panel becomes a fixed bottom sheet */
            .advanced-filters-panel {
                position: fixed;
                top: auto;  /* 2026-05-08: limpa desktop's top: calc(100% + 8px) que partia o slide-up */
                bottom: 0; left: 0; right: 0;
                width: 100%;
                z-index: 8000;
                background: var(--bg-secondary);
                border-top: 1px solid var(--border-color);
                border-radius: 20px 20px 0 0;
                padding: 0 20px 32px;
                max-height: 88vh;
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                transform: translateY(100%);
                transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
                display: block !important;
                flex-basis: auto;
                box-shadow: 0 -10px 40px rgba(15,23,42,0.18);
            }
            .advanced-filters-panel.open {
                transform: translateY(0);
            }
            /* Sheet handle bar */
            .advanced-filters-panel::before {
                content: '';
                display: block;
                width: 36px; height: 4px;
                background: var(--border-color);
                border-radius: 2px;
                margin: 12px auto 20px;
            }
            /* Backdrop */
            .filters-backdrop {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0,0,0,0.5);
                z-index: 7999;
                backdrop-filter: blur(2px);
            }
            .filters-backdrop.open { display: block; }

            /* Sheet header */
            .sheet-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                margin-bottom: 20px;
            }
            .sheet-title {
                font-size: 1rem;
                font-weight: 700;
                color: var(--text-primary);
            }
            .sheet-close-btn {
                background: var(--bg-card);
                border: 1px solid var(--border-color);
                border-radius: 50%;
                width: 32px; height: 32px;
                display: flex; align-items: center; justify-content: center;
                cursor: pointer;
                color: var(--text-muted);
            }
            /* Sheet footer with apply/reset */
            .sheet-footer {
                display: flex;
                gap: 10px;
                margin-top: 24px;
                padding-top: 16px;
                border-top: 1px solid var(--border-color);
            }
            .sheet-footer-reset {
                flex: 1;
                padding: 14px;
                background: var(--bg-card);
                border: 1px solid var(--border-color);
                border-radius: 12px;
                color: var(--text-muted);
                font-size: 0.9rem;
                font-weight: 600;
                cursor: pointer;
            }
            .sheet-footer-apply {
                flex: 2;
                padding: 14px;
                background: var(--btn-primary-bg);
                border: none;
                border-radius: 12px;
                color: var(--btn-primary-text);
                font-size: 0.9rem;
                font-weight: 600;
                cursor: pointer;
            }

            .advanced-filters-grid {
                display: flex;
                flex-direction: column;
                gap: 12px;
            }
            .advanced-filter-group {
                display: flex;
                flex-direction: column;
                gap: 6px;
            }
            /* 2026-05-07 mobile: ms-dropdown pills tornam-se inline (push)
               em vez de overlay absoluto, para não fugirem da bottom-sheet. */
            .ms-dropdown-pills {
                position: static;
                box-shadow: none;
                border: none;
                border-top: 1px solid var(--border-color);
                background: var(--bg-tertiary, transparent);
                border-radius: 0 0 8px 8px;
                margin: 0;
                width: 100%;
                max-width: none;
                padding: 10px 12px;
                max-height: none;  /* sem cap em mobile, deixa fluir na bottom-sheet */
                overflow: visible;
            }
            /* 2026-05-08 mobile: ms-dropdown-trigger + range inputs com touch
               target 44px e font-size 16px (evita iOS zoom-on-focus). */
            .ms-dropdown-trigger {
                min-height: 44px;
                font-size: 16px;
                padding: 10px 32px 10px 14px;
            }
            .ms-dropdown-text {
                font-size: 16px;
            }
            .range-inputs .filter-input {
                min-height: 44px;
                font-size: 16px;
                padding: 10px 12px;
            }
            /* Chips dentro do popover ficam um pouco maiores também */
            .ms-dropdown-pills .tag-filters-chip {
                padding: 8px 12px 8px 10px;
                font-size: 13px;
            }
            .advanced-filter-label {
                display: block;
                font-size: 0.8rem;
                font-weight: 600;
                color: var(--text-muted);
                text-transform: uppercase;
                letter-spacing: 0.5px;
            }

            .filter-select {
                flex: 1;
                min-width: 0;
                max-width: none;
                width: 100%;
                font-size: 16px;
                min-height: 44px;
            }

            .proximity-controls {
                flex-direction: column;
                gap: 8px;
            }
            /* 2026-05-08 v2: location btn em mobile fica icon-only 44x44
               (já forçado pela regra .filters-panel .filter-location-btn.inline-icon
               acima). Esta regra é fallback genérico. */
            .filter-location-btn {
                gap: 8px;
                min-height: 44px;
            }
            /* 2026-05-08 v2: radius pills em mobile — pills um pouco maiores
               para touch target. */
            .advanced-filters-panel .radius-pill {
                padding: 9px 4px;
                font-size: 0.82rem;
            }
            .advanced-filters-panel .radius-pill[data-km="0"] {
                font-size: 1.1rem;
            }

            .filter-chip {
                min-height: 44px;
                padding: 10px 16px;
                font-size: 0.9rem;
            }

            /* Touch targets */
            .carousel-btn {
                width: 44px;
                height: 44px;
                opacity: 1;
                font-size: 16px;
            }

            .action-btn {
                width: 44px;
                height: 44px;
                font-size: 1rem;
            }

            .load-more-btn {
                min-height: 48px;
                padding: 14px 48px;
                font-size: 1rem;
            }

            /* Text sizes */
            .event-type {
                font-size: 0.8rem;
            }

            .event-title {
                font-size: 1.05rem;
            }

            .event-location {
                font-size: 0.85rem;
            }

            .event-grid-label {
                font-size: 0.7rem;
            }

            .event-grid-value {
                font-size: 0.95rem;
            }

            .event-countdown {
                font-size: 0.9rem;
            }

            .event-ref {
                font-size: 0.8rem;
            }

            .ending-item {
                flex-direction: column;
                text-align: center;
            }

            .ending-price {
                text-align: center;
            }

            /* Drawer mobile: fullscreen modal */
            .dv-panel { top: 0; bottom: 0; left: 0; right: 0; max-width: none; border-radius: 0; border: none; box-shadow: none; }
            .dv-navbar { padding: 0; margin-top: 0; }
            .dv-navbar .nav-container { padding: 10px 12px !important; }
            .dv-breadcrumb-sep { display: none; }
            .dv-nav-ref { display: none; }
            .dv-nav-btn { padding: 10px; gap: 0; font-size: 0; min-width: 44px; min-height: 44px; justify-content: center; }
            .dv-nav-btn span { display: none; }
            .dv-nav-btn svg { width: 18px; height: 18px; }
            .dv-nav-back { font-size: 0; padding: 10px; min-width: 44px; min-height: 44px; }
            .dv-nav-back svg { width: 20px; height: 20px; }
            .dv-nav-timer { font-size: 0.7rem; padding: 4px 8px; }

            /* Main layout: vertical scroll, images + details stacked */
            .dv-main { flex-direction: column; padding: 0; overflow-y: auto; }

            /* Images: fixed aspect ratio, swipeable gallery */
            .dv-images { width: 100%; max-width: none; height: 55vw; min-height: 180px; max-height: 300px; flex: none; }
            .dv-img-item img { object-fit: cover; }
            .dv-img-nav { width: 36px; height: 36px; opacity: 0.8; }
            .dv-img-nav.prev { left: 8px; }
            .dv-img-nav.next { right: 8px; }

            /* Details: scrollable, breathing room */
            .dv-details { width: 100%; border-left: none; border-top: 1px solid var(--border-color); flex: 1; overflow-y: auto; overflow-x: hidden; padding: 16px; }
            .dv-header-row { flex-direction: column; gap: 12px; }
            .dv-título { font-size: 0.9rem; -webkit-line-clamp: 4; }

            /* 2026-05-08 mobile: pricing cards estavam achatados —
               valores 0.85rem (13.6px) e labels 0.58rem (9.28px) é
               quase ilegível. Bumped + mais padding para "respirar". */
            .dv-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
            .dv-val-card {
                padding: 14px 14px;
                min-width: 0;
                display: flex;
                flex-direction: column;
                gap: 6px;
                justify-content: center;
                min-height: 64px;
            }
            .dv-val-label {
                font-size: 0.7rem;
                letter-spacing: 0.4px;
                text-transform: uppercase;
                font-weight: 600;
            }
            .dv-val-num { font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
            /* LANCE ATUAL é o destaque — fonte maior e cor verde */
            .dv-val-card.main .dv-val-num { font-size: 1.35rem; }

            /* 2026-05-08 mobile audit:
               - Single column for sections (no 2-col grid)
               - Stacked label-left/value-right pattern (override desktop's inline-flex)
               - Larger fonts for a11y (≥14px / 0.875rem on body, ≥0.78rem on labels)
               - Safe-area-inset-bottom para iOS home indicator
               - Visual divider entre secções */
            .dv-columns { display: flex; flex-direction: column; gap: 0; }

            /* Override desktop inline-flex pattern: mobile wants stacked rows
               (label left, value right) — more readable in narrow viewport. */
            .dv-section .dv-row {
                display: flex !important;
                justify-content: space-between;
                align-items: baseline;
                gap: 12px;
                margin: 0 0 6px 0;
                padding: 0;
                font-size: 0.85rem;
                line-height: 1.5;
                width: 100%;
            }
            .dv-section .dv-row:last-child { margin-bottom: 0; }

            /* Row label/value sizing for mobile readability */
            .dv-row-label {
                font-size: 0.78rem;
                font-weight: 500;
                flex-shrink: 0;
                color: var(--text-muted);
            }
            .dv-row-value {
                font-size: 0.85rem;
                font-weight: 600;
                white-space: normal;
                word-break: break-word;
                text-align: right;
                max-width: 60%;
            }
            /* Section titles: bumped from 0.68rem (10.88px — too small) */
            .dv-section-title { font-size: 0.78rem; }

            /* Section divider in mobile: thin border instead of card-style */
            .dv-section {
                padding: 14px 0;
                background: transparent;
                border: none;
            }
            .dv-section + .dv-section {
                border-top: 1px solid rgba(255,255,255,0.08);
                padding-top: 14px;
                margin-top: 0;
            }
            [data-theme="light"] .dv-section + .dv-section {
                border-top-color: rgba(0,0,0,0.08);
            }
            /* Warn/danger sections (Observações, Ónus): keep card style */
            .dv-section.full-width.warn,
            .dv-section.full-width.danger {
                padding: 12px 14px;
                margin: 8px 0;
                border-radius: 10px;
            }

            /* 2026-05-08 mobile: datas estavam todas amontoadas à esquerda
               com metade do drawer vazia. Agora ocupam o espaço todo:
               Início encosta à esquerda, Fim à direita, com fontes maiores
               e padding vertical para parecerem cards leves. */
            .dv-dates-inline {
                display: flex;
                justify-content: space-between;
                align-items: stretch;
                gap: 12px;
                flex-wrap: nowrap;
            }
            .dv-date-cell {
                flex: 1;
                display: flex;
                flex-direction: column;
                gap: 4px;
                padding: 10px 12px;
                background: rgba(99, 102, 241, 0.06);
                border: 1px solid rgba(99, 102, 241, 0.15);
                border-radius: 8px;
                margin-bottom: 0;
            }
            [data-theme="light"] .dv-date-cell {
                background: rgba(99, 102, 241, 0.04);
                border-color: rgba(99, 102, 241, 0.18);
            }
            .dv-date-cell .dv-row-label {
                font-size: 0.7rem;
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.3px;
                color: var(--text-muted);
            }
            .dv-date-cell .dv-row-value {
                font-size: 0.92rem;
                font-weight: 700;
                line-height: 1.3;
                text-align: left;
                white-space: normal;
                color: var(--text-primary);
            }
            /* Em viewports muito estreitos (<340px) volta a stack vertical */
            @media (max-width: 340px) {
                .dv-dates-inline { flex-wrap: wrap; }
            }

            /* iOS safe-area: home indicator não tapa conteúdo final */
            .dv-details {
                padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
                -webkit-overflow-scrolling: touch;
                overscroll-behavior: contain;
            }

            /* Mobile: tap images for fullscreen */
            .dv-img-item { cursor: pointer; }

            /* Stats-specific: keep inline-pair flow on this section since
               stats are short pairs (label: value) and benefit from compact view */
            .dv-section-stats .dv-row {
                margin-bottom: 4px;
            }
        }

        /* ===== Fullscreen Image Lightbox ===== */
        .img-lightbox {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            z-index: 10010;
            background: #000;
            display: none;
            flex-direction: column;
        }
        .img-lightbox.open { display: flex; }
        .img-lightbox-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 16px;
            background: rgba(0,0,0,0.6);
            flex-shrink: 0;
            z-index: 2;
        }
        .img-lightbox-counter {
            color: #fff;
            font-size: 0.85rem;
            font-weight: 500;
        }
        .img-lightbox-close {
            background: none;
            border: none;
            color: #fff;
            cursor: pointer;
            padding: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .img-lightbox-close svg { width: 24px; height: 24px; }
        .img-lightbox-body {
            flex: 1;
            display: flex;
            overflow-x: auto;
            overflow-y: hidden;
            scroll-snap-type: x mandatory;
            scroll-behavior: smooth;
            -webkit-overflow-scrolling: touch;
        }
        .img-lightbox-body::-webkit-scrollbar { display: none; }
        .img-lightbox-body { scrollbar-width: none; }
        .img-lightbox-slide {
            min-width: 100%;
            width: 100%;
            flex-shrink: 0;
            scroll-snap-align: start;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 16px;
        }
        .img-lightbox-slide img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }
