/* ==========================================================================
   Marunthagam Pharmacy ERP — Design system
   Green & white theme · Inter · 14px base · responsive (phone / tablet / desktop)
   ========================================================================== */

:root {
  /* Brand greens */
  --g-25: #f5fbf7;
  --g-50: #ecfdf3;
  --g-100: #d1fadf;
  --g-200: #a6f4c5;
  --g-300: #6ce9a6;
  --g-400: #32d583;
  --g-500: #12b76a;
  --g-600: #039855;
  --g-700: #027a48;
  --g-800: #05603a;
  --g-900: #054f31;
  --g-950: #053321;

  /* Neutrals (very slightly green-tinted) */
  --n-0: #ffffff;
  --n-25: #fcfdfc;
  --n-50: #f7f9f8;
  --n-100: #f0f3f1;
  --n-200: #e4e9e6;
  --n-300: #d0d8d3;
  --n-400: #98a39d;
  --n-500: #6b7671;
  --n-600: #4a5550;
  --n-700: #333d38;
  --n-800: #1e2723;
  --n-900: #101814;

  --amber-50: #fffaeb;
  --amber-100: #fef0c7;
  --amber-200: #fedf89;
  --amber-500: #f79009;
  --amber-600: #dc6803;
  --amber-700: #b54708;
  --red-50: #fef3f2;
  --red-100: #fee4e2;
  --red-200: #fecdca;
  --red-500: #f04438;
  --red-600: #d92d20;
  --red-700: #b42318;
  --blue-50: #eff8ff;
  --blue-100: #d1e9ff;
  --blue-200: #b2ddff;
  --blue-600: #1570ef;
  --blue-700: #175cd3;
  --violet-50: #f4f3ff;
  --violet-100: #ebe9fe;
  --violet-200: #d9d6fe;
  --violet-600: #6938ef;
  --violet-700: #5925dc;

  /* Semantic */
  --bg: #f3f7f5;
  --surface: #ffffff;
  --border: #e3e9e5;
  --border-strong: #d0d8d3;
  --text: #13201a;
  --text-2: #45524b;
  --text-3: #6b7671;
  --primary: var(--g-600);
  --primary-hover: var(--g-700);
  --focus-ring: 0 0 0 4px rgba(18, 183, 106, .18);

  /* Chart palette (validated categorical order) */
  --c1: #2a78d6;
  --c2: #eb6834;
  --c3: #1baf7a;
  --c4: #eda100;
  --chart-grid: #e8ede9;
  --chart-axis: #c9d2cc;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-xs: 0 1px 2px rgba(16, 32, 24, .05);
  --shadow-sm: 0 1px 3px rgba(16, 32, 24, .08), 0 1px 2px rgba(16, 32, 24, .04);
  --shadow-md: 0 4px 8px -2px rgba(16, 32, 24, .08), 0 2px 4px -2px rgba(16, 32, 24, .04);
  --shadow-lg: 0 12px 16px -4px rgba(16, 32, 24, .09), 0 4px 6px -2px rgba(16, 32, 24, .04);
  --shadow-xl: 0 20px 24px -4px rgba(16, 32, 24, .12), 0 8px 8px -4px rgba(16, 32, 24, .05);

  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --mnav-h: 64px;

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-tamil: 'Noto Sans Tamil', 'Inter', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--g-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
::selection { background: var(--g-100); }
.ta { font-family: var(--font-tamil); }
i[data-icon] { display: inline-flex; align-items: center; justify-content: center; font-style: normal; flex: none; }
.ic { flex: none; }

/* Thin scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c7d1cb transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #c7d1cb; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ==========================================================================
   App shell
   ========================================================================== */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #05643d 0%, #054f31 55%, #053321 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: width .2s ease, transform .25s ease;
}
.sidebar::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(120% 50% at 0% 0%, rgba(255,255,255,.08), transparent 60%);
  pointer-events: none;
}
.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  transition: margin-left .2s ease;
}

.sb-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; padding: 0 18px; height: var(--topbar-h); flex: none; }
.sb-logo { width: 38px; height: 38px; flex: none; border-radius: 11px; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.sb-name { font-weight: 800; font-size: 16.5px; letter-spacing: -.02em; line-height: 1.1; }
.sb-tag { font-size: 11.5px; color: rgba(255,255,255,.66); font-weight: 500; margin-top: 2px; }
.sb-tag .ta { font-size: 11px; }

.sb-store {
  position: relative; z-index: 1;
  margin: 4px 14px 6px;
  padding: 10px 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 12px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
}
.sb-store .st-ic { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.12); display: grid; place-items: center; flex: none; }
.sb-store b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-store span { color: rgba(255,255,255,.62); white-space: nowrap; }
.sb-store .live { width: 8px; height: 8px; border-radius: 50%; background: var(--g-400); box-shadow: 0 0 0 3px rgba(50,213,131,.25); margin-left: auto; flex: none; }

