/* =========================================================
   Shamura Broilers – Design system v3
   Follows the supplied UI reference: pill navigation with an
   icon on the active item, two-tone headings, round icon
   buttons, bordered cards with icon chips, grey pill action
   groups, hatched "empty" fills and a light / dark theme.
   ========================================================= */
/* ---------- Brand tokens ----------
   Farm brand: deep charcoal green canvas, forest-green chrome, farm-green actions,
   golden yellow for key actions/metrics (sparingly), chicken orange for highlights/alerts.
   --sb-brand = fill colour (buttons, active states). --sb-navy = readable accent for
   text, icons and chart lines (kept under its old name so every module follows). */
:root {
  /* Light theme (optional) */
  --sb-brand: #285C3B;           /* farm green fill */
  --sb-brand-hover: #214D31;
  --sb-on-brand: #FFFFFF;
  --sb-navy: #2F6D46;            /* accent text / icons / lines (6.2:1 on white) */
  --sb-navy-600: #255A39;
  --sb-navy-700: #1D4A2E;
  --sb-navy-50: #EAF2EC;
  --sb-navy-100: #D3E5D8;
  --sb-gold: #E8B83F;            /* key actions & metrics */
  --sb-gold-text: #8A6A10;       /* gold used as text on light */
  --sb-gold-50: #FBF3DC;
  --sb-on-gold: #1B1606;
  --sb-hatch: #B9D3C1;
  --sb-ink: #16201A;
  --sb-text: #26302A;
  --sb-muted: #5E6B62;
  --sb-faint: #7D897F;
  --sb-green: #22844A;           /* positive / completed */
  --sb-green-600: #1C6E3D;
  --sb-green-50: #E6F3EA;
  --sb-amber: #B4501A;           /* chicken orange as text on light (4.9:1) */
  --sb-orange: #E87932;          /* chicken orange fill */
  --sb-on-orange: #1B1206;
  --sb-amber-50: #FDEEE4;
  --sb-red: #C2362B;
  --sb-red-50: #FBE9E7;
  --sb-bg: #F4F6F2;
  --sb-chrome: #FFFFFF;          /* top bar, drawer, bottom bar */
  --sb-chrome-2: #EEF2EC;
  --sb-surface: #FFFFFF;
  --sb-surface-2: #EEF2EC;
  --sb-input: #FFFFFF;
  --sb-border: #DCE3DA;
  --sb-radius: 16px;
  --sb-radius-sm: 12px;
  --sb-shadow: 0 1px 2px rgba(22, 32, 26, .04);
  --sb-shadow-lg: 0 16px 40px rgba(22, 32, 26, .14);
  --sb-topbar-h: 76px;
  --sb-max: 1440px;

  --bs-body-font-family: "Plus Jakarta Sans", "Noto Sans Tamil", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --bs-body-color: var(--sb-text);
  --bs-body-bg: var(--sb-bg);
  --bs-primary: var(--sb-navy);
  --bs-primary-rgb: 47, 109, 70;
  --bs-success: var(--sb-green);
  --bs-success-rgb: 34, 132, 74;
  --bs-warning-rgb: 180, 80, 26;
  --bs-link-color: var(--sb-navy);
  --bs-link-color-rgb: 47, 109, 70;
  --bs-link-hover-color: var(--sb-navy-600);
  --bs-border-color: var(--sb-border);
  --bs-secondary-color: var(--sb-muted);
  --bs-tertiary-bg: var(--sb-surface-2);
}

/* ---------- Dark theme (default) ---------- */
[data-theme="dark"] {
  --sb-brand: #285C3B;           /* farm green */
  --sb-brand-hover: #31704A;
  --sb-on-brand: #F5F7F4;        /* 7.3:1 */
  --sb-navy: #6CC28A;            /* farm-green tint for text/icons/lines (6.6:1 on cards) */
  --sb-navy-600: #82CF9C;
  --sb-navy-700: #9BDAB0;
  --sb-navy-50: rgba(108, 194, 138, .12);
  --sb-navy-100: rgba(108, 194, 138, .24);
  --sb-gold: #E8B83F;            /* golden yellow (7.7:1 on cards) */
  --sb-gold-text: #E8B83F;
  --sb-gold-50: rgba(232, 184, 63, .13);
  --sb-on-gold: #1B1606;
  --sb-hatch: rgba(108, 194, 138, .34);
  --sb-ink: #F5F7F4;             /* soft white */
  --sb-text: #E3E8E4;
  --sb-muted: #AAB6AD;           /* muted grey-green (6.8:1 on cards) */
  --sb-faint: #8A968D;
  --sb-green: #5BBE7E;           /* completed / positive */
  --sb-green-600: #5BBE7E;
  --sb-green-50: rgba(91, 190, 126, .14);
  --sb-amber: #E87932;           /* chicken orange (4.9:1 on cards) */
  --sb-orange: #E87932;
  --sb-on-orange: #1B1206;
  --sb-amber-50: rgba(232, 121, 50, .14);
  --sb-red: #EF6A5F;
  --sb-red-50: rgba(239, 106, 95, .14);
  --sb-bg: #151C18;              /* deep charcoal green */
  --sb-chrome: #19251E;          /* dark forest green: top bar, drawer, bottom bar */
  --sb-chrome-2: #22302A;
  --sb-surface: #242D27;         /* cards & panels */
  --sb-surface-2: #1D2620;
  --sb-input: #1C2420;
  --sb-border: #323D36;
  --sb-shadow: none;
  --sb-shadow-lg: 0 18px 40px rgba(5, 10, 7, .55);
  --bs-primary-rgb: 108, 194, 138;
  --bs-success-rgb: 91, 190, 126;
  --bs-warning-rgb: 232, 121, 50;
  --bs-link-color-rgb: 108, 194, 138;
  --bs-body-bg: var(--sb-bg);
  --bs-body-color: var(--sb-text);
  --bs-border-color: var(--sb-border);
  --bs-secondary-bg: var(--sb-surface-2);
  --bs-tertiary-bg: var(--sb-surface-2);
  --bs-emphasis-color: var(--sb-ink);
  color-scheme: dark;
}
[data-theme="dark"] .modal-content, [data-theme="dark"] .dropdown-menu, [data-theme="dark"] .offcanvas, [data-theme="dark"] .toast { background-color: var(--sb-surface); color: var(--sb-text); }
[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(2); }
[data-theme="dark"] .text-muted { color: var(--sb-muted) !important; }
[data-theme="dark"] .text-success { color: var(--sb-green) !important; }
[data-theme="dark"] .text-danger { color: var(--sb-red) !important; }
[data-theme="dark"] .alert-warning { background: var(--sb-amber-50); color: var(--sb-amber); border-color: transparent; }

html, body { height: 100%; }
body { font-size: .9375rem; background: var(--sb-bg); color: var(--sb-text); -webkit-font-smoothing: antialiased; font-feature-settings: "ss01"; }
.num, .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.min-w-0 { min-width: 0; }
.accent { color: var(--sb-navy); }
.skip-link { position: absolute; left: 8px; top: 8px; z-index: 2000; background: var(--sb-surface); padding: 8px 12px; border-radius: 8px; }
::selection { background: var(--sb-navy-100); }
kbd { background: var(--sb-surface-2); color: var(--sb-ink); border: 1px solid var(--sb-border); border-radius: 6px; padding: .05rem .4rem; font-size: .8em; }

