/* ═══════════════════════════════════════════════════════
   CHORNOMORKA OPERATIONS — Design System
   ═══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand */
  --navy-900: #0f1f4a;
  --navy-800: #1a2f6e;
  --navy-700: #1e3a8a;
  --navy-600: #2d4a9e;
  --navy-200: #bfcdf0;
  --navy-100: #eff6ff;
  --navy-50:  #f0f5ff;

  /* Neutrals */
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50:  #f8fafc;
  --white:    #ffffff;

  /* Status */
  --pending-bg:   #fef3c7; --pending-text:   #92400e; --pending-border: #fcd34d; --pending-dot:   #f59e0b;
  --approved-bg:  #dbeafe; --approved-text:  #1e40af; --approved-border:#93c5fd; --approved-dot:  #3b82f6;
  --delivered-bg: #dcfce7; --delivered-text: #166534; --delivered-border:#86efac;--delivered-dot: #22c55e;
  --cancelled-bg: #fee2e2; --cancelled-text: #991b1b; --cancelled-border:#fca5a5;--cancelled-dot: #ef4444;
  --preparing-bg: #ede9fe; --preparing-text: #6b21a8; --preparing-border:#c4b5fd;--preparing-dot: #8b5cf6;
  --shipped-bg:   #e0f2fe; --shipped-text:   #0369a1; --shipped-border:  #7dd3fc; --shipped-dot:   #0ea5e9;
  --issue-bg:     #ffedd5; --issue-text:     #c2410c; --issue-border:    #fb923c; --issue-dot:     #f97316;
  --resolved-bg:  #d1fae5; --resolved-text: #065f46; --resolved-border: #6ee7b7; --resolved-dot:  #10b981;

  /* Stock */
  --instock-bg:   #ecfdf5; --instock-text:   #065f46; --instock-dot:   #10b981;
  --lowstock-bg:  #fffbeb; --lowstock-text:  #92400e; --lowstock-dot:   #f59e0b;
  --outstock-bg:  #f1f5f9; --outstock-text:  #64748b; --outstock-dot:   #94a3b8;

  /* Semantic */
  --danger:  #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --info:    #3b82f6;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h:  64px;
  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 2px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

/* ── Base ── */
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

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

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-800) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.logo-text-top {
  font-size: 11px; font-weight: 800;
  letter-spacing: .18em; color: rgba(255,255,255,.9);
  line-height: 1;
}
.logo-text-sub {
  font-size: 9px; font-weight: 600;
  letter-spacing: .2em; color: rgba(255,255,255,.35);
  margin-top: 2px;
}

/* Restaurant selector */
.sidebar-restaurant {
  margin: 14px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  transition: background .15s;
}
.sidebar-restaurant:hover { background: rgba(255,255,255,.1); }
.rest-name { font-size: 12px; font-weight: 600; color: #fff; line-height: 1.3; }

/* Nav */
.sidebar-nav { padding: 8px 12px; flex: 1; overflow-y: auto; }
.nav-section-label {
  font-size: 9px; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase;
  color: rgba(255,255,255,.25);
  padding: 12px 8px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.55);
  font-size: 13px; font-weight: 500;
  transition: background .12s, color .12s;
  position: relative;
  border: none; background: none; width: 100%; text-align: left;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); }
