/* =====================================================================
   ZBTRIAANSH ERP — "Zest" admin theme (v2)
   Bootstrap 5.3 + Bootstrap Icons + Chart.js, all vendored (offline-safe).
   Light / dark mode via [data-bs-theme], dark or light sidebar via
   [data-sidebar], both remembered in localStorage (see base.html / app.js).
   ===================================================================== */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../vendor/inter/InterVariable.woff2") format("woff2"); }

:root, [data-bs-theme="light"] {
  --zb-primary: #4361ee; --zb-primary-600: #3651d4; --zb-primary-700: #2b41ad; --zb-primary-50: #eef1fe; --zb-primary-100: #dfe5fd;
  --zb-accent: #7c3aed; --zb-teal: #0ea5a4; --zb-success: #16a34a; --zb-warning: #f59e0b; --zb-danger: #ef4444; --zb-info: #0ea5e9;
  --zb-bg: #f4f6fb; --zb-surface: #ffffff; --zb-surface-2: #f8fafc; --zb-border: #e5e9f2; --zb-border-strong: #d3d9e6;
  --zb-text: #334155; --zb-heading: #0f172a; --zb-muted: #64748b; --zb-subtle: #94a3b8;
  --zb-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 3px rgba(15, 23, 42, .04);
  --zb-shadow: 0 6px 24px -6px rgba(15, 23, 42, .12);
  --zb-radius: .85rem; --zb-radius-sm: .55rem;
  --sidebar-width: 264px; --sidebar-width-collapsed: 76px;
  /* Bootstrap hooks */
  --bs-primary: #4361ee; --bs-primary-rgb: 67, 97, 238; --bs-link-color: #3651d4; --bs-link-color-rgb: 54, 81, 212;
  --bs-link-hover-color: #2b41ad; --bs-body-bg: var(--zb-bg); --bs-body-color: var(--zb-text); --bs-border-color: var(--zb-border);
  --bs-font-sans-serif: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-secondary-bg: #eef2f7; --bs-tertiary-bg: #f8fafc;
  /* legacy aliases used by older templates */
  --brand-50: var(--zb-primary-50); --brand-100: var(--zb-primary-100); --brand-500: var(--zb-primary); --brand-600: var(--zb-primary-600);
  --brand-700: var(--zb-primary-700); --gray-50: var(--zb-surface-2); --gray-100: #f1f5f9; --gray-200: var(--zb-border);
  --gray-300: var(--zb-border-strong); --gray-400: var(--zb-subtle); --gray-500: var(--zb-muted); --gray-700: var(--zb-text);
  --gray-800: #1e293b; --gray-900: var(--zb-heading); --radius: var(--zb-radius);
}
[data-bs-theme="dark"] {
  --zb-primary: #6b84ff; --zb-primary-600: #5a73f5; --zb-primary-700: #8ea0ff; --zb-primary-50: rgba(107, 132, 255, .14); --zb-primary-100: rgba(107, 132, 255, .22);
  --zb-bg: #0b1120; --zb-surface: #111a2e; --zb-surface-2: #0f172a; --zb-border: #1f2a44; --zb-border-strong: #2b3a5c;
  --zb-text: #cbd5e1; --zb-heading: #f1f5f9; --zb-muted: #94a3b8; --zb-subtle: #64748b;
  --zb-shadow-sm: 0 1px 2px rgba(0, 0, 0, .35); --zb-shadow: 0 10px 30px -10px rgba(0, 0, 0, .6);
  --bs-primary: #6b84ff; --bs-primary-rgb: 107, 132, 255; --bs-link-color: #8ea0ff; --bs-link-color-rgb: 142, 160, 255; --bs-link-hover-color: #b4c0ff;
  --bs-body-bg: var(--zb-bg); --bs-body-color: var(--zb-text); --bs-border-color: var(--zb-border);
  --bs-secondary-bg: #16213a; --bs-tertiary-bg: #131d33; --gray-100: #16213a; --gray-800: #e2e8f0;
}

