/* ================================================================
   IQCTH — Logistics Management System
   UI Inspired by Payflow Reference Design
   Theme: Premium Dark — Black / Dark Red / Red Accent
   ================================================================ */

:root {
  /* Brand colors */
  --black:        #0B0B0C;
  --dark-red:     #BE123C;
  --red-accent:   #E11D48;
  --red-hover:    #BE123C;
  --white:        #FFFFFF;
  --gray:         #D1D1D6;
  --gray-muted:   #8E8E93;

  /* Surface layers */
  --bg-base:      #0B0B0C;
  --bg-sidebar:   #0B0B0C;
  --bg-surface:   #141416;
  --bg-elevated:  #1C1C1E;
  --bg-hover:     #222225;
  --bg-overlay:   rgba(255, 255, 255, 0.04);

  /* Borders */
  --border:       rgba(255, 255, 255, 0.08);
  --border-md:    rgba(255, 255, 255, 0.16);
  --border-focus: rgba(225, 29, 72, 0.5);

  /* Status colors (Muted / Desaturated accents to prioritize Black/Red/White) */
  --green:        #568770;
  --green-dim:    rgba(86, 135, 112, 0.1);
  --blue:         #5C7C9E;
  --blue-dim:     rgba(92, 124, 158, 0.1);
  --yellow:       #9E865C;
  --yellow-dim:   rgba(158, 134, 92, 0.1);
  --red:          #E11D48;
  --red-dim:      rgba(225, 29, 72, 0.1);
  --purple:       #7C6C9E;
  --purple-dim:   rgba(124, 108, 158, 0.1);

  /* Fonts */
  --font-prompt:  'Prompt', 'Sarabun', sans-serif;
  --font-outfit:  'Outfit', 'Inter', sans-serif;

  /* Layout */
  --sidebar-w:    230px;
  --right-w:      300px;
  --header-h:     64px;

  /* UI */
  --radius-xs:    6px;
  --radius-sm:    12px;
  --radius:       16px;
  --radius-lg:    20px;
  --radius-xl:    24px;
  --shadow-sm:    0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow:       0 12px 40px rgba(0, 0, 0, 0.5);
  --shadow-lg:    0 16px 48px rgba(0, 0, 0, 0.6);
  --transition:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-s: all 0.2s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{scroll-behavior:smooth;-webkit-font-smoothing:antialiased}
body{
  font-family: var(--font-prompt);
  background:var(--bg-base);
  color:var(--white);
  min-height:100vh;
  font-size:13.5px;
  line-height:1.55;
}
a{color:var(--red-accent);text-decoration:none;transition:var(--transition-s)}
a:hover{color:var(--red-hover)}
button{font-family:inherit;cursor:pointer}

::-webkit-scrollbar{width:5px;height:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,.1);border-radius:10px}
::-webkit-scrollbar-thumb:hover{background:rgba(177,18,38,.5)}

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

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 1025px) {
  .sidebar {
    margin: 16px 0 16px 16px;
    height: calc(100vh - 32px);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
  .main-wrap {
    margin-left: calc(var(--sidebar-w) + 32px);
  }
  body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
    margin-left: -16px;
  }
  body.sidebar-collapsed .main-wrap {
    margin-left: 0;
  }
  body.sidebar-collapsed .mobile-menu-btn {
    display: flex !important;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    border-radius: 0;
    margin: 0;
    height: 100vh;
    border-top: none;
    border-bottom: none;
    border-left: none;
  }
  .sidebar.open {
    transform: none;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.6);
  }
  .main-wrap {
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: flex !important;
  }
  .sidebar-overlay.show {
    display: block;
  }
  .sidebar-toggle-btn {
    display: flex;
  }
  .sidebar-collapse-btn {
    display: none !important;
  }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--dark-red), var(--red-accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(177, 18, 38, 0.35);
}

.brand-text {
  display: flex; flex-direction: column;
}
.brand-text h2 {
  font-size: 15px; font-weight: 700; letter-spacing: .5px; color: var(--white); line-height: 1.2;
}
.brand-text span {
  font-size: 10px; color: var(--gray-muted); letter-spacing: .8px; text-transform: uppercase;
}

/* Sidebar collapse/toggle buttons */
.sidebar-collapse-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--gray-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-left: auto;
  transition: var(--transition-s);
}
.sidebar-collapse-btn:hover {
  background: var(--bg-hover);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-toggle-btn {
  width: 30px; height: 30px;
  border: none; background: transparent;
  color: var(--gray-muted);
  display: none;
  align-items: center; justify-content: center;
  font-size: 18px;
  margin-left: auto;
}

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

.nav-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--gray-muted);
  padding: 16px 16px 6px;
  opacity: 0.5;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--gray-muted);
  font-size: 13.5px; font-weight: 500;
  transition: var(--transition-s);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
  border: 1px solid transparent;
  margin: 2px 10px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--white);
}

