/* ── NEXUS WAREHOUSE – Design System ── */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

:root {
  --blue:         #1A56DB;
  --blue-light:   #EBF2FF;
  --blue-mid:     #3B82F6;
  --red:          #E02424;
  --red-light:    #FEF2F2;
  --orange:       #FF8A00;
  --orange-light: #FFF7ED;
  --green:        #057A55;
  --green-light:  #ECFDF5;
  --yellow:       #B45309;
  --yellow-light: #FFFBEB;
  --gray-50:  #F9FAFB; --gray-100: #F3F4F6; --gray-200: #E5E7EB;
  --gray-300: #D1D5DB; --gray-400: #9CA3AF; --gray-500: #6B7280;
  --gray-600: #4B5563; --gray-700: #374151; --gray-800: #1F2937;
  --gray-900: #111827; --white: #FFFFFF;
  --sidebar-w: 228px; --header-h: 52px;
  --font: 'DM Sans', sans-serif; --mono: 'DM Mono', monospace;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.10), 0 2px 4px -1px rgba(0,0,0,.06);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--gray-800);
       background: var(--gray-50); display: flex; overflow: hidden; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w); background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto; flex-shrink: 0;
  z-index: 50;
}
.sidebar-brand { padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 32px; height: 32px; background: var(--blue); border-radius: 6px;
              display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; }
.brand-name { font-weight: 700; font-size: 13px; color: var(--gray-800); line-height: 1.2; }
.brand-ver  { font-size: 11px; color: var(--gray-400); }
.sidebar-divider { height: 1px; background: var(--gray-200); margin: 4px 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 500;
  color: var(--gray-600); cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--gray-50); color: var(--gray-800); }