html { scroll-behavior: smooth; }
body { background: var(--zb-bg); color: var(--zb-text); font-size: .875rem; font-family: var(--bs-font-sans-serif);
  font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { color: var(--zb-heading); letter-spacing: -.015em; }
a { color: var(--bs-link-color); }
.text-muted { color: var(--zb-muted) !important; }
::selection { background: var(--zb-primary-100); }

/* ---------- buttons ---------- */
.btn { border-radius: var(--zb-radius-sm); font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--zb-primary); --bs-btn-border-color: var(--zb-primary); --bs-btn-hover-bg: var(--zb-primary-600);
  --bs-btn-hover-border-color: var(--zb-primary-600); --bs-btn-active-bg: var(--zb-primary-700); --bs-btn-active-border-color: var(--zb-primary-700);
  --bs-btn-disabled-bg: var(--zb-primary); --bs-btn-disabled-border-color: var(--zb-primary);
  box-shadow: 0 1px 2px rgba(67, 97, 238, .25), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-outline-primary { --bs-btn-color: var(--zb-primary); --bs-btn-border-color: var(--zb-primary); --bs-btn-hover-bg: var(--zb-primary);
  --bs-btn-hover-border-color: var(--zb-primary); --bs-btn-active-bg: var(--zb-primary-600); }
.btn-light { --bs-btn-bg: var(--zb-surface); --bs-btn-border-color: var(--zb-border); --bs-btn-hover-bg: var(--zb-surface-2);
  --bs-btn-hover-border-color: var(--zb-border-strong); --bs-btn-color: var(--zb-text); --bs-btn-hover-color: var(--zb-heading); }
.btn-soft { background: var(--zb-primary-50); color: var(--zb-primary-600); border: 0; }
.btn-soft:hover { background: var(--zb-primary-100); color: var(--zb-primary-700); }
.btn-gradient { color: #fff; border: 0; background: linear-gradient(135deg, var(--zb-primary), var(--zb-accent)); }
.btn-gradient:hover { color: #fff; filter: brightness(1.07); }

/* ---------- layout / sidebar ---------- */
.page-wrapper { display: flex; min-height: 100vh; }
.app-sidebar { --sb-bg: #ffffff; --sb-text: #475569; --sb-heading: #0f172a; --sb-muted: #94a3b8; --sb-hover: #f1f5f9; --sb-border: var(--zb-border);
  --sb-active-bg: var(--zb-primary-50); --sb-active: var(--zb-primary-600); --sb-card: #f8fafc;
  position: fixed; top: 0; left: 0; z-index: 1045; display: flex; flex-direction: column; height: 100vh; width: var(--sidebar-width);
  border-right: 1px solid var(--sb-border); background: var(--sb-bg); padding: 0 .85rem; transition: width .25s ease, transform .25s ease; }
[data-sidebar="dark"] .app-sidebar, [data-bs-theme="dark"] .app-sidebar {
  --sb-bg: linear-gradient(180deg, #0f172a 0%, #111b39 60%, #141f45 100%); --sb-text: #aab4cc; --sb-heading: #fff; --sb-muted: #5f6d8c;
  --sb-hover: rgba(255, 255, 255, .06); --sb-border: rgba(255, 255, 255, .06); --sb-active-bg: linear-gradient(90deg, rgba(107, 132, 255, .28), rgba(124, 58, 237, .12));
  --sb-active: #fff; --sb-card: rgba(255, 255, 255, .05); }
@media (max-width: 991.98px) { .app-sidebar { transform: translateX(-100%); box-shadow: none; } .app-sidebar.mobile-open { transform: translateX(0); box-shadow: 0 10px 40px rgba(15, 23, 42, .35); } }
@media (min-width: 992px) {
  .app-sidebar.collapsed { width: var(--sidebar-width-collapsed); }
  .app-sidebar.collapsed .hide-on-collapse { display: none !important; }
  .app-sidebar.collapsed .sidebar-header { justify-content: center; }
  .app-sidebar.collapsed .menu-item { justify-content: center; padding: .65rem 0; }
  .app-sidebar.collapsed .sb-children { display: none !important; }
}
.sidebar-header { display: flex; align-items: center; padding: 1.15rem .3rem 1rem; }
.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--sb-heading, var(--zb-heading)); font-weight: 800; letter-spacing: .02em; }
.brand-text { line-height: 1.1; }
.brand-text small { display: block; font-size: .6rem; font-weight: 600; color: var(--sb-muted, var(--zb-subtle)); letter-spacing: .28em; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 11px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--zb-primary), var(--zb-accent)); box-shadow: 0 6px 16px -4px rgba(67, 97, 238, .55); flex-shrink: 0; }
.sidebar-account { background: var(--sb-card); border: 1px solid var(--sb-border); border-radius: .7rem; padding: .55rem .75rem; margin-bottom: .85rem; font-size: .78rem; }
.sa-org { font-weight: 600; color: var(--sb-heading); } .sa-centre { color: var(--sb-text); opacity: .85; }
.sidebar-scroll { display: flex; flex-direction: column; overflow-y: auto; flex: 1 1 auto; scrollbar-width: thin; scrollbar-color: var(--sb-border) transparent; margin: 0 -.4rem; padding: 0 .4rem; }
.menu-group-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .12em; color: var(--sb-muted); margin: .25rem 0 .55rem .6rem; font-weight: 700; }
.menu-item { display: flex; align-items: center; gap: .75rem; border-radius: .6rem; padding: .55rem .75rem; font-size: .855rem; font-weight: 500;
  color: var(--sb-text); text-decoration: none; position: relative; transition: background .15s, color .15s; }
