/* ============================================================
   estilo.css — PWA Cocina v4
   Dark minimalista · Sin rojo · Acento índigo
   ============================================================ */

/* --- Variables globales --- */
:root {
  --bg:        #111111;
  --surface:   #1a1a1a;
  --card:      #202020;
  --borde:     #2c2c2c;
  --texto:     #e4e4e4;
  --texto2:    #6b6b6b;
  --acento:    #5b7cf6;
  --acento-h:  #768ef8;
  --ok:        #4ade80;
  --warn:      #fbbf24;
  --err:       #f87171;
  --radio:     6px;
  --sombra:    0 1px 4px rgba(0,0,0,.35);
}

/* --- Modo claro --- */
[data-tema="claro"] {
  --bg:       #f3f4f6;
  --surface:  #ffffff;
  --card:     #ffffff;
  --borde:    #e5e7eb;
  --texto:    #111827;
  --texto2:   #6b7280;
  --sombra:   0 1px 4px rgba(0,0,0,.08);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--texto);
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ============================================================
   CABECERA
   ============================================================ */
.cabecera {
  background: var(--surface);
  border-bottom: 1px solid var(--borde);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.cabecera-izq { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; }
.cabecera-der { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.cabecera-titulo    { font-size: 1rem; font-weight: 700; letter-spacing: -.3px; }
.cabecera-subtitulo { font-size: .7rem; color: var(--texto2); }

.nav-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.nav-tab {
  background: transparent;
  color: var(--texto2);
  border: none;
  border-radius: var(--radio);
  padding: 6px 14px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .12s, background .12s;
  white-space: nowrap;
}
.nav-tab:hover  { background: rgba(255,255,255,.06); color: var(--texto); }
.nav-tab.activo { background: rgba(91,124,246,.15); color: var(--acento); }


/* Overlay de búsqueda global */
#busqueda-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 80px;
}
#busqueda-modal {
  background: var(--surface); border: 1px solid var(--borde);
  border-radius: 10px; width: min(600px, 92vw);
  max-height: 70vh; display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.busqueda-cabecera {
  display: flex; gap: 8px; padding: 12px;
  border-bottom: 1px solid var(--borde);
}
.busqueda-cabecera .inp { flex: 1; margin: 0; }
.busqueda-cabecera button {
  background: transparent; border: 1px solid var(--borde);
  color: var(--texto2); border-radius: var(--radio);
  padding: 6px 10px; cursor: pointer; font-size: 1rem;
}
.busqueda-cabecera button:hover { color: var(--texto); border-color: #444; }
#busqueda-resultados { overflow-y: auto; padding: 8px 0; }
.busq-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; cursor: pointer; transition: background .1s;
}
.busq-item:hover { background: rgba(255,255,255,.05); }
.busq-item span:nth-child(2) { flex: 1; font-size: .95rem; }
.busq-tipo {
  font-size: .75rem; color: var(--texto2);
  background: var(--card); border-radius: 4px; padding: 2px 6px;
}

/* ---- Vista lista / form (Carta y Bebidas) ---- */
.vista-list-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
}
.vista-list-bar span {
  font-size: .75rem;
  font-weight: 600;
  color: var(--texto2);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.vista-form-bar {
  display: flex !important;
  align-items: center;
  gap: 10px;
}
.btn-volver {
  background: transparent;
  border: 1px solid var(--borde);
  color: var(--texto2);
  border-radius: var(--radio);
  padding: 3px 10px;
  font-size: .8rem;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
  white-space: nowrap;
}
.btn-volver:hover { border-color: #444; color: var(--texto); }

/* Banner sin conexión */
#offline-banner {
  background: #7c3aed;
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .02em;
  position: sticky;
  top: 0;
  z-index: 200;
}

/* Badge de alertas en pestañas */
.tab-badge {
  display: inline-block;
  background: #e74c3c;
  color: #fff;
  border-radius: 8px;
  font-size: .6rem;
  font-weight: 700;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
  min-width: 16px;
  text-align: center;
  line-height: 1.5;
}

/* Alertas de caducidad en el dashboard */
.dash-alertas {
  background: rgba(231,76,60,.08);
  border: 1px solid rgba(231,76,60,.25);
  border-radius: var(--radio);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.dash-alertas-titulo {
  font-size: .85rem;
  font-weight: 700;
  color: #e74c3c;
  margin-bottom: 10px;
}
.dash-alerta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: .85rem;
  margin-bottom: 5px;
}
.dash-alerta-item:last-child { margin-bottom: 0; }
.dash-alerta-item.rojo    { background: rgba(231,76,60,.15); }
.dash-alerta-item.amarillo{ background: rgba(241,196,15,.12); }

#indicador-microfono {
  font-size: 1.2rem; padding: 4px 8px; border-radius: var(--radio);
  background: rgba(255,255,255,.05); transition: background .3s;
}
#indicador-microfono.escuchando {
  background: var(--acento);
  animation: pulso 1s infinite;
}
@keyframes pulso {
  0%,100% { box-shadow: 0 0 0 0 rgba(91,124,246,.5); }
  50%     { box-shadow: 0 0 0 10px rgba(91,124,246,0); }
}