.nav-item.active { background: var(--blue-light); color: var(--blue); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .caret { margin-left: auto; width: 14px; height: 14px; transition: transform .2s; }
.nav-item .caret.open { transform: rotate(180deg); }
.nav-sub { display: none; }
.nav-sub.open { display: block; }
.nav-sub .nav-item { padding: 7px 12px 7px 44px; font-size: 13px; font-weight: 400; }

.sidebar-bottom { margin-top: auto; padding: 8px 0 4px; }
.new-entry-btn {
  display: block; margin: 8px 14px;
  background: var(--blue); color: #fff; border: none;
  padding: 10px; border-radius: var(--radius);
  font-family: var(--font); font-size: 13.5px; font-weight: 600;
  cursor: pointer; text-align: center; transition: background .15s;
}
.new-entry-btn:hover { background: #1747c4; }

/* ─── HAMBURGER ─── */
.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; flex-shrink: 0;
  align-items: center; justify-content: center; color: var(--gray-600);
}
.sidebar-overlay { display: none; }

/* ─── MAIN ─── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ─── TOPBAR ─── */
.topbar {
  height: var(--header-h); background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0;
}
.topbar-brand { font-weight: 700; font-size: 15px; color: var(--blue); white-space: nowrap; }
.topbar-section { font-size: 14px; font-weight: 600; color: var(--gray-700); white-space: nowrap; }
.topbar-search {
  flex: 1; max-width: 340px; display: flex; align-items: center;
  background: var(--gray-100); border-radius: 20px; padding: 6px 14px; gap: 8px;
}
.topbar-extra {
  display: flex; align-items: center; gap: 12px;
  flex: 1; margin-left: auto;
}
.topbar-search input { background: none; border: none; outline: none;
  font-family: var(--font); font-size: 13px; color: var(--gray-700); width: 100%; }
.topbar-search input::placeholder { color: var(--gray-400); }
.branch-pill {
  display: flex; align-items: center; gap: 6px;
  background: var(--gray-100); border-radius: 20px;
  padding: 5px 12px; font-size: 12.5px; font-weight: 500; color: var(--gray-700);
  white-space: nowrap; cursor: pointer;
}
.topbar-icon-btn { background: none; border: none; cursor: pointer; color: var(--gray-600);
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.topbar-icon-btn:hover { background: var(--gray-100); }
.bell-wrap { position: relative; }
.bell-dot { position: absolute; top: 2px; right: 2px; width: 8px; height: 8px;
            background: var(--red); border-radius: 50%; border: 2px solid #fff; }
.bell-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px;
              background: var(--red); color: #fff; border-radius: 9px; font-size: 10px;
              font-weight: 700; display: flex; align-items: center; justify-content: center;
              padding: 0 4px; border: 2px solid #fff; }
.notif-dropdown { width: 300px; right: 0; }
.nav-badge { margin-left: auto; background: var(--red); color: #fff; font-size: 10px;
             font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px;
             display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: #fff;
          display: flex; align-items: center; justify-content: center;
          font-size: 12px; font-weight: 700; cursor: pointer; flex-shrink: 0; }
.avatar:hover { opacity: 0.85; }
#profile-wrap .dropdown-menu { top: calc(100% + 6px); }

/* ─── PAGE WRAPPER ─── */
.page-body { flex: 1; overflow-y: auto; }
.page-header { padding: 16px 24px 0; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-top: 4px; }
.breadcrumb { font-size: 12.5px; color: var(--gray-500); }
.breadcrumb a { color: var(--gray-500); text-decoration: none; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { margin: 0 4px; }
.breadcrumb .current { color: var(--gray-700); font-weight: 500; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ─── STAT CARDS ─── */
.stat-row { display: flex; gap: 12px; padding: 16px 24px 0; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 140px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 14px 16px; }
.stat-label { font-size: 11px; font-weight: 600; color: var(--gray-500);
              text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-value.red  { color: var(--red); }
.stat-value.blue { color: var(--blue); }
.stat-sub { font-size: 12px; margin-top: 4px; color: var(--gray-500); }
.stat-sub.green  { color: var(--green); }
.stat-sub.red    { color: var(--red); }
.stat-sub.orange { color: var(--orange); }
.stat-progress { height: 4px; background: var(--gray-200); border-radius: 2px;
                 margin-top: 8px; overflow: hidden; }
.stat-progress-fill { height: 100%; border-radius: 2px; }

/* ─── CARD ─── */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); }
.card-header { display: flex; align-items: center; justify-content: space-between;
               padding: 14px 16px 0; flex-wrap: wrap; gap: 8px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--gray-800); }

/* ─── BADGES ─── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px;
         border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge-green  { background: var(--green-light);  color: var(--green); }
.badge-blue   { background: var(--blue-light);   color: var(--blue); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }
.badge-red    { background: var(--red-light);    color: var(--red); }
.badge-gray   { background: var(--gray-100);     color: var(--gray-600); }
.badge-orange { background: var(--orange-light); color: var(--orange); }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { font-size: 11.5px; font-weight: 600; text-transform: uppercase;
           letter-spacing: .04em; color: var(--gray-500);
           padding: 10px 12px; text-align: left;
           border-bottom: 1px solid var(--gray-200); background: var(--gray-50);
           white-space: nowrap; }
tbody td { padding: 11px 12px; font-size: 13px; color: var(--gray-700);
           border-bottom: 1px solid var(--gray-100); }
tbody tr:hover td { background: var(--gray-50); }
.link { color: var(--blue); font-weight: 500; cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.red-val { color: var(--red); font-weight: 700; }

/* ─── BUTTONS ─── */
.btn { display: inline-flex; align-items: center; gap: 6px;
       padding: 8px 16px; border-radius: var(--radius);
       font-family: var(--font); font-size: 13px; font-weight: 600;
       cursor: pointer; border: none; transition: all .15s; text-decoration: none; white-space: nowrap; }
.btn-primary   { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1747c4; }
.btn-secondary { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-danger    { background: var(--white); color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red-light); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--gray-700);
              margin-bottom: 5px; display: block; }
.form-control { width: 100%; padding: 8px 12px;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; color: var(--gray-800);
  background: var(--white); outline: none; transition: border-color .15s; }
.form-control:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,86,219,.10); }
select.form-control { cursor: pointer; }
.form-hint { font-size: 11.5px; color: var(--gray-400); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; padding: 16px; }
.form-row-2 { grid-template-columns: repeat(2,1fr); }
.form-row-3 { grid-template-columns: repeat(3,1fr); }

/* ─── PASSWORD TOGGLE ─── */
.pw-wrap { position: relative; }
.pw-wrap .form-control { padding-right: 36px; }
.pw-toggle {
  position: absolute; right: 1px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; padding: 6px;
  color: var(--gray-400); display: flex; align-items: center; justify-content: center;
  border-radius: 4px; transition: color .15s;
}
.pw-toggle:hover { color: var(--gray-600); }
.pw-toggle svg { width: 16px; height: 16px; display: block; }

