/* AR App - estilos base (mismos colores que el prototipo AR Autos) */
:root {
  --bg: #0b0b0b; --bg-2: #131416; --surface: #1b1d20; --surface-2: #232629;
  --border: rgba(255,255,255,.09); --text: #f5f6f7; --muted: #9aa1a8;
  --accent: #2c72d0; --accent-2: #5a9bf0; --accent-wash: rgba(44,114,208,.14);
  --ok: #22c55e; --error: #ef4444; --info: #5a9bf0;
  --radio: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 'Neutra2Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
a { color: var(--accent-2); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { background: var(--surface-2); padding: .1em .4em; border-radius: 6px; }
.muted { color: var(--muted); }
.centro { text-align: center; }

/* Barra superior */
.barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem;
  padding: .75rem 16px; background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.marca { display: flex; align-items: center; gap: .5rem; color: var(--text); text-decoration: none; font-weight: 700; }
.marca-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; border: 1px solid var(--border); display: block; }
.menu { display: flex; gap: .25rem; flex-wrap: wrap; }
.menu a { color: var(--muted); text-decoration: none; padding: .35rem .7rem; border-radius: 8px; }
.menu a[aria-current="page"], .menu a:hover { color: var(--text); background: var(--surface); }
.usuario { margin-left: auto; display: flex; align-items: center; gap: .9rem; font-size: .9rem; flex-wrap: wrap; }
.usuario a { color: var(--muted); }

/* Contenido */
.contenido { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.contenido.ancho { max-width: 1120px; }
.pie { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radio);
  padding: 20px; margin-bottom: 16px;
}
.card.angosta { max-width: 440px; margin: 24px auto; }
details.card summary { cursor: pointer; }
details.card[open] summary { margin-bottom: 1rem; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: .25rem; }
.stat-num { font-size: 2rem; font-weight: 700; }
.hero { text-align: center; padding: 48px 0; }
.hero h1 { font-size: 2rem; }
.acciones { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }

/* Formularios */
label { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; font-size: .92rem; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: .5rem; }
input, select {
  font: inherit; color: var(--text); background: var(--bg-2);
  border: 1px solid var(--border); border-radius: 10px; padding: .65rem .8rem; width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[disabled] { opacity: .6; }
input[type="checkbox"] { width: auto; }
.form-2col { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.form-2col .col-2, .form-2col .fila-accion { grid-column: 1 / -1; }
.fila-accion { display: flex; gap: .5rem; flex-wrap: wrap; }
.filtros { display: flex; gap: .5rem; flex-wrap: wrap; margin: 16px 0; }
.filtros input { flex: 1 1 220px; width: auto; }
.filtros select { width: auto; }

/* Botones */
.btn {
  display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 10px;
  padding: .7rem 1.2rem; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--accent-2); }
.btn-sec { background: var(--surface-2); color: var(--text); }
.btn-sec:hover { background: #2d3136; }
.btn-full { width: 100%; }
.link { background: none; border: 0; color: var(--accent-2); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
form.inline { display: inline; }

/* Alertas y etiquetas */
.alerta { border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; border: 1px solid; }
.alerta-ok { border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }
.alerta-error { border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.1); }
.alerta-info { border-color: rgba(90,155,240,.4); background: var(--accent-wash); }
.temporal { font-size: 1.1rem; user-select: all; }
.chip { display: inline-block; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.chip-admin { background: rgba(239,68,68,.15); color: #fca5a5; }
.chip-servicio { background: var(--accent-wash); color: var(--accent-2); }
.chip-cliente { background: rgba(34,197,94,.12); color: #86efac; }

pre.json { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; overflow-x: auto; font-size: .8rem; max-height: 480px; }
h3 { font-size: 1rem; margin: 1.2rem 0 .5rem; }

/* Tablas */
.tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radio); }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th, .tabla td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tabla th { color: var(--muted); font-weight: 600; background: var(--bg-2); white-space: nowrap; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.inactivo td { opacity: .5; }
.acciones-fila { white-space: nowrap; }
.acciones-fila > * + * { margin-left: .8rem; }

@media (max-width: 640px) {
  .usuario { margin-left: 0; width: 100%; }
  .hero h1 { font-size: 1.6rem; }
}

ol { padding-left: 1.2rem; line-height: 1.7; }

/* Grafica de barras simple (registros por dia) */
.barras { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 170px; padding-top: 8px; }
.barra { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.barra-v { width: 100%; max-width: 30px; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 3px; }
.barra-n { font-size: .75rem; color: var(--text); font-variant-numeric: tabular-nums; }
.barra-d { font-size: .68rem; color: var(--muted); text-align: center; line-height: 1.2; }
.stat .stat-num { font-variant-numeric: tabular-nums; }

/* Roles nuevos */
.chip-gerente_general { background: rgba(245,158,11,.15); color: #fcd34d; }
.chip-gerente_ventas { background: rgba(168,85,247,.15); color: #d8b4fe; }
.chip-ventas { background: rgba(20,184,166,.15); color: #5eead4; }

/* Matriz de permisos */
.matriz th, .matriz td { vertical-align: middle; }
.matriz tr.grupo td { background: var(--bg-2); color: var(--muted); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.matriz tr.fijo td { opacity: .7; }
.siempre { color: var(--ok); font-weight: 800; }
.interruptor { display: inline-block; position: relative; width: 42px; height: 24px; margin: 0; cursor: pointer; }
.interruptor input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.interruptor span { position: absolute; inset: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; transition: background .15s; pointer-events: none; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.interruptor input:checked + span { background: var(--accent); border-color: var(--accent); }
.interruptor input:checked + span::after { transform: translateX(18px); background: #fff; }
.interruptor input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* CRM */
.tabs-crm { display: flex; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tabs-crm a { padding: 10px 16px; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; font-weight: 600; }
.tabs-crm a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.periodos { display: flex; gap: 6px; flex-wrap: wrap; }
.periodos a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); text-decoration: none; font-size: .85rem; }
.periodos a[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.kpis { display: grid; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radio); overflow: hidden; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--surface); padding: 14px 16px; }
.kpi .l { font-size: .78rem; color: var(--muted); }
.kpi .f { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi .s { font-size: .75rem; color: var(--muted); }
.kpi.mal .f { color: #fca5a5; } .kpi.bien .f { color: #86efac; } .kpi.ojo .f { color: #fcd34d; }
.hbar { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; font-size: .88rem; }
.hbar .t { height: 22px; background: var(--bg-2); border-radius: 4px; overflow: hidden; display: flex; }
.hbar .t > div { height: 100%; }
.hbar .n { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 64px; text-align: right; font-size: .82rem; }
.hbar .lbl { text-align: right; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-azul { background: var(--accent); } .c-naranja { background: #f59e0b; } .c-rojo { background: #ef4444; } .c-verde { background: #22c55e; } .c-gris { background: #4b5563; }
.horas { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; align-items: end; height: 160px; }
.horas .h { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 3px; }
.horas .h .v { width: 100%; border-radius: 3px 3px 1px 1px; min-height: 2px; }
.horas .h small { font-size: .62rem; color: var(--muted); }
.leyenda { display: flex; gap: 16px; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.leyenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sync { font-size: .8rem; color: var(--muted); }
.estado-abierto { color: var(--accent-2); } .estado-cerrado { color: var(--muted); }

/* Servicio */
textarea { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: .65rem .8rem; width: 100%; resize: vertical; }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.estado { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; white-space: nowrap; }
.e-pendiente { background: rgba(245,158,11,.16); color: #fcd34d; }
.e-confirmada { background: var(--accent-wash); color: var(--accent-2); }
.e-taller { background: rgba(168,85,247,.16); color: #d8b4fe; }
.e-terminada { background: rgba(34,197,94,.14); color: #86efac; }
.e-cancelada, .e-noasistio { background: var(--surface-2); color: var(--muted); }
.e-noasistio { color: #fca5a5; }
.btn-mini { padding: .3rem .7rem; font-size: .8rem; border-radius: 8px; }
.btn-wa { background: #25d366; color: #04210f; }
.btn-wa:hover { background: #3be07a; }
.wa-mini { font-size: .72rem; color: #25d366; text-decoration: none; border: 1px solid rgba(37,211,102,.4); border-radius: 6px; padding: 0 .35rem; margin-left: .3rem; }
.tabla.citas td.hora { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabla.citas .acciones-fila > * + * { margin-left: .35rem; }
.dia-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.dia-nav .btn { padding: .5rem .85rem; }
.dia-form input { width: auto; }
.dia-titulo { margin-left: 6px; }
.cita-cabeza { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cita-cabeza .estado { font-size: .9rem; padding: .3rem .9rem; }
.nota-cliente { background: var(--bg-2); border-left: 3px solid var(--accent); padding: .6rem .8rem; border-radius: 6px; margin: .6rem 0 0; color: var(--text); }
.historial { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.historial li { padding: .45rem 0; border-bottom: 1px solid var(--border); }
.historial li:last-child { border-bottom: 0; }
@media (max-width: 640px) { .dia-titulo { width: 100%; margin: 4px 0 0; } .dia-nav .btn[style*="margin-left:auto"] { margin-left: 0 !important; } }
.tabla.horario input[type="time"] { width: auto; display: inline-block; padding: .45rem .5rem; }
.tabla.horario td { white-space: nowrap; }
.chip-gerente_servicio { background: rgba(59,130,246,.18); color: #93c5fd; }
.matriz .grupo-todo { font-size: .7rem; text-transform: none; letter-spacing: 0; font-weight: 600; margin-left: 10px; }
.matriz td.centro small.dep { display: block; }
.matriz { table-layout: fixed; min-width: 900px; }
.matriz th:first-child, .matriz td:first-child { width: 300px; }
.matriz thead th { white-space: normal; font-size: .82rem; line-height: 1.25; text-align: center; }
.matriz thead th:first-child { text-align: left; }
.matriz td, .matriz th { padding: .6rem .5rem; }
.matriz td:first-child, .matriz th:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; padding-left: .8rem; }
.matriz thead th:first-child, .matriz tr.grupo td:first-child { background: var(--bg-2); }
.campo { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; font-size: .92rem; }
.campo-etq { color: var(--muted); }
.casillas-suc { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; }
.casillas-suc label.check { margin: 0; color: var(--text); }
.chip-mkt { background: rgba(236,72,153,.16); color: #f9a8d4; }
.stat-link { color: var(--text); text-decoration: none; }
.stat-link:hover { border-color: var(--accent); }
.casillas-suc.apagado { opacity: .4; }
.aviso-cliente { color: #fcd34d; }
.aviso-legal h2 { margin-top: 1.8rem; }
.aviso-legal h3 { color: var(--muted); }
.aviso-legal p, .aviso-legal li { line-height: 1.65; }
.aviso-legal ul { padding-left: 1.2rem; }
label.check a { color: var(--accent-2); }
.aviso-legal h2 { margin-top: 1.8rem; }
.aviso-legal h3 { color: var(--muted); }
.aviso-legal p, .aviso-legal li { line-height: 1.65; }
.aviso-legal ul { padding-left: 1.2rem; }
label.check a { color: var(--accent-2); }

/* Analisis de competidores */
.rec-barra { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 8px; }
.rec-barra input[type=search] { flex: 1 1 240px; width: auto; }
.rec-cat { margin-top: 22px; }
.rec-cat h2 small { font-weight: 500; font-size: .8rem; margin-left: 6px; }
.rec { display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: start; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.rec.p-alta { border-left-color: #ef4444; } .rec.p-media { border-left-color: #f59e0b; } .rec.p-baja { border-left-color: var(--accent-2); }
.rec.hecho { opacity: .6; } .rec.hecho .rec-tit { text-decoration: line-through; }
.rec.pend { background: linear-gradient(90deg, rgba(245,158,11,.10), var(--surface) 40%); }
.rec.desc { opacity: .4; }
.rec-chk { width: 22px !important; height: 22px; margin-top: 2px; accent-color: #22c55e; cursor: pointer; }
.rec-tit { font-weight: 700; margin: 0 0 2px; }
.rec-desc { margin: 0; color: var(--muted); font-size: .9rem; }
.rec-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.rtag { font-size: .72rem; padding: .1rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.rtag.alta { background: rgba(239,68,68,.15); color: #fca5a5; } .rtag.media { background: rgba(245,158,11,.15); color: #fcd34d; } .rtag.baja { background: var(--accent-wash); color: var(--accent-2); }
.rtag.comp { background: rgba(168,85,247,.15); color: #d8b4fe; } .rtag.comp a { color: #e9d5ff; }
.rec-pend-tag { display: none; } .rec.pend .rec-pend-tag { display: inline-block; }
.rec-nota { margin-top: 8px; font-size: .86rem; padding: .4rem .6rem; min-height: 34px; }
.rec-acc { display: flex; flex-direction: column; gap: 6px; }
.rec-acc button { font: inherit; font-size: .78rem; border: 1px solid var(--border); background: var(--bg-2); color: var(--muted); border-radius: 8px; padding: .3rem .6rem; cursor: pointer; white-space: nowrap; }
.rec-acc button.on-p { background: rgba(245,158,11,.18); border-color: #f59e0b; color: #fcd34d; }
.rec-acc button.on-d { background: rgba(239,68,68,.15); border-color: #ef4444; color: #fca5a5; }
@media (max-width: 640px) { .rec { grid-template-columns: 26px 1fr; } .rec-acc { grid-column: 1 / -1; flex-direction: row; } }
.cmp { display: inline-block; font-size: .78rem; font-weight: 700; padding: .12rem .6rem; border-radius: 999px; text-decoration: none; }
.cmp.si { background: rgba(34,197,94,.14); color: #86efac; } .cmp.no { background: rgba(239,68,68,.12); color: #fca5a5; }
.cmp.parc { background: rgba(245,158,11,.14); color: #fcd34d; } .cmp.rev { background: var(--surface-2); color: var(--muted); }
.cmp-tabla th a { color: var(--text); }
.comp-grid .card.inactivo { opacity: .55; }

/* v0.8.1: barra roja para activar notificaciones */
.push-barra { display: flex; align-items: stretch; background: #c8102e; color: #fff; }
.push-barra[hidden] { display: none; }
.push-barra-txt { flex: 1; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; background: none; border: 0; color: inherit; font: inherit; font-size: .92rem; cursor: pointer; text-align: left; }
.push-barra-txt em { font-style: normal; font-weight: 800; background: #fff; color: #c8102e; padding: .3rem .9rem; border-radius: 999px; flex: none; }
.push-barra-x { width: 44px; background: none; border: 0; color: rgba(255,255,255,.85); font-size: 1.4rem; cursor: pointer; }

.chip-financiamiento { background: rgba(16,185,129,.15); color: #6ee7b7; }

/* Login: "Mantener mi sesion iniciada" (0.9.7) */
label.check-recordar { flex-direction: row; align-items: center; gap: .5rem; cursor: pointer; }
label.check-recordar input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: currentColor; }

/* Configuración: Interruptores de emergencia (0.9.8) */
.sw { border: 1px solid rgba(239,68,68,.35); }
.sw-cabeza { display: flex; gap: 1rem; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1rem; }
.sw-cabeza > div:first-child { flex: 1 1 420px; }
.sw-cabeza p { margin: 0; max-width: 70ch; }
.sw-estado { display: flex; flex-direction: column; padding: .7rem 1rem; border-radius: var(--radio); min-width: 200px; }
.sw-estado b { font-size: 1.15rem; }
.sw-estado span { font-size: .85rem; opacity: .9; }
.sw-estado-ok { background: rgba(34,197,94,.13); border: 1px solid rgba(34,197,94,.45); color: #86efac; }
.sw-estado-mal { background: rgba(239,68,68,.13); border: 1px solid rgba(239,68,68,.5); color: #fca5a5; }
.sw-estado-mal a { color: #fecaca; }
.sw-tabla td, .sw-tabla th { vertical-align: top; font-size: .9rem; }
.sw-tabla thead th { white-space: nowrap; }
.sw-tabla td:nth-child(1) { min-width: 150px; }
.sw-tabla td:nth-child(2), .sw-tabla td:nth-child(3) { min-width: 220px; color: var(--muted); }
.sw-tabla tr.sw-grupo th { background: var(--surface-2); color: var(--text); text-transform: uppercase; letter-spacing: .06em; font-size: .75rem; padding: .45rem .75rem; }
.sw-tabla tr.sw-off td { background: rgba(239,68,68,.08); }
.sw-tabla tr.sw-off td:first-child { box-shadow: inset 4px 0 0 var(--error); }
.sw-tabla tr.sw-on td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
.sw-col-estado { width: 150px; }
.sw-form { margin: 0; }
.sw-boton { display: flex; flex-direction: row; align-items: center; gap: .55rem; margin: 0; cursor: pointer; color: var(--text); }
.sw-boton b { font-size: .78rem; letter-spacing: .05em; }
.sw-on .sw-boton b { color: var(--ok); }
.sw-off .sw-boton b { color: var(--error); }
.sw .interruptor input:checked + span { background: var(--ok); border-color: var(--ok); }
.sw-off .interruptor span { background: rgba(239,68,68,.35); border-color: var(--error); }
.sw-acciones { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: flex-start; margin: 1.25rem 0; padding-top: 1rem; border-top: 1px solid var(--border); }
.sw-acciones form { margin: 0; }
.sw-sesiones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; max-width: 560px; }
.sw-sesiones input { width: 200px; margin: 0; }
.sw-sesiones small { flex-basis: 100%; }
.sw-pie { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.sw-pie h3 { font-size: 1rem; margin: 0 0 .5rem; }
.sw-lista { list-style: none; padding: 0; margin: 0 0 .75rem; display: grid; gap: .4rem; font-size: .9rem; }
.sw-log li { display: flex; gap: .5rem; flex-wrap: wrap; }
.txt-off { color: var(--error); }
.sw-autorizar { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.sw-autorizar select { flex: 1 1 220px; margin: 0; }
@media (max-width: 760px) {
  .sw-tabla thead { display: none; }
  .sw-tabla, .sw-tabla tbody, .sw-tabla tr, .sw-tabla td, .sw-tabla th { display: block; width: 100%; }
  .sw-tabla tr:not(.sw-grupo) { border-bottom: 1px solid var(--border); padding: .6rem .2rem; position: relative; }
  .sw-tabla td { border: 0; padding: .2rem .75rem; min-width: 0 !important; }
  .sw-tabla td[data-l]:not(:first-child)::before { content: attr(data-l) ": "; font-weight: 700; color: var(--text); }
  .sw-tabla td.sw-col-estado { padding-top: .5rem; }
  .sw-tabla tr.sw-off td, .sw-tabla tr.sw-on td { box-shadow: none; }
  .sw-tabla tr.sw-off { background: rgba(239,68,68,.08); box-shadow: inset 4px 0 0 var(--error); }
  .sw-tabla tr.sw-on { box-shadow: inset 4px 0 0 var(--ok); }
}
/* Jerarquía: Inventario (padre) y sus hijos */
.sw-tabla tr.sw-padre td { background: rgba(44,114,208,.07); }
.sw-tabla tr.sw-padre td:first-child b { font-size: 1rem; }
.sw-tabla tr.sw-nivel-1 td:first-child { padding-left: 1.6rem; }
.sw-tabla tr.sw-nivel-2 td:first-child { padding-left: 2.8rem; }
.sw-rama { color: var(--muted); margin-right: .35rem; }
.sw-dep { display: block; color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.sw-dep-off { color: #fca5a5; }
.sw-tabla tr.sw-bloq td { opacity: .55; }
.sw-tabla tr.sw-bloq td.sw-col-estado { opacity: 1; }
.sw-tabla tr.sw-bloq td:first-child { box-shadow: inset 4px 0 0 #7f1d1d; }
.sw-bloq .sw-boton b { color: var(--error); }
@media (max-width: 760px) {
  .sw-tabla tr.sw-nivel-1, .sw-tabla tr.sw-nivel-2 { padding-left: .9rem; }
  .sw-tabla tr.sw-nivel-1 td:first-child, .sw-tabla tr.sw-nivel-2 td:first-child { padding-left: .75rem; }
  .sw-tabla tr.sw-bloq { box-shadow: inset 4px 0 0 #7f1d1d; }
}
.sw .sw-bloq .interruptor input:checked + span { background: var(--surface-2); border-color: var(--border); }
.sw .sw-bloq .interruptor input:checked + span::after { background: var(--muted); }
/* Botones de pánico (0.9.9) */
.sw-panico { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .9rem; margin: 1.25rem 0 0; }
.sw-panico-caja { border-radius: var(--radio); padding: 1rem; display: flex; flex-direction: column; }
.sw-panico-caja h3 { margin: 0 0 .35rem; font-size: 1.05rem; }
.sw-panico-caja p { margin: 0 0 .8rem; font-size: .88rem; color: var(--muted); flex: 1; }
.sw-panico-caja form { display: flex; gap: .5rem; flex-wrap: wrap; margin: 0; }
.sw-panico-caja input { flex: 1 1 140px; margin: 0; }
.sw-panico-cli { background: rgba(249,115,22,.1); border: 1px solid rgba(249,115,22,.45); }
.sw-panico-cli h3 { color: #fdba74; }
.sw-panico-todo { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.55); }
.sw-panico-todo h3 { color: #fca5a5; }
.sw-panico-on { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.45); }
.sw-panico-on h3 { color: #86efac; }
.btn-naranja { background: #ea580c; }
.btn-rojo { background: #b91c1c; }
.btn-verde { background: #16a34a; }
.sw-panico .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- Configuración → Plantillas ---------- */
.tpl-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.tpl-op { border: 1px solid var(--border); border-radius: 16px; overflow: hidden; background: var(--bg-2); display: flex; flex-direction: column; }
.tpl-op.actual { border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.35); }
.tpl-op img { width: 100%; aspect-ratio: 16/10; object-fit: cover; object-position: top left; display: block; border-bottom: 1px solid var(--border); }
.tpl-op div { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.tpl-op b { font-size: .98rem; }
.tpl-op p { margin: 0; color: var(--muted); font-size: .84rem; flex: 1; }
.tpl-op form { margin: .3rem 0 0; }
.tpl-op .en-uso { color: #4ade80; font-weight: 800; font-size: .85rem; }
/* Configuración → Plantilla de inicio de sesión */
.login-conf { display: grid; grid-template-columns: 280px 1fr; gap: 20px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.login-foto-act img { width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); display: block; }
@media (max-width: 760px) { .login-conf { grid-template-columns: 1fr; } }

/* Roles → Permisos sugeridos (0.9.15) */
details.sug summary { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.sug-lista { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 12px; }
.sug-rol { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--bg-2); display: flex; flex-direction: column; gap: .6rem; }
.sug-cab { display: flex; justify-content: space-between; align-items: baseline; }
.sug-g { font-size: .85rem; font-weight: 700; }
.sug-g ul { margin: .3rem 0 0; padding-left: 1.1rem; font-weight: 400; color: var(--muted); line-height: 1.5; }
.sug-mas { color: #86efac; } .sug-menos { color: #fcd34d; }
.sug-rol .fila-accion { margin-top: auto; }

/* Datos de la agencia (0.9.16) */
.ag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.ag-grid .card { margin-bottom: 0; }
.ag-form > .fila-accion { margin-top: 16px; }
.ag-sucs { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.ag-suc { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--bg-2); }
.ag-suc > b { display: block; margin-bottom: .7rem; }

/* Buscadores del panel (0.9.17) */
kbd { font: 600 .68rem/1 system-ui, sans-serif; padding: .2rem .38rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.bus-abrir { display: flex; align-items: center; gap: .55rem; width: 100%; margin: 0 0 6px; padding: .55rem .7rem; border-radius: 11px; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); color: #8b93a1; font: inherit; font-size: .86rem; text-align: left; }
.bus-abrir:hover { color: #fff; border-color: rgba(59,130,246,.5); }
.bus-abrir span { flex: 1; }
.bus-clasica { width: auto; margin: 0; min-width: 190px; }
.bus-movil { margin-left: auto; }
.bus-fondo { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; opacity: 0; transition: opacity .15s; }
.bus-fondo[hidden] { display: none; }
.bus-fondo.show { opacity: 1; }
.bus-caja { width: 100%; max-width: 620px; background: #111318; border: 1px solid #262a31; border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.6); overflow: hidden; transform: translateY(-8px) scale(.98); transition: transform .15s; }
.bus-fondo.show .bus-caja { transform: none; }
.bus-in { display: flex; align-items: center; gap: .7rem; padding: 14px 16px; border-bottom: 1px solid #1f232a; color: #8b93a1; }
.bus-in input { border: 0; background: none; outline: none; padding: .3rem 0; font-size: 1.05rem; color: #fff; }
.bus-in input:focus { outline: none; }
.bus-res { max-height: 56vh; overflow-y: auto; padding: 6px; }
.bus-grupo { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: #5b6270; font-weight: 700; padding: 10px 12px 4px; }
.bus-it { display: flex; align-items: center; gap: .75rem; padding: .62rem .75rem; border-radius: 11px; color: #d1d5db; text-decoration: none; }
.bus-it svg { flex: none; color: #8b93a1; }
.bus-it.on, .bus-it:hover { background: rgba(44,114,208,.22); color: #fff; }
.bus-it.on svg { color: #93c5fd; }
.bus-t { flex: 1; min-width: 0; }
.bus-g { font-size: .75rem; color: #6b7280; white-space: nowrap; }
.bus-it mark, .bus-pag-it mark { background: rgba(250,204,21,.28); color: inherit; border-radius: 3px; padding: 0 1px; }
.bus-vacio { padding: 18px; text-align: center; color: #8b93a1; font-size: .9rem; }
.bus-pie { display: flex; gap: 1.2rem; padding: 10px 16px; border-top: 1px solid #1f232a; font-size: .74rem; color: #6b7280; flex-wrap: wrap; }
.bus-pie kbd { margin-right: .2rem; }
body.bus-abierto { overflow: hidden; }
/* Barra «Buscar en esta pestaña» */
.bus-pag { position: sticky; top: 8px; z-index: 25; display: flex; align-items: center; gap: .5rem; margin: 0 0 18px; padding: 6px 8px 6px 12px;
  background: rgba(17,19,24,.88); backdrop-filter: blur(10px); border: 1px solid var(--border); border-radius: 13px; color: var(--muted); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.bus-pag input { border: 0; background: none; padding: .45rem .2rem; font-size: .92rem; }
.bus-pag input:focus { outline: none; }
.bus-pag:focus-within { border-color: rgba(59,130,246,.6); }
.bus-pag-n { font-size: .78rem; white-space: nowrap; }
.bus-pag > button { background: var(--surface-2); border: 0; color: var(--text); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; font-size: .95rem; flex: none; }
.bus-pag-lista { position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: 50vh; overflow-y: auto; background: #111318; border: 1px solid #262a31; border-radius: 13px; padding: 6px; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.bus-pag-lista[hidden] { display: none; }
.bus-pag-it { display: block; width: 100%; text-align: left; background: none; border: 0; color: #d1d5db; font: inherit; font-size: .88rem; padding: .55rem .7rem; border-radius: 9px; cursor: pointer; }
.bus-pag-it small { display: block; color: #6b7280; font-size: .72rem; margin-bottom: .1rem; }
.bus-pag-it:hover, .bus-pag-it:focus { background: rgba(44,114,208,.22); outline: none; color: #fff; }
.bus-hit { outline: 2px solid #facc15 !important; outline-offset: 3px; border-radius: 6px; background-color: rgba(250,204,21,.1) !important; animation: busHit 1.6s ease-out; }
@keyframes busHit { 0% { outline-color: rgba(250,204,21,1); } 100% { outline-color: rgba(250,204,21,.55); } }
@media (max-width: 900px) { .bus-pag { top: 62px; } .bus-pag-n { display: none; } .bus-fondo { padding-top: 8vh; } }
.tpl-clasica .bus-pag { top: 8px; }

/* Citas: ejemplos y eliminar (0.9.22) */
.demo-barra { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .6rem .9rem; margin: 0 0 14px; border: 1px dashed rgba(250,204,21,.5); background: rgba(250,204,21,.07); border-radius: 12px; font-size: .88rem; }
.demo-barra > span { flex: 1 1 260px; }
.zona-borrar { display: flex; gap: 1rem; align-items: center; justify-content: space-between; border-color: rgba(239,68,68,.45); }
/* 0.9.23 Regresar / Eliminar en la lista, columna VIN */
.btn-borrar { background: rgba(239,68,68,.14); color: #fca5a5; border: 1px solid rgba(239,68,68,.45); box-shadow: none; }
.btn-borrar:hover { background: rgba(239,68,68,.28); color: #fff; }
.btn-regresar { opacity: .85; }
.tabla.citas td.vin code { font-size: .78rem; letter-spacing: .03em; white-space: nowrap; }
.tabla.citas .acciones-fila { white-space: normal; min-width: 210px; line-height: 2.3; }
.demo-barra label.inline { display: inline-flex; align-items: center; gap: .4rem; }
.chip-crm { background: rgba(20,184,166,.16); color: #5eead4; }
/* 0.9.25 Asignar asesor */
.asignar-mini select { font-size: .78rem; padding: .22rem .4rem; border-radius: 8px; min-width: 150px; max-width: 190px; margin-top: .3rem; }
form.asignar select { max-width: 320px; }
/* 0.9.30 Vista previa de las plantillas de Inicio de la app */
.tpl-op .ini-prev { aspect-ratio: 16/10; padding: 14px 22%; display: flex; flex-direction: column; gap: 6px; background: #0b0b0b; border-bottom: 1px solid var(--border); flex: none; }
.ini-prev i { display: block; border-radius: 6px; background: #1b1d20; border: 1px solid rgba(255,255,255,.08); }
.ini-clasica i:nth-child(1) { height: 34%; background: radial-gradient(120% 140% at 10% 0%, #1c3f6e, #0b0b0b 70%); }
.ini-clasica i:nth-child(2) { height: 10%; } .ini-clasica i:nth-child(3) { height: 14%; } .ini-clasica i:nth-child(4) { height: 14%; } .ini-clasica i:nth-child(5) { flex: 1; }
.ini-ventas i:nth-child(1) { height: 9%; } .ini-ventas i:nth-child(2) { height: 40%; background: linear-gradient(0deg, #0b0b0b, #34506f); }
.ini-ventas i:nth-child(3) { height: 11%; } .ini-ventas i:nth-child(4) { flex: 1; background: repeating-linear-gradient(90deg, #232629 0 30%, transparent 30% 35%); border: 0; }
.ini-ventas i:nth-child(5) { height: 10%; background: #123a2a; border-color: rgba(37,211,102,.3); }
