* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, sans-serif; padding: 1rem; background: #1e1e1e; color: #eee; min-height: 100vh; }

.step-bar { display: flex; gap: 6px; margin-bottom: 20px; }
.step { flex: 1; height: 3px; border-radius: 2px; background: #444; }
.step.active { background: #185FA5; }
.step.done { background: #1D9E75; }

.section-title { font-size: 22px; font-weight: 500; color: #eee; margin-bottom: 4px; text-align: center; }
.section-sub { font-size: 14px; color: #888; margin-bottom: 16px; text-align: center; }

.terr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-bottom: 18px; }
.terr-btn { background: #2a2a2a; border: 0.5px solid #444; border-radius: 10px; padding: 14px 8px; cursor: pointer; text-align: center; transition: border-color 0.15s; }
.terr-btn:hover { border-color: #666; }
.terr-btn.selected { border: 1.5px solid #378ADD; background: #0c2a45; }
.terr-btn.en-progreso { border: 1.5px solid #EF9F27; background: #2e1e00; }
.terr-btn.en-progreso.selected { border: 1.5px solid #378ADD; background: #0c2a45; }
.terr-num { font-size: 26px; font-weight: 500; color: #eee; }
.terr-btn.selected .terr-num { color: #85B7EB; }
.terr-date { font-size: 11px; color: #888; margin-top: 5px; }
.terr-days { font-size: 14px; font-weight: 600; margin-top: 5px; }
.days-old { color: #F09595; }
.days-mid { color: #FAC775; }
.days-new { color: #C0DD97; }
.badge-progreso { font-size: 10px; font-weight: 500; color: #FAC775; background: #2e1e00; border: 0.5px solid #EF9F27; border-radius: 4px; padding: 1px 5px; margin-top: 4px; display: inline-block; }

.step1-footer { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.step1-footer span { font-size: 13px; color: #888; }

.loading-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3rem 1rem; gap: 14px; }
.spinner { width: 32px; height: 32px; border: 3px solid #333; border-top-color: #1D9E75; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-txt { font-size: 14px; color: #888; }
.error-wrap { background: #2e1a1a; border: 0.5px solid #A32D2D; border-radius: 10px; padding: 1rem 1.25rem; margin-bottom: 16px; font-size: 13px; color: #F09595; }

.salida-card { background: #2a2a2a; border: 0.5px solid #444; border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 10px; }
.salida-card.card-mar { border-left: 3px solid #378ADD; }
.salida-card.card-thu { border-left: 3px solid #EF9F27; }
.salida-card.card-fri { border-left: 3px solid #639922; }
.salida-card.tel-card { border-left: 3px solid #1D9E75; background: #0d2420; }
.salida-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.salida-label { font-size: 16px; font-weight: 500; color: #eee; }
.phone-badge { font-size: 13px; background: #0a2e24; color: #5DCAA5; padding: 3px 10px; border-radius: 20px; border: 0.5px solid #1D9E75; }
.dia-label { font-size: 20px; font-weight: 700; letter-spacing: 0.01em; }
.dia-martes { color: #85B7EB; }
.dia-jueves { color: #FAC775; }
.dia-viernes { color: #C0DD97; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
select, input[type=text], input[type=date], input[type=time] { width: 100%; font-size: 13px; padding: 6px 8px; border: 0.5px solid #555; border-radius: 8px; background: #1e1e1e; color: #eee; }
select option { background: #2a2a2a; color: #eee; }
label { font-size: 12px; color: #888; display: block; margin-bottom: 3px; }

.btn-primary { padding: 10px 16px; font-size: 14px; font-weight: 500; background: #185FA5; color: white; border: none; border-radius: 8px; cursor: pointer; }
.btn-primary:hover { background: #0C447C; }
.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-secondary { padding: 10px 16px; font-size: 14px; border: 0.5px solid #555; border-radius: 8px; background: #2a2a2a; color: #ccc; cursor: pointer; }
.btn-secondary:hover { background: #333; }
.btn-autofill { font-size: 14px; padding: 8px 16px; background: #1a2e0a; color: #97C459; border: 0.5px solid #3B6D11; border-radius: 8px; cursor: pointer; }
.btn-clear { font-size: 14px; padding: 8px 16px; background: #2e1a1a; color: #F09595; border: 0.5px solid #A32D2D; border-radius: 8px; cursor: pointer; }
.btn-save { padding: 10px 16px; font-size: 14px; font-weight: 500; background: #1D9E75; color: white; border: none; border-radius: 8px; cursor: pointer; }
.btn-save:hover { background: #0F6E56; }

/* ── Modo selector ── */
.modo-wrap { min-height: calc(100vh - 4rem); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 2rem 1rem; }
.modo-titulo { font-size: 48px; font-weight: 500; color: #ccc; margin-bottom: 20px; text-align: center; }
.grupo-color-1 { color: #378ADD; }
.grupo-color-2 { color: #EF9F27; }
.grupo-color-3 { color: #97C459; }
.grupo-color-4 { color: #D85A30; }
.grupo-color-C { color: #7F77DD; }
.modo-card { width: 100%; max-width: 320px; background: #2a2a2a; border: 1.5px solid #444; border-radius: 14px; padding: 1.25rem 1.5rem; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 16px; transition: border-color 0.15s, background 0.15s, transform 0.1s; }
.modo-card:hover { transform: scale(1.02); }
.modo-card:active { transform: scale(0.98); }
.modo-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.modo-icon-plan { background: rgba(55,138,221,0.15); }
.modo-icon-reg { background: rgba(29,158,117,0.15); }
.modo-card-title { font-size: 16px; font-weight: 500; color: #eee; margin-bottom: 3px; }
.modo-card-sub { font-size: 13px; color: #888; }

/* ── Registro de territorios ── */
.reg-card { background: #2a2a2a; border: 0.5px solid #444; border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 10px; }
.reg-card.completado { border-left: 3px solid #1D9E75; opacity: 0.6; }
.reg-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.reg-terr { font-size: 18px; font-weight: 500; color: #eee; }
.reg-ini { font-size: 12px; color: #888; }
.toggle-wrap { display: flex; gap: 8px; margin-bottom: 10px; }
.toggle-btn { flex: 1; padding: 7px; font-size: 13px; border-radius: 8px; border: 0.5px solid #555; background: #1e1e1e; color: #aaa; cursor: pointer; }
.toggle-btn.active-comp { background: #0d2e1a; border-color: #1D9E75; color: #5DCAA5; }
.toggle-btn.active-prog { background: #2e1e00; border-color: #EF9F27; color: #FAC775; }
.reg-empty { text-align: center; padding: 2rem; color: #888; font-size: 14px; }
.btn-guardar { width: 100%; padding: 12px; font-size: 15px; font-weight: 500; background: #1D9E75; color: white; border: none; border-radius: 8px; cursor: pointer; margin-top: 8px; }
.btn-guardar:hover { background: #0F6E56; }
.btn-guardar:disabled { opacity: 0.35; cursor: not-allowed; }
.save-status { text-align: center; font-size: 13px; margin-top: 10px; min-height: 20px; }

/* ── Animaciones de transición ── */
.view { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.btn-registrar-prog { width: 100%; padding: 11px; font-size: 14px; font-weight: 500; background: #2e1e00; color: #FAC775; border: 1.5px solid #EF9F27; border-radius: 8px; cursor: pointer; margin-top: 8px; }
.btn-registrar-prog:hover { background: #3a2500; }
.btn-registrar-prog:disabled { opacity: 0.4; cursor: not-allowed; }
.reg-prog-status { text-align: center; font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ── Historial de salidas ── */
.hist-registro-group { background: #2a2a2a; border: 0.5px solid #444; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.hist-registro-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.hist-registro-fecha { font-size: 13px; font-weight: 500; color: #97C459; }
.hist-registro-del { font-size: 11px; padding: 3px 8px; border: 0.5px solid #A32D2D; border-radius: 6px; background: #2e1a1a; color: #F09595; cursor: pointer; }
.hist-registro-del:hover { background: #3a2020; }
.hist-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 0.5px solid #333; }
.hist-row:last-child { border-bottom: none; }
.hist-row-terr { font-size: 14px; font-weight: 500; color: #eee; min-width: 60px; }
.hist-row-dia { font-size: 12px; color: #FAC775; min-width: 70px; }
.hist-row-cond { font-size: 12px; color: #888; flex: 1; }
.hist-row-hora { font-size: 12px; color: #aaa; min-width: 40px; text-align: right; }
.hist-row-tel { color: #5DCAA5; }

/* ── Planificador flexible ── */
.plan-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; padding-right: 196px; }
.plan-titulo { font-size: 20px; font-weight: 500; color: #eee; }
.plan-btns { display: flex; gap: 8px; align-items: center; }
.btn-add-salida { font-size: 13px; padding: 7px 12px; background: #1a2e0a; color: #97C459; border: 0.5px solid #3B6D11; border-radius: 8px; cursor: pointer; }
.btn-add-tel { font-size: 13px; padding: 7px 12px; background: #0a2e24; color: #5DCAA5; border: 0.5px solid #1D9E75; border-radius: 8px; cursor: pointer; }
.btn-mapa-plan { display: none; }

.btn-mapa-view { display: none; }

.salida-card-new { background: #2a2a2a; border: 0.5px solid #444; border-radius: 12px; padding: 1rem 1.25rem; margin-bottom: 10px; position: relative; }
.salida-card-new.tipo-campo { border-left: 3px solid #378ADD; }
.salida-card-new.tipo-tel { border-left: 3px solid #1D9E75; background: #0d2420; }
.salida-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.salida-card-label { font-size: 15px; font-weight: 500; color: #eee; }
.salida-remove-btn { font-size: 13px; padding: 3px 10px; border: 0.5px solid #A32D2D; border-radius: 6px; background: #2e1a1a; color: #F09595; cursor: pointer; }
.salida-remove-btn:hover { background: #3a2020; }
.plan-footer { display: flex; gap: 8px; margin-top: 8px; }
.salida-count { font-size: 12px; color: #888; text-align: center; margin-bottom: 10px; }

/* ── Cover ── */
.cover { min-height: calc(100vh - 2rem); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; text-align: center; }
.cover-icon { width: 80px; height: 80px; background: rgba(59,109,17,0.25); border-radius: 22px; display: flex; align-items: center; justify-content: center; margin-bottom: 28px; }
.cover-title { font-size: 62px; font-weight: 500; color: #97C459; line-height: 1.1; margin-bottom: 10px; }
.cover-subtitle { font-size: 22px; color: #639922; letter-spacing: 0.04em; margin-bottom: 52px; }
.grupo-label { font-size: 20px; font-weight: 500; color: #ccc; margin-bottom: 16px; }
.grupo-grid { display: flex; gap: 10px; margin-bottom: 36px; flex-wrap: wrap; justify-content: center; width: 100%; }
.grupo-btn { width: 64px; height: 64px; border-radius: 14px; border: 1.5px solid #444; background: #2a2a2a; font-size: 22px; font-weight: 500; color: #aaa; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.1s; }
.grupo-btn:hover { transform: scale(1.08); }
.grupo-btn:active { transform: scale(0.96); }
.grupo-btn.selected { border-width: 2px; }
.btn-start { padding: 14px 48px; font-size: 16px; font-weight: 500; background: #3B6D11; color: #fff; border: none; border-radius: 12px; cursor: pointer; opacity: 0.3; pointer-events: none; letter-spacing: 0.02em; }
.btn-start.enabled { opacity: 1; pointer-events: auto; }
.btn-start.enabled:hover { background: #27500A; }

/* ── Panel de info del grupo ── */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-bottom: 16px; }
.info-btn { background: #2a2a2a; border: 0.5px solid #444; border-radius: 10px; padding: 10px 6px; text-align: center; cursor: pointer; }
.info-btn:hover { border-color: #666; }
.info-btn.estado-normal { border-color: #444; }
.info-btn.estado-peligroso { border: 1.5px solid #EF9F27; background: #2e1e00; }
.info-btn.estado-no_predica { border: 1.5px solid #A32D2D; background: #2e1a1a; }
.info-btn-num { font-size: 20px; font-weight: 500; color: #eee; }
.info-btn-date { font-size: 10px; color: #888; margin-top: 3px; }
.info-btn-days { font-size: 13px; font-weight: 600; margin-top: 2px; }
.info-btn-estado { font-size: 10px; font-weight: 500; margin-top: 3px; }
.info-btn.estado-peligroso .info-btn-estado { color: #FAC775; }
.info-btn.estado-no_predica .info-btn-estado { color: #F09595; }
.info-btn.estado-normal .info-btn-estado { color: #888; }
.info-legend { display: flex; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #888; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }

/* ── Modal territorio ── */
.estado-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem; box-sizing: border-box; }
.estado-modal-card { background: #2a2a2a; border: 0.5px solid #555; border-radius: 18px; padding: 1.75rem; width: 100%; max-width: 680px; max-height: 90vh; overflow-y: auto; box-sizing: border-box; }
.estado-modal-title { font-size: 26px; font-weight: 500; color: #eee; margin-bottom: 4px; text-align: center; }
.estado-modal-sub { font-size: 13px; color: #888; margin-bottom: 16px; text-align: center; }
.estado-opt { display: inline-flex; align-items: center; justify-content: center; width: calc(33% - 6px); padding: 9px 8px; font-size: 12px; font-weight: 500; border-radius: 10px; border: 1.5px solid; cursor: pointer; margin-bottom: 8px; text-align: center; transition: transform 0.1s, opacity 0.1s; }
.estado-opt:hover { transform: scale(1.01); opacity: 0.9; }
.estado-opt:active { transform: scale(0.98); }
.estado-opt.opt-normal { background: #0d2e1a; border-color: #1D9E75; color: #5DCAA5; }
.estado-opt.opt-normal:hover { background: #0f3d22; }
.estado-opt.opt-peligroso { background: #2e1e00; border-color: #EF9F27; color: #FAC775; }
.estado-opt.opt-peligroso:hover { background: #3a2500; }
.estado-opt.opt-no_predica { background: #2e1a1a; border-color: #A32D2D; color: #F09595; }
.estado-opt.opt-no_predica:hover { background: #3a2020; }
.hist-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: 14px; }
.hist-table th { color: #888; font-weight: 500; padding: 8px 8px; text-align: left; border-bottom: 0.5px solid #444; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.hist-table td { padding: 10px 8px; border-bottom: 0.5px solid #333; color: #eee; vertical-align: middle; }
.hist-table tr:last-child td { border-bottom: none; }
.hist-edit-btn { font-size: 12px; padding: 4px 10px; border: 0.5px solid #555; border-radius: 6px; background: #1e1e1e; color: #aaa; cursor: pointer; margin-right: 4px; }
.hist-edit-btn:hover { border-color: #888; color: #eee; }
.hist-del-btn { font-size: 12px; padding: 4px 10px; border: 0.5px solid #A32D2D; border-radius: 6px; background: #2e1a1a; color: #F09595; cursor: pointer; }
.hist-del-btn:hover { background: #3a2020; }
.btn-add-entry { width: 100%; padding: 10px; font-size: 13px; border: 1px dashed #555; border-radius: 8px; background: transparent; color: #888; cursor: pointer; margin-bottom: 14px; }
.btn-add-entry:hover { border-color: #888; color: #eee; }
.edit-row-form { background: #1e1e1e; border: 0.5px solid #555; border-radius: 8px; padding: 10px; margin-bottom: 10px; }
.edit-row-title { font-size: 12px; color: #888; margin-bottom: 8px; }
.modal-divider { border: none; border-top: 0.5px solid #444; margin: 16px 0; }
.modal-section-title { font-size: 15px; font-weight: 500; color: #ccc; letter-spacing: 0.02em; margin-bottom: 12px; text-align: center; }
.hist-en-prog { font-size: 10px; color: #FAC775; background: #2e1e00; border: 0.5px solid #EF9F27; border-radius: 4px; padding: 1px 5px; }

/* ── Vista previa / tabla final ── */
.preview-header-wrap { margin-bottom: 20px; }
.preview-tag { font-size: 13px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: #888; margin-bottom: 8px; }
.preview-title-line { font-size: 32px; font-weight: 500; line-height: 1.2; }
.preview-sep { color: #555; margin: 0 8px; }
.card-preview { background: #2a2a2a; border: 2px solid #444; border-radius: 16px; overflow: hidden; }
.card-preview-header { padding: 14px 18px 12px; border-bottom: 0.5px solid #444; }
.card-preview-top { font-size: 11px; font-weight: 500; color: #888; letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 2px; }
.card-preview-main { font-size: 17px; font-weight: 500; color: #eee; }
table.preview { width: 100%; border-collapse: collapse; }
table.preview th { background: #111; color: #fff; padding: 11px 10px; text-align: center; font-size: 13px; font-weight: 500; letter-spacing: 0.04em; border-right: 0.5px solid rgba(255,255,255,0.08); }
table.preview th:last-child { border-right: none; }
table.preview td { padding: 10px 10px; text-align: center; border-bottom: 0.5px solid #3a3a3a; color: #eee; background: #2a2a2a; vertical-align: middle; }
table.preview tr:last-child td { border-bottom: none; }
table.preview tr:nth-child(odd) td { background: #242424; }
table.preview tr.tel-row td { background: #0d2420; }
table.preview tr.tel-row td:first-child { border-left: 3px solid #1D9E75; }
.tel-terr { font-size: 14px; font-weight: 500; color: #5DCAA5; letter-spacing: 0.05em; text-transform: uppercase; }
.dia-badge { display: inline-block; font-size: 14px; font-weight: 500; padding: 4px 12px; border-radius: 20px; margin-bottom: 3px; }
.badge-mar { background: #0c2a45; color: #85B7EB; }
.badge-jue { background: #2e1e00; color: #FAC775; }
.badge-vie { background: #1a2e0a; color: #C0DD97; }
.terr-num-big { font-size: 18px; font-weight: 500; color: #eee; }
.fecha-num { font-size: 13px; color: #aaa; margin-top: 2px; }
.cond-txt { font-size: 14px; font-weight: 500; color: #ddd; }
.hora-txt { font-size: 15px; font-weight: 500; color: #eee; }

/* ── PIN modal ── */
.pin-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 1rem; box-sizing: border-box; }
.pin-card { background: #2a2a2a; border: 2px solid #555; border-radius: 22px; padding: 2rem 1.5rem; width: 100%; max-width: 300px; text-align: center; }
.pin-title { font-size: 24px; font-weight: 500; color: #eee; margin-bottom: 4px; }
.pin-sub { font-size: 13px; color: #888; margin-bottom: 24px; }
.pin-dots { display: flex; gap: 16px; justify-content: center; margin-bottom: 28px; }
.pin-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #555; background: transparent; transition: background 0.15s, border-color 0.15s, transform 0.1s; }
.pin-dot.filled { transform: scale(1.1); }
.pin-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.pin-btn { padding: 18px; font-size: 24px; font-weight: 500; border-radius: 14px; border: 0.5px solid #444; background: #1e1e1e; color: #eee; cursor: pointer; transition: background 0.1s, transform 0.1s; }
.pin-btn:hover { background: #333; }
.pin-btn:active { transform: scale(0.92); background: #444; }
.pin-btn.pin-del { font-size: 18px; color: #F09595; border-color: #A32D2D; background: #2e1a1a; }
.pin-btn.pin-del:hover { background: #3a2020; }
.pin-error { font-size: 13px; color: #F09595; min-height: 20px; margin-top: 4px; }
.pin-cancel { font-size: 13px; color: #888; background: none; border: none; cursor: pointer; margin-top: 10px; text-decoration: underline; }

/* ── Botón home ── */
.btn-home { position: fixed; top: 14px; right: 14px; width: 80px; height: 80px; border-radius: 16px; border: 0.5px solid #555; background: #2a2a2a; color: #aaa; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 50; transition: background 0.15s, color 0.15s; }
.btn-home:hover { background: #333; color: #eee; }
.btn-home.visible { display: flex; }
.btn-home.hidden-in-plan { display: none !important; }
.btn-mapa-float { position: fixed; top: 14px; right: 108px; width: 80px; height: 80px; border-radius: 16px; border: 0.5px solid #4A44A5; background: #1a1a2e; color: #7F77DD; cursor: pointer; display: none; align-items: center; justify-content: center; z-index: 50; transition: background 0.15s, color 0.15s; flex-direction: column; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.btn-mapa-float:hover { background: #22224a; color: #a09aff; }
.btn-mapa-float.visible { display: flex; }
.btn-home.hidden-in-plan { display: none !important; }

/* ── Encabezado tabla final por grupo ── */
.preview-header-wrap { margin-bottom: 16px; }
.preview-tag { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px; }
.preview-title-line { font-size: 26px; font-weight: 500; line-height: 1.2; }
.preview-sep { color: #555; margin: 0 6px; }

/* ── Offline banner ── */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #2e1a1a;
  border-bottom: 1.5px solid #A32D2D;
  color: #F09595;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 10px;
  z-index: 999;
  display: none;
}
.offline-banner.visible {
  display: block;
}









