
/* =====================================================
   CONFIGURACIÓN GENERAL Y TÁCTIL
===================================================== */

/* Evita seleccionar texto accidentalmente en la interfaz */
html,
body,
button,
.app-container,
.app-header,
.recorrido-card,
.acciones-rondin,
.lista-ubicaciones {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Permite escribir y copiar texto en los campos */
input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
}

/* Evita el zoom por doble toque en los botones */
button,
.btn {
    touch-action: manipulation;
}

:root {
    --navy: #082e68;
    --blue: #0759d5;
    --blue2: #064bb8;
    --ink: #102b52;
    --muted: #64748b;
    --bg: #eef2f7;
    --white: #fff;
    --green: #a7e8d4;
    --line: #dbe4ef;
    --shadow: 0 3px 12px rgba(15,42,79,.15);
    --radius: 13px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--ink);
}

button,
input,
textarea {
    font: inherit;
}

button {
    touch-action: manipulation;
}

/* =====================================================
   ENCABEZADO
===================================================== */

.topbar {
    min-height: 82px;
    background: linear-gradient(110deg,#082d67,#0b397b);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px max(16px,calc((100vw - 1050px)/2));
    box-shadow: 0 2px 7px #0b245344;
}

.brand-mark {
    width: 55px;
    height: 55px;
    border: 3px solid #fff;
    border-radius: 16px 16px 21px 21px;
    display: grid;
    place-items: center;
    font-size: 27px;
    flex-shrink: 0;
}

.brand-divider {
    height: 45px;
    width: 2px;
    background: #ffffff75;
}

.brand-title {
    text-align: center;
    flex: 1;
    font-size: clamp(28px,3vw,28px);
    font-weight: 800;
    letter-spacing: .3px;
    line-height: 1.1;
}

.admin {
    margin-left: auto;
    text-align: center;
    min-width: 58px;
    font-weight: 800;
    font-size: 12px;
}

.admin i {
    font-size: 28px;
    display: block;
    margin-bottom: 5px;
}

main {
    max-width: 1050px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

/* =====================================================
   INFORMACIÓN DEL CLIENTE
===================================================== */

.client-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    border-radius: 12px;
    background: linear-gradient(110deg,#075bd8,#064dbb);
    color: #fff;
    padding: 10px 10px;
    min-height: 25px;
}

.client-banner i {
    font-size: 25px;
    min-width: 48px;
    text-align: center;
}

.client-banner .divider {
    height: 45px;
    width: 2px;
    background: #ffffff85;
}

.client-banner strong {
    font-size: clamp(16px,2.5vw,18px);
    line-height: 1.2;
}

.client-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 0;
}

#clientStatus {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

#clientName {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

/* =====================================================
   MAPA
===================================================== */

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-card {
    height: 150px;
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: #dce6ef;
    box-shadow: var(--shadow);
    border: 1px solid #d8e1eb;
    transition: height .25s ease;
}

.leaflet-control-locate {
    width: 22px;
    height: 22px;
    border: 0;
    border-radius: 8px;
    background: #fffE;
    color: #334155;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 2px 8px #0002;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaflet-control-locate:hover {
    background: #f4f4f4;
}

.leaflet-control-attribution {
    font-size: 8px;
    opacity: .2;
}

.leaflet-interactive {
    transition: stroke-opacity 1.5s ease, fill-opacity 1.5s ease;
}

.map-card.mapa-ampliado {
    height: 300px;
}

.map-controls {
    position: absolute;
    z-index: 500;
    top: 13px;
    left: 13px;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-radius: 9px;
    overflow: hidden;
    box-shadow: 0 2px 8px #0002;
}

.map-controls button,
.layers-button {
    height: 47px;
    width: 47px;
    border: 0;
    background: #fff;
    color: #334155;
    font-size: 23px;
    cursor: pointer;
}

.map-controls button + button {
    border-top: 1px solid #e2e8f0;
}

.layers-button {
    position: absolute;
    z-index: 500;
    right: 13px;
    top: 13px;
    border-radius: 9px;
    box-shadow: 0 2px 8px #0002;
}

.map-status {
    position: absolute;
    z-index: 500;
    bottom: 10px;
    left: 10px;
    background: #fffE;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11px;
    box-shadow: 0 2px 8px #0002;
}

.map-find_me {
    position: absolute;
    z-index: 500;
    bottom: 10px;
    right: 10px;
    background: #fffE;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11px;
    box-shadow: 0 2px 8px #0002;
}

.gps-pulse-marker {
    width: 18px;
    height: 18px;
    background: #007bff;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 rgba(0,123,255,.6);
    position: relative;
    z-index: 1;
}

.gps-pulse-marker::before,
.gps-pulse-marker::after {
    content: "";
    position: absolute;
    inset: -8px;
    border: 2px solid #007bff;
    border-radius: 50%;
    animation: gpsPulse 2s infinite;
    opacity: 0;
}

.gps-pulse-marker::after {
    animation-delay: 1s;
}

/* =====================================================
   SCROLL DE FONDO EN MODALES
===================================================== */

/*
body.modal-abierto {
    overflow: hidden !important;
    overscroll-behavior: none;
}

html.modal-abierto {
    overflow: hidden !important;
    overscroll-behavior: none;
}
*/

/* =====================================================
   PROGRESO DEL RECORRIDO
===================================================== */

.progress-card {
    background: #fff;
    padding: 7px 20px 7px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.progress-title {
    font-size: clamp(15px,2.5vw,23px);
    font-weight: 800;
    letter-spacing: .2px;
}

.progress-count {
    font-size: 19px;
    font-weight: 800;
    margin: 7px 0 8px;
}

.progress-track {
    height: 10px;
    background: #d9f5ed;
    border-radius: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0;
    background: #4cc8a7;
    border-radius: 20px;
    transition: width .25s;
}

.next-point {
    font-size: clamp(15px,2.4vw,22px);
    margin-top: 10px;
    line-height: 1.35;
}

.next-point strong {
    font-weight: 700;
}

/* =====================================================
   BOTONES DE ACCIONES
===================================================== */

.action-button {
    border: 0;
    border-radius: 12px;
    background: linear-gradient(110deg,#075bd8,#064dbb);
    color: #fff;
    min-height: 25px;
    padding: 5px 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: clamp(17px,2.7vw,27px);
    font-weight: 800;
    letter-spacing: .2px;
}

.action-button:active {
    transform: translateY(1px);
    filter: brightness(.95);
}

.action-button:disabled {
    opacity: .45;
    filter: grayscale(.75);
    cursor: not-allowed;
    box-shadow: none;
}

.action-button:disabled:active {
    transform: none;
    filter: grayscale(.75);
}

.action-button > i {
    width: 55px;
    text-align: center;
    font-size: 32px;
    flex-shrink: 0;
}

.action-button .divider {
    height: 45px;
    width: 2px;
    background: #ffffff80;
    flex-shrink: 0;
}

.action-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-row .action-button {
    min-height: 25px;
    gap: 10px;
    padding: 10px 15px;
}

.action-row .action-button > i {
    width: 45px;
    font-size: 28px;
}

.action-row .action-button .divider {
    height: 30px;
}

.action-row .action-button span:last-child {
    font-size: clamp(15px,2.1vw,22px);
}

/* =====================================================
   LISTA DE UBICACIONES
===================================================== */

.drawer {
    display: none;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 9999;
    background: var(--white);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: background .2s, color .2s, border-color .2s;
}

.drawer.visible {
    display: block;
}

.drawer-toggle {
    width: 100%;
    height: 48px;
    padding: 0 15px;
    border: none;
    border-radius: 0;
    background: var(--blue);
    color: #fff;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: .5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background .2s, color .2s;
    -webkit-tap-highlight-color: transparent;
}

.drawer-toggle:active {
    filter: brightness(.92);
}

.drawer-toggle i {
    font-size: 14px;
    transition: transform .3s ease;
}

.drawer-list {
    max-height: 0;
    overflow-y: auto;
    padding: 0 12px;
    background: var(--white);
    color: var(--ink);
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transition: max-height .3s ease, padding .3s ease, background .2s;
}

.drawer.open .drawer-list {
    max-height: 55vh;
    padding: 12px;
}

.drawer.open .drawer-toggle i {
    transform: rotate(180deg);
}

/* Elementos individuales QR */

.point-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 12px;
    border-radius: 10px;
    color: var(--ink);
    transition: background .2s, border-color .2s, color .2s;
}

.point-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    background: #e4efff;
    color: #0755c9;
    border-radius: 9px;
    font-size: 17px;
    flex-shrink: 0;
}

.point-info {
    flex: 1;
    min-width: 0;
}

.point-info strong {
    display: block;
    font-size: 14px;
    color: var(--ink);
}

.point-info small {
    display: block;
    color: var(--muted);
    margin-top: 4px;
}

.point-state {
    font-size: 19px;
    color: #a2adbc;
}

.point-item.done .point-state {
    color: #16a34a;
}

.delete-point-button {
    border: 0;
    border-radius: 9px;
    background: #fee2e2;
    color: #b91c1c;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    font-size: 16px;
    cursor: pointer;
}

.delete-point-button:active {
    transform: scale(.96);
}

.delete-point-button:disabled {
    opacity: .5;
    cursor: wait;
}

/* =====================================================
   NOTIFICACIONES
===================================================== */

.toast {
    position: fixed;
    z-index: 999999;
    left: 50%;
    bottom: 22px;
    transform: translate(-50%, 20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background: #102b52;
    color: #fff;
    padding: 13px 17px;
    border-radius: 12px;
    box-shadow: 0 8px 25px #0003;
    width: max-content;
    max-width: calc(100vw - 32px);
    font-size: 14px;
    text-align: center;
    white-space: pre-line;
    transition: opacity .2s, transform .2s, visibility .2s;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

#toast {
    white-space: pre-line;
    text-align: center;
}

/* =====================================================
   MODALES
===================================================== */

.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: rgba(0,0,0,.85);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-backdrop.show {
    display: flex;
}

body.client-modal-open {
    overflow: hidden;
}

#clientModal .modal {
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.modal {
    background: #fff;
    border-radius: 17px;
    width: min(480px,100%);
    max-height: 90dvh;
    overflow: auto;
    box-shadow: 0 15px 50px #0004;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 17px 19px;
    background: var(--navy);
    color: #fff;
}

.modal-header h2 {
    font-size: 19px;
    margin: 0;
}

.modal-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
}

.modal-body {
    padding: 19px;
}

.modal-body label {
    font-weight: 700;
    font-size: 13px;
    display: block;
    margin-bottom: 8px;
}

.modal-body textarea,
.modal-body input[type=text],
.modal-body select {
    width: 100%;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
}

.modal-body select:focus {
    border-color: #0759d5;
    box-shadow: 0 0 0 3px #0759d522;
}

.modal-body textarea {
    min-height: 125px;
    resize: vertical;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 0 19px 19px;
}

.btn {
    border: 0;
    border-radius: 9px;
    padding: 12px 15px;
    font-weight: 700;
    cursor: pointer;
}

.btn-secondary {
    background: #e2e8f0;
    color: #334155;
}

.btn-primary {
    background: #0759d5;
    color: #fff;
}

#reader {
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
}