.menu-item:hover { background: var(--sb-hover); color: var(--sb-heading); }
.menu-item.active { background: var(--sb-active-bg); color: var(--sb-active); font-weight: 600; }
.app-sidebar > .sidebar-scroll .menu-item.active:not(.small)::before { content: ""; position: absolute; left: -.85rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--zb-primary); }
.menu-item .bi { font-size: 1.08rem; flex-shrink: 0; }
.menu-item .menu-item-arrow { margin-left: auto; font-size: .75rem; transition: transform .2s ease; }
.menu-item[aria-expanded="true"] .menu-item-arrow { transform: rotate(180deg); }
.sb-node-toggle { cursor: pointer; }
.sb-node-current { color: var(--sb-active); font-weight: 600; }
/* Never put .d-flex on a .collapse element: its !important beats .collapse:not(.show). */
.sb-children.collapse.show { display: flex; }
.sb-children { margin: .1rem 0 .35rem 1.2rem; padding-left: .6rem; border-left: 1px solid var(--sb-border); }
.sb-children .menu-item { padding: .38rem .65rem; font-weight: 500; font-size: .82rem; }
.sb-children .menu-item.active { background: transparent; color: var(--sb-active); }
.sb-children .menu-item.active::after { content: ""; position: absolute; left: -.68rem; width: 7px; height: 7px; border-radius: 50%; background: var(--zb-primary); box-shadow: 0 0 0 3px rgba(67, 97, 238, .2); }
.sidebar-footer { border-top: 1px solid var(--sb-border); padding: .75rem .3rem; font-size: .72rem; color: var(--sb-muted); }
.content-area { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; margin-left: var(--sidebar-width); transition: margin-left .25s ease; }
.app-sidebar.collapsed ~ .content-area { margin-left: var(--sidebar-width-collapsed); }
@media (max-width: 991.98px) { .content-area, .app-sidebar.collapsed ~ .content-area { margin-left: 0; } }
.mobile-overlay { display: none; position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.mobile-overlay.show { display: block; }

/* ---------- header ---------- */
.app-header { position: sticky; top: 0; z-index: 1035; background: color-mix(in srgb, var(--zb-surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--zb-border); min-height: 62px; display: flex; align-items: center; }
.header-toggle-btn, .icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--zb-border);
  border-radius: .6rem; background: var(--zb-surface); color: var(--zb-muted); transition: all .15s; }
