/* ─── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --primary:      #1565C0;
  --primary-dark: #0D47A1;
  --primary-mid:  #1976D2;
  --primary-lt:   #42A5F5;
  --primary-bg:   #E3F2FD;
  --accent:       #0288D1;
  --success:      #2E7D32;
  --success-lt:   #E8F5E9;
  --warning:      #F57F17;
  --warning-lt:   #FFF8E1;
  --danger:       #C62828;
  --danger-lt:    #FFEBEE;
  --info:         #0277BD;
  --info-lt:      #E1F5FE;
  --gray-50:      #FAFAFA;
  --gray-100:     #F5F5F5;
  --gray-200:     #EEEEEE;
  --gray-300:     #E0E0E0;
  --gray-400:     #BDBDBD;
  --gray-500:     #9E9E9E;
  --gray-600:     #757575;
  --gray-700:     #616161;
  --gray-800:     #424242;
  --gray-900:     #212121;
  --white:        #FFFFFF;
  --bg:           #F0F4F8;
  --sidebar-w:    240px;
  --navbar-h:     60px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow:       0 2px 8px rgba(0,0,0,.10);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.14);
  --transition:   .2s ease;
}

/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--gray-900); line-height: 1.5; }
a { color: var(--primary-mid); text-decoration: none; }
img { max-width: 100%; }
ul, ol { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ─── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-400); border-radius: 3px; }

/* ─── Login ─────────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-mid) 50%, var(--primary-lt) 100%);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px 40px;
  width: 100%;
  max-width: 420px;
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.login-logo .logo-icon {
  width: 48px;
  height: 48px;
  background: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.login-logo .logo-text { font-size: 24px; font-weight: 700; color: var(--primary); }
.login-subtitle { color: var(--gray-500); font-size: 13px; margin-bottom: 32px; }
.login-card h2 { font-size: 20px; font-weight: 600; color: var(--gray-800); margin-bottom: 24px; }
/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(25,118,210,.15); }
.form-control::placeholder { color: var(--gray-400); }
.form-control:read-only { background: var(--gray-100); color: var(--gray-600); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239E9E9E' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-text { font-size: 12px; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--primary-mid); color: var(--white); }
.btn-primary:hover { background: var(--primary); box-shadow: 0 4px 12px rgba(25,118,210,.3); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #1B5E20; box-shadow: 0 4px 12px rgba(46,125,50,.3); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #B71C1C; }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { background: #E65100; }
.btn-outline { background: transparent; border: 1.5px solid var(--primary-mid); color: var(--primary-mid); }
.btn-outline:hover { background: var(--primary-bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 7px; border-radius: 6px; background: transparent; border: none; color: var(--gray-600); transition: background var(--transition), color var(--transition); }
.btn-icon:hover { background: var(--gray-200); color: var(--gray-900); }
.btn-icon.danger:hover { background: var(--danger-lt); color: var(--danger); }
.btn-icon.success:hover { background: var(--success-lt); color: var(--success); }
.btn-icon.primary:hover { background: var(--primary-bg); color: var(--primary); }
.btn[disabled] { opacity: .5; pointer-events: none; }

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

/* ─── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.sidebar-brand .brand-name { color: var(--white); font-size: 16px; font-weight: 700; line-height: 1.2; }
.sidebar-brand .brand-tagline { color: rgba(255,255,255,.55); font-size: 11px; }
.sidebar-user {
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-user .user-name { color: var(--white); font-size: 13px; font-weight: 600; }
.sidebar-user .user-role { color: rgba(255,255,255,.55); font-size: 11px; margin-top: 2px; }
.sidebar-nav { padding: 12px 0; flex: 1; }
.nav-section { padding: 8px 20px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.35); }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.75);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav-item.active { background: rgba(255,255,255,.12); color: var(--white); border-left-color: var(--primary-lt); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--primary-lt);
  color: var(--white);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
}
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer .btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,.6);
  font-size: 13px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 0;
  transition: color var(--transition);
  width: 100%;
}
.sidebar-footer .btn-logout:hover { color: var(--white); }

/* ─── Main Content ──────────────────────────────────────────────────────────── */
.main-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--navbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--gray-900); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.page-content { padding: 24px; flex: 1; }

