@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════
   VARIABLES
═══════════════════════════════════════════ */
:root {
  --bg:        #0c0c0e;
  --surface:   #14141a;
  --surface2:  #1c1c26;
  --surface3:  #242432;
  --border:    #2a2a3a;
  --border2:   #3a3a4e;
  --red:       #c8102e;
  --red-dim:   #8b0b1f;
  --red-glow:  rgba(200,16,46,0.15);
  --amber:     #e8a020;
  --green:     #22c55e;
  --green-dim: #166534;
  --blue:      #3b82f6;
  --cyan:      #06b6d4;
  --text:      #e8e8f0;
  --text2:     #9090a8;
  --text3:     #60607a;
  --sidebar-w: 180px;
  --header-h:  56px;
  --radius:    8px;
  --radius-lg: 12px;
}

/* ═══════════════════════════════════════════
   RESET & BASE
═══════════════════════════════════════════ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
}

::-webkit-scrollbar        { width: 4px; height: 4px; }
::-webkit-scrollbar-track  { background: transparent; }
::-webkit-scrollbar-thumb  { background: var(--border2); border-radius: 2px; }

/* ═══════════════════════════════════════════
   LAYOUT PRINCIPAL
═══════════════════════════════════════════ */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ═══════════════════════════════════════════
   SIDEBAR
═══════════════════════════════════════════ */
#sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  flex-shrink: 0;
}

.sb-logo {
  width: 100%;
  height: calc(var(--header-h) * 1.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--red);
  font-size: 22px;
  padding: 10px;
  box-sizing: border-box;
}
.sb-logo-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.sb-logo-text {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--red);
}

.sb-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  overflow-y: auto;
}

.sb-item {
  width: 100%;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  color: var(--text3);
  border: 1px solid transparent;
}
.sb-item:hover  { background: var(--surface2); color: var(--text2); }
.sb-item.active { background: var(--red-glow); color: var(--red); border-color: rgba(200,16,46,.3); }
.sb-item svg    { width: 18px; height: 18px; flex-shrink: 0; }

.sb-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-tooltip {
  position: absolute;
  left: calc(var(--sidebar-w) + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--surface3);
  border: 1px solid var(--border2);
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  color: var(--text);
  z-index: 999;
}
.sb-item:hover .sb-tooltip { opacity: 0; }

.sb-divider { width: 100%; height: 1px; background: var(--border); margin: 4px 0; }

.sb-bottom {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   MAIN
═══════════════════════════════════════════ */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}

.topbar-title {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
  flex: 1;
}

.topbar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text2);
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.topbar-time {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: var(--text2);
}

.topbar-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.topbar-btn:hover { background: var(--surface2); color: var(--text); }

#content { flex: 1; overflow: hidden; position: relative; }

.module         { display: none; height: 100%; overflow: hidden; }
.module.active  { display: flex; }

/* ═══════════════════════════════════════════
   COMPONENTS — BUTTONS
═══════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--red);      color: #fff; border-color: var(--red); }
.btn-primary:hover { background: #a50d26; }
.btn-secondary { background: var(--surface2); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface3); border-color: var(--border2); }
.btn-ghost     { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-success   { background: var(--green-dim); color: var(--green); border-color: rgba(34,197,94,.3); }
.btn-success:hover { background: #1a7a40; }
.btn-amber     { background: rgba(232,160,32,.15); color: var(--amber); border-color: rgba(232,160,32,.3); }
.btn-sm        { padding: 5px 10px; font-size: 12px; }
.btn-lg        { padding: 10px 20px; font-size: 15px; font-weight: 600; }
.btn-icon      { padding: 7px; gap: 0; }

/* ═══════════════════════════════════════════
   COMPONENTS — CARDS
═══════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}

/* ═══════════════════════════════════════════
   COMPONENTS — INPUTS
═══════════════════════════════════════════ */
.input {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border .15s;
}
.input:focus        { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-glow); }
.input::placeholder { color: var(--text3); }
.input-group        { display: flex; flex-direction: column; gap: 6px; }
.label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text2);
}
select.input option { background: var(--surface2); }