.header-toggle-btn:hover, .icon-btn:hover { background: var(--zb-surface-2); color: var(--zb-heading); border-color: var(--zb-border-strong); }
.icon-btn .bi { font-size: 1.05rem; }
.header-search { position: relative; align-items: center; width: min(420px, 40vw); }
.header-search .bi-search { position: absolute; left: .85rem; color: var(--zb-subtle); }
.header-search input { padding-left: 2.3rem; padding-right: 2.4rem; border-radius: .6rem; background: var(--zb-surface-2); border-color: var(--zb-border); height: 40px; }
.header-search kbd { position: absolute; right: .5rem; background: var(--zb-surface); color: var(--zb-muted); border: 1px solid var(--zb-border); font-size: .68rem; padding: .1rem .4rem; box-shadow: none; }
.centre-switcher { display: flex; align-items: center; gap: .35rem; border: 1px solid var(--zb-border); border-radius: .6rem; padding: 0 .2rem 0 .65rem; background: var(--zb-surface); height: 40px; color: var(--zb-muted); }
.centre-switcher select { border: 0; box-shadow: none !important; max-width: 200px; font-weight: 500; background-color: transparent; }
.centre-pill { align-items: center; gap: .35rem; border: 1px solid var(--zb-border); border-radius: 2rem; padding: .3rem .85rem; background: var(--zb-surface); font-weight: 500; font-size: .8rem; }
.notif-count { position: absolute; top: -5px; right: -5px; background: var(--zb-danger); color: #fff; border-radius: 1rem; font-size: .62rem; min-width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; box-shadow: 0 0 0 2px var(--zb-surface); }
.ws-dot { position: absolute; bottom: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--zb-border-strong); border: 2px solid var(--zb-surface); }
.ws-dot.on { background: #22c55e; }
.notif-menu { width: 340px; padding: 0; border-radius: .85rem; border-color: var(--zb-border); overflow: hidden; }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-item { display: flex; gap: .65rem; padding: .65rem .9rem; border-bottom: 1px solid var(--zb-border); font-size: .8rem; text-decoration: none; color: var(--zb-text); }
.notif-item:hover { background: var(--zb-surface-2); }
.notif-item .bi { font-size: 1.05rem; color: var(--zb-primary); }
.notif-item time { display: block; color: var(--zb-subtle); font-size: .7rem; }
.empty-mini { padding: 1.25rem; text-align: center; color: var(--zb-subtle); font-size: .82rem; }
.user-menu-trigger { display: flex; align-items: center; gap: .55rem; border: 0; background: transparent; color: var(--zb-text); padding: .2rem .35rem; border-radius: .6rem; }
.user-menu-trigger:hover { background: var(--zb-surface-2); }
.user-role { font-size: .7rem; color: var(--zb-muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .78rem;
  color: #fff; background: linear-gradient(135deg, var(--zb-primary), var(--zb-accent)); }
.dropdown-menu { --bs-dropdown-border-color: var(--zb-border); --bs-dropdown-border-radius: .75rem; --bs-dropdown-link-active-bg: var(--zb-primary);
  --bs-dropdown-bg: var(--zb-surface); box-shadow: var(--zb-shadow); font-size: .85rem; }
.dropdown-item { border-radius: .4rem; margin: 0 .3rem; width: auto; }
.theme-switch .btn { padding: .2rem .55rem; font-size: .78rem; }

/* ---------- content ---------- */
.content { padding: 1.35rem 1.6rem 2rem; min-width: 0; flex: 1 1 auto; }
@media (max-width: 575.98px) { .content { padding: 1rem .75rem 2rem; } }
.app-footer { padding: .8rem 1.6rem; font-size: .74rem; color: var(--zb-subtle); border-top: 1px solid var(--zb-border); display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.app-breadcrumb { font-size: .76rem; margin-bottom: .5rem; --bs-breadcrumb-divider-color: var(--zb-subtle); }
.app-breadcrumb a { color: var(--zb-muted); text-decoration: none; } .app-breadcrumb a:hover { color: var(--zb-primary); } .app-breadcrumb .active { color: var(--zb-text); }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: .75rem; flex-wrap: wrap; margin-bottom: 1.15rem; }
.page-title, .content > h4:first-of-type, .content > div:first-of-type > h4:first-child, .content > .d-flex:first-of-type h4 {
  font-size: 1.4rem; font-weight: 700; color: var(--zb-heading); margin: 0 0 .15rem; letter-spacing: -.02em; }
.page-subtitle { color: var(--zb-muted); margin: 0; font-size: .84rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.content > .d-flex:first-of-type { margin-bottom: 1rem !important; }

/* ---------- cards ---------- */
.card { --bs-card-bg: var(--zb-surface); --bs-card-border-color: var(--zb-border); --bs-card-cap-bg: var(--zb-surface); border-radius: var(--zb-radius); box-shadow: var(--zb-shadow-sm); }
.card > .card-header { background: var(--zb-surface); border-bottom-color: var(--zb-border); border-top-left-radius: var(--zb-radius); border-top-right-radius: var(--zb-radius);
  font-weight: 600; padding: .75rem 1.1rem; color: var(--zb-heading); }
.card-title-sm { font-size: .92rem; font-weight: 650; margin: 0; color: var(--zb-heading); }
.card-sub { font-size: .74rem; color: var(--zb-muted); font-weight: 400; }
.card > .table-responsive:first-child, .card > .table-responsive:first-child table { border-top-left-radius: var(--zb-radius); border-top-right-radius: var(--zb-radius); }
.card-stat .label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--zb-muted); font-weight: 600; }
.card-stat .value { font-size: 1.4rem; font-weight: 750; color: var(--zb-heading); }
.card-hover { transition: transform .15s, box-shadow .15s; } .card-hover:hover { transform: translateY(-2px); box-shadow: var(--zb-shadow); }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--zb-text); --bs-table-hover-bg: var(--zb-primary-50); --bs-table-striped-bg: var(--zb-surface-2);
  --bs-table-border-color: var(--zb-border); margin-bottom: 0; }
