:root {
  --madera: #4a2c20;
  --brasa: #c0392b;
  --trigo: #f5e6d3;
  --fondo: #faf6f0;
  --gris-borde: #e0d8cc;
  --texto: #2b2420;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--texto);
  background: var(--fondo);
}

.oculto { display: none !important; }

.pantalla { min-height: 100vh; }

/* --- Login --- */
#pantalla-login {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--madera);
}
.tarjeta-login {
  background: white;
  padding: 36px 32px;
  border-radius: 12px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
.tarjeta-login h1 { margin: 0 0 2px; font-size: 22px; color: var(--madera); }
.subtitulo { margin: 0 0 20px; color: #8a7a6d; font-size: 14px; }
.tarjeta-login form { display: flex; flex-direction: column; gap: 14px; }
.tarjeta-login label { font-size: 13px; font-weight: 600; color: #5a4b40; display: flex; flex-direction: column; gap: 6px; }
.tarjeta-login input {
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--gris-borde);
  border-radius: 8px;
}
.error { color: var(--brasa); font-size: 13px; }

button { cursor: pointer; font-family: inherit; }

.boton-primario {
  background: var(--brasa);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
}
.boton-primario:hover { opacity: 0.9; }

.boton-secundario {
  background: transparent;
  border: 1px solid var(--gris-borde);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--texto);
}

.boton-texto {
  background: none;
  border: none;
  color: var(--brasa);
  font-weight: 600;
  font-size: 13px;
  padding: 4px 6px;
}

.boton-peligro { color: #a33; }

/* --- App shell --- */
#pantalla-app { display: flex; }

.barra-lateral {
  width: 230px;
  background: var(--madera);
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.logo-barra { font-weight: 700; font-size: 18px; padding: 20px 18px 12px; }
#menu-herramientas { display: flex; flex-direction: column; padding: 8px; gap: 2px; flex: 1; }
.item-herramienta {
  background: none;
  border: none;
  color: white;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0.55;
}
.item-herramienta.activo { background: rgba(255,255,255,0.12); opacity: 1; }
.item-herramienta:not([disabled]):hover { background: rgba(255,255,255,0.08); opacity: 1; }
.item-herramienta[disabled] { cursor: default; }

.barra-inferior { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,0.15); }
.usuario-actual { font-size: 12px; opacity: 0.8; margin-bottom: 8px; word-break: break-all; }
.barra-inferior .boton-secundario { color: white; border-color: rgba(255,255,255,0.3); width: 100%; }

.contenido { flex: 1; padding: 28px 36px; max-width: 980px; }

.encabezado-pantalla { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.encabezado-pantalla h2 { margin: 0; }
.selector-sede select { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--gris-borde); }

/* --- Categorías / productos --- */
.lista-categorias { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }

.tarjeta-categoria {
  background: white;
  border: 1px solid var(--gris-borde);
  border-radius: 10px;
  overflow: hidden;
}
.fila-categoria {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}
.miniatura { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--trigo); flex-shrink: 0; }
.miniatura.vacia { display: flex; align-items: center; justify-content: center; font-size: 18px; color: #b7a996; }
.nombre-categoria { font-weight: 700; flex: 1; }
.contador-productos { font-size: 12px; color: #8a7a6d; }

.cuerpo-categoria { border-top: 1px solid var(--gris-borde); padding: 10px 14px 14px; display: none; }
.cuerpo-categoria.abierto { display: block; }

.fila-producto {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f0e9df;
}
.fila-producto:last-child { border-bottom: none; }
.info-producto { flex: 1; }
.nombre-producto { font-weight: 600; font-size: 14px; }
.precio-producto { font-size: 13px; color: #6b5d50; }
.acciones-producto { display: flex; align-items: center; gap: 10px; }

.switch-wrap { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #6b5d50; }
.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; cursor: pointer; inset: 0;
  background-color: #ccc; border-radius: 20px; transition: 0.15s;
}
.slider:before {
  content: ""; position: absolute; height: 14px; width: 14px; left: 3px; bottom: 3px;
  background-color: white; border-radius: 50%; transition: 0.15s;
}
.switch input:checked + .slider { background-color: var(--brasa); }
.switch input:checked + .slider:before { transform: translateX(16px); }

.btn-crear-producto { margin-top: 10px; }

/* --- Modal --- */
.modal-fondo {
  position: fixed; inset: 0; background: rgba(20,15,10,0.5);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 40px 16px;
  z-index: 50;
}
.modal-caja {
  background: white; border-radius: 12px; padding: 26px 28px;
  width: 100%; max-width: 520px;
}
.modal-caja h3 { margin-top: 0; }
.campo { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; color: #5a4b40; }
.campo input[type=text], .campo input[type=number], .campo textarea, .campo select {
  padding: 9px 11px; border: 1px solid var(--gris-borde); border-radius: 8px; font-size: 14px; font-family: inherit;
}
.campo textarea { resize: vertical; min-height: 60px; }
.fila-2 { display: flex; gap: 12px; }
.fila-2 .campo { flex: 1; }

.checklist-categorias { display: flex; flex-wrap: wrap; gap: 8px 16px; max-height: 140px; overflow-y: auto; border: 1px solid var(--gris-borde); border-radius: 8px; padding: 10px; }
.checklist-categorias label { font-size: 13px; display: flex; align-items: center; gap: 6px; font-weight: 400; }

.subtabla { margin-top: 6px; }
.fila-opcion { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.fila-opcion input[type=text] { flex: 2; }
.fila-opcion input[type=number] { flex: 1; }
.fila-opcion button { background: none; border: none; color: #a33; font-size: 16px; }

.acciones-modal { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

.nota { font-size: 12px; color: #8a7a6d; margin-top: 4px; }
