/* Grúa — licencias de obra de Madrid. Responsive: el mapa manda en móvil. */
:root {
    --ink: #202124;
    --accent: #1a73e8;
    --bg: #f8f9fa;
    --line: #e0e0e0;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

body {
    display: flex;
    flex-direction: column;
}

/* ---------- Cabecera ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.2;
}

.subtitle {
    margin: 2px 0 0;
    font-size: 0.78rem;
    color: #5f6368;
}

/* ---------- Leyenda (chips por tipo) ---------- */

.leyenda {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    font-size: 0.72rem;
    cursor: pointer;
    user-select: none;
    transition: opacity 0.15s;
}

.chip:hover {
    border-color: var(--accent);
}

.chip.off {
    opacity: 0.35;
    text-decoration: line-through;
}

.chip .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex: none;
}

.chip-n {
    color: #5f6368;
    font-variant-numeric: tabular-nums;
}

/* ---------- Mapa + resumen ---------- */

.map-wrap {
    flex: 1;
    position: relative;
    min-height: 0;
}

#map {
    position: absolute;
    inset: 0;
}

.map-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #c62828;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    max-width: 90%;
}

.hidden {
    display: none !important;
}

.summary {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 14px;
    min-width: 170px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
}

.summary-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #5f6368;
}

.summary-numbers {
    font-size: 1.9rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.summary-note {
    font-size: 0.72rem;
    color: #5f6368;
}

.summary-caption {
    margin-top: 6px;
    font-size: 0.66rem;
    color: #80868b;
}

/* ---------- Ficha (InfoWindow) ---------- */

.ficha {
    font-family: inherit;
    min-width: 200px;
    max-width: 260px;
}

.ficha-tipo {
    font-weight: 700;
    font-size: 0.85rem;
    padding-left: 8px;
    margin-bottom: 6px;
}

.ficha-fila {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 2px 0;
    font-size: 0.78rem;
}

.ficha-k {
    color: #5f6368;
    flex: none;
}

.ficha-v {
    text-align: right;
    font-weight: 500;
}

/* ---------- Pie ---------- */

.foot {
    padding: 8px 16px;
    font-size: 0.7rem;
    color: #5f6368;
    background: #fff;
    border-top: 1px solid var(--line);
}

.foot a {
    color: var(--accent);
}

/* ---------- Móvil: mapa protagonista ---------- */

@media (max-width: 640px) {
    .topbar {
        padding: 8px 12px;
    }

    .leyenda {
        padding: 6px 12px;
        gap: 4px;
        max-height: 88px;
        overflow-y: auto;
    }

    .summary {
        top: auto;
        bottom: 12px;
        right: 12px;
        left: 12px;
        min-width: 0;
        text-align: center;
        padding: 8px 12px;
    }

    .summary-numbers {
        font-size: 1.4rem;
    }

    .summary-caption {
        display: none;
    }

    .foot {
        display: none;
    }
}
