:root {
  --primary: #087ceb;
  --primary-dark: #0663c7;
  --primary-light: #e7f2fd;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --bg: #f8fafc;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-light: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --sidebar-width: 248px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow: 0 1px 3px rgba(15,23,42,0.06), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,0.08), 0 2px 4px rgba(15,23,42,0.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.12), 0 4px 8px rgba(15,23,42,0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden; /* evita que un elemento ancho corra toda la pagina de lado en celular */
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; color: var(--text); }

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
}

.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo .icon {
  font-size: 42px;
  display: block;
  margin-bottom: 8px;
}
.login-logo h1 {
  font-size: 20px;
  margin: 0;
  color: var(--text);
}
.login-logo p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 1px 2px rgba(8,124,235,0.15); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-block { width: 100%; }
.btn-secondary { background: var(--border-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline { background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.error-msg {
  background: var(--danger-bg);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.error-msg.show { display: block; }

.login-hint {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ---------- Layout con sidebar ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: #e2e8f0;
  padding: 20px 0;
  flex-shrink: 0;
  transition: transform .2s;
}

/* En celular el sidebar se posiciona fijo (con su propia altura 100vh) y
   se tapa con transform en vez de con display - ver la media query mas
   abajo. En escritorio, en cambio, si el menu no entra completo en la
   pantalla, es toda la pagina la que se alarga (no el sidebar solo). */

/* Fondo oscuro detras del menu en celular: oculto por defecto (tanto en
   escritorio como en celular con el menu cerrado), solo aparece cuando el
   menu esta abierto - tocarlo lo cierra, y ademas oscurece el contenido de
   atras para que quede claro que el menu es lo que esta activo ahora. */
.sidebar-backdrop {
  display: none;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 20px;
  border-bottom: 1px solid #1e293b;
  margin-bottom: 12px;
}
.sidebar .brand .icon { font-size: 22px; }
.sidebar .brand span { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 12px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, color .15s ease;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar nav a.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

/* ---- Secciones del sidebar: titulo fijo destacado + modulos tabulados ---- */
.sidebar-group { margin-top: 6px; }
.sidebar-group-title {
  padding: 16px 24px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.sidebar-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 12px;
  padding: 9px 12px 9px 26px;
  font-size: 13.5px;
  font-weight: 500;
  color: #94a3b8;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, color .15s ease;
}
.sidebar-subitem .icon { font-size: 15px; }
.sidebar-subitem:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }
.sidebar-subitem.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

.sidebar .user-box {
  padding: 18px 20px 14px;
  border-top: 1px solid #1e293b;
  margin-top: 12px;
}
.sidebar .user-box .name { font-size: 13px; font-weight: 600; color: white; }
.sidebar .user-box .role { font-size: 11px; color: #94a3b8; margin-bottom: 10px; }

/* Boton propio (no reutiliza .btn-outline, que esta pensado para fondos
   claros - con las variables globales el texto quedaba oscuro sobre el
   fondo oscuro del sidebar, practicamente invisible). */
.btn-sidebar-logout {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #334155;
  background: transparent;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.btn-sidebar-logout:hover { background: #1e293b; color: white; border-color: #475569; }

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface);
  padding: 16px 28px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
}

.page-content { padding: 28px; flex: 1; }

/* ---------- Dashboard cards ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow .15s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-card .kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 21px;
  flex-shrink: 0;
}
.kpi-icon.blue { background: #dbeafe; }
.kpi-icon.green { background: var(--success-bg); }
.kpi-icon.red { background: var(--danger-bg); }
.kpi-icon.amber { background: var(--warning-bg); }

.kpi-card .kpi-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.kpi-card .kpi-value { font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.kpi-card .kpi-sublabel { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow-wrap: break-word; }

/* Contenido adaptable de las tarjetas. El cuerpo (todo lo que sigue al icono) es un item flex y, sin min-width:0, no podia achicarse por debajo
   de su texto, asi que empujaba controles, barras y botones fuera de la tarjeta. Ahora el cuerpo se ajusta al ancho de la tarjeta, el texto
   largo baja de linea y las cifras grandes se achican segun el ancho real de SU tarjeta (container query), no el de la ventana. */
.kpi-card { min-width: 0; }
.kpi-card > div:not(.kpi-icon):not(.dash-edit-controls) { flex: 1 1 0; min-width: 0; container-type: inline-size; }
@supports (font-size: 1cqi) {
  .kpi-card .kpi-value { font-size: clamp(15px, 14cqi, 22px); }
}
/* Fila del titulo con controles (ayuda "?", engranaje, boton Ventas/Monto): el texto baja de linea y los controles nunca se salen. */
.kpi-label-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 4px; }
.kpi-label-row > .kpi-label-text { flex: 1 1 0; min-width: min-content; overflow-wrap: break-word; }
.kpi-label-row > .help-btn, .kpi-label-row > [data-peak-toggle] { flex: none; }
.kpi-label-row > [data-peak-toggle] { margin-left: auto; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 24px;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.panel-header h3 { margin: 0; font-size: 15px; }

.period-tabs {
  display: flex;
  flex-wrap: wrap;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}
.period-tabs button {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.period-tabs button.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow);
}

.chart-wrap { position: relative; height: 320px; }

/* ---------- Tablas (compartido por todos los modulos: Productos, Stock, Cajas,
   Historial de Turnos, Ventas, Compras, Punto de Venta, etc.) ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border-light); }
th { color: var(--text-muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; }
tbody tr { transition: background-color .1s ease; }
tbody tr:hover { background: var(--bg); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-green { background: var(--success-bg); color: var(--success); }
.badge-red { background: var(--danger-bg); color: var(--danger); }
.badge-amber { background: var(--warning-bg); color: #92400e; }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray { background: #e2e8f0; color: #475569; }

.empty-state {
  text-align: center;
  padding: 30px 10px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ---------- Paginacion ---------- */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}
.pagination-info { color: var(--text-muted); font-size: 12px; }
.pagination-controls { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.page-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { padding: 0 4px; color: var(--text-muted); font-size: 12px; }

/* ---------- Modulo Actualizacion de Stock ---------- */
.stock-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.stock-result-item:hover { border-color: var(--primary); background: var(--bg); }
.stock-result-item .info { flex: 1; min-width: 0; }
.stock-result-item .info .desc { font-weight: 600; font-size: 13px; }
.stock-result-item .info .meta { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.stock-result-item .current-stock { font-size: 12px; font-weight: 700; color: var(--primary); white-space: nowrap; }

.stock-selected-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  background: var(--bg);
  margin-top: 16px;
}

.grid-stock-input {
  width: 90px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  transition: border-color .15s, background .15s;
}
.grid-stock-input:focus { outline: none; border-color: var(--primary); }
.grid-stock-input.has-value { border-color: var(--primary); background: var(--primary-light); font-weight: 600; }
.grid-stock-input.has-error { border-color: var(--danger); background: var(--danger-bg); }

/* ---------- Productos ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  align-items: center;
  justify-content: space-between;
}
.toolbar .search-box { flex: 1; min-width: 200px; max-width: 340px; }
.search-box input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
}

.product-table-wrap { overflow-x: auto; }

.thumb {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
}
.thumb-placeholder {
  width: 28px; height: 28px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.icon-btn {
  border: none;
  background: var(--bg);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  font-size: 14px;
}
.icon-btn:hover { background: var(--border); }

/* ---------- Menu desplegable de acciones (ej: Compras) ---------- */
/* Se posiciona con JS via top/left ("fixed", relativo a la ventana) porque
   vive pegado al <body> - asi ningun contenedor con scroll propio (como
   .product-table-wrap) lo recorta quedando cortado a la mitad. */
.actions-dropdown-menu {
  display: none;
  position: fixed;
  z-index: 100;
  min-width: 170px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  overflow: hidden;
}
.actions-dropdown-menu.open { display: block; }
.actions-dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border: none;
  background: none;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
}
.actions-dropdown-menu button:hover { background: var(--bg); }
.actions-dropdown-menu button:not(:last-child) { border-bottom: 1px solid var(--border); }
.actions-dropdown-menu button.action-danger { color: var(--danger); }
.actions-dropdown-menu button.action-success { color: var(--success); }

/* ---------- Modal producto ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.56);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal-overlay.show { display: flex; }
.modal-overlay.show .modal-box { animation: modal-pop-in .18s ease-out; }
@keyframes modal-pop-in {
  from { opacity: 0; transform: scale(0.95) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 26px;
}
.modal-box h3 { margin-top: 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }

.form-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.form-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary-light);
  border-bottom: 1px solid #d3e7fb;
  padding: 10px 14px;
}
.section-subtitle-icon { font-size: 14px; }
.form-section-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  padding: 16px;
}
.form-section-body .full { grid-column: 1 / -1; }

.input-icon-wrap { position: relative; }
.input-icon-wrap input { padding-left: 30px; }
.input-icon-wrap.input-lock-wrap input { padding-right: 42px; }
.input-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -1px;
  pointer-events: none;
}

.toggle-pair {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 12px;
}
.toggle-pair button {
  flex: 1;
  border: none;
  background: var(--bg);
  padding: 7px;
  color: var(--text-muted);
  font-weight: 600;
}
.toggle-pair button.active {
  background: var(--primary);
  color: white;
}

.field input:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Quitar las flechas de incremento/decremento de los inputs numéricos (solo entorpecen) */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.input-lock-wrap { position: relative; }
.input-lock-wrap input { padding-right: 42px; }
.lock-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lock-btn:hover { background: var(--primary-dark); }

.profit-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}
.profit-indicator {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}
.profit-indicator.positive { background: var(--success-bg); color: var(--success); }
.profit-indicator.negative { background: var(--danger-bg); color: var(--danger); }
.profit-indicator-main { font-weight: 700; }
.profit-indicator-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0.9;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

.image-upload {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  position: relative;
}
.image-upload img { max-width: 100%; max-height: 140px; border-radius: 8px; }
.image-upload input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.image-upload .hint { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  /* !important es necesario aca: varios modulos (Cajas, Compras, Consumo
     Interno, Reportes, Ventas) definen su fila de filtros con un
     grid-template-columns puesto directo en el atributo style="" (para tener
     una cantidad de columnas distinta en cada uno) - un estilo en linea
     siempre le gana a una regla de CSS externa, asi que sin !important esta
     regla nunca se aplicaba y esos filtros quedaban aplastados en celular en
     vez de apilarse en una columna. */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-section-body { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr !important; }
}

.insights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 60;
    height: 100vh;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

  .menu-toggle { display: block; }
  .page-content { padding: 16px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .chart-wrap { height: 260px; }

  /* Barras de herramientas (buscador + botones de accion arriba de cada
     tabla): que cada boton ocupe todo el ancho disponible, apilados, en vez
     de quedar amontonados en una sola fila apretada. La estructura HTML
     varia segun el modulo (algunos ponen los botones directo dentro de
     .toolbar, otros los envuelven en un div aparte) - estos selectores
     cubren ambos casos, sin afectar el buscador. */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search-box { max-width: none; }
  .toolbar > div:not(.search-box) { display: flex; flex-direction: column; gap: 8px; }
  .toolbar .btn { width: 100%; }

  /* Modales: que aprovechen el ancho de la pantalla en vez de dejar margenes
     grandes a los costados. */
  .modal-overlay { padding: 10px; }
  .modal-box { padding: 18px; max-height: 88vh; }

  /* Tablas: un poco mas compactas para que quepa mas info antes de tener que
     scrollear horizontal. */
  table { font-size: 12px; }
  th, td { padding: 8px 8px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }

  /* El menu de acciones desplegable (usado en Compras, Ventas, Categorias,
     Cajas, Clientes, Cantidad, Promociones y Usuarios) no debe quedar mas
     angosto que la pantalla ni salirse por el borde derecho. */
  .actions-dropdown-menu { min-width: 150px; max-width: calc(100vw - 16px); }

  /* En pantallas muy angostas, las tarjetas KPI y los paneles pierden algo
     de padding para aprovechar mejor el espacio. */
  .panel { padding: 16px; }
  .kpi-card { padding: 14px; }

  /* Botones de guardar/cancelar en los modales: apilados y de ancho
     completo, mas faciles de tocar con el dedo. */
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* ================= Punto de Venta ================= */

/* ---- Pantalla de seleccion de caja ---- */
.register-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.register-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  background: var(--surface);
}
.register-card .icon { font-size: 34px; margin-bottom: 10px; }
.register-card .name { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.register-card .status { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }

/* ---- Layout principal: carrito (izquierda, mas ancho) + catalogo (derecha) ---- */
.pos-layout {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .pos-layout {
    grid-template-columns: 1fr;
  }

  /* En celular conviene ver primero los productos (lo que mas se usa), y
     dejar el carrito debajo, accesible con solo bajar un poco - no arriba
     ocupando toda la pantalla como en escritorio. */
  .pos-catalog {
    order: 1;
    height: 58vh;
  }
  .pos-cart {
    order: 2;
    position: static;
    height: auto;
    max-height: none;
    padding: 14px;
    padding-bottom: 70px; /* mismo motivo: espacio para el boton flotante */
    border-right: none;
    border-top: 1px solid var(--border);
  }
  .pos-cart-items {
    max-height: 34vh;
  }

  .pos-product-grid {
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
  }

  .pos-floating-cart-btn.has-items {
    display: flex;
  }

  /* Barra superior: se acomoda en dos filas en vez de achicar el texto hasta
     hacerlo ilegible - nombre de la caja arriba, botones de accion abajo. */
  .pos-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .pos-topbar-left {
    justify-content: center;
    text-align: center;
  }
  .pos-topbar-right {
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .pos-catalog { height: 52vh; }
  .pos-cart-items { max-height: 28vh; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
  .pos-topbar-right .btn { padding: 5px 8px; font-size: 10px; }
  .checkout-columns { grid-template-columns: 1fr; }
}

.pos-session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
}
.pos-session-bar .info { color: var(--text-muted); }
.pos-session-bar .info strong { color: var(--text); }

.pos-scan-box input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}
.pos-scan-box input:focus { outline: none; border-color: var(--primary); }

/* Icono circular "X" del modal "producto no encontrado" - mismo diseño que
   el resto de los modales del sistema (modal-overlay / modal-box), solo se
   agrega este icono como elemento distintivo. */
.pos-not-found-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.pos-bulk-qty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-light);
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

/* ---- Filtro de categorias (pastillas) ---- */
.pos-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.pos-category-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.pos-category-pill:hover { border-color: var(--primary); }
.pos-category-pill.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.pos-product-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.pos-product-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.pos-product-card:active { transform: scale(0.98); }
.pos-product-card .thumb-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  flex-shrink: 0;
}
.pos-product-card .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; }
.pos-product-card .thumb-wrap .placeholder { font-size: 20px; color: var(--text-muted); }
.pos-product-card .desc {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.25;
  margin-bottom: 5px;
  color: var(--text);
  width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
}
.pos-product-card .price { font-size: 13px; font-weight: 800; color: var(--primary); }
.pos-product-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }
.pos-pack-card { border-color: #b45309; background: #fffbeb; }
.pos-pack-card .price { color: #b45309; }

/* ---- Catalogo (izquierda): mismo alto que el carrito, con la grilla
   desplazandose internamente; buscador y pastillas de categoria quedan fijos
   arriba, para que ambas columnas se vean consistentes. ---- */
.pos-catalog {
  height: calc(100vh - 78px);
  display: flex;
  flex-direction: column;
}
.pos-catalog-fixed { flex-shrink: 0; }
.pos-catalog-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 4px;
}
.pos-loading-more {
  text-align: center;
  padding: 14px 0;
  color: var(--text-muted);
  font-size: 12px;
}
.pos-more-results-notice {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* ---- Carrito ("Venta actual"): fijo, se extiende hasta el fondo de la pantalla ---- */
.pos-cart {
  padding: 18px 18px 18px 0;
  position: sticky;
  top: 0;
  height: calc(100vh - 78px);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.pos-cart-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; flex-shrink: 0; }
.pos-cart-header h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.pos-cart-items { flex: 1; overflow-y: auto; margin-bottom: 14px; min-height: 0; }
.pos-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.pos-cart-item:last-child { border-bottom: none; }
.pos-cart-item .info { flex: 1; min-width: 0; }
.pos-cart-item .desc { font-size: 13px; font-weight: 600; }
.pos-cart-item .unit-price { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.pos-cart-item .offer-tag { font-size: 11px; font-weight: 700; color: #b45309; background: #fffbeb; border-radius: 5px; padding: 1px 6px; display: inline-block; margin: 2px 0; }

/* Boton lapiz para editar el precio en el carrito (Configuracion -> Punto de
   Venta -> "Editar precio en el carrito"). Discreto hasta que se pasa el
   mouse/toca, para no llamar la atencion cuando no se necesita. */
.edit-price-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  opacity: 0.6;
}
.edit-price-btn:hover { opacity: 1; }
.cart-price-input {
  width: 70px;
  padding: 2px 6px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-size: 12px;
}
.pos-qty-controls { display: flex; align-items: center; gap: 6px; }
.pos-qty-controls button {
  width: 24px; height: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}
.pos-qty-controls button:hover { border-color: var(--primary); color: var(--primary); }
.pos-qty-controls .qty { min-width: 20px; text-align: center; font-size: 13px; font-weight: 600; }
.pos-cart-item .line-total { font-size: 13px; font-weight: 700; min-width: 62px; text-align: right; }
.pos-cart-item .remove-btn { color: var(--danger); cursor: pointer; background: none; border: none; font-size: 15px; }

.pos-totals {
  border-top: 1px solid var(--border); padding-top: 12px; margin-bottom: 14px; flex-shrink: 0;
}
.pos-totals .row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.pos-totals .total-row { display: flex; justify-content: space-between; font-size: 24px; font-weight: 800; color: var(--text); margin-top: 0; }

/* Punto de Venta (clasico) - mismo banner oscuro con chips que Punto de
   Venta 2, para que ambos usen la misma paleta de colores. Scoped por ID
   para no afectar otras pantallas que tambien usan .pos-topbar. */
#posTopbar {
  background: linear-gradient(135deg, #0f2942, #1e3a5f); border-bottom: none;
  color: white; padding: 10px 16px;
}
#posTopbar .pos-topbar-left { color: white; font-size: 15px; }
#posTopbar .session-info { display: flex; gap: 8px; flex-wrap: wrap; margin-left: 4px; }
.pos-topbar-chip {
  background: rgba(255,255,255,0.12); border-radius: 20px; padding: 4px 12px;
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px;
  color: white;
}
.pos-topbar-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; display: inline-block; }
#posTopbar .pos-topbar-right .btn {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25); color: white;
}
#posTopbar .pos-topbar-right .btn:hover { background: rgba(255,255,255,0.2); }
#posTopbar .pos-topbar-right .btn.btn-secondary { background: rgba(255,255,255,0.18); }

.pos-payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; flex-shrink: 0; }