/* ═══════════════════════════════════════════
   COMPONENTS — BADGES / TAGS
═══════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-red   { background: rgba(200,16,46,.2);   color: var(--red); }
.badge-green { background: rgba(34,197,94,.15);  color: var(--green); }
.badge-amber { background: rgba(232,160,32,.15); color: var(--amber); }
.badge-blue  { background: rgba(59,130,246,.15); color: var(--blue); }
.badge-cyan  { background: rgba(6,182,212,.15);  color: var(--cyan); }

.tag        { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 3px; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.tag-kg     { background: rgba(6,182,212,.15);  color: var(--cyan); }
.tag-unit   { background: rgba(59,130,246,.15); color: var(--blue); }

/* ═══════════════════════════════════════════
   TOAST
═══════════════════════════════════════════ */
#toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface3);
  border: 1px solid var(--border2);
  min-width: 260px;
  max-width: 360px;
  animation: toastIn .2s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
}
.toast.removing { animation: toastOut .2s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut { to   { opacity:0; transform:translateX(20px); } }
.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg  { font-size: 13px; flex: 1; }
.toast.success { border-color: rgba(34,197,94,.3); }
.toast.error   { border-color: rgba(200,16,46,.4); }
.toast.warning { border-color: rgba(232,160,32,.3); }

/* ═══════════════════════════════════════════
   MODAL
═══════════════════════════════════════════ */
#modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
#modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 400px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity:0; transform:scale(.95); } to { opacity:1; transform:scale(1); } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .5px;
}
.modal-close {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════
   TABLE
═══════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table       { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}
td          { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-family: 'Poppins', sans-serif; }

/* ═══════════════════════════════════════════
   KPI CARD
═══════════════════════════════════════════ */
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--kpi-color, var(--red));
}
.kpi-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text2);
  margin-bottom: 8px;
}
.kpi-value {
  font-family: 'Poppins', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -1px;
}
.kpi-sub   { font-size: 12px; color: var(--text3); margin-top: 4px; }
.kpi-trend {
  position: absolute;
  top: 16px; right: 16px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}
.kpi-up   { background: rgba(34,197,94,.15);  color: var(--green); }
.kpi-down { background: rgba(200,16,46,.15);  color: var(--red); }