.nav-item.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  background: #60a5fa;
  border-radius: 0 3px 3px 0;
}
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; }
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }
.nav-badge {
  margin-left: auto;
  background: #f97316;
  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 5px;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s;
}
.sidebar-user:hover { background: rgba(255,255,255,.06); }
.user-avatar-sm {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--navy-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.user-name-sm { font-size: 12px; font-weight: 600; color: rgba(255,255,255,.8); }
.user-role-sm { font-size: 10px; color: rgba(255,255,255,.35); }
.sidebar-version { font-size: 10px; color: rgba(255,255,255,.2); text-align: center; margin-top: 8px; }

/* ══════════════════════════════════════
   MAIN AREA
══════════════════════════════════════ */
.main-area {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
}
.topbar-breadcrumb {
  flex: 1;
}
.topbar-page { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.topbar-sub  { font-size: 12px; color: var(--gray-400); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  position: relative;
  transition: background .12s, border-color .12s;
}
.topbar-btn:hover { background: var(--gray-50); border-color: var(--gray-300); color: var(--gray-700); }
.topbar-notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: #f97316;
  border-radius: 50%;
  border: 2px solid #fff;
}

/* Page content */
.page-content {
  flex: 1;
  min-width: 0;
  padding: 28px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.card-header {
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.card-subtitle { font-size: 12px; color: var(--gray-400); margin-top: 1px; }
.card-body { padding: 20px; }

/* ══════════════════════════════════════
   STAT CARDS
══════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.stat-icon-wrap {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon-wrap.green  { background: #f0fdf4; color: #22c55e; }
.stat-icon-wrap.amber  { background: #fffbeb; color: #f59e0b; }
.stat-icon-wrap.purple { background: #faf5ff; color: #8b5cf6; }
.stat-icon-wrap.navy   { background: var(--navy-50); color: var(--navy-700); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-delta { font-size: 11px; font-weight: 600; color: var(--gray-400); margin-top: 2px; }
.stat-delta.up   { color: #16a34a; }
.stat-delta.down { color: var(--danger); }

/* ══════════════════════════════════════
   HERO BANNER (Dashboard)
══════════════════════════════════════ */
.hero-banner {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-700) 100%);
  border-radius: var(--radius-xl);
  padding: 28px 32px;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 80px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,255,255,.03);
}
.hero-left { z-index: 1; }
.hero-greeting { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.5); margin-bottom: 4px; }
.hero-name { font-size: 24px; font-weight: 800; color: #fff; line-height: 1.2; }
.hero-role { font-size: 13px; color: rgba(255,255,255,.45); margin-top: 4px; }
.hero-right { z-index: 1; display: flex; gap: 32px; }
.hero-stat { text-align: center; }
.hero-stat-val { font-size: 32px; font-weight: 800; color: #fff; line-height: 1; }
.hero-stat-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.4); letter-spacing: .1em; text-transform: uppercase; margin-top: 4px; white-space: nowrap; }
.hero-divider { width: 1px; background: rgba(255,255,255,.1); }


/* ══════════════════════════════════════
   QUICK ACTIONS
══════════════════════════════════════ */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.qa-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s, border-color .15s;
  text-align: left;
}
.qa-card:hover { box-shadow: var(--shadow); border-color: var(--gray-300); transform: translateY(-1px); }
.qa-card.primary {
  background: linear-gradient(135deg, var(--navy-800), var(--navy-700));
  border-color: transparent;
}
.qa-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  background: var(--gray-100);
  color: var(--gray-600);
}
.qa-card.primary .qa-icon { background: rgba(255,255,255,.15); color: #fff; }
.qa-label { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.qa-card.primary .qa-label { color: #fff; }
.qa-sub { font-size: 11px; color: var(--gray-400); }
.qa-card.primary .qa-sub { color: rgba(255,255,255,.5); }

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--gray-400);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
  font-size: 13px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--gray-50); }

/* Cell helpers */
.cell-primary { font-weight: 600; color: var(--gray-900); }
.cell-secondary { font-size: 11px; color: var(--gray-400); margin-top: 1px; }
.entity-cell { display: flex; align-items: center; gap: 10px; }
.entity-avatar {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--navy-50);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--navy-700);
  flex-shrink: 0;
}