.sb-nav { position: relative; z-index: 1; flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 16px; scrollbar-color: rgba(255,255,255,.2) transparent; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); }
.sb-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.48); padding: 16px 10px 6px; font-weight: 700; white-space: nowrap; }
.sb-link {
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 10px; margin: 1px 0;
  border-radius: 9px;
  color: rgba(255,255,255,.8);
  font-weight: 500; font-size: 14px;
  position: relative;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.sb-link:hover { background: rgba(255,255,255,.09); color: #fff; text-decoration: none; }
.sb-link .ic { width: 19px; height: 19px; opacity: .92; }
.sb-link.active { background: #fff; color: var(--g-800); font-weight: 650; box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.sb-link.active .ic { opacity: 1; color: var(--g-600); }
.sb-text { overflow: hidden; text-overflow: ellipsis; }
.sb-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.sb-badge.warn { background: #f79009; color: #fff; }
.sb-link.active .sb-badge { background: var(--g-100); color: var(--g-800); }
.sb-link.active .sb-badge.warn { background: var(--amber-100); color: var(--amber-700); }
.sb-kbd { margin-left: auto; font-family: var(--mono); font-size: 10.5px; padding: 0 5px; border: 1px solid rgba(255,255,255,.25); border-radius: 5px; color: rgba(255,255,255,.75); }
.sb-link.active .sb-kbd { border-color: var(--g-200); color: var(--g-700); }

.sb-foot { position: relative; z-index: 1; padding: 12px; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 10px; }
.sb-user { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.sb-user .avatar { background: rgba(255,255,255,.16); color: #fff; }
.sb-user b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user span { font-size: 11.5px; color: rgba(255,255,255,.62); }
.sb-collapse { width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(255,255,255,.16); background: transparent; color: rgba(255,255,255,.85); display: grid; place-items: center; cursor: pointer; flex: none; }
.sb-collapse:hover { background: rgba(255,255,255,.1); }

/* Collapsed rail (desktop) */
@media (min-width: 1024px) {
  body.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
  body.sb-collapsed .main { margin-left: var(--sidebar-w-collapsed); }
  body.sb-collapsed .sb-brand { padding: 0; justify-content: center; }
  body.sb-collapsed .sb-brand > div,
  body.sb-collapsed .sb-store,
  body.sb-collapsed .sb-text,
  body.sb-collapsed .sb-kbd,
  body.sb-collapsed .sb-user > div { display: none; }
  body.sb-collapsed .sb-group { font-size: 0; padding: 10px 0 6px; }
  body.sb-collapsed .sb-group::after { content: ''; display: block; height: 1px; background: rgba(255,255,255,.12); margin: 0 10px; }
  body.sb-collapsed .sb-link { justify-content: center; padding: 0; }
  body.sb-collapsed .sb-badge { position: absolute; top: 2px; right: 4px; min-width: 17px; height: 16px; font-size: 9.5px; padding: 0 4px; }
  body.sb-collapsed .sb-foot { flex-direction: column; }
  body.sb-collapsed .sb-collapse .ic { transform: rotate(180deg); }
}

/* Off-canvas (tablet & phone) */
.sb-overlay { position: fixed; inset: 0; background: rgba(5, 30, 18, .45); z-index: 45; opacity: 0; pointer-events: none; transition: opacity .2s; }
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-102%); width: 284px; box-shadow: var(--shadow-xl); }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .sb-overlay { opacity: 1; pointer-events: auto; }
  .main { margin-left: 0 !important; }
  .sb-collapse { display: none; }
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  background: rgba(255,255,255,.94);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
}
.tb-btn {
  position: relative;
  width: 40px; height: 40px; flex: none;
  border-radius: 10px; border: 0; background: transparent;
  color: var(--text-2);
  display: grid; place-items: center; cursor: pointer;
  transition: background .15s, color .15s;
}
.tb-btn:hover { background: var(--n-100); color: var(--text); }
.tb-btn .ic { width: 20px; height: 20px; }
.tb-menu { display: none; }
.tb-mbrand { display: none; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.02em; color: var(--g-800); }
.tb-mbrand svg { width: 30px; height: 30px; border-radius: 9px; }
.tb-search {
  flex: 1; max-width: 560px;
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 8px 0 14px;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--n-50); color: var(--text-3);
  cursor: text; font-size: 14px;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.tb-search:hover { border-color: var(--border-strong); background: #fff; }
.tb-search .ic { width: 18px; height: 18px; }
.tb-search span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tb-date { font-size: 12.5px; color: var(--text-3); text-align: right; line-height: 1.25; padding: 0 8px; white-space: nowrap; }
.tb-date b { display: block; color: var(--text); font-weight: 600; font-size: 13px; }
.tb-branch {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff;
  font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer;
}
.tb-branch .ic { width: 16px; height: 16px; color: var(--g-600); }
.tb-branch:hover { background: var(--n-50); }
.tb-user { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.tb-user:hover { background: var(--n-100); }
.tb-user b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.tb-user span { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.notif-dot { position: absolute; top: 6px; right: 6px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--red-600); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff; }

@media (max-width: 1279px) { .tb-date { display: none; } }
@media (max-width: 1023px) {
  .topbar { padding: 0 12px; gap: 6px; }
  .tb-menu { display: grid; }
  .tb-collapse { display: none; }
  .tb-branch span, .tb-user > div { display: none; }
  .tb-user .ic { display: none; }
}
@media (max-width: 767px) {
  .tb-mbrand { display: flex; }
  .tb-search { flex: none; width: 40px; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .tb-search span, .tb-search kbd { display: none; }
  .tb-search .ic { width: 20px; height: 20px; color: var(--text-2); }
  .tb-branch, .tb-newbill { display: none !important; }
}

/* ---------- Content ---------- */
.content { padding: 24px 28px 40px; width: 100%; max-width: 1640px; margin: 0 auto; flex: 1; }
@media (max-width: 1023px) { .content { padding: 20px 16px 32px; } }
@media (max-width: 767px) { .content { padding: 16px 16px calc(var(--mnav-h) + 28px + env(safe-area-inset-bottom)); } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; font-weight: 500; }
.crumbs a { color: var(--text-3); }
.crumbs .ic { width: 13px; height: 13px; }
.page-title { font-size: 24px; font-weight: 750; letter-spacing: -.025em; }
.page-sub { color: var(--text-3); margin-top: 3px; font-size: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 767px) {
  .page-title { font-size: 20px; }
  .page-head { margin-bottom: 16px; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
}

/* Mobile bottom navigation */
.mnav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 42;
  height: calc(var(--mnav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(16, 32, 24, .06);
  grid-template-columns: repeat(5, 1fr);
}
.mnav a, .mnav button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--text-3);
  border: 0; background: none; cursor: pointer; text-decoration: none;
}
.mnav .ic { width: 22px; height: 22px; }
.mnav a.active { color: var(--g-700); }
.mnav .mnav-cta span.cta { width: 46px; height: 46px; margin-top: -22px; border-radius: 16px; background: var(--g-600); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 14px rgba(3, 152, 85, .35); border: 3px solid #fff; }
.mnav .mnav-cta { color: var(--g-700); }
@media (max-width: 767px) { .mnav { display: grid; } }

/* ==========================================================================
   Layout helpers
   ========================================================================== */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); align-items: start; }
.split-rev { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1279px) { .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1199px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .split, .split-rev { grid-template-columns: 1fr; } }
@media (max-width: 1023px) { .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767px) {
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid { gap: 12px; }
  .grid { gap: 12px; }
}
@media (max-width: 479px) { .g-4 { grid-template-columns: 1fr; } }

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.col { flex-direction: column; }
.wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.none { flex: none; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.p-0 { padding: 0 !important; }
.w-100 { width: 100%; }
.text-right, .right { text-align: right; }
.text-center, .center { text-align: center; }
.text-xs { font-size: 12px; } .text-sm { font-size: 13px; } .text-md { font-size: 15px; } .text-lg { font-size: 17px; } .text-xl { font-size: 20px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; } .fw-800 { font-weight: 800; }
.muted, .text-muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.text-green { color: var(--g-700); } .text-red { color: var(--red-600); } .text-amber { color: var(--amber-700); } .text-blue { color: var(--blue-700); } .text-violet { color: var(--violet-700); }
.num, .tabnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.upper { text-transform: uppercase; letter-spacing: .06em; }
.hidden { display: none !important; }
@media (max-width: 767px) { .hide-sm { display: none !important; } }
@media (min-width: 768px) { .show-sm { display: none !important; } }
@media (max-width: 1023px) { .hide-md { display: none !important; } }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.sep-dot::before { content: '•'; margin: 0 6px; color: var(--n-400); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); min-height: 58px; flex-wrap: wrap; }
.card-head.plain { border-bottom: 0; padding-bottom: 4px; }
.card-title { font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-title .ic { width: 18px; height: 18px; color: var(--g-600); }
.card-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card.soft { background: var(--g-25); border-color: var(--g-100); }
@media (max-width: 767px) {
  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .card-foot { padding: 12px 16px; }
}

/* KPI tiles */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 13px; color: var(--text-2); font-weight: 550; }
.kpi-value { font-size: 27px; font-weight: 750; letter-spacing: -.025em; line-height: 1.1; color: var(--text); }
.kpi-value small { font-size: 15px; font-weight: 600; color: var(--text-3); letter-spacing: 0; }
.kpi-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-3); flex-wrap: wrap; }
.kpi.hero { background: linear-gradient(135deg, #05603a 0%, #027a48 55%, #039855 100%); color: #fff; border: 0; }
.kpi.hero .kpi-label, .kpi.hero .kpi-meta { color: rgba(255,255,255,.8); }
.kpi.hero .kpi-value { color: #fff; }
.kpi.hero .ic-box { background: rgba(255,255,255,.16); color: #fff; }
.kpi.hero .delta.up { background: rgba(255,255,255,.18); color: #fff; }
.kpi.hero .delta.down { background: rgba(255,255,255,.18); color: #fff; }
.kpi.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.07); }
@media (max-width: 767px) { .kpi { padding: 14px 16px; gap: 8px; } .kpi-value { font-size: 22px; } }

.ic-box { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--g-50); color: var(--g-700); flex: none; }
.ic-box .ic { width: 19px; height: 19px; }
.ic-box.sm { width: 32px; height: 32px; border-radius: 9px; }
.ic-box.sm .ic { width: 16px; height: 16px; }
.ic-box.lg { width: 46px; height: 46px; border-radius: 13px; }
.ic-box.amber { background: var(--amber-50); color: var(--amber-600); }
.ic-box.red { background: var(--red-50); color: var(--red-600); }
.ic-box.blue { background: var(--blue-50); color: var(--blue-600); }
.ic-box.violet { background: var(--violet-50); color: var(--violet-600); }
.ic-box.gray { background: var(--n-100); color: var(--text-2); }

.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 650; font-size: 12px; padding: 1px 7px 1px 5px; border-radius: 999px; }
.delta .ic { width: 13px; height: 13px; }
.delta.up { color: var(--g-700); background: var(--g-50); }
.delta.down { color: var(--red-700); background: var(--red-50); }
.delta.flat { color: var(--text-2); background: var(--n-100); }

/* Alert tiles (actionable) */
.alert-tile {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text); text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  min-width: 0;
}
.alert-tile:hover { text-decoration: none; border-color: var(--g-200); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.alert-tile .at-num { font-size: 20px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.alert-tile .at-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.alert-tile .at-go { margin-left: auto; color: var(--n-400); }
.alert-tile .at-go .ic { width: 18px; height: 18px; }
@media (max-width: 767px) {
  .alert-tile { padding: 12px; gap: 10px; }
  .alert-tile .at-go { display: none; }
  .alert-tile .ic-box { width: 32px; height: 32px; border-radius: 9px; }
  .alert-tile .at-num { font-size: 18px; }
  .alert-tile .at-label { font-size: 12px; line-height: 1.35; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none;
  text-decoration: none !important;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(.5px); }
.btn .ic { width: 17px; height: 17px; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--g-600); color: #fff; box-shadow: var(--shadow-xs), inset 0 -1px 0 rgba(0,0,0,.1); }
.btn-primary:hover { background: var(--g-700); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--n-50); border-color: var(--n-400); }
.btn-soft { background: var(--g-50); color: var(--g-700); border-color: var(--g-100); }
.btn-soft:hover { background: var(--g-100); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--n-100); color: var(--text); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger:hover { background: var(--red-700); }
.btn-danger-soft { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.btn-danger-soft:hover { background: var(--red-100); }
.btn-amber { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }
.btn-amber:hover { background: var(--amber-100); }
.btn-dark { background: var(--g-900); color: #fff; }
.btn-dark:hover { background: var(--g-950); }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-xs .ic { width: 14px; height: 14px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-sm .ic { width: 15px; height: 15px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 11px; }
.btn-xl { height: 54px; padding: 0 24px; font-size: 16px; border-radius: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-xs.btn-icon { width: 26px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }
.btn-group .btn + .btn { margin-left: -1px; }

kbd {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px;
  background: #fff; color: var(--text-2); line-height: 1.5;
}
.btn-primary kbd, .btn-dark kbd { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.32); color: #fff; }
.link-btn { border: 0; background: none; padding: 0; color: var(--g-700); font-weight: 600; cursor: pointer; font-size: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 13px; font-weight: 550; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--red-600); }
.label .opt { color: var(--text-3); font-weight: 400; font-size: 12px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: #fff; font-size: 14px; color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
.input::placeholder, .textarea::placeholder { color: #9aa59f; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--n-400); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--g-500); box-shadow: var(--focus-ring); }
.input:disabled, .select:disabled, .input[readonly] { background: var(--n-50); color: var(--text-2); }
.input.invalid, .select.invalid { border-color: var(--red-500); box-shadow: 0 0 0 4px rgba(240,68,56,.12); }
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7671' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input-sm, .select.input-sm { height: 32px; font-size: 13px; padding: 0 10px; border-radius: 8px; }
.select.input-sm { padding-right: 30px; }
.input-lg { height: 46px; font-size: 15px; border-radius: 11px; }
.input.num, input[type=number].input { font-variant-numeric: tabular-nums; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }
.hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--red-600); }

.input-icon { position: relative; display: block; min-width: 0; }
.input-icon > .ic, .input-icon > i[data-icon] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--text-3); pointer-events: none; }
.input-icon > i[data-icon] .ic { width: 17px; height: 17px; }
.input-icon .input { padding-left: 38px; }
.input-icon .input-sm { padding-left: 34px; }
.input-icon.sm > i[data-icon] { left: 10px; }

.input-group { display: flex; min-width: 0; }
.input-group .input, .input-group .select { border-radius: 0; flex: 1; position: relative; }
.input-group .input:focus { z-index: 1; }
.input-group > :first-child { border-top-left-radius: 9px; border-bottom-left-radius: 9px; }
.input-group > :last-child { border-top-right-radius: 9px; border-bottom-right-radius: 9px; }
.input-group > * + * { margin-left: -1px; }
.addon { display: grid; place-items: center; padding: 0 11px; background: var(--n-50); border: 1px solid var(--border-strong); color: var(--text-3); font-size: 13px; font-weight: 600; white-space: nowrap; }

.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-1 { grid-template-columns: 1fr; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-all { grid-column: 1 / -1; }
@media (max-width: 1023px) { .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .span-3 { grid-column: 1 / -1; } }
@media (max-width: 640px) {
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
}
.form-section { padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.form-section-title .ic { width: 16px; height: 16px; color: var(--g-600); }

input[type=checkbox], input[type=radio] { accent-color: var(--g-600); width: 16px; height: 16px; cursor: pointer; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--text); user-select: none; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 14px; }
.switch input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--n-300); position: relative; transition: background .2s; cursor: pointer; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .2s; }
.switch input:checked { background: var(--g-600); }
.switch input:checked::after { left: 19px; }
.switch input:focus-visible { box-shadow: var(--focus-ring); outline: none; }

/* Segmented control */
.seg { display: inline-flex; background: var(--n-100); border-radius: 10px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.active { background: #fff; color: var(--g-800); box-shadow: var(--shadow-sm); font-weight: 650; }
.seg.sm button { height: 26px; padding: 0 10px; font-size: 12.5px; }

/* Filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; font-size: 13px; font-weight: 550; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: all .15s; }
.chip:hover { border-color: var(--g-300); color: var(--g-800); }
.chip .count { font-size: 11.5px; font-weight: 700; color: var(--text-3); background: var(--n-100); border-radius: 999px; padding: 0 6px; }
.chip.active { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.chip.active .count { background: rgba(255,255,255,.2); color: #fff; }
.chip .ic { width: 15px; height: 15px; }

/* ==========================================================================
   Toolbar · tabs · pager
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 260px; max-width: 420px; }
.toolbar .spacer { flex: 1; }
@media (max-width: 767px) {
  .toolbar { padding: 12px; }
  .toolbar .search { max-width: none; flex-basis: 100%; }
  .toolbar > .select, .toolbar > .input { flex: 1 1 140px; }
}

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs.padded { padding: 0 12px; }
.tab { appearance: none; border: 0; background: none; padding: 12px 14px; font-size: 14px; font-weight: 550; color: var(--text-3); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; transition: color .15s; }
.tab .ic { width: 16px; height: 16px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--g-700); border-bottom-color: var(--g-600); font-weight: 650; }
.tab .count { background: var(--n-100); color: var(--text-2); font-size: 11.5px; padding: 0 7px; border-radius: 999px; font-weight: 700; line-height: 18px; }
.tab.active .count { background: var(--g-50); color: var(--g-700); }
.tab .count.warn { background: var(--amber-50); color: var(--amber-700); }
.tab .count.danger { background: var(--red-50); color: var(--red-700); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.pager-btns { display: flex; gap: 4px; align-items: center; }
.pager-btns button { min-width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); display: grid; place-items: center; padding: 0 8px; }
.pager-btns button:hover:not(:disabled) { background: var(--n-50); }
.pager-btns button.active { background: var(--g-600); border-color: var(--g-600); color: #fff; }
.pager-btns button:disabled { opacity: .45; cursor: not-allowed; }
.pager-btns .ic { width: 15px; height: 15px; }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll { max-height: 560px; overflow: auto; }
.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.dtable th {
  position: sticky; top: 0; z-index: 2;
  background: var(--n-50); color: var(--text-3);
  font-weight: 650; font-size: 12px; text-align: left;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  white-space: nowrap; letter-spacing: .01em;
}
.dtable th:first-child, .dtable td:first-child { padding-left: 20px; }
.dtable th:last-child, .dtable td:last-child { padding-right: 20px; }
.dtable td { padding: 11px 14px; border-bottom: 1px solid var(--n-100); vertical-align: middle; color: var(--text); }
.dtable tbody tr { transition: background .1s; }
.dtable tbody tr:hover td { background: var(--g-25); }
.dtable tbody tr:last-child td { border-bottom: 0; }
.dtable .num, .dtable th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable .center, .dtable th.center { text-align: center; }
.dtable .actions { text-align: right; white-space: nowrap; width: 1%; }
.dtable tr.clickable { cursor: pointer; }
.dtable tfoot td { font-weight: 700; background: var(--n-50); border-top: 1px solid var(--border); border-bottom: 0; }
.dtable.compact td { padding: 8px 12px; }
.dtable.compact th { padding: 8px 12px; }
.dtable.bordered td, .dtable.bordered th { border-right: 1px solid var(--n-100); }
.dtable tr.row-red td { background: #fffbfa; }
.dtable tr.row-amber td { background: #fffdf5; }
.dtable tr.row-muted td { color: var(--text-3); }
.dtable tr.selected td { background: var(--g-50); }
.cell-title { font-weight: 600; color: var(--text); line-height: 1.35; }
.cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; line-height: 1.35; }
.cell-flex { display: flex; align-items: center; gap: 10px; min-width: 0; }
.th-sort { cursor: pointer; user-select: none; }
.th-sort:hover { color: var(--text); }

/* Responsive card-table on phones */
@media (max-width: 640px) {
  .table-wrap.stackable { padding: 12px; overflow: visible; }
  .dtable.rt thead { display: none; }
  .dtable.rt, .dtable.rt tbody, .dtable.rt tfoot, .dtable.rt tr, .dtable.rt td { display: block; width: 100%; }
  .dtable.rt tr { border: 1px solid var(--border); border-radius: 12px; margin: 0 0 10px; padding: 4px 14px; background: #fff; box-shadow: var(--shadow-xs); }
  .dtable.rt tbody tr:hover td { background: transparent; }
  .dtable.rt td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0 !important; border-bottom: 1px dashed var(--n-200); text-align: right; min-height: 38px; }
  .dtable.rt td::before { content: attr(data-label); font-size: 12px; color: var(--text-3); font-weight: 550; text-align: left; flex: none; }
  .dtable.rt td.td-main { display: block; text-align: left; padding: 10px 0 !important; border-bottom: 1px solid var(--n-200); }
  .dtable.rt td.td-main::before { display: none; }
  .dtable.rt td.hide-sm { display: none; }
  .dtable.rt td:last-child { border-bottom: 0; }
  .dtable.rt td.actions { width: 100%; justify-content: flex-end; }
  .dtable.rt td.actions::before { content: ''; }
  .dtable.rt td[data-label=""]::before { display: none; }
  .dtable.rt tfoot tr { background: var(--n-50); }
  .dtable.rt tr.row-red { border-color: var(--red-200); }
  .dtable.rt tr.row-amber { border-color: var(--amber-200); }
}

/* ==========================================================================
   Badges & status
   ========================================================================== */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--n-100); color: var(--text-2); line-height: 1; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge .ic { width: 13px; height: 13px; }
.badge.sm { height: 19px; font-size: 11px; padding: 0 6px; }
.b-green { background: var(--g-50); color: var(--g-700); }
.b-amber { background: var(--amber-50); color: var(--amber-700); }
.b-red { background: var(--red-50); color: var(--red-700); }
.b-blue { background: var(--blue-50); color: var(--blue-700); }
.b-violet { background: var(--violet-50); color: var(--violet-700); }
.b-gray { background: var(--n-100); color: var(--text-2); }
.b-solid-green { background: var(--g-600); color: #fff; }
.b-solid-red { background: var(--red-600); color: #fff; }
.b-outline { background: #fff; border: 1px solid var(--border-strong); }

.sch { display: inline-grid; place-items: center; min-width: 30px; height: 20px; padding: 0 5px; border-radius: 5px; font-size: 10.5px; font-weight: 750; letter-spacing: .03em; border: 1px solid; line-height: 1; flex: none; }
.sch-otc { color: var(--g-700); border-color: var(--g-200); background: var(--g-50); }
.sch-h { color: var(--amber-700); border-color: var(--amber-200); background: var(--amber-50); }
.sch-h1 { color: var(--red-700); border-color: var(--red-200); background: var(--red-50); }
.sch-x { color: var(--violet-700); border-color: var(--violet-200); background: var(--violet-50); }
.sch-g { color: var(--blue-700); border-color: var(--blue-200); background: var(--blue-50); }
.tagline { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; color: var(--blue-700); }
.tagline .ic { width: 13px; height: 13px; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--g-100); color: var(--g-800); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; letter-spacing: .02em; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 48px; height: 48px; font-size: 16px; }
.avatar.xl { width: 64px; height: 64px; font-size: 21px; }

.progress { height: 8px; border-radius: 999px; background: var(--n-100); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--g-500); }
.progress.amber > span { background: var(--amber-500); }
.progress.red > span { background: var(--red-500); }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 11px; border: 1px solid; font-size: 13.5px; line-height: 1.5; }
.notice .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.notice b { font-weight: 650; }
.notice-green { background: var(--g-50); border-color: var(--g-200); color: var(--g-900); }
.notice-amber { background: var(--amber-50); border-color: var(--amber-200); color: #7a2e0e; }
.notice-red { background: var(--red-50); border-color: var(--red-200); color: #7a271a; }
.notice-blue { background: var(--blue-50); border-color: var(--blue-200); color: #194185; }
.notice-gray { background: var(--n-50); border-color: var(--border); color: var(--text-2); }

.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; font-size: 13.5px; }
.kv > :first-child { color: var(--text-3); }
.kv > :last-child { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.kv.total { border-top: 1px dashed var(--border-strong); margin-top: 6px; padding-top: 12px; font-size: 15px; }
.kv.total > :first-child { color: var(--text); font-weight: 650; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--n-100); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--g-25); }
a.list-item { color: inherit; text-decoration: none; }
@media (max-width: 767px) { .list-item { padding: 12px 16px; } }

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--g-50); color: var(--g-600); display: grid; place-items: center; margin: 0 auto 14px; border: 1px solid var(--g-100); }
.empty-icon .ic { width: 24px; height: 24px; }
.empty h4 { color: var(--text); font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.empty p { font-size: 13.5px; max-width: 360px; margin: 0 auto; }
.empty .btn { margin-top: 16px; }

.restricted { max-width: 460px; margin: 10vh auto; text-align: center; }

/* ==========================================================================
   Overlays: modal · drawer · menu · toast · command palette
   ========================================================================== */
.modal-backdrop, .drawer-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(8, 28, 18, .48);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .18s ease;
}
.modal-backdrop { display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 110; }
.modal-backdrop.show, .drawer-backdrop.show { opacity: 1; }
.modal {
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-xl);
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
  transform: translateY(10px) scale(.985); transition: transform .2s ease;
}
.modal-backdrop.show .modal { transform: none; }
.modal.sm { max-width: 420px; }
.modal.lg { max-width: 820px; }
.modal.xl { max-width: 1100px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 16px; border-bottom: 1px solid var(--border); flex: none; }
.modal-title { font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.modal-sub { font-size: 13px; color: var(--text-3); margin-top: 3px; }
.modal-close { width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--text-3); display: grid; place-items: center; cursor: pointer; flex: none; margin: -4px -8px 0 0; }
.modal-close:hover { background: var(--n-100); color: var(--text); }
.modal-close .ic { width: 19px; height: 19px; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-body.flush { padding: 0; }
.modal-foot { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--n-50); border-radius: 0 0 16px 16px; flex: none; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
@media (max-width: 640px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none !important; border-radius: 20px 20px 0 0; max-height: 94vh; max-height: 94dvh; transform: translateY(40px); }
  .modal::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--n-300); margin: 8px auto 0; flex: none; }
  .modal-head { padding: 12px 16px 14px; }
  .modal-body { padding: 16px; }
  .modal-foot { border-radius: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1 1 auto; }
  .modal-foot .left { flex-basis: 100%; }
}

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 101;
  width: min(560px, 100%);
  background: #fff; box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .24s ease;
}
.drawer.wide { width: min(760px, 100%); }
.drawer.show { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--border); flex: none; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.drawer-body.flush { padding: 0; }
.drawer-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--n-50); flex: none; flex-wrap: wrap; }
@media (max-width: 640px) { .drawer-head, .drawer-body { padding-left: 16px; padding-right: 16px; } .drawer-foot { padding-left: 16px; padding-right: 16px; } .drawer-foot .btn { flex: 1 1 auto; } }

