/* ========================================================
   CensoAcacías - Estilos Mobile-First y Modo Moto
   Optimizado para uso con una sola mano, alto contraste y PWA
   ======================================================== */

:root {
    --bg-primary: #0f172a;
    --bg-surface: #1e293b;
    --bg-card: #273549;
    --bg-card-hover: #334155;
    --border-color: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Colores funcionales */
    --color-total: #38bdf8;
    --color-censado: #22c55e;
    --color-cerrado: #f97316;
    --color-pendiente: #a855f7;
    --color-pendientes-por-censar: #eab308;

    /* Estados de Alto Contraste */
    --status-sin-empezar: #0284c7; /* Azul */
    --status-en-proceso: #ea580c;  /* Amarillo/Naranja */
    --status-terminado: #166534;   /* Verde Oscuro */

    /* Tamaños táctiles para Modo Moto */
    --btn-counter-size: 58px;
    --tab-bar-height: 64px;
    --header-height: 56px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
}

/* Modo Claro (opcional) */
body.light-theme {
    --bg-primary: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-card: #f8fafc;
    --bg-card-hover: #e2e8f0;
    --border-color: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
}

#app {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* -------------------------------------------------------------
   Barra Superior / Header
   ------------------------------------------------------------- */
.app-header {
    height: calc(var(--header-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 100;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text-primary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Indicador de Sincronización */
.sync-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid transparent;
    transition: all 0.25s ease;
}

.sync-chip.synced {
    color: #4ade80;
    border-color: rgba(74, 222, 128, 0.3);
    background-color: rgba(74, 222, 128, 0.1);
}

.sync-chip.pending {
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.4);
    background-color: rgba(251, 191, 36, 0.15);
}

.sync-chip.offline {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.4);
    background-color: rgba(248, 113, 113, 0.15);
}

.sync-chip.syncing {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
    background-color: rgba(56, 189, 248, 0.15);
}

/* -------------------------------------------------------------
   Contenedor Principal de Pantallas
   ------------------------------------------------------------- */
.screens-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background-color: var(--bg-primary);
}

.screen.active {
    display: flex;
}

/* -------------------------------------------------------------
   PANTALLA 1: MAPA
   ------------------------------------------------------------- */
#screen-map {
    position: relative;
    overflow: hidden;
}

#map-container {
    width: 100%;
    height: 100%;
    background-color: #1e293b;
    z-index: 10;
}

/* Chip Fijo Superior: "Estás en Polígono N" */
.gps-current-chip-container {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    z-index: 50;
    pointer-events: none;
}

.gps-current-chip {
    pointer-events: auto;
    background-color: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.gps-current-chip:active {
    transform: scale(0.98);
}

.gps-chip-left {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.gps-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
    animation: gpsPulse 2s infinite;
}

@keyframes gpsPulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.6; }
    100% { transform: scale(1); opacity: 1; }
}

.gps-chip-action {
    font-size: 12px;
    color: #38bdf8;
    font-weight: 600;
}

/* Interruptor Flotante: "Ver otros polígonos" */
.map-toggle-bar {
    position: absolute;
    top: 68px;
    left: 14px;
    z-index: 50;
    pointer-events: none;
}

.toggle-others-pill {
    pointer-events: auto;
    background-color: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.toggle-others-pill:hover, .toggle-others-pill:active {
    border-color: #38bdf8;
    color: var(--text-primary);
}

.toggle-others-pill input[type="checkbox"] {
    accent-color: #38bdf8;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Botón flotante para recentrar GPS */
.btn-gps-center {
    position: absolute;
    bottom: calc(var(--tab-bar-height) + var(--safe-bottom) + 20px);
    right: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    z-index: 40;
    cursor: pointer;
}

.btn-gps-center:active {
    transform: scale(0.94);
    background-color: #2563eb;
    color: white;
}

/* Estilos de etiquetas numéricas en Leaflet (solo número, compactas) */
.poly-label-container {
    background: transparent;
    border: none;
}

.poly-badge {
    background: rgba(15, 23, 42, 0.95);
    border: 1.5px solid #fff;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

/* Colores de estado de alto contraste */
.poly-badge.sin_empezar {
    border-color: #38bdf8;
    background-color: #0284c7; /* Azul */
    color: #ffffff;
}

.poly-badge.en_proceso {
    border-color: #f59e0b;
    background-color: #ea580c; /* Amarillo / Naranja */
    color: #ffffff;
}

.poly-badge.terminado {
    border-color: #4ade80;
    background-color: #14532d; /* Verde Oscuro */
    color: #ffffff;
}

.poly-badge.highlight {
    border-color: #ffffff;
    box-shadow: 0 0 10px #38bdf8;
    background: #0284c7;
}

/* Marcador GPS del usuario */
.user-location-marker-wrap {
    position: relative;
    width: 32px;
    height: 32px;
}

.user-dot {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 16px;
    height: 16px;
    background-color: #0284c7;
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

.user-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(56, 189, 248, 0.35);
    animation: userPulse 1.8s ease-out infinite;
}

@keyframes userPulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

/* -------------------------------------------------------------
   PANTALLA 2: FICHA DE POLÍGONO (Hoja Inferior / Bottom Sheet)
   ------------------------------------------------------------- */
.bottom-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.bottom-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface);
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -8px 30px rgba(0,0,0,0.6);
    z-index: 210;
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--safe-bottom) + 12px);
    border-top: 1px solid var(--border-color);
}