/* ══════════════════════════════════════
   STATUS BADGES
══════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
  border: 1px solid;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.badge-pending   { background:var(--pending-bg);   color:var(--pending-text);   border-color:var(--pending-border); }
.badge-pending   .badge-dot { background: var(--pending-dot); }
.badge-approved  { background:var(--approved-bg);  color:var(--approved-text);  border-color:var(--approved-border); }
.badge-approved  .badge-dot { background: var(--approved-dot); }
.badge-delivered { background:var(--delivered-bg); color:var(--delivered-text); border-color:var(--delivered-border); }
.badge-delivered .badge-dot { background: var(--delivered-dot); }
.badge-cancelled { background:var(--cancelled-bg); color:var(--cancelled-text); border-color:var(--cancelled-border); }
.badge-cancelled .badge-dot { background: var(--cancelled-dot); }
.badge-preparing { background:var(--preparing-bg); color:var(--preparing-text); border-color:var(--preparing-border); }
.badge-preparing .badge-dot { background: var(--preparing-dot); }
.badge-shipped   { background:var(--shipped-bg);   color:var(--shipped-text);   border-color:var(--shipped-border); }
.badge-shipped   .badge-dot { background: var(--shipped-dot); }
.badge-issue     { background:var(--issue-bg);     color:var(--issue-text);     border-color:var(--issue-border); }
.badge-issue     .badge-dot { background: var(--issue-dot); }
.badge-resolved  { background:var(--resolved-bg);  color:var(--resolved-text);  border-color:var(--resolved-border); }
.badge-resolved  .badge-dot { background: var(--resolved-dot); }

.badge-instock  { background:var(--instock-bg);  color:var(--instock-text);  border-color: #a7f3d0; }
.badge-instock  .badge-dot { background: var(--instock-dot); }
.badge-lowstock { background:var(--lowstock-bg); color:var(--lowstock-text); border-color: var(--pending-border); }
.badge-lowstock .badge-dot { background: var(--lowstock-dot); }
.badge-outstock { background:var(--outstock-bg); color:var(--outstock-text); border-color: var(--gray-200); }
.badge-outstock .badge-dot { background: var(--outstock-dot); }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background .12s, opacity .12s, box-shadow .12s;
  white-space: nowrap;
  line-height: 1;
}
.btn:active { opacity: .88; }

.btn-primary { background: var(--navy-700); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }

.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }

.btn-ghost { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover { background: var(--gray-50); border-color: var(--gray-300); }

.btn-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

.btn-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.btn-success:hover { background: #dcfce7; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; border-radius: var(--radius); }
.btn-icon { padding: 8px; }

/* ══════════════════════════════════════
   INPUTS
══════════════════════════════════════ */
.input-wrap {
  position: relative;
  display: flex; align-items: center;
}
.input-icon {
  position: absolute; left: 10px;
  color: var(--gray-400);
  pointer-events: none;
  display: flex;
}
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--gray-900);
  background: var(--white);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(30,58,138,.08); }
.input-with-icon { padding-left: 34px; }
.input::placeholder { color: var(--gray-400); }

/* ══════════════════════════════════════
   TOOLBAR (search + filters row)
══════════════════════════════════════ */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.toolbar-search { flex: 1; max-width: 320px; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

/* Filter chips */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  transition: all .12s;
}
.chip:hover { border-color: var(--navy-700); color: var(--navy-700); }
.chip.active { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }

/* ══════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════ */
.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--gray-400);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ══════════════════════════════════════
   PAGINATION