.scan-help {
    font-size: 13px;
    color: #64748b;
    line-height: 1.45;
    margin-top: 10px;
}

.evidence-preview {
    display: none;
    width: 100%;
    max-height: 220px;
    object-fit: contain;
    margin-top: 12px;
    border-radius: 9px;
    background: #0f172a;
}

.footer-note {
    position: fixed;
    bottom: 5px;
    left: 0;
    width: 100%;
    text-align: center;
    color: #718096;
    font-size: 11px;
    padding: 8px 0;
    z-index: 1000;
}

.leaflet-control-attribution {
    font-size: 9px !important;
}

/* =====================================================
   ESCÁNER QR
===================================================== */

#scanModal {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    z-index: 9998;
    overflow: hidden;
    background: rgba(0,0,0,.85);
}

#scanModal.open {
    display: flex;
    align-items: stretch;
    justify-content: center;
}

#scanModal .modal {
    width: 100%;
    max-width: none;
    height: 100%;
    max-height: 100%;
    margin: 0;
    border-radius: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#scanModal .modal-header {
    flex-shrink: 0;
}

#scanModal .modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#scanModal .modal-header,
#scanModal .modal-footer,
#scanModal #manualQr {
    flex-shrink: 0;
}

#scanTitle {
    text-align: center;
    white-space: pre-line;
    width: 100%;
}