.nav-item .nav-chevron {
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-item:hover .nav-chevron {
  opacity: 0.85 !important;
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(177, 18, 38, 0.22) 0%, rgba(177, 18, 38, 0.04) 100%);
  border: 1px solid rgba(177, 18, 38, 0.25);
  color: var(--white);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #B11226;
  border-radius: 0 4px 4px 0;
}

.nav-item .nav-ico {
  font-size: 16px; width: 20px; text-align: center; flex-shrink: 0;
  color: var(--gray-muted);
  transition: var(--transition-s);
}

.nav-item:hover .nav-ico, .nav-item.active .nav-ico {
  color: var(--white);
}

.nav-item .badge {
  margin-left: auto;
  font-size: 10px; font-weight: 700;
  background: var(--red-accent); color: #fff;
  padding: 1px 5px; border-radius: 8px;
  min-width: 16px; text-align: center;
}

.nav-item.disabled {
  opacity: .3; pointer-events: none;
}

.soon-tag {
  margin-left: auto;
  font-size: 9px; font-weight: 600; letter-spacing: .5px;
  color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.05);
  padding: 1px 6px; border-radius: 4px;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: var(--transition-s);
  cursor: default;
}

.profile-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.avatar {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--red-accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(225,29,72,0.25);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 15px; }
.avatar.xl { width: 48px; height: 48px; font-size: 18px; }

.profile-info { flex: 1; min-width: 0; }
.profile-info .pname { font-size: 13px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-info .prole { font-size: 10.5px; color: var(--gray-muted); margin-top: 2px; }

.logout-btn-card {
  color: var(--gray-muted);
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition-s);
  padding: 4px;
  display: flex; align-items: center; justify-content: center;
}
.logout-btn-card:hover {
  color: var(--red-accent);
  transform: scale(1.08);
}

.sidebar-logout-link {
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 8px;
  font-size: 12px;
  color: var(--gray-muted);
  transition: var(--transition-s);
  text-decoration: none;
  font-weight: 600;
}
.sidebar-logout-link:hover {
  color: var(--red-accent);
}