.menu { position: fixed; min-width: 220px; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 120; animation: pop .14s ease; }
.menu-head { padding: 10px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--text); border: 0; background: none; text-align: left; cursor: pointer; text-decoration: none !important; }
.menu-item:hover { background: var(--n-50); }
.menu-item .ic { width: 16px; height: 16px; color: var(--text-3); }
.menu-item.danger { color: var(--red-700); }
.menu-item.danger .ic { color: var(--red-600); }
.menu-item .check-ic { margin-left: auto; color: var(--g-600); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.notif-panel { width: 380px; padding: 0; }
.notif-panel .np-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.notif-panel .np-list { max-height: 420px; overflow-y: auto; }
.notif-panel .np-item { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--n-100); color: var(--text); text-decoration: none !important; align-items: flex-start; }
.notif-panel .np-item:hover { background: var(--g-25); }
.notif-panel .np-item b { font-size: 13.5px; font-weight: 600; display: block; }
.notif-panel .np-item span { font-size: 12.5px; color: var(--text-3); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; min-width: 280px; max-width: 400px; background: #10241a; color: #fff; border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--shadow-xl); animation: toastIn .22s ease; font-size: 13.5px; }
.toast .t-ic { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--g-500); color: #fff; flex: none; }
.toast .t-ic .ic { width: 14px; height: 14px; }
.toast.error .t-ic { background: var(--red-500); }
.toast.warn .t-ic { background: var(--amber-500); }
.toast.info .t-ic { background: var(--blue-600); }
.toast b { display: block; font-weight: 650; margin-bottom: 1px; }
.toast span { color: rgba(255,255,255,.78); }
.toast.hide { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }
@media (max-width: 767px) {
  .toasts { left: 12px; right: 12px; bottom: calc(var(--mnav-h) + 12px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; min-width: 0; }
}

.cmdk-backdrop { position: fixed; inset: 0; z-index: 150; background: rgba(8, 28, 18, .45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; opacity: 0; transition: opacity .15s; }
.cmdk-backdrop.show { opacity: 1; }
.cmdk { width: 100%; max-width: 680px; background: #fff; border-radius: 16px; box-shadow: var(--shadow-xl); overflow: hidden; display: flex; flex-direction: column; max-height: 76vh; }
.cmdk-search { position: relative; border-bottom: 1px solid var(--border); flex: none; }
.cmdk-search .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--g-600); }
.cmdk-search input { width: 100%; height: 58px; border: 0; outline: none; padding: 0 60px 0 50px; font-size: 16px; }
.cmdk-search kbd { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); }
.cmdk-list { overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 10px 10px 6px; }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; min-width: 0; }
.cmdk-item.active { background: var(--g-50); }
.cmdk-item .ic-box { width: 32px; height: 32px; border-radius: 9px; }
.cmdk-item .ci-main { flex: 1; min-width: 0; }
.cmdk-item .ci-main b { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .ci-main span { font-size: 12px; color: var(--text-3); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .ci-right { text-align: right; font-size: 12px; color: var(--text-3); flex: none; }
.cmdk-item .ci-right b { display: block; color: var(--text); font-size: 13px; }
.cmdk-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--n-50); flex: none; flex-wrap: wrap; }
@media (max-width: 640px) { .cmdk-backdrop { padding: 0; } .cmdk { max-height: 100vh; max-height: 100dvh; height: 100%; border-radius: 0; } .cmdk-foot { display: none; } }