/* =====================================================
   PANTALLA DE CARGA
===================================================== */

#appLoading {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    color: #082e68;
    opacity: 1;
    visibility: visible;
    transition: opacity .22s ease, visibility .22s ease;
}

#appLoading.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loading-content {
    width: min(90vw,320px);
    text-align: center;
}

.app-loading-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 18px;
    border: 4px solid #dbe7f5;
    border-top-color: #0759d5;
    border-radius: 50%;
    animation: appLoadingSpin .75s linear infinite;
}

.app-loading-title {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: .5px;
}

.app-loading-text {
    margin-top: 7px;
    font-size: 14px;
    color: #64748b;
}

/* =====================================================
   CÁMARA
===================================================== */

.scanner-camera {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
    overflow: hidden;
    background: #000;
    border-radius: 1px;
}

#preview {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    object-fit: cover;
    background: #000;
}

.camera-loading {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: #000;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.camera-loading.oculto {
    display: none;
}

.camera-loading-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #333;
    border-top-color: #fff;
    border-radius: 50%;
    animation: cameraSpin .8s linear infinite;
}

/* Botón flotante del flash */

.btn-flash {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 10;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(15,23,42,.78);
    border: 1px solid rgba(255,255,255,.28);
    box-shadow: 0 5px 18px rgba(0,0,0,.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-size: 21px;
    cursor: pointer;
    transition: background .2s, transform .2s, box-shadow .2s;
    -webkit-tap-highlight-color: transparent;
}

.btn-flash:active {
    transform: scale(.90);
}

.btn-flash.flash-activo {
    color: #fff;
    background: #0759d5;
    border-color: #7db5ff;
    box-shadow: 0 0 0 4px rgba(7,89,213,.22), 0 0 22px rgba(30,130,255,.65);
}

/* Indicador inferior */

.scanner-status {
    position: absolute;
    left: 12px;
    bottom: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border-radius: 20px;
    color: #fff;
    background: rgba(8,15,27,.78);
    border: 1px solid rgba(255,255,255,.15);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    pointer-events: none;
}

.scanner-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #35e58b;
    box-shadow: 0 0 8px #35e58b;
}

