/* ==========================================================================
   Zee Pharmaceuticals ERP — App shell, navigation, page furniture, charts, POS
   ========================================================================== */

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

.shell { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* -------------------------------------------------------------- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: width var(--dur-3) var(--ease);
  z-index: var(--z-topbar);
}
.shell.collapsed .sidebar { width: var(--sidebar-w-collapsed); }

.brand {
  display: flex; align-items: center; gap: var(--sp-3);
  height: var(--topbar-h); padding: 0 var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0; overflow: hidden;
}
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-md);
  background: linear-gradient(140deg, var(--brand-400), var(--brand-600));
  display: grid; place-items: center; color: #fff; flex-shrink: 0;
  box-shadow: var(--sh-xs);
}
.brand-mark svg { width: 17px; height: 17px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text .nm { font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: -0.02em; color: var(--ink); line-height: 1.15; }
.brand-text .sb { font-size: var(--fs-2xs); color: var(--ink-muted); letter-spacing: 0.05em; text-transform: uppercase; font-weight: var(--fw-medium); }
.shell.collapsed .brand-text { display: none; }

.scope-switch {
  margin: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-3);
  cursor: pointer; text-align: left; width: calc(100% - var(--sp-6));
  transition: all var(--dur-1) var(--ease);
}
.scope-switch:hover { border-color: var(--border-strong); background: var(--surface-3); }
.scope-switch .sw-mark {
  width: 26px; height: 26px; border-radius: var(--r-sm);
  display: grid; place-items: center; flex-shrink: 0;
  font-size: var(--fs-2xs); font-weight: var(--fw-bold);
  background: var(--brand-500); color: var(--ink-on-brand);
}
/* These bodies are <span>s holding two <span>s. Without an explicit block
   context the two lines run together on one line. */
.scope-switch .sw-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.scope-switch .sw-nm { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-switch .sw-sb { font-size: var(--fs-2xs); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scope-switch > svg { width: 14px; height: 14px; color: var(--ink-muted); flex-shrink: 0; }
.shell.collapsed .scope-switch { padding: var(--sp-2); justify-content: center; margin: var(--sp-3) auto; width: 44px; }
.shell.collapsed .scope-switch .sw-body, .shell.collapsed .scope-switch > svg { display: none; }

.nav { flex: 1; overflow-y: auto; padding: var(--sp-2) var(--sp-3) var(--sp-6); }
.nav-section { margin-top: var(--sp-4); }
.nav-section:first-child { margin-top: 0; }
.nav-label {
  font-size: var(--fs-2xs); font-weight: var(--fw-semi);
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-muted); padding: var(--sp-3) var(--sp-3) var(--sp-2);
}
.shell.collapsed .nav-label { text-align: center; font-size: 8px; padding: var(--sp-3) 0 var(--sp-2); letter-spacing: 0; }

.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  height: 32px; padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  font-size: var(--fs-md); font-weight: var(--fw-medium);
  color: var(--ink-2); cursor: pointer; width: 100%;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
  position: relative; text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-muted); }
.nav-item .lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item.active { background: var(--brand-50); color: var(--brand-700); }
.nav-item.active svg { color: var(--brand-500); }
.nav-item .nav-count {
  font-size: var(--fs-2xs); font-weight: var(--fw-semi);
  background: var(--surface-3); color: var(--ink-3);
  padding: 1px 6px; border-radius: var(--r-full); min-width: 18px; text-align: center;
}
.nav-item.active .nav-count { background: var(--brand-100); color: var(--brand-700); }
.nav-item .nav-count.alert { background: var(--critical-bg); color: var(--critical-ink); }
.shell.collapsed .nav-item { justify-content: center; padding: 0; }
.shell.collapsed .nav-item .lbl, .shell.collapsed .nav-item .nav-count { display: none; }