.bottom-sheet.open {
    transform: translateY(0);
}

.sheet-drag-handle-wrap {
    width: 100%;
    padding: 10px 0 4px;
    display: flex;
    justify-content: center;
    cursor: grab;
}

.sheet-drag-handle {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background-color: var(--border-color);
}

.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px 14px;
    border-bottom: 1px solid var(--border-color);
}

.sheet-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sheet-poly-number {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.sheet-status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sheet-status-badge.sin_empezar {
    background-color: rgba(2, 132, 199, 0.2);
    color: #38bdf8;
    border: 1px solid #0284c7;
}

.sheet-status-badge.en_proceso {
    background-color: rgba(234, 88, 12, 0.2);
    color: #fb923c;
    border: 1px solid #ea580c;
}

.sheet-status-badge.terminado {
    background-color: rgba(22, 101, 52, 0.3);
    color: #4ade80;
    border: 1px solid #166534;
}

.sheet-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.sheet-body {
    padding: 16px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Línea destacada en la ficha: Por volver: N cerrados */
.cerrados-notice-banner {
    background: linear-gradient(135deg, rgba(234, 88, 12, 0.22), rgba(249, 115, 22, 0.12));
    border: 1.5px solid #ea580c;
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 700;
    color: #fdba74;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.25);
}

.cerrados-notice-icon {
    font-size: 18px;
}

/* Distintivo en la Lista: 🔒 N cerrados */
.badge-cerrados-indicator {
    background-color: rgba(234, 88, 12, 0.2);
    border: 1px solid #ea580c;
    color: #fb923c;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
}

/* Indicador de Pendientes por Censar */
.pendientes-display-card {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(234, 179, 8, 0.3);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pendientes-info {
    display: flex;
    flex-direction: column;
}

.pendientes-label {
    font-size: 13px;
    color: #fbbf24;
    font-weight: 600;
}

.pendientes-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.pendientes-value {
    font-size: 32px;
    font-weight: 800;
    color: #fef08a;
}

/* Fila de Contadores con Botones Gigantes (Modo Moto) */
.counters-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.counter-row {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.counter-label-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding-right: 8px;
}

.counter-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.counter-desc {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.counter-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-counter {
    width: var(--btn-counter-size);
    height: var(--btn-counter-size);
    border-radius: 14px;
    border: none;
    font-size: 32px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.08s ease, filter 0.08s ease;
    color: #ffffff;
}

.btn-counter:active {
    transform: scale(0.92);
    filter: brightness(1.25);
}

.btn-counter.btn-minus {
    background-color: #475569;
}

.btn-counter.btn-plus.total {
    background: linear-gradient(135deg, #0284c7, #0369a1);
}

.btn-counter.btn-plus.censado {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-counter.btn-plus.cerrado {
    background: linear-gradient(135deg, #ea580c, #c2410c);
}

.btn-counter.btn-plus.pendiente_censo {
    background: linear-gradient(135deg, #9333ea, #7e22ce);
}

.counter-value-box {
    min-width: 44px;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Botones de Acción de Ficha */
.sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.btn-sheet-action {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}

.btn-sheet-action:active {
    transform: scale(0.98);
}

.btn-mark-finished {
    background-color: #16a34a;
    color: white;
}

.btn-mark-finished.is-finished {
    background-color: #334155;
    color: #cbd5e1;
    border: 1px solid var(--border-color);
}

.btn-undo-move {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: #94a3b8;
}

/* -------------------------------------------------------------
   PANTALLA 3: LISTA
   ------------------------------------------------------------- */
.list-header-controls {
    padding: 14px 16px 10px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 20;
}

.search-input-wrap {
    position: relative;
    margin-bottom: 12px;
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.search-input {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 12px 14px 12px 42px;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.search-input:focus {
    border-color: #38bdf8;
}

/* Filtros por estado */
.filter-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    white-space: nowrap;
    cursor: pointer;
}

.filter-chip.active {
    background-color: #2563eb;
    color: white;
    border-color: #2563eb;
}

.polygons-list-container {
    padding: 14px 16px calc(var(--tab-bar-height) + var(--safe-bottom) + 20px);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.polygon-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px;
    cursor: pointer;
    transition: transform 0.1s ease, border-color 0.15s ease;
}

.polygon-card:active {
    transform: scale(0.98);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.card-poly-number {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}

.card-counters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    background-color: var(--bg-primary);
    border-radius: 10px;
    padding: 8px;
    text-align: center;
}

.card-counter-item {
    display: flex;
    flex-direction: column;
}

.card-counter-label {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.card-counter-val {
    font-size: 16px;
    font-weight: 700;
}

.card-counter-val.tot { color: var(--color-total); }
.card-counter-val.cen { color: var(--color-censado); }
.card-counter-val.cer { color: var(--color-cerrado); }
.card-counter-val.pen { color: var(--color-pendientes-por-censar); }

/* -------------------------------------------------------------
   PANTALLA 4: RESUMEN
   ------------------------------------------------------------- */
.summary-container {
    padding: 16px 16px calc(var(--tab-bar-height) + var(--safe-bottom) + 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tarjeta Principal de Avance Global */
.progress-card {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 18px;
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.progress-pct-big {
    font-size: 38px;
    font-weight: 800;
    color: #4ade80;
}

.progress-bar-bg {
    width: 100%;
    height: 12px;
    background-color: #334155;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #4ade80);
    border-radius: 6px;
    transition: width 0.4s ease;
}

.progress-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Tarjetas de Totales Generales */
.stats-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
}

.stat-card-title {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-card-number {
    font-size: 26px;
    font-weight: 800;
}

.stat-card-number.tot { color: var(--color-total); }
.stat-card-number.cen { color: var(--color-censado); }
.stat-card-number.cer { color: var(--color-cerrado); }
.stat-card-number.pen-cen { color: var(--color-pendiente); }
.stat-card-number.pen-tot { color: var(--color-pendientes-por-censar); }

/* Tabla de Avance por Día */
.daily-table-wrap {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
}

.daily-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.daily-table th {
    background-color: var(--bg-card);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.daily-table td {
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
}

.daily-table tr.today-row {
    background-color: rgba(37, 99, 235, 0.12);
}

.badge-today {
    background-color: #2563eb;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* Botón de Exportar CSV */
.btn-export-csv {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3);
}

.btn-export-csv:active {
    transform: scale(0.98);
}

/* -------------------------------------------------------------
   PANTALLA 5: AJUSTES / IMPORTAR / GESTIÓN DE COLORES
   ------------------------------------------------------------- */
.settings-container {
    padding: 16px 16px calc(var(--tab-bar-height) + var(--safe-bottom) + 24px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-group {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Subida de KML / KMZ */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 14px;
    padding: 24px 16px;
    text-align: center;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.upload-dropzone.dragover {
    border-color: #38bdf8;
    background-color: rgba(56, 189, 248, 0.1);
}

.upload-icon {
    font-size: 36px;
    margin-bottom: 8px;
    color: #38bdf8;
}

.upload-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Listas de Selección de Colores (Paso 2 y Gestión) */
.kml-preview-box {
    background-color: var(--bg-card);
    border: 1px solid #38bdf8;
    border-radius: 14px;
    padding: 16px;
    margin-top: 10px;
}

.colors-checklist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
}

.color-check-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 8px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}

.color-check-item:hover {
    border-color: #475569;
}

.color-check-item input[type="checkbox"] {
    accent-color: #22c55e;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.color-swatch-box {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    flex-shrink: 0;
}

.color-info-text {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-primary);
}

.badge-green-detected {
    background-color: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid #22c55e;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
}

/* -------------------------------------------------------------
   Barra de Pestañas Inferior (Thumb-Friendly Tab Bar)
   ------------------------------------------------------------- */
.tab-bar {
    height: calc(var(--tab-bar-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    touch-action: manipulation;
    transition: color 0.15s ease;
}

.tab-btn:active {
    transform: scale(0.94);
}

.tab-icon {
    font-size: 20px;
}

.tab-label {
    font-size: 11px;
    font-weight: 600;
}

.tab-btn.active {
    color: #38bdf8;
}

.tab-btn.active .tab-icon {
    transform: translateY(-2px);
}

/* -------------------------------------------------------------
   Modal de Login / Sesión
   ------------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 28px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.modal-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.form-input {
    width: 100%;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.form-input:focus {
    border-color: #38bdf8;
}

.btn-primary {
    width: 100%;
    background: #2563eb;
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
}

.btn-primary:active {
    background: #1d4ed8;
}

.alert-box {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.4;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    color: #fca5a5;
}

.alert-success {
    background-color: rgba(34, 197, 94, 0.15);
    border: 1px solid #22c55e;
    color: #86efac;
}

/* Toast flotante de notificación */
.toast-msg {
    position: fixed;
    top: calc(var(--header-height) + var(--safe-top) + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: #1e293b;
    border: 1px solid var(--border-color);
    color: #f8fafc;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: all 0.25s ease;
}

.toast-msg.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
