:root {
    --fondo: #f4f2ee;
    --tarjeta: #ffffff;
    --tinta: #212529;
    --tinta-suave: #6c757d;
    --acento: #e8590c;
    --borde: #dee2e6;
    --clust: #5f3dc4;
    --estac: #1971c2;
}

* { box-sizing: border-box; }

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

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ---- Cabecera ---- */
.topbar {
    background: linear-gradient(135deg, #2b1a0e, #4a2c14);
    color: #fff;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
}
.topbar h1 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.3px;
}
.topbar .subtitle {
    margin: 2px 0 0;
    font-size: 0.75rem;
    opacity: 0.85;
}

/* ---- Controles ---- */
.controls {
    flex: 0 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 14px;
    background: var(--tarjeta);
    border-bottom: 1px solid var(--borde);
}
.controls label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--tinta-suave);
}
.controls select {
    font-size: 0.9rem;
    padding: 5px 8px;
    border: 1px solid var(--borde);
    border-radius: 8px;
    background: #fff;
    max-width: 220px;
}
.controls select:focus {
    outline: 2px solid var(--acento);
    outline-offset: 1px;
}

/* ---- Mapa ---- */
.map-wrap {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
}
#map {
    position: absolute;
    inset: 0;
    background: #e9ecef;
}
.map-notice {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff3bf;
    border: 1px solid #f0b429;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.85rem;
    max-width: 90%;
    z-index: 5;
}
.hidden { display: none; }

/* ---- Panel de resumen ---- */
.summary {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 4;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    padding: 10px 14px;
    min-width: 180px;
    max-width: 46vw;
    pointer-events: none;
}
.summary-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--acento);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.summary-numbers {
    font-size: 1.35rem;
    font-weight: 700;
    margin-top: 2px;
}
.summary-note {
    font-size: 0.6rem;
    color: var(--tinta-suave);
}

/* ---- InfoWindow ---- */
/* ---- InfoWindow (ficha de terraza) ---- */
.tp-ficha {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    padding: 4px 6px;
    min-width: 170px;
    max-width: 230px;
}
.tp-ficha .tf-nombre {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1c2733;
    line-height: 1.25;
    margin-bottom: 8px;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 6px;
}
.tp-ficha .tf-mesas {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
}
.tp-ficha .tf-mesas-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: #2b1a0e;
    line-height: 1;
}
.tp-ficha .tf-mesas-lbl {
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.tp-ficha .tf-estado {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}
.tp-ficha .tf-estado.ok { background: #dcfce7; color: #166534; }
.tp-ficha .tf-estado.parada { background: #fee2e2; color: #991b1b; }
.tp-ficha .tf-estado.sin-datos { background: #f3f4f6; color: #4b5563; }
.tp-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
    margin-right: 4px;
}
.tp-chip.anual { background: var(--acento); }
.tp-chip.estacional { background: var(--estac); }

/* ---- Pie ---- */
.foot {
    flex: 0 0 auto;
    font-size: 0.6rem;
    color: var(--tinta-suave);
    background: var(--tarjeta);
    border-top: 1px solid var(--borde);
    padding: 5px 14px;
    text-align: center;
}

/* ---- Móvil: el mapa manda ---- */
@media (max-width: 640px) {
    .topbar { padding: 6px 10px; }
    .topbar h1 { font-size: 1rem; }
    .topbar .subtitle { display: none; }
    .controls {
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 6px;
        padding: 6px 10px;
        -webkit-overflow-scrolling: touch;
    }
    .controls label { display: none; }
    .controls select { max-width: 38vw; font-size: 0.85rem; }
    .summary { top: 10px; right: 10px; padding: 8px 12px; min-width: 150px; }
    .summary-numbers { font-size: 1.15rem; }
    .foot { font-size: 0.55rem; }
}

/* ---- Leyenda de sombrillas ---- */
.legend {
    position: absolute;
    bottom: 24px;
    left: 12px;
    z-index: 5;
    background: rgba(255,255,255,.95);
    border-radius: 10px;
    padding: 8px 12px;
    font-size: .78rem;
    box-shadow: 0 1px 6px rgba(0,0,0,.2);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    align-items: center;
    max-width: 320px;
}
.lg-title { font-weight: 700; color: #2b1a0e; }
.lg-item { display: inline-flex; align-items: center; gap: 5px; color: #444; }
.swatch { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2); }
.sw-naranja { background: #e8590c; }
.sw-azul { background: #1971c2; }
.summary-caption { font-size: .72rem; color: #888; margin-top: 2px; }