/* ─── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }

/* ─── KPI Cards ─────────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: box-shadow 0.15s, transform 0.15s;
}
.kpi-card[data-action] { cursor: pointer; }
.kpi-card[data-action]:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.kpi-icon.blue { background: var(--primary-bg); }
.kpi-icon.green { background: var(--success-lt); }
.kpi-icon.yellow { background: var(--warning-lt); }
.kpi-icon.red { background: var(--danger-lt); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--gray-900); line-height: 1; margin-bottom: 4px; }
.kpi-label { font-size: 12px; color: var(--gray-500); font-weight: 500; }
.kpi-change { font-size: 11px; margin-top: 4px; }
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }

/* ─── Tables ─────────────────────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--gray-50);
  padding: 11px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13.5px;
  color: var(--gray-800);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.td-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ─── Badges / Status ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge-blue    { background: var(--primary-bg); color: var(--primary); }
.badge-green   { background: var(--success-lt); color: var(--success); }
.badge-yellow  { background: var(--warning-lt); color: var(--warning); }
.badge-red     { background: var(--danger-lt); color: var(--danger); }
.badge-gray    { background: var(--gray-200); color: var(--gray-600); }
.badge-cyan    { background: #E0F7FA; color: #00838F; }

/* ─── Search & Filters ──────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-input-wrap { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-input-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 14px;
}
.search-input-wrap input { padding-left: 34px; }

/* ─── Product Grid ──────────────────────────────────────────────────────────── */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.product-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition), transform var(--transition);
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.product-card-img {
  aspect-ratio: 1 / 1;
  width: 100%;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: 1px solid #F0F0F0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
}
.product-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.product-card-code { font-size: 11px; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .04em; }
.product-card-name { font-size: 14px; font-weight: 700; color: var(--gray-900); line-height: 1.3; min-height: calc(1.3em * 3); display: flex; align-items: flex-start; }
.product-card-cat { font-size: 11.5px; color: var(--gray-500); }
.product-card-price { font-size: 18px; font-weight: 800; color: var(--primary); margin-top: auto; }
.product-card-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stock-indicator { font-size: 11.5px; font-weight: 600; }
.stock-ok { color: var(--success); }
.stock-low { color: var(--warning); }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-ctrl button { width: 26px; height: 26px; border-radius: 6px; border: 1.5px solid var(--gray-300); background: var(--white); font-size: 15px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--transition); }
.qty-ctrl button:hover { background: var(--primary-bg); border-color: var(--primary-lt); }
.qty-ctrl input { width: 68px; text-align: center; border: 1.5px solid var(--gray-300); border-radius: 6px; padding: 4px; font-size: 13px; }