/* ═══════════════════════════════════════════
   MISC HELPERS
═══════════════════════════════════════════ */
.scroll-y { overflow-y: auto; overflow-x: hidden; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-col { display: flex; flex-direction: column; gap: 12px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-title  {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.empty-state  { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; color: var(--text3); gap: 8px; }
.empty-icon   { font-size: 40px; margin-bottom: 4px; }

.toggle {
  width: 40px; height: 22px;
  border-radius: 11px;
  background: var(--surface3);
  border: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle.on { background: var(--green-dim); border-color: var(--green); }
.toggle::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: white;
  top: 2px; left: 2px;
  transition: left .2s;
}
.toggle.on::after { left: 20px; }

.config-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.config-item:last-child { border-bottom: none; }
.config-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }

/* ═══════════════════════════════════════════
   DASHBOARD
═══════════════════════════════════════════ */
#mod-dashboard { flex-direction: column; padding: 20px; gap: 16px; overflow-y: auto; }

.dash-kpis    { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dash-row     { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.dash-row-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.quick-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qa-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.qa-btn:hover    { background: var(--surface2); border-color: var(--border2); }
.qa-btn.qa-primary { border-color: rgba(200,16,46,.3); background: var(--red-glow); }
.qa-btn.qa-primary:hover { background: rgba(200,16,46,.2); }
.qa-icon  { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.qa-label { font-size: 11px; font-weight: 600; letter-spacing: .3px; color: var(--text2); text-transform: uppercase; }
.qa-key   { font-size: 10px; font-family: 'Poppins', sans-serif; color: var(--text3); margin-top: 2px; }

.stock-alert-item  { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stock-alert-item:last-child { border-bottom: none; }
.stock-bar         { flex: 1; height: 4px; background: var(--surface3); border-radius: 2px; margin: 0 12px; overflow: hidden; }
.stock-bar-fill    { height: 100%; border-radius: 2px; background: var(--red); transition: width .3s; }

.recent-item   { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.recent-item:last-child { border-bottom: none; }
.recent-avatar { width: 34px; height: 34px; border-radius: 8px; background: var(--surface3); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.recent-info   { flex: 1; }
.recent-name   { font-size: 13px; font-weight: 500; }
.recent-time   { font-size: 11px; color: var(--text3); }
.recent-amount { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 600; color: var(--green); }

.mini-chart    { display: flex; align-items: flex-end; gap: 4px; height: 60px; }
.mini-bar      { flex: 1; border-radius: 3px 3px 0 0; background: var(--red-dim); transition: height .3s; min-height: 4px; }
.mini-bar:hover { background: var(--red); }
.mini-bar.today { background: var(--red); }

/* ═══════════════════════════════════════════
   POS
═══════════════════════════════════════════ */
#mod-pos   { flex-direction: row; overflow: hidden; }
#pos-left  { flex: 1; display: flex; flex-direction: column; border-right: 1px solid var(--border); overflow: hidden; }
#pos-right { width: 400px; display: flex; flex-direction: column; background: var(--surface); overflow: hidden; flex-shrink: 0; }

#pos-search-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 8px;
  align-items: center;
}
#pos-search {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 600;
  outline: none;
  letter-spacing: .5px;
}
#pos-search:focus { border-color: var(--red); }
#pos-search::placeholder { color: var(--text3); font-size: 14px; font-weight: 400; }

#pos-products-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  overflow-y: auto;
}

.prod-quick {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.prod-quick:hover    { background: var(--surface2); border-color: var(--border2); }
.prod-quick:active   { transform: scale(.995); }
.prod-quick.out-of-stock { opacity: .4; cursor: not-allowed; }
.prod-quick.has-promo    { border-color: rgba(232,160,32,.4); }
.prod-quick-code  { font-family: 'Poppins', sans-serif; font-size: 11px; color: var(--text3); min-width: 44px; }
.prod-quick-name  { flex: 1; font-size: 13px; font-weight: 600; letter-spacing: .2px; color: var(--text); }
.prod-quick-price { font-family: 'Poppins', sans-serif; font-size: 13px; color: var(--green); font-weight: 700; min-width: 90px; text-align: right; }

/* Weight popup — centrado grande */
#pos-weight-bar {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
#pos-weight-bar.open { display: flex; }
#pos-weight-bar > .pw-card {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 32px 40px;
  min-width: 480px;
  max-width: 560px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
#pos-weight-bar .pw-header {
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
}
#pos-weight-bar .pos-weight-product {
  font-family: 'Poppins', sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 6px;
}
#pos-weight-bar .pw-price-row {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  color: var(--text2);
}
#pos-weight-bar .pw-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 600;
  letter-spacing: .5px;
  text-align: center;
  margin-bottom: 8px;
  text-transform: uppercase;
}
#pos-weight-input {
  width: 100%;
  padding: 18px 16px;
  background: var(--surface3);
  border: 2px solid var(--cyan);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 48px;
  font-weight: 700;
  text-align: center;
  outline: none;
}
.pos-weight-calc {
  font-family: 'Poppins', sans-serif;
  font-size: 44px;
  font-weight: 800;
  color: var(--green);
  text-align: center;
  letter-spacing: .5px;
}
.pw-promo {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .2px;
  transition: background .15s, border-color .15s;
}
.pw-promo.info {
  background: rgba(100,116,139,.08);
  border: 1px solid rgba(100,116,139,.2);
  color: var(--text2);
  text-align: left;
}
.pw-promo.applied {
  background: rgba(232,160,32,.12);
  border: 1px solid rgba(232,160,32,.4);
  color: var(--amber);
  animation: pw-promo-in .2s ease-out;
}
.pw-promo-heading {
  font-size: 10.5px;
  color: var(--text3);
  font-weight: 700;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.pw-promo-line  { font-size: 12px; color: var(--text2); font-weight: 500; line-height: 1.5; }
.pw-promo-badge { font-size: 16px; font-weight: 800; }
.pw-promo-del   { font-family: 'Poppins', sans-serif; font-size: 12px; color: var(--text3); text-decoration: line-through; display: block; margin-top: 4px; font-weight: 500; }
.pw-promo-save  { font-family: 'Poppins', sans-serif; font-size: 13px; color: var(--green); font-weight: 700; display: block; margin-top: 4px; }
@keyframes pw-promo-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
#pos-weight-bar .pw-card.has-promo {
  border-color: rgba(232,160,32,.5);
  box-shadow: 0 0 0 3px rgba(232,160,32,.1), 0 20px 60px rgba(0,0,0,.6);
}
#pos-weight-bar .pw-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
#pos-weight-bar .pw-buttons .btn { padding: 12px 22px; font-size: 14px; }

/* Cart */
#pos-cart-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#pos-cart-title { font-family: 'Poppins', sans-serif; font-size: 16px; font-weight: 700; letter-spacing: .5px; }
#pos-cart-count { background: var(--red); color: white; border-radius: 10px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
#pos-cart-items { flex: 1; overflow-y: auto; padding: 8px; }

.cart-empty      { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--text3); gap: 12px; }
.cart-empty-icon { font-size: 48px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: var(--radius);
  margin-bottom: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all .15s;
}
.cart-item.selected { border-color: rgba(200,16,46,.4); background: rgba(200,16,46,.05); }
.cart-item-info     { flex: 1; min-width: 0; }
.cart-item-name     { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-detail   { font-size: 11px; color: var(--text3); margin-top: 2px; }
.cart-item-qty      { display: flex; align-items: center; gap: 4px; }

.qty-btn {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface3);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .1s;
}
.qty-btn:hover { background: var(--surface2); border-color: var(--border2); }
.qty-num       { font-family: 'Poppins', sans-serif; font-size: 12px; min-width: 28px; text-align: center; }