/* Hatched fill used for "empty" bars, dots and remainders */
.hatch { background-image: repeating-linear-gradient(135deg, var(--sb-hatch) 0 1.5px, transparent 1.5px 6px); }

/* ---------- Buttons (pill shaped) ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-font-size: .9rem; --bs-btn-padding-x: 1.1rem; border-radius: 999px; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-sm { min-height: 34px; --bs-btn-font-size: .82rem; --bs-btn-padding-x: .85rem; }
.btn-primary { --bs-btn-color: var(--sb-on-brand); --bs-btn-bg: var(--sb-brand); --bs-btn-border-color: var(--sb-brand); --bs-btn-hover-color: var(--sb-on-brand); --bs-btn-hover-bg: var(--sb-brand-hover); --bs-btn-hover-border-color: var(--sb-brand-hover); --bs-btn-active-color: var(--sb-on-brand); --bs-btn-active-bg: var(--sb-brand-hover); --bs-btn-active-border-color: var(--sb-brand-hover); --bs-btn-disabled-color: var(--sb-on-brand); --bs-btn-disabled-bg: var(--sb-brand); --bs-btn-disabled-border-color: var(--sb-brand); }
/* Golden yellow: reserved for the single most important action on a screen */
.btn-gold { --bs-btn-color: var(--sb-on-gold); --bs-btn-bg: var(--sb-gold); --bs-btn-border-color: var(--sb-gold); --bs-btn-hover-color: var(--sb-on-gold); --bs-btn-hover-bg: #F0C658; --bs-btn-hover-border-color: #F0C658; --bs-btn-active-color: var(--sb-on-gold); --bs-btn-active-bg: #D9A92F; --bs-btn-active-border-color: #D9A92F; --bs-btn-disabled-bg: var(--sb-gold); --bs-btn-disabled-color: var(--sb-on-gold); }
.btn-outline-primary { --bs-btn-color: var(--sb-navy); --bs-btn-border-color: var(--sb-border); --bs-btn-bg: var(--sb-surface); --bs-btn-hover-color: var(--sb-navy); --bs-btn-hover-bg: var(--sb-navy-50); --bs-btn-hover-border-color: var(--sb-navy-100); --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--sb-navy); --bs-btn-active-border-color: var(--sb-navy); }
.btn-success { --bs-btn-color: #fff; --bs-btn-bg: var(--sb-green); --bs-btn-border-color: var(--sb-green); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--sb-green-600); --bs-btn-hover-border-color: var(--sb-green-600); --bs-btn-active-bg: var(--sb-green-600); --bs-btn-disabled-bg: var(--sb-green); --bs-btn-disabled-border-color: var(--sb-green); }
[data-theme="dark"] .btn-success { --bs-btn-color: #0B1F12; --bs-btn-hover-color: #0B1F12; --bs-btn-active-color: #0B1F12; --bs-btn-disabled-color: #0B1F12; }
.btn-outline-success { --bs-btn-color: var(--sb-green-600); --bs-btn-border-color: var(--sb-border); --bs-btn-bg: var(--sb-surface); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--sb-green); --bs-btn-hover-border-color: var(--sb-green); }
.btn-outline-secondary { --bs-btn-color: var(--sb-text); --bs-btn-border-color: var(--sb-border); --bs-btn-bg: var(--sb-surface); --bs-btn-hover-color: var(--sb-navy); --bs-btn-hover-bg: var(--sb-navy-50); --bs-btn-hover-border-color: var(--sb-navy-100); --bs-btn-active-color: var(--sb-navy); --bs-btn-active-bg: var(--sb-navy-50); --bs-btn-active-border-color: var(--sb-navy-100); }
.btn-outline-danger { --bs-btn-color: var(--sb-red); --bs-btn-border-color: var(--sb-border); --bs-btn-bg: var(--sb-surface); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--sb-red); --bs-btn-hover-border-color: var(--sb-red); }
.btn-icon { width: 42px; height: 42px; padding: 0; border: 0; background: transparent; color: var(--sb-muted); border-radius: 50%; }
.btn-icon:hover { background: var(--sb-navy-50); color: var(--sb-navy); }
.btn-round { width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--sb-border); background: var(--sb-surface-2); color: var(--sb-ink); font-size: 1.05rem; }
.btn-round:hover { border-color: var(--sb-navy-100); background: var(--sb-navy-50); color: var(--sb-navy); }
.btn-round.primary { background: var(--sb-brand); border-color: var(--sb-brand); color: var(--sb-on-brand); }
.btn-round.sm { width: 36px; height: 36px; min-height: 36px; font-size: .9rem; }
.btn-row { width: 34px; height: 34px; min-height: 34px; padding: 0; border: 1px solid var(--sb-border); background: var(--sb-surface); color: var(--sb-muted); border-radius: 50%; }
.btn-row:hover { color: var(--sb-navy); border-color: var(--sb-navy-100); background: var(--sb-navy-50); }
.btn-row.danger:hover { color: var(--sb-red); border-color: var(--sb-red-50); background: var(--sb-red-50); }
.btn-row:disabled { opacity: .35; }
.btn-link.p-0 { min-height: 0; vertical-align: baseline; text-decoration: none; border-radius: 0; }
.form-control:focus, .form-select:focus, .btn:focus-visible, .form-check-input:focus { border-color: var(--sb-navy); box-shadow: 0 0 0 .22rem var(--sb-navy-100); outline: 0; }

/* Grey pill "action group": primary pill + plain text buttons (reference: Send Money · Request · Scan QR) */
.action-group, .page-head .page-actions { display: inline-flex; align-items: center; gap: .15rem; background: var(--sb-surface-2); border-radius: 999px; padding: 4px; }
.action-group > .btn:not(.btn-primary):not(.btn-success):not(.btn-gold), .page-head .page-actions > .btn:not(.btn-primary):not(.btn-success):not(.btn-gold),
.page-head .page-actions > .dropdown > .btn { background: transparent; border-color: transparent; color: var(--sb-text); }
.action-group > .btn:not(.btn-primary):not(.btn-success):not(.btn-gold):hover, .page-head .page-actions > .btn:not(.btn-primary):not(.btn-success):not(.btn-gold):hover,
.page-head .page-actions > .dropdown > .btn:hover { background: var(--sb-surface); color: var(--sb-navy); }
.page-head .page-actions > .btn-outline-danger:hover { color: var(--sb-red); }