/* ─── FILTER ROW ─── */
.filter-row { display: flex; gap: 8px; align-items: center; padding: 12px 24px; flex-wrap: wrap; }
.filter-select {
  padding: 7px 28px 7px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius);
  font-family: var(--font); font-size: 13px; color: var(--gray-700); background: var(--white);
  appearance: none; cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
}
.filter-select:focus { border-color: var(--blue); }
.search-bar { display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  padding: 7px 12px; background: var(--white); }
.search-bar input { border: none; outline: none; font-family: var(--font); font-size: 13px;
  color: var(--gray-800); width: 100%; background: none; }
.search-bar input::placeholder { color: var(--gray-400); }

/* ─── CHECKBOX ─── */
.checkbox { width: 18px; height: 18px; border: 2px solid var(--gray-300); border-radius: 4px;
  cursor: pointer; appearance: none; background: var(--white); transition: all .15s; flex-shrink: 0; }
.checkbox:checked { background: var(--blue); border-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'%3E%3Cpath d='M3 8l3.5 3.5L13 4' stroke='white' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; }

/* ─── TOGGLE ─── */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: 12px; transition: .2s; }
.toggle-slider:before { content: ''; position: absolute; width: 18px; height: 18px;
  left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + .toggle-slider { background: var(--blue); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ─── ALERTS ─── */
.alert-badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
               border-radius: 10px; padding: 1px 7px; }
.alert-item { padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
              display: flex; gap: 10px; align-items: flex-start; }
.alert-item:last-child { border-bottom: none; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.alert-desc  { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ─── DASHBOARD GRID ─── */
.dash-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; padding: 16px 24px; }
.dash-col   { display: flex; flex-direction: column; gap: 16px; }

/* ─── CHART BARS ─── */
.chart-area  { padding: 16px; }
.chart-bars  { display: flex; align-items: flex-end; gap: 6px; height: 160px;
               border-bottom: 1px solid var(--gray-200); padding-bottom: 4px; }
.bar-group   { display: flex; gap: 2px; align-items: flex-end; flex: 1; }
.bar         { border-radius: 3px 3px 0 0; min-width: 14px; transition: opacity .2s; cursor: pointer; }
.bar:hover   { opacity: .75; }
.bar.inbound  { background: #93B4F0; }
.bar.outbound { background: #CBD5E1; }

/* ─── SECTION CARD (Receiving) ─── */
.section-card { background: var(--white); border: 1px solid var(--gray-200);
                border-radius: var(--radius); margin-bottom: 16px; }
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase;
                 letter-spacing: .08em; color: var(--gray-500); }

/* ─── ACCORDION ─── */
.accordion { background: var(--white); border: 1px solid var(--gray-200);
             border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.accordion-header { display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; cursor: pointer; user-select: none; }
.accordion-header:hover { background: var(--gray-50); }
.accordion-title { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 14px; }
.accordion-caret { transition: transform .2s; }
.accordion.open .accordion-caret { transform: rotate(180deg); }
.accordion-body { padding: 20px; border-top: 1px solid var(--gray-100); display: none; }
.accordion.open .accordion-body { display: block; }

/* ─── CAPACITY BAR ─── */
.capacity-bar  { display: inline-block; width: 100px; height: 6px; background: var(--gray-200);
                 border-radius: 3px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.capacity-fill { height: 100%; border-radius: 3px; display: block; }
.capacity-fill.high { background: var(--red); }
.capacity-fill.mid  { background: var(--blue); }
.capacity-fill.low  { background: var(--blue-mid); }

/* ─── SKU CARDS (Dispatch) ─── */
.sku-card { background: var(--white); border: 1px solid var(--gray-200);
            border-radius: var(--radius); padding: 12px; margin-bottom: 8px; }
.sku-card.low  { border-left: 3px solid var(--orange); }
.sku-card.ready { border-left: 3px solid var(--green); }
.sku-card.oos  { border-left: 3px solid var(--gray-300); opacity: .75; }
.batch-item { background: var(--gray-50); border: 1px solid var(--gray-200);
              border-radius: 6px; padding: 6px 10px; font-size: 12px; }
.batch-label { color: var(--gray-500); font-size: 11px; text-transform: uppercase;
               letter-spacing: .04em; }
.batch-qty   { font-weight: 600; color: var(--gray-800); font-size: 13px; }

/* ─── PRODUCT ITEM (Transfers) ─── */
.product-item { display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  margin-bottom: 8px; background: var(--white); transition: border-color .15s; }
.product-item:hover { border-color: var(--blue); }
.product-thumb { width: 44px; height: 44px; border-radius: 6px; background: var(--gray-100);
                 display: flex; align-items: center; justify-content: center;
                 font-size: 22px; flex-shrink: 0; }

/* ─── ROLES ─── */
.role-item { padding: 12px 14px; border-radius: 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid transparent; margin-bottom: 4px;
  text-decoration: none; color: inherit; }
.role-item:hover { background: var(--gray-50); border-color: var(--gray-200); }
.role-item.active { background: var(--blue); color: #fff; }
.role-item.active .role-sub { color: rgba(255,255,255,.75); }
.role-sub { font-size: 12px; color: var(--gray-500); margin-top: 1px; }

/* ─── ROLE PILLS ─── */
.role-pill {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 9px 12px; border: 1px solid transparent; border-radius: 7px;
  background: none; cursor: pointer; text-align: left;
  font-family: var(--font); font-size: 13px; transition: all .15s;
  color: var(--gray-600);
}
.role-pill:hover { background: var(--blue-light); border-color: var(--blue-mid); color: var(--blue); }
.role-pill.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
  box-shadow: 0 1px 3px rgba(26,86,219,.25);
}
.role-pill-name { font-weight: 600; }
.role-pill-count {
  font-size: 12px; font-weight: 600;
  background: var(--gray-100); color: var(--gray-500);
  padding: 1px 8px; border-radius: 10px; min-width: 22px; text-align: center;
}
.role-pill.active .role-pill-count { background: rgba(255,255,255,.25); color: #fff; }

/* ─── STATUS BAR ─── */
.status-bar { background: var(--white); border-top: 1px solid var(--gray-200);
  padding: 10px 24px; font-size: 12px; color: var(--gray-500);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--orange);
              display: inline-block; margin-right: 6px; }

/* ─── PERM TABLE ─── */
.perm-table { width: 100%; border-collapse: collapse; }
.perm-table th { font-size: 12px; font-weight: 600; color: var(--gray-500);
  padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--gray-200); }
.perm-table td { padding: 14px 12px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.perm-name { font-size: 13.5px; font-weight: 600; color: var(--gray-800); }
.perm-desc { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ─── DISPATCH FOOTER TOTALS ─── */
.total-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--gray-600); padding: 4px 0; }
.total-row.grand { font-size: 15px; font-weight: 700; color: var(--blue);
                   padding-top: 10px; border-top: 1px solid var(--gray-200); margin-top: 6px; }

/* ─── TOAST MESSAGES ─── */
.messages-container { position: fixed; top: 60px; right: 20px; z-index: 9999;
                      display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--white);
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 12px 16px; box-shadow: var(--shadow-md); pointer-events: all;
  font-size: 13px; min-width: 280px; animation: slideIn .25s ease; }
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--orange); }
@keyframes slideIn { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:translateX(0); } }