/* ─── Cart ──────────────────────────────────────────────────────────────────── */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-icon { font-size: 28px; width: 44px; text-align: center; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-weight: 600; font-size: 14px; }
.cart-item-code { font-size: 11.5px; color: var(--gray-500); }
.cart-item-price { font-size: 13px; color: var(--gray-600); margin-top: 2px; }
.cart-item-subtotal { font-size: 15px; font-weight: 700; color: var(--primary); min-width: 90px; text-align: right; }
.cart-summary-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13.5px; }
.cart-summary-line.total { font-size: 16px; font-weight: 800; color: var(--gray-900); border-top: 2px solid var(--gray-200); margin-top: 8px; padding-top: 12px; }
.cart-empty { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.cart-empty .empty-icon { font-size: 56px; margin-bottom: 12px; }
.cart-empty p { font-size: 14px; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.hidden { display: none; }
.modal-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal-close { background: transparent; border: none; font-size: 20px; cursor: pointer; color: var(--gray-500); line-height: 1; padding: 2px 6px; border-radius: 4px; }
.modal-close:hover { background: var(--gray-100); color: var(--gray-900); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--gray-900);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13.5px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: 360px;
  animation: toastIn .25s ease;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info    { background: var(--info); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ─── Pagination ────────────────────────────────────────────────────────────── */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.page-info {
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}

/* ─── Order detail ──────────────────────────────────────────────────────────── */
.order-info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.order-info-item label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--gray-500); display: block; margin-bottom: 2px; }
.order-info-item span { font-size: 14px; font-weight: 600; color: var(--gray-900); }

/* ─── Misc ──────────────────────────────────────────────────────────────────── */
.section-title { font-size: 22px; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; }
.section-subtitle { font-size: 13.5px; color: var(--gray-500); margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mt-8  { margin-top: 8px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary-mid); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.fw-bold { font-weight: 700; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-bg);
  color: var(--primary);
}
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .es-icon { font-size: 56px; margin-bottom: 12px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--gray-500); }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-mid);
  color: var(--white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.progress-bar-wrap { background: var(--gray-200); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 4px; background: var(--primary-mid); transition: width .5s ease; }
.top-product-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--gray-100); }
.top-product-row:last-child { border-bottom: none; }
.top-product-rank { font-size: 16px; font-weight: 800; color: var(--gray-400); min-width: 24px; }
.top-product-info { flex: 1; min-width: 0; }
.top-product-name { font-size: 13.5px; font-weight: 600; color: var(--gray-900); }
.top-product-cat  { font-size: 11.5px; color: var(--gray-500); }
.top-product-qty  { font-size: 13px; font-weight: 700; color: var(--primary); }
.categories-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--gray-300);
  background: var(--white);
  color: var(--gray-700);
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--primary-lt); color: var(--primary); }
.filter-chip.active { background: var(--primary-mid); border-color: var(--primary-mid); color: var(--white); }

/* ─── Form section labels ───────────────────────────────────────────────────── */
.form-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  background: var(--primary-bg);
  border-radius: 4px;
  padding: 4px 10px;
  margin: 16px 0 12px;
  display: block;
}