/* Segmented toggle (Week · Month · Year) */
.seg { display: inline-flex; background: var(--sb-surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; color: var(--sb-text); font-weight: 600; font-size: .84rem; padding: .45rem 1rem; border-radius: 999px; min-height: 36px; }
.seg button.active { background: var(--sb-brand); color: var(--sb-on-brand); }
.seg button:not(.active):hover { background: var(--sb-surface); }

/* ---------- Top bar ---------- */
.app-shell { min-height: 100vh; }
.sb-main { min-height: 100vh; display: flex; flex-direction: column; }
.sb-topbar { position: sticky; top: 0; z-index: 1020; background: var(--sb-chrome); border-bottom: 1px solid var(--sb-border); }
.sb-topbar-inner { max-width: var(--sb-max); margin: 0 auto; height: var(--sb-topbar-h); display: flex; align-items: center; gap: .85rem; padding: 0 1.75rem; }
.sb-topbar-brand { display: flex; align-items: center; gap: .55rem; color: var(--sb-ink); white-space: nowrap; margin-right: .75rem; }
.sb-topbar-brand:hover { text-decoration: none; color: var(--sb-ink); }
.sb-logo-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--sb-brand); color: var(--sb-gold); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; box-shadow: inset 0 -3px 0 rgba(0,0,0,.12); }
.sb-logo-text { font-size: 1.3rem; font-weight: 500; letter-spacing: -.02em; }
.sb-topnav { align-items: center; gap: 2px; background: var(--sb-chrome-2); border-radius: 999px; padding: 5px; }
.sb-topnav a { display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1.05rem; border-radius: 999px; color: var(--sb-text); font-weight: 500; font-size: .9rem; white-space: nowrap; transition: background-color .15s, color .15s; }
.sb-topnav a i { display: none; font-size: .95rem; }
.sb-topnav a:hover { background: var(--sb-surface); text-decoration: none; }
.sb-topnav a.active { background: var(--sb-brand); color: var(--sb-on-brand); font-weight: 600; }
.sb-topnav a.active i { display: inline-block; }
.sb-topbar-date { align-items: center; gap: .45rem; color: var(--sb-text); font-weight: 500; font-size: .85rem; background: var(--sb-chrome-2); border-radius: 999px; padding: .55rem 1rem; white-space: nowrap; }
.sb-topbar-date i { color: var(--sb-navy); }
.sb-theme { background: var(--sb-chrome-2); border-radius: 999px; padding: 4px; gap: 2px; }
.sb-theme button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--sb-text); display: inline-flex; align-items: center; justify-content: center; }
.sb-theme button.active { background: var(--sb-brand); color: var(--sb-on-brand); }
.sb-profile-btn { border: 0; background: transparent; padding: 0; min-height: 0; border-radius: 50%; }
.sb-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--sb-brand); color: var(--sb-on-brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; border: 2px solid var(--sb-surface); box-shadow: 0 0 0 1px var(--sb-border); }
.sb-notif-badge { position: absolute; top: -3px; right: -3px; min-width: 19px; height: 19px; border-radius: 10px; background: var(--sb-orange); color: var(--sb-on-orange); font-size: .68rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border: 2px solid var(--sb-chrome); }
.sb-notif-menu { width: 340px; max-width: calc(100vw - 24px); padding: 0; overflow: hidden; }
.sb-notif-menu .notif-head { padding: .85rem 1rem; font-weight: 700; border-bottom: 1px solid var(--sb-border); color: var(--sb-ink); }
.sb-notif-menu .dropdown-item { white-space: normal; padding: .8rem 1rem; display: flex; gap: .7rem; border-radius: 0; border-bottom: 1px solid var(--sb-border); }
.sb-notif-menu .dropdown-item:last-child { border-bottom: 0; }
.dropdown-menu { --bs-dropdown-link-color: var(--sb-text); --bs-dropdown-link-hover-bg: var(--sb-surface-2); --bs-dropdown-link-hover-color: var(--sb-ink); border-radius: 16px; border-color: var(--sb-border); box-shadow: var(--sb-shadow-lg); padding: .4rem; background: var(--sb-surface); }
.dropdown-item { border-radius: 10px; padding: .55rem .8rem; font-weight: 500; }
.dropdown-item:active { background: var(--sb-brand); color: var(--sb-on-brand); }

/* Drawer menu (tablet / phone) */
.sb-sidebar.offcanvas { --bs-offcanvas-width: 290px; background: var(--sb-chrome); display: flex; flex-direction: column; }
.sb-sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.1rem; border-bottom: 1px solid var(--sb-border); }
.sb-sidebar-brand img { border-radius: 11px; }
.sb-brand-name { font-weight: 700; color: var(--sb-ink); line-height: 1.2; }
.sb-brand-sub { font-size: .74rem; color: var(--sb-muted); }
.sb-nav { padding: .75rem; display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.sb-nav a { display: flex; align-items: center; gap: .8rem; padding: .7rem .95rem; color: var(--sb-text); border-radius: 999px; font-weight: 500; }
.sb-nav a i { font-size: 1.05rem; width: 22px; text-align: center; color: var(--sb-muted); }
.sb-nav a:hover { background: var(--sb-surface-2); text-decoration: none; }
.sb-nav a.active { background: var(--sb-brand); color: var(--sb-on-brand); font-weight: 600; }
.sb-nav a.active i { color: var(--sb-on-brand); }
.sb-sidebar-foot { margin: .75rem; padding: .95rem 1.05rem; border-radius: 16px; background: var(--sb-surface-2); color: var(--sb-muted); }
.sb-sidebar-foot .fw-semibold { color: var(--sb-ink); font-size: 1.2rem; }

.sb-test-banner { max-width: calc(var(--sb-max) - 3.5rem); margin: .75rem auto .25rem; width: calc(100% - 3.5rem); background: var(--sb-amber-50); color: var(--sb-amber); border-radius: 999px; padding: .5rem 1.1rem; font-size: .85rem; display: flex; gap: .5rem; align-items: center; }
.sb-test-banner a { color: inherit; text-decoration: underline; font-weight: 700; }
.sb-content { padding: 1.5rem 1.75rem 2.5rem; flex: 1; outline: none; width: 100%; max-width: var(--sb-max); margin: 0 auto; }
@media (max-width: 767.98px) {
  .sb-content { padding: 1rem 1rem 1.5rem; }
  .sb-topbar-inner { padding: 0 .75rem; height: 64px; gap: .45rem; }
  .btn-round { width: 40px; height: 40px; min-height: 40px; }
  .sb-avatar { width: 40px; height: 40px; }
  .sb-test-banner { width: calc(100% - 2rem); font-size: .78rem; border-radius: 14px; }
}

/* ---------- Page header (two-tone title + action group) ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1rem; margin-bottom: 1.6rem; }
.page-head h1 { font-size: 1.85rem; font-weight: 500; letter-spacing: -.025em; margin: 0; color: var(--sb-ink); }
.page-head .page-sub { color: var(--sb-muted); font-size: .92rem; margin: .35rem 0 0; }
.page-head .page-actions { margin-left: auto; flex-wrap: wrap; }
.page-head .page-actions .btn { white-space: nowrap; }
.breadcrumb { font-size: .82rem; margin-bottom: .45rem; --bs-breadcrumb-divider-color: var(--sb-faint); }
.breadcrumb a { color: var(--sb-muted); font-weight: 500; }
.breadcrumb a:hover { color: var(--sb-navy); }
.breadcrumb-item.active { color: var(--sb-ink); }

/* ---------- Cards ---------- */
.sb-card { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius); box-shadow: var(--sb-shadow); }
.sb-card-head { display: flex; align-items: center; gap: .7rem; padding: 1.05rem 1.25rem; border-bottom: 1px solid var(--sb-border); }
.sb-card-head h2, .sb-card-head h3 { font-size: 1rem; font-weight: 600; margin: 0; color: var(--sb-ink); }
.sb-card-head .sub { display: block; font-size: .8rem; color: var(--sb-muted); font-weight: 400; margin-top: .15rem; }
.sb-card-head .ms-auto a { font-size: .85rem; font-weight: 600; }
.sb-card-head.flat { border-bottom: 0; padding-bottom: .25rem; }
.sb-card-body { padding: 1.25rem; }
.sb-card > .table-responsive { border-radius: 0 0 var(--sb-radius) var(--sb-radius); }
.sb-card > .table-responsive > .table { margin-bottom: 0; }
/* Round icon chip used in card headers (reference) */
.chip-icon { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--sb-border); background: var(--sb-surface); color: var(--sb-navy); display: inline-flex; align-items: center; justify-content: center; font-size: 1.02rem; flex-shrink: 0; }
.chip-icon.green { color: var(--sb-green); }
.chip-icon.amber { color: var(--sb-amber); }
.kebab { width: 32px; height: 32px; min-height: 32px; border: 0; background: transparent; color: var(--sb-muted); border-radius: 50%; padding: 0; }
.kebab:hover { background: var(--sb-surface-2); color: var(--sb-ink); }

