/* ===================================================================
   Atas — Desktop / Web Theme (Flat Design, light, WCAG AA)
   Reuses the SAME design tokens as prototype/assets/theme.css.
   Desktop components: top navbar, fixed sidebar, data tables, dashboard grid.
   Built on Bootstrap 5.3 (overrides --bs-* + custom components).
   =================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Brand tokens (identical to mobile) */
  --color-primary:      #0F172A;
  --color-on-primary:   #FFFFFF;
  --color-secondary:    #334155;
  --color-accent:       #0369A1;
  --color-accent-600:   #075985;
  --color-background:   #F8FAFC;
  --color-foreground:   #020617;
  --color-muted:        #E8ECF1;
  --color-muted-fg:     #64748B;
  --color-border:       #E2E8F0;
  --color-destructive:  #DC2626;
  --color-surface:      #FFFFFF;

  /* Status palette (lifecycle) — identical to mobile */
  --st-pending:    #64748B;  --st-pending-bg:    #F1F5F9;
  --st-approved:   #2563EB;  --st-approved-bg:   #EFF6FF;
  --st-inprogress: #D97706;  --st-inprogress-bg: #FFFBEB;
  --st-ready:      #4F46E5;  --st-ready-bg:      #EEF2FF;
  --st-released:   #0D9488;  --st-released-bg:   #F0FDFA;
  --st-completed:  #16A34A;  --st-completed-bg:  #F0FDF4;
  --st-rejected:   #DC2626;  --st-rejected-bg:   #FEF2F2;
  --st-cancelled:  #94A3B8;  --st-cancelled-bg:  #F8FAFC;
  --st-paid:       #16A34A;  --st-paid-bg:       #F0FDF4;
  --st-unpaid:     #B45309;  --st-unpaid-bg:     #FFFBEB;

  /* Bootstrap variable overrides */
  --bs-primary:        #0369A1;
  --bs-primary-rgb:    3,105,161;
  --bs-body-bg:        #F8FAFC;
  --bs-body-color:     #020617;
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --bs-border-color:   #E2E8F0;
  --bs-border-radius:  .75rem;
  --bs-link-color:     #0369A1;

  /* Desktop layout dimensions */
  --sidebar-w:  248px;
  --topbar-h:   60px;
  --content-max: 1200px;
}

* { -webkit-tap-highlight-color: transparent; }
html, body { background: var(--color-background); }
body {
  font-family: var(--bs-body-font-family);
  color: var(--color-foreground);
  margin: 0;
  min-height: 100vh;
}

/* ===================================================================
   SHELL: top navbar + fixed left sidebar + content area
   =================================================================== */
.app-shell { min-height: 100vh; }

/* ---------- Top navbar (persistent) ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1040;
  height: var(--topbar-h);
  background: var(--color-primary); color: #fff;
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.topbar .brand {
  display: flex; align-items: center; gap: .6rem;
  text-decoration: none; color: #fff;
  width: calc(var(--sidebar-w) - 1.25rem);
  flex-shrink: 0;
}
.topbar .brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--color-accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; flex-shrink: 0;
}
.topbar .brand-name { font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; }
.topbar .biz {
  font-weight: 600; font-size: .92rem; color: #cbd5e1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .spacer { flex: 1; }
.topbar .iconbtn { color: #cbd5e1; }
.topbar .iconbtn:hover { color: #fff; background: rgba(148,163,184,.18); }

/* user menu in navbar */
.topbar .user-chip {
  display: flex; align-items: center; gap: .55rem;
  background: rgba(148,163,184,.14); border: 0; color: #fff;
  padding: .3rem .55rem .3rem .35rem; border-radius: 999px; cursor: pointer;
  transition: background .15s;
}
.topbar .user-chip:hover { background: rgba(148,163,184,.28); }
.topbar .user-chip .meta { text-align: left; line-height: 1.1; }
.topbar .user-chip .meta .nm { font-size: .82rem; font-weight: 700; }
.topbar .user-chip .meta .rl { font-size: .68rem; color: #cbd5e1; }

/* hamburger only shown on small screens */
.nav-toggle { display: none; }

/* ---------- Sidebar (fixed) ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; z-index: 1030;
  width: var(--sidebar-w);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: transform .2s ease;
}
.sidebar .sb-section {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--color-muted-fg); padding: 1.1rem 1.25rem .4rem;
}
.sidebar nav { padding: .35rem .65rem 1rem; flex: 1; }
.sidebar .sb-link {
  display: flex; align-items: center; gap: .7rem;
  padding: .62rem .7rem; border-radius: .65rem;
  text-decoration: none; color: var(--color-secondary);
  font-weight: 600; font-size: .9rem; margin-bottom: 2px;
  transition: background .15s, color .15s;
  position: relative;
}
.sidebar .sb-link svg { width: 19px; height: 19px; flex-shrink: 0; opacity: .85; }
.sidebar .sb-link:hover { background: var(--color-muted); color: var(--color-foreground); }
.sidebar .sb-link.active {
  background: var(--st-approved-bg); color: var(--color-accent);
}
.sidebar .sb-link.active svg { opacity: 1; }
.sidebar .sb-link.active::before {
  content: ""; position: absolute; left: -.65rem; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--color-accent);
}
.sidebar .sb-link .count {
  margin-left: auto; background: var(--color-destructive); color: #fff;
  font-size: .68rem; font-weight: 700; min-width: 20px; height: 20px;
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.sidebar .sb-foot { padding: .75rem 1.1rem 1.25rem; border-top: 1px solid var(--color-border); }
.sidebar .sb-foot .biz-card {
  display: flex; align-items: center; gap: .6rem; font-size: .8rem; color: var(--color-muted-fg);
}

/* sidebar backdrop (mobile) */
.sb-backdrop {
  display: none; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 1025;
  background: rgba(2,6,23,.4);
}

/* ---------- Content area ---------- */
.content {
  margin-left: var(--sidebar-w);
  padding-top: var(--topbar-h);
  min-height: 100vh;
}
.content-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.75rem 2rem 3rem;
}