/* ---- Modal "Cobrar venta": columna izquierda (total + tipo de documento) y
   columna derecha (metodo de pago / motivo de consumo interno) ---- */
.checkout-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 18px;
}
.checkout-col { display: flex; flex-direction: column; }
@media (max-width: 640px) {
  .checkout-columns { grid-template-columns: 1fr; gap: 16px; }
}
/* Tarjetas seleccionables (radio) para elegir la modalidad del programa de
   beneficios en Configuracion. */
.loyalty-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.loyalty-mode-option input[type="radio"] { margin-top: 3px; }
.loyalty-mode-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.loyalty-mode-option.active { border-color: var(--primary); background: var(--primary-light); }

.pos-payment-btn {
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 10px 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.pos-payment-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }

.pos-charge-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: var(--success);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.pos-charge-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pos-charge-btn:hover:not(:disabled) { filter: brightness(0.95); }

/* Boton flotante "Ver carrito": solo aparece en celular (ver media query mas
   abajo) y solo cuando hay al menos un producto agregado - ahorra tener que
   scrollear manualmente para llegar al carrito y cobrar. */
.pos-floating-cart-btn {
  display: none;
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  align-items: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  white-space: nowrap;
}

/* ---- Contenedor de pantalla completa (sin sidebar/topbar de la app) ---- */
.pos-fullscreen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.pos-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 4px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.pos-topbar-left {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.pos-topbar-left .session-info {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: normal;
}
.pos-topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pos-topbar-right .btn {
  padding: 4px 9px;
  font-size: 11px;
}
.pos-body {
  flex: 1;
  padding: 20px 24px 32px;
  overflow-y: auto;
}
.pos-unauthorized {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

/* ---- Revisar turno: mismo alto en las 3 pestañas, con scroll interno si el contenido no cabe ---- */
.shift-review-body {
  height: 420px;
  overflow-y: auto;
}

/* ---- Revisar turno: filas resumen tipo "etiqueta: valor" ---- */
.kv-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 5px 0;
  color: var(--text-muted);
}
.kv-row.total {
  font-weight: 800;
  font-size: 16px;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 6px;
}

/* Cuando #documentPrintArea vive suelto en el body (no dentro del modal),
   se mantiene oculto y fuera de pantalla en el uso normal - visibility (no
   display:none) para que la regla de @media print de mas abajo SI pueda
   mostrarlo al imprimir (display:none no se puede "reactivar" con
   visibility, pero visibility si). Un selector por ID adentro de
   @media print le gana en especificidad a esta clase, sin necesitar
   !important. Cuando se reubica dentro del modal (ver mostrarDocumentoEnModal
   en pos.js), se le quita esta clase para que se vea con normalidad ahi. */
.print-area-standalone {
  visibility: hidden;
  position: fixed;
  top: -100vh;
  left: 0;
}

/* ---- Impresion de documentos: solo se imprime el area del comprobante ---- */
@media print {
  @page {
    /* Papel termico continuo (no tiene un "alto de pagina" fijo como una
       hoja carta/A4): se deja crecer segun el contenido, y sin margenes -
       el ancho real lo define el ancho de #documentPrintArea, que se
       configura en Configuracion -> Punto de Venta (57mm u 80mm). */
    size: auto;
    margin: 0;
  }
  body * { visibility: hidden; }
  #documentPrintArea, #documentPrintArea * { visibility: visible; }
  #documentPrintArea {
    position: absolute;
    top: 0;
    left: 0;
  }
  .no-print { display: none !important; }
}