/* ---------- Toolbars / filters (pill inputs) ---------- */
.sb-filters { display: flex; flex-wrap: wrap; gap: .6rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--sb-border); align-items: end; }
.sb-filters .f-search { flex: 1 1 240px; min-width: 180px; }
.sb-filters .f-item { flex: 0 1 170px; min-width: 140px; }
.sb-filters label { font-size: .74rem; font-weight: 500; color: var(--sb-muted); margin-bottom: .3rem; }
.sb-filters .form-control, .sb-filters .form-select { border-radius: 999px; }
.sb-filters .m-toggle { display: none; }
.search-pill, .sb-filters .f-search .form-control { padding-left: 2.6rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239CA3AF' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 1rem center; border-radius: 999px; }
@media (max-width: 575.98px) { .sb-filters .f-item { flex: 1 1 calc(50% - .6rem); } }

/* ---------- Tables (plain header like the reference) ---------- */
.table { --bs-table-color: var(--sb-text); --bs-table-hover-bg: var(--sb-surface-2); --bs-table-hover-color: var(--sb-text); --bs-table-bg: transparent; --bs-table-border-color: var(--sb-border); margin-bottom: 0; }
.table > thead th { font-size: .82rem; color: var(--sb-muted); font-weight: 500; background: transparent; border-bottom: 1px solid var(--sb-border); white-space: nowrap; padding: .85rem 1.1rem; }
.table > tbody td { padding: .9rem 1.1rem; vertical-align: middle; border-color: var(--sb-border); }
.table > tbody tr:last-child td { border-bottom: 0; }
.table > tbody td:first-child, .table > thead th:first-child { white-space: nowrap; }
.table > tfoot td, .table > tfoot th { font-weight: 700; background: var(--sb-surface-2); padding: .85rem 1.1rem; border-top: 1px solid var(--sb-border); color: var(--sb-ink); }
.table .row-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: nowrap; }
.table tr.is-cancelled td { color: var(--sb-faint); }
.table tr.is-cancelled td.num { text-decoration: line-through; }
.table tr.clickable { cursor: pointer; }
.cell-strong { font-weight: 600; color: var(--sb-ink); }
.cell-sub { font-size: .78rem; color: var(--sb-muted); }
.st-text { font-weight: 600; }
.st-text.ok { color: var(--sb-green); }
.st-text.bad { color: var(--sb-red); }
.st-text.warn { color: var(--sb-amber); }
.amt-in { color: var(--sb-green); font-weight: 600; }
.amt-out { color: var(--sb-red); font-weight: 600; }

/* Pagination (1 of N + round arrows) */
.pager { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--sb-text); white-space: nowrap; }

/* ---------- Badges ---------- */
.sb-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .28rem .65rem; border-radius: 999px; font-size: .74rem; font-weight: 600; white-space: nowrap; }
.sb-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.sb-badge.ok { background: var(--sb-green-50); color: var(--sb-green-600); }
.sb-badge.warn { background: var(--sb-amber-50); color: var(--sb-amber); }
.sb-badge.bad { background: var(--sb-red-50); color: var(--sb-red); }
.sb-badge.info { background: var(--sb-navy-50); color: var(--sb-navy); }
.sb-badge.muted { background: var(--sb-surface-2); color: var(--sb-muted); }
.amt-due { color: var(--sb-amber); font-weight: 700; }
.amt-ok { color: var(--sb-green); font-weight: 700; }
.amt-adv { color: var(--sb-navy); font-weight: 700; }
/* Change pill: ↗ +9.5% vs last month */
.chg { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 999px; font-weight: 500; font-size: .74rem; white-space: nowrap; }
.chg.up { background: var(--sb-green-50); color: var(--sb-green-600); }
.chg.down { background: var(--sb-red-50); color: var(--sb-red); }
.chg.warn { background: var(--sb-amber-50); color: var(--sb-amber); }
.chg.flat { background: var(--sb-surface-2); color: var(--sb-muted); }

/* ---------- Forms ---------- */
.form-label { font-weight: 500; font-size: .86rem; margin-bottom: .4rem; color: var(--sb-text); }
.req::after { content: " *"; color: var(--sb-red); }
.form-control, .form-select { border-radius: var(--sb-radius-sm); min-height: 46px; border-color: var(--sb-border); background-color: var(--sb-input); color: var(--sb-ink); }
.form-control::placeholder { color: var(--sb-faint); }
.form-control:hover, .form-select:hover { border-color: var(--sb-navy-100); }
.form-control:disabled, .form-select:disabled { background-color: var(--sb-surface-2); }
.form-control[readonly].calc { background-color: var(--sb-surface-2); font-weight: 700; color: var(--sb-ink); border-color: transparent; }
.form-select-lg { font-size: 1rem; font-weight: 600; }
.input-group-text { background: var(--sb-surface-2); color: var(--sb-muted); border-color: var(--sb-border); font-weight: 600; }
.input-group > :first-child { border-top-left-radius: var(--sb-radius-sm); border-bottom-left-radius: var(--sb-radius-sm); }
.input-group > :last-child { border-top-right-radius: var(--sb-radius-sm); border-bottom-right-radius: var(--sb-radius-sm); }
.input-group > .btn { border-radius: 0; }
.input-group > .btn:last-child { border-top-right-radius: var(--sb-radius-sm); border-bottom-right-radius: var(--sb-radius-sm); }
.form-hint { font-size: .78rem; color: var(--sb-muted); margin-top: .35rem; }
.form-section-title { font-size: .95rem; color: var(--sb-ink); font-weight: 600; margin: 0 0 1rem; display: flex; align-items: center; gap: .6rem; }
.form-check-input { background-color: var(--sb-surface); border-color: var(--sb-border); }
.form-check-input:checked { background-color: var(--sb-brand); border-color: var(--sb-brand); }
.sb-summary { background: var(--sb-surface); border: 1px solid var(--sb-border); border-radius: var(--sb-radius); padding: 1.15rem 1.3rem; }
.sb-summary .s-row { display: flex; justify-content: space-between; padding: .5rem 0; font-variant-numeric: tabular-nums; }
.sb-summary .s-row + .s-row { border-top: 1px dashed var(--sb-border); }
.sb-summary .s-row.total { font-weight: 700; font-size: 1.05rem; color: var(--sb-ink); }
.sb-summary .s-row.remaining { font-weight: 700; font-size: 1.25rem; color: var(--sb-amber); }
.sb-summary .s-row.remaining.zero { color: var(--sb-green); }
.sb-summary .s-label { color: var(--sb-muted); }
@media (min-width: 992px) { .sticky-summary { position: sticky; top: calc(var(--sb-topbar-h) + 1rem); } }
.sb-seg { background: var(--sb-surface-2); border-radius: 999px; padding: 4px; }
.sb-seg .btn { min-height: 40px; border: 0 !important; border-radius: 999px !important; background: transparent; color: var(--sb-text); }
.sb-seg .btn-check:checked + .btn { background: var(--sb-brand); color: var(--sb-on-brand); }

