*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}



:root {
    --bg: #f0f2f7;
    --surface: #ffffff;
    --surface2: #f5f6fa;
    --border: #dde1ee;
    --accent: var(--mud-palette-primary, #2563eb);
    --text: #1a1f36;
    --text-dim: #6b7280;
    --seg1: #2563eb;
    --seg2: #059669;
    --seg3: #d97706;
    --seg4: #dc2626;
    --seg5: #7c3aed;
}



body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* -- Sobreescribir atributos mud -- */
.mud-icon-size-large {
    font-size: 3.25rem;
}

/* -- Estilo botones -- */
.login-button {
    padding: 0px 0px !important;
    width: auto;
    height: 35px;
    text-align: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    --tw-bg-opacity: 1 !important;
    background-color: rgb(20 27 77 / var(--tw-bg-opacity)) !important;
    color: white !important;
    transition: background-color 0.3s ease, transform 0.2s ease !important;
}

    .login-button:hover {
        background-color: rgb(30 37 97 / var(--tw-bg-opacity)) !important; /* Color más claro al hacer hover */
        justify-content: center !important;
    }

    .login-button:disabled {
        cursor: not-allowed !important; /* Cambia el cursor a "no permitido" */
        opacity: 0.5; /* Reduce la opacidad para indicar que está deshabilitado */
        color: white !important;
        justify-content: center !important;
    }

/* ── LAYOUT MEJORADO ── */

.mapa-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--bg);
}



.mapa-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    flex-shrink: 0;
}



    .mapa-header h3 {
        font-size: 1.25rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }



        .mapa-header h3 span {
            color: var(--accent);
        }



    .mapa-header p {
        font-size: 0.85rem;
        color: var(--text-dim);
        margin: 4px 0 0 0;
    }



.mapa-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}



.mapa-sidebar {
    width: 320px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}



.mapa-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}



/* ── CARDS MEJORADAS ── */

.info-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    margin: 12px;
}



.info-card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 6px 6px 0 0;
}



    .info-card-header h5 {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }



.info-card-body {
    padding: 14px;
}



/* ── ESTADÍSTICAS ── */

.stats-grid {
    display: grid;
    gap: 8px;
}



.stat-item {
    background: var(--surface2);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
}



    .stat-item strong {
        display: block;
        color: var(--accent);
        font-size: 0.8rem;
        margin-bottom: 6px;
    }



    .stat-item ul {
        list-style: none;
        padding: 0;
        margin: 0;
    }



    .stat-item li {
        font-size: 0.75rem;
        padding: 4px 0;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid var(--border);
    }



        .stat-item li:last-child {
            border-bottom: none;
        }



        .stat-item li span:first-child {
            color: var(--text);
            font-weight: 500;
        }



        .stat-item li span:last-child {
            color: var(--text-dim);
            font-weight: 400;
        }



/* ── MAPA ── */

.mapa-wrapper {
    flex: 1;
    position: relative;
    background: var(--surface);
}



.mapa-toolbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}



    .mapa-toolbar h5 {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text);
        margin: 0;
    }



.badge-gps {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}



#map {
    height: 100%;
    width: 100%;
}

/*ESTILO MUDCHIP A BUTTON*/
.chips-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    --chip-color: #888;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: 16px;
    border: 1px solid var(--chip-color);
    background: transparent;
    color: var(--chip-color);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease, box-shadow .12s ease;
    user-select: none;
}

    .chip:hover {
        filter: brightness(0.95);
    }

    .chip.active {
        background: var(--chip-color);
        color: #ffffff;
        box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    }

    .chip:focus {
        outline: 2px solid rgba(0,0,0,0.06);
        outline-offset: 2px;
    }

/* ── LEAFLET POPUP PERSONALIZADO ── */

.leaflet-popup-content-wrapper {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    border-radius: 10px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.12) !important;
}



.leaflet-popup-tip {
    background: var(--surface) !important;
}



.popup-title {
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--accent);
}



.popup-row {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin: 2px 0;
}



    .popup-row b {
        color: var(--text);
    }



/* ── SCROLLBAR ── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}



::-webkit-scrollbar-track {
    background: var(--surface);
}



::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}



    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-dim);
    }



/* ── APP LEGACY ── */

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}



/* ── HEADER LEGACY ── */

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    flex-wrap: wrap;
}



    header h1 {
        font-size: 1rem;
        font-weight: 600;
        color: var(--text);
        flex: 1;
        min-width: 180px;
    }



        header h1 span {
            color: var(--accent);
        }



.stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}



.stat-chip {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.75rem;
    color: var(--text-dim);
}



    .stat-chip b {
        color: var(--text);
    }



/* ── CONTROLS ── */

.controls {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
}



.view-tabs {
    display: flex;
    background: var(--surface2);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}



.view-tab {
    padding: 6px 18px;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    background: transparent;
    color: var(--text-dim);
    transition: all .2s;
}



    .view-tab.active {
        background: var(--accent);
        color: #fff;
    }



.filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-dim);
    white-space: nowrap;
}



.toggle-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}



.toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px 11px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: var(--surface2);
    transition: all .15s;
    user-select: none;
}



    .toggle-btn:hover {
        border-color: var(--accent);
        color: var(--text);
    }



    .toggle-btn .dot {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        flex-shrink: 0;
    }



.divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}



/* ── MAIN ── */

.main {
    flex: 1;
    overflow: hidden;
    position: relative;
}



.loading, .error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 1.2rem;
    color: var(--text-dim);
}



.error {
    color: #dc2626;
}



/* ── MAP ── */

.map-container {
    width: 100%;
    height: 100%;
}



/* ── TABLE ── */

.table-wrapper {
    width: 100%;
    height: 100%;
    overflow: auto;
}



table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}



thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--surface);
}



    thead th {
        padding: 10px 14px;
        text-align: left;
        font-weight: 600;
        color: var(--text-dim);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: .05em;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
    }



        thead th:hover {
            color: var(--accent);
        }



        thead th .sort-icon {
            margin-left: 4px;
            opacity: .5;
        }



tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background .1s;
    cursor: pointer;
}



    tbody tr:hover {
        background: var(--surface2);
    }



td {
    padding: 9px 14px;
    color: var(--text);
    white-space: nowrap;
}



    td.id-col {
        color: var(--text-dim);
        font-size: 0.75rem;
    }



    td.coord {
        font-family: monospace;
        font-size: 0.78rem;
        color: #a0c4ff;
    }



.seg-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #fff;
}



.assign-chip {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.75rem;
}



/* ── SPLIT VIEW ── */

.split-view {
    display: flex;
    width: 100%;
    height: 100%;
}



.map-container-split {
    flex: 1;
    height: 100%;
}



.table-wrapper-split {
    width: 420px;
    flex-shrink: 0;
    height: 100%;
    overflow: auto;
    border-left: 1px solid var(--border);
}



/* ── SCROLLBAR ── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}



::-webkit-scrollbar-track {
    background: var(--surface);
}



::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* ── SNACKBAR PERSONALIZADO ── */
.mud-snackbar {
    font-size: 1.3rem !important;
}

.mud-snackbar-content {
    font-size: 1.3rem !important;
}

.mud-snackbar-message {
    font-size: 1.3rem !important;
}
