/* =====================================================================
   Costsy design system — follows the Forecourt POS / StitchPro look.
   One accent colour drives everything: every neutral takes a light tint of it.
   html attributes: data-theme (accent) · data-mode (light|dark) · data-style (flat|minimal|glass|aurora) · lang · dir
   Use tokens only — no hex values inside components.
   ===================================================================== */

/* ------------------------------------------------------------ tokens */
:root {
  --accent: #673DE6;

  --font-ui: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-num: "Onest", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-ur: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Urdu Typesetting", serif;

  --fs-display: clamp(26px, 1.4vw + 16px, 34px);
  --fs-h1: 19px; --fs-h2: 16px; --fs-h3: 14px;
  --fs-body: 14px; --fs-sm: 13px; --fs-xs: 12px;
  --lh-body: 1.5;

  --r-xs: 4px; --r-sm: 6px; --r: 9px; --r-lg: 14px; --r-xl: 18px; --r-full: 9999px;
  --topbar: 64px; --sidebar-open: 248px; --sidebar-closed: 72px;
  --sidebar-w: var(--sidebar-open);
  --gap: 18px; --pad: 28px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .7, .2, 1); --t-fast: 120ms; --t: 180ms; --t-slow: 240ms;

  /* light (default) */
  --bg: color-mix(in srgb, var(--accent) 4%, #F4F4F6);
  --surface: #FFFFFF;
  --surface-2: color-mix(in srgb, var(--accent) 2.5%, #FAFAFB);
  --surface-3: color-mix(in srgb, var(--accent) 6%, #F2F2F4);
  --text: color-mix(in srgb, var(--accent) 10%, #16161C);
  --text-2: color-mix(in srgb, var(--accent) 12%, #3E3E49);
  --text-3: color-mix(in srgb, var(--accent) 14%, #6A6A76);
  --line: color-mix(in srgb, var(--accent) 8%, #E5E5E9);
  --line-strong: color-mix(in srgb, var(--accent) 10%, #D3D3D9);
  --accent-ink: #FFFFFF;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 30%, var(--surface));
  --accent-fg: color-mix(in srgb, var(--accent) 88%, var(--text));
  --ring: var(--accent);
  --ring-soft: color-mix(in srgb, var(--accent) 26%, transparent);
  --shade: color-mix(in srgb, var(--accent) 25%, #101018);
  --overlay: color-mix(in srgb, var(--shade) 40%, transparent);

  --ok: #0B8A5E;   --ok-soft: #E3F5EE;
  --warn: #A66300; --warn-soft: #FDF1DE;
  --bad: #CF3340;  --bad-soft: #FCE8EA;
  --info: #1F6FD1; --info-soft: #E6EFFB;

  --shadow-sm: 0 1px 2px color-mix(in srgb, var(--shade) 10%, transparent);
  --shadow: 0 1px 2px color-mix(in srgb, var(--shade) 8%, transparent), 0 6px 16px -6px color-mix(in srgb, var(--shade) 14%, transparent);
  --shadow-lg: 0 18px 48px -14px color-mix(in srgb, var(--shade) 32%, transparent);
  --toast-bg: var(--text); --toast-text: var(--surface);

  /* sidebar = white panel (flat) */
  --chrome: var(--surface); --chrome-2: var(--surface-3); --chrome-active: var(--accent-soft);
  --chrome-text: var(--text); --chrome-text-2: var(--text-2); --chrome-line: var(--line);

  --card-border: 1px solid var(--line);
  --card-shadow: none;
  color-scheme: light;
}

/* accent swatches (Forecourt colour system) */
[data-theme="violet"]   { --accent: #673DE6; }
[data-theme="red"]      { --accent: #E10600; }
[data-theme="blue"]     { --accent: #1F6FD1; }
[data-theme="green"]    { --accent: #0C8A62; }
[data-theme="amber"]    { --accent: #C26A06; }
[data-theme="rose"]     { --accent: #C2265A; }
[data-theme="graphite"] { --accent: #3D4656; }

[data-mode="light"] { color-scheme: light; }
[data-mode="dark"] {
  color-scheme: dark;
  --bg: color-mix(in srgb, var(--accent) 6%, #0E0E12);
  --surface: color-mix(in srgb, var(--accent) 5%, #16161B);
  --surface-2: color-mix(in srgb, var(--accent) 6%, #1B1B21);
  --surface-3: color-mix(in srgb, var(--accent) 8%, #202027);
  --text: color-mix(in srgb, var(--accent) 6%, #EDEDF2);
  --text-2: color-mix(in srgb, var(--accent) 8%, #C9C9D3);
  --text-3: color-mix(in srgb, var(--accent) 12%, #96969F);
  --line: color-mix(in srgb, var(--accent) 10%, #27272E);
  --line-strong: color-mix(in srgb, var(--accent) 12%, #37373F);
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 45%, var(--surface));
  --accent-fg: color-mix(in srgb, var(--accent) 55%, #FFFFFF);
  --ring-soft: color-mix(in srgb, var(--accent) 35%, transparent);
  --overlay: rgb(0 0 0 / 55%);
  --ok: #3CC48F;  --ok-soft: #12291F;
  --warn: #E6A443; --warn-soft: #2D2312;
  --bad: #F06B74;  --bad-soft: #321619;
  --info: #6AA8F0; --info-soft: #14233A;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 35%);
  --shadow: 0 1px 2px rgb(0 0 0 / 35%), 0 6px 16px -6px rgb(0 0 0 / 45%);
  --shadow-lg: 0 18px 48px -14px rgb(0 0 0 / 65%);
}
[data-mode="dark"][data-theme="graphite"] { --accent: #6B7890; }

/* ------------------------------------------------------------ styles */
html[data-style="minimal"] { --card-border: 1px solid transparent; --chrome-line: transparent; }
html[data-style="minimal"] .topbar { border-bottom-color: transparent; }
html[data-style="minimal"] .card-head { border-bottom-color: transparent; }
html[data-style="glass"], html[data-style="aurora"] { --card-border: 1px solid transparent; --card-shadow: 0 0 0 1px var(--line), var(--shadow-sm); }

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; max-width: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font: 400 var(--fs-body)/var(--lh-body) var(--font-ui);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
html[lang="ur"] { --font-ui: var(--font-ur), "Onest", ui-sans-serif, system-ui, sans-serif; --lh-body: 1.95; }
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: var(--fs-h1); line-height: 1.25; }
h2 { font-size: var(--fs-h2); line-height: 1.3; }
h3 { font-size: var(--fs-h3); line-height: 1.35; }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3 { letter-spacing: 0; line-height: 1.75; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring-soft); border-radius: var(--r-sm); }
[hidden] { display: none !important; }
p, li, td, .li-title, .wrap-any { overflow-wrap: anywhere; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
/* inner scroll areas: when they reach the top / bottom (or don't need to scroll) the page scrolls on */
.scroll-y { overflow-y: auto; overscroll-behavior: auto; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.scroll-y::-webkit-scrollbar { width: 6px; }

/* ------------------------------------------------------------ utilities */
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; letter-spacing: 0; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.ok-text { color: var(--ok); } .bad-text { color: var(--bad); } .warn-text { color: var(--warn); } .info-text { color: var(--info); }
.accent-text { color: var(--accent-fg); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nowrap { white-space: nowrap; }
.right { text-align: end; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.row-top { align-items: flex-start; }
.row-wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { gap: 16px; }
.spacer, .grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: var(--gap); } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }
.ico { width: 18px; height: 18px; flex: none; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }
@media (max-width: 899px) { .hide-m { display: none !important; } }
@media (min-width: 900px) { .show-m { display: none !important; } }

.grid { display: grid; gap: var(--gap); min-width: 0; align-items: stretch; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 899px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ shell: sidebar */
.app { min-height: 100dvh; }
.app.is-collapsed { --sidebar-w: var(--sidebar-closed); }

.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50;
  width: var(--sidebar-w);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--chrome); color: var(--chrome-text);
  border-inline-end: 1px solid var(--chrome-line);
  transition: width var(--t-side) var(--ease-side), transform var(--t-slow) var(--ease-side);
  will-change: width;
  padding-top: var(--safe-t);
}
:root { --t-side: 240ms; --ease-side: cubic-bezier(.32, .72, 0, 1); }
.sb-head { display: flex; align-items: center; height: var(--topbar); border-bottom: 1px solid var(--line); flex: none; min-width: 0; }
.brand { flex: 1; display: flex; align-items: center; gap: 11px; height: 100%; padding: 0 19px; min-width: 0; color: var(--text); overflow: hidden; }
.brand:hover { background: var(--surface-3); }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.brand-mark svg { width: 19px; height: 19px; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-text { min-width: 0; display: flex; flex-direction: column; }
.brand-name { display: block; font: 650 15px/1.2 var(--font-num); letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.35; }
.sb-close { margin-inline-end: 10px; }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 4px 12px 12px; scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sb-nav:hover { scrollbar-color: var(--line-strong) transparent; }
.sb-nav::-webkit-scrollbar { width: 6px; }
.sb-nav::-webkit-scrollbar-thumb { background: transparent; border: 0; }
.sb-nav:hover::-webkit-scrollbar-thumb { background: var(--line-strong); }
.sb-label { position: relative; font-size: 11.5px; font-weight: 600; color: var(--text-3); padding: 16px 14px 6px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; overflow: hidden; height: 40px; transition: color 140ms ease; }
html[lang="ur"] .sb-label { text-transform: none; letter-spacing: 0; font-size: 12.5px; height: 44px; padding-top: 14px; line-height: 1.8; }
.sb-link {
  position: relative; display: flex; align-items: center; gap: 12px; height: 40px;
  margin: 2px 0; padding: 0 14px; border-radius: 10px;
  color: var(--chrome-text-2); font-weight: 500; white-space: nowrap; overflow: hidden;
  transition: background var(--t-fast), color var(--t-fast);
}
.sb-link .ico { width: 19px; height: 19px; color: var(--text-3); transition: color var(--t-fast); }
.sb-link .sb-text { overflow: hidden; text-overflow: ellipsis; transition: opacity 140ms ease; }
.brand-text, .sb-user-meta, .sb-collapse span { transition: opacity 140ms ease; white-space: nowrap; }
.sb-link:hover { background: var(--chrome-2); color: var(--text); }
.sb-link:hover .ico { color: var(--text-2); }
.sb-link.is-active { background: var(--chrome-active); color: var(--accent-fg); font-weight: 600; }
.sb-link.is-active .ico { color: var(--accent); }
.sb-link.is-active::before { content: ""; position: absolute; inset-inline-start: 3px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
html[lang="ur"] .sb-link { height: 44px; }

.sb-foot { flex: none; padding: 10px 12px; border-top: 1px solid var(--line); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 10px; color: var(--text); min-width: 0; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); transition: background var(--t-side) ease, border-color var(--t-side) ease; }
.sb-user:hover { border-color: var(--accent-line); }
.sb-user .avatar { --s: 32px; }
.sb-user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-user-name { font-weight: 600; font-size: 13.5px; }
.sb-user-sub { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.sb-user-sub .dot { width: 7px; height: 7px; background: var(--ok); }
.sb-collapse {
  flex: none; display: flex; align-items: center; gap: 12px; height: 52px; width: 100%; margin: 0; padding: 0 26px;
  border: 0; border-top: 1px solid var(--line); background: var(--chrome); color: var(--text-2);
  font: inherit; font-weight: 550; white-space: nowrap; overflow: hidden; padding-bottom: var(--safe-b);
}
.sb-collapse:hover { background: var(--surface-3); color: var(--text); }
.sb-collapse .ico { width: 19px; height: 19px; color: var(--text-3); transition: transform var(--t-side) var(--ease-side); }
[dir="rtl"] .sb-collapse .ico { transform: scaleX(-1); }

/* collapsed: icons only. Nothing changes position or display — the width slides and the text fades,
   so opening / closing is smooth (icons stay where they are). */
.app.is-collapsed .brand-text, .app.is-collapsed .sb-text, .app.is-collapsed .sb-user-meta, .app.is-collapsed .sb-collapse span { opacity: 0; pointer-events: none; }
.app.is-collapsed .sb-label { color: transparent; }
.app.is-collapsed .sb-label::after { content: ""; position: absolute; inset-inline: 14px; bottom: 14px; height: 1px; background: var(--line); }
.app.is-collapsed .sb-group:first-child .sb-label::after { background: transparent; }
.app.is-collapsed .sb-link.is-active::before { inset-inline-start: 2px; }
.app.is-collapsed .sb-user { background: transparent; border-color: transparent; }
.app.is-collapsed .sb-collapse .ico { transform: scaleX(-1); }
[dir="rtl"] .app.is-collapsed .sb-collapse .ico { transform: none; }

/* ------------------------------------------------------------ shell: top bar + content */
.main-col { margin-inline-start: var(--sidebar-w); min-height: 100dvh; min-width: 0; display: flex; flex-direction: column; transition: margin var(--t-side) var(--ease-side); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar) + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 12px; padding-inline: var(--pad);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.tb-heading { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1; }
.tb-project { display: inline-flex; align-items: center; gap: 3px; max-width: 100%; align-self: flex-start; padding: 0; border: 0; background: none; color: var(--text-3); font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.tb-project:hover { color: var(--accent-fg); }
.tb-project .ico { width: 13px; height: 13px; }
.tb-title { font-size: var(--fs-h1); line-height: 1.25; font-weight: 650; letter-spacing: -.015em; }
html[lang="ur"] .tb-title { letter-spacing: 0; line-height: 1.5; font-size: 18px; }
html[lang="ur"] .tb-project { line-height: 1.8; font-size: 12px; }
.tb-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.tb-icon { position: relative; }
.tb-avatar { padding: 0; border: 0; background: none; border-radius: 50%; }
.topbar .tb-menu { display: none; }
.topbar .tb-add-icon { display: none; }

.view { flex: 1; padding: 24px var(--pad) calc(36px + var(--safe-b)); min-width: 0; }
.view-enter { animation: view-in var(--t) var(--ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } }
.scrim { position: fixed; inset: 0; z-index: 45; background: var(--overlay); opacity: 0; pointer-events: none; transition: opacity var(--t) var(--ease); }
.tabbar { display: none !important; }

@media (max-width: 1280px) { :root { --pad: 22px; } }
@media (max-width: 899px) {
  :root { --pad: 16px; --gap: 14px; --topbar: 58px; }
  .main-col { margin-inline-start: 0; }
  .sidebar, .app.is-collapsed .sidebar { width: 272px; transform: translateX(-102%); box-shadow: none; }
  [dir="rtl"] .sidebar, [dir="rtl"] .app.is-collapsed .sidebar { transform: translateX(102%); }
  .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
  .sidebar { will-change: transform; }
  .app.is-collapsed .brand-text, .app.is-collapsed .sb-text, .app.is-collapsed .sb-user-meta { opacity: 1; pointer-events: auto; }
  .app.is-collapsed .sb-label { color: var(--text-3); }
  .app.is-collapsed .sb-label::after { display: none; }
  .app.is-collapsed .sb-user { background: var(--surface-2); border-color: var(--line); }
  .sb-collapse { display: none; }
  .sb-foot { padding-bottom: calc(10px + var(--safe-b)); }
  .topbar { padding-inline: 8px 12px; gap: 6px; }
  .topbar .tb-menu { display: inline-grid; }
  .tb-title { font-size: 17px; }
  .tb-add { display: none !important; }
  .topbar .tb-add-icon { display: inline-flex; }
  .view { padding: 16px var(--pad) calc(28px + var(--safe-b)); }
}
@media (max-width: 640px) {
  :root { --pad: 12px; --gap: 12px; }
  body { font-size: 13.5px; }
  .view { padding-top: 14px; }
}
@media (min-width: 900px) { .sb-close { display: none !important; } }

/* glass: control layer only */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-style="glass"] body {
    background:
      radial-gradient(1100px 620px at 8% -8%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
      radial-gradient(900px 520px at 100% 0%, color-mix(in srgb, var(--info) 8%, transparent), transparent 60%),
      var(--bg);
    background-attachment: fixed;
  }
  html[data-style="glass"] .sidebar, html[data-style="glass"] .sb-collapse { background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4); }
  html[data-style="glass"] .topbar { background: color-mix(in srgb, var(--surface) 65%, transparent); -webkit-backdrop-filter: blur(20px) saturate(1.5); backdrop-filter: blur(20px) saturate(1.5); }
  html[data-style="glass"] .sheet, html[data-style="glass"] .menu { background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(28px) saturate(1.4); backdrop-filter: blur(28px) saturate(1.4); }
}
@media (prefers-reduced-transparency: reduce) {
  html[data-style="glass"] .sidebar, html[data-style="glass"] .topbar, html[data-style="glass"] .sheet, html[data-style="glass"] .menu { background: var(--surface); backdrop-filter: none; }
}
/* aurora: soft colour behind content */
html[data-style="aurora"] body::before {
  content: ""; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38% 34% at 18% 18%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    radial-gradient(34% 40% at 82% 26%, color-mix(in srgb, var(--info) 12%, transparent), transparent 70%),
    radial-gradient(40% 38% at 50% 92%, color-mix(in srgb, var(--ok) 9%, transparent), transparent 70%);
  filter: blur(48px);
  animation: aurora-drift 48s ease-in-out infinite alternate;
}
@keyframes aurora-drift { to { transform: translate3d(4%, 3%, 0) rotate(6deg) scale(1.06); } }

/* ------------------------------------------------------------ buttons */
.btn {
  --h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h); padding: 0 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font: 550 14px/1 var(--font-ui); white-space: nowrap; user-select: none; text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform 100ms var(--ease);
  position: relative; flex: none;
}
html[lang="ur"] .btn { line-height: 1.6; }
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { box-shadow: 0 0 0 3px var(--ring-soft); border-radius: var(--r); }
.btn .ico { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); }
.btn-danger-ghost { background: transparent; border-color: color-mix(in srgb, var(--bad) 35%, var(--surface)); color: var(--bad); }
.btn-danger-ghost:hover { background: var(--bad-soft); }
.btn-link { background: none; border: 0; padding: 0; height: auto; color: var(--accent-fg); font-weight: 550; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-sm { --h: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-lg { --h: 46px; padding: 0 20px; font-size: 15px; }
.btn-icon { width: var(--h); padding: 0; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; inset: 0; margin: auto;
  border: 2px solid var(--text-2); border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
.btn-primary.is-loading::after, .btn-danger.is-loading::after { border-color: #fff; border-right-color: transparent; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r);
  border: 1px solid transparent; background: transparent; color: var(--text-2); position: relative; flex: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.is-outline { border-color: var(--line-strong); background: var(--surface); }
.badge {
  position: absolute; top: -3px; inset-inline-end: -3px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font: 650 11px/14px var(--font-num); text-align: center;
  border: 2px solid var(--surface);
}
@media (max-width: 640px) {
  .btn { --h: 38px; }
  .btn-sm { --h: 32px; }
  .icon-btn { width: 40px; height: 40px; }
  .sheet-foot .btn, .form-actions .btn { flex: 1 1 auto; }
}

/* quick actions row (StitchPro style) */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.quick-actions .spacer { flex: 1; }
@media (max-width: 640px) {
  .quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions .btn { width: 100%; }
  .quick-actions .btn-primary { grid-column: 1 / -1; }
  .quick-actions .spacer { display: none; }
}

/* ------------------------------------------------------------ forms */
.form { display: block; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.label { font-size: 13px; font-weight: 550; color: var(--text-2); display: flex; align-items: baseline; gap: 6px; }
.label .opt { color: var(--text-3); font-weight: 450; font-size: 12px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 11px; min-width: 0;
  border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  font: 400 14px/1.4 var(--font-ui);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none; appearance: none;
}
html[lang="ur"] .input, html[lang="ur"] .select, html[lang="ur"] .textarea { line-height: 1.8; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .85; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring-soft); }
.input[readonly] { background: var(--surface-2); color: var(--text-3); }
.input:disabled, .select:disabled { opacity: .55; }
.textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.select {
  padding-inline-end: 38px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6A82' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px;
}
[dir="rtl"] .select { background-position: left 12px center; }
input[type="date"].input { min-height: 38px; }
input[type="date"]::-webkit-date-and-time-value { text-align: start; }
.input.amount, .input.qty { text-align: end; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.affix { position: relative; display: flex; align-items: center; min-width: 0; }
.affix > .input { flex: 1; }
.affix .prefix, .affix .suffix { position: absolute; color: var(--text-3); font-size: 13.5px; pointer-events: none; font-family: var(--font-num); }
.affix .prefix { inset-inline-start: 12px; }
.affix .suffix { inset-inline-end: 12px; }
.affix.has-prefix > .input { padding-inline-start: 38px; }
.affix.has-suffix > .input { padding-inline-end: 56px; }
.hint { font-size: 12px; color: var(--text-3); line-height: 1.4; }
html[lang="ur"] .hint { line-height: 1.8; }
.field-error { display: none; font-size: 12px; color: var(--bad); line-height: 1.4; }
.field.has-error .field-error { display: block; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--bad); }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.field-row > .field { margin-bottom: 14px; }
.field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-section { margin: 6px 0 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.form-section-title { font: 600 13px/1.4 var(--font-ui); color: var(--text-3); margin-bottom: 10px; }
.form-summary { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 13.5px; margin-bottom: 14px; }
.form-summary .row { justify-content: space-between; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
@media (max-width: 640px) {
  .input, .select, .textarea { font-size: 16px; height: 42px; }
  .textarea { height: auto; }
  input[type="date"].input { min-height: 42px; }
}
@media (max-width: 380px) { .field-row-3 { grid-template-columns: minmax(0, 1fr); } }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; font-weight: 500; min-height: 30px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; flex: none; }

.switch { position: relative; display: inline-flex; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { width: 40px; height: 24px; border-radius: 12px; background: var(--line-strong); transition: background var(--t-fast); position: relative; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t) var(--ease); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--ring-soft); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r); background: var(--surface-3); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button, .seg label { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font: 550 13px/1 var(--font-ui); white-space: nowrap; cursor: pointer; flex: 1 0 auto; }
html[lang="ur"] .seg button, html[lang="ur"] .seg label { line-height: 1.6; }
.seg button:hover, .seg label:hover { color: var(--text); }
.seg label input { position: absolute; opacity: 0; pointer-events: none; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px color-mix(in srgb, var(--shade) 12%, transparent); }
.seg-block { display: flex; width: 100%; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--r-full); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2); font: 550 13px/1 var(--font-ui); white-space: nowrap; cursor: pointer; flex: none; }
html[lang="ur"] .chip { line-height: 1.6; }
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .ico { width: 14px; height: 14px; }

.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search .ico { position: absolute; inset-inline-start: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.search .input { padding-inline-start: 34px; }

.otp { display: flex; gap: 8px; justify-content: center; direction: ltr; }
.otp input { width: 46px; height: 54px; text-align: center; font: 650 22px/1 var(--font-num); border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 0; }
.otp input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring-soft); }
.otp.has-error input { border-color: var(--bad); animation: shake .32s var(--ease); }
@media (max-width: 360px) { .otp { gap: 6px; } .otp input { width: 40px; height: 50px; } }

/* ------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: var(--card-border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); min-width: 0; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 18px; min-height: 54px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-title { font: 600 15px/1.3 var(--font-ui); letter-spacing: -.01em; }
html[lang="ur"] .card-title { line-height: 1.8; letter-spacing: 0; }
.card-sub { font-size: 12.5px; color: var(--text-3); }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.card-flush { overflow: hidden; }
@supports (overflow: clip) { .card-flush { overflow: clip; } }
.card.is-fill { display: flex; flex-direction: column; }
.card.is-fill > .card-body, .card.is-fill > .fill { flex: 1; min-height: 0; }
@media (max-width: 640px) {
  .card-pad, .card-body { padding: 14px; }
  .card-head { padding: 10px 14px; min-height: 48px; }
  .card-foot { padding: 10px 14px; }
}
.section-label { font: 600 11.5px/1.3 var(--font-ui); letter-spacing: .02em; text-transform: uppercase; color: var(--text-3); margin: 0 0 10px; }
html[lang="ur"] .section-label { letter-spacing: 0; text-transform: none; line-height: 1.8; font-size: 13px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: var(--gap); flex-wrap: wrap; }
.page-head .grow { min-width: 120px; }
.page-sub { color: var(--text-2); font-size: 13.5px; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat { background: var(--surface); border: var(--card-border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); padding: 15px 18px; min-width: 0; color: inherit; display: block; }
a.stat:hover, button.stat:hover { border-color: var(--accent-line); }
.stat-label { font-size: 13px; color: var(--text-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font: 650 clamp(18px, 1.5vw, 23px)/1.25 var(--font-num); letter-spacing: -.02em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; unicode-bidi: isolate; text-align: start; }
[dir="rtl"] .stat-value { text-align: end; }
.stat-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
html[lang="ur"] .stat-sub, html[lang="ur"] .stat-label { line-height: 1.8; }
.stat-hero .stat-value { font-size: var(--fs-display); letter-spacing: -.03em; line-height: 1.15; }
.delta-up { color: var(--ok); } .delta-down { color: var(--bad); }

/* KPI tile with icon (StitchPro style) */
.kpi { position: relative; display: flex; flex-direction: column; min-width: 0; padding: 15px 18px; background: var(--surface); border: var(--card-border); border-radius: var(--r-lg); box-shadow: var(--card-shadow); color: inherit; transition: border-color var(--t-fast); }
a.kpi:hover { border-color: var(--accent-line); }
.kpi-head { display: flex; align-items: flex-start; gap: 10px; }
.kpi-label { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="ur"] .kpi-label { line-height: 1.8; white-space: normal; }
.kpi-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-3); }
.kpi-ico .ico { width: 15px; height: 15px; }
.kpi-ico.is-accent { background: var(--accent-soft); color: var(--accent-fg); }
.kpi-ico.is-bad { background: var(--bad-soft); color: var(--bad); }
.kpi-ico.is-ok { background: var(--ok-soft); color: var(--ok); }
.kpi-ico.is-warn { background: var(--warn-soft); color: var(--warn); }
.kpi-value { margin-top: 6px; font: 650 clamp(18px, 1.45vw, 22px)/1.2 var(--font-num); letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; unicode-bidi: isolate; text-align: start; }
[dir="rtl"] .kpi-value { text-align: end; }
.kpi-value small { font-size: .6em; font-weight: 550; color: var(--text-3); margin-inline-end: 3px; letter-spacing: 0; }
.kpi-value.is-bad { color: var(--bad); }
.kpi-value.is-big { font-size: clamp(24px, 2.2vw, 32px); letter-spacing: -.03em; }
.kpi-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[lang="ur"] .kpi-sub { line-height: 1.8; white-space: normal; }
.kpi .progress { margin-top: 12px; }
@media (max-width: 640px) {
  .kpi { padding: 11px 12px; border-radius: 12px; }
  .kpi-label { font-size: 12px; }
  .kpi-value { font-size: 17px; }
  .kpi-value.is-big { font-size: 22px; }
  .kpi-sub { font-size: 11.5px; }
  .kpi-ico { width: 24px; height: 24px; }
}

/* ------------------------------------------------------------ tables (desktop) → one-line rows (phone) */
.table-wrap { width: 100%; overflow-x: clip; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  position: sticky; top: calc(var(--topbar) + var(--safe-t)); z-index: 2;
  background: var(--surface-2); text-align: start; white-space: nowrap;
  font: 550 12.5px/1.3 var(--font-ui); color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
html[lang="ur"] .table th { font-size: 12.5px; line-height: 1.8; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-inline-start: 18px; }
.table th:last-child, .table td:last-child { padding-inline-end: 18px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr[data-href], .table tr[data-id] { cursor: pointer; }
.table .t-num, .table th.t-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.t-num { font-family: var(--font-num); }
.table .t-title { font-weight: 550; color: var(--text); }
.table .t-meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
html[lang="ur"] .table .t-meta { line-height: 1.7; }
.table .t-act { width: 1%; white-space: nowrap; text-align: end; }
.table .t-check { width: 1%; }
.table .t-mobile { display: none; }
.table tfoot td { font-weight: 650; border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
@media (max-width: 1180px) { .table .hide-md { display: none; } }
@media screen and (max-width: 899px) {
  .rtable thead { display: none; }
  .rtable, .rtable tbody { display: block; }
  .rtable tr { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); min-height: 58px; }
  .rtable tbody tr:last-child { border-bottom: 0; }
  .rtable td { display: none; padding: 0 !important; border: 0; background: none !important; width: auto !important; max-width: none !important; }
  .rtable td.t-main { display: block; flex: 1 1 auto; min-width: 0; }
  .rtable td.t-main .t-title, .rtable td.t-main .t-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rtable td.t-amt { display: block; flex: none; text-align: end; white-space: nowrap; font-weight: 650; }
  .rtable td.t-lead, .rtable td.t-keep { display: block; flex: none; }
  .rtable .t-mobile { display: block; }
  .rtable tfoot { display: block; }
  .rtable tfoot tr { background: var(--surface-2); }
  .rtable tfoot td.t-main, .rtable tfoot td.t-amt { display: block; background: none; }
}

/* list rows */
.list { display: flex; flex-direction: column; min-width: 0; }
.li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; min-height: 56px; border-bottom: 1px solid var(--line); color: inherit; background: transparent; width: 100%; border-inline: 0; border-top: 0; text-align: start; font: inherit; min-width: 0; }
.li:last-child { border-bottom: 0; }
a.li, button.li, .li[data-href], .li[data-id] { cursor: pointer; transition: background var(--t-fast); }
a.li:hover, button.li:hover, .li[data-href]:hover, .li[data-id]:hover { background: var(--surface-2); }
.li-lead { flex: none; display: flex; }
.li-body { flex: 1 1 auto; min-width: 0; }
.li-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-meta { font-size: 12.5px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
html[lang="ur"] .li-meta { line-height: 1.8; }
.li-trail { flex: none; text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.li-amount { font: 650 14.5px/1.3 var(--font-num); white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.li-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.li-chev { color: var(--text-3); flex: none; width: 17px; height: 17px; }
[dir="rtl"] .li-chev { transform: scaleX(-1); }
.li-icon { width: 36px; height: 36px; border-radius: var(--r); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-fg); flex: none; }
.li-icon .ico { width: 17px; height: 17px; }
@media (max-width: 640px) { .li { padding: 10px 14px; } }

/* pills (badges) + dots */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-full); background: var(--surface-3); color: var(--text-2); font: 550 12px/1 var(--font-ui); white-space: nowrap; flex: none; }
html[lang="ur"] .pill { line-height: 1.6; height: 24px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-accent { background: var(--accent-soft); color: var(--accent-fg); }
.pill .dot { width: 6px; height: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }

/* progress */
.progress { display: flex; height: 6px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; min-width: 40px; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width var(--t-slow) var(--ease); }
.progress > .p-accent { background: var(--accent); }
.progress > .p-ok { background: var(--ok); }
.progress > .p-warn { background: var(--warn); }
.progress > .p-bad { background: var(--bad); }
.progress > .p-info { background: var(--info); }
.progress-lg { height: 8px; }
.progress-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.progress-legend .dot { margin-inline-end: 6px; }

/* avatar */
.avatar { --s: 32px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-grid; place-items: center; overflow: hidden; background: var(--accent-soft); color: var(--accent-fg); font: 650 calc(var(--s) * .38)/1 var(--font-num); letter-spacing: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { --s: 22px; } .avatar-sm { --s: 28px; } .avatar-md { --s: 38px; } .avatar-lg { --s: 60px; } .avatar-xl { --s: 88px; }
.avatars { display: flex; }
.avatars .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatars .avatar + .avatar { margin-inline-start: -8px; }

/* key / value rows */
.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; min-width: 0; }
.kv-row:last-child { border-bottom: 0; }
.kv-row > :first-child { color: var(--text-3); flex: none; }
.kv-row > :last-child { text-align: end; min-width: 0; overflow-wrap: anywhere; font-weight: 550; }

/* timeline */
.timeline { position: relative; display: flex; flex-direction: column; }
.tl-item { position: relative; display: flex; gap: 12px; padding-bottom: 16px; min-width: 0; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 11px; height: 11px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--surface); box-shadow: inset 0 0 0 2px var(--text-3); }
.tl-dot.is-ok { box-shadow: inset 0 0 0 6px var(--ok); }
.tl-dot.is-accent { box-shadow: inset 0 0 0 6px var(--accent); }
.tl-body { flex: 1; min-width: 0; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--gap); }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 40px; padding: 0 14px; border: 0; background: none; color: var(--text-3); font: 550 14px/1 var(--font-ui); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
html[lang="ur"] .tab { line-height: 1.6; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--accent-fg); border-bottom-color: var(--accent); }
.tab .pill { height: 18px; padding: 0 6px; font-size: 11px; }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--gap); min-width: 0; }
.toolbar .search { flex: 1 1 260px; min-width: 200px; }
.toolbar .chips { flex: 0 1 auto; }
.toolbar .select, .toolbar input[type="date"] { width: auto; }
@media (max-width: 640px) {
  .toolbar { gap: 8px; }
  .toolbar .search { flex-basis: 100%; min-width: 0; }
  .toolbar .chips { flex-basis: 100%; margin-inline: -12px; padding-inline: 12px; }
}

/* banners (Forecourt alert style) */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text); font-size: 13.5px; min-width: 0; }
.banner > .ico { color: var(--accent-fg); }
.banner-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); } .banner-warn > .ico { color: var(--warn); }
.banner-ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); } .banner-ok > .ico { color: var(--ok); }
.banner-bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 25%, transparent); color: var(--bad); } .banner-bad > .ico { color: var(--bad); }
.banner .grow { min-width: 0; }
.banner-action { font-weight: 600; background: none; border: 0; color: var(--accent-fg); padding: 6px 8px; border-radius: var(--r-sm); white-space: nowrap; }
.banner-action:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.banner .icon-btn { width: 30px; height: 30px; margin: -6px -8px -6px 0; }

/* empty states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px; gap: 6px; color: var(--text-3); }
.empty-icon { width: 48px; height: 48px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-fg); margin-bottom: 8px; }
.empty-icon .ico { width: 22px; height: 22px; }
.empty-title { font-weight: 600; font-size: 16px; color: var(--text); }
.empty-text { color: var(--text-3); font-size: 13.5px; max-width: 420px; }
.empty .btn { margin-top: 12px; }
.empty-sm { padding: 22px 16px; }
.empty-sm .empty-icon { width: 38px; height: 38px; margin-bottom: 4px; }

/* skeleton */
.sk { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--r-sm); }
.sk-line { height: 12px; margin: 8px 0; }
.sk-title { height: 20px; width: 38%; }
.sk-stat { height: 96px; border-radius: var(--r-lg); }
.sk-row { height: 56px; border-radius: 0; border-bottom: 1px solid var(--line); padding: 10px 18px; }
.sk-card { height: 240px; border-radius: var(--r-lg); }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* pager (lists) */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 14px 0 4px; }
.pager-nums { display: flex; align-items: center; gap: 4px; }
.pager-num { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--r-sm); border: 1px solid transparent; background: transparent; color: var(--text-2); font: 550 13px/1 var(--font-num); }
.pager-num:hover { background: var(--surface-3); color: var(--text); }
.pager-num.is-current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager-gap { color: var(--text-3); padding: 0 2px; }
@media (max-width: 640px) {
  .pager { justify-content: space-between; }
  .pager .btn span { display: none; }
  .pager .btn { width: 36px; padding: 0; }
}

/* ------------------------------------------------------------ overlays: right-side panels (drawers) */
.sheet-scrim { position: fixed; inset: 0; z-index: 100; background: var(--overlay); opacity: 0; transition: opacity var(--t) var(--ease); }
.sheet-scrim.is-open { opacity: 1; }
.sheet {
  position: fixed; z-index: 101; display: flex; flex-direction: column;
  background: var(--surface); box-shadow: var(--shadow-lg); outline: none;
  transition: transform var(--t-slow) cubic-bezier(.2, .8, .2, 1);
  max-width: 100vw;
}
.sheet.side-right { inset-block: 0; inset-inline-end: 0; width: min(520px, 100vw); border-inline-start: 1px solid var(--line); transform: translateX(100%); }
[dir="rtl"] .sheet.side-right { transform: translateX(-100%); }
.sheet.side-right.sheet-wide { width: min(720px, 100vw); }
.sheet.side-bottom { inset-inline: 0; bottom: 0; max-height: min(88dvh, 760px); border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(100%); }
@media (min-width: 900px) { .sheet.side-bottom { inset-inline: auto; left: 50%; width: 460px; margin-left: -230px; bottom: 24px; border-radius: var(--r-xl); transform: translateY(calc(100% + 32px)); } }
.sheet.is-open { transform: none !important; }
.sheet.is-dragging { transition: none; }
.sheet-grip { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; padding: 16px 14px 16px 22px; border-bottom: 1px solid var(--line); flex: none; }
[dir="rtl"] .sheet-head { padding: 16px 22px 16px 14px; }
.sheet.side-right .sheet-head { padding-top: calc(16px + var(--safe-t)); }
.sheet-title { flex: 1; min-width: 0; font: 600 17px/1.3 var(--font-ui); letter-spacing: -.01em; padding-top: 5px; overflow-wrap: anywhere; }
html[lang="ur"] .sheet-title { letter-spacing: 0; line-height: 1.9; padding-top: 0; }
.sheet-sub { font-size: 13px; color: var(--text-3); font-weight: 400; letter-spacing: 0; margin-top: 2px; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; padding: 20px 22px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-body.flush { padding: 0; }
.sheet-foot { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 22px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface-2); flex: none; }
.sheet-foot .spacer { flex: 1; }
@media (max-width: 640px) {
  .sheet.side-right, .sheet.side-right.sheet-wide { width: 100vw; border-inline-start: 0; }
  .sheet-head { padding: 12px 10px 12px 16px; }
  [dir="rtl"] .sheet-head { padding: 12px 16px 12px 10px; }
  .sheet-body { padding: 16px; }
  .sheet-foot { padding: 12px 16px calc(12px + var(--safe-b)); gap: 8px; }
  .sheet-foot .spacer { display: none; }
}

.modal-scrim { position: fixed; inset: 0; z-index: 110; background: var(--overlay); opacity: 0; transition: opacity var(--t) var(--ease); }
.modal-scrim.is-open { opacity: 1; }
.modal { position: fixed; z-index: 111; left: 50%; top: 50%; width: min(400px, calc(100vw - 32px)); transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 22px; }
.modal.is-open { opacity: 1; transform: translate(-50%, -50%); }
.modal-title { font: 600 17px/1.35 var(--font-ui); }
html[lang="ur"] .modal-title { line-height: 1.9; }
.modal-text { color: var(--text-2); margin: 8px 0 20px; font-size: 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 640px) { .modal-actions .btn { flex: 1; } }

.menu { position: fixed; z-index: 120; min-width: 220px; max-width: min(320px, calc(100vw - 24px)); max-height: min(440px, 70dvh); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 6px; opacity: 0; transform: translateY(-4px); transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.menu.is-open { opacity: 1; transform: none; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 36px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: 500 14px/1.3 var(--font-ui); text-align: start; }
html[lang="ur"] .menu-item { line-height: 1.8; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); box-shadow: none; }
.menu-item .ico { width: 16px; height: 16px; color: var(--text-3); }
.menu-item.is-danger, .menu-item.is-danger .ico { color: var(--bad); }
.menu-item .check-mark { margin-inline-start: auto; color: var(--accent-fg); }
.menu-item .menu-sub { font-size: 12px; color: var(--text-3); font-weight: 400; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu-label { font-size: 12px; color: var(--text-3); padding: 6px 10px 4px; }

.tooltip { position: fixed; z-index: 130; pointer-events: none; padding: 6px 10px; border-radius: var(--r-sm); background: var(--toast-bg); color: var(--toast-text); font: 550 12.5px/1.3 var(--font-ui); white-space: nowrap; opacity: 0; transition: opacity var(--t-fast); }
.tooltip.is-open { opacity: 1; }

.toast-root { position: fixed; z-index: 300; inset-inline-end: 20px; bottom: calc(20px + var(--safe-b)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; min-height: 44px; max-width: min(420px, calc(100vw - 24px)); padding: 9px 10px 9px 14px; border-radius: var(--r); background: var(--toast-bg); color: var(--toast-text); box-shadow: 0 12px 30px -8px rgb(0 0 0 / 35%); font-size: 13.5px; font-weight: 500; animation: toast-in var(--t) var(--ease); }
[dir="rtl"] .toast { padding: 9px 14px 9px 10px; }
.toast.is-leaving { animation: toast-out var(--t-fast) var(--ease) forwards; }
.toast .ico { width: 17px; height: 17px; }
.toast-ok .ico { color: #3CC48F; } .toast-info .ico { color: #6AA8F0; }
.toast-bad { background: var(--bad); color: #fff; } .toast-bad .ico { color: #fff; }
.toast-msg { flex: 1; min-width: 0; padding-inline-end: 4px; }
.toast-action { border: 0; background: none; color: inherit; font-weight: 650; padding: 6px 10px; border-radius: var(--r-sm); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.toast-action:hover { background: rgb(127 127 127 / 20%); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@media (max-width: 640px) {
  .toast-root { inset-inline: 12px; bottom: calc(12px + var(--safe-b)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
}

.lightbox { position: fixed; inset: 0; z-index: 200; background: rgb(8 9 11 / 94%); display: flex; flex-direction: column; animation: view-in var(--t) var(--ease); }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 12px 8px; color: #f3f4f6; }
.lb-bar .icon-btn { color: #f3f4f6; }
.lb-bar .icon-btn:hover { background: rgb(255 255 255 / 10%); color: #fff; }
.lb-name { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 8px 8px calc(8px + var(--safe-b)); touch-action: pan-x pan-y pinch-zoom; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: var(--r-sm); }
.lb-stage img.is-zoomed { max-width: none; max-height: none; cursor: zoom-out; }
.lb-count { font-size: 13px; color: #a1a1aa; }

/* uploader */
.uploader { display: flex; flex-direction: column; gap: 10px; }
.up-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.up-actions .btn { flex: 1 1 140px; }
.up-drop { border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); padding: 16px; text-align: center; color: var(--text-3); font-size: 13px; transition: border-color var(--t-fast), background var(--t-fast); }
.up-drop.is-over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-fg); }
.up-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.up-item { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.up-item > button.up-open { all: unset; display: block; width: 100%; height: 100%; cursor: zoom-in; }
.up-item img { width: 100%; height: 100%; object-fit: cover; }
.up-file { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; text-align: center; font-size: 11px; color: var(--text-2); overflow-wrap: anywhere; }
.up-file .ico { width: 24px; height: 24px; color: var(--bad); }
.up-remove { position: absolute; top: 4px; inset-inline-end: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgb(0 0 0 / 58%); color: #fff; display: grid; place-items: center; }
.up-remove .ico { width: 14px; height: 14px; }
.up-progress { position: absolute; inset-inline: 6px; bottom: 6px; height: 4px; border-radius: 2px; background: rgb(255 255 255 / 55%); overflow: hidden; }
.up-progress > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width var(--t-fast); }
.up-item.is-pending::after { content: ""; position: absolute; inset: 0; background: rgb(255 255 255 / 25%); }
.up-item.is-error { border-color: var(--bad); }

/* charts */
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--text-3); font: 500 11px var(--font-num); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--accent); }
.chart .bar-muted { fill: var(--accent-line); }
.chart .bar:hover { filter: brightness(.94); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-soft); }
.hbars { display: flex; flex-direction: column; }
.hb-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding: 7px 0; font-size: 13.5px; align-items: baseline; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.hb-value { font: 650 13.5px var(--font-num); direction: ltr; unicode-bidi: isolate; }
.hb-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.hb-track > span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.hb-row.is-muted .hb-track > span { background: var(--text-3); opacity: .5; }

/* settings-style menus */
.sgroup { margin-bottom: 22px; }
.sgroup-label { font: 600 11.5px/1.3 var(--font-ui); letter-spacing: .02em; text-transform: uppercase; color: var(--text-3); padding: 0 4px 8px; }
html[lang="ur"] .sgroup-label { text-transform: none; letter-spacing: 0; font-size: 13px; line-height: 1.8; }
.srow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 18px; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: start; color: inherit; font: inherit; min-width: 0; }
.srow:last-child { border-bottom: 0; }
button.srow, a.srow { cursor: pointer; transition: background var(--t-fast); }
button.srow:hover, a.srow:hover { background: var(--surface-2); }
.srow-icon { color: var(--text-3); }
.srow-body { flex: 1; min-width: 0; }
.srow-label { font-weight: 550; }
.srow-desc { font-size: 12.5px; color: var(--text-3); }
.srow-value { color: var(--text-3); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.srow-danger, .srow-danger .srow-icon { color: var(--bad); }
.srow .li-chev { margin-inline-start: -4px; }

/* offline + pull to refresh + misc */
.offline-bar { position: fixed; inset-inline: 0; top: 0; z-index: 60; padding: calc(4px + var(--safe-t)) 16px 4px; text-align: center; font-size: 12.5px; font-weight: 550; background: var(--warn-soft); color: var(--warn); }
/* pull-to-refresh indicator: phones only, invisible unless the user is pulling or it is loading */
.ptr { position: fixed; top: calc(var(--topbar) + var(--safe-t) + 8px); left: 50%; z-index: 25; width: 36px; height: 36px; margin-left: -18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--accent); transform: translateY(-140px); opacity: 0; visibility: hidden; transition: transform var(--t) var(--ease), opacity var(--t) var(--ease), visibility 0s linear var(--t); pointer-events: none; }
.ptr.is-pulling, .ptr.is-loading { opacity: 1; visibility: visible; transition: transform var(--t) var(--ease), opacity var(--t-fast) var(--ease); }
.ptr.is-pulling { transition: none; }
@media (min-width: 900px) { .ptr { display: none !important; } }
.ptr .ico { width: 18px; height: 18px; }
.ptr.is-loading .ico { animation: spin .8s linear infinite; }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; opacity: .7; display: inline-block; }
.check-pop { animation: pop .32s var(--ease); }
.shake { animation: shake .32s var(--ease); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

.thumb { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; background: var(--surface-2); flex: none; }
.amount-lg { font: 700 30px/1.1 var(--font-num); letter-spacing: -.03em; direction: ltr; unicode-bidi: isolate; }
.legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-inline-end: 6px; }
.kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; font: 600 11px/1.4 var(--font-num); color: var(--text-3); text-align: center; background: var(--surface); }
.link { color: var(--accent-fg); font-weight: 550; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ auth pages */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: calc(24px + var(--safe-t)) 16px calc(24px + var(--safe-b)); }
.auth-card { width: min(400px, 100%); }
.auth-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 22px; }
.auth-brand .brand-name { font-size: 20px; }
.auth-brand .brand-mark { width: 42px; height: 42px; border-radius: 12px; }
.auth-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 32px; }
.auth-title { font-size: 22px; margin-bottom: 6px; }
html[lang="ur"] .auth-title { line-height: 1.8; }
.auth-sub { color: var(--text-3); font-size: 14px; margin-bottom: 20px; }
.auth-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.auth-steps span { flex: 1; height: 3px; border-radius: 2px; background: var(--surface-3); }
.auth-steps span.is-done { background: var(--accent); }
.auth-foot { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-3); }
.auth-error { display: none; margin-bottom: 16px; }
.auth-error.is-on { display: flex; }
.qr-box { display: grid; place-items: center; padding: 16px; border-radius: var(--r-lg); background: #fff; width: 208px; height: 208px; margin: 0 auto 16px; border: 1px solid var(--line); }
.qr-box img, .qr-box canvas, .qr-box svg { width: 176px; height: 176px; image-rendering: pixelated; }
.secret { display: flex; align-items: center; gap: 8px; justify-content: center; font: 550 14px/1.4 var(--font-mono); letter-spacing: .06em; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); word-break: break-all; direction: ltr; }
@media (max-width: 480px) { .auth-panel { padding: 24px 18px; } }

/* ------------------------------------------------------------ motion prefs */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* print (reports, khata) */
@media print {
  .sidebar, .topbar, .toolbar, .no-print, .toast-root, .quick-actions { display: none !important; }
  .main-col { margin: 0 !important; }
  .view { padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card, .kpi, .stat { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .table th { position: static; }
}