/* ---------- Tabs (pill segmented) ---------- */
.sb-tabs { border-bottom: 1px solid var(--sb-border); padding: .8rem 1.1rem; gap: .25rem; flex-wrap: nowrap; overflow-x: auto; }
.sb-tabs .nav-link { color: var(--sb-text); font-weight: 500; border: 0; border-radius: 999px; padding: .5rem 1.05rem; white-space: nowrap; font-size: .9rem; }
.sb-tabs .nav-link:hover { background: var(--sb-surface-2); }
.sb-tabs .nav-link.active { color: var(--sb-on-brand); background: var(--sb-brand); font-weight: 600; }

/* ---------- Empty / loading ---------- */
.sb-empty { text-align: center; padding: 2.75rem 1rem; color: var(--sb-muted); }
.sb-empty i { font-size: 1.45rem; color: var(--sb-navy); display: inline-flex; width: 56px; height: 56px; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid var(--sb-border); background-image: repeating-linear-gradient(135deg, var(--sb-navy-50) 0 2px, transparent 2px 7px); margin-bottom: .8rem; }
.sb-empty h3 { font-size: 1rem; color: var(--sb-ink); font-weight: 600; margin-bottom: .25rem; }
.sb-empty p { font-size: .875rem; margin-bottom: 1rem; }
.sb-loading { display: flex; align-items: center; justify-content: center; min-height: 40vh; color: var(--sb-muted); gap: .75rem; }

/* ---------- Toasts ---------- */
.sb-toasts { right: 1rem; bottom: 1rem; z-index: 2000; }
.toast.sb-toast { border: 1px solid var(--sb-border); border-left: 4px solid var(--sb-navy); border-radius: 14px; box-shadow: var(--sb-shadow-lg); }
.toast.sb-toast.success { border-left-color: var(--sb-green); }
.toast.sb-toast.error { border-left-color: var(--sb-red); }
.toast.sb-toast.warning { border-left-color: var(--sb-amber); }

/* ---------- Modals ---------- */
.modal-content { border: 1px solid var(--sb-border); border-radius: 22px; box-shadow: var(--sb-shadow-lg); background: var(--sb-surface); }
.modal-header { border-bottom-color: var(--sb-border); padding: 1.15rem 1.5rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top-color: var(--sb-border); padding: .9rem 1.5rem; }
.modal-title { font-weight: 600; color: var(--sb-ink); font-size: 1.15rem; letter-spacing: -.01em; }
.modal-backdrop.show { opacity: .45; }
.confirm-icon { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; background: var(--sb-red-50); color: var(--sb-red); flex-shrink: 0; }
.confirm-icon.primary { background: var(--sb-navy-50); color: var(--sb-navy); }
.dl-grid { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.25rem; margin: 0; }
.dl-grid dt { color: var(--sb-muted); font-weight: 500; font-size: .86rem; }
.dl-grid dd { margin: 0; font-weight: 600; color: var(--sb-ink); }

/* Global search */
.sb-search-input { position: relative; }
.sb-search-input i { position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%); color: var(--sb-faint); }
.sb-search-input .form-control { padding-left: 2.8rem; border-radius: 999px; min-height: 52px; font-size: 1rem; }
.gs-group + .gs-group { margin-top: 1rem; }
.gs-head { font-size: .75rem; font-weight: 600; color: var(--sb-muted); margin: 0 0 .4rem .25rem; text-transform: uppercase; letter-spacing: .06em; }
.gs-item { display: flex; align-items: center; gap: .8rem; padding: .6rem .75rem; border-radius: 14px; color: var(--sb-text); }
.gs-item:hover { background: var(--sb-surface-2); text-decoration: none; color: var(--sb-ink); }
.gs-item strong { display: block; color: var(--sb-ink); font-weight: 600; }
.gs-item small { display: block; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-steps { padding-left: 1.2rem; margin-bottom: 1rem; }
.sb-steps li { margin-bottom: .6rem; }

/* =========================================================
   Phones & tablets
   ========================================================= */
@media (max-width: 767.98px) {
  .table > thead th, .table > tbody td, .table > tfoot td { padding: .65rem .65rem; font-size: .86rem; }
  .btn { min-height: 44px; }
  .btn-row { width: 38px; height: 38px; }
}
@media (max-width: 767.98px) {
  .page-head { margin-bottom: 1rem; }
  .page-head h1 { font-size: 1.45rem; }
  .page-head .page-sub { font-size: .84rem; }
  .page-head .page-actions { margin-left: 0; width: 100%; display: flex; flex-wrap: nowrap; }
  .page-head .page-actions > .btn, .page-head .page-actions > a.btn { flex: 1 1 0; min-width: 0; padding-left: .5rem; padding-right: .5rem; font-size: .85rem; gap: .3rem; }
  .page-head .page-actions > .dropdown { flex: 0 0 auto; }
  .page-head .page-actions > .dropdown .btn { width: 44px; padding: 0; }
  .sb-toasts { left: .75rem; right: .75rem; }
  .sb-toasts .toast { width: 100%; }
}

/* Bottom navigation (phones & tablets) */
.sb-bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1025; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--sb-chrome); border-top: 1px solid var(--sb-border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.sb-bottomnav a, .sb-bottomnav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px;
  border: 0; background: transparent; color: var(--sb-muted); font-size: .7rem; font-weight: 600; border-radius: 14px; text-decoration: none; }
.sb-bottomnav a > i, .sb-bottomnav button > i { font-size: 1.2rem; line-height: 1; height: 32px; width: 48px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; }
.sb-bottomnav a.active { color: var(--sb-navy); }
.sb-bottomnav a.active > i { background: var(--sb-navy-50); }
.sb-bottomnav a.primary > i { background: var(--sb-gold); color: var(--sb-on-gold); }
.sb-bottomnav a.primary.active > i { background: var(--sb-gold); box-shadow: 0 0 0 3px var(--sb-gold-50); }
@media (max-width: 767.98px) {
  .sb-content { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .sb-toasts { bottom: 84px !important; }
  body.form-page .sb-bottomnav { display: none !important; }
}
@media (max-width: 991.98px) {
  body.form-page .sb-content { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  body.form-page .sticky-summary > .d-flex { display: none !important; }
  body.form-page .sb-toasts { bottom: 96px !important; }
}

/* Sticky save bar on form pages (phones & tablets) */
.sb-mobilebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1026; display: flex; align-items: center; gap: .75rem;
  background: var(--sb-chrome); border-top: 1px solid var(--sb-border); padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom)); }
