:root {
  --sidebar-w: 250px;
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --bg: #f1f5f9;
}

* { box-sizing: border-box; }

body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: #1e293b;
  min-height: 100vh;
}

#app { min-height: 100vh; }

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 1.02rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon { font-size: 1.4rem; color: #fbbf24; }

.sidebar-nav { flex: 1; padding: 14px 10px; display: flex; flex-direction: column; gap: 4px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: .95rem;
  transition: background .15s, color .15s;
}
.nav-item i { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }

.sidebar-footer { padding: 12px 10px; border-top: 1px solid rgba(255,255,255,.08); }

/* ===== Main ===== */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: #fff;
  padding: 14px 24px;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar h5 { font-weight: 600; }

/* ===== Tarjetas dashboard ===== */
.card { border: none; border-radius: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.card .card-title { font-weight: 600; }

.stat-card {
  border-radius: 14px;
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
}
.stat-card .stat-icon { font-size: 2.2rem; opacity: .85; }
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; }
.stat-card .stat-label { opacity: .9; font-size: .85rem; }
.bg-grad-blue   { background: linear-gradient(135deg,#2563eb,#3b82f6); }
.bg-grad-green  { background: linear-gradient(135deg,#059669,#10b981); }
.bg-grad-orange { background: linear-gradient(135deg,#d97706,#f59e0b); }
.bg-grad-red    { background: linear-gradient(135deg,#dc2626,#ef4444); }
.bg-grad-purple { background: linear-gradient(135deg,#7c3aed,#8b5cf6); }

/* ===== Tablas ===== */
.table { margin-bottom: 0; }
.table thead th {
  background: #f8fafc;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  border-bottom: 1px solid #e2e8f0;
}
.table td { vertical-align: middle; }

/* ===== Botones ===== */
.btn { border-radius: 9px; }
.btn-primary { --bs-btn-bg: var(--primary); --bs-btn-border-color: var(--primary); --bs-btn-hover-bg: var(--primary-dark); --bs-btn-hover-border-color: var(--primary-dark); }

/* ===== POS ===== */
.pos-grid { display: grid; grid-template-columns: 1fr 360px; gap: 18px; }
@media (max-width: 992px) { .pos-grid { grid-template-columns: 1fr; } }

.pos-products { max-height: calc(100vh - 260px); overflow-y: auto; }
.pos-products .product-row { cursor: pointer; transition: background .12s; }
.pos-products .product-row:hover { background: #eff6ff; }

.cart-panel {
  position: sticky;
  top: 80px;
  align-self: start;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(15,23,42,.08);
}
.cart-items { max-height: calc(100vh - 460px); overflow-y: auto; }

.qty-input { width: 70px; }

.stock-bajo { color: #dc2626; font-weight: 700; }

/* ===== Ticket (impresión) ===== */
.ticket {
  font-family: "Courier New", monospace;
  width: 280px;
  margin: 0 auto;
  background: #fff;
  padding: 14px;
  border-radius: 6px;
}
.ticket h4 { font-size: 1rem; font-weight: 700; }
.ticket table { width: 100%; font-size: .78rem; }
.ticket .t { display: flex; justify-content: space-between; }
.ticket .sep { border-top: 1px dashed #000; margin: 6px 0; }
.ticket .total-row { font-size: 1rem; font-weight: 700; }

@media print {
  body { background: #fff; }
  #sidebar, .topbar, .no-print, .btn { display: none !important; }
  #main { padding: 0; }
  .container-fluid { padding: 0 !important; }
  .ticket { border: none; box-shadow: none; }
}

.img-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; }

/* ===== Login ===== */
.login-body {
  background: linear-gradient(135deg, #0f172a, #1e3a8a);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card { width: 100%; max-width: 400px; border-radius: 16px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