.cart-item-price { font-family: 'Poppins', sans-serif; font-size: 14px; font-weight: 600; min-width: 70px; text-align: right; }
.cart-item-price-wrap { display: flex; flex-direction: column; align-items: flex-end; min-width: 80px; }
.cart-item-price-del  { font-family: 'Poppins', sans-serif; font-size: 11px; color: var(--text3); text-decoration: line-through; }
.cart-item-promo {
  font-size: 10.5px;
  color: var(--amber);
  margin-top: 3px;
  font-weight: 600;
  letter-spacing: .2px;
}
.cart-item.has-promo { border-color: rgba(232,160,32,.35); background: rgba(232,160,32,.04); }
.cart-item.has-promo.selected { border-color: rgba(200,16,46,.5); }

.cart-del {
  width: 22px; height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cart-del:hover { color: var(--red); background: var(--red-glow); }

/* Payment */
#pos-payment { border-top: 1px solid var(--border); padding: 12px 16px; }
.pos-discount-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#pos-discount-input {
  width: 80px;
  padding: 6px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--amber);
  font-family: 'Poppins', sans-serif;
  text-align: center;
  outline: none;
}

.pos-totals { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
.pos-total-row { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; }
.pos-total-row.main { padding-top: 8px; border-top: 1px solid var(--border); margin-top: 4px; }
.pos-total-label    { font-size: 12px; color: var(--text2); }
.pos-total-val      { font-family: 'Poppins', sans-serif; font-size: 13px; }
.pos-total-row.main .pos-total-label { font-family: 'Poppins', sans-serif; font-size: 16px; font-weight: 700; text-transform: uppercase; }
.pos-total-row.main .pos-total-val   { font-size: 26px; font-weight: 700; color: var(--green); }

/* Cobrar popup - payment methods */
.cobrar-total-display {
  text-align: center;
  padding: 16px 0 20px;
}
.cobrar-methods {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.cobrar-method {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface2);
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.cobrar-method:hover { border-color: var(--border2); background: var(--surface3); }
.cobrar-method.selected {
  border-color: var(--green);
  background: rgba(34,197,94,.08);
  box-shadow: 0 0 0 1px rgba(34,197,94,.2);
}
.cobrar-method-shortcut {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--surface3);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  flex-shrink: 0;
}
.cobrar-method.selected .cobrar-method-shortcut {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.cobrar-method-icon { font-size: 18px; }
.cobrar-method-label { font-size: 13px; font-weight: 600; color: var(--text); }

#pos-cobrar-btn {
  width: 100%;
  padding: 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  border-radius: var(--radius);
  border: none;
  background: var(--red);
  color: white;
  cursor: pointer;
  transition: all .15s;
  text-transform: uppercase;
}
#pos-cobrar-btn:hover    { background: #a50d26; }
#pos-cobrar-btn:disabled { background: var(--surface3); color: var(--text3); cursor: not-allowed; }

/* Shortcut bar */
#shortcut-bar { padding: 6px 16px; border-top: 1px solid var(--border); display: flex; gap: 12px; overflow-x: auto; }
.kb-shortcut  { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.kb-key       { background: var(--surface3); border: 1px solid var(--border2); border-radius: 3px; padding: 1px 6px; font-family: 'Poppins', sans-serif; font-size: 10px; color: var(--text2); }
.kb-desc      { font-size: 10px; color: var(--text3); }

/* ═══════════════════════════════════════════
   PRODUCTOS
═══════════════════════════════════════════ */
#mod-products { flex-direction: column; padding: 20px; gap: 16px; overflow-y: auto; }
.prod-toolbar  { display: flex; align-items: center; gap: 10px; }
.prod-search   { flex: 1; position: relative; }
.prod-search input  { padding-left: 36px; }
.prod-search-icon   { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 16px; }
.cat-filter    { display: flex; gap: 6px; flex-wrap: wrap; }
.cat-pill {
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all .15s;
}
.cat-pill.active { background: var(--red-glow); border-color: rgba(200,16,46,.4); color: var(--red); }

/* ═══════════════════════════════════════════
   STOCK
═══════════════════════════════════════════ */
#mod-stock   { flex-direction: column; padding: 20px; gap: 16px; overflow-y: auto; }
.stock-grid  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stock-cat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.stock-cat-card::after {
  content: attr(data-icon);
  position: absolute;
  right: -8px; bottom: -8px;
  font-size: 64px;
  opacity: .06;
}

/* ═══════════════════════════════════════════
   CONTABILIDAD
═══════════════════════════════════════════ */
#mod-contabilidad { flex-direction: column; padding: 20px; gap: 16px; overflow-y: auto; }
.flujo-bar      { display: flex; gap: 12px; margin-top: 12px; }
.flujo-seg      { flex: 1; padding: 16px; border-radius: var(--radius); text-align: center; }
.flujo-ingresos { background: rgba(34,197,94,.08);  border: 1px solid rgba(34,197,94,.2); }
.flujo-egresos  { background: rgba(200,16,46,.08);  border: 1px solid rgba(200,16,46,.2); }
.flujo-neto     { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2); }

/* ═══════════════════════════════════════════
   AFIP STATUS
═══════════════════════════════════════════ */
.afip-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: rgba(232,160,32,.08);
  border: 1px solid rgba(232,160,32,.2);
}

