/* ============================================================
   Zaapton Inventory Pro — Master Stylesheet
   ============================================================ */

:root {
  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #e0e7ff;
  --success:       #10b981;
  --danger:        #ef4444;
  --warning:       #f59e0b;
  --info:          #06b6d4;
  --orange:        #f97316;
  --purple:        #8b5cf6;
  --teal:          #14b8a6;
  --indigo:        #6366f1;

  --sidebar-w:     260px;
  --topbar-h:      64px;
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --radius:        12px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md:     0 4px 16px rgba(0,0,0,.08);
  --sidebar-bg:    #0f172a;
  --sidebar-text:  #94a3b8;
  --sidebar-active:#6366f1;
  --transition:    .2s ease;
}

[data-theme="dark"] {
  --bg:      #0f172a;
  --surface: #1e293b;
  --border:  #334155;
  --text:    #f1f5f9;
  --text-muted: #94a3b8;
  color-scheme: dark;
}

/* Dark mode: native select options + browser UI elements */
[data-theme="dark"] select option {
  background-color: #1e293b;
  color: #f1f5f9;
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  color: #f1f5f9 !important;
  background-color: #1e293b !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #263448 !important;
  border-color: #6366f1 !important;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .modal-content {
  background: #1e293b;
  color: #f1f5f9;
  border-color: #334155;
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: #334155;
}
[data-theme="dark"] .btn-close { filter: invert(1); }
[data-theme="dark"] .dropdown-menu {
  background: #1e293b;
  border-color: #334155;
  color: #f1f5f9;
}
[data-theme="dark"] .dropdown-item { color: #f1f5f9; }
[data-theme="dark"] .dropdown-item:hover { background: #263448; }
[data-theme="dark"] textarea.form-control { color: #f1f5f9 !important; }
[data-theme="dark"] .input-group-text {
  background: #263448;
  border-color: #334155;
  color: #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ============================================================
   LAYOUT
   ============================================================ */
.zaapton-body { display: flex; min-height: 100vh; overflow-x: hidden; }

/* Sidebar */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  z-index: 1050;
  transition: transform var(--transition);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #334155 transparent;
}
.sidebar-brand {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1e293b;
}
.brand-logo { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
}
.brand-name { color: #f8fafc; font-weight: 700; font-size: 18px; display: block; line-height: 1.2; }
.brand-sub  { color: var(--sidebar-text); font-size: 11px; display: block; }
.sidebar-close-btn { display: none; background: none; border: none; color: var(--sidebar-text); font-size: 16px; cursor: pointer; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid #1e293b;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex-shrink: 0;
}
.user-name  { color: #f1f5f9; font-weight: 600; font-size: 13px; line-height: 1.3; }
.user-role  { color: var(--sidebar-text); font-size: 11px; }

.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label {
  color: #475569; font-size: 10px; font-weight: 700;
  letter-spacing: 1px; padding: 10px 20px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: all var(--transition);
  font-size: 13.5px;
  position: relative;
}
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item:hover  { color: #f1f5f9; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; background: rgba(99,102,241,.25); border-right: 3px solid var(--primary); }
.nav-item.active i { color: var(--primary); }
.nav-badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
}
.nav-badge-warn { background: var(--warning); }

/* ── Sidebar section color groups ───────────────────────────── */
/* MAIN — Indigo */
.ng-main .nav-section-label          { color: #818cf8; }
.ng-main .nav-item:hover i           { color: #818cf8; }
.ng-main .nav-item.active            { background: rgba(99,102,241,.2); border-right: 3px solid #6366f1; }
.ng-main .nav-item.active i          { color: #818cf8; }

/* COMMERCE — Emerald */
.ng-commerce .nav-section-label      { color: #34d399; }
.ng-commerce .nav-item:hover i       { color: #34d399; }
.ng-commerce .nav-item.active        { background: rgba(16,185,129,.18); border-right: 3px solid #10b981; }
.ng-commerce .nav-item.active i      { color: #34d399; }

/* CATALOG — Amber */
.ng-catalog .nav-section-label       { color: #fbbf24; }
.ng-catalog .nav-item:hover i        { color: #fbbf24; }
.ng-catalog .nav-item.active         { background: rgba(245,158,11,.18); border-right: 3px solid #f59e0b; }
.ng-catalog .nav-item.active i       { color: #fbbf24; }

/* FINANCE — Rose */
.ng-finance .nav-section-label       { color: #f87171; }
.ng-finance .nav-item:hover i        { color: #f87171; }
.ng-finance .nav-item.active         { background: rgba(239,68,68,.18); border-right: 3px solid #ef4444; }
.ng-finance .nav-item.active i       { color: #f87171; }

/* ANALYTICS — Violet */
.ng-analytics .nav-section-label     { color: #c084fc; }
.ng-analytics .nav-item:hover i      { color: #c084fc; }
.ng-analytics .nav-item.active       { background: rgba(139,92,246,.18); border-right: 3px solid #8b5cf6; }
.ng-analytics .nav-item.active i     { color: #c084fc; }

/* ADMINISTRATION — Cyan */
.ng-admin .nav-section-label         { color: #22d3ee; }
.ng-admin .nav-item:hover i          { color: #22d3ee; }
.ng-admin .nav-item.active           { background: rgba(6,182,212,.18); border-right: 3px solid #06b6d4; }
.ng-admin .nav-item.active i         { color: #22d3ee; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid #1e293b;
}
.logout-btn {
  display: flex; align-items: center; gap: 10px;
  color: #ef4444; font-size: 13px; text-decoration: none;
  padding: 8px 0;
  transition: opacity var(--transition);
}
.logout-btn:hover { opacity: .8; }

/* Main Wrapper */
.main-wrapper {
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
  width: calc(100% - var(--sidebar-w));
  transition: margin-left var(--transition);
}

/* Topbar */
.topbar {
  position: sticky; top: 0; z-index: 900;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  box-shadow: var(--shadow);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.topbar-toggle { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; padding: 4px; }
.topbar-toggle:hover { color: var(--primary); }
.topbar-breadcrumb { font-weight: 600; font-size: 15px; color: var(--text); }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 8px;
}
.topbar-search i { color: var(--text-muted); font-size: 13px; }
.topbar-search input { border: none; background: transparent; outline: none; font-size: 13px; width: 180px; color: var(--text); }
.topbar-datetime { font-size: 12px; color: var(--text-muted); }
.topbar-icon { position: relative; cursor: pointer; }
.topbar-icon a { color: var(--text-muted); font-size: 16px; text-decoration: none; }
.topbar-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 999px;
}
.topbar-new-order { border-radius: 8px !important; font-size: 12px !important; }
.topbar-user-btn {
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.topbar-user-btn::after { display: none; }
.avatar-circle {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.topbar-dropdown { border: 1px solid var(--border); box-shadow: var(--shadow-md); border-radius: var(--radius); min-width: 200px; }
.dropdown-header { padding: 12px 16px; }

/* Page Content */
.page-content { padding: 24px; flex: 1; }
.page-footer { text-align: center; padding: 16px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--border); }
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-title  { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }

/* ============================================================
   CARDS & PANELS
   ============================================================ */
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 14px; font-weight: 600; color: var(--text); margin: 0; }
.panel-body  { padding: 20px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-card {
  border-radius: var(--radius); padding: 0;
  overflow: hidden; position: relative;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.stat-card-body { display: flex; align-items: center; gap: 14px; padding: 18px 20px 12px; }
.stat-icon { font-size: 24px; width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-value { font-size: 22px; font-weight: 800; line-height: 1.2; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-footer { padding: 8px 20px 12px; font-size: 12px; border-top: 1px solid rgba(0,0,0,.05); }
.stat-footer a { text-decoration: none; color: var(--text-muted); }
.stat-footer a:hover { color: var(--primary); }

/* Stat card gradient backgrounds */
.stat-card-blue   { background: linear-gradient(135deg,#eff6ff 0%,#dbeafe 100%); border-color:#bfdbfe; }
.stat-card-green  { background: linear-gradient(135deg,#f0fdf4 0%,#dcfce7 100%); border-color:#bbf7d0; }
.stat-card-teal   { background: linear-gradient(135deg,#f0fdfa 0%,#ccfbf1 100%); border-color:#99f6e4; }
.stat-card-red    { background: linear-gradient(135deg,#fff1f2 0%,#fee2e2 100%); border-color:#fecaca; }
.stat-card-orange { background: linear-gradient(135deg,#fff7ed 0%,#ffedd5 100%); border-color:#fed7aa; }
.stat-card-purple { background: linear-gradient(135deg,#f5f3ff 0%,#ede9fe 100%); border-color:#ddd6fe; }

/* Solid icon circles */
.stat-card-blue   .stat-icon { background: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.35); }
.stat-card-green  .stat-icon { background: #16a34a; color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,.35); }
.stat-card-teal   .stat-icon { background: #0d9488; color: #fff; box-shadow: 0 4px 12px rgba(13,148,136,.35); }
.stat-card-red    .stat-icon { background: #dc2626; color: #fff; box-shadow: 0 4px 12px rgba(220,38,38,.35); }
.stat-card-orange .stat-icon { background: #ea580c; color: #fff; box-shadow: 0 4px 12px rgba(234,88,12,.35); }
.stat-card-purple .stat-icon { background: #7c3aed; color: #fff; box-shadow: 0 4px 12px rgba(124,58,237,.35); }

/* Dark mode stat cards */
[data-theme="dark"] .stat-card-blue   { background: linear-gradient(135deg,#172554 0%,#1e293b 100%) !important; border-color:#1e40af !important; }
[data-theme="dark"] .stat-card-green  { background: linear-gradient(135deg,#14532d 0%,#1e293b 100%) !important; border-color:#166534 !important; }
[data-theme="dark"] .stat-card-teal   { background: linear-gradient(135deg,#134e4a 0%,#1e293b 100%) !important; border-color:#115e59 !important; }
[data-theme="dark"] .stat-card-red    { background: linear-gradient(135deg,#450a0a 0%,#1e293b 100%) !important; border-color:#7f1d1d !important; }
[data-theme="dark"] .stat-card-orange { background: linear-gradient(135deg,#431407 0%,#1e293b 100%) !important; border-color:#7c2d12 !important; }
[data-theme="dark"] .stat-card-purple { background: linear-gradient(135deg,#2e1065 0%,#1e293b 100%) !important; border-color:#4c1d95 !important; }
[data-theme="dark"] .stat-card .stat-value,
[data-theme="dark"] .stat-card .stat-label { color: #f1f5f9 !important; }

/* Mini Stats */
.mini-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}
.mini-stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
a.mini-stat-link { text-decoration: none; color: inherit; display: block; cursor: pointer; }
a.mini-stat-link:hover { color: inherit; }
.mini-stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-size: 16px; }
.mini-stat-val   { font-size: 22px; font-weight: 800; color: var(--text); }
.mini-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Soft backgrounds */
.bg-primary-soft { background: #e0e7ff; } .bg-success-soft  { background: #dcfce7; }
.bg-warning-soft { background: #fef9c3; } .bg-danger-soft   { background: #fee2e2; }
.bg-info-soft    { background: #cffafe; } .bg-purple-soft   { background: #ede9fe; }
.bg-orange-soft  { background: #ffedd5; }
.text-purple     { color: #7c3aed; }      .text-orange      { color: #ea580c; }
.text-indigo     { color: #4338ca; }

/* Revenue Cards */
.revenue-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; overflow: hidden;
}
.revenue-card::before { content:''; position:absolute; left:0;top:0;bottom:0; width:4px; background: var(--primary); }
.revenue-card-month::before { background: var(--success); }
a.revenue-card-link { text-decoration: none; color: inherit; transition: transform var(--transition), box-shadow var(--transition); }
a.revenue-card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }
.rc-label { font-size: 12px; color: var(--text-muted); }
.rc-value { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 4px; }
.rc-icon  { font-size: 22px; color: var(--border); }

/* ============================================================
   TABLES
   ============================================================ */
.zaapton-table { font-size: 13.5px; margin: 0; }
.zaapton-table thead th {
  background: var(--bg); color: var(--text-muted);
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; border-bottom: 2px solid var(--border);
  padding: 10px 16px; white-space: nowrap;
}
.zaapton-table tbody td { padding: 12px 16px; vertical-align: middle; border-color: var(--border); color: var(--text); }
.zaapton-table tbody tr:hover { background: var(--bg); }
.table-responsive { overflow-x: auto; }

/* Dark mode: override Bootstrap's own table color variables */
[data-theme="dark"] .table,
[data-theme="dark"] .zaapton-table {
  --bs-table-color: #f1f5f9;
  --bs-table-bg: transparent;
  --bs-table-border-color: #334155;
  --bs-table-striped-color: #f1f5f9;
  --bs-table-hover-color: #f1f5f9;
  color: #f1f5f9 !important;
}
[data-theme="dark"] .table th,
[data-theme="dark"] .table td,
[data-theme="dark"] .zaapton-table th,
[data-theme="dark"] .zaapton-table td { color: #f1f5f9 !important; border-color: #334155 !important; }
[data-theme="dark"] .zaapton-table thead th { background: #0f172a !important; color: #94a3b8 !important; }
[data-theme="dark"] .zaapton-table tbody tr:hover td { background: #263448 !important; }
[data-theme="dark"] .card-panel { background: #1e293b !important; border-color: #334155 !important; }
[data-theme="dark"] .panel-header { border-color: #334155 !important; }
[data-theme="dark"] .page-title,
[data-theme="dark"] .page-subtitle,
[data-theme="dark"] .panel-title,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .stat-value { color: #f1f5f9 !important; }
[data-theme="dark"] .text-muted { color: #94a3b8 !important; }
[data-theme="dark"] .nav-tabs { border-color: #334155; }
[data-theme="dark"] .nav-tabs .nav-link { color: #94a3b8; border-color: transparent; }
[data-theme="dark"] .nav-tabs .nav-link.active { color: #6366f1 !important; background: #1e293b; border-color: #334155 #334155 #1e293b; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; }
.badge-success  { background: #dcfce7; color: #15803d; }
.badge-danger   { background: #fee2e2; color: #dc2626; }
.badge-warning  { background: #fef9c3; color: #92400e; }
.badge-info     { background: #cffafe; color: #0e7490; }
.badge-primary  { background: #e0e7ff; color: #3730a3; }
.badge-secondary{ background: #f1f5f9; color: #64748b; }
.badge-indigo   { background: #e0e7ff; color: #4338ca; }
.badge-teal     { background: #ccfbf1; color: #0f766e; }
.badge-orange   { background: #ffedd5; color: #c2410c; }
.bg-indigo-soft { background: #e0e7ff; }
.text-indigo    { color: #4338ca; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { border-radius: 8px; font-weight: 500; font-size: 13.5px; transition: all var(--transition); }
.btn-primary  { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success  { background: var(--success); border-color: var(--success); }
.btn-xs { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.action-btns { display: flex; gap: 4px; }
.btn-tab { background: var(--bg); border: 1px solid var(--border); color: var(--text-muted); font-size: 12px; padding: 4px 12px; border-radius: 6px; cursor: pointer; transition: all var(--transition); }
.btn-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-indigo { background: #6366f1; color: #fff; border-color: #6366f1; }
.btn-indigo:hover { background: #4f46e5; border-color: #4f46e5; color: #fff; }
.btn-teal { background: #14b8a6; color: #fff; border-color: #14b8a6; }
.btn-teal:hover { background: #0d9488; border-color: #0d9488; color: #fff; }

/* ── Workflow Panel ── */
.workflow-panel .panel-body { padding: 16px 20px; }
.wf-btn { min-width: 145px; padding: 10px 16px; line-height: 1.2; text-align: left; border-radius: 10px !important; box-shadow: 0 2px 8px rgba(0,0,0,.10); transition: transform .15s, box-shadow .15s !important; }
.wf-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.15) !important; }

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
  border-color: var(--border); border-radius: 8px;
  font-size: 13.5px; color: var(--text); background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: var(--surface);
}
.form-label { font-weight: 500; font-size: 13px; color: var(--text); margin-bottom: 5px; }
.form-label.required::after { content: ' *'; color: var(--danger); }
.search-input-wrap { position: relative; }
.search-input-wrap i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-input-wrap .form-control { padding-left: 36px; }

/* ============================================================
   STATUS TABS
   ============================================================ */
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.status-tab {
  padding: 7px 14px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
  color: var(--text-muted); text-decoration: none; border: 1px solid var(--border);
  background: var(--surface); transition: all var(--transition); white-space: nowrap;
}
.status-tab:hover { color: var(--primary); border-color: var(--primary); }
.status-tab.active { color: var(--primary); background: var(--primary-light); border-color: var(--primary); }
.tab-count { background: var(--bg); border-radius: 999px; padding: 1px 6px; font-size: 11px; margin-left: 4px; font-weight: 700; }
.tab-count-warning { background: #fef9c3; color: #92400e; }
.tab-count-success { background: #dcfce7; color: #15803d; }
.tab-count-danger  { background: #fee2e2; color: #dc2626; }
.tab-count-primary { background: #e0e7ff; color: #3730a3; }
.tab-count-info    { background: #cffafe; color: #0e7490; }
.tab-count-indigo  { background: #e0e7ff; color: #4338ca; }

/* ============================================================
   DASHBOARD COMPONENTS
   ============================================================ */
.low-stock-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.low-stock-item:last-child { border-bottom: none; }
.low-stock-item:hover { background: var(--bg); }
a.low-stock-link { text-decoration: none; color: inherit; }
a.low-stock-link:hover { background: var(--bg); color: inherit; }
.text-sm  { font-size: 13px; }
.text-xs  { font-size: 11.5px; }

.top-product-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
}
.top-product-item:last-child { border-bottom: none; }
a.top-product-link { text-decoration: none; color: inherit; }
a.top-product-link:hover { background: var(--bg); color: inherit; }
.tp-rank { width: 20px; height: 20px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tp-info { flex: 1; min-width: 0; }
.tp-rev  { font-size: 12px; font-weight: 700; color: var(--success); white-space: nowrap; }

.donut-legend { display: flex; flex-direction: column; gap: 6px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   ORDER PROGRESS
   ============================================================ */
.order-progress {
  display: flex; align-items: center; padding-bottom: 20px;
  overflow-x: auto;
}
.progress-step { display: flex; flex-direction: column; align-items: center; min-width: 70px; }
.ps-dot { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; z-index: 1; }
.progress-step.done .ps-dot  { background: var(--success); border-color: var(--success); }
.progress-step.active .ps-dot { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.2); }
.progress-step.done .ps-dot::after { content: '✓'; color: #fff; font-size: 12px; font-weight: 700; }
.progress-step.active .ps-dot::after { content: '●'; color: #fff; font-size: 10px; }
.ps-label { font-size: 10px; color: var(--text-muted); margin-top: 4px; white-space: nowrap; }
.progress-step.done .ps-label, .progress-step.active .ps-label { color: var(--text); font-weight: 600; }
.progress-line { flex: 1; height: 3px; background: var(--border); margin: 0 -2px; margin-bottom: 18px; min-width: 20px; }
.progress-line.done { background: var(--success); }

/* Timeline */
.timeline-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.timeline-item:last-child { border-bottom: none; }
.timeline-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex-shrink: 0; margin-top: 4px; }
.timeline-dot.status-completed, .timeline-dot.status-delivered { background: var(--success); }
.timeline-dot.status-cancelled, .timeline-dot.status-returned  { background: var(--danger); }
.timeline-dot.status-processing, .timeline-dot.status-confirmed { background: var(--primary); }
.timeline-dot.status-shipped    { background: var(--info); }
.timeline-dot.status-pending    { background: var(--warning); }

/* Info rows */
.info-row  { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--border); }
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); font-weight: 500; }
.payment-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.payment-item:last-child { border-bottom: none; }

/* ============================================================
   PRODUCT COMPONENTS
   ============================================================ */
.product-thumb { width: 40px; height: 40px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); flex-shrink: 0; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb-placeholder { width: 40px; height: 40px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 14px; }
.product-thumb-placeholder.sm { width: 36px; height: 36px; }
.sku-code { background: var(--bg); border: 1px solid var(--border); padding: 2px 6px; border-radius: 4px; font-size: 11px; font-family: monospace; color: var(--text-muted); }

.img-upload-area {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 30px 20px; cursor: pointer; transition: border-color var(--transition);
  min-height: 120px; display: flex; align-items: center; justify-content: center;
}
.img-upload-area:hover { border-color: var(--primary); }
.img-preview { max-height: 150px; max-width: 100%; border-radius: 8px; }

/* ============================================================
   ORDER CREATION (POS)
   ============================================================ */
.product-search-wrap, .customer-search-wrap { position: relative; }
.product-search-dropdown, .customer-search-dropdown {
  position: absolute; top: calc(100% + 2px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; z-index: 9999;
  box-shadow: 0 8px 32px rgba(0,0,0,.18); max-height: 320px; overflow-y: auto;
}
/* Allow dropdown to escape card-panel overflow:hidden */
.card-panel-overflow { overflow: visible !important; }
.card-panel-overflow .panel-body { overflow: visible !important; }
.pd-item { padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background var(--transition); }
.pd-item:last-child { border-bottom: none; }
.pd-item:hover { background: var(--bg); }
.pd-name { font-weight: 600; font-size: 13.5px; color: var(--text); }
.pd-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.selected-customer-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 10px 14px; }
.order-summary-lines { display: flex; flex-direction: column; gap: 10px; }
.summary-line { display: flex; align-items: center; justify-content: space-between; font-size: 13.5px; }
.summary-total { padding-top: 8px; border-top: 2px solid var(--border); }
.summary-due   { font-size: 14px; }

/* Customer avatar */
.customer-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.customer-avatar-lg { width: 72px; height: 72px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-size: 28px; display: flex; align-items: center; justify-content: center; margin: 0 auto; }

/* ============================================================
   FLASH TOASTS
   ============================================================ */
.alert-toast {
  position: fixed; top: 80px; right: 20px; z-index: 9999;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  min-width: 280px; max-width: 420px;
  animation: slideInRight .3s ease;
}
.alert-toast-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-toast-danger  { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.toast-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; opacity: .6; }
.toast-close:hover { opacity: 1; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.alert-banner { padding: 12px 16px; border-radius: var(--radius); }
.alert-banner-warning { background: #fef9c3; border: 1px solid #fde68a; color: #92400e; }

/* ============================================================
   REPORTS CARDS
   ============================================================ */
.report-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  text-decoration: none; color: var(--text);
  transition: all var(--transition);
  box-shadow: var(--shadow);
}
.report-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); color: var(--text); }
.rc-icon-wrap { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.rc-body { flex: 1; }
.rc-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.rc-desc  { font-size: 12px; color: var(--text-muted); }
.rc-arrow { color: var(--border); font-size: 14px; }
.report-card:hover .rc-arrow { color: var(--primary); }

.report-card-blue   .rc-icon-wrap { background: #dbeafe; color: #2563eb; }
.report-card-purple .rc-icon-wrap { background: #ede9fe; color: #7c3aed; }
.report-card-teal   .rc-icon-wrap { background: #ccfbf1; color: #0d9488; }
.report-card-orange .rc-icon-wrap { background: #ffedd5; color: #ea580c; }
.report-card-green  .rc-icon-wrap { background: #dcfce7; color: #16a34a; }
.report-card-indigo .rc-icon-wrap { background: #e0e7ff; color: #4338ca; }

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-tabs .nav-link { color: var(--text-muted); font-size: 13.5px; border-radius: 8px 8px 0 0 !important; }
.settings-tabs .nav-link.active { color: var(--primary); border-color: var(--border) var(--border) var(--surface); font-weight: 600; }
.logo-upload-area { border: 2px dashed var(--border); border-radius: 10px; padding: 20px; cursor: pointer; text-align: center; transition: border-color var(--transition); min-height: 100px; display: flex; align-items: center; justify-content: center; }
.logo-upload-area:hover { border-color: var(--primary); }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; padding: 12px 20px; border: 2px solid var(--border); border-radius: 10px; transition: all var(--transition); font-size: 13px; }
.theme-option.active, .theme-option:has(input:checked) { border-color: var(--primary); background: var(--primary-light); }
.theme-preview { width: 80px; height: 50px; border-radius: 6px; border: 1px solid var(--border); }
.theme-light-prev { background: linear-gradient(135deg, #fff 0%, #f1f5f9 100%); }
.theme-dark-prev  { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); }

/* ============================================================
   RECEIPT / INVOICE PRINT  (Zaapto Receipt Design)
   ============================================================ */
.invoice-action-bar { background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 14px 24px; }
.print-body  { font-family: 'Inter', sans-serif; background: #f1f5f9; }

/* ── Receipt Document Shell ── */
.zap-receipt {
  max-width: 760px; margin: 24px auto 40px;
  background: #fff; color: #1e293b;
  border: 1px solid #cbd5e1; border-radius: 4px;
  padding: 48px 52px;
  box-shadow: 0 6px 24px rgba(0,0,0,.10);
  font-size: 13px; line-height: 1.55;
}

/* ── Top row: title + logo ── */
.zap-top-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 32px;
}
.zap-slash-line { font-size: 11px; color: #94a3b8; letter-spacing: 2px; margin-bottom: 4px; }
.zap-receipt-title {
  font-size: 44px; font-weight: 300; color: #1e293b;
  font-family: Georgia, 'Times New Roman', serif; letter-spacing: 1px;
}
.zap-logo-circle {
  width: 88px; height: 88px; min-width: 88px; min-height: 88px;
  border-radius: 18px !important;
  background: #1a56c4; overflow: hidden !important;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative;
}
.zap-logo-img {
  width: 88px !important; height: 88px !important;
  max-width: 88px !important; max-height: 88px !important;
  object-fit: cover; object-position: center;
  display: block; border-radius: 16px;
}
.zap-logo-fallback { color: #fff; font-weight: 800; font-size: 22px; }

/* ── Section label ── */
.zap-col-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: #64748b; margin-bottom: 6px;
}

/* ── FROM + META row ── */
.zap-from-row {
  display: flex; justify-content: space-between; gap: 32px;
  padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px;
}
.zap-from-col { min-width: 200px; }
.zap-from-name { font-weight: 700; font-size: 13.5px; margin-bottom: 3px; }
.zap-from-detail { color: #475569; font-size: 12px; }
.zap-meta-col  { text-align: right; }
.zap-meta-table { border-collapse: collapse; font-size: 12.5px; }
.zap-meta-table tr td { padding: 3px 0 3px 16px; }
.zap-meta-label { color: #64748b; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; font-size: 11px; }
.zap-meta-value { font-weight: 700; color: #1e293b; }

/* ── Bill / Ship row ── */
.zap-bill-row {
  display: flex; gap: 32px;
  padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px;
}
.zap-bill-col, .zap-ship-col { flex: 1; }
.zap-bill-single {
  padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; margin-bottom: 20px;
}
.zap-bill-name   { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.zap-bill-detail { color: #475569; font-size: 12px; }

/* ── Items table ── */
.zap-items-table {
  width: 100%; border-collapse: collapse; margin-bottom: 0;
  font-size: 13px;
}
.zap-items-table thead tr { border-top: 1px solid #1e293b; border-bottom: 1px solid #1e293b; }
.zap-items-table th {
  padding: 9px 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: #1e293b;
  background: #fff;
}
.zap-items-table tbody tr { border-bottom: 1px solid #f1f5f9; }
.zap-items-table td { padding: 10px 10px; vertical-align: top; }
.col-qty    { width: 50px; text-align: center; }
.col-price  { width: 110px; text-align: right; }
.col-amount { width: 110px; text-align: right; font-weight: 600; }
.zap-items-table tbody tr:last-child { border-bottom: 1px solid #1e293b; }

/* ── Totals ── */
.zap-totals-wrap { display: flex; justify-content: flex-end; padding: 12px 0 0; }
.zap-totals-table { font-size: 13px; min-width: 240px; }
.zap-total-label { padding: 4px 0; color: #475569; }
.zap-total-val   { padding: 4px 0 4px 24px; text-align: right; font-weight: 600; }

/* ── Grand Total Box ── */
.zap-grand-box {
  display: flex; justify-content: space-between; align-items: center;
  border: 2px solid #1e293b; margin: 12px 0 0;
  padding: 14px 18px;
}
.zap-grand-label  { font-size: 22px; font-weight: 800; text-transform: uppercase; letter-spacing: 2px; }
.zap-grand-amount { font-size: 22px; font-weight: 800; }

/* ── Due box ── */
.zap-due-box {
  display: flex; justify-content: space-between;
  background: #fff1f2; border: 1px solid #fecaca;
  padding: 9px 18px; margin-top: 6px;
  font-size: 13px; font-weight: 700; color: #dc2626;
}

/* ── Payment history ── */
.zap-payments { margin-bottom: 16px; }
.zap-pay-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.zap-pay-table th { background: #f8fafc; padding: 7px 10px; font-weight: 600; border-bottom: 1px solid #e2e8f0; font-size: 11px; }
.zap-pay-table td { padding: 7px 10px; border-bottom: 1px solid #f1f5f9; }

/* ── Notes ── */
.zap-notes-block { font-size: 12px; color: #475569; margin: 16px 0; padding: 10px 14px; background: #f8fafc; border-left: 3px solid #94a3b8; }

/* ── Terms ── */
.zap-terms-block { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e8f0; }
.zap-terms-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #1e293b; margin-bottom: 10px; }
.zap-terms-text  { font-size: 12px; color: #475569; margin-bottom: 5px; }

/* ── Footer ── */
.zap-doc-footer {
  margin-top: 20px; padding-top: 14px; border-top: 1px solid #e2e8f0;
  text-align: center; font-size: 11px; color: #94a3b8;
}

/* ── Print overrides ── */
@media print {
  .zap-receipt {
    margin: 0; border: none; box-shadow: none;
    padding: 20mm 18mm; max-width: 100%;
  }
  .zap-logo-circle { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .zap-grand-box   { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-body { background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%); min-height: 100vh; }
.auth-wrapper { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-bg-shapes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.shape { position: absolute; border-radius: 50%; opacity: .12; }
.shape-1 { width: 400px; height: 400px; background: #fff; top: -100px; left: -100px; }
.shape-2 { width: 300px; height: 300px; background: #fff; bottom: -80px; right: -60px; }
.shape-3 { width: 200px; height: 200px; background: #fff; top: 40%; left: 60%; }
.auth-card { background: #fff; border-radius: 20px; padding: 40px 44px; width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.2); position: relative; z-index: 1; }
.auth-brand { text-align: center; margin-bottom: 28px; }
.auth-logo { width: 60px; height: 60px; border-radius: 16px; background: var(--primary); display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.auth-logo-letter { font-size: 28px; font-weight: 900; color: #fff; }
.auth-title    { font-size: 26px; font-weight: 800; color: #1e293b; margin-bottom: 4px; }
.auth-subtitle { font-size: 13px; color: #64748b; }
.auth-alert    { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.auth-alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fecaca; }
.auth-alert-success { background: #dcfce7; color: #16a34a; border: 1px solid #bbf7d0; }
.auth-form  { display: flex; flex-direction: column; gap: 16px; }
.auth-label { font-weight: 600; font-size: 13px; color: #334155; margin-bottom: 6px; display: block; }
.auth-input-wrap { position: relative; }
.auth-input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 14px; }
.auth-input {
  width: 100%; padding: 12px 44px; border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; color: #1e293b; outline: none; transition: border-color .2s;
}
.auth-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.auth-eye-btn { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #94a3b8; }
.auth-btn {
  background: var(--primary); color: #fff; border: none; border-radius: 10px;
  padding: 13px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background .2s; margin-top: 4px;
}
.auth-btn:hover { background: var(--primary-dark); }
.auth-footer-text { text-align: center; margin-top: 16px; font-size: 12px; color: #94a3b8; }
.auth-bottom-text { color: rgba(255,255,255,.6); font-size: 12px; margin-top: 20px; }

/* ============================================================
   INVENTORY PURCHASE VIEW
   ============================================================ */
.inventory-tabs .nav-link { color: var(--text-muted); border-radius: 8px !important; padding: 8px 16px; }
.inventory-tabs .nav-link.active { background: var(--primary); color: #fff; }

/* ============================================================
   ERROR PAGE
   ============================================================ */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.error-content { text-align: center; }
.error-code  { font-size: 100px; font-weight: 900; color: var(--primary); opacity: .15; line-height: 1; }
.error-title { font-size: 24px; font-weight: 700; margin: -20px 0 10px; }
.error-desc  { color: var(--text-muted); margin-bottom: 24px; }

/* ============================================================
   TOAST (JS)
   ============================================================ */
.zap-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  padding: 14px 20px; border-radius: 10px; font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.15);
  animation: slideInRight .3s ease;
  display: flex; align-items: center; gap: 10px;
}
.zap-toast-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.zap-toast-error   { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }
.zap-toast-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close-btn { display: block; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1040; }
  .sidebar-overlay.show { display: block; }
  .main-wrapper { margin-left: 0 !important; width: 100% !important; }
  .topbar-new-order { display: none !important; }
}
@media (max-width: 768px) {
  .page-content { padding: 16px; }
  .auth-card { padding: 28px 24px; }
  .invoice-doc { padding: 24px; }
  .inv-bill-row { flex-direction: column; gap: 16px; }
  .invoice-header { flex-direction: column; gap: 16px; }
}
@media print {
  .no-print { display: none !important; }
  .sidebar, .topbar, .page-footer { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  body { background: #fff !important; }
  .invoice-doc { border: none !important; box-shadow: none !important; padding: 0 !important; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.sticky-top-panel { position: sticky; top: calc(var(--topbar-h) + 16px); }
a { color: var(--primary); }
code { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.fs-6 { font-size: 14px !important; }
