/* ============================================================
   COTIZA Y COBRA — Estilos
   Temas: blanco (por defecto), gris, celeste, pastel, marino
   ============================================================ */

:root, [data-tema="blanco"] {
  --bg: #FFFFFF; --surface: #F2F6F7; --nav: #FFFFFF; --text: #13253A; --muted: #526676;
  --line: #DCE5E9; --accent: #137F75; --on-accent: #FFFFFF; --gold: #E2B24A; --gold-text: #8A6210;
  --on-gold: #1E1500; --ring: #E3F1EF; --shadow: rgba(16,41,58,0.14);
  --ok-bg: #D3F1EB; --ok-text: #0E6458; --wait-bg: #FBEFCF; --wait-text: #7A5608;
  --bad-bg: #FBE1DC; --bad-text: #9A2B17; --input: #FFFFFF;
  color-scheme: light;
}
[data-tema="gris"] {
  --bg: #EDF0F2; --surface: #FFFFFF; --nav: #F6F8F9; --text: #1A2A36; --muted: #536470;
  --line: #D5DBDF; --ring: #DDE3E6; --shadow: rgba(26,42,54,0.14); --input: #FFFFFF;
}
[data-tema="celeste"] {
  --bg: #E2F0FA; --surface: #FFFFFF; --nav: #F3F9FD; --text: #10293A; --muted: #486276;
  --line: #C2DCEE; --ring: #C9E3F5; --shadow: rgba(23,92,140,0.16); --input: #FFFFFF;
}
[data-tema="pastel"] {
  --bg: #E4F5F4; --surface: #FFFFFF; --nav: #F4FBFB; --text: #10293A; --muted: #4D6677;
  --line: #C5E3E1; --ring: #C3ECE8; --shadow: rgba(19,127,117,0.18); --input: #FFFFFF;
}
[data-tema="marino"] {
  --bg: #0E2238; --surface: #163252; --nav: #0B1C2F; --text: #E6F0F2; --muted: #A5BBCB;
  --line: #2A4A6B; --accent: #4FD8C7; --on-accent: #0E2238; --gold: #E6B94F; --gold-text: #F0C766;
  --on-gold: #1E1500; --ring: #2B4E6E; --shadow: rgba(0,0,0,0.35);
  --ok-bg: #16483F; --ok-text: #7FF0DA; --wait-bg: #4A3A12; --wait-text: #F5D58A;
  --bad-bg: #5A2218; --bad-text: #FFB4A3; --input: #0E2238;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px; line-height: 1.4; -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.oculto { display: none !important; }

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.pantalla { flex: 1; padding: 16px 20px 110px; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Encabezado ---------- */
.encabezado { display: flex; align-items: center; gap: 12px; padding-top: 6px; }
.encabezado img { width: 44px; height: 44px; border-radius: 11px; }
.encabezado .titulos { flex: 1; display: flex; flex-direction: column; }
.encabezado .titulo { font-size: 20px; font-weight: 700; }
.encabezado .sub { font-size: 15px; color: var(--muted); }
.barra-atras { display: flex; align-items: center; gap: 8px; }
.barra-atras h1 { font-size: 22px; margin: 0; font-weight: 800; }

/* ---------- Botones ---------- */
.btn-redondo { width: 44px; height: 44px; border-radius: 22px; border: none; background: var(--surface);
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn { min-height: 52px; padding: 0 18px; border-radius: 16px; border: 1.5px solid var(--line);
  background: transparent; color: var(--text); font-size: 17px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; text-decoration: none; }
.btn-oro { background: var(--gold); color: var(--on-gold); border: none; font-weight: 800; min-height: 60px;
  font-size: 19px; box-shadow: 0 8px 20px var(--shadow); }
.btn-acento { background: var(--accent); color: var(--on-accent); border: none; font-weight: 700; }
.btn-borde { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.btn-peligro { border-color: var(--bad-text); color: var(--bad-text); }
.btn-texto { background: none; border: none; color: var(--accent); font-weight: 600; text-decoration: underline;
  min-height: 44px; padding: 0 8px; }
.btn-chico { min-height: 38px; padding: 0 14px; border-radius: 19px; font-size: 15px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.fila-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.columna { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Tarjetas ---------- */
.tarjeta { background: var(--surface); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.tarjeta-aviso { border: 1.5px solid var(--gold); }
.etiqueta { font-size: 15px; color: var(--muted); }
.seccion { font-size: 16px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.numero-grande { font-size: 32px; font-weight: 800; }
.oro { color: var(--gold-text); }
.acento { color: var(--accent); }

.fila-doc { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface);
  border: none; width: 100%; text-align: left; }
.fila-doc .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fila-doc .nombre { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-doc .detalle { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-doc .der { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.fila-doc .monto { font-size: 17px; font-weight: 700; }

.chip { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 10px; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); }
.chip-espera { background: var(--wait-bg); color: var(--wait-text); }
.chip-gris { background: var(--line); color: var(--text); }
.chip-mal { background: var(--bad-bg); color: var(--bad-text); }

/* ---------- Micrófono ---------- */
.zona-mic { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 18px 0 6px; text-align: center; }
.mic { width: 168px; height: 168px; border-radius: 84px; border: 8px solid var(--ring); background: var(--gold);
  color: var(--on-gold); display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px var(--shadow); }
.mic.escuchando { animation: latido 1.2s ease-in-out infinite; }
@keyframes latido { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.zona-mic .grande { font-size: 26px; font-weight: 800; }
.zona-mic .explica { color: var(--muted); max-width: 300px; }
.transcripcion { min-height: 80px; width: 100%; padding: 14px; border-radius: 16px; background: var(--surface);
  font-size: 18px; text-align: left; }

/* ---------- Formularios ---------- */
label.campo { display: flex; flex-direction: column; gap: 6px; font-size: 15px; color: var(--muted); }
.campo input, .campo select, .campo textarea, input.entrada, textarea.entrada, select.entrada {
  min-height: 50px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--input);
  padding: 10px 14px; font-size: 17px; color: var(--text); width: 100%; }
.campo textarea, textarea.entrada { min-height: 90px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.segmentos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface); }
.segmentos button { min-height: 44px; border-radius: 10px; border: none; background: transparent; font-weight: 600; }
.segmentos button.activo { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.casillas { display: flex; flex-wrap: wrap; gap: 8px; }
.casilla { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 22px;
  border: 1.5px solid var(--line); background: var(--surface); font-weight: 600; }
.casilla input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Partidas del presupuesto ---------- */
.partida { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.partida .linea { display: flex; gap: 8px; align-items: center; }
.partida .precio { max-width: 130px; }
.partida .en { font-weight: 600; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; border-top: 2px solid var(--line); }

/* ---------- Lectura en voz alta ---------- */
.lector { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.lector .btn-redondo { background: var(--accent); color: var(--on-accent); }

/* ---------- Voces ---------- */
.voces { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.voz-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.voz-btn b { font-size: 16px; }
.voz-btn small { font-size: 12px; opacity: .7; }
.voz-btn.activo { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }

/* ---------- Temas ---------- */
.temas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tema { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; }
.tema.activo { border-color: var(--accent); }
.tema .muestra { width: 44px; height: 44px; border-radius: 22px; border: 1px solid rgba(0,0,0,.12); display: flex; align-items: center; justify-content: center; }
.tema .muestra i { width: 16px; height: 16px; border-radius: 8px; background: #E2B24A; }

/* ---------- Navegación inferior ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--nav); border-top: 1px solid var(--line);
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
.nav .dentro { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.nav a { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; }
.nav a.activo { color: var(--accent); font-weight: 700; }

/* ---------- Avisos ---------- */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 12px 18px; border-radius: 14px; font-weight: 600; z-index: 50; max-width: 90vw; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.cargando { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 60px 20px; text-align: center; color: var(--muted); }
.rueda { width: 48px; height: 48px; border-radius: 24px; border: 5px solid var(--line); border-top-color: var(--accent); animation: gira 1s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.vacio { text-align: center; color: var(--muted); padding: 24px 10px; }
.nota { font-size: 14px; color: var(--muted); }

/* ---------- Entrar ---------- */
.entrar { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 28px 22px; text-align: center; }
.entrar img { width: 110px; height: 110px; border-radius: 26px; margin: 0 auto; }
.entrar h1 { margin: 0; font-size: 32px; font-weight: 800; }
.entrar p { margin: 0; color: var(--muted); }
.separador { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; }
.separador::before, .separador::after { content: ''; flex: 1; height: 1px; background: var(--line); }

/* ---------- Modal ---------- */
.fondo-modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: var(--bg); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin: 0; font-size: 22px; }

/* ---------- Pasos para hablar ---------- */
.pasos { margin: 0; padding: 14px 16px 14px 44px; text-align: left; background: var(--surface); border-radius: 16px;
  font-size: 18px; line-height: 1.6; width: 100%; max-width: 340px; }
.pasos li::marker { color: var(--accent); font-weight: 800; }

/* ---------- Dos columnas (en el celular es una sola) ---------- */
.dos-col, .dos-col > .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- Plantillas de factura ---------- */
.plantillas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.plantilla { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 16px; border: 2px solid var(--line);
  background: var(--surface); text-align: left; font-size: 15px; }
.plantilla.activo { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset; }
.plantilla .nota { font-size: 13px; }
.punto-color { width: 40px; height: 40px; border-radius: 20px; border: 2px solid rgba(255,255,255,.7); box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
@media (max-width: 420px) { .plantillas { grid-template-columns: 1fr; } .plantilla { flex-direction: row; align-items: center; } .plantilla > div:first-child { width: 120px; flex-shrink: 0; } }

/* ---------- Computadora: más ancho y en dos columnas ---------- */
@media (min-width: 900px) {
  #app { max-width: 1160px; }
  .pantalla { padding: 24px 32px 120px; }
  .dos-col { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
  .col-acciones { position: sticky; top: 16px; }
  .nav .dentro { max-width: 720px; }
  .fondo-modal { align-items: center; }
  .modal { border-radius: 22px; max-width: 560px; }
  .entrar { max-width: 460px; margin: 0 auto; }
}