.sidebar-foot {
  border-top: 1px solid var(--border-subtle);
  padding: var(--sp-3);
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: var(--sp-2);
}
.user-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2); border-radius: var(--r-md);
  cursor: pointer; width: 100%; text-align: left;
}
.user-row:hover { background: var(--surface-3); }
.user-row > svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--ink-muted); }
.user-row .u-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.user-row .u-nm { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-row .u-rl { font-size: var(--fs-2xs); color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shell.collapsed .user-row { justify-content: center; }
.shell.collapsed .user-row .u-body, .shell.collapsed .sidebar-foot .btn .lbl { display: none; }

/* --------------------------------------------------------------- Main ----- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0 var(--sp-5);
  z-index: var(--z-topbar);
}
.topbar-search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: var(--sp-3);
  height: 32px; padding: 0 var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--ink-muted); font-size: var(--fs-md);
  cursor: pointer; transition: all var(--dur-1) var(--ease);
}
.topbar-search:hover { border-color: var(--border-strong); background: var(--surface-3); }
.topbar-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.topbar-search .ph { flex: 1; text-align: left; }

.crumbs { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); color: var(--ink-3); min-width: 0; }
.crumbs .sep { color: var(--border-strong); }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.crumbs .cur { color: var(--ink); font-weight: var(--fw-medium); }

.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-md);
  display: grid; place-items: center;
  color: var(--ink-3); position: relative;
  transition: all var(--dur-1) var(--ease);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn .dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--critical); border: 1.5px solid var(--surface);
}

/* ------------------------------------------------------------- Page ------- */
.page { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page-inner { max-width: var(--content-max); margin: 0 auto; padding: var(--sp-6) var(--sp-7) var(--sp-9); }
.page-inner-wide { max-width: none; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-5); margin-bottom: var(--sp-6); flex-wrap: wrap;
}
.page-head h1 { font-size: var(--fs-2xl); font-weight: var(--fw-semi); letter-spacing: -0.021em; line-height: 1.2; }
.page-head .page-sub { font-size: var(--fs-md); color: var(--ink-3); margin-top: var(--sp-2); max-width: 72ch; }
.page-actions { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-4);
}
.section-head h2 { font-size: var(--fs-lg); font-weight: var(--fw-semi); letter-spacing: -0.012em; }
.section-head .sub { font-size: var(--fs-sm); color: var(--ink-3); }

.toolbar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; margin-bottom: var(--sp-5);
}
.toolbar .grow-search { flex: 1 1 220px; max-width: 340px; }

/* ---- Named two-column splits (collapse together, unlike ad-hoc inline grids) */
.grid-split { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }
.grid-rail  { grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); }
.grid-rail-narrow { grid-template-columns: minmax(0, 1fr) minmax(0, 340px); }
@media (max-width: 1100px) {
  .grid-split, .grid-rail, .grid-rail-narrow { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------- Charts --- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--sp-4); margin-bottom: var(--sp-4);
}
.chart-legend { margin-top: var(--sp-4); }
.chart-hit { cursor: crosshair; }
.chart-crosshair { stroke: var(--axis); stroke-width: 1; pointer-events: none; }
.chart-grid line { stroke: var(--grid); stroke-width: 1; }
.chart-axis text { fill: var(--axis-ink); font-size: 10.5px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart-baseline { stroke: var(--axis); stroke-width: 1; }
.chart-label { fill: var(--ink-2); font-size: 10.5px; font-weight: 600; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart-label-inv { fill: #fff; font-size: 10.5px; font-weight: 600; font-family: var(--font-sans); }
.chart-table-toggle { font-size: var(--fs-xs); color: var(--ink-3); }
.chart-table { margin-top: var(--sp-4); border-top: 1px solid var(--border-subtle); padding-top: var(--sp-3); max-height: 260px; overflow-y: auto; }
.chart-scroll { overflow-x: auto; overflow-y: hidden; }
.spark { display: block; width: 100%; height: 30px; overflow: visible; }

/* --------------------------------------------------- Branch network page -- */
.net {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  background: var(--canvas);
}
.net-inner { max-width: 1480px; margin: 0 auto; padding: var(--sp-6) var(--sp-7) var(--sp-10); }

.net-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-5); padding: var(--sp-3) 0 var(--sp-8); flex-wrap: wrap;
}
.net-hero { display: flex; flex-direction: column; gap: var(--sp-4); margin-bottom: var(--sp-8); }
.net-hero h1 {
  font-size: clamp(30px, 4.2vw, 46px);
  font-weight: var(--fw-semi); letter-spacing: -0.032em; line-height: 1.04;
  max-width: 20ch;
}
.net-hero p { font-size: var(--fs-lg); color: var(--ink-3); max-width: 62ch; line-height: 1.5; }

.net-kpis {
  display: grid; gap: var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: var(--sp-8);
}

.hq-card {
  position: relative;
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  background: linear-gradient(145deg, var(--brand-700), var(--brand-900) 70%);
  color: #fff;
  box-shadow: var(--sh-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
  display: flex; flex-direction: column; gap: var(--sp-5);
  border: 1px solid color-mix(in srgb, #fff 12%, transparent);
}
.hq-card::after {
  content: ""; position: absolute; inset: -40% -10% auto auto;
  width: 340px; height: 340px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.14), transparent 62%);
  pointer-events: none;
}
.hq-card:hover { transform: translateY(-2px); box-shadow: var(--sh-xl); }
.hq-card .hq-tag {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-2xs); font-weight: var(--fw-semi); letter-spacing: 0.09em;
  text-transform: uppercase; color: rgba(255,255,255,0.78);
}
.hq-card h2 { font-size: var(--fs-2xl); font-weight: var(--fw-semi); letter-spacing: -0.022em; }
.hq-card .hq-sub { font-size: var(--fs-md); color: rgba(255,255,255,0.72); }
.hq-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-5); }
.hq-metric .m-lbl { font-size: var(--fs-2xs); color: rgba(255,255,255,0.66); text-transform: uppercase; letter-spacing: 0.07em; font-weight: var(--fw-semi); }
.hq-metric .m-val { font-size: var(--fs-xl); font-weight: var(--fw-semi); letter-spacing: -0.018em; margin-top: 2px; }