/* ─── MODAL ─── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
                 z-index: 1000; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--white); border-radius: 10px; padding: 24px;
         min-width: 400px; max-width: 520px; width: 100%;
         box-shadow: var(--shadow-md); animation: modalIn .2s ease;
         max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
@keyframes modalIn { from { opacity:0; transform:scale(.96); } to { opacity:1; transform:scale(1); } }

/* ─── LOGIN PAGE ─── */
.login-page { min-height: 100vh; width: 100%; display: flex; align-items: center; justify-content: center;
              padding: 16px;
              background: var(--gray-50); }
.login-card { background: var(--white); border: 1px solid var(--gray-200);
  border-radius: 12px; padding: 36px 32px; width: 100%; max-width: 400px; box-shadow: var(--shadow-md);
  text-align: center; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; justify-content: center; }
.login-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.login-sub   { font-size: 13px; color: var(--gray-500); margin-bottom: 24px; }

/* ─── PAGINATION ─── */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.page-btn { padding: 5px 10px; border: 1px solid var(--gray-300); border-radius: 6px;
  background: var(--white); color: var(--gray-700); font-family: var(--font);
  font-size: 12.5px; cursor: pointer; }
.page-btn:hover { background: var(--gray-50); }
.page-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ─── DROPDOWN ─── */
.dropdown-menu {
  display: none; position: absolute; top: 100%; right: 0; z-index: 100;
  background: var(--white); border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 180px; padding: 4px;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-radius: 6px; font-size: 13px;
  color: var(--gray-700); text-decoration: none;
}
.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }

/* ─── SEARCHABLE PRODUCT DROPDOWN ─── */
.search-res-dropdown .search-res-item {
  padding: 8px 12px; font-size: 13px; cursor: pointer;
  color: var(--gray-700); border-bottom: 1px solid var(--gray-100);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.search-res-dropdown .search-res-item:last-child { border-bottom: none; }
.search-res-dropdown .search-res-item:hover { background: var(--blue-light); color: var(--blue); }

/* ─── RESPONSIVE HELPERS ─── */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-16 { margin-top: 16px; }
.p-24  { padding: 24px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

/* ══════════════════════════════════════
   ─── RESPONSIVE MEDIA QUERIES ───
   ══════════════════════════════════════ */

/* ─── TABLETS (up to 1024px) ─── */
@media (max-width: 1024px) {
  .dash-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: repeat(2,1fr); }
}

/* ─── SMALL TABLETS / LARGE PHONES (up to 768px) ─── */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .sidebar {
    position: fixed; left: -100%; top: 0; bottom: 0;
    transition: left .25s ease; z-index: 200;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.4); z-index: 150;
  }
  .sidebar-overlay.open { display: block; }

  .topbar { flex-wrap: wrap; height: auto; padding: 6px 12px 10px; gap: 8px; }
  .topbar-section { display: none; }
  .topbar-extra { flex: 1 1 100%; margin-left: 0; margin-top: 2px; order: 10; }
  .topbar-search { max-width: none; }
  .branch-pill { font-size: 11.5px; }
  .avatar { width: 30px; height: 30px; }

  .stat-card { min-width: calc(50% - 12px); }
  .stat-value { font-size: 22px; }

  .page-header { padding: 12px 16px 0; }
  .page-title { font-size: 18px; }
  .stat-row { padding: 12px 16px 0; }
  .filter-row { padding: 12px 16px; }
  .form-row { grid-template-columns: 1fr; padding: 12px; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }

  .dash-grid { padding: 12px 16px; }
  .chart-bars { height: 120px; }

  .modal { min-width: 0; padding: 20px; }
  .modal .grid-2 { grid-template-columns: 1fr; }

  .messages-container { right: 12px; left: 12px; }
  .toast { min-width: 0; }

  .transfer-page-grid { grid-template-columns: 1fr !important; }
}

/* ─── PHONES (up to 480px) ─── */
@media (max-width: 480px) {
  :root { --header-h: 48px; }
  .topbar { padding: 4px 8px 8px; gap: 6px; }
  .topbar-brand { font-size: 13px; }
  .topbar-search { padding: 5px 10px; }
  .branch-pill { padding: 4px 8px; font-size: 11px; }
  .avatar { width: 28px; height: 28px; font-size: 10px; }

  .stat-row { gap: 8px; }
  .stat-card { min-width: 100%; padding: 12px; }
  .stat-value { font-size: 20px; }

  .page-header { padding: 10px 12px 0; }
  .page-title { font-size: 16px; }
  .page-actions { width: 100%; }
  .stat-row { padding: 10px 12px 0; }
  .filter-row { padding: 10px 12px; flex-direction: column; align-items: stretch; }
  .filter-row .search-bar { max-width: 100%; }

  .dash-grid { padding: 10px 12px; gap: 12px; }
  .card-header { flex-direction: column; align-items: flex-start; }

  table { font-size: 12px; }
  thead th, tbody td { padding: 8px; }
  .btn { padding: 7px 12px; font-size: 12px; }
  .btn-sm { padding: 4px 8px; font-size: 11px; }

  .login-card { padding: 24px 20px; }
  .login-title { font-size: 18px; }

  .grid-4 { grid-template-columns: 1fr 1fr; }
  .product-item { flex-wrap: wrap; }

  .sidebar { width: 260px; }
  .chart-bars { height: 100px; }
  .bar { min-width: 10px; }
}

/* ─── TRANSFER PAGE FIX ─── */
#transfer-form { display: grid; grid-template-columns: 380px 1fr; }
@media (max-width: 768px) {
  #transfer-form { display: block !important; height: auto !important; }
  #transfer-form > div:first-child { border-right: none !important; border-bottom: 1px solid var(--gray-200); max-height: 45vh; }
  #transfer-form > div:last-child { overflow-y: visible; padding-top: 12px; }
}