/* =====================================================
   MENÚ LATERAL Y TEMAS
===================================================== */

.options-button {
    margin-left: auto;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border: 1px solid #ffffff33;
    border-radius: 13px;
    background: #ffffff12;
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 21px;
    cursor: pointer;
    transition: background .2s, transform .2s;
    -webkit-tap-highlight-color: transparent;
}

.options-button:active {
    transform: scale(.94);
}

.options-button:hover {
    background: #ffffff20;
}

.options-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0,0,0,.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

.options-overlay.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.options-drawer {
    position: fixed;
    z-index: 10001;
    top: 0;
    right: 0;
    width: min(340px,88vw);
    height: 100dvh;
    background: var(--white);
    color: var(--ink);
    box-shadow: -12px 0 35px rgba(0,0,0,.22);
    transform: translateX(105%);
    transition: transform .28s cubic-bezier(.22,.61,.36,1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.options-drawer.open {
    transform: translateX(0);
}

.options-header {
    min-height: 92px;
    padding: 18px 18px 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(110deg,#082d67,#0b397b);
    color: #fff;
    flex-shrink: 0;
}

.options-kicker {
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    opacity: .72;
    margin-bottom: 3px;
}

.options-header h2 {
    margin: 0;
    font-size: 24px;
}

.options-close {
    width: 42px;
    height: 42px;
    border: 1px solid #ffffff33;
    border-radius: 12px;
    background: #ffffff12;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

.options-body {
    padding: 22px 18px;
    overflow-y: auto;
}

.option-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 800;
    color: var(--ink);
    margin-bottom: 12px;
}

.option-section-title i {
    color: var(--blue);
    font-size: 18px;
}

.theme-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.theme-option {
    min-height: 72px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--bg);
    color: var(--ink);
    padding: 12px;
    display: grid;
    grid-template-columns: 28px 1fr 20px;
    align-items: center;
    gap: 6px;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s;
}

.theme-option > i:first-child {
    font-size: 18px;
    color: var(--muted);
}

.theme-option span {
    font-size: 14px;
    font-weight: 800;
}

.theme-check {
    opacity: 0;
    color: var(--blue) !important;
    font-size: 15px !important;
}

.theme-option.active {
    border-color: var(--blue);
    background: #eaf2ff;
}

.theme-option.active .theme-check {
    opacity: 1;
}

.theme-option:active {
    transform: scale(.98);
}

.theme-help {
    margin: 13px 3px 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

/* =====================================================
   CONFIRMACIÓN DE ELIMINACIÓN
===================================================== */

.delete-checkpoint-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,.72);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.delete-checkpoint-backdrop.open {
    display: flex;
}

.delete-checkpoint-modal {
    width: min(420px,100%);
    padding: 25px;
    border-radius: 18px;
    background: var(--white,#fff);
    color: var(--ink,#102b52);
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
    text-align: center;
    animation: deleteModalIn .18s ease-out;
}

.delete-checkpoint-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    margin: 0 auto 15px;
    border-radius: 50%;
    background: #fee2e2;
    color: #b91c1c;
    font-size: 27px;
}

.delete-checkpoint-modal h2 {
    margin: 0 0 12px;
    font-size: 21px;
}

.delete-checkpoint-modal p {
    margin: 0;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.delete-checkpoint-warning {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 18px;
    padding: 12px;
    border-radius: 10px;
    background: #fff1f2;
    color: #9f1239;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
}

.delete-checkpoint-warning i {
    margin-top: 2px;
}

.delete-checkpoint-actions {
    display: flex;
    gap: 10px;
    margin-top: 22px;
}

.delete-checkpoint-actions button {
    flex: 1;
    min-height: 46px;
}

.btn-danger {
    border: 0;
    border-radius: 9px;
    padding: 12px 15px;
    background: #b91c1c;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.btn-danger:disabled,
.delete-checkpoint-actions .btn-secondary:disabled {
    opacity: .55;
    cursor: wait;
}

/* =====================================================
   TEMA OSCURO
===================================================== */

html[data-theme="dark"] {
    --ink: #e6edf7;
    --muted: #9aa9bd;
    --bg: #090e16;
    --white: #111823;
    --line: #263345;
    --shadow: 0 3px 14px rgba(0,0,0,.35);
}

html[data-theme="dark"] body {
    background: #090e16;
    color: var(--ink);
}

html[data-theme="dark"] .topbar {
    box-shadow: 0 2px 10px rgba(0,0,0,.5);
}

html[data-theme="dark"] .map-card {
    background: #111923;
    border-color: #263345;
}

html[data-theme="dark"] .progress-card {
    background: #111823;
}

html[data-theme="dark"] .progress-fill {
    background: #164b82;
}

/* Lista de ubicaciones en tema oscuro */

html[data-theme="dark"] .drawer {
    background: #111823;
    color: #e6edf7;
    border-color: #263345;
}

html[data-theme="dark"] .drawer-toggle {
    background: linear-gradient(110deg,#164b82,#123f70);
    color: #e6edf7;
}

html[data-theme="dark"] .drawer-list {
    background: #111823;
    color: #e6edf7;
}

html[data-theme="dark"] .point-item {
    background: #151e2a;
    border-color: #2a384c;
    color: #e6edf7;
}

html[data-theme="dark"] .point-icon {
    background: #172b49;
    color: #76adff;
}

html[data-theme="dark"] .point-info strong {
    color: #e6edf7;
}

html[data-theme="dark"] .point-info small {
    color: #91a0b5;
}

html[data-theme="dark"] .point-state {
    color: #718096;
}

html[data-theme="dark"] .delete-point-button {
    background: #3b1d24;
    color: #ff8b9a;
}

html[data-theme="dark"] .map-controls button,
html[data-theme="dark"] .layers-button,
html[data-theme="dark"] .map-status,
html[data-theme="dark"] .map-find_me {
    background: #121a26;
    color: #e6edf7;
}

html[data-theme="dark"] .map-controls button + button {
    border-top-color: #2a384c;
}

html[data-theme="dark"] .footer-note {
    color: #718096;
}

html[data-theme="dark"] .modal {
    background: #111823;
    color: #e6edf7;
}

html[data-theme="dark"] .modal-body textarea,
html[data-theme="dark"] .modal-body input[type=text],
html[data-theme="dark"] .modal-body select {
    background: #0c131d;
    color: #e6edf7;
    border-color: #304055;
}

html[data-theme="dark"] .modal-body textarea::placeholder,
html[data-theme="dark"] .modal-body input::placeholder {
    color: #718096;
}

html[data-theme="dark"] .btn-secondary {
    background: #263345;
    color: #d9e3f0;
}

html[data-theme="dark"] .scan-help {
    color: #91a0b5;
}

html[data-theme="dark"] .options-drawer {
    background: #111823;
}

html[data-theme="dark"] .theme-option {
    background: #0c131d;
    border-color: #2b394c;
}

html[data-theme="dark"] .theme-option.active {
    background: #172b49;
    border-color: #3d82e8;
}

html[data-theme="dark"] #notesHistory > div {
    background: #151e2a !important;
    border-left-color: #3d82e8 !important;
}

html[data-theme="dark"] #notesHistory > div small {
    color: #91a0b5 !important;
}

html[data-theme="dark"] #appLoading {
    background: #090e16;
    color: #e6edf7;
}

html[data-theme="dark"] .app-loading-spinner {
    border-color: #263345;
    border-top-color: #3d82e8;
}

html[data-theme="dark"] .app-loading-text {
    color: #91a0b5;
}

html[data-theme="dark"] .leaflet-tile-pane {
    filter: brightness(.62) saturate(.82);
}

html[data-theme="dark"] .leaflet-control-attribution {
    background: rgba(10,15,23,.65) !important;
    color: #8998ad;
}

html[data-theme="dark"] body.menu-open {
    overflow: hidden;
}

html[data-theme="dark"] .client-banner,
html[data-theme="dark"] .action-button,
html[data-theme="dark"] .btn-primary {
    background: linear-gradient(110deg,#164b82,#123f70);
}

html[data-theme="dark"] .btn-flash.flash-activo {
    background: #164b82;
    border-color: #6f9fd0;
    box-shadow: 0 0 0 4px rgba(22,75,130,.22), 0 0 18px rgba(40,105,170,.45);
}

html[data-theme="dark"] .delete-checkpoint-modal {
    background: #111823;
    color: #e6edf7;
}

html[data-theme="dark"] .delete-checkpoint-icon {
    background: #3b1d24;
    color: #ff8b9a;
}

html[data-theme="dark"] .delete-checkpoint-warning {
    background: #301b24;
    color: #ffb4bf;
}

/* =====================================================
   ANIMACIONES
===================================================== */

@keyframes gpsPulse {
    0% {
        transform: scale(.4);
        opacity: .8;
    }
    70% {
        transform: scale(1.5);
        opacity: 0;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

@keyframes cameraSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes appLoadingSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes deleteModalIn {
    from {
        opacity: 0;
        transform: scale(.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =====================================================
   OPCIONES DE INICIO Y RECORRIDO
===================================================== */

#opciones_inicio,
#opciones_recorrido {
    width: 100%;
}

#opciones_inicio .action-button,
#opciones_recorrido .action-button {
    margin-top: 10px;
    width: 100%;
    box-sizing: border-box;
}

#opciones_recorrido .action-row {
    display: flex;
    width: 100%;
    gap: 10px;
}

#opciones_recorrido .action-row .action-button {
    flex: 1;
    min-width: 0;
}

#nextQrButton,
#nextQrButton[hidden] {
    display: none !important;
}

.next-qr-banner {
    cursor: pointer;
    position: relative;
    padding-right: 48px;
}

.next-qr-banner:active {
    transform: scale(.99);
}

.next-qr-arrow {
    position: absolute;
    right: 18px;
    font-size: 17px;
    opacity: .8;
}

/* =====================================================
   CHECKLIST
===================================================== */

.checklist-modal {
    width: calc(100% - 36px);
    max-width: 480px;
    max-height: 85vh;
    padding: 0;
    border: 0;
    border-radius: 18px;
    background: #fff;
    color: #172033;
    box-shadow: 0 15px 50px rgba(0,0,0,.35);
}

.checklist-modal::backdrop {
    background: rgba(0,0,0,.7);
}

.checklist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #082e68;
    color: #fff;
}

.checklist-header span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: .8;
}

.checklist-header h2 {
    font-size: 19px;
    margin: 7px 0 0;
}

.checklist-close {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,255,255,.15);
    color: #fff;
    font-size: 20px;
}

.checklist-content {
    padding: 20px;
    max-height: 55vh;
    overflow-y: auto;
}

.checklist-description {
    color: #64748b;
    font-size: 13px;
    margin: 0 0 15px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #e2e8f0;
}

.checklist-item:last-child {
    border-bottom: 0;
}

.checklist-item i {
    color: #0759d5;
    font-size: 18px;
    margin-top: 2px;
}

.checklist-item span {
    font-size: 14px;
    line-height: 1.5;
    font-weight: 600;
}

.checklist-footer {
    padding: 15px 20px;
    border-top: 1px solid #e2e8f0;
}

.checklist-footer button {
    width: 100%;
    padding: 13px;
    border: 0;
    border-radius: 10px;
    background: #0759d5;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

/* =====================================================
   AJUSTES RESPONSIVOS
===================================================== */

@media (max-width: 430px) {
    .delete-checkpoint-modal {
        padding: 21px 17px;
    }

    .delete-checkpoint-actions {
        flex-direction: column-reverse;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-loading-spinner {
        animation: none;
    }
}

/* =====================================================
   LOGIN DEL GUARDIA
===================================================== */

#guardLoginScreen {
    position: fixed;
    inset: 0;
    z-index: 1000000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #fff;
    color: #0f172a;
}

#guardLoginScreen.hidden {
    display: none;
}

.guard-login-card {
    width: min(430px,100%);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 15px 50px #0003;
}

.guard-login-header {
    background: var(--navy);
    color: #fff;
    padding: 25px 22px;
    text-align: center;
}

.guard-login-header .brand-mark {
    margin: 0 auto 12px;
}

.guard-login-header h1 {
    margin: 0;
    font-size: 22px;
}

.guard-login-header p {
    margin: 7px 0 0;
    font-size: 13px;
    opacity: .82;
}

.guard-login-body {
    padding: 22px;
}

.guard-login-step {
    display: none;
}

.guard-login-step.active {
    display: block;
}

.guard-login-step-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: #e4efff;
    color: #0759d5;
    display: grid;
    place-items: center;
    margin: 0 auto 15px;
    font-size: 26px;
}

.guard-login-title {
    text-align: center;
    margin: 0;
    font-size: 19px;
}

.guard-login-text {
    text-align: center;
    color: #64748b;
    font-size: 13px;
    line-height: 1.5;
    margin: 9px 0 18px;
}

.guard-login-client {
    display: none;
    margin: 0 0 16px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    text-align: center;
}

.guard-login-client strong {
    display: block;
    color: #0f172a;
    margin-top: 3px;
}

.guard-login-button {
    width: 100%;
    border: 0;
    border-radius: 10px;
    padding: 13px 16px;
    background: #0759d5;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.guard-login-button:disabled {
    opacity: .55;
    cursor: wait;
}

/* Tema oscuro del login */

html[data-theme="dark"] #guardLoginScreen {
    background: #090e16;
    color: #e6edf7;
}

html[data-theme="dark"] .guard-login-card {
    background: #111823;
}

html[data-theme="dark"] .guard-login-client {
    background: #0c131d;
    border-color: #304055;
}

html[data-theme="dark"] .guard-login-client strong {
    color: #e6edf7;
}

#selfieModal {
    background: #fff;
}

html[data-theme="dark"] #selfieModal {
    background: #111823;
}