/* Autocomplete dropdown */
.ac-list { position: fixed; z-index: 130; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-xl); max-height: 380px; overflow-y: auto; padding: 4px; animation: pop .12s ease; }
.ac-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; cursor: pointer; min-width: 0; }
.ac-item.active { background: var(--g-50); }
.ac-item.disabled { opacity: .55; }
.ac-empty { padding: 14px; text-align: center; color: var(--text-3); font-size: 13px; }
.ac-main { flex: 1; min-width: 0; }
.ac-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.ac-title > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-right { text-align: right; font-size: 12px; color: var(--text-3); flex: none; }
.ac-right b { display: block; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Charts
   ========================================================================== */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .base-line { stroke: var(--chart-axis); stroke-width: 1; }
.chart .bar { transition: opacity .12s; }
.chart .bar.dim { opacity: .35; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart-tip { position: absolute; pointer-events: none; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .1s; z-index: 5; color: var(--text); }
.chart-tip.show { opacity: 1; }
.chart-tip .tt-label { color: var(--text-3); font-size: 11.5px; margin-bottom: 2px; }
.chart-tip .tt-row { display: flex; align-items: center; gap: 8px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-tip .tt-row i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.chart-tip .tt-row span { color: var(--text-2); font-weight: 500; margin-right: auto; }
.legend { display: flex; gap: 8px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.splitbar { display: flex; height: 14px; gap: 2px; border-radius: 7px; overflow: hidden; background: #fff; }
.splitbar span { display: block; height: 100%; min-width: 3px; }
.split-legend { display: flex; flex-direction: column; margin-top: 14px; }
.split-legend .sl-row { display: grid; grid-template-columns: 12px 1fr auto 52px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--n-100); font-size: 13.5px; }
.split-legend .sl-row:last-child { border-bottom: 0; }
.split-legend .sl-row i { width: 10px; height: 10px; border-radius: 3px; }
.split-legend .sl-row b { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.split-legend .sl-row small { color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.hbar-list { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 13px; }
.hbar-row .hb-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-weight: 550; }
.hbar-row .hb-val { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.hbar-row .hb-track { grid-column: 1 / -1; height: 8px; background: var(--n-100); border-radius: 4px; overflow: hidden; }
.hbar-row .hb-track span { display: block; height: 100%; border-radius: 4px; background: var(--g-500); }

/* ==========================================================================
   Login
   ========================================================================== */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: #fff; }
.auth-brand {
  position: relative; overflow: hidden;
  background: linear-gradient(150deg, #05643d 0%, #054f31 50%, #053321 100%);
  color: #fff; padding: 48px 56px; display: flex; flex-direction: column;
}
.auth-brand::before { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -180px; top: -160px; background: radial-gradient(circle, rgba(50,213,131,.28), transparent 65%); }
.auth-brand::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; left: -160px; bottom: -180px; background: radial-gradient(circle, rgba(255,255,255,.10), transparent 65%); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo svg { width: 44px; height: 44px; border-radius: 13px; box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.auth-logo b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; display: block; line-height: 1.1; }
.auth-logo span { font-size: 12.5px; color: rgba(255,255,255,.7); }
.auth-hero { margin: auto 0; padding: 40px 0; max-width: 520px; }
.auth-hero h1 { font-size: 40px; line-height: 1.12; font-weight: 800; letter-spacing: -.03em; }
.auth-hero h1 em { font-style: normal; color: var(--g-300); }
.auth-hero p { font-size: 16px; color: rgba(255,255,255,.78); margin-top: 16px; line-height: 1.6; }
.auth-feats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
.auth-feat { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); font-size: 13px; color: rgba(255,255,255,.85); }
.auth-feat .ic { width: 18px; height: 18px; color: var(--g-300); flex: none; margin-top: 1px; }
.auth-feat b { display: block; color: #fff; font-weight: 600; font-size: 13.5px; }
.auth-foot { font-size: 12.5px; color: rgba(255,255,255,.6); display: flex; gap: 16px; flex-wrap: wrap; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: linear-gradient(180deg, #fff, var(--g-25)); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 26px; font-weight: 800; letter-spacing: -.025em; }
.auth-card .sub { color: var(--text-3); margin-top: 6px; }
.role-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.role-pick button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; border: 1.5px solid var(--border); background: #fff; cursor: pointer; text-align: left; transition: all .15s; min-width: 0; }
.role-pick button:hover { border-color: var(--g-300); }
.role-pick button.active { border-color: var(--g-600); background: var(--g-50); box-shadow: 0 0 0 3px rgba(18,183,106,.12); }
.role-pick b { display: block; font-size: 13px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.role-pick span { display: block; font-size: 11.5px; color: var(--text-3); }
@media (max-width: 1023px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 24px 32px; }
  .auth-hero { padding: 28px 0 8px; margin: 0; }
  .auth-hero h1 { font-size: 28px; }
  .auth-hero p { font-size: 14.5px; }
  .auth-feats, .auth-foot { display: none; }
  .auth-panel { padding: 28px 16px 40px; align-items: flex-start; }
}

/* ==========================================================================
   POS billing
   ========================================================================== */
body[data-page="pos"] .content { max-width: none; padding: 16px 20px 24px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 392px; gap: 16px; align-items: start; }
.pos-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pos-side { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; gap: 14px; }
.pos-head { display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; padding: 12px 16px; }
.pos-head .ph-item { display: flex; flex-direction: column; min-width: 0; }
.pos-head .ph-item span { font-size: 11.5px; color: var(--text-3); font-weight: 550; text-transform: uppercase; letter-spacing: .05em; }
.pos-head .ph-item b { font-size: 14px; font-weight: 700; white-space: nowrap; }
.pos-head .ph-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pos-search { position: relative; }
.pos-search .input { height: 54px; font-size: 16px; padding-left: 50px; padding-right: 120px; border-radius: 13px; border-width: 1.5px; border-color: var(--g-200); box-shadow: 0 2px 10px rgba(3,152,85,.07); }
.pos-search .input:focus { border-color: var(--g-500); }
.pos-search > i[data-icon] { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--g-600); pointer-events: none; }
.pos-search > i[data-icon] .ic { width: 21px; height: 21px; }
.pos-search .ps-right { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; gap: 6px; align-items: center; }

.cart-card { min-height: 360px; display: flex; flex-direction: column; }
.cart-table td { padding-top: 10px; padding-bottom: 10px; }
.cart-table .ci-name { font-weight: 650; line-height: 1.3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cart-table .ci-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.batch-pill { display: inline-flex; flex-direction: column; align-items: flex-start; border: 1px dashed var(--border-strong); border-radius: 8px; padding: 3px 8px; background: #fff; cursor: pointer; font-size: 12px; line-height: 1.3; text-align: left; }
.batch-pill:hover { border-color: var(--g-500); background: var(--g-25); }
.batch-pill b { font-family: var(--mono); font-size: 11.5px; font-weight: 600; }
.batch-pill.warn { border-color: var(--amber-200); background: var(--amber-50); }
.qty-box { display: inline-flex; align-items: stretch; border: 1px solid var(--border-strong); border-radius: 9px; overflow: hidden; background: #fff; }
.qty-box input { width: 46px; height: 32px; border: 0; text-align: center; font-weight: 650; font-size: 14px; outline: none; font-variant-numeric: tabular-nums; padding: 0 2px; }
.qty-box input:focus { background: var(--g-25); }
.qty-box label { font-size: 10.5px; color: var(--text-3); padding: 0 6px; background: var(--n-50); display: grid; place-items: center; border-left: 1px solid var(--border); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.qty-box label + input { border-left: 1px solid var(--border); }
.disc-input { width: 62px; height: 32px; border: 1px solid var(--border-strong); border-radius: 8px; text-align: right; padding: 0 8px; font-weight: 600; font-variant-numeric: tabular-nums; }
.disc-input:focus { outline: none; border-color: var(--g-500); box-shadow: var(--focus-ring); }
.cart-empty { flex: 1; display: grid; place-items: center; padding: 40px 20px; }
.pos-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-3); padding: 10px 16px; border-top: 1px solid var(--border); background: var(--n-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); margin-top: auto; }
.pos-keys span { display: inline-flex; align-items: center; gap: 6px; }

.cust-box { padding: 14px 16px; }
.cust-chip { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; background: var(--g-25); border: 1px solid var(--g-100); }
.cust-chip b { display: block; font-size: 14px; }
.cust-chip span { font-size: 12px; color: var(--text-3); }
.total-card .tc-body { padding: 14px 18px 6px; }
.grand { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 14px 18px; background: linear-gradient(135deg, var(--g-50), #fff); border-top: 1px solid var(--g-100); border-bottom: 1px solid var(--g-100); }
.grand span { font-size: 13px; color: var(--g-800); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; }
.grand b { font-size: 34px; font-weight: 800; letter-spacing: -.03em; color: var(--g-800); line-height: 1; }
.savings { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--g-800); background: var(--g-50); padding: 6px 10px; border-radius: 8px; font-weight: 600; }
.savings .ic { width: 15px; height: 15px; }
.pay-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pay-mode { border: 1.5px solid var(--border); border-radius: 12px; padding: 10px 4px 8px; text-align: center; cursor: pointer; background: #fff; font-size: 12.5px; font-weight: 650; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 5px; transition: all .15s; }
.pay-mode .ic { width: 20px; height: 20px; }
.pay-mode:hover { border-color: var(--g-300); }
.pay-mode.active { border-color: var(--g-600); background: var(--g-50); color: var(--g-800); box-shadow: 0 0 0 3px rgba(18,183,106,.12); }
.pay-mode:disabled { opacity: .45; cursor: not-allowed; }
.denoms { display: flex; flex-wrap: wrap; gap: 6px; }
.denoms button { height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.denoms button:hover { background: var(--g-50); border-color: var(--g-300); }
.change-due { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 11px; background: var(--g-50); border: 1px solid var(--g-100); font-weight: 650; }
.change-due b { font-size: 22px; color: var(--g-800); }
.upi-qr { display: grid; place-items: center; padding: 14px; border: 1px dashed var(--border-strong); border-radius: 14px; background: #fff; }
.pos-paybar { display: none; }
@media (min-width: 641px) { .cart-table td.td-main { min-width: 190px; } }
@media (max-width: 1279px) {
  .pos { grid-template-columns: minmax(0, 1fr) 360px; }
  .cart-table th:first-child, .cart-table td.c-idx { display: none; }
  .cart-table th:nth-child(2), .cart-table td.td-main { padding-left: 16px; }
}
@media (max-width: 1023px) {
  .pos { grid-template-columns: 1fr; }
  .pos-side { position: static; }
  body[data-page="pos"] .content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .pos-keys { display: none; }
}
@media (min-width: 641px) and (max-width: 1023px) {
  .cart-table th, .cart-table td { padding-left: 9px !important; padding-right: 9px !important; }
  .cart-table td.td-main { min-width: 160px; }
  .cart-table .disc-input { width: 54px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .pos-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .pos-side > :nth-child(3) { grid-column: 2; grid-row: 1 / span 2; }
}
@media (max-width: 767px) {
  body[data-page="pos"] .content { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }
  body[data-page="pos"] .mnav { display: none; }
  .pos-head .ph-actions { margin-left: 0; width: 100%; }
  .pos-head .ph-actions .btn { flex: 1; }
  .pos-search .input { padding-right: 16px; height: 50px; }
  .pos-search .ps-right { display: none; }
}
@media (max-width: 1023px) {
  .pos-paybar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 42;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(16,32,24,.08);
    align-items: center; gap: 12px;
  }
  .pos-paybar .pb-total span { display: block; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
  .pos-paybar .pb-total b { font-size: 22px; font-weight: 800; color: var(--g-800); letter-spacing: -.02em; }
  .pos-paybar .btn { margin-left: auto; }
}
@media (max-width: 767px) {
  .cart-table.rt td.td-main { padding-right: 36px !important; position: relative; }
  .cart-table.rt .rm-btn { position: absolute; right: -6px; top: 8px; }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
  .sidebar, .topbar, .mnav, .no-print, .toasts, .page-actions { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; }
}