.sb-mobilebar .mb-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sb-mobilebar .mb-lbl { font-size: .72rem; color: var(--sb-muted); font-weight: 500; }
.sb-mobilebar .mb-val { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.sb-mobilebar .mb-sub { font-size: .72rem; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-mobilebar .btn { min-width: 120px; min-height: 50px; }

/* Filters collapse behind a button on phones (all phone sizes up to 767px) */
@media (max-width: 767.98px) {
  .sb-filters { padding: .75rem; }
  .sb-filters .f-search { flex: 1 1 0; min-width: 0; }
  .sb-filters .f-search label { display: none; }
  .sb-filters .m-toggle { display: inline-flex; flex: 0 0 auto; align-self: flex-end; }
  .sb-filters.m-collapsed > :not(.f-search):not(.m-toggle) { display: none !important; }
}

/* Tables become stacked cards on phones (labels come from the header row) */
@media (max-width: 767.98px) {
  .sb-view .table thead { display: none; }
  .sb-view .table, .sb-view .table tbody, .sb-view .table tfoot { display: block; width: 100%; }
  .sb-view .table tr { display: block; padding: .85rem 1rem; border-bottom: 1px solid var(--sb-border); }
  .sb-view .table > tbody > tr > td, .sb-view .table > tfoot > tr > td { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem;
    padding: .2rem 0; border: 0; text-align: right; background: transparent; box-shadow: none; white-space: normal; }
  .sb-view .table td::before { content: attr(data-label); color: var(--sb-muted); font-size: .78rem; font-weight: 500; text-align: left; flex-shrink: 0; margin-right: auto; }
  .sb-view .table td:first-child { font-size: 1rem; justify-content: flex-start; text-align: left; padding-bottom: .4rem; }
  .sb-view .table td:first-child::before { display: none; }
  .sb-view .table td > .cell-sub { flex-basis: 100%; text-align: right; margin-top: -.1rem; }
  .sb-view .table td:first-child > .cell-sub { text-align: left; }
  .sb-view .table td:empty { display: none; }
  .sb-view .table td:has(.row-actions) { justify-content: flex-end; padding-top: .55rem; }
  .sb-view .table td:has(.row-actions)::before { display: none; }
  .sb-view .table .row-actions .btn-row { width: 40px; height: 40px; }
  .sb-view .table > tfoot > tr { background: var(--sb-surface-2); }
  .sb-view .table tr.is-cancelled { opacity: .75; }
  .sb-view .table-responsive { overflow: visible; }
}
/* Laptop widths: tighter menu, Settings moves to the profile menu */
@media (min-width: 1200px) and (max-width: 1599.98px) {
  .sb-topbar-inner { gap: .6rem; padding: 0 1.25rem; }
  .sb-topnav a { padding: .5rem .75rem; font-size: .86rem; }
  .sb-topnav a[data-nav="settings"] { display: none; }
  .sb-logo-text { font-size: 1.15rem; }
}
.btn { white-space: nowrap; }
@media (max-width: 575.98px) {
  .sb-card-head .sub { display: none; }
  .sb-card-head.flat { flex-wrap: nowrap; }
}

/* ---------- Polish: tap targets (≥ 44px on touch screens) ---------- */
.sb-topbar-brand { min-height: 44px; padding: 5px 0; }
@media (max-width: 991.98px) {
  .table .btn-link.p-0, .form-hint a, .page-sub a, .dl-grid a, .sb-summary a { display: inline-flex; align-items: center; min-height: 40px; }
  .table td a:not(.btn) { display: inline-block; padding: .35rem 0; }
}

/* Top bar never overflows: the menu can shrink and scroll sideways as a last resort */
.sb-topnav { min-width: 0; overflow-x: auto; scrollbar-width: none; }
.sb-topnav::-webkit-scrollbar { display: none; }
.sb-topbar-inner > .ms-auto { flex-shrink: 0; }
@media (min-width: 1200px) and (max-width: 1599.98px) { .sb-topbar-date { padding: .55rem .8rem; } }

/* Close buttons: 44px touch area, same icon size */
.btn-close { width: 44px; height: 44px; padding: 0; margin: -.5rem -.6rem -.5rem auto; background-size: .9em; border-radius: 50%; opacity: .6; }
.btn-close:hover { opacity: 1; background-color: var(--sb-surface-2); }
.toast .btn-close { width: 36px; height: 36px; margin: -.4rem -.4rem 0 0; }
@media (max-width: 991.98px) { a.form-hint, .form-hint a { display: inline-flex; align-items: center; min-height: 40px; } }

/* Change pills may wrap instead of spilling out of small cards */
.stat-row .chg { white-space: normal; text-align: left; line-height: 1.25; max-width: 100%; }

/* ---------- Tablets: denser tables so the important last columns stay visible ---------- */
@media (min-width: 576px) and (max-width: 1199.98px) {
  .table > thead th, .table > tbody td, .table > tfoot td, .table > tfoot th { padding: .7rem .55rem; font-size: .84rem; }
  .table > thead th:first-child, .table > tbody td:first-child, .table > tfoot td:first-child { padding-left: 1rem; }
  .table > thead th:last-child, .table > tbody td:last-child, .table > tfoot td:last-child { padding-right: 1rem; }
  .table .row-actions { gap: .25rem; }
  .table .row-actions .btn-row { width: 34px; height: 34px; min-height: 34px; }
  .sb-badge { padding: .22rem .5rem; font-size: .7rem; }
  .table .cell-sub { font-size: .74rem; }
}
/* A single action does not need the grey group container */
.page-head .page-actions:has(> :only-child) { background: transparent; padding: 0; }


/* ---------- Farm brand finishing ---------- */
[data-theme="dark"] .sb-card, [data-theme="dark"] .modal-content { box-shadow: inset 0 1px 0 rgba(255,255,255,.03); }
[data-theme="dark"] .table > tfoot td, [data-theme="dark"] .table > tfoot th { background: var(--sb-surface-2); }
.metric-gold { color: var(--sb-gold-text) !important; }
.chip-icon.gold { color: var(--sb-gold-text); }
.chip-icon.orange, .chip-icon.amber { color: var(--sb-amber); }
.page-head h1 .accent-gold { color: var(--sb-gold-text); }
.a4 { color-scheme: light; }
.ml-icon { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--sb-border); background: var(--sb-surface-2); color: var(--sb-navy); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
a.form-hint, .form-hint a { color: var(--sb-navy); font-weight: 500; }


/* ---------- Header: full width (container-fluid) ---------- */
.sb-topbar-inner { max-width: none; }

/* ---------- Language switch ---------- */
.sb-lang { background: var(--sb-chrome-2); border-radius: 999px; padding: 4px; gap: 2px; }
.sb-lang button { min-width: 44px; height: 36px; padding: 0 .7rem; border-radius: 999px; border: 0; background: transparent; color: var(--sb-text); font-weight: 700; font-size: .8rem; }
.sb-lang button.active { background: var(--sb-brand); color: var(--sb-on-brand); }
.lang-ta-only { display: none; }
html.lang-ta .lang-ta-only { display: inline; }
html.lang-ta .lang-en-only { display: none; }

/* ---------- Tamil typography: longer words, taller glyphs ---------- */
html.lang-ta body { line-height: 1.6; }
html.lang-ta .page-head h1 { font-size: 1.6rem; line-height: 1.35; letter-spacing: 0; }
html.lang-ta .kpi-value, html.lang-ta .chart-summary strong, html.lang-ta .perf-sum strong { letter-spacing: 0; }
html.lang-ta .sb-topnav a { font-size: .84rem; padding: .5rem .8rem; }
html.lang-ta .table > thead th { white-space: normal; line-height: 1.3; }
html.lang-ta .btn { white-space: normal; line-height: 1.25; }
html.lang-ta .stat .sb-card-head h2, html.lang-ta .kpi-label { line-height: 1.35; }
html.lang-ta .sb-bottomnav a, html.lang-ta .sb-bottomnav button { font-size: .64rem; }
@media (max-width: 575.98px) {
  html.lang-ta .page-head h1 { font-size: 1.3rem; }
  html.lang-ta .quick-actions .btn, html.lang-ta .dash-actions .action-group .btn { font-size: .74rem; }
}
/* Tamil labels are wider: keep the whole menu visible */
@media (max-width: 1599.98px) { html.lang-ta .sb-topbar-date { display: none !important; } }
@media (min-width: 1200px) and (max-width: 1599.98px) {
  html.lang-ta .sb-topnav a { padding: .5rem .62rem; font-size: .8rem; }
  html.lang-ta .sb-topnav a.active i { display: none; }
  html.lang-ta .sb-logo-text { display: none !important; }
}
/* Label/value lists stack on phones so long labels (e.g. Tamil) never push values out */
@media (max-width: 575.98px) {
  .dl-grid { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .dl-grid dt { margin-top: .55rem; }
  .dl-grid dd { overflow-wrap: anywhere; }
}
/* Tablets: long shop/vendor names may wrap so the Actions column stays visible */
@media (min-width: 576px) and (max-width: 1199.98px) {
  .table > tbody td:first-child { white-space: normal; min-width: 7rem; }
  html.lang-ta .table > tbody td, html.lang-ta .table > thead th { font-size: .8rem; }
}


/* =========================================================
   RESPONSIVE v5 – phones, landscape phones and iPad
   Breakpoints: small mobile ≤375 · mobile 376–430 · large mobile 431–767 ·
   tablet portrait 768–1023 · tablet landscape 1024–1199 · desktop ≥1200 (unchanged)
   ========================================================= */
.app-shell { min-height: 100dvh; }
.sb-nav a .ns { display: none; }
.sb-rail-toggle, .sb-rail-scrim { display: none; }
.sb-topbar-title { flex: 1 1 auto; min-width: 0; font-weight: 700; font-size: 1.05rem; color: var(--sb-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.sb-hdr-action:empty { display: none; }
.sb-hdr-action { display: inline-flex; }
@media (min-width: 1200px) { .sb-sidebar, .sb-hdr-action, .sb-hdr-back { display: none !important; } }

/* ---------- Phones (≤767): compact app header ---------- */
@media (max-width: 767.98px) {
  .sb-topbar { padding-top: env(safe-area-inset-top); }
  .sb-topbar-inner { height: 60px; gap: .35rem; padding-left: max(.6rem, env(safe-area-inset-left)); padding-right: max(.6rem, env(safe-area-inset-right)); }
  .sb-topbar-brand { margin-right: .15rem; }
  body.has-back .sb-hdr-menu, body.has-back .sb-topbar-brand { display: none !important; }
  .sb-hdr-back[hidden] { display: none !important; }
  .sb-hdr-tools { gap: .4rem !important; }
  /* The page title lives in the header, so list pages drop the large heading */
  .page-head:not(:has(.breadcrumb)) h1:not(.keep), .page-head:not(:has(.breadcrumb)) .page-sub:not(.keep) { display: none; }
  .page-head .breadcrumb { display: none; }
  .page-head h1 { font-size: 1.3rem; }
  .page-head .page-actions.mirrored { display: none; }
  .page-head:not(:has(.breadcrumb)):has(.page-actions.mirrored) { display: none; }
  .modal-dialog:not(.modal-fullscreen-sm-down) { margin: .75rem; }
  .sb-sidebar.offcanvas-md { --bs-offcanvas-width: min(86vw, 320px); }
}
/* Small phones (≤375) */
@media (max-width: 375.98px) {
  .sb-content { padding-left: .7rem; padding-right: .7rem; }
  .sb-topbar-brand { display: none !important; }
  .btn-round { width: 40px; height: 40px; min-height: 40px; }
  .sb-avatar { width: 38px; height: 38px; }
  .sb-topbar-title { font-size: .98rem; }
  .kpi-grid { gap: .5rem; }
  .stat .kpi-value { font-size: 1.02rem; }
  .stat .chg { font-size: .64rem; padding: .18rem .45rem; }
  .sb-bottomnav a, .sb-bottomnav button { font-size: .64rem; }
  .sb-bottomnav a > i, .sb-bottomnav button > i { width: 42px; }
  .sb-mobilebar { gap: .5rem; padding-left: .75rem; padding-right: .75rem; }
  .sb-mobilebar .btn { min-width: 96px; }
  .sb-mobilebar .mb-val { font-size: 1.1rem; }
  .sb-card-body { padding: 1rem; }
  .src-grid { grid-template-columns: 1fr 1fr; gap: .45rem; }
  .av { width: 40px; height: 40px; }
  .seg button { padding: .45rem .7rem; }
}
/* Large phones (431–767): two KPI columns, roomier cards */
@media (min-width: 431px) and (max-width: 767.98px) {
  .sb-content { padding-left: 1.1rem; padding-right: 1.1rem; }
  .bal-cards .kpi-value { font-size: 1.1rem; }
}
@media (min-width: 576px) and (max-width: 767.98px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-grid > *, .kpi-grid > :nth-child(4) { grid-column: span 1; }
  .kpi-grid > :nth-child(5) { grid-column: span 2; }
}

/* ---------- Tablets (768–1199): collapsible icon rail ---------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
  :root { --rail-w: 92px; }
  .sb-sidebar.offcanvas-md { position: fixed; inset: 0 auto 0 0; width: var(--rail-w); z-index: 1036; display: flex; flex-direction: column;
    background: var(--sb-chrome) !important; border-right: 1px solid var(--sb-border); transition: width .2s ease, box-shadow .2s ease; overflow: hidden; }
  .sb-main { margin-left: var(--rail-w); }
  .sb-topbar-brand { display: none !important; }
  .sb-topbar-inner { padding: 0 1.25rem; }
  .sb-sidebar-brand { justify-content: center; padding: .9rem .5rem; min-height: 68px; }
  .sb-brand-text { display: none; }
  .sb-nav { padding: .5rem; gap: 4px; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
  .sb-nav a { flex-direction: column; gap: .25rem; padding: .62rem .2rem; border-radius: 16px; font-size: .68rem; font-weight: 600; text-align: center; line-height: 1.15; }
  .sb-nav a i { font-size: 1.2rem; width: auto; }
  .sb-nav a .nl { display: none; }
  .sb-nav a .ns { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sb-sidebar-foot { display: none; }
  .sb-rail-toggle { display: flex; align-items: center; justify-content: center; gap: .7rem; margin: .5rem; min-height: 48px; border: 1px solid var(--sb-border); border-radius: 14px;
    background: var(--sb-surface-2); color: var(--sb-text); font-weight: 600; font-size: .85rem; }
  .sb-rail-toggle .nl { display: none; }
  .sb-rail-toggle:hover { color: var(--sb-ink); border-color: var(--sb-navy-100); }
  /* Expanded: slides over the content with full labels (content keeps its size, so nothing reflows) */
  html.rail-open .sb-sidebar.offcanvas-md { width: 272px; box-shadow: var(--sb-shadow-lg); }
  html.rail-open .sb-sidebar-brand { justify-content: flex-start; padding: .9rem 1.1rem; }
  html.rail-open .sb-brand-text { display: block; white-space: nowrap; }
  html.rail-open .sb-nav a { flex-direction: row; gap: .8rem; padding: .72rem .95rem; font-size: .92rem; font-weight: 500; text-align: left; border-radius: 999px; }
  html.rail-open .sb-nav a .nl { display: inline; white-space: nowrap; }
  html.rail-open .sb-nav a .ns { display: none; }
  html.rail-open .sb-sidebar-foot { display: block; white-space: nowrap; }
  html.rail-open .sb-rail-toggle { justify-content: flex-start; padding: 0 1rem; }
  html.rail-open .sb-rail-toggle .nl { display: inline; }
  html.rail-open .sb-rail-scrim { display: block; position: fixed; inset: 0; z-index: 1035; background: rgba(5, 10, 7, .45); }
  .sb-mobilebar { left: var(--rail-w); }
  .sb-toasts { right: 1.25rem; }
  .modal-dialog.modal-lg { max-width: min(720px, calc(100vw - var(--rail-w) - 2rem)); }
}
/* Tablet portrait (768–1023) */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .sb-content { padding: 1.25rem 1.25rem 2rem; }
  .page-head h1 { font-size: 1.6rem; }
  .welcome-steps { grid-template-columns: repeat(2, 1fr); }
}
/* Tablet landscape (1024–1199): slightly wider rail, denser grids */
@media (min-width: 1024px) and (max-width: 1199.98px) {
  :root { --rail-w: 100px; }
  .sb-content { padding: 1.5rem 1.5rem 2rem; }
}

/* ---------- Landscape phones & short screens ---------- */
@media (orientation: landscape) and (max-height: 500px) {
  .sb-topbar-inner { height: 52px; }
  .sb-test-banner { margin-top: .4rem; padding: .35rem .9rem; }
  .sb-bottomnav { padding-top: 3px; padding-bottom: calc(3px + env(safe-area-inset-bottom)); }
  .sb-bottomnav a, .sb-bottomnav button { min-height: 44px; flex-direction: row; gap: .35rem; }
  .sb-bottomnav a > i, .sb-bottomnav button > i { height: 30px; width: 38px; }
  .sb-content { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .sb-mobilebar { padding-top: .4rem; padding-bottom: calc(.4rem + env(safe-area-inset-bottom)); }
  .sb-mobilebar .mb-val { font-size: 1.05rem; }
  .sb-mobilebar .mb-sub { display: none; }
  .sb-mobilebar .btn { min-height: 44px; }
  .sb-sidebar-brand { min-height: 52px; padding-top: .4rem; padding-bottom: .4rem; }
  .sb-nav a { padding-top: .4rem; padding-bottom: .4rem; }
  .sb-nav a .ns { display: none !important; }
  .sb-nav a { min-height: 44px; justify-content: center; flex-shrink: 0; }
  html.rail-open .sb-nav a { justify-content: flex-start; }
  .sb-rail-toggle { min-height: 44px; flex-shrink: 0; }
  .sb-rail-toggle { min-height: 40px; }
  .modal-dialog { margin: .4rem auto; }
  .modal-dialog-scrollable .modal-content { max-height: calc(100dvh - .8rem); }
  .modal-header, .modal-footer { padding-top: .6rem; padding-bottom: .6rem; }
  .page-head { margin-bottom: .75rem; }
}

/* ---------- On-screen keyboard open: give the form the space ---------- */
html.kb-open .sb-bottomnav, html.kb-open .sb-mobilebar { display: none !important; }

/* ---------- Dropdowns & menus always fit the screen ---------- */
.dropdown-menu { max-height: min(70dvh, 520px); overflow-y: auto; max-width: calc(100vw - 16px); }
@media (max-width: 1199.98px) {
  .dropdown-item { min-height: 44px; display: flex; align-items: center; }
  .form-control, .form-select { font-size: 16px; } /* stops iOS zooming into fields */
  .form-control-sm, .sb-filters .form-control, .sb-filters .form-select { font-size: 15px; }
}

@media (min-width: 768px) { .sb-hdr-action { display: none !important; } }

/* ---- Responsive v5 · audit fixes ---- */
@media (max-width: 1199.98px) {
  .kebab { width: 40px; height: 40px; min-height: 40px; margin: -4px 0; flex-shrink: 0; }
}

/* Tablet portrait (768–991): the icon rail takes width, so drop columns that repeat other info */
.show-md-only { display: none !important; }
@media (min-width: 768px) and (max-width: 991.98px) {
  .hide-md-only { display: none !important; }
  .show-md-only { display: block !important; }
}
/* Touch devices (phones + tablets): 40 px minimum targets */
@media (max-width: 1199.98px) {
  .btn-row, .table .row-actions .btn-row { width: 40px; height: 40px; min-height: 40px; }
  .btn-sm, .btn-group-sm > .btn { min-height: 40px; }
  .sb-view .btn-outline-secondary.btn-sm { min-height: 40px; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
  .table > thead th, .table > tbody td, .table > tfoot td, .table > tfoot th { padding-left: .45rem; padding-right: .45rem; }
  .table > thead th:first-child, .table > tbody td:first-child, .table > tfoot td:first-child { padding-left: .8rem; }
  .table > thead th:last-child, .table > tbody td:last-child, .table > tfoot td:last-child { padding-right: .8rem; }
}

/* Inline helper links get a taller hit area on touch screens */
@media (max-width: 1199.98px) {
  .form-hint a, a.form-hint, .sb-view dd a, .sb-view .page-sub a, .sb-view .card-link { display: inline-block; padding-top: .65rem; padding-bottom: .65rem; margin-top: -.65rem; margin-bottom: -.65rem; }
}

.stat .sb-card-head > :not(.dropdown) { min-width: 0; }
.stat .sb-card-head h2 { overflow-wrap: anywhere; }
@media (min-width: 768px) and (max-width: 1199.98px) {
  html.lang-ta .sb-view .table { font-size: .8rem; }
  html.lang-ta .sb-view .table > thead th { font-size: .74rem; }
}
.sb-topbar-inner > .btn, .sb-topbar-inner .btn-icon, .sb-hdr-tools > *, .sb-hdr-action .btn { flex-shrink: 0; }
.sb-topbar-inner .btn-icon { min-width: 40px; }

/* Segmented choices share the width evenly and never spill out of the card */
.sb-seg { display: flex; }
.sb-seg > .btn { flex: 1 1 0; min-width: 0; padding-left: .4rem; padding-right: .4rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 992px) and (max-width: 1199.98px) { .hide-lg-only { display: none !important; } }
/* Very small phones: page action pills drop their icons so the words fit */
@media (max-width: 399.98px) {
  .page-head .page-actions > .btn:not(.btn-icon):not(.kebab):not(.dropdown-toggle) > i:first-child,
  .page-head .page-actions > a.btn > i:first-child { display: none; }
  .page-head .page-actions > .btn, .page-head .page-actions > .dropdown > .btn { font-size: .86rem; padding-left: .6rem; padding-right: .6rem; min-width: 0; }
}

/* ---------- Cloud sync indicator ---------- */
.sb-sync { position: relative; }
.sb-sync .sb-sync-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--sb-green); box-shadow: 0 0 0 2px var(--sb-chrome); }
.sb-sync.is-pending .sb-sync-dot, .sb-sync.is-syncing .sb-sync-dot { background: var(--sb-gold); }
.sb-sync.is-offline .sb-sync-dot { background: var(--sb-amber); }
.sb-sync.is-error .sb-sync-dot, .sb-sync.is-signin .sb-sync-dot { background: var(--sb-red); }
.sb-sync.is-syncing i { animation: sb-spin 1s linear infinite; }
@keyframes sb-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sb-sync.is-syncing i { animation: none; } }
/* Small phones: only show the cloud button when something needs attention */
@media (max-width: 575.98px) { .sb-sync.is-idle { display: none !important; } }