/* ---------- Page header ---------- */
.page-head {
  display: flex; flex-wrap: wrap; gap: 1rem;
  justify-content: space-between; align-items: flex-start;
  margin-bottom: 1.5rem;
}
.breadcrumb-mini { font-size: .78rem; color: var(--color-muted-fg); font-weight: 600; margin-bottom: .25rem; }
.breadcrumb-mini a { color: var(--color-muted-fg); text-decoration: none; }
.breadcrumb-mini a:hover { color: var(--color-accent); }
.page-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -.025em; margin: 0; }
.page-sub { color: var(--color-muted-fg); font-size: .92rem; margin: .35rem 0 0; }

/* ===================================================================
   COMPONENTS
   =================================================================== */

/* ---------- Cards ---------- */
.card { border: 1px solid var(--color-border); border-radius: var(--bs-border-radius); background: var(--color-surface); }
.card-flat { box-shadow: none; }
.panel {
  border: 1px solid var(--color-border); border-radius: var(--bs-border-radius);
  background: var(--color-surface);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--color-border);
}
.panel-head h2, .panel-head .panel-title { font-size: 1rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
.panel-body { padding: 1.25rem; }
.panel-body.p-0 { padding: 0; }

/* KPI cards */
.kpi {
  border: 1px solid var(--color-border); border-radius: .9rem; background: #fff;
  padding: 1.15rem 1.25rem; height: 100%;
}
.kpi .label { font-size: .74rem; color: var(--color-muted-fg); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi .value { font-size: 1.85rem; font-weight: 800; letter-spacing: -.025em; font-variant-numeric: tabular-nums; line-height: 1.15; margin-top: .15rem; }
.kpi .delta { font-size: .78rem; font-weight: 600; margin-top: .15rem; }
.kpi.accent { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }
.kpi.accent .label { color: #cbd5e1; }
.kpi .kpi-icon {
  width: 42px; height: 42px; border-radius: .7rem; display: inline-flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  background: var(--st-approved-bg); color: var(--color-accent);
}
.kpi.accent .kpi-icon { background: rgba(255,255,255,.12); color: #34d399; }

/* ---------- Data tables ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: .9rem;
}
table.data thead th {
  text-align: left; font-weight: 700; font-size: .76rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--color-muted-fg);
  padding: .8rem 1rem; border-bottom: 1px solid var(--color-border);
  white-space: nowrap; background: var(--color-surface); position: sticky; top: 0;
}
table.data thead th.sortable { cursor: pointer; user-select: none; }
table.data thead th.sortable:hover { color: var(--color-foreground); }
table.data thead th.sortable .sort-ico { opacity: .45; margin-left: .25rem; vertical-align: -1px; }
table.data thead th.num, table.data tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody td {
  padding: .8rem 1rem; border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--color-background); }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tfoot td {
  padding: .85rem 1rem; font-weight: 800; border-top: 2px solid var(--color-border);
  font-variant-numeric: tabular-nums;
}
.cell-strong { font-weight: 700; }
.cell-sub { font-size: .78rem; color: var(--color-muted-fg); }

.thumb-sm {
  width: 42px; height: 42px; border-radius: .55rem; background: var(--color-muted);
  display: inline-flex; align-items: center; justify-content: center; color: var(--color-muted-fg); flex-shrink: 0;
}
.thumb-sm svg { width: 22px; height: 22px; opacity: .7; }

/* ---------- Filter bar ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .6rem; align-items: center;
  padding: .85rem 1rem; border-bottom: 1px solid var(--color-border);
}
.filter-bar .search { flex: 1 1 240px; min-width: 200px; max-width: 360px; }
.filter-bar .form-select, .filter-bar .form-control { font-size: .88rem; }

/* ---------- Status & payment badges (identical to mobile) ---------- */
.badge-status { font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 999px; display: inline-flex; align-items: center; gap: .32rem; line-height: 1; white-space: nowrap; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-pending    { color: var(--st-pending);    background: var(--st-pending-bg); }
.st-approved   { color: var(--st-approved);   background: var(--st-approved-bg); }
.st-inprogress { color: var(--st-inprogress); background: var(--st-inprogress-bg); }
.st-ready      { color: var(--st-ready);      background: var(--st-ready-bg); }
.st-released   { color: var(--st-released);   background: var(--st-released-bg); }
.st-completed  { color: var(--st-completed);  background: var(--st-completed-bg); }
.st-rejected   { color: var(--st-rejected);   background: var(--st-rejected-bg); }
.st-cancelled  { color: var(--st-cancelled);  background: var(--st-cancelled-bg); }
.pay-paid   { color: var(--st-paid);   background: var(--st-paid-bg); }
.pay-unpaid { color: var(--st-unpaid); background: var(--st-unpaid-bg); }

/* ---------- Filter chips (kept for status quick filters) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { white-space: nowrap; border: 1px solid var(--color-border); background: #fff; color: var(--color-secondary); border-radius: 999px; padding: .4rem .85rem; font-size: .82rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip:hover { border-color: #cbd5e1; }
.chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ---------- Timeline (status history) ---------- */
.timeline { position: relative; margin: .25rem 0; padding-left: 1.8rem; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--color-border); }
.tl-item { position: relative; padding: .25rem 0 1.1rem; }
.tl-item::before { content: ""; position: absolute; left: -1.8rem; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--color-border); }
.tl-item.done::before { background: var(--st-completed); border-color: var(--st-completed); }
.tl-item.current::before { background: var(--st-inprogress); border-color: var(--st-inprogress); box-shadow: 0 0 0 4px var(--st-inprogress-bg); }
.tl-item .tl-title { font-weight: 700; font-size: .92rem; }
.tl-item .tl-meta { font-size: .78rem; color: var(--color-muted-fg); }
.tl-item.future .tl-title { color: var(--color-muted-fg); font-weight: 600; }

/* ---------- Product card (catalog) ---------- */
.product-card { border: 1px solid var(--color-border); border-radius: .85rem; overflow: hidden; background: #fff; display: flex; flex-direction: column; transition: border-color .15s, transform .05s, box-shadow .15s; }
.product-card:hover { border-color: #cbd5e1; box-shadow: 0 6px 20px -12px rgba(2,6,23,.25); }
.product-card .thumb { aspect-ratio: 1/1; background: var(--color-muted); display: flex; align-items: center; justify-content: center; color: var(--color-muted-fg); }
.product-card .thumb svg { width: 44px; height: 44px; opacity: .6; }
.product-card .body { padding: .8rem .85rem .85rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.product-card .name { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.product-card .cat { font-size: .74rem; color: var(--color-muted-fg); }
.product-card .price { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem; }

/* ---------- Cart / summary panel ---------- */
.summary-panel { position: sticky; top: calc(var(--topbar-h) + 1.75rem); }
.summary-line { display: flex; justify-content: space-between; padding: .55rem 0; font-size: .9rem; }
.summary-line + .summary-line { border-top: 1px solid var(--color-border); }

/* ---------- Buttons ---------- */
.btn-primary { --bs-btn-bg: var(--color-accent); --bs-btn-border-color: var(--color-accent); --bs-btn-hover-bg: var(--color-accent-600); --bs-btn-hover-border-color: var(--color-accent-600); --bs-btn-active-bg: var(--color-accent-600); font-weight: 600; }
.btn-dark { --bs-btn-bg: var(--color-primary); --bs-btn-border-color: var(--color-primary); --bs-btn-hover-bg: #1e293b; --bs-btn-hover-border-color: #1e293b; font-weight: 600; }
.btn { font-weight: 600; transition: background .18s, border-color .18s, color .18s, box-shadow .18s; }
.btn-block { width: 100%; }
.cursor-pointer { cursor: pointer; }
.btn:focus-visible, a:focus-visible, .form-control:focus-visible, .form-select:focus-visible,
.chip:focus-visible, .sb-link:focus-visible, .iconbtn:focus-visible, .user-chip:focus-visible,
table.data thead th.sortable:focus-visible, .form-check-input:focus-visible {
  outline: 2px solid var(--color-accent); outline-offset: 2px;
}

/* ---------- Icon button ---------- */
.iconbtn {
  background: transparent; border: 0; color: var(--color-secondary);
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: .6rem; cursor: pointer; transition: background .15s, color .15s; position: relative; text-decoration: none;
}
.iconbtn:hover { background: rgba(148,163,184,.18); }

/* ---------- Notification badge (live request count on the navbar bell) ---------- */
.notif-bell { position: relative; }
.notif-count {
  position: absolute; top: 3px; right: 3px;
  min-width: 17px; height: 17px; padding: 0 4px;
  background: var(--color-destructive); color: #fff;
  font-size: .62rem; font-weight: 700; line-height: 1;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-primary);
}
/* The navbar is the dark primary surface; outline the badge against it for legibility. */
.topbar .notif-count { border-color: var(--color-primary); }
.notif-count.pulse { animation: notif-pulse .6s ease; }
@keyframes notif-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}

/* Small "live" indicator next to a status that receives real-time updates. */
.live-dot {
  color: var(--st-completed, #16a34a); font-size: .7em; vertical-align: middle;
  animation: live-blink 2s ease-in-out infinite; margin-left: .15rem;
}
@keyframes live-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.badge-status.pulse { animation: notif-pulse .6s ease; }

/* ---------- Misc ---------- */
.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.muted { color: var(--color-muted-fg); }
.divider { height: 1px; background: var(--color-border); margin: 1rem 0; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--color-border); border-radius: .6rem; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: #fff; font-size: 1.1rem; cursor: pointer; color: var(--color-secondary); transition: background .12s; }
.qty button:hover { background: var(--color-muted); }
.qty span { min-width: 36px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--color-accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; flex-shrink: 0; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.6rem; }

/* Empty state */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--color-muted-fg); }
.empty-state svg { width: 46px; height: 46px; opacity: .4; margin-bottom: .75rem; }

/* Pager (server-side pagination) */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-top: 1px solid var(--color-border); }
.pager-summary { font-size: .82rem; }
.pager-pages { list-style: none; display: flex; align-items: center; gap: .3rem; margin: 0; padding: 0; flex-wrap: wrap; }
.pager-link { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; min-height: 38px; padding: 0 .6rem; border: 1px solid var(--color-border); background: #fff; color: var(--color-secondary); border-radius: .55rem; font-size: .84rem; font-weight: 600; text-decoration: none; transition: background .15s, color .15s, border-color .15s; }
.pager-link:hover:not(.disabled):not(.active) { border-color: #cbd5e1; background: var(--color-muted); }
.pager-link.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); cursor: default; }
.pager-link.disabled { opacity: .45; cursor: not-allowed; }
.pager-gap { padding: 0 .25rem; color: var(--color-muted-fg); }
.pager-link:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
@media (max-width: 575.98px) { .pager { justify-content: center; } .pager-summary { width: 100%; text-align: center; } }

/* Toast (desktop: top-right) */
.toast-host { position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 2000; display: flex; flex-direction: column; gap: .5rem; pointer-events: none; align-items: flex-end; }
.toast-msg { background: var(--color-primary); color: #fff; padding: .75rem 1rem; border-radius: .7rem; font-size: .88rem; font-weight: 600; box-shadow: 0 14px 40px -12px rgba(2,6,23,.5); display: flex; align-items: center; gap: .55rem; opacity: 0; transform: translateY(12px); transition: opacity .2s, transform .2s; max-width: 340px; }
.toast-msg.show { opacity: 1; transform: translateY(0); }
.toast-msg svg { flex-shrink: 0; }

/* Live pill */
.live-pill { display: inline-flex; align-items: center; gap: .4rem; font-size: .76rem; font-weight: 700; color: var(--st-released); background: var(--st-released-bg); padding: .28rem .65rem; border-radius: 999px; }
.live-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #16a34a; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Image upload dropzone */
.dropzone { border: 2px dashed var(--color-border); border-radius: 1rem; padding: 2rem; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; display: block; }
.dropzone:hover { border-color: var(--color-accent); background: var(--st-approved-bg); }

/* Modals (flat, rounded) */
.modal-content { border-radius: 1rem; border: 1px solid var(--color-border); }
.modal-header, .modal-footer { border: 0; }
.cred-box { background: var(--color-muted); border-radius: .6rem; padding: .65rem .8rem; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }

/* Proto note */
.proto-note { font-size: .72rem; color: var(--color-muted-fg); text-align: center; padding: 1rem; }

/* ===================================================================
   RESPONSIVE — usable when narrowed (< 1024px collapses sidebar)
   =================================================================== */
@media (max-width: 991.98px) {
  .nav-toggle { display: inline-flex; }
  .topbar .brand { width: auto; }
  .topbar .biz { display: none; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px -10px rgba(2,6,23,.3); }
  .sidebar.open { transform: translateX(0); }
  .sb-backdrop.open { display: block; }
  .content { margin-left: 0; }
  .content-inner { padding: 1.25rem 1.1rem 3rem; }
  .page-title { font-size: 1.35rem; }
  .summary-panel { position: static; }
}

@media (max-width: 575.98px) {
  .content-inner { padding: 1rem .85rem 3rem; }
  .filter-bar .search { max-width: none; }
  .toast-host { right: .85rem; left: .85rem; bottom: 1rem; align-items: stretch; }
  .toast-msg { max-width: none; }
  /* stacked-card fallback for wide tables */
  table.data.responsive-cards thead { display: none; }
  table.data.responsive-cards tbody td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem 1rem; border: 0; }
  table.data.responsive-cards tbody td::before { content: attr(data-label); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--color-muted-fg); }
  table.data.responsive-cards tbody td.num { text-align: right; }
  table.data.responsive-cards tbody tr { display: block; border: 1px solid var(--color-border); border-radius: .75rem; margin-bottom: .7rem; padding: .4rem 0; }
  table.data.responsive-cards tbody tr:hover { background: #fff; }
}

/* ===================================================================
   DARK MODE — toggled via navbar sun/moon, remembered in localStorage
   (sets data-bs-theme="dark" on <html>; Bootstrap handles form/table/
   modal surfaces, these rules cover the custom desktop components)
   =================================================================== */
:root[data-bs-theme="dark"] {
  --color-background:#0b1220;
  --color-surface:#111c33;
  --color-foreground:#E5EAF2;
  --color-secondary:#CBD5E1;
  --color-muted:#1e293b;
  --color-muted-fg:#94A3B8;
  --color-border:#243049;
  --bs-body-bg:#0b1220;
  --bs-body-color:#E5EAF2;
  --bs-border-color:#243049;
}
[data-bs-theme="dark"] .kpi,
[data-bs-theme="dark"] .product-card,
[data-bs-theme="dark"] .qty button { background: var(--color-surface); }
[data-bs-theme="dark"] .kpi.accent { background: var(--color-primary); }
[data-bs-theme="dark"] .product-card .thumb,
[data-bs-theme="dark"] .thumb-sm { background:#1e293b; }
[data-bs-theme="dark"] .chip { background:#1a2438; border-color: var(--color-border); color:#CBD5E1; }
[data-bs-theme="dark"] .chip.active { background: var(--color-accent); border-color: var(--color-accent); color:#fff; }
[data-bs-theme="dark"] .tl-item::before { background: var(--color-surface); }
[data-bs-theme="dark"] .sidebar .sb-link.active { background: rgba(3,105,161,.18); }
[data-bs-theme="dark"] table.data tbody tr:hover { background:#0d1830; }
[data-bs-theme="dark"] table.data thead th { background: var(--color-surface); }
[data-bs-theme="dark"] .bg-white { background: var(--color-surface) !important; color: var(--color-foreground); }
[data-bs-theme="dark"] .role { background: var(--color-surface) !important; border-color: var(--color-border) !important; }
[data-bs-theme="dark"] .btn-outline-secondary { --bs-btn-color:#CBD5E1; --bs-btn-border-color:#334155; --bs-btn-hover-bg:#1e293b; --bs-btn-hover-border-color:#334155; --bs-btn-hover-color:#fff; }
[data-bs-theme="dark"] .pager-link { background:#1a2438; border-color: var(--color-border); color:#CBD5E1; }
[data-bs-theme="dark"] .pager-link:hover:not(.disabled):not(.active) { background:#1e293b; border-color:#334155; }
[data-bs-theme="dark"] .pager-link.active { background: var(--color-accent); border-color: var(--color-accent); color:#fff; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
