:root {
  --bg: #0b1020;
  --bg-soft: #121936;
  --panel: rgba(255,255,255,0.06);
  --panel-strong: rgba(255,255,255,0.1);
  --border: rgba(255,255,255,0.12);
  --text: #e8ecf7;
  --muted: #a7b0c8;
  --primary: #6ea8fe;
  --primary-strong: #4d8df5;
  --danger: #ff6b6b;
  --success: #3ddc97;
  --shadow: 0 20px 60px rgba(0,0,0,0.35);
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #243b7a 0%, transparent 60%),
    radial-gradient(900px 500px at 100% 0%, #1b6b5a 0%, transparent 55%),
    var(--bg);
}
a { color: var(--primary); }

/* Login */
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.card {
  width: 100%;
  max-width: 360px;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  margin: auto 0;
}
.brand { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; font-size: 0.75rem;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  display: grid; place-items: center; font-weight: 700;
}
h1 { margin: 0; font-size: 1.6rem; }
.subtitle { color: var(--muted); margin: 4px 0 24px; }
.field { margin-bottom: 14px; }
label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
input, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(10, 14, 30, 0.6);
  color: var(--text);
  outline: none;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(110,168,254,0.2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 12px; border: 1px solid transparent;
  background: var(--primary); color: #081225; font-weight: 600; cursor: pointer;
  transition: transform .05s ease, background .2s ease;
}
.btn:hover { background: var(--primary-strong); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: rgba(255,107,107,0.15); color: #ffd6d6; border-color: rgba(255,107,107,0.4); }
.btn.solid-danger { background: #dc2626; color: #fff; border-color: #b91c1c; }
.btn.solid-danger:hover { background: #ef4444; }
.btn-warning { background: #f59e0b; color: #111827; border-color: #d97706; }
.btn-warning:hover { background: #fbbf24; }
.perms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.perms-grid label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; cursor: pointer; }
.perms-grid input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }
label > input[type="checkbox"] { flex: 0 0 auto; }
.perms-group { grid-column: 1 / -1; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; margin: 2px 0; }
.perms-group-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.perms-subgrid { margin-top: 2px; }

/* Gestión tabs */
.gestion-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tab-btn { background: transparent; color: var(--text); border: 1px solid var(--border); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.tab-btn:hover { background: rgba(255,255,255,0.06); }
.tab-btn.active { background: rgba(110,168,254,0.18); border-color: rgba(110,168,254,0.5); }
.gestion-panel { display: block; }
.gestion-panel[style*="display:none"] { }
.gestion-panel .table-wrap { overflow: auto; margin: 0; }
.gestion-panel table { width: 100%; border-collapse: separate; border-spacing: 0; }
.gestion-panel thead th { border-bottom: 1px solid var(--border); }
.gestion-panel th,
.gestion-panel td { padding: 8px 10px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.gestion-panel tbody tr { background: transparent; }
.gestion-panel tbody tr:last-child td { border-bottom: 0; }
.gestion-panel tr, .gestion-panel td, .gestion-panel th { margin: 0; }
.btn.block { width: 100%; margin-top: 8px; }
.error { color: #ffb4b4; min-height: 20px; font-size: 0.9rem; margin-top: 8px; }
.hint { margin-top: 16px; color: var(--muted); font-size: 0.85rem; }

/* App layout */
.app { display: grid; grid-template-columns: 260px 1fr; height: 100vh; overflow: hidden; }
.sidebar {
  background: rgba(8, 12, 28, 0.7);
  border-right: 1px solid var(--border);
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 6px;
  backdrop-filter: blur(8px);
  height: 100vh; overflow: hidden;
}
.sidebar .brand { padding: 4px 8px; flex: 0 0 auto; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.nav-item {
  padding: 5px 8px; border-radius: 8px; color: var(--muted); font-size: 0.84rem; line-height: 1.2;
  cursor: pointer; border: 1px solid transparent;
}
.nav-item.active, .nav-item:hover {
  color: var(--text); background: var(--panel); border-color: var(--border);
}
.sidebar-footer { margin-top: 0; display: flex; flex-direction: column; gap: 6px; flex: 0 0 auto; padding-top: 6px; border-top: 1px solid var(--border); }
.me { padding: 6px 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); }
.me .name { font-weight: 600; font-size: 0.82rem; }
.me .email { color: var(--muted); font-size: 0.7rem; }

.main { padding: 28px 32px; height: 100vh; overflow-y: auto; overflow-x: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.topbar h2 { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--muted, #94a3b8); letter-spacing: .01em; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px; font-size: 0.85rem;
  background: rgba(61,220,151,0.15); color: #bff3dc; border: 1px solid rgba(61,220,151,0.35);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(61,220,151,0.15); }

.grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.panel h3 { margin: 0; font-size: 0.95rem; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions { display: flex; gap: 8px; margin-top: 10px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
tr:hover td { background: rgba(255,255,255,0.03); }
.pill { padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; border: 1px solid var(--border); }
.pill.admin { background: rgba(110,168,254,0.15); color: #cfe2ff; border-color: rgba(110,168,254,0.4); }
.pill.user { background: rgba(255,255,255,0.06); color: var(--muted); }
.row-actions { display: flex; gap: 6px; }
.small { padding: 6px 10px; font-size: 0.85rem; border-radius: 10px; }
.muted { color: var(--muted); }
.toast { margin-top: 10px; min-height: 20px; font-size: 0.9rem; }
.toast:empty { display: none; }
#inventory-toast { margin-top: 4px; min-height: 0; }
.toast.ok { color: #bff3dc; }
.toast.err { color: #ffb4b4; }

.toast.floating-toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  margin: 0;
  min-height: 0;
  max-width: min(92vw, 520px);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  background: #1f2937;
  color: #e5e7eb;
  display: none;
  pointer-events: none;
}
.toast.floating-toast.show { display: block; }
.toast.floating-toast.ok { background: #065f46; color: #ecfdf5; border-color: #10b981; }
.toast.floating-toast.err { background: #7f1d1d; color: #fef2f2; border-color: #ef4444; }

/* Modal */
.modal {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: 24px; background: rgba(5, 8, 20, 0.65); backdrop-filter: blur(4px); z-index: 50;
}
.modal.open { display: flex; }
.modal-content {
  width: 100%; max-width: 520px; background: linear-gradient(180deg, rgba(30,38,70,0.98), rgba(18,25,54,0.98));
  border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow);
  max-height: 90vh; overflow: auto;
}
.modal-content.wide { max-width: 1200px; width: 100%; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; }
.modal-header h3 { margin: 0; font-size: 1rem; }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: 10px; width: 34px; height: 34px; cursor: pointer; }
.icon-btn[data-close],
.modal .icon-btn[data-close] {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
  opacity: 1;
}
.icon-btn[data-close]:hover,
.modal .icon-btn[data-close]:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}
.drag-grip { cursor: grab; display: inline-flex; align-items: center; justify-content: center; padding: 2px 6px; margin-right: 4px; border-radius: 6px; user-select: none; color: var(--muted); font-weight: 700; }
.drag-grip:active { cursor: grabbing; }
.drag-grip:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.detail-remove,
[data-remove-draft],
[data-remove-obs] {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #fff !important;
  font-weight: 700;
  opacity: 1;
}
.detail-remove:hover,
[data-remove-draft]:hover,
[data-remove-obs]:hover {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}

/* Number inputs: hide spinners */
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[type="color"] {
  width: 72px;
  min-width: 72px;
  height: 42px;
  padding: 4px;
  border-radius: 10px;
  cursor: pointer;
  flex: 0 0 auto;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 6px; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 6px; }

/* Inventarios */
.inv-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.inv-toolbar label { margin: 0; color: var(--text); font-weight: 600; }
.inv-toolbar input[type=date] { width: auto; min-width: 190px; background: #162a52; color: #e8f1ff; border: 1px solid #5fa8ff; font-weight: 600; color-scheme: dark; }
.inv-toolbar input[type=date]:focus { border-color: #9fd0ff; box-shadow: 0 0 0 3px rgba(95,168,255,0.25); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.store-card { background: linear-gradient(180deg, rgba(40,70,140,0.45), rgba(20,35,70,0.7)); border: 1px solid rgba(120,170,255,0.35); border-radius: var(--radius); padding: 16px; box-shadow: 0 10px 24px rgba(0,0,0,0.25); }
.store-card h4 { margin: 0 0 12px; font-size: 1rem; color: #eaf3ff; }
.shifts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
.shift { border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; border: 1px solid transparent; min-width: 0; box-sizing: border-box; }
.shift .shift-title, .shift .muted { overflow-wrap: anywhere; }
.shift .btn { width: 100%; max-width: 100%; box-sizing: border-box; }
.shift:nth-child(1) { background: rgba(255, 179, 71, 0.15); border-color: rgba(255, 179, 71, 0.45); }
.shift:nth-child(2) { background: rgba(120, 170, 255, 0.15); border-color: rgba(120, 170, 255, 0.45); }
.shift .label { font-size: 0.9rem; color: #eef5ff; font-weight: 600; }
.shift .status { font-size: 0.8rem; }
.shift .status.ok { color: #9fffcf; font-weight: 600; }
.inv-meta { color: var(--muted); font-size: 0.85rem; }
.inv-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 2px; }
.inv-detail-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.inv-detail-title h3 { margin: 0; font-size: 0.95rem; }
.inv-detail-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#ventas-chart svg { background: #fff; border: 1px solid var(--border, #e2e8f0); border-radius: 12px; }
#ventas-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.inv-table { border: 1px solid #9aa6c3; border-collapse: collapse; background: #0f1730; width: 100%; table-layout: fixed; }
.inv-table th, .inv-table td { border: 1px solid #7f8db0; padding: 0; }
.inv-table th { background: #dfe7f5; color: #111827; font-weight: 700; position: sticky; top: 0; z-index: 5; text-align: center; box-shadow: 0 1px 0 #7f8db0; font-size: 0.78rem; }
.inv-table thead th { background-clip: padding-box; }
.inv-table th.vhead { height: 110px; vertical-align: bottom; padding: 4px 2px; text-align: center; }
.inv-table th.vhead span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; font-size: 0.8rem; line-height: 1; padding: 4px 0; }
.inv-table td { background: #fff; color: #111827; height: 20px; }
.inv-table td > div { padding: 1px 3px; line-height: 1.1; }
.inv-table td .muted { color: #4b5563; }
.inv-table td.group-cell { background: #cfe0ff; color: #0b2459; font-weight: 700; padding: 2px 6px; font-size: 0.78rem; }
.inv-table input {
  width: 100%; height: 18px; min-width: 0; padding: 0 2px; font-size: 0.78rem; text-align: center;
  border: 1px solid transparent; border-radius: 0; background: #fff; color: #111827;
}
.inv-table input:focus { border-color: #93c5fd; box-shadow: inset 0 0 0 1px #93c5fd; }
.inv-table input.calc { background: #f8fafc; font-weight: 700; }
.inv-table td.price-cell { text-align: right; font-size: 0.78rem; padding: 0 3px; white-space: nowrap; }
.inv-table td.product-cell { font-size: 0.78rem; white-space: normal; overflow: hidden; text-overflow: ellipsis; }
.inv-table td.money-cell { text-align: right; font-size: 0.78rem; padding: 0 3px; background: #f3f4f6; white-space: nowrap; }
.inv-table td, .inv-table th { overflow: hidden; }
.inv-table td, .inv-table input, .inv-table .group-cell { scroll-margin-top: 120px; }
.inv-table col.col-price { width: 72px; }
.inv-table col.col-product { width: auto; }
.inv-table col.col-num { width: 46px; }
.inv-table col.col-money { width: 90px; }
.inv-table tr:hover td { background: #fff; }
.inv-table tr:hover td.group-cell { background: #cfe0ff; }
.inv-table tr:hover td.money-cell { background: #f3f4f6; }
.inv-table th.hl-inicio, .inv-table td.hl-inicio { background: #fff7cc; }
.inv-table th.hl-final, .inv-table td.hl-final { background: #ffe1cc; }
.inv-table th.hl-venta, .inv-table td.hl-venta { background: #dff7df; }
.inv-table td.hl-inicio input, .inv-table td.hl-final input { background: #fffdf0; }
.inv-table td.hl-venta input { background: #f3fbf3; }
.inv-table tr:hover td.hl-inicio { background: #fff7cc; }
.inv-table tr:hover td.hl-final { background: #ffe1cc; }
.inv-table tr:hover td.hl-venta { background: #dff7df; }

/* Inventory detail layout & summary cards */
.inv-layout { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: start; }
.inv-side { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
/* Inventory detail: table scrolls separately, side scrolls with page */
#page-inventory-detail .inv-layout { align-items: start; }
#page-inventory-detail .inv-side { overflow: visible; }
#page-inventory-detail .table-wrap { overflow: auto; max-height: calc(100vh - 150px); min-height: 420px; position: sticky; top: 12px; align-self: start; scroll-padding-top: 120px; background: #0f1730; }
.sum-card { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; min-width: 0; }
.result-card { grid-column: 1 / -1; }
.sum-card .label { font-size: 0.72rem; color: var(--muted); margin-bottom: 3px; line-height: 1.2; }
.sum-card .value { font-size: 0.88rem; font-weight: 700; }
.sum-card .sub { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.sum-card input { width: 100%; padding: 5px 7px; border-radius: 7px; border: 1px solid var(--border); background: rgba(10,14,30,0.6); color: var(--text); font-size: 0.85rem; }
.sum-card.clickable { cursor: pointer; transition: border-color .15s, background .15s; }
.sum-card.clickable:hover { border-color: var(--primary); background: rgba(110,168,254,0.08); }
.sum-card.ok { border-color: rgba(61,220,151,0.6); background: rgba(61,220,151,0.08); }
.sum-card.falta { border-color: rgba(255,107,107,0.6); background: rgba(255,107,107,0.08); }
.sum-card.sobra { border-color: rgba(80,200,255,0.6); background: rgba(80,200,255,0.08); }
.sum-card .status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; }
.status-pill.ok { background: #22c55e; color: #ffffff; }
.status-pill.falta { background: #ef4444; color: #ffffff; }
.status-pill.sobra { background: #38bdf8; color: #ffffff; }
.detail-total { font-weight: 700; margin: 8px 0; }
.sum-diff-amt { margin-left: 6px; font-size: 0.9rem; font-weight: 700; }
#sum-estado-card { position: relative; overflow: hidden; }
#sum-estado-card .result-card-content { position: relative; z-index: 1; }
#sum-estado-card .result-value { display: flex; align-items: center; gap: 8px; }
#sum-estado-card .result-text { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.sum-estado-shift-icon { display: none; position: absolute; inset: 0; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: 3.6rem; line-height: 1; pointer-events: none; z-index: 0; opacity: 1; }
.sum-estado-shift-icon.shift-am { display: flex; color: #f59e0b; }
.sum-estado-shift-icon.shift-pm { display: flex; color: #93c5fd; }
.detail-modal-content { max-width: 700px; display: flex; flex-direction: column; max-height: 85vh; overflow: hidden; }
.detail-table-wrap { flex: 1; overflow: auto; min-height: 0; }
#detail-modal .inv-table th, #detail-modal .inv-table td { padding: 4px; text-align: left; }
#detail-modal .inv-table th { padding: 8px; text-align: center; position: sticky; top: 0; z-index: 1; }
#detail-modal .inv-table input { height: 28px; min-width: 60px; }
.detail-remove-btn { width: 26px; height: 26px; border-radius: 6px; border: none; background: #dc2626; color: #fff; font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(220,38,38,0.35); }
.detail-remove-btn:hover { background: #ef4444; }
.detail-remove-btn:active { transform: scale(0.96); }
@media (max-width: 1100px) {
  .inv-layout { grid-template-columns: 1fr; }
  .inv-side { grid-template-columns: repeat(2, 1fr); }
  #page-inventory-detail .table-wrap { position: static; max-height: none; min-height: 0; height: auto; overflow: visible; }
}

.menu-btn { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; display: block; height: auto; overflow: visible; }
  .main { height: auto; overflow: visible; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
  .topbar { gap: 10px; align-items: center; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(290px, 86vw);
    z-index: 60; transform: translateX(-100%); transition: transform .2s ease;
    padding: 16px 14px; gap: 10px; overflow: hidden;
    box-shadow: 8px 0 24px rgba(0,0,0,0.4);
    height: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; position: fixed; inset: 0; background: rgba(5,8,20,0.55); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s ease; }
  .sidebar-overlay.open { opacity: 1; pointer-events: auto; }
  .nav { flex-direction: column; overflow: visible; gap: 6px; }
  .nav-item { white-space: normal; flex: initial; padding: 10px 12px; }
  .sidebar-footer { margin-top: auto; margin-left: 0; flex-direction: column; align-items: stretch; }
  .sidebar-footer .btn { width: 100%; }
  .main { padding: 14px 12px; min-width: 0; width: 100%; }
  .grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .main { padding: 10px 8px; }
  .topbar h2 { font-size: 1.15rem; }
  .panel { padding: 10px; border-radius: 12px; }
  .panel-header { flex-wrap: wrap; align-items: stretch; gap: 8px; }
  .panel-header .btn { width: 100%; }
  .form-row { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .shifts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .inv-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .inv-toolbar input[type=date] { width: 100%; min-width: 0; }
  .inv-detail-header { flex-direction: column; align-items: stretch; gap: 4px; }
  .inv-detail-title { flex: 0 0 auto; }
  #page-inventory-detail .table-wrap { position: static; max-height: none; min-height: 0; height: auto; overflow: visible; }
  .inv-detail-actions { width: 100%; flex-wrap: wrap; gap: 4px; justify-content: flex-end; align-items: center; }
  .inv-detail-actions .inv-meta { flex: 1 1 auto; margin-right: auto; font-size: 0.72rem; }
  .inv-detail-actions .btn { flex: 0 0 auto; justify-content: center; font-size: 0.72rem; padding: 4px 8px; min-width: 0; }
  /* summary cards: multiple columns, minimal width */
  .inv-side { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .sum-card { padding: 4px 5px; border-radius: 8px; }
  .sum-card .label { font-size: 0.62rem; margin-bottom: 2px; line-height: 1.15; }
  .sum-card .value { font-size: 0.74rem; }
  .sum-card .sub { font-size: 0.62rem; }
  .sum-card input { padding: 3px 4px; font-size: 0.72rem; }
  .sum-card .status-pill { font-size: 0.68rem; padding: 2px 6px; }
  .result-card { grid-column: 1 / -1; }
  .modal { padding: 10px; align-items: flex-start; overflow-y: auto; }
  .modal-content { max-width: 100%; width: 100%; border-radius: 14px; max-height: calc(var(--vvh, 100dvh) - 16px); padding: 10px; }
  .modal-content.wide { max-width: 100%; width: 100%; }
  .detail-modal-content { max-height: calc(var(--vvh, 100dvh) - 16px); overflow: auto; }
  .pick-layout { grid-template-columns: 1fr; flex: none; }
  .pick-right { order: -1; }
  .pick-left .search-results { max-height: 35vh; }
  .modal-header { flex-wrap: wrap; }
  .row-actions { flex-wrap: wrap; gap: 4px; }
  .row-actions .btn.small { padding: 4px 6px; font-size: 0.72rem; }
  /* general tables: fit screen, no horizontal slide */
  .table-wrap { -webkit-overflow-scrolling: touch; max-width: 100%; overflow-x: hidden; }
  table { width: 100%; table-layout: fixed; }
  th, td { padding: 6px 4px; font-size: 0.72rem; word-break: break-word; overflow-wrap: anywhere; white-space: normal; }
  th { font-size: 0.68rem; }
  .pill { font-size: 0.68rem; padding: 2px 6px; }
  .pending-batch-card, .obs-entry-card, .inv-col-group-card { min-width: 0 !important; width: 100%; max-width: 100%; }
  .pending-batch-row { flex-wrap: wrap; }
  /* inventory table compact to fit screen, show product names */
  .inv-table { font-size: 0.64rem; table-layout: fixed; width: 100%; }
  .inv-table th.vhead { height: 58px; padding: 1px 0; }
  .inv-table th.vhead span { font-size: 0.56rem; }
  #page-inventory-detail .table-wrap { scroll-padding-top: 70px; }
  .inv-table td, .inv-table input, .inv-table .group-cell { scroll-margin-top: 70px; }
  .inv-table td .muted, .inv-table td { font-size: 0.64rem; }
  .inv-table td > div { padding: 1px 1px; }
  .inv-table input { height: 18px; font-size: 0.62rem; padding: 0 1px; min-width: 0; }
  .inv-table td.price-cell, .inv-table td.money-cell { font-size: 0.6rem; padding: 0 1px; }
  .inv-table td.product-cell { font-size: 0.62rem; white-space: normal; word-break: break-word; overflow-wrap: anywhere; line-height: 1.1; }
  .inv-table col.col-price { width: 11%; }
  .inv-table col.col-product { width: 24%; }
  .inv-table col.col-num { width: 7%; }
  .inv-table col.col-money { width: 16%; }
}

@media (max-width: 420px) {
  .shifts { grid-template-columns: 1fr; }
  .inv-side { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar-footer { flex-direction: column; align-items: stretch; }
  .sidebar-footer .btn { width: 100%; }
  th, td { padding: 5px 3px; font-size: 0.68rem; }
  .inv-table { font-size: 0.58rem; }
  .inv-table th.vhead { height: 50px; }
  .inv-table th.vhead span { font-size: 0.5rem; }
  #page-inventory-detail .table-wrap { scroll-padding-top: 60px; }
  .inv-table td, .inv-table input, .inv-table .group-cell { scroll-margin-top: 60px; }
  .inv-table input { font-size: 0.56rem; height: 16px; }
  .inv-table td.product-cell { font-size: 0.56rem; }
  .inv-table td.price-cell, .inv-table td.money-cell { font-size: 0.54rem; }
  .sum-card .label { font-size: 0.58rem; }
  .sum-card .value { font-size: 0.68rem; }
}

.inv-table td.col-ingreso input { color: #1d4ed8; font-weight: 700; }
.inv-table td.col-desecho input { color: #dc2626; font-weight: 700; }
.inv-table td.col-observacion input { color: #ea580c; font-weight: 700; }
.inv-table td.col-porcion input { color: #0284c7; font-weight: 700; }

.search-results { max-height: 140px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; background: rgba(10,14,30,0.5); }
.search-results .item { padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.search-results .item:hover { background: rgba(110,168,254,0.12); }
.search-results .item:last-child { border-bottom: none; }
#open-ingresos-list-btn.pending-ingresos-warning { background: #f59e0b; color: #1f2937; border-color: #f59e0b; }
#open-ingresos-list-btn.pending-ingresos-warning:hover { background: #d97706; border-color: #d97706; }
#open-ingresos-list-btn.pending-ingresos-ok { background: #16a34a; color: #ffffff; border-color: #16a34a; }
#open-ingresos-list-btn.pending-ingresos-ok:hover { background: #15803d; border-color: #15803d; }

.pick-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; min-height: 0; flex: 1; }
.pick-left { display: flex; flex-direction: column; min-height: 0; }
.pick-left .search-results { flex: 1; max-height: none; }
.pick-right { display: flex; flex-direction: column; min-height: 0; }
.pick-right .table-wrap { overflow: auto; }
@media (max-width: 800px) {
  .pick-layout { grid-template-columns: 1fr; }
  .pick-right { order: -1; }
  .pick-right { order: -1; }
}
.pending-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px; background: rgba(255,255,255,0.03); }
#ingresos-pending-tbody input[type=checkbox], #ingresos-select-all { width: 16px; height: 16px; }
.pending-select-all { margin-bottom: 8px; color: var(--muted); font-size: 0.9rem; }
.pending-select-all input { margin-right: 6px; }
.pending-list { display: flex; flex-direction: column; gap: 10px; }
.pending-subtype-card { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: rgba(255,255,255,0.03); }
.pending-subtype-title { font-weight: 600; margin-bottom: 8px; color: var(--accent, #7dd3fc); }
.pending-items { display: flex; flex-direction: column; gap: 6px; }
.pending-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; border-radius: 8px; background: rgba(0,0,0,0.15); }
.pending-item-main { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }
.pending-item-name { flex: 1; font-weight: 500; }
.pending-item-qty { min-width: 80px; text-align: right; }
.pending-batches { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; }
.pending-batch-card { border: 1px solid var(--border); border-radius: 10px; padding: 4px 8px; background: rgba(255,255,255,0.03); width: fit-content; min-width: 240px; max-width: 100%; font-size: 0.82rem; line-height: 1.2; }
.pending-batch-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 2px; font-size: 0.86rem; line-height: 1.2; }
.pending-batch-header .btn.small { font-size: 0.74rem; padding: 2px 6px; }
.pending-batch-items { display: flex; flex-direction: column; gap: 2px; }
.pending-batch-subgroup { display: flex; flex-direction: column; gap: 0; }
.pending-batch-subtitle { font-size: 0.75rem; font-weight: 600; color: var(--muted); margin-top: 0; line-height: 1.2; }
.pending-batch-row { display: flex; align-items: center; justify-content: flex-start; gap: 6px; padding: 0; line-height: 1.2; min-height: 0; }
.pending-batch-qty { min-width: 36px; text-align: left; font-weight: 600; }
.pending-batch-name { flex: 0 1 auto; }
.pending-batch-card.is-pending .pending-batch-row { gap: 2px; }
.pending-batch-card.is-pending .pending-batch-qty { min-width: 1.8em; padding-right: 0; }
.pending-batch-actions { margin-bottom: 2px !important; gap: 4px !important; }
.pending-batch-meta { line-height: 1.2; }
.pending-trace { font-size: 0.72rem; line-height: 1.15; margin: 0 0 1px 0; }
.inv-col-head { cursor: pointer; }
.inv-col-head:hover span { text-decoration: underline; }
.inv-col-cards { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
#inv-col-modal .modal-content.detail-modal-content { overflow: hidden; }
#inv-col-modal #inv-col-modal-body { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.inv-col-group-card { min-width: 220px; }
#inventory-tbody td.no-select, #inventory-tbody td.no-select input { user-select: none; -webkit-user-select: none; }
#inventory-tbody td.no-select input { pointer-events: none; }
.monto-error { color: #ef4444; font-weight: 700; }
#inventory-tbody tr.row-error td { background: rgba(239,68,68,0.12); }
#inventory-tbody tr.row-error td, #inventory-tbody tr.row-error input { color: #ef4444; }
#sum-estado-card.error { border-color: rgba(239,68,68,0.6); background: rgba(239,68,68,0.12); }
#sum-estado-card .status-pill.error { background: transparent; color: #ef4444; }
#sum-debe.monto-error { color: #ef4444; }
.pending-batch-meta { font-size: 0.72rem; color: var(--muted); margin-top: 1px; line-height: 1.2; }
.pending-qty-input { width: 64px; padding: 1px 4px; font-size: 0.85rem; height: 22px; }
.pending-edit-row { gap: 8px; align-items: center; }
.pending-edit-btn { font-size: 0.72rem; line-height: 1; padding: 2px 6px; border: 1px solid #38bdf8; background: rgba(56,189,248,0.15); color: #7dd3fc; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.pending-edit-btn:hover { color: #fff; background: rgba(56,189,248,0.3); border-color: #7dd3fc; }
.pending-trace { font-size: 0.72rem; color: #f59e0b; margin: -2px 0 4px 0; padding-left: 2px; }
.color-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 6px; border: 1px solid rgba(255,255,255,0.2); }
.obs-entry-card { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,0.03); min-width: 220px; }
.obs-entry-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 0.85rem; }
.obs-entry-date { margin-left: auto; font-size: 0.72rem; }
.obs-type-pick-list { display: flex; flex-wrap: wrap; gap: 10px; padding: 8px 0; }
.obs-type-pick-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); cursor: pointer; font-size: 0.95rem; }
.obs-type-pick-btn:hover { border-color: var(--obs-color, #7dd3fc); background: rgba(255,255,255,0.08); }
.obs-type-display { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255,255,255,0.03); }

@media (max-width: 480px) {
  .card { padding: 22px 16px; border-radius: 14px; }
  .brand h1 { font-size: 1.4rem; }
}

/* drag reorder */
tr[draggable="true"] { cursor: default; }
tr[draggable="true"].dragging { opacity: .5; }
tr[draggable="true"].drag-over { outline: 2px dashed #3b82f6; outline-offset: -2px; }


.drag-handle { user-select: text; -webkit-user-select: text; }


.btn.pending-ingresos-warning, .pending-ingresos-warning { background: #f59e0b !important; color: #111827 !important; border-color: #d97706 !important; }
.search-results { border: 1px solid var(--border, #334155); border-radius: 10px; overflow: auto; background: var(--panel, #0f172a); }
.search-item { padding: 10px 12px; cursor: pointer; border-bottom: 1px solid rgba(148,163,184,0.15); transition: background .15s ease; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: rgba(59,130,246,0.12); }
.search-item-name { font-weight: 500; }
.pw-wrap { position: relative; display: flex; align-items: center; }
.pw-wrap input { width: 100%; padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 1px solid var(--border, #334155); background: rgba(15,23,42,0.06); color: var(--text, #0f172a); border-radius: 8px; padding: 4px 8px; font-size: 0.78rem; cursor: pointer; line-height: 1.2; }
.pw-toggle:hover { background: rgba(59,130,246,0.12); }
.pick-layout { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; align-items: start; }
.pick-left, .pick-right { min-width: 0; }
@media (max-width: 800px) { .pick-layout { grid-template-columns: 1fr; } }

.subtype-total-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
}
.pending-batch-subtitle { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.ing-meta-has-popover {
  cursor: pointer;
}
.ing-meta-has-popover:hover .ing-meta-text,
.ing-meta-has-popover.open .ing-meta-text { opacity: 0.9; }
.ing-meta-float {
  display: none;
  position: fixed;
  z-index: 10050;
  max-width: min(320px, calc(100vw - 16px));
  background: #111827;
  color: var(--text, #fff);
  border: 1px solid var(--border, rgba(255,255,255,0.15));
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 0.78rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
  pointer-events: none;
  opacity: 1;
}
.ing-meta-float.open { display: block; }
.ing-meta-float::before {
  content: "";
  position: absolute;
  left: 14px;
  top: -5px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-left: 1px solid var(--border, rgba(255,255,255,0.15));
  border-top: 1px solid var(--border, rgba(255,255,255,0.15));
  transform: rotate(45deg);
}
.ing-meta-float.above::before {
  top: auto;
  bottom: -5px;
  transform: rotate(225deg);
}
.pending-trace.ing-meta-has-popover { padding-right: 2px; }

/* Página de ingresos - filas por tienda */
#ingresos-page-list.ingresos-store-rows-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}
.ing-store-row {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255,255,255,0.02);
}
.ing-store-row-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 600;
}
.ing-store-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,0.2);
}
.ing-store-row-name { flex: 1 1 auto; min-width: 0; }
.ing-store-row-count {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
}
.ing-store-row-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

/* Agregar ingreso / observación - minimalista */
.add-flow-modal.modal-content.detail-modal-content {
  max-width: 860px;
  width: 100%;
  max-height: min(84vh, 760px);
  overflow: hidden;
  padding: 10px 12px;
  gap: 0;
}
.add-flow-header {
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.add-flow-title-wrap h3 { margin: 0; font-size: 0.95rem; font-weight: 600; }
.add-flow-header-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.add-flow-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  overflow: hidden;
}
.add-flow-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: none;
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
}
.add-flow-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.add-flow-panel-head h4 {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}
.add-flow-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
}
.add-flow-search-wrap { margin-bottom: 6px; }
.add-flow-search-input {
  width: 100%;
  height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
}
.add-flow-search-input:focus {
  outline: none;
  border-color: rgba(110,168,254,0.5);
}
.add-flow-search-results,
.add-flow-draft-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.add-flow-search-results {
  display: flex;
  flex-direction: column;
}
.add-flow-modal .search-item.add-flow-result-card {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 4px;
  min-height: 0;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  line-height: 1.2;
}
.add-flow-modal .search-item.add-flow-result-card:last-child { border-bottom: none; }
.add-flow-modal .search-item.add-flow-result-card:hover {
  background: rgba(255,255,255,0.03);
}
.add-flow-result-name { font-size: 0.8rem; font-weight: 500; line-height: 1.2; }
.add-flow-result-meta { font-size: 0.68rem; white-space: nowrap; color: var(--muted); }
.add-flow-draft-list {
  display: flex;
  flex-direction: column;
}
.add-flow-draft-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.add-flow-draft-card:last-child { border-bottom: none; }
.add-flow-draft-name {
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.2;
  word-break: break-word;
  min-width: 0;
}
.add-flow-draft-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.add-flow-qty-input {
  width: 64px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: var(--text);
  padding: 2px 4px;
  text-align: center;
  font-size: 0.8rem;
}
.add-flow-qty-input:focus {
  outline: none;
  border-color: rgba(110,168,254,0.5);
}
.add-flow-remove-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  font-size: 0.9rem;
}
.add-flow-empty {
  padding: 12px 6px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}
.add-flow-empty-draft {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}
.add-flow-extra-card {
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  background: transparent;
}
.add-flow-extra-card:empty,
.add-flow-extra-card[style*="display: none"] { padding: 0; border: none; margin: 0; }
#observacion-modal .obs-modal-title-type {
  margin-left: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  vertical-align: middle;
}
@media (max-width: 900px) {
  .add-flow-layout { grid-template-columns: 1fr 1fr; overflow: hidden; gap: 6px; }
  .add-flow-panel { min-height: 0; }
  .add-flow-modal.modal-content.detail-modal-content { max-height: calc(var(--vvh, 100dvh) - 12px); padding: 8px; }
  .add-flow-panel-head h4 { font-size: 0.72rem; }
  .add-flow-search-input { height: 30px; font-size: 0.84rem; padding: 4px 6px; }
  .add-flow-modal .search-item.add-flow-result-card { padding: 11px 3px; }
  .add-flow-result-name, .add-flow-draft-name { font-size: 0.76rem; }
  .add-flow-result-meta { font-size: 0.64rem; }
  .add-flow-qty-input { width: 52px; height: 26px; font-size: 0.76rem; }
  .add-flow-remove-btn { width: 24px; height: 24px; }
  .add-flow-draft-card {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px;
    padding: 4px 1px;
    text-align: left;
  }
  .add-flow-draft-name { text-align: left; }
  .add-flow-draft-controls { justify-content: flex-end; gap: 3px; }
}
@media (max-width: 520px) {
  .add-flow-header { gap: 4px; margin-bottom: 6px; padding-bottom: 6px; }
  .add-flow-header-actions { gap: 4px; }
  .add-flow-title-wrap h3 { font-size: 0.9rem; }
  .add-flow-draft-card {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px;
    padding: 4px 1px;
  }
  .add-flow-qty-input { width: 48px; height: 24px; font-size: 0.74rem; }
  .add-flow-remove-btn { width: 22px; height: 22px; }
}


/* Estadísticas: compact table to avoid horizontal scroll */
#page-estadisticas .table-wrap { overflow-x: auto; }
#estadisticas-table { table-layout: fixed; width: 100%; font-size: 0.78rem; }
#estadisticas-table th, #estadisticas-table td { padding: 4px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#estadisticas-table th { font-size: 0.72rem; line-height: 1.15; white-space: normal; word-break: break-word; }
#estadisticas-table th.sortable { cursor: pointer; user-select: none; }
#estadisticas-table td[data-col="product_name"],
#estadisticas-table th[data-col="product_name"] { width: 18%; white-space: normal; word-break: break-word; overflow: visible; text-overflow: clip; }
#estadisticas-table td[data-col="sku"],
#estadisticas-table th[data-col="sku"] { width: 6%; }
#estadisticas-table td[data-col="type_name"],
#estadisticas-table th[data-col="type_name"] { width: 8%; white-space: normal; word-break: break-word; overflow: visible; text-overflow: clip; }
#estadisticas-table td[data-col="stock_inicial"],
#estadisticas-table td[data-col="ingresado"],
#estadisticas-table td[data-col="vendido"],
#estadisticas-table td[data-col="stock_final"],
#estadisticas-table td[data-col="desechado"],
#estadisticas-table td[data-col="observado"],
#estadisticas-table td[data-col="porcionado"],
#estadisticas-table th[data-col="stock_inicial"],
#estadisticas-table th[data-col="ingresado"],
#estadisticas-table th[data-col="vendido"],
#estadisticas-table th[data-col="stock_final"],
#estadisticas-table th[data-col="desechado"],
#estadisticas-table th[data-col="observado"],
#estadisticas-table th[data-col="porcionado"],
#estadisticas-table td[data-col^="sale_obs_"],
#estadisticas-table th[data-col^="sale_obs_"] { width: 4.2%; text-align: right; }
#estadisticas-table td[data-col="tasa_venta"],
#estadisticas-table td[data-col="tasa_desecho"],
#estadisticas-table td[data-col="tasa_observacion"],
#estadisticas-table td[data-col="tasa_porcion"],
#estadisticas-table th[data-col="tasa_venta"],
#estadisticas-table th[data-col="tasa_desecho"],
#estadisticas-table th[data-col="tasa_observacion"],
#estadisticas-table th[data-col="tasa_porcion"],
#estadisticas-table td[data-col^="tasa_sale_obs_"],
#estadisticas-table th[data-col^="tasa_sale_obs_"] { width: 5.2%; text-align: right; }
@media (max-width: 980px) {
  #estadisticas-table { font-size: 0.7rem; }
  #estadisticas-table th, #estadisticas-table td { padding: 3px 3px; }
  #estadisticas-table th { font-size: 0.64rem; }
  #estadisticas-table td[data-col="product_name"], #estadisticas-table th[data-col="product_name"] { width: 22%; }
}


/* Ingresos masivo: compact excel-like grid */
#ingresos-panel-masivo .inv-toolbar { margin-top: 4px !important; }
#ingresos-panel-masivo .ingresos-masivo-pickers { gap: 6px !important; margin-top: 6px !important; }
#ingresos-masivo-stores { display: flex !important; flex-wrap: wrap; gap: 4px !important; max-height: 90px !important; overflow: auto; align-content: flex-start; }
.ing-masivo-store-btn { border: 1px solid var(--border,#cbd5e1); background: #fff; color: #334155; border-radius: 6px; padding: 3px 8px; font-size: 0.75rem; line-height: 1.2; cursor: pointer; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-masivo-store-btn:hover { background: #f1f5f9; }
.ing-masivo-store-btn.selected { background: #2563eb; color: #fff; border-color: #2563eb; }

#ingresos-masivo-table { border-collapse: collapse; font-size: 0.75rem; width: auto; max-width: 100%; table-layout: fixed; }
#ingresos-masivo-table th, #ingresos-masivo-table td { border: 1px solid #cbd5e1; padding: 0; }
#ingresos-masivo-table th { background: #e2e8f0; color: #0f172a; font-weight: 600; }
#ingresos-masivo-table th.vstore { height: 90px; vertical-align: bottom; padding: 1px 0; text-align: center; min-width: 30px; width: 30px; max-width: 30px; }
#ingresos-masivo-table th.vstore span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; display: inline-block; font-size: 0.68rem; line-height: 1; padding: 3px 0; max-height: 84px; overflow: hidden; text-overflow: ellipsis; }
#ingresos-masivo-table th.prod-head { min-width: 110px; width: 140px; max-width: 180px; padding: 2px 4px; text-align: left; position: sticky; left: 0; z-index: 3; background: #e2e8f0; color: #0f172a; }
#ingresos-masivo-table td.prod-cell { min-width: 110px; width: 140px; max-width: 180px; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #f8fafc; color: #0f172a; font-weight: 500; position: sticky; left: 0; z-index: 1; }
#ingresos-masivo-table td.prod-cell button { border: none; background: transparent; cursor: pointer; color: #64748b; padding: 0 2px; font-size: 0.85em; }
#ingresos-masivo-table td.cell-wrap { width: 30px; min-width: 30px; max-width: 30px; background: #fff; padding: 0; }
#ingresos-masivo-table input.ing-masivo-cell { width: 30px; min-width: 30px; max-width: 30px; height: 22px; border: none; margin: 0; padding: 0 1px; font-size: 0.72rem; text-align: center; background: #fff; color: #0f172a; outline: none; border-radius: 0; box-shadow: none; -webkit-appearance: none; appearance: textfield; }
#ingresos-masivo-table input.ing-masivo-cell::-webkit-outer-spin-button,
#ingresos-masivo-table input.ing-masivo-cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#ingresos-masivo-table input.ing-masivo-cell:focus { background: #dbeafe; box-shadow: inset 0 0 0 1px #3b82f6; position: relative; z-index: 1; }
#ingresos-masivo-table td.cell-wrap:focus-within { outline: 1px solid #3b82f6; outline-offset: -1px; }

.ing-masivo-prod-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; border: 1px solid var(--border,#e2e8f0); border-radius: 999px; background: rgba(0,0,0,0.02); font-size: 0.78rem; }
.ing-masivo-prod-chip button { border: none; background: transparent; cursor: pointer; padding: 0 2px; line-height: 1; font-size: 0.9em; color: #64748b; }
@media (max-width: 700px) { .ingresos-masivo-pickers { grid-template-columns: 1fr !important; } }


/* Confirm modal */
.confirm-modal-content { max-width: 420px; }
.confirm-modal-message { color: var(--text, #e2e8f0); line-height: 1.5; margin: 4px 0 6px; white-space: pre-wrap; }
.confirm-modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
#confirm-modal .btn { min-width: 110px; }


/* Inventarios: compact + list view */
#page-inventories .panel { padding: 2px 10px 10px; }
#page-inventories .inv-toolbar { margin-bottom: 2px; gap: 6px; }
#page-inventories .inventory-global-banner { margin-top: 0; }
#page-inventories .cards { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
#page-inventories .store-card { padding: 10px; border-radius: 12px; }
#page-inventories .store-card h4 { margin: 0 0 8px; font-size: 0.92rem; }
#page-inventories .shifts { gap: 6px; }
#page-inventories .shift { padding: 8px; gap: 6px; border-radius: 10px; }
#page-inventories .shift-title { font-size: 0.85rem; font-weight: 600; }
#page-inventories .shift-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
#page-inventories .inv-owner { font-size: 0.75rem; margin: 0; }
#page-inventories .shift-actions { display: flex; flex-wrap: wrap; gap: 4px; }
#page-inventories .btn.xsmall, .btn.xsmall { padding: 3px 8px; font-size: 0.75rem; line-height: 1.2; border-radius: 8px; }
#page-inventories .inv-flag { display: inline-flex; align-items: center; justify-content: center; font-size: 0.9rem; line-height: 1; }
#page-inventories .inv-flag + .inv-flag { margin-left: 4px; }
#page-inventories .inv-flags-inline { display: inline-flex; gap: 2px; }
#page-inventories .inv-flag.pending { font-size: 1rem; padding: 2px 7px; border-radius: 999px; background: rgba(245,158,11,0.22); border: 1px solid rgba(245,158,11,0.55); color: #fbbf24; box-shadow: 0 0 0 1px rgba(245,158,11,0.12); }
#page-inventories .inv-flag.error { font-size: 1rem; padding: 2px 7px; border-radius: 999px; background: rgba(239,68,68,0.22); border: 1px solid rgba(239,68,68,0.55); color: #f87171; box-shadow: 0 0 0 1px rgba(239,68,68,0.12); }
#page-inventories .inv-flags-cell { white-space: nowrap; }

#inv-cards.inv-list-mode { display: block; }
.inv-list-wrap { overflow: auto; }
.inv-list-table { width: 100%; font-size: 0.82rem; border-collapse: collapse; }
.inv-list-table th, .inv-list-table td { padding: 6px 8px; border-bottom: 1px solid var(--border, #334155); text-align: left; vertical-align: middle; }
.inv-list-table th { font-size: 0.78rem; color: var(--muted, #94a3b8); font-weight: 600; white-space: nowrap; }
.inv-list-table .store-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.inv-list-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
@media (max-width: 700px) {
  .inv-list-table th, .inv-list-table td { padding: 5px 6px; font-size: 0.78rem; }
  #page-inventories .cards { grid-template-columns: 1fr; }
}


/* Ingreso/observation batch cards: compact and organized */
.pending-batches { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; align-items: start; }
.pending-batch-card { border: 1px solid var(--border, #334155); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,0.03); width: auto; min-width: 0; max-width: 100%; font-size: 0.78rem; line-height: 1.25; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.pending-batch-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ing-card-head-main { min-width: 0; flex: 1; }
.ing-card-title-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ing-card-title { font-size: 0.84rem; line-height: 1.2; }
.ing-card-context { font-size: 0.74rem; color: var(--muted, #94a3b8); margin-top: 2px; }
.ing-card-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.ing-card-pill { display: inline-flex; align-items: center; padding: 1px 6px; border-radius: 999px; font-size: 0.68rem; font-weight: 600; border: 1px solid transparent; }
.ing-card-pill.pending { background: rgba(245,158,11,0.15); color: #f59e0b; border-color: rgba(245,158,11,0.35); }
.ing-card-pill.ok { background: rgba(34,197,94,0.15); color: #22c55e; border-color: rgba(34,197,94,0.35); }
.ing-card-pill.changed { background: rgba(59,130,246,0.15); color: #60a5fa; border-color: rgba(59,130,246,0.35); }
.ing-card-pill.portion { background: rgba(56,189,248,0.18); color: #38bdf8; border-color: rgba(56,189,248,0.45); }
.pending-batch-card.is-portion .ing-card-title,
.pending-batch-card.is-portion .pending-batch-subtitle { color: #e0f2fe; }order-color: rgba(59,130,246,0.35); }
.ing-card-pill.pair { background: rgba(59,130,246,0.12); color: #3b82f6; border-color: rgba(59,130,246,0.3); }
.ing-card-meta { margin-top: 4px; }
.ing-card-meta-line { font-size: 0.7rem; color: var(--muted, #94a3b8); line-height: 1.3; }
.pending-batch-actions, .ing-card-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; flex: 0 0 auto; }
.pending-batch-items { display: flex; flex-direction: column; gap: 6px; }
.pending-batch-subgroup { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; border-top: 1px dashed var(--border, #334155); }
.pending-batch-subgroup:first-child { border-top: none; padding-top: 0; }
.pending-batch-subtitle { font-size: 0.7rem; font-weight: 600; color: var(--muted, #94a3b8); text-transform: uppercase; letter-spacing: .02em; margin-bottom: 1px; }
.pending-batch-row { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 6px; padding: 1px 0; }
.pending-batch-qty { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; color: var(--text, #e2e8f0); font-size: 0.78rem; }
.pending-batch-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-edit-btn { background: transparent; border: 1px solid var(--border, #334155); color: var(--muted, #94a3b8); border-radius: 6px; padding: 0 4px; cursor: pointer; font-size: 0.75rem; line-height: 1.4; }
.pending-trace { font-size: 0.68rem; color: #f59e0b; margin: -1px 0 2px 40px; line-height: 1.25; }
@media (max-width: 700px) {
  .pending-batches { grid-template-columns: 1fr; }
  .pending-batch-card { padding: 8px; }
}


/* Ingreso cards: tighter, cleaner */
.pending-batches { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pending-batch-card { padding: 7px 8px; border-radius: 10px; }
.pending-batch-header { align-items: flex-start; gap: 6px; margin-bottom: 4px; }
.ing-card-head-main { min-width: 0; flex: 1 1 auto; }
.ing-card-title { font-size: 0.8rem; line-height: 1.2; word-break: break-word; }
.ing-card-context { font-size: 0.7rem; margin-top: 1px; }
.ing-card-pills { margin-top: 3px; gap: 3px; }
.ing-card-pill { font-size: 0.64rem; padding: 1px 5px; }
.ing-card-meta { margin: 0 0 4px; padding-top: 2px; }
.ing-card-meta-line { font-size: 0.68rem; }
.ing-card-actions { flex: 0 0 auto; align-self: flex-start; gap: 3px; flex-wrap: nowrap; }
.ing-card-actions .btn.xsmall.icon-only { width: 24px; height: 24px; min-width: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; line-height: 1; border-radius: 7px; }
.ing-card-actions .btn.xsmall:not(.icon-only) { padding: 2px 8px; font-size: 0.7rem; height: 24px; }
.pending-batch-items { gap: 4px; }
.pending-batch-subgroup { gap: 1px; padding-top: 3px; }
.pending-batch-subtitle { font-size: 0.66rem; margin-bottom: 0; }
.pending-batch-row { grid-template-columns: 28px 1fr auto; gap: 6px; padding: 1px 0; }
.pending-batch-qty { font-size: 0.75rem; }
.pending-batch-name { font-size: 0.75rem; }
.pending-trace { margin-left: 34px; font-size: 0.64rem; }


/* Ingreso card fixes: shift pills + qty/product alignment */
.ing-card-pill.shift-manana { background: rgba(251,191,36,0.15); color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.ing-card-pill.shift-tarde { background: rgba(99,102,241,0.15); color: #818cf8; border-color: rgba(99,102,241,0.35); }

.pending-batch-items { padding-left: 0; }
.pending-batch-subgroup { padding-left: 0; margin-left: 0; }
.pending-batch-row { display: grid !important; grid-template-columns: max-content minmax(0, 1fr) auto !important; align-items: center; gap: 6px !important; padding: 1px 0 !important; margin: 0 !important; justify-content: initial !important; }
.pending-batch-qty { display: block !important; text-align: left !important; justify-content: flex-start !important; width: auto; min-width: 0; font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text, #e2e8f0); padding: 0 !important; margin: 0 !important; }
.pending-batch-name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; padding: 0; margin: 0; }
.pending-trace { margin-left: 0 !important; padding-left: 0; }


/* Ensure pending ingreso cards use same qty/product spacing as confirmed */
.pending-batch-card.is-pending .pending-batch-row { display: grid !important; grid-template-columns: max-content minmax(0, 1fr) auto !important; gap: 6px !important; align-items: center; }
.pending-batch-card.is-pending .pending-batch-qty { min-width: 0 !important; width: auto !important; padding-right: 0 !important; text-align: left !important; }


/* Observation type modal: checkbox options */
.obs-type-options { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border, #334155); border-radius: 10px; background: rgba(255,255,255,0.02); }
.obs-type-options-title { font-size: 0.78rem; font-weight: 600; color: var(--muted, #94a3b8); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px; }
.obs-type-option { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; line-height: 1.35; font-weight: normal; transition: background .15s ease; }
.obs-type-option:hover { background: rgba(255,255,255,0.04); }
.obs-type-option input[type="checkbox"] { margin: 2px 0 0; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--primary, #3b82f6); cursor: pointer; }
.obs-type-option-text { flex: 1; min-width: 0; font-size: 0.88rem; color: var(--text, #e2e8f0); }
.obs-type-option-text small { display: block; margin-top: 2px; font-size: 0.75rem; color: var(--muted, #94a3b8); font-weight: normal; }


/* Gestion: compact UI */
#page-gestion { font-size: 0.9rem; }
#page-gestion .gestion-tabs { gap: 4px; margin-bottom: 8px; }
#page-gestion .tab-btn { padding: 5px 10px; font-size: 0.78rem; border-radius: 8px; }
#page-gestion .grid { gap: 10px; }
#page-gestion .panel { padding: 10px 12px; border-radius: 12px; }
#page-gestion .panel-header { margin-bottom: 8px; gap: 8px; }
#page-gestion .panel h3 { font-size: 0.92rem; margin: 0; }
#page-gestion .panel-header .btn { padding: 5px 10px; font-size: 0.78rem; border-radius: 8px; }
#page-gestion .btn.small { padding: 3px 7px; font-size: 0.72rem; border-radius: 7px; }
#page-gestion .table-wrap { margin: 0; }
#page-gestion .gestion-panel table,
#page-gestion table { font-size: 0.8rem; }
#page-gestion .gestion-panel th,
#page-gestion .gestion-panel td,
#page-gestion th,
#page-gestion td { padding: 5px 8px; }
#page-gestion th { font-size: 0.75rem; }
#page-gestion .row-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#page-gestion .drag-grip { cursor: grab; color: var(--muted, #94a3b8); margin-right: 4px; font-size: 0.85rem; }
#page-gestion .drag-handle { white-space: nowrap; }
@media (max-width: 700px) {
  #page-gestion .tab-btn { padding: 4px 8px; font-size: 0.74rem; }
  #page-gestion .gestion-panel th,
  #page-gestion .gestion-panel td,
  #page-gestion th,
  #page-gestion td { padding: 4px 6px; font-size: 0.76rem; }
  #page-gestion .panel-header { flex-wrap: wrap; }
}


/* Products list: search + sticky header scroll */
#gestion-panel-products .products-panel-header { flex-wrap: wrap; align-items: center; }
#gestion-panel-products .products-panel-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
#gestion-panel-products .products-search { min-width: 220px; max-width: 340px; flex: 1 1 220px; padding: 6px 10px; font-size: 0.8rem; border: 1px solid var(--border, #334155); border-radius: 8px; background: var(--input-bg, rgba(15,23,42,0.6)); color: var(--text, #e2e8f0); }
#gestion-panel-products .products-table-wrap {
  height: calc(100vh - 240px);
  height: calc(100dvh - 240px);
  min-height: 280px;
  max-height: none;
  overflow: auto;
}
#gestion-panel-products .products-table { border-collapse: separate; border-spacing: 0; }
#gestion-panel-products .products-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #161d3b;
  background-clip: padding-box;
  box-shadow: 0 1px 0 var(--border, #334155);
}
@media (max-width: 700px) {
  #gestion-panel-products .products-panel-tools { width: 100%; margin-left: 0; }
  #gestion-panel-products .products-search { min-width: 0; max-width: none; width: 100%; flex: 1 1 100%; }
  #gestion-panel-products .products-table-wrap {
    height: calc(100vh - 260px);
    height: calc(100dvh - 260px);
    min-height: 240px;
    max-height: none;
  }
}


@media (max-width: 700px) {
  #gestion-panel-products .products-table-wrap {
    height: calc(100vh - 260px);
    height: calc(100dvh - 260px);
    min-height: 240px;
  }
}


/* Accesos: compact UI */
#page-accesos { font-size: 0.9rem; }
#page-accesos .panel { padding: 10px 12px; border-radius: 12px; }
#page-accesos .panel-header { margin-bottom: 8px; gap: 8px; }
#page-accesos .panel-header h3 { font-size: 0.92rem; margin: 0; }
#page-accesos #accesos-search { min-width: 180px; padding: 6px 10px; font-size: 0.8rem; border: 1px solid var(--border, #334155); border-radius: 8px; background: var(--input-bg, rgba(15,23,42,0.6)); color: var(--text, #e2e8f0); }
#page-accesos .btn.small { padding: 4px 8px; font-size: 0.75rem; border-radius: 8px; }
#accesos-list.cards { display: flex; flex-direction: column; gap: 8px; }
.accesos-vendor-card { padding: 8px 10px !important; }
.accesos-vendor-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.accesos-vendor-main { min-width: 180px; flex: 1; }
.accesos-vendor-name { font-size: 0.88rem; line-height: 1.3; }
.accesos-vendor-summary { margin-top: 4px; font-size: 0.78rem; line-height: 1.45; color: var(--muted, #94a3b8); }
.accesos-vendor-summary .muted { font-size: inherit; }
.accesos-vendor-actions { flex: 0 0 auto; }

/* Accesos modal: store/shift toggles */
.accesos-shift-grid { display: flex; flex-direction: column; gap: 6px; }
.accesos-shift-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border, #334155); border-radius: 10px; background: rgba(255,255,255,0.02); }
.accesos-shift-store { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.accesos-shift-store .store-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.accesos-shift-store-name { font-size: 0.88rem; color: var(--text, #e2e8f0); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.accesos-shift-toggles { display: flex; gap: 6px; flex: 0 0 auto; }
.acc-shift-toggle { appearance: none; border: 1px solid var(--border, #334155); background: rgba(255,255,255,0.03); color: var(--muted, #94a3b8); padding: 6px 12px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all .15s ease; line-height: 1.2; }
.acc-shift-toggle:hover { border-color: rgba(110,168,254,0.5); color: var(--text, #e2e8f0); background: rgba(110,168,254,0.08); }
.acc-shift-toggle.active { background: var(--acc-color, #2563eb); border-color: var(--acc-color, #2563eb); color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset; }
.acc-shift-toggle.active:hover { filter: brightness(0.95); color: #fff; }

/* Accesos: vista por tiendas y turnos */
.accesos-store-card { padding: 10px 12px !important; }
.accesos-store-header { display:flex; align-items:center; gap:8px; margin-bottom:8px; font-weight:600; }
.accesos-store-header .store-dot { width: 12px; height: 12px; border-radius: 50%; display:inline-block; flex: 0 0 auto; }
.accesos-store-shifts { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.accesos-store-shift { border:1px solid var(--border, #334155); border-radius:10px; padding:8px 10px; background: rgba(255,255,255,0.02); }
.accesos-store-shift-title { font-size:0.8rem; font-weight:700; margin-bottom:6px; color: var(--text, #e2e8f0); }
.accesos-assigned-users { display:flex; flex-wrap:wrap; gap:6px; }
.accesos-user-chip { display:inline-flex; align-items:center; padding:4px 8px; border-radius:999px; font-size:0.78rem; background: rgba(148,163,184,0.12); border:1px solid rgba(148,163,184,0.25); color: var(--text, #e2e8f0); }
.accesos-empty-shift { font-size:0.78rem; color: var(--muted, #94a3b8); }
@media (max-width: 700px) { .accesos-store-shifts { grid-template-columns: 1fr; } }
#accesos-modal .modal-content { max-width: 560px; }
#accesos-modal-subtitle { font-size: 0.85rem; }
@media (max-width: 700px) {
  #page-accesos #accesos-search { min-width: 0; width: 100%; flex: 1 1 100%; }
  .accesos-shift-row { flex-wrap: wrap; gap: 8px; }
  .accesos-shift-toggles { width: 100%; }
  .acc-shift-toggle { flex: 1; text-align: center; }
}


/* Users: compact and aesthetic */
#page-users { font-size: 0.9rem; }
#page-users .grid { gap: 10px; }
#page-users .panel { padding: 10px 12px; border-radius: 12px; }
#page-users .panel-header { margin-bottom: 8px; gap: 8px; }
#page-users .panel-header h3 { font-size: 0.92rem; margin: 0; }
#page-users #users-search { min-width: 180px; padding: 6px 10px; font-size: 0.8rem; border: 1px solid var(--border, #334155); border-radius: 8px; background: var(--input-bg, rgba(15,23,42,0.6)); color: var(--text, #e2e8f0); }
#page-users #add-user-btn { padding: 6px 10px; font-size: 0.78rem; border-radius: 8px; }
#page-users table { font-size: 0.8rem; }
#page-users th, #page-users td { padding: 6px 8px; vertical-align: middle; }
#page-users th { font-size: 0.74rem; color: var(--muted, #94a3b8); font-weight: 600; }
#page-users .user-name-cell strong { font-weight: 600; color: var(--text, #e2e8f0); }
#page-users .user-username { color: var(--muted, #94a3b8); font-size: 0.78rem; }
#page-users .user-lastconn { font-size: 0.76rem; color: var(--muted, #94a3b8); white-space: nowrap; }
#page-users .user-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
#page-users .user-actions .btn.xsmall { padding: 3px 7px; font-size: 0.72rem; border-radius: 7px; }
.user-status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 500; padding: 2px 8px; border-radius: 999px; border: 1px solid transparent; }
.user-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.user-status.online { color: #22c55e; background: rgba(34,197,94,0.12); border-color: rgba(34,197,94,0.25); }
.user-status.online .user-status-dot { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.18); }
.user-status.offline { color: #94a3b8; background: rgba(148,163,184,0.1); border-color: rgba(148,163,184,0.2); }
.user-status.offline .user-status-dot { background: #ef4444; }
.user-role-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; border: 1px solid transparent; }
.user-role-pill.role-admin { background: rgba(239,68,68,0.14); color: #fca5a5; border-color: rgba(239,68,68,0.25); }
.user-role-pill.role-encargado { background: rgba(59,130,246,0.14); color: #93c5fd; border-color: rgba(59,130,246,0.25); }
.user-role-pill.role-vendedor { background: rgba(34,197,94,0.14); color: #86efac; border-color: rgba(34,197,94,0.25); }
#page-users .user-row-inactive td { opacity: 0.9; }
@media (max-width: 700px) {
  #page-users #users-search { min-width: 0; width: 100%; flex: 1 1 100%; }
  #page-users .panel-header { flex-wrap: wrap; }
  #page-users .panel-header > div { width: 100%; }
  #page-users #add-user-btn { width: 100%; }
}


/* Ventas: compact */
#page-ventas { font-size: 0.9rem; }
#page-ventas .panel { padding: 10px 12px; border-radius: 12px; }
#page-ventas .panel-header { margin-bottom: 6px; gap: 8px; }
#page-ventas .panel-header h3 { font-size: 0.92rem; margin: 0; }
#page-ventas .ventas-toolbar { margin-top: 4px !important; gap: 6px !important; }
#page-ventas .ventas-toolbar label { font-size: 0.78rem; color: var(--muted, #94a3b8); display: flex; flex-direction: column; gap: 2px; }
#page-ventas .ventas-toolbar input,
#page-ventas .ventas-toolbar select { padding: 5px 8px; font-size: 0.8rem; border: 1px solid var(--border, #334155); border-radius: 8px; background: var(--input-bg, rgba(15,23,42,0.6)); color: var(--text, #e2e8f0); }
#page-ventas .ventas-toolbar .btn.small { padding: 5px 10px; font-size: 0.75rem; }
#page-ventas #ventas-tabs { margin-top: 6px !important; gap: 4px; margin-bottom: 6px; }
#page-ventas #ventas-tabs .tab-btn { padding: 5px 10px; font-size: 0.78rem; border-radius: 8px; }
#page-ventas .table-wrap { margin-top: 6px !important; }
#page-ventas #ventas-table { font-size: 0.76rem; }
#page-ventas #ventas-table th,
#page-ventas #ventas-table td { padding: 5px 6px; white-space: nowrap; }
#page-ventas #ventas-table th { font-size: 0.72rem; color: var(--muted, #94a3b8); font-weight: 600; }
#page-ventas #ventas-chart { margin-top: 8px !important; min-height: 260px !important; }
@media (max-width: 900px) {
  #page-ventas #ventas-table { font-size: 0.72rem; }
  #page-ventas #ventas-table th, #page-ventas #ventas-table td { padding: 4px 5px; }
}


/* General page compacting (titles/data priority) */
#page-ingresos .panel, #page-desechos .panel, #page-porciones .panel, #page-observaciones .panel, #page-estadisticas .panel { padding: 10px 12px; }
#page-ingresos .pending-batch-card { background: var(--bg-soft) !important; }
#page-ingresos .pending-batch-card.is-pending { background: #2a2416 !important; background: color-mix(in srgb, #f59e0b 18%, var(--bg-soft)) !important; }
#page-ingresos .pending-batch-card.is-confirmed { background: #14261e !important; background: color-mix(in srgb, #22c55e 18%, var(--bg-soft)) !important; }
#page-ingresos .pending-batch-card.is-portion { background: #142433 !important; background: color-mix(in srgb, #38bdf8 18%, var(--bg-soft)) !important; }
#page-ingresos .pending-batch-card.is-vendor-created { background: #2b1708 !important; background: color-mix(in srgb, #f97316 22%, var(--bg-soft)) !important; border-left-color: #f97316 !important; }
.trace-role-admin { color: #f87171; font-weight: 600; }
.trace-role-encargado { color: #60a5fa; font-weight: 600; }
.trace-role-vendedor { color: #34d399; font-weight: 600; }
#page-ingresos .panel-header h3, #page-desechos .panel-header h3, #page-porciones .panel-header h3, #page-observaciones .panel-header h3, #page-estadisticas .panel-header h3 { font-size: 0.92rem; }
#page-ingresos .gestion-tabs .tab-btn, #page-desechos .gestion-tabs .tab-btn, #page-porciones .gestion-tabs .tab-btn, #page-observaciones .gestion-tabs .tab-btn, #page-estadisticas .gestion-tabs .tab-btn, #page-ventas .gestion-tabs .tab-btn { padding: 5px 10px; font-size: 0.78rem; border-radius: 8px; }
#page-ingresos .gestion-tabs, #page-desechos .gestion-tabs, #page-porciones .gestion-tabs, #page-observaciones .gestion-tabs, #page-estadisticas .gestion-tabs { gap: 4px; margin-bottom: 6px; }
#page-ingresos .inv-toolbar label, #page-desechos .inv-toolbar label, #page-porciones .inv-toolbar label, #page-observaciones .inv-toolbar label, #page-estadisticas .inv-toolbar label { font-size: 0.78rem; color: var(--muted, #94a3b8); }
#page-ingresos .inv-toolbar input, #page-ingresos .inv-toolbar select,
#page-desechos .inv-toolbar input, #page-desechos .inv-toolbar select,
#page-porciones .inv-toolbar input, #page-porciones .inv-toolbar select,
#page-observaciones .inv-toolbar input, #page-observaciones .inv-toolbar select,
#page-estadisticas .inv-toolbar input, #page-estadisticas .inv-toolbar select { padding: 5px 8px; font-size: 0.8rem; }
#page-estadisticas .data-table, #page-desechos .data-table, #page-porciones .data-table, #page-observaciones .data-table { font-size: 0.78rem; }
#page-estadisticas .data-table th, #page-estadisticas .data-table td,
#page-desechos .data-table th, #page-desechos .data-table td,
#page-porciones .data-table th, #page-porciones .data-table td,
#page-observaciones .data-table th, #page-observaciones .data-table td { padding: 5px 6px; }


/* Switch control (user active, etc.) */
.switch-field-label { display: block; font-size: 0.82rem; color: var(--muted, #94a3b8); margin-bottom: 6px; font-weight: 600; }
.switch-control { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; padding: 6px 2px; }
.switch-control input[type="checkbox"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: rgba(148,163,184,0.25); border: 1px solid var(--border, #334155); transition: all .18s ease; flex: 0 0 auto; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #e2e8f0; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform .18s ease, background .18s ease; }
.switch-control input:checked + .switch-track { background: rgba(34,197,94,0.35); border-color: rgba(34,197,94,0.55); }
.switch-control input:checked + .switch-track::after { transform: translateX(18px); background: #22c55e; }
.switch-control input:focus-visible + .switch-track { outline: 2px solid rgba(110,168,254,0.6); outline-offset: 2px; }
.switch-state { font-size: 0.85rem; font-weight: 600; color: var(--text, #e2e8f0); min-width: 64px; }
.switch-state::before { content: attr(data-off); color: #94a3b8; }
.switch-control input:checked ~ .switch-state::before { content: attr(data-on); color: #22c55e; }


/* Observation card description */
.ing-card-description { margin: 4px 0 6px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); border: 1px solid var(--border, #334155); font-size: 0.76rem; line-height: 1.35; color: var(--text, #e2e8f0); word-break: break-word; }
.ing-card-description-label { font-weight: 600; color: var(--muted, #94a3b8); margin-right: 4px; }


/* Login redesign */
body.login-page { min-height: 100vh; min-height: 100dvh; }
.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
@supports (height: 100svh) {
  .login-wrap { min-height: 100svh; }
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 24px 24px;
  border-radius: 18px;
}
.login-header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.login-brand-mark { width: 44px; height: 44px; border-radius: 12px; font-size: 0.95rem; flex: 0 0 auto; }
.login-title-wrap h1 { margin: 0; font-size: 1.35rem; line-height: 1.2; color: var(--text, #e8ecf7); }
.login-subtitle { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted, #a7b0c8); }
.login-form .field { margin-bottom: 14px; }
.login-form label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--muted, #a7b0c8); font-weight: 600; }
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  background: rgba(15,23,42,0.5);
  color: var(--text, #e8ecf7);
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.login-form input:focus { border-color: rgba(110,168,254,0.7); box-shadow: 0 0 0 3px rgba(110,168,254,0.15); }
.password-field { position: relative; display: flex; align-items: center; }
.password-field input { padding-right: 44px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border: none; background: transparent; color: var(--muted, #94a3b8);
  border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
}
.password-toggle:hover { color: var(--text, #e8ecf7); background: rgba(255,255,255,0.06); }
.password-toggle .eye-closed { display: none; }
.password-toggle.showing .eye-open { display: none; }
.password-toggle.showing .eye-closed { display: block; }
.login-submit { width: 100%; margin-top: 6px; padding: 11px 16px; font-size: 0.95rem; border-radius: 10px; }
.login-error { min-height: 20px; margin-top: 10px; color: #fca5a5; font-size: 0.85rem; text-align: center; }

/* Mobile keyboard: keep login reachable */
@media (max-width: 640px) {
  .login-wrap { align-items: flex-start; justify-content: flex-start; padding: max(16px, env(safe-area-inset-top)) 14px max(24px, env(safe-area-inset-bottom)); }
  .login-card { max-width: 100%; margin: 0 auto; padding: 22px 18px 20px; border-radius: 16px; }
  .login-header { margin-bottom: 18px; }
  .login-title-wrap h1 { font-size: 1.25rem; }
}
@media (max-height: 700px) {
  .login-wrap { align-items: flex-start; padding-top: 16px; padding-bottom: 24px; }
}


/* Vendor inventory list: distinct Abrir/Continuar buttons */
.inv-open-btn { background: transparent; color: var(--text, #e2e8f0); border: 1px solid var(--border, #334155); }
.inv-open-btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(110,168,254,0.5); }
.inv-continue-btn { background: rgba(34,197,94,0.18); color: #86efac; border: 1px solid rgba(34,197,94,0.45); font-weight: 600; }
.inv-continue-btn:hover { background: rgba(34,197,94,0.28); border-color: rgba(34,197,94,0.65); }
.inv-occupied-btn { background: rgba(148,163,184,0.12); color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); }


/* Mobile optimizations: Usuarios, Gestion, Ventas, Estadisticas, Ingresos */
@media (max-width: 900px) {
  .table-wrap { -webkit-overflow-scrolling: touch; }
  #page-users .table-wrap > table,
  #page-gestion .table-wrap > table,
  #page-ventas .table-wrap > table,
  #page-estadisticas .table-wrap > table,
  #page-ingresos .table-wrap > table,
  #page-desechos .table-wrap > table,
  #page-porciones .table-wrap > table,
  #page-observaciones .table-wrap > table { min-width: 520px; }
  #page-ventas .table-wrap > table,
  #page-estadisticas .table-wrap > table { min-width: 900px; }
  #page-users .table-wrap > table { min-width: 620px; }
  #page-ingresos .table-wrap > table { min-width: 560px; }
}

@media (max-width: 700px) {
  /* Usuarios */
  #page-users .panel-header { flex-direction: column; align-items: stretch; }
  #page-users .panel-header > div { display: flex !important; flex-direction: column; align-items: stretch !important; gap: 8px !important; width: 100%; }
  #page-users #users-search { min-width: 0 !important; width: 100% !important; }
  #page-users #add-user-btn { width: 100%; }
  #page-users .user-actions { flex-wrap: wrap; }
  #page-users .user-actions .btn.xsmall { flex: 1 1 auto; }

  /* Gestion */
  #page-gestion .gestion-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  #page-gestion .gestion-tabs .tab-btn { flex: 0 0 auto; white-space: nowrap; }
  #page-gestion .panel-header { flex-direction: column; align-items: stretch; gap: 8px; }
  #page-gestion .panel-header .btn { width: 100%; }
  #page-gestion .products-panel-tools { width: 100%; margin-left: 0; flex-direction: column; align-items: stretch; }
  #page-gestion .products-search { width: 100% !important; max-width: none !important; min-width: 0 !important; }
  #page-gestion .row-actions { flex-wrap: wrap; gap: 4px; }
  #page-gestion .table-wrap > table { min-width: 560px; }
  #page-gestion #gestion-panel-products .table-wrap > table { min-width: 760px; }

  /* Ventas */
  #page-ventas .panel-header { flex-direction: column; align-items: stretch; }
  #page-ventas .ventas-toolbar { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; align-items: stretch !important; }
  #page-ventas .ventas-toolbar label { width: 100%; min-width: 0; }
  #page-ventas .ventas-toolbar input,
  #page-ventas .ventas-toolbar select { width: 100%; min-width: 0; }
  #page-ventas .ventas-toolbar .btn { grid-column: 1 / -1; width: 100%; }
  #page-ventas #ventas-tabs { overflow-x: auto; flex-wrap: nowrap; }
  #page-ventas #ventas-tabs .tab-btn { flex: 0 0 auto; white-space: nowrap; }

  /* Estadisticas */
  #page-estadisticas .panel-header { flex-direction: column; align-items: stretch; }
  #page-estadisticas .estadisticas-toolbar { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; align-items: stretch !important; }
  #page-estadisticas .estadisticas-toolbar label { width: 100%; min-width: 0; }
  #page-estadisticas .estadisticas-toolbar input,
  #page-estadisticas .estadisticas-toolbar select { width: 100%; min-width: 0; }
  #page-estadisticas .estadisticas-toolbar .btn { grid-column: 1 / -1; width: 100%; }
  #page-estadisticas .gestion-tabs { overflow-x: auto; flex-wrap: nowrap; }
  #page-estadisticas .gestion-tabs .tab-btn { flex: 0 0 auto; white-space: nowrap; }
  #page-estadisticas #estadisticas-table { min-width: 900px; table-layout: auto; }

  /* Ingresos */
  #page-ingresos .panel-header { flex-direction: column; align-items: stretch; gap: 8px; }
  #page-ingresos .panel-header .btn { width: 100%; }
  #page-ingresos #ingresos-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  #page-ingresos #ingresos-tabs .tab-btn { flex: 0 0 auto; white-space: nowrap; }
  #page-ingresos .ingresos-toolbar { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; align-items: stretch !important; }
  #page-ingresos .ingresos-toolbar label { width: 100%; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
  #page-ingresos .ingresos-toolbar input,
  #page-ingresos .ingresos-toolbar select { width: 100% !important; min-width: 0 !important; }
  #page-ingresos .ingresos-toolbar .btn { grid-column: 1 / -1; width: 100%; }
  #ingresos-totales-filters { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
  #ingresos-totales-filters label { width: 100%; min-width: 0; }
  #ingresos-totales-filters input,
  #ingresos-totales-filters select { width: 100% !important; min-width: 0 !important; }
  #ingresos-totales-filters .btn { grid-column: 1 / -1; width: 100%; }

  /* Generic: prevent overlap from inline-styled flex rows (non-inventory pages) */
  #page-users .inv-toolbar,
  #page-gestion .inv-toolbar,
  #page-ventas .inv-toolbar,
  #page-estadisticas .inv-toolbar,
  #page-ingresos .inv-toolbar,
  #page-desechos .inv-toolbar,
  #page-porciones .inv-toolbar,
  #page-observaciones .inv-toolbar { flex-wrap: wrap !important; }
  .panel-header { flex-wrap: wrap; }
}

@media (max-width: 420px) {
  #page-ventas .ventas-toolbar,
  #page-estadisticas .estadisticas-toolbar,
  #page-ingresos .ingresos-toolbar,
  #ingresos-totales-filters { grid-template-columns: 1fr; }
  #page-ventas .ventas-toolbar .btn,
  #page-estadisticas .estadisticas-toolbar .btn,
  #page-ingresos .ingresos-toolbar .btn,
  #ingresos-totales-filters .btn { grid-column: auto; }
}


/* Inventarios list view (admin/encargado): mobile optimization */
#page-inventories .inv-list-wrap { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; max-width: 100%; }
#page-inventories .inv-list-table { width: 100%; }
@media (max-width: 700px) {
  #page-inventories .inv-toolbar { flex-direction: column; align-items: stretch; gap: 8px; }
  #page-inventories .inv-toolbar input[type="date"] { width: 100%; min-width: 0; }
  #page-inventories .inv-list-wrap { display: block; width: 100%; overflow-x: auto; }
  #page-inventories .inv-list-table { min-width: 640px; font-size: 0.76rem; }
  #page-inventories .inv-list-table th,
  #page-inventories .inv-list-table td { padding: 5px 6px; white-space: nowrap; }
  #page-inventories .inv-list-table td:first-child { white-space: normal; min-width: 140px; }
  #page-inventories .inv-list-actions { flex-wrap: nowrap; }
  #page-inventories .inv-list-actions .btn.xsmall { white-space: nowrap; }
}


/* Inventarios list view: responsive cards (no horizontal scroll) */
#inv-cards.inv-list-mode { display: block; }
.inv-list-rows { display: flex; flex-direction: column; gap: 8px; }
.inv-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border, #334155);
  border-left: 4px solid var(--store-color, #3b82f6);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
}
.inv-list-item-main { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; }
.inv-list-store { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--text, #e2e8f0); min-width: 0; }
.inv-list-store strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-list-store .store-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }
.inv-list-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.78rem; color: var(--muted, #94a3b8); }
.inv-list-chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; background: rgba(110,168,254,0.12); color: #cfe0ff; border: 1px solid rgba(110,168,254,0.25); font-weight: 600; font-size: 0.74rem; }
.inv-list-resp { min-width: 0; }
.inv-list-chip.no-resp-chip { background: rgba(245,158,11,0.18); color: #fbbf24; border-color: rgba(245,158,11,0.45); }
.inv-list-chip.resp-chip { background: rgba(56,189,248,0.18); color: #7dd3fc; border-color: rgba(56,189,248,0.45); }
.inv-list-item.inv-no-resp { box-shadow: inset 3px 0 0 rgba(245,158,11,0.55); }
.inv-no-resp-label { color: #fbbf24; font-weight: 600; font-size: 0.78rem; }
.inv-resp-label { color: #7dd3fc; font-weight: 600; font-size: 0.78rem; }
.inv-list-status { display: inline-flex; align-items: center; gap: 6px; }
.inv-list-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; flex: 0 0 auto; }
@media (max-width: 700px) {
  .inv-list-item { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
  .inv-list-actions { justify-content: flex-start; }
  .inv-list-actions .btn.xsmall { flex: 1 1 auto; }
  .inv-list-meta { gap: 6px 8px; }
}


/* Adjust earlier blanket min-width for gestion at 900px */
@media (max-width: 900px) {
  #page-gestion .table-wrap > table { min-width: 0; }
  #gestion-panel-products .table-wrap > table { min-width: 720px; }
  #gestion-panel-observation-types .table-wrap > table { min-width: 560px; }
}


/* Gestion mobile: better optimization */
@media (max-width: 700px) {
  #page-gestion .gestion-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    flex-wrap: unset;
    padding-bottom: 0;
  }
  #page-gestion .gestion-tabs .tab-btn {
    white-space: normal;
    text-align: center;
    padding: 8px 6px;
    font-size: 0.75rem;
    line-height: 1.2;
  }
  #page-gestion .panel-header { flex-direction: column; align-items: stretch; gap: 8px; }
  #page-gestion .panel-header .btn { width: 100%; }
  #page-gestion .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Override blanket min-widths for simpler tables */
  #page-gestion .table-wrap > table { min-width: 0; width: 100%; }
  #gestion-panel-products .table-wrap > table { min-width: 720px; }
  #gestion-panel-types .table-wrap > table,
  #gestion-panel-subtypes .table-wrap > table,
  #gestion-panel-groups .table-wrap > table { min-width: 0; }
  #gestion-panel-stores .table-wrap > table { min-width: 0; }
  #gestion-panel-observation-types .table-wrap > table { min-width: 560px; }

  /* Hide "Creado" column on mobile for simple tables to avoid horizontal scroll */
  #gestion-panel-types th:nth-child(2), #gestion-panel-types td:nth-child(2),
  #gestion-panel-subtypes th:nth-child(2), #gestion-panel-subtypes td:nth-child(2),
  #gestion-panel-groups th:nth-child(2), #gestion-panel-groups td:nth-child(2) { display: none; }
  #gestion-panel-stores th:nth-child(3), #gestion-panel-stores td:nth-child(3) { display: none; }

  #page-gestion .row-actions { display: flex; flex-wrap: wrap; gap: 4px; }
  #page-gestion .row-actions .btn.small { padding: 4px 6px; font-size: 0.7rem; }
  #page-gestion .drag-grip { padding: 2px 4px; }
  #page-gestion th, #page-gestion td { padding: 6px 6px; }
  #page-gestion td { white-space: normal; word-break: break-word; }
  #page-gestion td.drag-handle { white-space: nowrap; }
}

@media (max-width: 420px) {
  #page-gestion .gestion-tabs { grid-template-columns: 1fr 1fr; }
  #page-gestion .gestion-tabs .tab-btn { font-size: 0.72rem; padding: 7px 4px; }
}


/* Gestion: Productos & Tipos de observacion as cards on mobile (no horizontal scroll) */
@media (max-width: 700px) {
  #gestion-panel-products .products-table-wrap,
  #gestion-panel-observation-types .table-wrap {
    overflow: visible;
    max-height: none;
  }
  #gestion-panel-products .products-table,
  #gestion-panel-products .products-table thead,
  #gestion-panel-products .products-table tbody,
  #gestion-panel-products .products-table tr,
  #gestion-panel-products .products-table th,
  #gestion-panel-products .products-table td,
  #gestion-panel-observation-types table,
  #gestion-panel-observation-types thead,
  #gestion-panel-observation-types tbody,
  #gestion-panel-observation-types tr,
  #gestion-panel-observation-types th,
  #gestion-panel-observation-types td {
    display: block;
    width: 100%;
  }
  #gestion-panel-products .products-table thead,
  #gestion-panel-observation-types table thead {
    display: none;
  }
  #gestion-panel-products .products-table tbody,
  #gestion-panel-observation-types table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  #gestion-panel-products .products-table tr,
  #gestion-panel-observation-types table tr {
    border: 1px solid var(--border, #334155);
    border-radius: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.02);
  }
  #gestion-panel-products .products-table td,
  #gestion-panel-observation-types table td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0 !important;
    border: none !important;
    font-size: 0.8rem;
    text-align: right;
  }
  #gestion-panel-products .products-table td::before,
  #gestion-panel-observation-types table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--muted, #94a3b8);
    font-size: 0.75rem;
    text-align: left;
    flex: 0 0 auto;
    min-width: 90px;
  }
  #gestion-panel-products .products-table td.drag-handle,
  #gestion-panel-products .products-table td[data-label="Nombre"] {
    justify-content: flex-start;
    text-align: left;
  }
  #gestion-panel-products .products-table td.drag-handle { font-weight: 600; color: var(--text, #e2e8f0); }
  #gestion-panel-products .products-table td.row-actions,
  #gestion-panel-observation-types table td.row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    padding-top: 8px !important;
    margin-top: 4px;
    border-top: 1px dashed var(--border, #334155) !important;
  }
  #gestion-panel-products .products-table td.row-actions::before,
  #gestion-panel-observation-types table td.row-actions::before {
    flex-basis: 100%;
    margin-bottom: 2px;
  }
  #gestion-panel-products .products-table td.row-actions .btn.small,
  #gestion-panel-observation-types table td.row-actions .btn.small {
    flex: 1 1 auto;
    min-width: 70px;
  }
  /* Override min-widths/scroll forcing for these panels */
  #gestion-panel-products .table-wrap > table { min-width: 0 !important; }
  #gestion-panel-observation-types .table-wrap > table { min-width: 0 !important; }
}


/* Inventory PDF/print export */
#inventory-print-root { display: none; }
@media print {
  body.printing-inventory > *:not(#inventory-print-root) { display: none !important; }
  body.printing-inventory #inventory-print-root { display: block !important; }
  body.printing-inventory {
    background: #fff !important;
    color: #111827 !important;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #inventory-print-root {
    font-family: Arial, sans-serif;
    font-size: 7.5px;
    line-height: 1.15;
    color: #111827;
    padding: 3mm;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #inventory-print-root h1 {
    font-size: 11px;
    margin: 0 0 1px;
    color: #0f172a;
    background: #dbeafe;
    border-left: 3px solid #2563eb;
    padding: 2px 4px;
    border-radius: 2px;
  }
  #inventory-print-root h2 {
    font-size: 8.5px;
    margin: 4px 0 2px;
    color: #fff;
    background: #334155;
    padding: 2px 4px;
    border-radius: 2px;
    border: none;
  }
  #inventory-print-root h3 { font-size: 8px; margin: 3px 0 2px; }
  #inventory-print-root .meta {
    font-size: 7px;
    color: #1e293b;
    margin-bottom: 3px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 2px 4px;
    border-radius: 2px;
  }
  #inventory-print-root .cards-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-bottom: 3px; }
  #inventory-print-root .pcard {
    border: 1px solid #94a3b8;
    border-left: 3px solid #3b82f6;
    border-radius: 2px;
    padding: 2px 3px;
    break-inside: avoid;
    background: #f8fafc;
  }
  #inventory-print-root .pcard .lbl { font-size: 5.8px; color: #334155; text-transform: uppercase; font-weight: 700; letter-spacing: .01em; line-height: 1.1; }
  #inventory-print-root .pcard .val { font-size: 7.8px; font-weight: 700; margin-top: 0; color: #0f172a; line-height: 1.1; }
  #inventory-print-root .pcard.result-ok { background: #dcfce7; border-color: #22c55e; border-left-color: #16a34a; }
  #inventory-print-root .pcard.result-ok .val { color: #166534; }
  #inventory-print-root .pcard.result-bad { background: #fee2e2; border-color: #ef4444; border-left-color: #dc2626; }
  #inventory-print-root .pcard.result-bad .val { color: #991b1b; }
  #inventory-print-root .pcard.result-neutral { background: #e2e8f0; border-color: #64748b; border-left-color: #475569; }

  #inventory-print-root table { width: 100%; border-collapse: collapse; margin-bottom: 3px; font-size: 6.8px; }
  #inventory-print-root th, #inventory-print-root td { border: 1px solid #94a3b8; padding: 1px 2px; text-align: right; line-height: 1.1; }
  #inventory-print-root th { background: #1e293b; color: #fff; font-weight: 700; text-align: center; font-size: 6.6px; }
  #inventory-print-root td.left, #inventory-print-root th.left { text-align: left; }
  #inventory-print-root tbody tr:nth-child(even) td { background: #f8fafc; }
  #inventory-print-root tr.group-row td { background: #bfdbfe; color: #1e3a8a; font-weight: 700; text-align: left; border-color: #60a5fa; padding: 1px 3px; }

  #inventory-print-root .detail-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; margin-bottom: 3px; }
  #inventory-print-root .detail-card { border: 1px solid #94a3b8; border-radius: 2px; padding: 2px 3px; break-inside: avoid; font-size: 6.8px; background: #f8fafc; }
  #inventory-print-root .detail-head { display: flex; justify-content: space-between; gap: 3px; font-weight: 700; margin-bottom: 1px; padding-bottom: 1px; border-bottom: 1px solid rgba(0,0,0,0.15); font-size: 7px; }
  #inventory-print-root .detail-total { font-weight: 800; }
  #inventory-print-root .detail-items { margin: 0; padding-left: 10px; }
  #inventory-print-root .detail-items li { margin: 0; line-height: 1.1; }
  #inventory-print-root .d-amt { font-weight: 700; }
  #inventory-print-root .d-desc { color: #334155; }
  #inventory-print-root .cat-yape { background: #f3e8ff; border-color: #a855f7; border-left: 3px solid #9333ea; }
  #inventory-print-root .cat-yape .detail-head { color: #6b21a8; }
  #inventory-print-root .cat-culqi { background: #e0f2fe; border-color: #0ea5e9; border-left: 3px solid #0284c7; }
  #inventory-print-root .cat-culqi .detail-head { color: #075985; }
  #inventory-print-root .cat-descuentos { background: #fef3c7; border-color: #f59e0b; border-left: 3px solid #d97706; }
  #inventory-print-root .cat-descuentos .detail-head { color: #92400e; }
  #inventory-print-root .cat-pagos { background: #dcfce7; border-color: #22c55e; border-left: 3px solid #16a34a; }
  #inventory-print-root .cat-pagos .detail-head { color: #166534; }
  #inventory-print-root .cat-gastos { background: #fee2e2; border-color: #ef4444; border-left: 3px solid #dc2626; }
  #inventory-print-root .cat-gastos .detail-head { color: #991b1b; }

  #inventory-print-root .batch-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; }
  #inventory-print-root .batch-card { border: 1px solid #94a3b8; border-left: 3px solid #0ea5e9; border-radius: 2px; padding: 2px 3px; break-inside: avoid; font-size: 6.8px; background: #f0f9ff; }
  #inventory-print-root .batch-head { font-weight: 700; margin-bottom: 1px; font-size: 7px; color: #0c4a6e; line-height: 1.1; }
  #inventory-print-root .batch-meta { font-size: 6.3px; color: #334155; margin-bottom: 1px; line-height: 1.1; }
  #inventory-print-root .batch-items { margin: 0; padding-left: 10px; }
  #inventory-print-root .batch-items li { margin: 0; line-height: 1.1; }
  #inventory-print-root .muted { color: #64748b; font-style: italic; font-size: 6.8px; }
  @page { size: A4; margin: 4mm; }
}


/* Inventory detail header tweaks */
.inv-detail-header {
  position: relative;
  padding-top: 0;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 0;
}
.inv-detail-toprow {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin: 0;
}
.inv-detail-shift-icon {
  flex: 0 0 auto;
  font-size: 1.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  pointer-events: none;
}
.inv-detail-shift-icon.shift-am { color: #f59e0b; }
.inv-detail-shift-icon.shift-pm { color: #93c5fd; }
.inv-exit-btn { position: static !important; margin-left: 0; }
.inv-detail-title { flex: 0 0 auto; min-width: 0; }
.inv-detail-actions {
  flex: 1 1 100%;
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 0;
}
.inv-detail-actions .inv-meta {
  margin-right: auto;
  font-size: 0.78rem;
  line-height: 1.2;
}
.inv-detail-actions .btn.xsmall { padding: 4px 8px; font-size: 0.72rem; line-height: 1.2; }
.btn-export-pdf { background: #16a34a !important; color: #fff !important; border: 1px solid #15803d !important; }
.btn-export-pdf:hover { background: #22c55e !important; border-color: #16a34a !important; }
.inv-mobile-logout-btn { display: inline-flex !important; }
#page-inventory-detail { padding-top: 0; margin-top: 0; }
#page-inventory-detail .inv-detail-header { margin-top: 0; }
#inventory-global-message-banner-detail { margin-top: 0; margin-bottom: 2px; }
@media (max-width: 640px) {
  .inv-detail-header { padding-top: 0; gap: 4px; }
  .inv-detail-toprow .btn { padding: 4px 8px; font-size: 0.72rem; }
  .inv-detail-actions { justify-content: flex-end; gap: 4px; }
  .inv-detail-actions .btn { flex: 0 0 auto; }
}

.inv-detail-title .inv-meta { font-weight: 600; color: var(--text, #e2e8f0); }


/* Global inventory message */
.inventory-global-banner {
  margin: 0 0 4px;
  padding: 5px 8px;
  border-radius: 8px;
  border: 1px solid #f59e0b;
  border-left: 4px solid #d97706;
  background: #fff7ed;
  color: #92400e;
  font-weight: 600;
  font-size: 0.8rem;
  line-height: 1.25;
  white-space: pre-wrap;
  word-break: break-word;
  width: fit-content;
  max-width: 100%;
}
.inventory-global-admin-bar { display: flex; justify-content: flex-end; margin: 0 0 2px; }
.inventory-global-admin-bar .btn { padding: 4px 8px; font-size: 0.75rem; }


/* Observation modal title: porción type indicator */
#observacion-modal-title { display: inline-flex; align-items: center; gap: 6px; font-size: 0.9rem; }
#observacion-modal-title-text { font-size: 0.9rem; }
.obs-modal-title-type { display: inline-flex; align-items: center; gap: 4px; }
.obs-title-color-square { width: 10px; height: 10px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0,0,0,0.15); flex: 0 0 auto; }
.obs-title-type-name { font-size: 0.8rem; font-weight: 600; color: var(--muted, #94a3b8); line-height: 1; }

.obs-modal-title-type-inner.clickable { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.obs-modal-title-type-inner.clickable:hover .obs-title-type-name { text-decoration: underline; }
#observacion-modal-title .btn.xsmall { font-size: 0.7rem; padding: 2px 6px; line-height: 1.2; }


/* Inventory table: stronger separator every 2 rows per type group */
.inv-table tr.inv-pair-sep td { border-bottom: 2px solid #4b5563 !important; }
.inv-table tr.inv-pair-sep td.hl-inicio { border-bottom-color: #6b7280 !important; }
.inv-table tr.inv-pair-sep td.hl-final { border-bottom-color: #6b7280 !important; }
.inv-table tr.inv-pair-sep td.hl-venta { border-bottom-color: #6b7280 !important; }


/* Login redesign (same background, new layout) */
body.login-redesign .login-card {
  max-width: 360px;
  padding: 30px 26px 24px;
  border-radius: 16px;
  border: 1px solid rgba(148,163,184,0.25);
  background: rgba(15,23,42,0.72);
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
}
body.login-redesign .login-brand-top {
  text-align: center;
  margin-bottom: 22px;
}
body.login-redesign .login-box-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
}
body.login-redesign .login-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #f8fafc;
  text-transform: lowercase;
}
body.login-redesign .login-subtitle {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: #94a3b8;
}
body.login-redesign .login-form .field { margin-bottom: 14px; }
body.login-redesign .login-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: 0.02em;
}
body.login-redesign .login-form input[type="text"],
body.login-redesign .login-form input[type="password"] {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 10px;
  background: rgba(2,6,23,0.45);
  color: #f1f5f9;
  font-size: 0.95rem;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
body.login-redesign .login-form input::placeholder { color: #64748b; }
body.login-redesign .login-form input:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.18);
  background: rgba(2,6,23,0.6);
}
body.login-redesign .login-submit {
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.28);
  color: #e0f2fe;
}
body.login-redesign .login-submit:hover {
  background: rgba(56, 189, 248, 0.4);
  border-color: rgba(56, 189, 248, 0.75);
}
body.login-redesign .login-error { min-height: 20px; margin-top: 10px; color: #fca5a5; font-size: 0.85rem; text-align: center; }
@media (max-width: 640px) {
  body.login-redesign .login-card { padding: 24px 18px 20px; max-width: 100%; }
  body.login-redesign .login-title { font-size: 1.35rem; }
}


/* Ingreso/Observacion modals (inventory): mobile two columns - left search, right added products */
@media (max-width: 700px) {
  #ingreso-modal .modal-content.detail-modal-content,
  #observacion-modal .modal-content.detail-modal-content {
    height: calc(var(--vvh, 100dvh) - 24px);
    max-height: calc(var(--vvh, 100dvh) - 24px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  #ingreso-modal .pick-layout,
  #observacion-modal .pick-layout {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    min-height: 0;
    gap: 8px;
    overflow: hidden;
    align-items: stretch;
  }
  #ingreso-modal .pick-left,
  #observacion-modal .pick-left {
    order: 1;
    flex: 0 0 44%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  #ingreso-modal .pick-right,
  #observacion-modal .pick-right {
    order: 2;
    flex: 1 1 56%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  #ingreso-modal .pick-right .table-wrap,
  #ingreso-modal .pick-right .detail-table-wrap,
  #observacion-modal .pick-right .table-wrap,
  #observacion-modal .pick-right .detail-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
  }
  #ingreso-modal .pick-left .search-results,
  #observacion-modal .pick-left .search-results {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
  }
  #ingreso-modal #ingreso-search,
  #observacion-modal #observacion-search {
    flex: 0 0 auto;
    margin-bottom: 6px;
  }
}


/* Compact draft tables in ingreso/observacion modals */
#ingreso-modal .inv-table td,
#observacion-modal .inv-table td { min-height: 18px; height: auto; }
#ingreso-modal .inv-table input,
#observacion-modal .inv-table input { height: 16px; font-size: 0.75rem; padding: 0 2px; }
#ingreso-modal .inv-table td,
#ingreso-modal .inv-table th,
#observacion-modal .inv-table td,
#observacion-modal .inv-table th { font-size: 0.75rem; padding: 1px 4px; }
#ingreso-modal .inv-table th,
#observacion-modal .inv-table th { padding: 3px 4px; }
#ingreso-modal .inv-table .icon-btn,
#observacion-modal .inv-table .icon-btn { width: 24px; height: 24px; }

/* Draft tables (ingreso/observacion): wide product, minimal qty and delete */
#ingreso-modal .ingreso-draft-table,
#observacion-modal .observacion-draft-table { table-layout: fixed; width: 100%; }
#ingreso-modal .ingreso-draft-table th.col-prod,
#ingreso-modal .ingreso-draft-table td.col-prod,
#observacion-modal .observacion-draft-table th.col-prod,
#observacion-modal .observacion-draft-table td.col-prod {
  width: auto;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}
#ingreso-modal .ingreso-draft-table th.col-cant,
#ingreso-modal .ingreso-draft-table td.col-cant,
#observacion-modal .observacion-draft-table th.col-cant,
#observacion-modal .observacion-draft-table td.col-cant {
  width: 56px;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
}
#ingreso-modal .ingreso-draft-table td.col-cant input,
#observacion-modal .observacion-draft-table td.col-cant input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: center;
}
#ingreso-modal .ingreso-draft-table th.col-del,
#ingreso-modal .ingreso-draft-table td.col-del,
#observacion-modal .observacion-draft-table th.col-del,
#observacion-modal .observacion-draft-table td.col-del {
  width: 30px;
  padding-left: 1px;
  padding-right: 1px;
  text-align: center;
}
#ingreso-modal .ingreso-draft-table td.col-del .icon-btn,
#observacion-modal .observacion-draft-table td.col-del .icon-btn {
  width: 22px;
  height: 22px;
  min-width: 22px;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1;
}


/* Inventory column headers: clickable hint (magnifying glass at top, end of text) */
.inv-col-head { position: sticky; cursor: pointer; }
.inv-col-head span { text-decoration: none; }
.inv-col-head .inv-col-hint {
  position: absolute;
  left: 50%;
  top: 3px;
  transform: translateX(-50%);
  font-size: 0.72rem;
  line-height: 1;
  pointer-events: none;
  font-style: normal;
}


/* Shift icons (sun/moon) placed without affecting layout */
.shift-chip { position: relative; }
.shift-chip .shift-icon {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.05rem;
  line-height: 1;
  opacity: 0.95;
  pointer-events: none;
}
.shift-head .shift-title { position: relative; }
.shift-head .shift-title .shift-icon {
  position: absolute;
  right: -18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.95;
  pointer-events: none;
}
.shift-inline { position: relative; }
.shift-inline .shift-icon {
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  line-height: 1;
  opacity: 0.95;
  pointer-events: none;
}
.shift-am .shift-icon { color: #f59e0b; }
.shift-pm .shift-icon { color: #93c5fd; }


/* Mobile: taller inventory detail headers to avoid overlap with magnifier icon */
@media (max-width: 640px) {
  #page-inventory-detail .inv-table th.vhead { height: 74px; padding-top: 14px; }
  #page-inventory-detail .inv-col-hint { top: 2px; font-size: 0.68rem; }
}
@media (max-width: 420px) {
  #page-inventory-detail .inv-table th.vhead { height: 68px; padding-top: 14px; }
}


/* Tipos contables */
.type-contable-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}
.type-contable-badge.yes {
  color: #065f46;
  background: #d1fae5;
  border-color: #34d399;
}
.type-contable-badge.no {
  color: #475569;
  background: #e2e8f0;
  border-color: #94a3b8;
}
#inventory-tbody .group-row.contable-group-row td, .inventory-table .group-row.contable-group-row td {
  font-weight: 700;
  background: #ecfdf5;
  vertical-align: middle;
}
#inventory-tbody .group-row.contable-group-row .group-total-cell, .inventory-table .group-row.contable-group-row .group-total-cell {
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  padding: 2px 3px;
  font-size: 0.78rem;
}
#inventory-tbody .group-row.contable-group-row .group-name-cell, .inventory-table .group-row.contable-group-row .group-name-cell {
  text-align: left;
  padding-left: 10px;
  font-size: 0.78rem;
}
#inventory-tbody .group-row.contable-group-row .group-total-box, .inventory-table .group-row.contable-group-row .group-total-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 1px 5px;
  border: 1px solid #34d399;
  border-radius: 6px;
  background: #ffffff;
  color: #065f46;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.1;
  box-shadow: none;
}
#inventory-tbody .group-row.contable-group-row .money-cell .group-total-box, .inventory-table .group-row.contable-group-row .money-cell .group-total-box {
  min-width: 52px;
}

/* Inventory prices modal tabs */
.inv-prices-tabs-wrap { margin: 2px 0 12px; }
.inv-prices-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  max-width: 100%;
  flex-wrap: wrap;
}
.inv-prices-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted, #9fb0d0);
  padding: 9px 14px;
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.inv-prices-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.inv-prices-tab:active { transform: translateY(1px); }
.inv-prices-tab.active {
  color: #eaf2ff;
  background: linear-gradient(180deg, rgba(110,168,254,0.28), rgba(110,168,254,0.16));
  border-color: rgba(110,168,254,0.45);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset, 0 4px 12px rgba(30, 64, 120, 0.18);
}
.inv-prices-tab:focus-visible {
  outline: 2px solid rgba(110,168,254,0.55);
  outline-offset: 1px;
}
.inv-prices-tab-icon { font-size: 1rem; line-height: 1; }
#inventory-prices-modal .modal-content { gap: 0; }
#inventory-prices-modal #inv-prices-panel-list .ingresos-filters { margin-top: 2px; }
@media (max-width: 640px) {
  .inv-prices-tabs { width: 100%; }
  .inv-prices-tab { flex: 1 1 180px; justify-content: center; text-align: center; padding: 10px 12px; }
}


/* Ver precios button */
#open-inventory-prices-btn {
  background: #7c3aed;
  color: #ffffff;
  border: 1px solid #7c3aed;
  opacity: 1;
}
#open-inventory-prices-btn:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}
#open-inventory-prices-btn:active {
  background: #5b21b6;
  border-color: #5b21b6;
}


/* Contable group totals: compact on mobile */
@media (max-width: 640px) {
  #inventory-tbody .group-row.contable-group-row .group-total-cell,
  .inventory-table .group-row.contable-group-row .group-total-cell {
    padding: 1px 2px;
    font-size: 0.66rem;
  }
  #inventory-tbody .group-row.contable-group-row .group-name-cell,
  .inventory-table .group-row.contable-group-row .group-name-cell {
    font-size: 0.58rem;
    padding-left: 4px;
  }
  #inventory-tbody .group-row.contable-group-row .group-total-box,
  .inventory-table .group-row.contable-group-row .group-total-box {
    min-width: 0;
    padding: 1px 4px;
    font-size: 0.62rem;
    border-radius: 4px;
    line-height: 1.1;
  }
  #inventory-tbody .group-row.contable-group-row .money-cell .group-total-box,
  .inventory-table .group-row.contable-group-row .money-cell .group-total-box {
    min-width: 0;
  }
}
@media (max-width: 420px) {
  #inventory-tbody .group-row.contable-group-row .group-total-cell,
  .inventory-table .group-row.contable-group-row .group-total-cell {
    padding: 1px 1px;
    font-size: 0.6rem;
  }
  #inventory-tbody .group-row.contable-group-row .group-name-cell,
  .inventory-table .group-row.contable-group-row .group-name-cell {
    font-size: 0.52rem;
    padding-left: 2px;
  }
  #inventory-tbody .group-row.contable-group-row .group-total-box,
  .inventory-table .group-row.contable-group-row .group-total-box {
    padding: 1px 3px;
    font-size: 0.56rem;
    border-width: 1px;
  }
}


/* Product special prices */
.product-special-stores { display: flex; flex-wrap: wrap; gap: 8px; max-height: 180px; overflow: auto; padding: 8px; border: 1px solid #e2e8f0; border-radius: 10px; background: #f8fafc; }
.product-special-store-chip { appearance: none; border: 1px solid #cbd5e1; background: #fff; color: #334155; border-radius: 999px; padding: 6px 12px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all .15s ease; line-height: 1.2; }
.product-special-store-chip:hover { border-color: #94a3b8; background: #f1f5f9; }
.product-special-store-chip.selected { background: #7c3aed; color: #fff; border-color: #6d28d9; box-shadow: 0 1px 0 rgba(0,0,0,0.04); }
.product-special-store-chip.selected:hover { background: #6d28d9; border-color: #5b21b6; }
.product-special-store-chip:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }


/* Inventory list: last edited */
.inv-list-chip.inv-edited-chip { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.inv-last-edit { font-size: 0.78rem; }