/* Botones de cabecera (tema, búsqueda, conexión) */
.cab-btn {
  background: transparent;
  color: var(--texto2);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 5px 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.cab-btn:hover { color: var(--texto); border-color: #777; background: rgba(128,128,128,.08); }
.cab-btn.online  { color: #4ade80; }
.cab-btn.offline { color: #f87171; }


/* ============================================================
   LAYOUT
   ============================================================ */
.modulo-seccion {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

.contenido-principal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 820px) {
  .contenido-principal { grid-template-columns: 1fr; }
  .cabecera { padding: 0 14px; }
  .cabecera-subtitulo { display: none; }
}

/* --- Barra de navegación inferior (móvil) --- */
.nav-bottom {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--borde);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-bottom-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 2px 6px;
  gap: 2px;
  background: transparent;
  border: none;
  color: var(--texto2);
  font-size: .68rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .12s;
  white-space: nowrap;
}
.nb-icon { font-size: 1.35rem; line-height: 1; }
.nav-bottom-tab.activo { color: var(--acento); }
.nav-bottom-tab.activo .nb-icon { filter: drop-shadow(0 0 4px var(--acento)); }

@media (max-width: 640px) {
  .nav-tabs   { display: none; }
  .nav-bottom { display: flex; }
  .modulo-seccion { padding-bottom: 80px; }
  .cabecera { height: 50px; padding: 0 12px; }
}

/* ============================================================
   BOTÓN LOGO / HOME
   ============================================================ */
.cabecera-titulo-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 0;
  color: var(--texto);
  font-family: inherit;
  line-height: 1;
}
.cabecera-titulo-btn:hover .cabecera-titulo { color: var(--acento); }

/* ============================================================
   DASHBOARD
   ============================================================ */
#modulo-dashboard { padding: 0; max-width: 100%; }

.dash-fondo {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 10% 85%, rgba(255,180,60,.07) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 15%, rgba(91,124,246,.08) 0%, transparent 50%),
    linear-gradient(160deg, #0b0d18 0%, #10131e 60%, #0c0f16 100%);
  padding: 40px 24px 80px;
}

[data-tema="claro"] .dash-fondo {
  background:
    radial-gradient(ellipse at 10% 85%, rgba(255,180,60,.06) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 15%, rgba(91,124,246,.07) 0%, transparent 50%),
    linear-gradient(160deg, #edf0f8 0%, #e8ecf5 60%, #eef1f9 100%);
}

.dash-contenido {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 44px;
}

.dash-saludo { text-align: center; }

.dash-logo {
  font-size: 3.8rem;
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 28px rgba(91,124,246,.4));
  display: block;
}

.dash-nombre {
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--texto);
  letter-spacing: -.5px;
  margin-bottom: 6px;
}

.dash-sub { font-size: .9rem; color: var(--texto2); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  width: 100%;
}

.dash-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 18px;
  padding: 38px 20px 30px;
  cursor: pointer;
  transition: transform .22s ease, border-color .2s, background .2s, box-shadow .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  color: var(--texto);
  font-family: inherit;
}
.dash-card:hover {
  transform: translateY(-6px);
  border-color: rgba(91,124,246,.45);
  background: rgba(91,124,246,.08);
  box-shadow: 0 14px 44px rgba(91,124,246,.2);
}
.dash-card:active { transform: translateY(-2px); }

[data-tema="claro"] .dash-card { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.09); }
[data-tema="claro"] .dash-card:hover { background: rgba(91,124,246,.07); border-color: rgba(91,124,246,.35); }

.dash-card-icon   { font-size: 2.5rem; line-height: 1; }
.dash-card-nombre { font-size: 1.05rem; font-weight: 600; }
.dash-card-desc   { font-size: .78rem; color: var(--texto2); }