.branch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(298px, 1fr));
  gap: var(--sp-4);
}

.branch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  box-shadow: var(--sh-sm);
  display: flex; flex-direction: column; gap: var(--sp-4);
  cursor: pointer; text-align: left;
  transition: transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
  position: relative; overflow: hidden;
}
.branch-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: var(--status-color, var(--border-strong));
  transition: width var(--dur-2) var(--ease);
}
.branch-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
  border-color: var(--border-strong);
}
.branch-card:hover::before { width: 4px; }
.branch-card-top { display: flex; align-items: flex-start; gap: var(--sp-3); }
.branch-code {
  width: 38px; height: 38px; border-radius: var(--r-md);
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--surface-3); color: var(--ink-2);
  font-size: var(--fs-2xs); font-weight: var(--fw-bold); letter-spacing: 0.02em;
}
.branch-card .b-nm { font-size: var(--fs-base); font-weight: var(--fw-semi); color: var(--ink); letter-spacing: -0.01em; line-height: 1.25; }
.branch-card .b-loc { font-size: var(--fs-xs); color: var(--ink-3); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.branch-card .b-loc svg { width: 11px; height: 11px; }
.branch-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.branch-metrics .bm-lbl { font-size: var(--fs-2xs); color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: var(--fw-semi); }
.branch-metrics .bm-val { font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 1px; }
.branch-flags { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.branch-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); padding-top: var(--sp-3);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--fs-xs); color: var(--ink-3);
}

.net-filters {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap; margin-bottom: var(--sp-5);
  position: sticky; top: 0; z-index: var(--z-sticky);
  padding: var(--sp-4) 0;
  background: linear-gradient(var(--canvas) 72%, transparent);
}

/* --------------------------------------------------------------- Map ------ */
.geo-map { position: relative; width: 100%; aspect-ratio: 4 / 3.1; }
.geo-map svg { width: 100%; height: 100%; }
.geo-outline { fill: color-mix(in srgb, var(--brand-500) 7%, var(--surface-2)); stroke: var(--border-strong); stroke-width: 1.2; }
.geo-node { cursor: pointer; transition: opacity var(--dur-1) var(--ease); }
.geo-node:hover { opacity: 0.82; }
.geo-node .halo { fill: none; stroke-width: 1.5; opacity: 0.35; }
.geo-lake { fill: color-mix(in srgb, var(--series-1) 16%, var(--surface-2)); stroke: none; }
.geo-label { fill: var(--ink-3); font-size: 8.5px; font-family: var(--font-sans); pointer-events: none; }

/* ------------------------------------------------------------------ POS --- */
.pos {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: var(--sp-5);
  height: 100%;
  min-height: 0;
}
.pos-left { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 0; }
.pos-search-wrap { position: relative; }
.pos-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  max-height: 340px; overflow-y: auto; z-index: var(--z-sticky);
  padding: var(--sp-2);
}
.pos-result {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md); cursor: pointer;
  width: 100%; text-align: left;
}
.pos-result:hover, .pos-result[aria-selected="true"] { background: var(--brand-50); }
.pos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--sp-3); overflow-y: auto; padding: 2px; align-content: start;
}
.pos-tile {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); padding: var(--sp-3);
  text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: var(--sp-2);
  transition: all var(--dur-1) var(--ease); min-height: 92px;
}
.pos-tile:hover { border-color: var(--brand-300); box-shadow: var(--sh-sm); transform: translateY(-1px); }
.pos-tile:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.pos-tile .pt-nm { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); line-height: 1.25; }
.pos-tile .pt-sub { font-size: var(--fs-2xs); color: var(--ink-muted); }
.pos-tile .pt-price { font-size: var(--fs-md); font-weight: var(--fw-semi); color: var(--brand-600); margin-top: auto; font-variant-numeric: tabular-nums; }

.pos-cart {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  min-height: 0; overflow: hidden;
}
.pos-cart-items { flex: 1; overflow-y: auto; min-height: 120px; }
.pos-line {
  display: grid; grid-template-columns: 1fr auto;
  gap: var(--sp-2) var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}