.role-pill {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 20px;
}
.role-pill.admin, .role-pill.owner { background: rgba(225, 29, 72, 0.15); color: #E11D48; }
.role-pill.warehouse, .role-pill.warehouse_team { background: rgba(92, 124, 158, 0.15); color: #93AECF; }
.role-pill.transport, .role-pill.zone_staff { background: rgba(158, 134, 92, 0.15); color: #C4B08C; }

/* ── Main wrapper ───────────────────────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar{
  height:var(--header-h);
  background:var(--bg-sidebar);
  border-bottom:1px solid var(--border);
  display:flex;align-items:center;
  padding:0 20px;
  gap:12px;
  position:sticky;top:0;
  z-index:100;
}

.topbar-left{display:flex;align-items:center;gap:10px;flex:1;min-width:0}

.search-box{
  display:flex;align-items:center;gap:8px;
  background:var(--bg-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:7px 12px;
  min-width:220px;max-width:340px;
  transition:var(--transition-s);
}
.search-box:focus-within{
  border-color:var(--border-focus);
  background:rgba(177,18,38,.05);
}
.search-box i{color:var(--gray-muted);font-size:13px;flex-shrink:0}
.search-box input{
  background:transparent;border:none;outline:none;
  color:var(--white);font-size:13px;width:100%;
}
.search-box input::placeholder{color:rgba(255,255,255,.25)}
.search-shortcut{
  font-size:10px;color:rgba(255,255,255,.2);
  border:1px solid rgba(255,255,255,.1);
  border-radius:4px;padding:1px 5px;
  flex-shrink:0;
}

.topbar-right{display:flex;align-items:center;gap:6px}

.icon-btn{
  width:34px;height:34px;
  border:none;background:transparent;
  border-radius:var(--radius-sm);
  color:var(--gray-muted);
  display:flex;align-items:center;justify-content:center;
  font-size:15px;
  transition:var(--transition-s);
  position:relative;
}
.icon-btn:hover{background:var(--bg-elevated);color:var(--white)}
.icon-btn .dot{
  position:absolute;top:6px;right:6px;
  width:7px;height:7px;
  background:var(--red-accent);
  border-radius:50%;
  border:1.5px solid var(--bg-sidebar);
}

.mobile-menu-btn{display:none}

/* ── Page content ───────────────────────────────────────────── */
.page-body{
  flex:1;
  padding:22px 22px;
  overflow-x:hidden;
}

/* Flash toast auto-dismiss */
.flash-bar{
  padding:10px 20px;
  border-bottom:1px solid var(--border);
}

/* ── Dashboard 3-col layout ─────────────────────────────────── */
.dash-grid{
  display:grid;
  grid-template-columns:1fr 1fr 300px;
  grid-template-rows:auto auto 1fr;
  gap:18px;
  align-items:start;
}

/* ── Hero card (like Total Balance) ─────────────────────────── */
.hero-card{
  background:linear-gradient(135deg,#1a0606 0%,#1f0a0a 40%,#140404 100%);
  border:1px solid rgba(177,18,38,.25);
  border-radius:var(--radius-lg);
  padding:22px;
  position:relative;
  overflow:hidden;
}
.hero-card::before{
  content:'';
  position:absolute;top:-40px;right:-40px;
  width:180px;height:180px;
  background:radial-gradient(circle,rgba(177,18,38,.2) 0%,transparent 70%);
  pointer-events:none;
}
.hero-card .hc-label{
  font-size:11px;font-weight:600;letter-spacing:.8px;text-transform:uppercase;
  color:rgba(255,255,255,.45);margin-bottom:4px;
}
.hero-card .hc-title{
  font-size:17px;font-weight:700;color:var(--white);margin-bottom:2px;
}
.hero-card .hc-sub{font-size:11px;color:rgba(255,255,255,.35);margin-bottom:18px}

.hc-value{
  display:flex;align-items:baseline;gap:1px;
  margin-bottom:18px;
}
.hc-value .integer{font-size:32px;font-weight:800;line-height:1}
.hc-value .decimal{font-size:20px;font-weight:700;opacity:.6}
.hc-value .currency{font-size:13px;color:var(--gray-muted);margin-right:6px;font-weight:500}

.hc-actions{display:flex;gap:10px}
.hc-btn{
  flex:1;display:flex;align-items:center;justify-content:center;gap:6px;
  padding:9px 14px;
  border-radius:var(--radius-sm);
  font-size:12.5px;font-weight:600;
  border:none;
  transition:var(--transition);
  cursor:pointer;
}
.hc-btn.primary{
  background:linear-gradient(135deg,var(--dark-red),var(--red-accent));
  color:#fff;
  box-shadow:0 4px 14px rgba(177,18,38,.4);
}
.hc-btn.primary:hover{
  background:linear-gradient(135deg,var(--red-accent),var(--red-hover));
  transform:translateY(-1px);
  box-shadow:0 6px 18px rgba(177,18,38,.5);
}
.hc-btn.ghost{
  background:rgba(255,255,255,.07);
  color:rgba(255,255,255,.7);
  border:1px solid var(--border-md);
}
.hc-btn.ghost:hover{background:rgba(255,255,255,.12);color:#fff}

/* ── Card ───────────────────────────────────────────────────── */
.card{
  background:var(--bg-surface);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  overflow:hidden;
  box-shadow:var(--shadow);
  transition:var(--transition);
}
.card:hover{
  border-color:rgba(255, 255, 255, 0.12);
  box-shadow:var(--shadow-lg);
}

.card-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:20px 24px 16px;
  border-bottom:1px solid rgba(255, 255, 255, 0.05);
}
.card-title{
  font-size:15px;font-weight:700;color:var(--white);
  display:flex;align-items:center;gap:12px;
  letter-spacing:0.3px;
}
.card-title-icon{
  width:32px;
  height:32px;
  border-radius:8px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:15px;
}
.card-title-icon.red   {background:rgba(225,29,72,.1);color:var(--red-accent)}
.card-title-icon.green {background:var(--green-dim);color:var(--green)}
.card-title-icon.blue  {background:var(--blue-dim);color:var(--blue)}
.card-title-icon.yellow{background:var(--yellow-dim);color:var(--yellow)}

.card-body{padding:24px}
.card-body.flush{padding:0}

.card-action{
  font-size:12px;color:var(--gray-muted);
  transition:var(--transition-s);
  display:flex;align-items:center;gap:4px;
}
.card-action:hover{color:var(--white)}

.card-more{
  background:transparent;border:none;
  color:var(--gray-muted);
  display:flex;align-items:center;justify-content:center;
  width:26px;height:26px;
  border-radius:6px;
  font-size:14px;
  transition:var(--transition-s);
  cursor:pointer;
}
.card-more:hover{background:var(--bg-hover);color:var(--white)}

/* ── Stat widget (right panel) ──────────────────────────────── */
.stat-widget{
  background:var(--bg-surface);
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  padding:18px 20px;
}
.sw-top{display:flex;align-items:flex-start;justify-content:space-between;margin-bottom:4px}
.sw-label{font-size:11px;font-weight:600;letter-spacing:.5px;text-transform:uppercase;color:var(--gray-muted)}
.sw-value{
  font-size:24px;font-weight:800;line-height:1.1;margin-bottom:6px;
  display:flex;align-items:baseline;gap:2px;
}
.sw-value .sm{font-size:15px;font-weight:700;opacity:.55}
.sw-change{
  display:inline-flex;align-items:center;gap:3px;
  font-size:11px;font-weight:600;
  padding:2px 8px;border-radius:20px;
}
.sw-change.up  {background:rgba(34,197,94,.15);color:var(--green)}
.sw-change.down{background:rgba(239,68,68,.15);color:var(--red)}
.sw-chart{margin-top:14px;height:60px}

/* ── Transaction / Product list rows ───────────────────────── */
.tx-list{display:flex;flex-direction:column}

.tx-row{
  display:flex;align-items:center;gap:12px;
  padding:11px 20px;
  border-bottom:1px solid var(--border);
  transition:var(--transition-s);
}
.tx-row:last-child{border-bottom:none}
.tx-row:hover{background:var(--bg-overlay)}

.tx-icon{
  width:38px;height:38px;
  border-radius:50%;
  flex-shrink:0;
  overflow:hidden;
  display:flex;align-items:center;justify-content:center;
  font-size:16px;
  background:var(--bg-elevated);
  border:1px solid var(--border);
}
.tx-icon img{width:100%;height:100%;object-fit:cover}

.tx-info{flex:1;min-width:0}
.tx-name{
  font-size:13px;font-weight:600;color:var(--white);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.tx-sub{font-size:11px;color:var(--gray-muted);margin-top:1px}

.tx-meta{text-align:right;flex-shrink:0}
.tx-amount{font-size:13px;font-weight:700;line-height:1.2}
.tx-amount.pos{color:var(--green)}
.tx-amount.neg{color:var(--red)}
.tx-amount.neu{color:var(--gray)}
.tx-date{font-size:11px;color:var(--gray-muted);margin-top:2px}

.tx-status{
  font-size:10.5px;font-weight:600;
  padding:3px 9px;border-radius:20px;
  flex-shrink:0;
}
.tx-status.active   {background:var(--green-dim);color:var(--green)}
.tx-status.inactive {background:rgba(255,255,255,.07);color:var(--gray-muted)}
.tx-status.low      {background:var(--red-dim);color:var(--red)}
.tx-status.pending  {background:var(--yellow-dim);color:var(--yellow)}
.tx-status.paid,
.tx-status.zone_assigned,
.tx-status.zone_received,
.tx-status.packing           {background:var(--blue-dim);color:var(--blue)}
.tx-status.warehouse_received {background:var(--purple-dim);color:var(--purple)}
.tx-status.shipped,
.tx-status.completed         {background:var(--green-dim);color:var(--green)}
.tx-status.cancelled         {background:var(--red-dim);color:var(--red)}

.view-all{
  display:flex;align-items:center;justify-content:center;gap:6px;
  padding:13px;
  border-top:1px solid var(--border);
  font-size:12.5px;font-weight:500;color:var(--gray-muted);
  transition:var(--transition-s);
}
.view-all:hover{color:var(--white);background:var(--bg-overlay)}

/* ── Quick Contacts / Product shortcuts ─────────────────────── */
.contacts-grid{
  display:flex;align-items:center;gap:10px;
  flex-wrap:wrap;
  padding:16px 20px;
}
.contact-item{
  display:flex;flex-direction:column;align-items:center;gap:5px;
  cursor:pointer;
}
.contact-item .avatar{
  width:40px;height:40px;font-size:14px;
  border:2px solid var(--border);
  transition:var(--transition-s);
}
.contact-item:hover .avatar{border-color:var(--red-accent)}
.contact-item span{font-size:10px;color:var(--gray-muted)}

.contact-actions{
  display:flex;gap:8px;
  padding:0 20px 16px;
}
.contact-action-btn{
  flex:1;display:flex;align-items:center;justify-content:center;gap:6px;
  padding:8px;border-radius:var(--radius-sm);
  font-size:12px;font-weight:600;
  border:1px solid var(--border);
  background:transparent;color:var(--gray);
  transition:var(--transition-s);
  cursor:pointer;
}
.contact-action-btn:hover{background:var(--bg-elevated);color:var(--white)}
.contact-action-btn.filled{
  background:linear-gradient(135deg,var(--dark-red),var(--red-accent));
  border-color:transparent;color:#fff;
}
.contact-action-btn.filled:hover{
  background:linear-gradient(135deg,var(--red-accent),var(--red-hover));
}

/* ── Exchange-style widget ──────────────────────────────────── */
.exchange-widget{
  padding:16px 20px;
  display:flex;flex-direction:column;gap:10px;
}
.ex-row{
  display:flex;align-items:center;gap:10px;
  background:var(--bg-elevated);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:10px 14px;
}
.ex-flag{
  width:22px;height:22px;border-radius:50%;
  font-size:14px;display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.ex-label{font-size:13px;font-weight:600;flex:1}
.ex-value{font-size:14px;font-weight:700;color:var(--white)}

.ex-swap{
  display:flex;align-items:center;justify-content:center;
  color:var(--gray-muted);font-size:16px;
}
.ex-rate{
  font-size:11px;color:var(--gray-muted);
  display:flex;justify-content:space-between;
}
.ex-btn{
  width:100%;padding:11px;
  background:linear-gradient(135deg,var(--dark-red),var(--red-accent));
  border:none;border-radius:var(--radius-sm);
  color:#fff;font-size:13px;font-weight:700;
  cursor:pointer;
  transition:var(--transition);
  letter-spacing:.3px;
  box-shadow:0 4px 14px rgba(177,18,38,.35);
}
.ex-btn:hover{
  background:linear-gradient(135deg,var(--red-accent),var(--red-hover));
  transform:translateY(-1px);
  box-shadow:0 6px 20px rgba(177,18,38,.5);
}

/* ── Stats row (4 small cards) ──────────────────────────────── */
.stats-row{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:14px;
  margin-bottom:18px;
}
.stat-mini{
  background:var(--bg-surface);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px 18px;
  display:flex;align-items:center;gap:14px;
  transition:var(--transition-s);
}
.stat-mini:hover{border-color:var(--border-md);background:var(--bg-elevated)}
.stat-mini-icon{
  width:40px;height:40px;
  border-radius:10px;
  display:flex;align-items:center;justify-content:center;
  font-size:18px;
  flex-shrink:0;
}
.stat-mini-icon.red    {background:rgba(177,18,38,.18);color:#ff8a95}
.stat-mini-icon.green  {background:var(--green-dim);color:var(--green)}
.stat-mini-icon.blue   {background:var(--blue-dim);color:var(--blue)}
.stat-mini-icon.yellow {background:var(--yellow-dim);color:var(--yellow)}
.stat-mini-icon.purple {background:var(--purple-dim);color:var(--purple)}

.stat-mini-body{min-width:0}
.stat-mini-val{font-size:20px;font-weight:800;line-height:1.1}
.stat-mini-lbl{font-size:11px;color:var(--gray-muted);margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* ── Page header ────────────────────────────────────────────── */
.page-head{
  display:flex;align-items:center;justify-content:space-between;
  margin-bottom:20px;
  flex-wrap:wrap;gap:12px;
}
.page-head-left h1{
  font-size:19px;font-weight:700;color:var(--white);
  display:flex;align-items:center;gap:8px;
}
.breadcrumb{
  display:flex;align-items:center;gap:5px;
  font-size:11.5px;color:var(--gray-muted);
  margin-top:3px;
}
.breadcrumb a{color:var(--gray-muted)}
.breadcrumb a:hover{color:var(--white)}
.breadcrumb .sep{opacity:.4}

/* ── Buttons ────────────────────────────────────────────────── */
.btn{
  display:inline-flex;align-items:center;justify-content:center;
  gap:8px;
  padding:10px 18px;
  border-radius:var(--radius-sm);
  font-size:13px;font-weight:700;
  border:none;cursor:pointer;
  transition:all 0.2s ease;
  white-space:nowrap;
  line-height:1.4;
  font-family:inherit;
}
.btn-primary{
  background:var(--red-accent);
  color:#fff;
  box-shadow:0 8px 24px rgba(225,29,72,.2);
}
.btn-primary:hover{
  background:var(--red-hover);
  color:#fff;
  box-shadow:0 12px 28px rgba(225,29,72,.3);
  transform:translateY(-1px);
}
.btn-primary:active{
  transform:translateY(0);
}
.btn-ghost{
  background:transparent;
  color:var(--gray-muted);
  border:1px solid rgba(255,255,255,.12);
}
.btn-ghost:hover{background:rgba(255,255,255,.05);color:var(--white);border-color:rgba(255,255,255,.2)}
.btn-danger{
  background:rgba(225,29,72,.1);
  color:var(--red-accent);
  border:1px solid rgba(225,29,72,.2);
}
.btn-danger:hover{background:rgba(225,29,72,.2)}
.btn-success{
  background:var(--green-dim);
  color:var(--green);
  border:1px solid rgba(16,185,129,.2);
}
.btn-success:hover{background:rgba(16,185,129,.2)}
.btn-sm{padding:6px 12px;font-size:12px;gap:6px}
.btn-lg{padding:14px 24px;font-size:14px}
.btn-block{width:100%;justify-content:center}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group{margin-bottom:18px}
.form-label{
  display:block;
  font-size:11px;font-weight:600;letter-spacing:.5px;text-transform:uppercase;
  color:var(--gray-muted);margin-bottom:7px;
}
.form-label .req{color:var(--red-accent);margin-left:2px}
.form-control,
.form-select,
.form-textarea{
  width:100%;
  padding:12px 14px;
  background:var(--bg-base);
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  color:var(--white);
  font-size:13px;
  font-family:inherit;
  outline:none;
  transition:all 0.2s ease;
}
.form-control::placeholder,.form-textarea::placeholder{color:var(--gray-muted);opacity:0.8}
.form-control:focus,.form-select:focus,.form-textarea:focus{
  border-color:rgba(255,255,255,.16);
  background:#121214;
  box-shadow:none;
}
.form-select{
  appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%238A8A8A'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat:no-repeat;
  background-position:right 12px center;
  background-size:18px;
  padding-right:34px;
}
.form-select option{background:var(--bg-surface);color:var(--white)}
.form-textarea{resize:vertical;min-height:90px}
.form-hint{font-size:11px;color:var(--gray-muted);margin-top:4px}
.form-error{font-size:11.5px;color:var(--red);margin-top:4px}

.input-prefix-wrap{display:flex}
.input-prefix{
  padding:0 11px;
  background:var(--bg-surface);
  border:1px solid var(--border);
  border-right:none;
  border-radius:var(--radius-sm) 0 0 var(--radius-sm);
  color:var(--gray-muted);
  font-size:13px;
  display:flex;align-items:center;
}
.input-prefix + .form-control{border-radius:0 var(--radius-sm) var(--radius-sm) 0}

/* ── Upload zone ────────────────────────────────────────────── */
.upload-zone{
  border:1.5px dashed var(--border-md);
  border-radius:var(--radius);
  padding:28px 20px;
  text-align:center;
  cursor:pointer;
  transition:var(--transition-s);
  position:relative;
}
.upload-zone:hover,.upload-zone.drag{
  border-color:var(--border-focus);
  background:rgba(177,18,38,.04);
}
.upload-zone input[type=file]{
  position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%;
}
.upload-preview{
  width:110px;height:110px;
  border-radius:var(--radius);
  object-fit:cover;
  border:1.5px solid var(--border);
  display:none;margin:0 auto 12px;
}
.upload-preview.show{display:block}

/* ── Table ──────────────────────────────────────────────────── */
.tbl-wrap{overflow-x:auto}
.data-tbl{width:100%;border-collapse:collapse}
.data-tbl th{
  padding:14px 18px;
  font-size:11px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;
  color:var(--gray-muted);
  border-bottom:1px solid rgba(255, 255, 255, 0.06);
  white-space:nowrap;
  text-align:left;
}
.data-tbl td{
  padding:16px 18px;
  border-bottom:1px solid rgba(255, 255, 255, 0.06);
  vertical-align:middle;
  font-size:13px;
  color:var(--white);
  transition:background 0.15s ease;
}
.data-tbl tbody tr:last-child td{border-bottom:none}
.data-tbl tbody tr:hover td{background:rgba(255,255,255,0.02)}

.thumb{
  width:40px;height:40px;
  border-radius:9px;
  object-fit:cover;
  border:1px solid var(--border);
}
.thumb-ph{
  width:40px;height:40px;
  border-radius:9px;
  background:var(--bg-elevated);
  border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center;
  font-size:16px;color:rgba(255,255,255,.2);
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge{
  display:inline-flex;align-items:center;gap:3px;
  padding:3px 9px;border-radius:20px;
  font-size:11px;font-weight:600;letter-spacing:.2px;
}
.badge-active   {background:var(--green-dim);color:var(--green)}
.badge-inactive {background:rgba(255,255,255,.07);color:var(--gray-muted)}
.badge-low      {background:var(--red-dim);color:var(--red)}
.badge-pending  {background:var(--yellow-dim);color:var(--yellow)}
.badge-processing {background:var(--blue-dim);color:var(--blue)}
.badge-admin, .badge-owner {background:rgba(225, 29, 72, 0.15);color:#E11D48}
.badge-warehouse, .badge-warehouse_team {background:rgba(92, 124, 158, 0.15);color:#93AECF}
.badge-transport, .badge-zone_staff {background:rgba(158, 134, 92, 0.15);color:#C4B08C}
.badge-customer {background:rgba(124, 108, 158, 0.15);color:#7C6C9E}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert{
  padding:11px 16px;
  border-radius:var(--radius-sm);
  font-size:13px;
  display:flex;align-items:flex-start;gap:9px;
  margin-bottom:16px;
}
.alert-success{background:rgba(34,197,94,.1);border:1px solid rgba(34,197,94,.2);color:var(--green)}
.alert-danger {background:rgba(239,68,68,.1);border:1px solid rgba(239,68,68,.2);color:var(--red)}
.alert-warning{background:rgba(245,158,11,.1);border:1px solid rgba(245,158,11,.2);color:var(--yellow)}
.alert-info   {background:rgba(59,130,246,.1);border:1px solid rgba(59,130,246,.2);color:var(--blue)}

/* ── Pagination ─────────────────────────────────────────────── */
.pager{
  display:flex;align-items:center;justify-content:center;gap:4px;
  padding:14px 0;flex-wrap:wrap;
}
.pager-link{
  display:inline-flex;align-items:center;justify-content:center;
  width:32px;height:32px;border-radius:var(--radius-xs);
  background:transparent;border:1px solid var(--border);
  color:var(--gray-muted);font-size:13px;
  transition:var(--transition-s);
}
.pager-link:hover{background:var(--bg-elevated);border-color:var(--border-md);color:var(--white)}
.pager-link.active{
  background:linear-gradient(135deg,var(--dark-red),var(--red-accent));
  border-color:transparent;color:#fff;
}
.pager-link.disabled{opacity:.35;pointer-events:none}

/* ── Toggle ─────────────────────────────────────────────────── */
.toggle{position:relative;display:inline-block;width:38px;height:21px}
.toggle input{opacity:0;width:0;height:0}
.toggle-track{
  position:absolute;inset:0;
  background:rgba(255,255,255,.1);
  border-radius:21px;
  cursor:pointer;
  transition:.25s;
}
.toggle-track::before{
  content:'';position:absolute;
  width:15px;height:15px;
  left:3px;bottom:3px;
  background:var(--gray-muted);
  border-radius:50%;
  transition:.25s;
}
.toggle input:checked + .toggle-track{background:rgba(34,197,94,.4)}
.toggle input:checked + .toggle-track::before{transform:translateX(17px);background:var(--green)}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-bg{
  position:fixed;inset:0;
  background:rgba(0,0,0,.75);
  z-index:1000;
  display:none;align-items:center;justify-content:center;
  padding:16px;
  backdrop-filter:blur(3px);
}
.modal-bg.show{display:flex}
.modal-box{
  background:var(--bg-surface);
  border:1px solid var(--border-md);
  border-radius:var(--radius-xl);
  width:100%;max-width:480px;
  box-shadow:var(--shadow-lg);
  animation:modal-in .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes modal-in{from{opacity:0;transform:scale(.94) translateY(-14px)}to{opacity:1;transform:none}}
.modal-head{padding:18px 22px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between}
.modal-head h4{font-size:15px;font-weight:700}
.modal-close{background:none;border:none;color:var(--gray-muted);font-size:18px;cursor:pointer;transition:var(--transition-s);width:28px;height:28px;border-radius:6px;display:flex;align-items:center;justify-content:center}
.modal-close:hover{background:var(--bg-hover);color:var(--white)}
.modal-body{padding:20px 22px}
.modal-foot{padding:14px 22px;border-top:1px solid var(--border);display:flex;gap:8px;justify-content:flex-end}

/* ── Toast container ────────────────────────────────────────── */
.toast-wrap{
  position:fixed;top:18px;right:18px;
  z-index:9999;
  display:flex;flex-direction:column;gap:8px;
  max-width:340px;width:calc(100% - 36px);
}
.toast{
  padding:12px 16px;border-radius:var(--radius-sm);
  font-size:13px;display:flex;align-items:center;gap:9px;
  box-shadow:var(--shadow);
  animation:toast-in .28s ease;
}
@keyframes toast-in{from{opacity:0;transform:translateX(80px)}to{opacity:1;transform:none}}
.toast-success{background:#14532d;border-left:3px solid var(--green);color:#bbf7d0}
.toast-danger {background:#7f1d1d;border-left:3px solid var(--red);color:#fecaca}
.toast-warning{background:#78350f;border-left:3px solid var(--yellow);color:#fef3c7}

/* ── Auth ───────────────────────────────────────────────────── */
.auth-wrap{
  min-height:100vh;
  display:flex;align-items:center;justify-content:center;
  background:
    radial-gradient(ellipse at 15% 60%,rgba(139,0,0,.2) 0%,transparent 55%),
    radial-gradient(ellipse at 85% 20%,rgba(177,18,38,.12) 0%,transparent 50%),
    var(--bg-base);
  padding:24px;
}
.auth-card{
  background:var(--bg-surface);
  border:1px solid var(--border-md);
  border-radius:var(--radius-xl);
  padding:44px 40px;
  width:100%;max-width:400px;
  box-shadow:var(--shadow-lg);
  position:relative;overflow:hidden;
}
.auth-card::after{
  content:'🚚';
  position:absolute;right:-20px;bottom:-20px;
  font-size:100px;opacity:.03;pointer-events:none;
}
.auth-logo{text-align:center;margin-bottom:32px}
.auth-logo .logo-wrap{
  display:inline-flex;align-items:center;justify-content:center;
  width:58px;height:58px;
  background:linear-gradient(135deg,var(--dark-red),var(--red-accent));
  border-radius:16px;
  margin-bottom:14px;
  font-size:26px;
  box-shadow:0 8px 24px rgba(177,18,38,.4);
}
.auth-logo h1{font-size:20px;font-weight:800;letter-spacing:2px}
.auth-logo p{font-size:11px;color:var(--gray-muted);letter-spacing:1px;text-transform:uppercase;margin-top:3px}

/* ── Sidebar overlay ────────────────────────────────────────── */
.sidebar-overlay{
  display:none;
  position:fixed;inset:0;background:rgba(0,0,0,.6);z-index:199;
}
.sidebar-overlay.show{display:block}

/* ── Grid helpers ───────────────────────────────────────────── */
.g2{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.g3{display:grid;grid-template-columns:1fr 1fr 1fr;gap:18px}
.flex-gap{display:flex;gap:8px;flex-wrap:wrap}

/* ── Misc ───────────────────────────────────────────────────── */
.empty{text-align:center;padding:44px 20px;color:var(--gray-muted)}
.empty .ei{font-size:42px;margin-bottom:12px;opacity:.4}
.empty h3{font-size:15px;color:rgba(255,255,255,.6);margin-bottom:6px;font-weight:600}
.empty p{font-size:12.5px}

.divider{border:none;border-top:1px solid var(--border);margin:18px 0}
code{background:rgba(255,255,255,.06);padding:2px 7px;border-radius:5px;font-size:12px;color:var(--gray-muted)}

.section-label{
  font-size:10px;font-weight:700;letter-spacing:1.2px;text-transform:uppercase;
  color:rgba(255,255,255,.25);margin-bottom:12px;margin-top:4px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media(max-width:1100px){
  .dash-grid{grid-template-columns:1fr 1fr;grid-template-rows:auto}
  .dash-right{grid-column:1/-1;display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}
}
@media(max-width:900px){
  .stats-row{grid-template-columns:1fr 1fr}
  .g3{grid-template-columns:1fr 1fr}
}
@media(max-width:768px){
  .sidebar{transform:translateX(-100%)}
  .sidebar.open{transform:none;box-shadow:4px 0 24px rgba(0,0,0,.6)}
  .main-wrap{margin-left:0}
  .mobile-menu-btn{display:flex}
  .sidebar-overlay.show{display:block}
  .sidebar-toggle-btn{display:flex}
  .page-body{padding:16px}
  .dash-grid{grid-template-columns:1fr}
  .stats-row{grid-template-columns:1fr 1fr}
  .g2,.g3{grid-template-columns:1fr}
  .auth-card{padding:32px 24px}
  .search-box{min-width:140px}
}
@media(max-width:480px){
  .stats-row{grid-template-columns:1fr}
  .hc-actions{flex-direction:column}
}

/* ── Bootstrap helper classes mapping ───────────────────────── */
.text-end { text-align: right !important; }
.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.fw-bold { font-weight: 700 !important; }
.text-muted { color: var(--gray-muted) !important; }
.text-success { color: var(--green) !important; }
.text-warning { color: var(--yellow) !important; }
.text-danger { color: var(--red) !important; }
.text-white { color: var(--white) !important; }
.h-100 { height: 100% !important; }
.w-100 { width: 100% !important; }
.mb-1 { margin-bottom: 4px !important; }
.mb-2 { margin-bottom: 8px !important; }
.mb-3 { margin-bottom: 12px !important; }
.mb-4 { margin-bottom: 16px !important; }

/* Custom utility classes */
.hidden-block {
  display: none !important;
}

/* Modal Backdrop Styles */
.custom-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.custom-modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: 20px;
  width: 90%;
  max-width: 580px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEntrance 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalEntrance {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.custom-modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.custom-modal-close {
  background: transparent;
  border: none;
  color: var(--gray-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
}
.custom-modal-close:hover {
  color: #fff;
}

.custom-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 70vh;
}

.custom-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(255, 255, 255, 0.01);
}