══════════════════════════════════════ */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100);
  font-size: 12px; color: var(--gray-400);
}
.page-btns { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  font-size: 12px; font-weight: 600;
  color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .12s;
}
.page-btn:hover { border-color: var(--navy-700); color: var(--navy-700); }
.page-btn.active { background: var(--navy-700); border-color: var(--navy-700); color: #fff; }

/* ══════════════════════════════════════
   TIMELINE
══════════════════════════════════════ */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 14px; }
.timeline-left { display: flex; flex-direction: column; align-items: center; }
.timeline-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 12px; font-weight: 700;
}
.timeline-dot.done { background: var(--navy-700); color: #fff; }
.timeline-dot.pending { background: var(--gray-100); color: var(--gray-400); border: 1px solid var(--gray-200); }
.timeline-line {
  width: 2px; flex: 1; min-height: 20px; margin: 4px 0;
  background: var(--gray-200);
}
.timeline-line.done { background: #bfdbfe; }
.timeline-content { padding-bottom: 20px; }
.timeline-label { font-size: 13px; font-weight: 600; }
.timeline-label.done { color: var(--gray-800); }
.timeline-label.pending { color: var(--gray-400); }
.timeline-time { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ══════════════════════════════════════
   PRODUCT CARD (catalog)
══════════════════════════════════════ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .15s, transform .1s;
}
.product-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.product-card.out-of-stock { opacity: .6; }
.product-img-wrap { position: relative; height: 140px; background: var(--gray-100); overflow: hidden; }
.product-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.product-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px;
}
.product-stock-badge {
  position: absolute; top: 8px; left: 8px;
}
.product-body { padding: 12px 14px; }
.product-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--gray-400); margin-bottom: 2px; }
.product-name { font-size: 13px; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.product-pkg  { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.product-origin { font-size: 10px; color: var(--gray-400); margin-top: 1px; }
.product-footer {
  padding: 10px 14px 14px;
  display: flex; align-items: center; justify-content: space-between;
}
.product-price { font-size: 15px; font-weight: 800; color: var(--gray-900); }
.product-unit  { font-size: 10px; color: var(--gray-400); font-weight: 500; }

/* Qty control */
.qty-control {
  display: flex; align-items: center; gap: 8px;
}
.qty-btn {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .12s;
}
.qty-btn.minus { background: var(--gray-100); color: var(--gray-700); }
.qty-btn.minus:hover { background: var(--gray-200); }
.qty-btn.plus  { background: var(--navy-700); color: #fff; }
.qty-btn.plus:hover { background: var(--navy-800); }
.qty-val { font-size: 14px; font-weight: 700; color: var(--navy-700); min-width: 24px; text-align: center; }

/* ══════════════════════════════════════
   CART DRAWER
══════════════════════════════════════ */
.cart-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 300;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.cart-overlay.open { opacity: 1; pointer-events: all; }
.cart-drawer {
  position: fixed; top: 0; right: 0;
  width: 420px; height: 100dvh;
  background: var(--white);
  box-shadow: var(--shadow-lg);
  z-index: 301;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  touch-action: pan-y;
}
.cart-drawer.open { transform: translateX(0); }
.cart-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.cart-title { font-size: 16px; font-weight: 700; }
.cart-items { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 0; }
.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.cart-item-img {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--gray-100);
  flex-shrink: 0;
}
.cart-item-name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.cart-item-pkg  { font-size: 11px; color: var(--gray-400); }
.cart-footer {
  padding: 20px 24px;
  border-top: 1px solid var(--gray-200);
}
.cart-total-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.cart-total-label { font-size: 13px; color: var(--gray-500); }
.cart-total-val   { font-size: 20px; font-weight: 800; color: var(--gray-900); }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
/* Chat modal — desktop: bottom-right corner */
#chat-modal { align-items: flex-end; justify-content: flex-end; padding: 0 24px 24px 0; background: rgba(0,0,0,.3); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 520px;
  max-width: calc(100vw - 40px);
  max-height: calc(100dvh - 80px);
  display: flex; flex-direction: column;
  transform: scale(.96) translateY(8px);
  transition: transform .2s;
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

@media(max-width:640px) {
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
    margin: 0;
    transform: translateY(24px);
  }
  .modal-overlay:not(#chat-modal).open .modal { transform: translateY(0); }
  /* handle drag indicator */
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }
  .modal-footer { flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; justify-content: center; }
}

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400); flex-shrink: 0;
  transition: background .12s, color .12s;
}
.modal-close:hover { background: var(--gray-100); color: var(--gray-700); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ══════════════════════════════════════
   NOTIFICATION ITEM
══════════════════════════════════════ */
.notif-item {
  display: flex; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  transition: background .12s;
  cursor: pointer;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--navy-50); }
.notif-icon-wrap {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-title { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.notif-body  { font-size: 12px; color: var(--gray-500); margin-top: 2px; line-height: 1.5; }
.notif-time  { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.unread-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--navy-700); flex-shrink: 0; margin-top: 4px; }

/* ══════════════════════════════════════
   ALERT BANNER
══════════════════════════════════════ */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 20px;
}
.alert-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-info    { background: var(--navy-50); border: 1px solid #bfdbfe; color: var(--navy-700); }

/* ══════════════════════════════════════
   PAGE LAYOUT HELPERS
══════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.grid-cols-7-3 { display: grid; grid-template-columns: 7fr 3fr; gap: 20px; }

.section-title {
  font-size: 13px; font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}

.divider { height: 1px; background: var(--gray-100); margin: 20px 0; }


/* ══════════════════════════════════════
   ICONS (inline SVG helper)
══════════════════════════════════════ */
.icon { display: inline-block; vertical-align: middle; }

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

/* ══════════════════════════════════════
   UTILITIES
══════════════════════════════════════ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--gray-400); font-size: 12px; }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* Mobile filter buttons (shared: catalog + orders) */
.mob-filter-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 8px;
  border-radius: 10px;
  border: 1.5px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 13px; font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  transition: border-color .12s, color .12s, background .12s;
  white-space: nowrap;
}
.mob-filter-btn.active {
  border-color: var(--navy-700);
  color: var(--navy-700);
  background: var(--navy-50, #eef1f8);
}

/* ══════════════════════════════════════
   MOBILE — bottom nav bar
══════════════════════════════════════ */
.mob-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  z-index: 400;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -2px 12px rgba(0,0,0,.07);
}
.mob-nav-item {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  color: var(--gray-400);
  font-size: 9px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer;
  border: none; background: none;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  transition: color .12s;
  padding: 6px 0;
}
.mob-nav-item.active { color: var(--navy-700); }
.mob-nav-item svg { width: 22px; height: 22px; }
.mob-nav-badge {
  position: absolute; top: 4px; right: calc(50% - 18px);
  background: #f97316; color: #fff;
  font-size: 9px; font-weight: 800;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 1.5px solid #fff;
}