/* ═══════════════════════════════════════════
   REMAINING MODULE WRAPPERS
═══════════════════════════════════════════ */
#mod-ventas,
#mod-compras,
#mod-gastos,
#mod-clientes,
#mod-proveedores,
#mod-cajas,
#mod-facturacion,
#mod-reportes,
#mod-config { flex-direction: column; padding: 20px; gap: 16px; overflow-y: auto; }

/* ═══════════════════════════════════════════
   CAJA
═══════════════════════════════════════════ */
.topbar-caja-badge:hover { background: var(--surface3); }

.caja-stat {
  padding: 12px;
  border-radius: var(--radius);
  text-align: center;
}
.caja-stat-blue  { background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2); }
.caja-stat-green { background: rgba(34,197,94,.08);  border: 1px solid rgba(34,197,94,.2);  }
.caja-stat-red   { background: rgba(200,16,46,.08);  border: 1px solid rgba(200,16,46,.2);  }
.caja-stat-label { font-size: 10px; color: var(--text2); font-weight: 600; letter-spacing: .5px; margin-bottom: 4px; }
.caja-stat-value { font-family: 'Poppins', sans-serif; font-size: 20px; font-weight: 800; }
.caja-stat-sub   { font-size: 10px; color: var(--text3); margin-top: 2px; }