.pos-line .pl-nm { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink); }
.pos-line .pl-sub { font-size: var(--fs-2xs); color: var(--ink-muted); }
.pos-line .pl-amt { font-size: var(--fs-md); font-weight: var(--fw-semi); font-variant-numeric: tabular-nums; text-align: right; }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-sm); height: 24px; overflow: hidden; }
.qty-stepper button { width: 22px; height: 100%; display: grid; place-items: center; color: var(--ink-3); }
.qty-stepper button:hover { background: var(--surface-3); color: var(--ink); }
.qty-stepper svg { width: 11px; height: 11px; }
.qty-stepper input {
  width: 34px; height: 100%; border: 0; text-align: center;
  font-size: var(--fs-sm); font-variant-numeric: tabular-nums;
  background: transparent; outline: none;
  border-left: 1px solid var(--border-subtle); border-right: 1px solid var(--border-subtle);
}
.pos-totals { padding: var(--sp-4); border-top: 1px solid var(--border); background: var(--surface-2); }
.pos-total-row { display: flex; justify-content: space-between; font-size: var(--fs-md); color: var(--ink-3); padding: 3px 0; }
.pos-total-row.grand { font-size: var(--fs-xl); font-weight: var(--fw-semi); color: var(--ink); padding-top: var(--sp-3); margin-top: var(--sp-2); border-top: 1px solid var(--border); }
.pos-total-row .v { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.pos-total-row.grand .v { color: var(--ink); }
.pay-methods { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.pay-method {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: var(--sp-3) var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-md);
  font-size: var(--fs-2xs); font-weight: var(--fw-medium); color: var(--ink-3);
  cursor: pointer; transition: all var(--dur-1) var(--ease);
}
.pay-method svg { width: 16px; height: 16px; }
.pay-method:hover { border-color: var(--border-strong); color: var(--ink); }
.pay-method[aria-pressed="true"] { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }

/* -------------------------------------------------------------- Receipt --- */
.receipt {
  background: #fff; color: #111;
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  padding: 16px; width: 300px; margin: 0 auto;
  border: 1px solid var(--border);
}
.receipt hr { border-top: 1px dashed #999; margin: 8px 0; }
.receipt .r-center { text-align: center; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 8px; }
.receipt .r-big { font-size: 13px; font-weight: 700; }
.receipt .qr { width: 74px; height: 74px; margin: 8px auto; display: block; image-rendering: pixelated; }

/* ------------------------------------------------------ Transfer console -- */
.transfer-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--sp-4); align-items: start; }
.tf-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; min-height: 180px; }
.tf-col-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border);
}
.tf-col-head .t { font-size: var(--fs-sm); font-weight: var(--fw-semi); color: var(--ink); display: flex; align-items: center; gap: var(--sp-2); }
.tf-col-head .t svg { width: 14px; height: 14px; color: var(--ink-3); }
.tf-col-body { padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); overflow-y: auto; max-height: 460px; }
.tf-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: var(--sp-3); box-shadow: var(--sh-xs); cursor: pointer;
  display: flex; flex-direction: column; gap: var(--sp-2);
  transition: all var(--dur-1) var(--ease); text-align: left;
}
.tf-card:hover { border-color: var(--brand-300); box-shadow: var(--sh-sm); }
.tf-route { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--ink); }
.tf-route svg { width: 12px; height: 12px; color: var(--ink-muted); flex-shrink: 0; }
.tf-meta { font-size: var(--fs-2xs); color: var(--ink-muted); display: flex; justify-content: space-between; gap: var(--sp-2); }

.flow-arrow { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-sm); }
.flow-arrow svg { width: 13px; height: 13px; color: var(--ink-muted); }

/* ============================================================== Documents == */
/* One visual system for every printable artefact the company issues: sales
   invoice, purchase invoice, payment receipt, payment voucher. Ink on paper —
   these are deliberately fixed light, because they print. */

.doc-wrap { display: flex; justify-content: center; }
.doc {
  width: 100%;
  max-width: 840px;
  background: #ffffff;
  color: #10161e;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  overflow: hidden;
  position: relative;
}
.doc-accent { height: 6px; background: linear-gradient(90deg, var(--brand-500), var(--brand-300) 55%, var(--brand-600)); }
.doc-body { padding: var(--sp-8); }