/* ---- Modulo Ventas: fila marcada cuando tiene nota de credito emitida ---- */
.sale-row-voided { background: var(--danger-bg); }
.sale-row-voided td { color: var(--danger); text-decoration: line-through; }
.sale-row-voided td:last-child { text-decoration: none; } /* la columna de acciones no se tacha */

/* ---- Modulo Compras: resultados de busqueda de producto al armar una compra ---- */
.search-result-row:hover { background: var(--bg); }
.search-result-row:last-child { border-bottom: none; }

/* El modal de "Crear cliente rapido" (Punto de Venta) se abre ENCIMA del
   modal de cobro que ya esta abierto - sin esto, al compartir el mismo
   z-index que el resto de los modales, quedaria tapado por el que se abrio
   primero (el orden en el DOM decide el apilamiento quedando iguales). */
#quickCustomerModal { z-index: 200; }

/* Configuracion -> Dashboard: lista de interruptores de widgets visibles */
.widgets-toggle-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-width: 900px; }
.widget-toggle-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: border-color 0.15s ease, background-color 0.15s ease;
}
.widget-toggle-row:hover { border-color: var(--primary); background: var(--bg); }
.widget-toggle-row input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }

/* ===== Indicador de conexion (POS offline) ===== */
.conn-status { border: 0; border-radius: 999px; padding: 4px 12px; color: #fff; font-weight: 600; font-size: 12px; cursor: pointer; }
.conn-online  { background: #16a34a; }
.conn-offline { background: #dc2626; }
.conn-syncing { background: #d97706; }

/* ===== Documentos emitidos del turno: grilla responsiva (POS 1 y POS 2) ===== */
/* Un solo scroll: el cuerpo de la grilla. Titulo y botones del modal quedan fijos. */
.shift-review-box { display: flex; flex-direction: column; overflow: hidden; }
.shift-review-box .shift-review-body { height: auto; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }

.shift-docs-head, .shift-docs-row {
  display: grid;
  /* Columnas fijas e iguales en cabecera y filas (si no, cada fila se acomoda distinto y los datos no alinean) */
  grid-template-columns: minmax(0, 1.7fr) 52px minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1.2fr) 124px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.shift-docs-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg); border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
}
.shift-docs-row { border-bottom: 1px solid var(--border); font-size: 13px; }
.shift-docs-row:hover { background: var(--bg); }
.shift-docs-head > div:nth-child(4), .shift-docs-row .c-total { text-align: right; }
.shift-docs-row .c-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.shift-docs-row .c-hora { font-variant-numeric: tabular-nums; }
.shift-docs-row .c-doc { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.shift-docs-row .c-doc .shift-docs-sub { flex-basis: 100%; margin-top: 0; }
.shift-docs-row .badge { font-size: 10px; padding: 2px 6px; }
.shift-docs-legend { padding: 10px 10px 4px; font-size: 11px; color: var(--text-muted); }
.shift-docs-legend .badge { font-size: 10px; padding: 2px 6px; }
.shift-docs-row .c-acc { display: flex; gap: 4px; justify-content: flex-end; }
.shift-docs-sub { color: var(--text-muted); font-size: 11px; margin-top: 2px; }
.shift-docs-row.voided { background: var(--danger-bg); color: var(--danger); }
.shift-docs-row.voided .c-total { text-decoration: line-through; }

@media (max-width: 600px) {
  .shift-docs-head { display: none; }
  .shift-docs-row {
    grid-template-columns: 1fr 1fr auto;
    grid-template-areas: "doc doc total" "hora pago estado" "acc acc acc";
    row-gap: 4px;
  }
  .shift-docs-row .c-doc { grid-area: doc; }
  .shift-docs-row .c-total { grid-area: total; }
  .shift-docs-row .c-hora { grid-area: hora; color: var(--text-muted); }
  .shift-docs-row .c-pago { grid-area: pago; color: var(--text-muted); }
  .shift-docs-row .c-estado { grid-area: estado; }
  .shift-docs-row .c-acc { grid-area: acc; }
}


/* ---------- Login: mejora visual (aislado, no afecta otras pantallas) ---------- */
.login-wrapper {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(60% 50% at 12% 8%, rgba(255,255,255,0.18) 0%, transparent 60%),
    radial-gradient(50% 45% at 92% 96%, rgba(56,189,248,0.35) 0%, transparent 60%),
    linear-gradient(135deg, #087ceb 0%, #0647a6 100%);
}

.login-card {
  max-width: 400px;
  padding: 40px 36px 36px;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(4,40,92,0.32), 0 2px 6px rgba(4,40,92,0.10);
  animation: login-card-in .35s ease-out both;
}
@keyframes login-card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.login-logo { margin-bottom: 28px; }
.login-logo .logo {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 16px;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(8,124,235,0.30);
}
.login-logo h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.login-logo p  { margin-top: 6px; font-size: 13.5px; }

.login-card .field { margin-bottom: 16px; }
.login-card .field input {
  height: 44px;
  padding: 0 14px;
  font-size: 16px;            /* evita zoom automático en iOS */
  background: var(--bg);
}
.login-card .field input:hover { border-color: #cbd5e1; }
.login-card .field input:focus {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(8,124,235,0.16);
}
.login-card .field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 100px var(--primary-light) inset;
  -webkit-text-fill-color: var(--text);
}

#loginBtn {
  height: 46px;
  margin-top: 8px;
  font-size: 14.5px;
  background: linear-gradient(180deg, #2b93f3 0%, var(--primary) 100%);
  box-shadow: 0 4px 12px rgba(8,124,235,0.32);
}
#loginBtn:hover:not(:disabled) {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(8,124,235,0.38);
}
#loginBtn:focus-visible { outline: 3px solid rgba(8,124,235,0.35); outline-offset: 2px; }
#loginBtn:disabled { cursor: wait; opacity: .85; }
#loginBtn:disabled::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-spin .7s linear infinite;
}
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-card .error-msg {
  border: 1px solid #fecaca;
  border-left: 3px solid var(--danger);
  font-weight: 500;
}
.login-card .error-msg.show { animation: login-shake .35s ease; }
@keyframes login-shake {
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

@media (max-width: 480px) {
  .login-card { padding: 32px 22px 28px; }
  .login-logo .logo { width: 68px; height: 68px; }
  .login-logo h1 { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .login-card, .login-card .error-msg.show { animation: none; }
  #loginBtn { transition: none; }
}


/* ---------- Sidebar: marca (logo + nombre) ---------- */
.sidebar .brand-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(8,124,235,0.35);
}
.sidebar .brand > span { font-size: 17px; font-weight: 800; letter-spacing: -0.02em; color: white; }

/* =====================================================================
   Dashboard: cuadricula de 4 casillas, iconos, leyenda de tortas y "Editar orden"
   ===================================================================== */

/* Cuadricula de 4 casillas por fila: cada indicador ocupa 1, 2, 3 o 4.
   minmax(0, 1fr) evita que tablas y graficos ensanchen una columna. */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.dash-grid > .panel { margin-bottom: 0; }
.dash-span-1 { grid-column: span 1; }
.dash-span-2 { grid-column: span 2; }
.dash-span-3 { grid-column: span 3; }
.dash-span-4 { grid-column: span 4; }
/* Tablet: 1 casilla pasa a 2 (dos por fila) y 3 pasa a ancho completo */
@media (max-width: 1100px) {
  .dash-span-1 { grid-column: span 2; }
  .dash-span-3 { grid-column: span 4; }
}
/* Celular: todo a ancho completo */
@media (max-width: 720px) {
  .dash-span-1, .dash-span-2, .dash-span-3 { grid-column: span 4; }
}

/* Iconos de las tarjetas: SVG de trazo sobre un fondo suave del mismo color */
.kpi-card .kpi-icon svg { width: 22px; height: 22px; }
.kpi-icon.blue  { background: #dbeafe; color: #1d4ed8; }
.kpi-icon.green { background: var(--success-bg); color: var(--success); }
.kpi-icon.red   { background: var(--danger-bg); color: var(--danger); }
.kpi-icon.amber { background: var(--warning-bg); color: var(--warning); }

/* Titulos de los paneles del Dashboard con icono */
.dash-panel-title { display: flex; align-items: center; gap: 8px; }
.dash-panel-title .panel-icon { display: inline-flex; color: var(--primary); }
.dash-panel-title .panel-icon svg { width: 18px; height: 18px; }

/* Tortas: porcentaje y, debajo, el total vendido */
.pie-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px 16px;
  margin-top: 16px;
}
.pie-legend-item { display: flex; align-items: flex-start; gap: 8px; }
.pie-legend-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.pie-legend-name { font-size: 12px; color: var(--text-muted); }
.pie-legend-pct { font-size: 20px; font-weight: 700; line-height: 1.2; }
.pie-legend-amt { font-size: 13px; color: var(--text-muted); margin-top: 1px; }

/* Barra de "Editar orden" (solo administrador) */
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.dash-toolbar .dash-hint { margin-right: auto; font-size: 13px; color: var(--text-muted); }
.dash-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.dash-toolbar .btn svg { width: 16px; height: 16px; }

/* Modo edicion: borde punteado, ancho en casillas y flechas de posicion */
.dash-editing {
  outline: 2px dashed var(--primary);
  outline-offset: 3px;
  cursor: grab;
}
.dash-editing.dash-dragging { opacity: .45; }
.dash-editing.dash-drop-target { outline-style: solid; background: var(--primary-light); }
.kpi-card.dash-editing { flex-wrap: wrap; }

.dash-edit-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  flex: 0 0 100%;
  order: 10; /* en las tarjetas (flex) los controles van al final; en los paneles, arriba */
}
.kpi-card .dash-edit-controls { margin-bottom: 0; }
.dash-size-group, .dash-move-group { display: flex; align-items: center; gap: 4px; }
.dash-size-label { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-right: 2px; }
.dash-edit-controls button {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.dash-edit-controls button:hover:not(:disabled) { background: var(--primary-light); color: var(--primary-dark); }
.dash-edit-controls button:disabled { opacity: .35; cursor: default; }
.dash-edit-controls .dash-size-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.dash-edit-controls svg { width: 16px; height: 16px; }

/* Ayuda "?" de los indicadores del Dashboard: boton junto al titulo y globo con la descripcion */
.help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  flex-shrink: 0;
}
.help-btn:hover, .help-btn:focus-visible, .help-btn[aria-expanded="true"] {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary-dark);
  outline: none;
}
.help-tip {
  position: fixed;
  z-index: 1000;
  max-width: min(380px, calc(100vw - 16px));
  max-height: 70vh;
  overflow-y: auto;
  padding: 12px 14px;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .35);
  font-size: 12.5px;
  line-height: 1.45;
}
.help-tip[hidden] { display: none; }
.help-tip strong { display: block; font-size: 13px; margin-bottom: 6px; }
.help-tip p { margin: 0 0 6px; }
.help-tip ul { margin: 4px 0 8px; padding-left: 18px; }
.help-tip li { margin-bottom: 4px; }
.help-tip b { color: #fff; }
.help-tip .help-note { color: #cbd5e1; font-size: 12px; margin-bottom: 0; }

/* Filtros del grafico de ventas: listas desplegables de seleccion multiple (Documento y Categoria) */
.ms { position: relative; }
.ms-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 300px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.ms-btn:hover, .ms.open .ms-btn, .ms-btn:focus-visible { border-color: var(--primary); outline: none; }
.ms-label { color: var(--text-muted); font-weight: 600; }
.ms-value { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-caret { width: 14px; height: 14px; flex-shrink: 0; color: var(--text-muted); transition: transform .15s; }
.ms.open .ms-caret { transform: rotate(180deg); }
.ms-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-width: min(340px, 90vw);
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .15);
}
.ms-menu[hidden] { display: none; }
.ms-actions { display: flex; gap: 6px; padding: 2px 4px 8px; margin-bottom: 6px; border-bottom: 1px solid var(--border-light); }
.ms-actions button {
  padding: 4px 6px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.ms-actions button:hover { background: var(--primary-light); }
.ms-options { max-height: 240px; overflow-y: auto; }
.ms-option { display: flex; align-items: center; gap: 8px; margin: 0; padding: 7px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.ms-option:hover { background: var(--bg); }
.ms-option input { width: auto; margin: 0; }

/* La opcion de notas de credito / devoluciones va separada, al final de la lista Documento */
.ms-option.ms-sep { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--border-light); border-radius: 0 0 8px 8px; }

/* Grafico de ventas con tabla de resumen al lado (se apila sola cuando no hay ancho) */
.chart-split { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.chart-main { flex: 2 1 420px; min-width: 0; }
.chart-side { flex: 1 1 320px; min-width: 0; max-width: 440px; }
.chart-side-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mini-table th { padding: 6px 4px; border-bottom: 1px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: 12px; text-align: left; }
.mini-table td { padding: 6px 4px; border-bottom: 1px solid var(--border-light); }
.mini-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mini-table .neg { color: var(--danger); }
.mini-table .mini-credit td:first-child { color: var(--danger); }
.mini-table .mini-total td { border-top: 2px solid var(--border); border-bottom: none; font-weight: 700; }
.mini-muted td, .mini-muted { color: var(--text-muted); }
.mini-zero { color: var(--text-muted); font-weight: 400; }

/* Numero de posicion en los rankings (Productos y Packs mas vendidos) */
.rank-col { width: 44px; text-align: center; }
.rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.rank-1 { background: #fef3c7; color: #92400e; }
.rank-2 { background: #e2e8f0; color: #334155; }
.rank-3 { background: #fde8d7; color: #9a3412; }

/* Ganancia del mes: ganancia, margen y rentabilidad */
.profit-period { font-size: 12px; color: var(--text-muted); }
.profit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 18px 24px; }
.profit-metric { min-width: 0; }
.profit-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.profit-value { font-size: 26px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.profit-value.profit-small { font-size: 18px; }
.profit-value.neg { color: var(--danger); }
.profit-value.warn { color: var(--warning); }
.profit-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.profit-main { grid-column: auto; }
.profit-warn { margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--warning-bg); color: var(--text); font-size: 12.5px; line-height: 1.45; }

/* =====================================================================
   Menu lateral en celular: debe poder desplazarse cuando no cabe en pantalla
   (antes era un panel fijo de alto 100vh SIN desplazamiento: lo que no cabia
   quedaba cortado y al deslizar el dedo se movia la pagina de atras)
   ===================================================================== */
@media (max-width: 768px) {
  .sidebar {
    top: 0;
    bottom: 0;
    height: auto;              /* ocupa el alto visible (top + bottom), sin depender de 100vh */
    max-height: 100vh;
    max-height: 100dvh;        /* en navegadores nuevos descuenta la barra de direcciones del celular */
    overflow-y: auto;          /* permite bajar dentro del menu */
    overscroll-behavior: contain; /* el desplazamiento del menu no arrastra la pagina de atras */
    -webkit-overflow-scrolling: touch;
    /* Margen inferior: en un iPhone la barra de Safari (~86 px) puede tapar el borde de abajo; con este espacio
       el ultimo boton (Cerrar sesion) siempre se puede subir por encima de ella. */
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
}

/* =====================================================================
   Iconos del menu lateral: de emoji a iconos de linea (SVG) que heredan el color del texto
   (menu-icons.js los coloca; si ese script no esta, los emojis siguen igual que antes)
   ===================================================================== */
.sidebar .icon.icon-svg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
  font-size: 0;
  line-height: 1;
}
.sidebar .icon-svg .menu-svg { width: 18px; height: 18px; }
.sidebar nav a .icon-svg,
.sidebar .sidebar-subitem .icon-svg { opacity: .85; transition: opacity .15s ease; }
.sidebar nav a:hover .icon-svg,
.sidebar .sidebar-subitem:hover .icon-svg,
.sidebar a.active .icon-svg { opacity: 1; }

/* Boton hamburguesa del celular: icono de linea (SVG) en vez del caracter ☰ */
.menu-toggle { color: var(--text); }
.menu-toggle svg { width: 24px; height: 24px; display: block; }

/* =====================================================================
   Resumen de cierre de caja (modal estilo SweetAlert)
   ===================================================================== */
body.cc-open { overflow: hidden; }
.cc-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .6);
  backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .15s ease;
}
.cc-overlay.show { opacity: 1; }
.cc-card {
  width: 100%; max-width: 860px;
  max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 25px 60px rgba(15, 23, 42, .35);
  text-align: center;
  transform: scale(.94) translateY(8px); transition: transform .18s ease;
}
/* el contenido se desplaza por dentro; el boton Aceptar queda siempre visible abajo */
.cc-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 28px 24px 8px; }
.cc-overlay.show .cc-card { transform: none; }
.cc-icon {
  width: 64px; height: 64px; margin: 0 auto 10px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  animation: cc-icon-pop .45s ease-out;
}
.cc-icon svg { width: 34px; height: 34px; }
.cc-icon-ok { background: var(--success-bg); color: var(--success); }
.cc-icon-warn { background: var(--warning-bg); color: var(--warning); }
@keyframes cc-icon-pop { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
.cc-title { margin: 0; font-size: 22px; font-weight: 700; }
.cc-register { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--primary); }
.cc-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.cc-body {
  margin-top: 14px; text-align: left;
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
  grid-template-areas: "ventas" "efectivo" "nota";
}
.cc-sec-ventas { grid-area: ventas; }
.cc-sec-efectivo { grid-area: efectivo; }
.cc-sec-nota { grid-area: nota; }
/* en pantallas anchas: ventas (con la maquina de pago) a la izquierda; el cuadre del efectivo y la nota a la derecha */
@media (min-width: 760px) {
  .cc-body { grid-template-columns: 1fr 1fr; grid-template-areas: "ventas efectivo" "ventas nota"; align-items: start; }
  .cc-scroll { padding: 22px 32px 8px; }
  .cc-actions { padding: 14px 32px 22px; }
}
.cc-section { margin-bottom: 0; padding: 12px 14px; background: var(--bg); border-radius: 12px; }
.cc-section-title { margin-bottom: 6px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.cc-section-title span { margin-left: 4px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.cc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 14px; }
.cc-row small { margin-left: 4px; font-size: 11.5px; color: var(--text-muted); }
.cc-row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-subtitle { margin: 12px 0 4px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.cc-subtitle span { margin-left: 4px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.cc-row-total { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); font-weight: 700; }
.cc-row-total strong { font-size: 16px; }
.cc-row-diff { margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--border); font-weight: 600; }
.cc-badge { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.cc-badge-ok { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.cc-badge-over { background: var(--success-bg); color: var(--success); }
.cc-badge-short { background: var(--danger-bg); color: var(--danger); }
.cc-note { margin-top: 6px; font-size: 12.5px; color: var(--text-muted); }
.cc-note-warn { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--warning-bg); color: var(--text); }
.cc-actions { flex: 0 0 auto; padding: 12px 24px 20px; border-top: 1px solid var(--border-light); }
.cc-btn {
  min-width: 140px; padding: 12px 28px;
  border: none; border-radius: 10px;
  background: var(--primary); color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.cc-btn:hover { background: var(--primary-dark); }
.cc-btn:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }
@media (max-width: 480px) {
  .cc-card { border-radius: 16px; }
  .cc-scroll { padding: 22px 16px 6px; }
  .cc-actions { padding: 10px 16px 16px; }
  .cc-btn { width: 100%; }
}

/* Esperado que se muestra bajo los campos al CERRAR la caja (efectivo y maquina de pago) */
.cc-expected {
  margin-top: 8px; padding: 9px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 10px; background: var(--primary-light);
  font-size: 13.5px; font-weight: 600; color: var(--text); text-align: left;
}
.cc-expected small { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 400; color: var(--text-muted); }
.cc-expected strong { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cc-expected-loading { opacity: .65; font-weight: 400; }
.cc-expected-error { background: var(--warning-bg); font-size: 12.5px; font-weight: 400; }

/* =====================================================================
   Movimientos de caja: bloques "+ Ingreso" / "− Egreso" y observacion
   ===================================================================== */
.mv-type { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.mv-type-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 10px 12px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text-muted);
  font-size: 15px; font-weight: 700; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.mv-type-btn:hover:not(.active) { border-color: var(--text-muted); color: var(--text); }
.mv-type-btn:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }
.mv-sign {
  width: 30px; height: 30px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--bg);
  font-size: 22px; font-weight: 800; line-height: 1;
}
.mv-ingreso.active { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.mv-ingreso.active .mv-sign { background: var(--success); color: #fff; }
.mv-egreso.active { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.mv-egreso.active .mv-sign { background: var(--danger); color: #fff; }
.mv-obs-text { display: block; margin-top: 1px; font-size: 11.5px; font-weight: 400; color: var(--text-muted); }

/* =====================================================================
   Productos: el stock ya no se edita en el formulario (se muestra como texto)
   ===================================================================== */
.stock-note {
  margin-top: 6px; padding: 9px 12px;
  border-radius: 10px; background: var(--bg);
  font-size: 13.5px; color: var(--text);
}
.stock-note small { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 400; color: var(--text-muted); }
.stock-note a { color: var(--primary); font-weight: 600; }