.table > thead th, .table-light th, .table > thead.table-light th { background: var(--zb-surface-2) !important; color: var(--zb-muted) !important; font-size: .68rem; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 650; border-bottom-color: var(--zb-border); position: sticky; top: 0; z-index: 2; }
.table-light { --bs-table-bg: var(--zb-surface-2); --bs-table-color: var(--zb-text); }
.card .table > tbody > tr:nth-of-type(even) > * { background-color: color-mix(in srgb, var(--zb-surface-2) 70%, transparent); }
.table > tbody > tr:hover > * { background-color: var(--zb-primary-50) !important; }
.table td { vertical-align: middle; border-color: var(--zb-border); }
.table-sm td, .table-sm th { white-space: nowrap; padding: .55rem .75rem; }
.table-scroll { max-height: 420px; overflow: auto; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td > a:not(.btn) { text-decoration: none; font-weight: 600; }
.table td > a:not(.btn):hover { text-decoration: underline; }
.cell-main { font-weight: 600; color: var(--zb-heading); } .cell-sub { font-size: .72rem; color: var(--zb-muted); }
.row-actions .btn { padding: .15rem .45rem; }

/* ---------- forms ---------- */
.form-control, .form-select { border-color: var(--zb-border-strong); border-radius: var(--zb-radius-sm); background-color: var(--zb-surface); color: var(--zb-text); }
.form-control:focus, .form-select:focus { border-color: var(--zb-primary); box-shadow: 0 0 0 .22rem rgba(67, 97, 238, .16); background-color: var(--zb-surface); color: var(--zb-heading); }
.form-control::placeholder { color: var(--zb-subtle); }
.form-label { font-weight: 550; color: var(--zb-text); font-size: .8rem; }
.input-group-text { background: var(--zb-surface-2); border-color: var(--zb-border-strong); color: var(--zb-muted); }
.form-card { max-width: 880px; }
.form-card .card-footer { background: var(--zb-surface-2); border-top-color: var(--zb-border); display: flex; gap: .5rem; justify-content: flex-end;
  border-bottom-left-radius: var(--zb-radius); border-bottom-right-radius: var(--zb-radius); position: sticky; bottom: 0; }
.invalid-feedback { display: block; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .8rem 1.1rem; border-bottom: 1px solid var(--zb-border); }
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 340px; }
.toolbar .search .bi { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--zb-subtle); }
.toolbar .search input { padding-left: 2.1rem; }
.modal-content { border-radius: 1rem; border-color: var(--zb-border); background: var(--zb-surface); box-shadow: var(--zb-shadow); }
.modal-header, .modal-footer { border-color: var(--zb-border); }
.nav-tabs { --bs-nav-tabs-border-color: var(--zb-border); --bs-nav-tabs-link-active-bg: var(--zb-surface); --bs-nav-tabs-link-active-border-color: var(--zb-border) var(--zb-border) var(--zb-surface); }
.pagination { --bs-pagination-bg: var(--zb-surface); --bs-pagination-border-color: var(--zb-border); --bs-pagination-active-bg: var(--zb-primary); --bs-pagination-active-border-color: var(--zb-primary); }
.list-group { --bs-list-group-bg: var(--zb-surface); --bs-list-group-border-color: var(--zb-border); --bs-list-group-color: var(--zb-text); }
.alert { border-radius: var(--zb-radius-sm); }

/* ---------- KPI cards ---------- */
.kpi-card { position: relative; display: flex; gap: .9rem; align-items: flex-start; background: var(--zb-surface); border: 1px solid var(--zb-border); border-radius: var(--zb-radius);
  padding: 1rem 1.05rem; height: 100%; box-shadow: var(--zb-shadow-sm); transition: box-shadow .15s, transform .15s; overflow: hidden; }