/* ─── CSV Import ────────────────────────────────────────────────────────────── */
.csv-info-box {
  background: var(--primary-bg);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--primary-dark);
}
.csv-info-box strong { display: block; margin-bottom: 8px; }
.csv-columns { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.csv-info-hint { font-size: 11.5px; color: var(--gray-600); line-height: 1.6; }
.csv-info-hint code { background: rgba(0,0,0,.07); padding: 1px 5px; border-radius: 3px; font-family: monospace; }

.csv-drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 16px;
}
.csv-drop-zone:hover, .csv-drop-zone.dragging {
  border-color: var(--primary-mid);
  background: var(--primary-bg);
}
.csv-drop-icon { font-size: 36px; margin-bottom: 8px; }
.csv-drop-text { font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.csv-drop-sub  { font-size: 12px; color: var(--gray-500); }

.csv-summary { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.csv-stat {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
}
.csv-stat.green  { background: var(--success-lt); color: var(--success); }
.csv-stat.red    { background: var(--danger-lt);  color: var(--danger); }
.csv-stat.blue   { background: var(--primary-bg); color: var(--primary); }

.csv-section-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  margin-bottom: 6px;
  margin-top: 12px;
}
.csv-preview-table { max-height: 200px; overflow-y: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.csv-error-box {
  background: var(--danger-lt);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  color: var(--danger);
  line-height: 1.6;
}

/* ─── Hamburger ─────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  flex-shrink: 0;
}
.hamburger:hover { background: var(--gray-100); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-700);
  border-radius: 2px;
  transition: all .25s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ─── Sidebar overlay (mobile) ──────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ─── Tablet (768px – 1024px) ───────────────────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 768px) {
  :root { --sidebar-w: 200px; }
  .sidebar-brand .brand-tagline { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 18px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

/* ─── Mobile (< 768px) ──────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* Sidebar: oculto por defecto, slide-in al abrir */
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
    height: 100dvh;
  }
  .sidebar.open { transform: translateX(0); }

  /* Contenido ocupa todo el ancho */
  .main-content { width: 100%; min-width: 0; }

  /* Mostrar hamburger */
  .hamburger { display: flex; }

  /* Topbar */
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-title { font-size: 15px; }
  .topbar-actions { gap: 6px; }
  .topbar-actions span[style] { display: none; } /* oculta nombre de texto */

  /* Page content */
  .page-content { padding: 12px; }

  /* KPIs: 2 columnas en móvil */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px 12px; gap: 10px; }
  .kpi-value { font-size: 20px; }
  .kpi-icon { width: 40px; height: 40px; font-size: 18px; border-radius: 10px; }

  /* Grids a 1 columna */
  .grid-2 { grid-template-columns: 1fr; }

  /* Cart */
  .cart-layout { grid-template-columns: 1fr; }
  .cart-item { flex-wrap: wrap; gap: 10px; }
  .cart-item-subtotal { min-width: unset; }

  /* Product grid */
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 12px; }
  .product-card-img { font-size: 36px; }

  /* Forms */
  .form-row { grid-template-columns: 1fr; }
  .modal-container { max-width: 100%; margin: 0 8px; }

  /* Tablas: scroll horizontal + texto más pequeño */
  thead th { padding: 8px 10px; font-size: 11px; }
  tbody td { padding: 9px 10px; font-size: 12.5px; }

  /* Page header apilado */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-title { font-size: 18px; }

  /* Toolbar apilado */
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-input-wrap { max-width: 100% !important; }
  .toolbar select { max-width: 100% !important; width: 100% !important; }

  /* Botones más fáciles de tocar */
  .btn { padding: 10px 16px; min-height: 40px; }
  .btn-sm { padding: 8px 12px; min-height: 34px; }
  .btn-icon { padding: 8px; }

  /* Login */
  .login-card { padding: 28px 18px 24px; }
  .login-logo .logo-text { font-size: 20px; }

  /* Categorías filtro: scroll horizontal */
  .categories-filter { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .categories-filter::-webkit-scrollbar { height: 0; }
  .filter-chip { flex-shrink: 0; }

  /* Order detail acciones apiladas */
  .order-info-grid { grid-template-columns: 1fr 1fr; }

  /* Topbar cart badge: solo icono */
  .topbar-actions .btn span[style*="margin-left"] { margin-left: 2px !important; }

  /* Toast más ancho */
  #toast-container { right: 12px; left: 12px; bottom: 16px; }
  .toast { min-width: unset; max-width: 100%; }
}

/* ─── Phones muy pequeños (< 400px) ─────────────────────────────────────────── */
@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr; }
  .kpi-value { font-size: 18px; }
}

/* ─── Print Styles ──────────────────────────────────────────────────────────── */
@media print {
  body { background: white; }
  .no-print { display: none !important; }
}

/* ─── Product image in card ─────────────────────────────────────────────────── */
.product-card-img img {
  width: 80%;
  height: 80%;
  object-fit: contain;
  display: block;
}

/* ─── Product thumbnail in inventory table ──────────────────────────────────── */
.product-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── Vendor order-for-client banner ───────────────────────────────────────── */
.client-order-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--primary-bg);
  border: 1.5px solid var(--primary-lt);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.client-order-banner-info {
  background: var(--gray-100);
  border-color: var(--gray-300);
  color: var(--gray-600);
  font-size: 13px;
}
.client-order-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--primary-dark);
}
.client-order-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary);
}

/* ─── Clients page ──────────────────────────────────────────────────────────── */
.client-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.client-status-dot.active   { background: var(--success); }
.client-status-dot.inactive { background: var(--gray-400); }

/* ─── Image upload preview ──────────────────────────────────────────────────── */
.img-preview {
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  margin-bottom: 8px;
  display: block;
}

@media (max-width: 767px) {
  .client-order-banner { gap: 8px; }
  .client-order-info { flex-wrap: wrap; }
}

.pstats-opt:hover { background: var(--gray-50); }