/* Chat button in topbar — desktop: hidden, mobile: shown via @media below */
.mob-chat-topbar-btn { display: none; }

/* Hamburger (mobile topbar) */
.mob-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--gray-600);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Sidebar backdrop (mobile) */
.mob-sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 499;
}
.mob-sidebar-backdrop.open { display: block; }

/* ══════════════════════════════════════
   RESPONSIVE ≤ 640px
══════════════════════════════════════ */
@media (max-width: 640px) {

  /* Show mobile chrome */
  .mob-nav { display: flex; }
  .mob-hamburger { display: flex; }

  /* Sidebar → slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    z-index: 500;
    height: 100dvh;
  }
  .sidebar.mob-open { transform: translateX(0); }

  /* Main area full-width */
  .main-area { margin-left: 0; }

  /* Topbar — fixed on mobile so it stays visible while scrolling */
  .topbar {
    position: fixed; top: 0; left: 0; right: 0;
    padding: 0 14px; gap: 10px;
    z-index: 200;
  }
.topbar-actions { display: flex; gap: 6px; }
  .topbar-actions > *:not(.mob-notif-topbar-btn) { display: none !important; }

  /* Feedback card */
  #feedback-default { flex-direction: column; align-items: flex-start !important; gap: 12px !important; }
  #feedback-default > div:last-child { width: 100%; }
  #feedback-default button { width: 100%; justify-content: center; }

  /* Page content — push down for fixed topbar + extra bottom for mob nav */
  .page-content { padding: calc(16px + 64px) 14px calc(80px + env(safe-area-inset-bottom, 0px)); }

  /* Hero banner */
  .hero-banner {
    padding: 18px 16px;
    flex-direction: column;
    gap: 14px;
  }
  .hero-right { gap: 20px; justify-content: flex-start; }
  .hero-stat-val { font-size: 26px; }

  /* Grids */
  .stat-grid            { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .quick-actions-grid   { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .grid-2               { grid-template-columns: 1fr; gap: 12px; }
  .grid-3               { grid-template-columns: 1fr; gap: 12px; }
  .grid-cols-7-3        { grid-template-columns: 1fr; gap: 12px; }

  /* Stat cards */
  .stat-card { padding: 14px 12px; gap: 8px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 10px; }

  /* Cards */
  .card-header { padding: 14px 14px; flex-wrap: wrap; }
  .card-body   { padding: 14px; }

  /* Product grid → 2 cols */
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-img-wrap { height: 110px; }
  .product-body { padding: 10px 10px 6px; }
  .product-footer { padding: 8px 10px 12px; }
  .product-name { font-size: 12px; }
  .product-price { font-size: 14px; }

  /* Tables — scrollable */
  .card { overflow-x: auto; }
  .data-table { font-size: 12px; min-width: 480px; }
  .data-table th, .data-table td { padding: 10px 12px; white-space: nowrap; }

  /* Orders table — compact on mobile, no horizontal scroll */
  #orders-table { min-width: 0 !important; table-layout: fixed !important; width: 100% !important; }
  #orders-table th, #orders-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 10px 8px; }
  #orders-table th:nth-child(1), #orders-table td:nth-child(1) { width: 72px; }
  #orders-table th:nth-child(2), #orders-table td:nth-child(2) { width: 105px; }
  #orders-table th:nth-child(3), #orders-table td:nth-child(3) { width: auto; }
  #orders-table th:nth-child(6), #orders-table td:nth-child(6) { width: 80px; font-size: 11px; }
  #orders-table th:nth-child(8), #orders-table td:nth-child(8) { width: 44px; }

  /* Toolbar */
  .toolbar { padding: 10px 12px; flex-wrap: wrap; }
  .toolbar-search { max-width: 100%; order: -1; flex: 1 1 100%; }
  .toolbar-right { margin-left: 0; }

  /* Inputs → 16px prevents iOS auto-zoom (applies globally) */
  input, textarea, select { font-size: 16px !important; }
  .input { font-size: 16px; padding: 11px 14px; }
  .input-with-icon { padding-left: 38px; }
  textarea.input { font-size: 16px; }

  /* Buttons — bigger touch targets */
  .btn    { min-height: 42px; }
  .btn-sm { min-height: 34px; }
  .btn-lg { min-height: 52px; font-size: 15px; }
  .btn-icon { min-height: 40px; width: 40px; }

  /* Qty control — bigger */
  .qty-btn { width: 34px; height: 34px; border-radius: 9px; }
  .qty-val  { font-size: 15px; }

  /* Cart drawer → bottom sheet on mobile */
  .cart-overlay { z-index: 410; }
  .cart-drawer {
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    top: 0 !important;
    bottom: 0 !important;
    border-radius: 0 !important;
    transform: translateY(100%) !important;
    z-index: 411;
  }
  .cart-drawer.open { transform: translateY(0) !important; }
  .cart-item { padding: 10px 16px; }
  .cart-header { padding: 14px 16px; }
  .cart-footer { padding: 12px 16px; }

  /* Modals → bottom sheet */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    max-height: 92dvh;
    margin: 0;
  }
  .modal-header {
    padding: 16px 20px;
  }
  .modal-close,
  .modal-header .btn-icon {
    width: 32px !important; height: 32px !important;
    background: var(--gray-100) !important;
    border-radius: 8px !important;
    color: var(--gray-500) !important;
    border: none !important;
    box-shadow: none !important;
  }
  .modal-body { padding-top: 28px; }
  .modal-body { padding: 0 20px 8px; }
  .modal-footer { padding: 12px 20px 24px; }

  /* Chat modal — full-screen bottom sheet on mobile */
  #chat-modal {
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 0 !important;
  }
  #chat-modal .chat-modal-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    background: var(--navy-900) !important;
    overflow: hidden !important;
    transform: translateY(100%) !important;
    transition: transform .3s cubic-bezier(.4,0,.2,1) !important;
  }
  #chat-modal.open .chat-modal-box {
    transform: translateY(0) !important;
  }
  #chat-modal .chat-modal-box::before { display: none !important; }
  #chat-screen-list, #chat-screen-chat { flex: 1; min-height: 0; background: var(--white); }
  #chat-screen-list > div:first-child, #chat-screen-chat > div:first-child { background: linear-gradient(135deg,var(--navy-900),var(--navy-700)) !important; }
  #chat-messages-list { flex: 1; min-height: 0; max-height: unset; }

  /* Feedback modal — bottom sheet */
  #feedback-modal {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
  }
  #feedback-modal .modal {
    border-radius: 20px 20px 0 0 !important;
    max-height: 92dvh !important;
    margin: 0 !important;
  }

  /* Chat FAB — hidden on mobile (chat moved to topbar) */
  #chat-fab { display: none !important; }

  /* Chat + Notif buttons in topbar — show on mobile only */
  .mob-chat-topbar-btn { display: flex !important; }
  .mob-notif-topbar-btn { display: flex !important; }

  /* Deadline banner — fixed under topbar on mobile, single row */
  #deadline-banner {
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    z-index: 199;
    padding: 8px 12px;
    gap: 8px;
    flex-wrap: nowrap;
    flex-direction: row;
    align-items: center;
  }
  #deadline-icon { font-size: 14px !important; }
  #deadline-text { font-size: 12px; }
  #deadline-countdown { font-size: 12px !important; }
  #deadline-banner .btn, #deadline-action { font-size: 11px !important; padding: 5px 10px !important; }
  /* page-content padding set dynamically by JS */

  /* Pagination */
  .pagination { flex-direction: column; gap: 8px; align-items: center; padding: 12px; font-size: 11px; }



  /* Quick action cards */
  .qa-card { padding: 14px; }
  .qa-label { font-size: 12px; }
  .qa-sub { font-size: 10px; }
  .qa-icon { width: 36px; height: 36px; }
}