.btn-red {
  background: var(--red);
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-red:hover { background: var(--red-dim); }

/* ═══════════════════════════════════════════
   KEYBOARD NAVIGATION
═══════════════════════════════════════════ */
.sb-item.kb-focus {
  background: var(--surface2);
  color: var(--text);
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}
.sb-item.kb-focus .sb-tooltip { opacity: 0; }

.prod-quick.kb-focus {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
  background: var(--surface2);
  border-color: var(--cyan);
}

#prod-tbody tr.kb-focus {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
  background: rgba(6,182,212,0.08);
}

.cart-item.kb-focus {
  border-color: var(--cyan);
  background: rgba(6,182,212,0.08);
}

.cat-pill.kb-focus {
  outline: 2px solid var(--cyan);
  outline-offset: -2px;
}

/* Zone indicator */
.kb-zone-indicator {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.kb-zone-indicator.visible { opacity: 1; }

/* Flash de mixto input al auto-rellenar */
@keyframes mixto-fill {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.5); background: rgba(34,197,94,.15); }
  100% { box-shadow: 0 0 0 6px rgba(34,197,94,0); background: var(--surface2); }
}
.mixto-fill-flash {
  animation: mixto-fill .5s ease-out;
  border-color: var(--green) !important;
}

/* ═══════════════════════════════════════════
   MÉTODOS DE PAGO — donut chart
═══════════════════════════════════════════ */
.metodos-pago-wrap {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 8px 4px;
}
.metodos-pago-donut {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.metodos-pago-leyenda {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.metodo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background .15s;
}
.metodo-row:hover { background: var(--surface2); }
.metodo-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.metodo-info { flex: 1; min-width: 0; }
.metodo-label { font-size: 13px; font-weight: 600; color: var(--text); }
.metodo-sub   { font-size: 11px; color: var(--text3); margin-top: 2px; }
.metodo-total {
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 90px;
  text-align: right;
}
.metodo-pct {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  color: var(--text2);
  min-width: 46px;
  text-align: right;
  background: var(--surface3);
  padding: 2px 6px;
  border-radius: 3px;
}

@media (max-width: 768px) {
  .metodos-pago-wrap { flex-direction: column; gap: 14px; }
  .metodos-pago-donut svg { width: 150px !important; height: 150px !important; }
  .metodo-total { min-width: 70px; font-size: 12px; }
  .metodo-pct { min-width: 38px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════ */

/* Tablet / laptops chicas — sidebar compacto */
@media (max-width: 1024px) {
  :root { --sidebar-w: 64px; }
  .sb-label { display: none; }
  .sb-logo { height: calc(var(--header-h) * 1.3); padding: 6px; }
  .sb-item { justify-content: center; padding: 0; gap: 0; }
  .sb-item svg { width: 20px; height: 20px; }

  .dash-kpis     { grid-template-columns: repeat(2, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr) !important; }
  #pos-right     { width: 340px; }
}

/* Mobile — layout apilado con scroll vertical */
@media (max-width: 768px) {
  html, body { overflow-y: auto; overflow-x: hidden; height: auto; min-height: 100%; }
  body { font-size: 14px; }

  #app { min-height: 100vh; flex-direction: column; }

  /* Sidebar horizontal arriba */
  #sidebar {
    width: 100%;
    flex-direction: row;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    position: sticky;
    top: 0;
  }
  .sb-logo {
    width: auto;
    min-width: 56px;
    height: 54px;
    padding: 6px 10px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
  }
  .sb-nav {
    flex-direction: row;
    padding: 6px;
    gap: 4px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
    flex-wrap: nowrap;
  }
  .sb-bottom {
    flex-direction: row;
    border-top: none;
    border-left: 1px solid var(--border);
    padding: 6px;
    flex-shrink: 0;
  }
  .sb-item {
    height: 40px;
    width: 40px;
    min-width: 40px;
    padding: 0;
    flex-shrink: 0;
  }
  .sb-divider { width: 1px; height: 24px; margin: 0 4px; align-self: center; }
  .sb-tooltip { display: none; }

  /* Main */
  #main { overflow: visible; }
  #topbar { padding: 0 12px; height: 48px; gap: 8px; }
  .topbar-title { font-size: 16px; }
  .topbar-time,
  .topbar-badge span:not(.badge-dot) { font-size: 11px; }

  /* Módulos */
  #mod-dashboard,
  #mod-ventas, #mod-compras, #mod-gastos,
  #mod-clientes, #mod-proveedores, #mod-cajas,
  #mod-facturacion, #mod-reportes, #mod-config,
  #mod-stock, #mod-products, #mod-contabilidad {
    padding: 12px !important;
    gap: 12px !important;
    overflow-y: visible !important;
    height: auto !important;
  }
  .module { height: auto; }

  /* POS apilado */
  #mod-pos { flex-direction: column !important; height: auto; }
  #pos-left  {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 55vh;
  }
  #pos-right {
    width: 100%;
    min-height: 50vh;
    flex: none;
  }
  #pos-products-grid { max-height: 45vh; }

  /* Dashboard */
  .dash-kpis     { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .quick-actions { grid-template-columns: 1fr 1fr !important; gap: 8px; }
  .kpi-value     { font-size: 22px; }

  /* Formularios: 1 columna */
  .form-row { grid-template-columns: 1fr !important; }

  /* Modales casi pantalla completa */
  #modal-content {
    min-width: 0 !important;
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin: 8px;
    max-height: 90vh;
    overflow-y: auto;
  }
  #modal-overlay { padding: 8px; }

  /* Tablas: scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 600px; }

  /* Cards y secciones */
  .card          { padding: 10px; }
  .config-section { padding: 10px; }
  .section-title { font-size: 14px; }

  /* Caja stats — tipografía reducida */
  .caja-stat-value { font-size: 16px; }

  /* POS weight popup */
  #pos-weight-bar { padding: 10px; }
  #pos-weight-bar > .pw-card {
    min-width: 0;
    padding: 20px;
    gap: 16px;
  }
  #pos-weight-input { font-size: 38px; padding: 14px 12px; }
  .pos-weight-calc  { font-size: 36px; }
  #pos-weight-bar .pos-weight-product { font-size: 24px; }

  /* Grids de 2-columnas dentro de módulos → 1 columna */
  .config-section[style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* Badges flotantes más chicos */
  #sync-badge, #balanza-badge {
    font-size: 10px !important;
    padding: 5px 9px !important;
  }

  /* Toasts */
  #toasts { left: 8px; right: 8px; top: 8px; }
  .toast  { max-width: 100%; }
}