@media (max-width: 480px) {
  .dash-card { padding: 28px 12px 22px; }
  .dash-card-icon { font-size: 2rem; }
  .dash-nombre { font-size: 1.6rem; }
  .dash-contenido { gap: 30px; }
  .dash-logo { font-size: 3rem; }
}

.modulo-cabecera-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.modulo-h2 { font-size: 1.2rem; font-weight: 600; color: var(--texto); }

/* Sub-navegación */
.sub-nav  { display: flex; gap: 4px; }
.sub-tab {
  background: transparent;
  color: var(--texto2);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 6px 16px;
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
}
.sub-tab:hover  { color: var(--texto); border-color: #444; }
.sub-tab.activo { background: var(--acento); color: white; border-color: var(--acento); }

/* ============================================================
   TARJETAS
   ============================================================ */
.tarjeta {
  background: var(--card);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 16px;
  box-shadow: var(--sombra);
}
.tarjeta-titulo {
  font-size: .75rem;
  font-weight: 600;
  color: var(--texto2);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--borde);
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radio);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  padding: 0 20px;
  min-height: 56px;
  transition: background .12s, opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }

.btn-primario  { background: var(--acento); color: white; width: 100%; }
.btn-primario:hover:not(:disabled) { background: var(--acento-h); }

.btn-secundario { background: transparent; color: var(--texto); border: 1px solid var(--borde); width: 100%; }
.btn-secundario:hover:not(:disabled) { background: rgba(255,255,255,.05); border-color: #444; }

.btn-imprimir   { background: var(--surface); color: var(--texto); border: 1px solid var(--borde); width: 100%; }
.btn-imprimir:hover:not(:disabled) { background: rgba(255,255,255,.06); }

.btn-historial  { background: transparent; color: var(--texto2); border: 1px solid var(--borde); font-size: .875rem; min-height: 36px; width: 100%; margin-top: 4px; }
.btn-historial:hover { color: var(--texto); border-color: #444; }

/* Botones medianos */
.btn-primario-sm  {
  background: var(--acento); color: white;
  border: none; border-radius: var(--radio);
  padding: 0 16px; min-height: 38px;
  font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: background .12s;
}
.btn-primario-sm:hover { background: var(--acento-h); }

.btn-secundario-sm {
  background: transparent; color: var(--texto);
  border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 0 14px; min-height: 38px;
  font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: all .12s;
}
.btn-secundario-sm:hover { background: rgba(255,255,255,.05); border-color: #444; }

/* Botones mini */
.btn-mini {
  background: transparent; color: var(--texto2);
  border: 1px solid var(--borde);
  border-radius: 4px; padding: 4px 10px;
  font-size: .8rem; cursor: pointer;
  transition: all .12s; white-space: nowrap;
}
.btn-mini:hover    { background: rgba(255,255,255,.05); color: var(--texto); border-color: #444; }
.btn-editar:hover  { border-color: var(--acento); color: var(--acento); }
.btn-borrar:hover  { border-color: var(--err);    color: var(--err); }
.btn-email:hover   { border-color: #60a5fa; color: #60a5fa; }
.btn-wa:hover      { border-color: #4ade80; color: #4ade80; }

/* Botón WhatsApp (acción principal) */
.btn-wa {
  background: #25d366; color: #fff; border: none;
  padding: 8px 14px; border-radius: var(--radio);
  font-size: .875rem; font-weight: 600; cursor: pointer;
  transition: background .12s;
}
.btn-wa:hover { background: #1db954; }
.btn-ver:hover    { border-color: var(--ok);     color: var(--ok); }
.btn-pagar:hover  { border-color: var(--ok);     color: var(--ok); }

.card-acciones { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.form-acciones { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.form-grupo { display: flex; flex-direction: column; gap: 5px; }
.form-grupo-full { grid-column: 1 / -1; }

label { font-size: .8rem; color: var(--texto2); font-weight: 500; }

.inp {
  background: var(--surface);
  color: var(--texto);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 9px 11px;
  font-size: .9rem;
  width: 100%;
  transition: border-color .12s;
}
.inp:focus    { border-color: var(--acento); outline: none; }
.inp-select   { cursor: pointer; }
textarea.inp  { resize: vertical; min-height: 60px; }

/* Tabs voz / manual en etiquetas */
.etq-modo-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--borde);
  padding-bottom: 10px;
}
.etq-modo-tab {
  background: transparent;
  color: var(--texto2);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 5px 14px;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
}
.etq-modo-tab:hover  { color: var(--texto); border-color: #777; }
.etq-modo-tab.activo { background: var(--acento); color: white; border-color: var(--acento); }

/* ============================================================
   MÓDULO ETIQUETAS
   ============================================================ */
.panel-estado {
  min-height: 80px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 12px 14px;
  margin-bottom: 12px;
}
#etq-mensaje         { font-size: 1.05rem; min-height: 2em; }
#etq-mensaje.mensaje-app   { color: #93c5fd; }
#etq-mensaje.mensaje-info  { color: var(--texto2); }
#etq-mensaje.mensaje-error { color: var(--err); }
#etq-respuesta       { font-size: .9rem; color: var(--ok); font-style: italic; min-height: 1.5em; margin-top: 6px; }

.contenedor-progreso {
  background: var(--surface); border-radius: 99px; height: 4px; overflow: hidden; margin-top: 10px;
}
#etq-progreso-barra {
  height: 100%; width: 0; background: var(--acento); border-radius: 99px; transition: width .4s;
}
#etq-progreso-texto { font-size: .75rem; color: var(--texto2); margin-top: 4px; text-align: right; }

/* Etiqueta de recipiente */
.etiqueta {
  background: white; color: #111;
  border: 2px solid #ccc; border-radius: var(--radio);
  padding: 12px 16px; max-width: 340px;
  margin: 0 auto; font-family: 'Courier New', monospace;
}
.etiqueta-nombre       { font-size: 1.25rem; font-weight: 900; text-transform: uppercase; border-bottom: 1px solid #ddd; padding-bottom: 5px; margin-bottom: 5px; }
.etiqueta-lote         { font-size: .9rem; margin-bottom: 3px; }
.etiqueta-fecha        { font-size: .8rem; color: #666; margin-bottom: 7px; }
.etiqueta-caducidad    { font-size: .95rem; font-weight: 700; padding: 5px 9px; border-radius: 4px; color: white; margin-bottom: 7px; }
.etiqueta-caducidad.verde    { background: #22c55e; }
.etiqueta-caducidad.amarillo { background: #f59e0b; }
.etiqueta-caducidad.rojo     { background: #ef4444; }
.etiqueta-alergenos    { font-size: .8rem; font-weight: 700; text-transform: uppercase; border-top: 1px solid #e5e5e5; padding-top: 5px; }
.etiqueta-normativa    { font-size: .6rem; color: #aaa; margin-top: 5px; text-align: right; }

/* Leyenda de colores */
.leyenda        { display: flex; gap: 14px; font-size: .8rem; flex-wrap: wrap; margin-top: 8px; }
.leyenda-item   { display: flex; align-items: center; gap: 6px; }
.leyenda-punto  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.leyenda-punto.verde    { background: #22c55e; }
.leyenda-punto.amarillo { background: #f59e0b; }
.leyenda-punto.rojo     { background: #ef4444; }

/* Historial */
.item-historial {
  padding: 9px 12px; border-radius: var(--radio); margin-bottom: 6px;
  border-left: 3px solid var(--borde); background: var(--surface); font-size: .875rem;
}
.item-historial.verde    { border-left-color: #22c55e; }
.item-historial.amarillo { border-left-color: #f59e0b; }
.item-historial.rojo     { border-left-color: #ef4444; }
.item-historial small    { color: var(--texto2); }

/* ============================================================
   MÓDULO MENÚ
   ============================================================ */
.grid-ingredientes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  padding: 8px;
  max-height: 200px;
  overflow-y: auto;
}
.check-ingrediente {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 7px; border-radius: 4px; cursor: pointer; font-size: .875rem;
  transition: background .1s;
}
.check-ingrediente:hover { background: rgba(255,255,255,.04); }
.check-ingrediente input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--acento); }
.check-ingrediente small { color: var(--texto2); margin-left: auto; }

.grid-alergenos-check {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 4px;
  background: var(--surface); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 8px;
}
.check-alergeno {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 7px; border-radius: 4px; cursor: pointer; font-size: .875rem;
  transition: background .1s;
}
.check-alergeno:hover { background: rgba(255,255,255,.04); }
.check-alergeno input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--acento); }

/* Badges de alérgenos */
.badges-alergenos   { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.badge-alergeno {
  background: rgba(91,124,246,.12); color: #93a8fb; border: 1px solid rgba(91,124,246,.25);
  border-radius: 4px; padding: 2px 8px; font-size: .75rem; white-space: nowrap;
}
.badge-sin-alergenos {
  background: rgba(74,222,128,.1); color: #86efac; border: 1px solid rgba(74,222,128,.2);
  border-radius: 4px; padding: 2px 8px; font-size: .75rem;
}

/* Tarjeta de plato */
.card-plato {
  background: var(--surface); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 12px 14px; margin-bottom: 8px;
}
.card-plato-cabecera { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 3px; }
.card-plato-nombre   { font-size: 1rem; font-weight: 600; }
.card-plato-precio   { font-size: .95rem; color: var(--ok); font-weight: 600; white-space: nowrap; }
.card-plato-desc     { font-size: .85rem; color: var(--texto2); margin-bottom: 5px; }
.card-plato-ingredientes { font-size: .8rem; color: var(--texto2); margin-bottom: 5px; }

/* Tarjeta de ingrediente */
.card-ingrediente {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 10px 12px; margin-bottom: 6px;
}
.card-ing-info   { flex: 1; }
.card-ing-nombre { font-weight: 500; font-size: .95rem; display: block; margin-bottom: 3px; }

/* ============================================================
   MÓDULO FACTURAS
   ============================================================ */
.card-factura {
  background: var(--surface); border: 1px solid var(--borde);
  border-radius: var(--radio); padding: 12px 14px; margin-bottom: 8px;
}
.fac-card-cabecera { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.fac-card-numero   { font-weight: 600; font-size: .9rem; color: var(--texto2); }
.fac-card-cliente  { font-size: 1rem; font-weight: 500; margin-bottom: 3px; }
.fac-card-meta     { display: flex; justify-content: space-between; color: var(--texto2); font-size: .85rem; margin-bottom: 3px; }

/* Badges de estado */
.badge-estado       { border-radius: 4px; padding: 2px 9px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.estado-pagada      { background: rgba(74,222,128,.12);  color: #86efac; border: 1px solid rgba(74,222,128,.25); }
.estado-pendiente      { background: rgba(251,191,36,.12);  color: #fcd34d; border: 1px solid rgba(251,191,36,.25); }
.estado-pres-aceptado  { background: rgba(74,222,128,.12);  color: #86efac; border: 1px solid rgba(74,222,128,.25); }
.estado-pres-rechazado { background: rgba(248,113,113,.12); color: #f87171; border: 1px solid rgba(248,113,113,.25); }

/* Barra "importar plato" */
.fac-add-linea-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.fac-add-linea-bar .inp-select { flex: 1; min-width: 180px; }

/* Tabla de líneas */
.tabla-responsive { overflow-x: auto; }
.fac-tabla-lineas-form { width: 100%; border-collapse: collapse; font-size: .875rem; }
.fac-tabla-lineas-form th {
  background: var(--surface); color: var(--texto2); text-align: left;
  padding: 7px 9px; font-size: .75rem; text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--borde); font-weight: 500;
}
.fac-tabla-lineas-form td  { padding: 5px 7px; border-bottom: 1px solid var(--borde); vertical-align: middle; }
.fac-tabla-lineas-form .inp-linea {
  background: var(--surface); border: 1px solid var(--borde); color: var(--texto);
  border-radius: 4px; padding: 5px 7px; font-size: .85rem; width: 100%;
}
.fac-tabla-lineas-form .inp-linea:focus { border-color: var(--acento); outline: none; }
.inp-qty, .inp-precio { width: 80px; text-align: right; }
.linea-subtotal        { text-align: right; font-weight: 500; white-space: nowrap; }
.td-num                { text-align: right; }

/* Totales formulario */
.fac-totales-form {
  margin-top: 10px; padding: 10px 14px; background: var(--surface);
  border: 1px solid var(--borde); border-radius: var(--radio);
  display: flex; flex-direction: column; gap: 4px;
}
.fac-fila-total {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .875rem; color: var(--texto2);
}
.fac-total-final { color: var(--texto); font-size: 1.1rem; font-weight: 700; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--borde); }

/* Factura imprimible */
.factura-imprimible {
  background: white; color: #111; padding: 32px 36px; border-radius: var(--radio);
  font-family: Arial, Helvetica, sans-serif; font-size: 13px; max-width: 760px; margin: 0 auto;
  border: 1px solid var(--borde);
}
.fac-cabecera-print {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  margin-bottom: 20px; padding-bottom: 16px; border-bottom: 3px solid #1a1a2e;
}
.fac-emisor { font-size: 12.5px; color: #333; flex: 1; }
.fac-emisor-nombre { font-size: 1.1rem; font-weight: 800; color: #111; display: block; margin-bottom: 6px; }
.fac-emisor-datos  { font-size: 11.5px; color: #555; line-height: 1.7; }
.fac-titulo-doc    { text-align: right; flex-shrink: 0; }
.fac-numero-grande { font-size: 1.7rem; font-weight: 900; color: #1a1a2e; letter-spacing: 2px; }
.fac-meta-item     { font-size: 12px; color: #444; margin-top: 4px; }
.fac-meta-item span { color: #888; }
.fac-receptor      { border: 1px solid #dde; border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; font-size: 12.5px; background: #f8f9fc; }
.fac-receptor-titulo { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #888; font-weight: 700; margin-bottom: 6px; }
.fac-tabla-lineas  { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.fac-tabla-lineas th { background: #1a1a2e; color: white; padding: 8px 12px; font-size: 11px; text-align: left; text-transform: uppercase; letter-spacing: .5px; }
.fac-tabla-lineas td { padding: 8px 12px; border-bottom: 1px solid #eee; font-size: 12.5px; }
.fac-tabla-lineas tr:last-child td { border-bottom: 2px solid #dde; }
.fac-tabla-lineas tr:nth-child(even) td { background: #fafafa; }
.fac-totales       { margin-left: auto; max-width: 260px; border: 1px solid #dde; border-radius: 6px; overflow: hidden; }
.fac-totales .fac-fila-total { padding: 7px 14px; font-size: 13px; color: #333; display: flex; justify-content: space-between; }
.fac-totales .fac-fila-total:not(:last-child) { border-bottom: 1px solid #eee; }
.fac-totales .fac-total-final { background: #1a1a2e; color: white; font-size: 15px; font-weight: 900; padding: 10px 14px; }
.fac-pago { margin-top: 14px; padding: 10px 14px; background: #f8f9fc; border: 1px solid #dde; border-radius: 6px; font-size: 12px; color: #444; }
.fac-notas { margin-top: 14px; font-size: 12px; color: #666; border-top: 1px solid #eee; padding-top: 10px; font-style: italic; }
.fac-pie-legal { margin-top: 20px; font-size: 10.5px; color: #aaa; text-align: center; border-top: 1px solid #eee; padding-top: 12px; line-height: 1.6; }

/* ============================================================
   PANTALLA DE LOGIN / REGISTRO
   ============================================================ */
#pantalla-login {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.login-caja {
  background: var(--card);
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 32px 28px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-titulo    { font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 4px; letter-spacing: -.3px; }
.login-subtitulo { font-size: .85rem; color: var(--texto2); text-align: center; margin-bottom: 20px; }
.login-error     { color: var(--err); font-size: .82rem; min-height: 1.2em; text-align: center; }

.login-toggle { text-align: center; font-size: .82rem; color: var(--texto2); margin-top: 12px; }
.login-toggle button {
  background: none; border: none; color: var(--acento);
  cursor: pointer; text-decoration: none; font-size: .82rem; padding: 0; font-weight: 500;
}
.login-toggle button:hover { text-decoration: underline; }

#login-forma, #registro-forma { display: flex; flex-direction: column; gap: 12px; }

/* ============================================================
   UTILIDADES
   ============================================================ */
.texto-vacio  { color: var(--texto2); font-size: .875rem; padding: 10px 0; }
.error-texto  { color: var(--err); }

.pie {
  text-align: center; font-size: .72rem; color: #444; padding: 14px;
  border-top: 1px solid var(--borde); margin-top: 24px;
}
.pie a { color: #444; }
.pie a:hover { color: #666; }

/* ============================================================
   IMPRESIÓN
   ============================================================ */
@media print {
  .cabecera, .pie, .btn, .btn-mini, .form-acciones, .tarjeta-titulo,
  .sub-nav, .nav-tabs, .panel-estado, .contenedor-progreso, .leyenda,
  .modulo-cabecera-inner, #etq-seccion-historial,
  #etq-btn-historial, #fac-btn-volver, #fac-btn-imprimir,
  #pantalla-login, #btn-logout, #offline-banner { display: none !important; }

  body { background: white; color: black; font-size: 11pt; }

  #modulo-etiquetas .tarjeta { box-shadow: none; background: white; padding: 0; border: none; }
  .etiqueta {
    width: 62mm; border: 2px solid black; padding: 4mm 5mm; margin: 0 auto;
    font-size: 9pt; page-break-inside: avoid;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
  .etiqueta-nombre { font-size: 13pt; }

  .factura-imprimible {
    padding: 0; border-radius: 0; max-width: 100%; border: none;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }

  @page { size: A4; margin: 12mm; }
}