.kpi-card:hover { box-shadow: var(--zb-shadow); transform: translateY(-1px); }
.kpi-icon { width: 44px; height: 44px; border-radius: .8rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.kpi-body { min-width: 0; flex: 1 1 auto; }
.kpi-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--zb-muted); font-weight: 650; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kpi-value { font-size: clamp(1.15rem, 1.45vw, 1.55rem); font-weight: 750; color: var(--zb-heading); line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: -.02em; white-space: nowrap; }
.kpi-value .cur { font-size: .7em; font-weight: 600; opacity: .7; margin-right: .1em; }
.kpi-note { font-size: .72rem; color: var(--zb-muted); }
.kpi-foot { display: flex; align-items: center; gap: .4rem; margin-top: .3rem; flex-wrap: wrap; }
.kpi-spark { position: relative; width: 100%; height: 36px; margin-top: .5rem; } .kpi-spark canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.trend { display: inline-flex; align-items: center; gap: .15rem; font-size: .7rem; font-weight: 700; padding: .08rem .42rem; border-radius: 1rem; }
.trend.up { color: #15803d; background: rgba(34, 197, 94, .14); } .trend.down { color: #b91c1c; background: rgba(239, 68, 68, .13); } .trend.flat { color: var(--zb-muted); background: var(--zb-surface-2); }
[data-bs-theme="dark"] .trend.up { color: #4ade80; } [data-bs-theme="dark"] .trend.down { color: #f87171; }
.trend-vs { font-size: .68rem; color: var(--zb-subtle); }
.kpi-primary .kpi-icon { background: var(--zb-primary-50); color: var(--zb-primary); }
.kpi-success .kpi-icon { background: rgba(22, 163, 74, .12); color: #16a34a; }
.kpi-warning .kpi-icon { background: rgba(245, 158, 11, .14); color: #d97706; }
.kpi-danger .kpi-icon { background: rgba(239, 68, 68, .12); color: #dc2626; }
.kpi-info .kpi-icon { background: rgba(14, 165, 233, .12); color: #0284c7; }
.kpi-purple .kpi-icon { background: rgba(124, 58, 237, .12); color: #7c3aed; }
.kpi-teal .kpi-icon { background: rgba(14, 165, 164, .12); color: #0d9488; }
/* gradient (hero) variant */
.kpi-card.kpi-grad { border: 0; color: #fff; }
.kpi-card.kpi-grad .kpi-label, .kpi-card.kpi-grad .kpi-note, .kpi-card.kpi-grad .trend-vs { color: rgba(255, 255, 255, .78); }
.kpi-card.kpi-grad .kpi-value { color: #fff; }
.kpi-card.kpi-grad .kpi-icon { background: rgba(255, 255, 255, .18); color: #fff; }
.kpi-card.kpi-grad .trend.up, .kpi-card.kpi-grad .trend.down, .kpi-card.kpi-grad .trend.flat { background: rgba(255, 255, 255, .2); color: #fff; }
.kpi-card.kpi-grad::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(255, 255, 255, .09); }
.kpi-grad.kpi-primary { background: linear-gradient(135deg, #4361ee 0%, #6d4aff 100%); }
.kpi-grad.kpi-success { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.kpi-grad.kpi-info { background: linear-gradient(135deg, #0284c7 0%, #22d3ee 100%); }
.kpi-grad.kpi-purple { background: linear-gradient(135deg, #7c3aed 0%, #c026d3 100%); }
.kpi-grad.kpi-warning { background: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%); }
.kpi-grad.kpi-danger { background: linear-gradient(135deg, #dc2626 0%, #f43f5e 100%); }
.kpi-grad.kpi-teal { background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%); }

.alert-tile { display: flex; justify-content: space-between; align-items: center; background: var(--zb-surface); border: 1px solid var(--zb-border); border-left-width: 4px;
  border-radius: .7rem; padding: .7rem .95rem; text-decoration: none; color: var(--zb-text); box-shadow: var(--zb-shadow-sm); transition: background .15s; }
.alert-tile b { font-size: 1.15rem; color: var(--zb-heading); }
.alert-tile:hover { background: var(--zb-surface-2); color: var(--zb-heading); }
.alert-tile.t-danger { border-left-color: var(--zb-danger); } .alert-tile.t-warning { border-left-color: var(--zb-warning); } .alert-tile.t-info { border-left-color: var(--zb-info); }
.alert-tile.t-secondary { border-left-color: var(--zb-subtle); } .alert-tile.t-success { border-left-color: var(--zb-success); } .alert-tile.t-primary { border-left-color: var(--zb-primary); }

/* ---------- dashboard ---------- */
.dash-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.seg { display: inline-flex; background: var(--zb-surface); border: 1px solid var(--zb-border); border-radius: .65rem; padding: 3px; box-shadow: var(--zb-shadow-sm); }
.seg button, .seg a { border: 0; background: transparent; color: var(--zb-muted); font-size: .78rem; font-weight: 600; padding: .32rem .7rem; border-radius: .5rem; text-decoration: none; white-space: nowrap; }
.seg button:hover, .seg a:hover { color: var(--zb-heading); }
.seg .active { background: var(--zb-primary); color: #fff !important; box-shadow: 0 2px 6px rgba(67, 97, 238, .35); }
.dash-filters .form-control, .dash-filters .form-select { height: 36px; font-size: .8rem; }
.dash-custom { display: none; gap: .35rem; align-items: center; } .dash-custom.show { display: inline-flex; }
.chart-card .card-body { position: relative; }
.chart-box { position: relative; height: 290px; } .chart-box.sm { height: 230px; } .chart-box.lg { height: 330px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .74rem; color: var(--zb-muted); }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: .3rem; }
.heatmap { display: grid; grid-template-columns: 36px repeat(24, minmax(0, 1fr)); gap: 3px; font-size: .62rem; color: var(--zb-subtle); }
.heatmap .hm-cell { aspect-ratio: 1 / 1; border-radius: 3px; background: var(--zb-surface-2); min-height: 10px; }
.heatmap .hm-lbl { display: flex; align-items: center; } .heatmap .hm-hr { text-align: left; white-space: nowrap; overflow: visible; }
#centre-table td:first-child { white-space: normal; min-width: 150px; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px dashed var(--zb-border); }
.rank-list li:last-child { border-bottom: 0; }
.rank-no { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700; background: var(--zb-primary-50); color: var(--zb-primary); }
.rank-bar { height: 5px; border-radius: 3px; background: var(--zb-surface-2); overflow: hidden; margin-top: .25rem; }
.rank-bar span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--zb-primary), var(--zb-accent)); }
.welcome-card { background: linear-gradient(120deg, #1e2a78 0%, #4361ee 55%, #7c3aed 100%); color: #fff; border: 0; position: relative; overflow: hidden; }
.welcome-card h2, .welcome-card h3, .welcome-card h5 { color: #fff; }
.welcome-card::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.welcome-card .btn-light { --bs-btn-bg: #fff; --bs-btn-color: #2b41ad; --bs-btn-border-color: #fff; }
.mini-stat { display: flex; flex-direction: column; } .mini-stat b { font-size: 1.05rem; color: var(--zb-heading); font-variant-numeric: tabular-nums; } .mini-stat span { font-size: .7rem; color: var(--zb-muted); }
.welcome-card .mini-stat b { color: #fff; } .welcome-card .mini-stat span { color: rgba(255, 255, 255, .75); }
.health-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: .35rem; }
.health-dot.ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .2); } .health-dot.warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .2); }
.health-dot.bad { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.progress { --bs-progress-bg: var(--zb-surface-2); height: 6px; border-radius: 4px; }
.live-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .68rem; font-weight: 700; color: #16a34a; background: rgba(34, 197, 94, .12); padding: .12rem .5rem; border-radius: 1rem; }
.live-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); } 70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

/* skeleton loaders */
.skeleton { position: relative; overflow: hidden; background: var(--zb-surface-2); border-radius: .5rem; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--zb-surface) 70%, transparent), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.is-loading .chart-box canvas { opacity: 0; }
.chart-box .skeleton { position: absolute; inset: 0; }
.chart-box:not(.is-loading) .skeleton { display: none; }
.chart-empty { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; color: var(--zb-subtle); font-size: .82rem; }
.chart-box.is-empty .chart-empty { display: flex; } .chart-box.is-empty canvas { opacity: 0; }

/* ---------- status badges ---------- */
.status-badge { display: inline-flex; align-items: center; gap: .32rem; padding: .2rem .62rem; border-radius: 2rem; font-size: .7rem; font-weight: 650; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-success { background: rgba(34, 197, 94, .13); color: #15803d; } .status-warning { background: rgba(245, 158, 11, .15); color: #b45309; }
.status-danger { background: rgba(239, 68, 68, .12); color: #b91c1c; } .status-info { background: rgba(14, 165, 233, .13); color: #0369a1; }
.status-secondary { background: var(--zb-surface-2); color: var(--zb-muted); border: 1px solid var(--zb-border); } .status-primary { background: var(--zb-primary-50); color: var(--zb-primary-600); }
[data-bs-theme="dark"] .status-success { color: #4ade80; } [data-bs-theme="dark"] .status-warning { color: #fbbf24; } [data-bs-theme="dark"] .status-danger { color: #f87171; } [data-bs-theme="dark"] .status-info { color: #38bdf8; }
.badge { font-weight: 600; letter-spacing: .01em; }

/* ---------- empty states ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--zb-muted); }
.empty-icon { width: 60px; height: 60px; margin: 0 auto .8rem; border-radius: 18px; background: var(--zb-primary-50); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--zb-primary); }
.empty-title { font-weight: 650; color: var(--zb-heading); } .empty-hint { font-size: .8rem; }

/* ---------- toasts ---------- */
.app-toast { border: 0; border-radius: .75rem; box-shadow: 0 14px 34px rgba(15, 23, 42, .22); color: #fff; }
.toast-success { background: #16a34a; } .toast-danger, .toast-error { background: #dc2626; } .toast-warning { background: #d97706; } .toast-info, .toast-debug { background: #1e293b; }
.app-toast .btn-close { filter: invert(1) grayscale(1) brightness(2); }

/* ---------- POS billing ---------- */
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1rem; align-items: start; }
@media (max-width: 1199.98px) { .pos-grid { grid-template-columns: 1fr; } }
.pos-totals { position: sticky; top: 78px; }
.pos-net { background: linear-gradient(135deg, #0f172a, #1e2a78 70%, #4361ee); color: #fff; border-radius: var(--zb-radius); padding: 1.05rem 1.15rem; margin-bottom: .75rem; box-shadow: var(--zb-shadow); }
.pos-net .lbl { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #a5b4fc; }
.pos-net .amt { font-size: 2.5rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pos-net .sub { display: flex; justify-content: space-between; font-size: .78rem; color: #c7d2fe; margin-top: .35rem; }
.pos-balance { font-size: 1.15rem; font-weight: 700; }
.pos-balance.due { color: var(--zb-danger); } .pos-balance.change { color: var(--zb-success); }
.tender-row .input-group-text { width: 108px; font-weight: 500; }
.tender-row input.tender { font-weight: 600; font-variant-numeric: tabular-nums; }
.pos-keys { display: flex; flex-wrap: wrap; gap: .35rem .75rem; font-size: .74rem; color: var(--zb-muted); }
.pos-keys kbd { background: var(--zb-surface-2); color: var(--zb-text); border: 1px solid var(--zb-border); font-size: .68rem; box-shadow: none; }
.bill-lines td input { min-width: 80px; }
.bill-lines tbody tr:last-child > * { background: color-mix(in srgb, #fde68a 25%, transparent) !important; }
.btn-pos-save { font-size: 1.1rem; font-weight: 700; padding: .75rem; }

/* ---------- auth layout ---------- */
body.auth { min-height: 100vh; background: var(--zb-bg); }
.auth-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; color: var(--zb-heading); text-decoration: none; margin: 1.5rem 0 .5rem; }
.auth-brand small { color: var(--zb-subtle); font-weight: 600; letter-spacing: .2em; font-size: .62rem; }
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
@media (max-width: 991.98px) { .auth-split { grid-template-columns: 1fr; } .auth-art { display: none !important; } }
.auth-art { position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(900px 500px at 0% 0%, rgba(124, 58, 237, .55), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(14, 165, 164, .45), transparent 60%), linear-gradient(135deg, #0f172a, #1e2a78); }
.auth-art h1 { color: #fff; font-size: 2.3rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; }
.auth-art p { color: rgba(255, 255, 255, .78); }
.auth-art .grid-bg { position: absolute; inset: 0; opacity: .14; background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px);
  background-size: 42px 42px; mask-image: radial-gradient(circle at 30% 30%, #000, transparent 70%); }
.auth-feature { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; }
.auth-feature i { width: 38px; height: 38px; border-radius: 11px; background: rgba(255, 255, 255, .12); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.auth-feature b { display: block; color: #fff; } .auth-feature span { color: rgba(255, 255, 255, .72); font-size: .84rem; }
.auth-glass { position: relative; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 1rem; padding: 1rem 1.1rem; backdrop-filter: blur(6px); max-width: 380px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--zb-surface); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-weight: 800; letter-spacing: -.03em; }
.auth-card .form-control { height: 46px; }
.auth-card .input-icon { position: relative; } .auth-card .input-icon > .bi { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--zb-subtle); }
.auth-card .input-icon .form-control { padding-left: 2.5rem; }
.auth-card .pw-toggle { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--zb-subtle); padding: .3rem .5rem; }

.flash { animation: flash 1.2s; }
@keyframes flash { from { background: rgba(250, 204, 21, .35); } to { background: transparent; } }
.has-error .form-control, .has-error .form-select { border-color: var(--zb-danger); }
.matrix .table-group td { background: var(--zb-surface-2); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--zb-text); }
.matrix td .form-check-input { width: 1.15em; height: 1.15em; cursor: pointer; }
.form-check-input:checked { background-color: var(--zb-primary); border-color: var(--zb-primary); }
@media (max-width: 575.98px) { .kpi-icon { width: 36px; height: 36px; font-size: 1.05rem; } .kpi-card { padding: .8rem; gap: .6rem; } .page-title { font-size: 1.2rem; } .seg button, .seg a { padding: .3rem .5rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- print ---------- */
@media print {
  .no-print, .app-sidebar, .app-header, .app-breadcrumb, .app-footer, .dash-filters, .toast-container { display: none !important; }
  .content-area { margin-left: 0 !important; } .content { padding: 0 !important; }
  body, [data-bs-theme="dark"] body { background: #fff !important; color: #000 !important; }
  .card, .kpi-card { box-shadow: none !important; border-color: #ccc !important; break-inside: avoid; }
  .kpi-card.kpi-grad { background: #fff !important; color: #000 !important; border: 1px solid #ccc !important; }
  .kpi-card.kpi-grad .kpi-value, .kpi-card.kpi-grad .kpi-label { color: #000 !important; }
  .table > thead th { position: static; }
}