/* Móviles chicos */
@media (max-width: 480px) {
  .dash-kpis     { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr !important; }
  .topbar-time   { display: none; }
  .cart-item     { padding: 8px; gap: 6px; }
  .cart-item-name { font-size: 12px; }
  #pos-weight-bar .pos-weight-product { font-size: 20px; }
  #pos-weight-input { font-size: 32px; }
  .pos-weight-calc  { font-size: 30px; }
}

/* ═══════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════ */
#login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(200,16,46,0.15) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(200,16,46,0.10) 0%, transparent 40%),
    var(--bg);
  font-family: 'Poppins', sans-serif;
}
#login-screen.hidden { display: none; }

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.login-logo {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.login-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.login-logo-text {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--red);
  text-transform: uppercase;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  letter-spacing: .5px;
}
.login-subtitle {
  font-size: 12px;
  color: var(--text3);
  text-align: center;
  margin-top: 4px;
  margin-bottom: 22px;
}

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin: 10px 0 6px;
}

#login-form input {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  outline: none;
  transition: all .15s;
}
#login-form input:focus {
  border-color: var(--red);
  background: var(--surface3);
}

.login-error {
  min-height: 18px;
  margin-top: 12px;
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

.login-btn {
  width: 100%;
  margin-top: 10px;
  padding: 11px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
}
.login-btn:hover:not(:disabled) { background: var(--red-dim); }
.login-btn:disabled { opacity: .55; cursor: not-allowed; }

.login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .5px;
}

/* ═══════════════════════════════════════════
   PRINT
═══════════════════════════════════════════ */
@media print {
  body > *:not(#print-target) { display: none !important; }
  #print-target { display: block !important; }
}