/* ---- letterhead ---------------------------------------------------------- */
.doc-head { display: flex; justify-content: space-between; gap: var(--sp-6); align-items: flex-start; }
.doc-brand { display: flex; gap: var(--sp-4); align-items: flex-start; min-width: 0; }
.doc-mark {
  width: 46px; height: 46px; border-radius: 11px; flex-shrink: 0;
  background: linear-gradient(140deg, #2ba184, #0a6552);
  display: grid; place-items: center; color: #fff;
}
.doc-mark svg { width: 26px; height: 26px; }
.doc-org .o-nm { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.doc-org .o-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: #0a6552; margin-top: 3px;
}
.doc-org .o-line { font-size: 11.5px; color: #46505d; line-height: 1.6; margin-top: 8px; }

.doc-ident { text-align: right; flex-shrink: 0; }
.doc-type {
  font-size: 19px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: #0a6552;
}
.doc-no {
  display: inline-block; margin-top: 6px; padding: 5px 12px;
  border: 1.5px solid #10161e; border-radius: 5px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
}
.doc-ident .o-line { font-size: 11.5px; color: #46505d; margin-top: 8px; line-height: 1.6; }

.doc-rule { height: 2px; background: #10161e; margin: var(--sp-6) 0; }

/* ---- parties ------------------------------------------------------------- */
.doc-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-5); }
.doc-party { padding: var(--sp-4); background: #f4faf8; border-left: 3px solid #0d7a63; border-radius: 0 5px 5px 0; }
.doc-party h5 {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: #0a6552; margin-bottom: 5px;
}
.doc-party .p-nm { font-size: 14.5px; font-weight: 700; line-height: 1.3; }
.doc-party .p-line { font-size: 11.5px; color: #46505d; line-height: 1.6; }

/* ---- meta strip ---------------------------------------------------------- */
.doc-meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  border: 1px solid #dbe7e2; border-radius: 6px; overflow: hidden; margin-top: var(--sp-5);
}
.doc-meta > div { padding: var(--sp-3) var(--sp-4); border-right: 1px solid #dbe7e2; }
.doc-meta > div:last-child { border-right: 0; }
.doc-meta .m-k {
  font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #57616e;
}
.doc-meta .m-v { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 3px; }
.doc-meta .m-v.due { color: #9b1f1f; }
.doc-meta .m-v.ok { color: #146c14; }

/* ---- lines --------------------------------------------------------------- */
table.doc-lines { width: 100%; border-collapse: collapse; margin-top: var(--sp-6); font-size: 12px; }
table.doc-lines thead th {
  background: #0a6552; color: #fff;
  text-align: left; padding: 9px var(--sp-3);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
}
table.doc-lines thead th:first-child { border-radius: 5px 0 0 0; }
table.doc-lines thead th:last-child { border-radius: 0 5px 0 0; }
table.doc-lines th.num, table.doc-lines td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.doc-lines tbody td { padding: 9px var(--sp-3); border-bottom: 1px solid #e6efec; vertical-align: top; }
table.doc-lines tbody tr:nth-child(even) td { background: #f8fcfb; }
table.doc-lines .l-nm { font-weight: 600; }
table.doc-lines .l-sub { font-size: 10px; color: #6a7482; margin-top: 1px; }
table.doc-lines .l-idx { color: #8b95a3; font-variant-numeric: tabular-nums; }

/* ---- totals -------------------------------------------------------------- */
.doc-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: var(--sp-6); margin-top: var(--sp-6); }
.doc-total-row {
  display: flex; justify-content: space-between; gap: var(--sp-5);
  padding: 6px 0; font-size: 12.5px; color: #46505d;
}
.doc-total-row .v { font-variant-numeric: tabular-nums; color: #10161e; font-weight: 600; }
.doc-total-row.sep { border-top: 1px solid #dbe7e2; margin-top: 5px; padding-top: 9px; }
.doc-total-row.grand {
  background: #0a6552; color: #fff; margin-top: 9px;
  padding: 11px var(--sp-4); border-radius: 6px;
  font-size: 15px; font-weight: 700;
}
.doc-total-row.grand .v { color: #fff; font-weight: 700; }
.doc-total-row.due { color: #9b1f1f; font-weight: 700; }
.doc-total-row.due .v { color: #9b1f1f; }

/* ---- amount in words ----------------------------------------------------- */
.doc-words {
  margin-top: var(--sp-5); padding: var(--sp-4);
  border: 1px dashed #a9d0c2; border-radius: 6px; background: #f4faf8;
}
.doc-words .w-k {
  font-size: 9px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase; color: #0a6552;
}
.doc-words .w-v { font-size: 13px; font-weight: 600; margin-top: 3px; line-height: 1.45; }

/* ---- settlement / payment instructions ----------------------------------- */
.doc-panel { margin-top: var(--sp-5); padding: var(--sp-4); border: 1px solid #dbe7e2; border-radius: 6px; }
.doc-panel h5 {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.11em; text-transform: uppercase;
  color: #0a6552; margin-bottom: var(--sp-3);
}
.doc-paygrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--sp-4); }
.doc-paygrid .pg-k { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em; color: #57616e; font-weight: 700; }
.doc-paygrid .pg-v { font-size: 12px; font-weight: 600; margin-top: 2px; }

.doc-settled { display: flex; flex-direction: column; gap: 5px; }
.doc-settled-row {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  font-size: 12px; padding: 5px 0; border-bottom: 1px solid #eef4f2;
}
.doc-settled-row:last-child { border-bottom: 0; }
.doc-settled-row .s-v { font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---- signature & footer -------------------------------------------------- */
.doc-sign { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-8); margin-top: var(--sp-8); }
.doc-sign-block { display: flex; flex-direction: column; gap: 4px; }
.doc-sign-line { border-bottom: 1px solid #10161e; height: 34px; }
.doc-sign-k { font-size: 10px; color: #57616e; font-weight: 600; }

.doc-foot {
  margin-top: var(--sp-7); padding-top: var(--sp-4); border-top: 1px solid #dbe7e2;
  display: flex; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap;
  font-size: 10.5px; color: #57616e; line-height: 1.65;
}
.doc-fiscal { text-align: right; display: flex; gap: var(--sp-4); align-items: flex-start; }
.doc-fiscal .fdn { font-family: var(--font-mono); font-weight: 700; color: #10161e; }
.doc-qr { width: 72px; height: 72px; flex-shrink: 0; }

.doc-stamp {
  position: absolute; top: 132px; right: 54px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 16px; border: 3px solid currentColor; border-radius: 7px;
  font-size: 15px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase;
  transform: rotate(-9deg); opacity: 0.85; pointer-events: none;
}
.doc-stamp svg { width: 17px; height: 17px; }
.doc-stamp.paid { color: #146c14; }
.doc-stamp.overdue { color: #9b1f1f; }
.doc-stamp.void { color: #57616e; }

@media (max-width: 720px) {
  .doc-body { padding: var(--sp-5); }
  .doc-head, .doc-parties, .doc-summary, .doc-sign { grid-template-columns: minmax(0, 1fr); flex-direction: column; }
  .doc-ident { text-align: left; }
  .doc-stamp { position: static; transform: none; margin-top: var(--sp-4); }
  table.doc-lines { font-size: 11px; }
}

/* ---- print portal --------------------------------------------------------- */
/* Printing clones the document into a portal and hides everything else, so the
   output never depends on which drawer or modal happened to be open. */
#doc-print-portal { display: none; }
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.printing > *:not(#doc-print-portal) { display: none !important; }
  body.printing #doc-print-portal { display: block !important; }
  body.printing { overflow: visible !important; height: auto !important; background: #fff !important; }
  #doc-print-portal .doc {
    max-width: none; border: 0; border-radius: 0; box-shadow: none;
  }
  #doc-print-portal .doc-body { padding: 0; }
  #doc-print-portal .doc-accent { margin-bottom: 10mm; }
  .doc { break-inside: auto; }
  table.doc-lines tbody tr { break-inside: avoid; }
  .doc-summary, .doc-sign, .doc-words { break-inside: avoid; }
}

/* ------------------------------------------------------------- Banking ---- */
.acct-card {
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--sh-sm);
  cursor: pointer; text-align: left; transition: all var(--dur-1) var(--ease);
}
.acct-card:hover { border-color: var(--brand-300); transform: translateY(-1px); box-shadow: var(--sh-md); }
.acct-card[aria-selected="true"] { border-color: var(--brand-500); background: var(--brand-50); }
.acct-card .a-top { display: flex; align-items: center; gap: var(--sp-3); }
.acct-card .a-ic {
  width: 32px; height: 32px; border-radius: var(--r-sm); flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
}
.acct-card .a-ic svg { width: 16px; height: 16px; }
.acct-card .a-nm { font-size: var(--fs-md); font-weight: var(--fw-semi); }
.acct-card .a-sb { font-size: var(--fs-2xs); color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.acct-card .a-bal { font-size: var(--fs-xl); font-weight: var(--fw-semi); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.alloc-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: var(--sp-3);
  align-items: center; padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.alloc-row:last-child { border-bottom: 0; }
.alloc-row input { width: 120px; text-align: right; }
.alloc-summary {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm);
  background: var(--surface-2); font-size: var(--fs-md); font-variant-numeric: tabular-nums;
}
.alloc-summary.over { background: var(--critical-bg); color: var(--critical-ink); }
.alloc-summary.left { background: var(--warning-bg); color: var(--warning-ink); }

.money-in  { color: var(--delta-up); font-variant-numeric: tabular-nums; }
.money-out { color: var(--delta-down); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Payslip ---- */
.payslip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sp-6); }
.payslip-head { display: flex; justify-content: space-between; gap: var(--sp-5); padding-bottom: var(--sp-4); border-bottom: 2px solid var(--ink); margin-bottom: var(--sp-5); }
.payslip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
.payslip-col h4 { font-size: var(--fs-sm); font-weight: var(--fw-semi); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: var(--sp-3); padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border); }

/* ------------------------------------------------- Attendance / calendar -- */
.att-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.att-cell {
  aspect-ratio: 1; border-radius: var(--r-xs);
  display: grid; place-items: center;
  font-size: var(--fs-2xs); font-variant-numeric: tabular-nums;
  color: var(--ink-3); background: var(--surface-3);
  cursor: default;
}
.att-cell.present { background: color-mix(in srgb, var(--good) 22%, var(--surface)); color: var(--good-ink); }
.att-cell.late    { background: color-mix(in srgb, var(--warning) 30%, var(--surface)); color: var(--warning-ink); }
.att-cell.absent  { background: color-mix(in srgb, var(--critical) 20%, var(--surface)); color: var(--critical-ink); }
.att-cell.leave   { background: color-mix(in srgb, var(--info) 20%, var(--surface)); color: var(--info-ink); }
.att-cell.off     { background: var(--surface-2); color: var(--ink-muted); }

.punch-clock {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-3);
  padding: var(--sp-6); border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--brand-600), var(--brand-800));
  color: #fff;
}
.punch-clock .time { font-size: var(--fs-4xl); font-weight: var(--fw-semi); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.punch-clock .date { font-size: var(--fs-sm); color: rgba(255,255,255,0.75); }

/* ------------------------------------------------------------ Heat / ABC -- */
.heat-row { display: flex; align-items: center; gap: var(--sp-3); }
.heat-cells { display: flex; gap: 2px; flex: 1; }
.heat-cell { flex: 1; height: 22px; border-radius: 2px; }

/* -------------------------------------------------------- Misc surfaces --- */
.tile-link {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4); border-radius: var(--r-md);
  border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; text-align: left; width: 100%;
  transition: all var(--dur-1) var(--ease);
}
.tile-link:hover { border-color: var(--brand-300); background: var(--surface-2); transform: translateY(-1px); box-shadow: var(--sh-sm); }
.tile-link .ic { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--brand-50); color: var(--brand-600); flex-shrink: 0; }
.tile-link .ic svg { width: 16px; height: 16px; }
.tile-link .tl-nm { font-size: var(--fs-md); font-weight: var(--fw-medium); color: var(--ink); }
.tile-link .tl-sb { font-size: var(--fs-xs); color: var(--ink-3); }

.alert-item {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer; transition: background var(--dur-1) var(--ease);
}
.alert-item:hover { background: var(--surface-2); }
.alert-item:last-child { border-bottom: 0; }
.alert-ic { width: 26px; height: 26px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.alert-ic svg { width: 13px; height: 13px; }
.alert-item .a-ttl { font-size: var(--fs-md); color: var(--ink); font-weight: var(--fw-medium); }
.alert-item .a-sub { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 1px; }
.alert-item .a-time { font-size: var(--fs-2xs); color: var(--ink-muted); white-space: nowrap; }

.stack-list > * + * { border-top: 1px solid var(--border-subtle); }

.rank-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0;
}
.rank-no {
  width: 20px; height: 20px; border-radius: var(--r-xs); flex-shrink: 0;
  display: grid; place-items: center; font-size: var(--fs-2xs);
  font-weight: var(--fw-bold); background: var(--surface-3); color: var(--ink-3);
}
.rank-row:nth-child(1) .rank-no { background: var(--brand-500); color: #fff; }

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.status-dot.live { animation: pulse-ring 2s infinite; }

/* -------------------------------------------------------------- Loading --- */
.boot {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--canvas); z-index: 999;
}
.boot-inner { display: flex; flex-direction: column; align-items: center; gap: var(--sp-5); }
.boot-bar { width: 180px; height: 3px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.boot-bar > i { display: block; height: 100%; width: 40%; background: var(--brand-500); border-radius: inherit; animation: boot-slide 1.1s var(--ease) infinite; }
@keyframes boot-slide { 0% { transform: translateX(-105%); } 100% { transform: translateX(355%); } }

/* ----------------------------------------------------------- Responsive --- */

/* The scrim sits under the off-canvas sidebar so a tap outside closes it.
   Rendered always; only visible once the shell opens the nav. */
.nav-scrim {
  position: fixed; inset: 0;
  background: rgba(10, 16, 22, 0.42);
  z-index: calc(var(--z-topbar) - 1);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur-2) var(--ease);
}
.shell.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
@media (min-width: 1025px) { .nav-scrim { display: none; } }

@media (max-width: 1280px) {
  .pos { grid-template-columns: minmax(0, 1fr) 340px; }
}

/* ---- Tablet: the sidebar leaves the flow and slides over ------------------ */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(var(--sidebar-w), 84vw);
    transform: translateX(-100%);
    transition: transform var(--dur-3) var(--ease);
    box-shadow: var(--sh-xl);
  }
  .shell.nav-open .sidebar { transform: none; }
  /* Collapsed-rail mode is a desktop affordance; off-canvas is always full. */
  .shell.collapsed .sidebar { width: min(var(--sidebar-w), 84vw); }
  .shell.collapsed .sidebar .brand-text,
  .shell.collapsed .sidebar .sw-body,
  .shell.collapsed .sidebar .scope-switch > svg,
  .shell.collapsed .sidebar .nav-item .lbl,
  .shell.collapsed .sidebar .nav-item .nav-count,
  .shell.collapsed .sidebar .u-body,
  .shell.collapsed .sidebar .btn .lbl { display: unset; }
  .shell.collapsed .sidebar .scope-switch { padding: var(--sp-3); justify-content: flex-start; margin: var(--sp-3); width: calc(100% - var(--sp-6)); }
  .shell.collapsed .sidebar .nav-item { justify-content: flex-start; padding: 0 var(--sp-3); }
  .shell.collapsed .sidebar .user-row { justify-content: flex-start; }

  .pos { grid-template-columns: minmax(0, 1fr); }
  .pos-cart { max-height: none; }
  .payslip-grid { grid-template-columns: 1fr; }
  .transfer-board { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
}

/* ---- Narrow: compact the topbar so it never overflows --------------------- */
@media (max-width: 860px) {
  .crumbs { display: none; }                 /* the page header carries context */
  .topbar { padding: 0 var(--sp-4); gap: var(--sp-2); }
  .topbar-search { max-width: none; }
  .topbar-search .ph, .topbar-search kbd { display: none; }
  .topbar-search {
    flex: 0 0 auto; width: 34px; padding: 0; justify-content: center;
    margin-left: auto;
  }
  .page-head { gap: var(--sp-4); }
  .page-head h1 { font-size: var(--fs-xl); }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .card-head { flex-wrap: wrap; }
  .table-toolbar { gap: var(--sp-2); }
  .table-toolbar .input-group { max-width: none; flex: 1 1 100%; }
}

/* ---- Phone ---------------------------------------------------------------- */
@media (max-width: 720px) {
  .page-inner { padding: var(--sp-5) var(--sp-4) var(--sp-9); }
  .net-inner { padding: var(--sp-4) var(--sp-4) var(--sp-9); }
  .net-top { padding-bottom: var(--sp-6); }
  .net-hero p { font-size: var(--fs-base); }
  .net-kpis { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: var(--sp-3); }
  .net-filters { padding: var(--sp-3) 0; }
  .branch-grid { grid-template-columns: 1fr; }
  .hq-card { padding: var(--sp-5); }
  .hq-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }

  .card-body { padding: var(--sp-4); }
  .card-head { padding: var(--sp-4); }
  .stat { padding: var(--sp-4); }
  .stat-value { font-size: var(--fs-xl); }

  /* A squashed table is unreadable — let it keep column widths and scroll. */
  .table-wrap table.tbl { min-width: 620px; }
  .pager { flex-wrap: wrap; gap: var(--sp-2); }
  .pager-btns { flex-wrap: wrap; }

  .modal { max-width: none; }
  .overlay { padding: var(--sp-3); align-items: flex-end; }
  .modal { max-height: 92vh; }
  .modal-head, .modal-foot { padding-left: var(--sp-5); padding-right: var(--sp-5); }
  .modal-body { padding: var(--sp-5); }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }

  .drawer, .drawer-lg { width: 100vw; }
  .drawer-head, .drawer-foot { padding-left: var(--sp-5); padding-right: var(--sp-5); }
  .drawer-body { padding: var(--sp-5); }
  .drawer-foot { flex-wrap: wrap; }
  .drawer-foot .btn { flex: 1 1 auto; }

  .toast-host { left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4); }
  .toast { min-width: 0; max-width: none; }

  .cmdk-overlay { padding-top: 6vh; }
  .receipt { width: 100%; max-width: 300px; }
  .payslip { padding: var(--sp-4); }
  .dl { grid-template-columns: minmax(90px, 42%) 1fr; }
  .punch-clock .time { font-size: var(--fs-3xl); }
}

@media (max-width: 480px) {
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .pay-methods { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .branch-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1 0 auto; padding: 0 var(--sp-3); }
}

/* ---- Touch: bigger hit targets than a mouse needs ------------------------- */
@media (pointer: coarse) {
  .btn { height: 40px; }
  .btn-sm { height: 32px; }
  .btn-lg { height: 46px; }
  .btn-icon { width: 40px; }
  .btn-icon.btn-sm { width: 32px; }
  .icon-btn { width: 40px; height: 40px; }
  .nav-item { height: 40px; }
  .input, .select { height: 40px; }
  .input-sm { height: 32px; }
  .tabs button { height: 44px; }
  .qty-stepper { height: 32px; }
  .qty-stepper button { width: 30px; }
  table.tbl tbody td { padding: var(--sp-4); }
  .pager-btns button { min-width: 36px; height: 36px; }
  .check input[type="checkbox"], .check input[type="radio"] { width: 20px; height: 20px; }
}

/* --------------------------------------------------------------- Print ---- */
@media print {
  .sidebar, .topbar, .page-actions, .no-print, .toast-host { display: none !important; }
  body, .page, .shell { overflow: visible !important; height: auto !important; }
  .card { box-shadow: none !important; border-color: #ccc !important; break-inside: avoid; }
  .page-inner { padding: 0 !important; max-width: none !important; }
  /* A drawer holding an invoice becomes the printed page. */
  .drawer-overlay, .drawer-head, .drawer-foot { display: none !important; }
  .drawer {
    position: static !important; width: auto !important; box-shadow: none !important;
    border: 0 !important; height: auto !important;
  }
  .drawer-body { overflow: visible !important; padding: 0 !important; }
  .invoice-doc { border: 0 !important; padding: 0 !important; }
  .invoice-doc, .payslip, .receipt { break-inside: avoid; }
}
