/* Theme colors (2026-09-19) -- moved OUT of this file entirely into
   the `themes` table in Clients.db, admin-editable from admin_app.py's
   Themes screen without a code deploy (Sabari: "add a card in
   admin_app.py for Themes ... separate the 4 layers back color").
   db.write_theme_css_file() turns those rows back into exactly the
   same shape this block used to be by hand -- a bare :root {} for
   "default" plus one :root[data-theme="<key>"] {} per other theme,
   10 light + 10 dark -- and writes it to static/theme_vars.css, which
   base.html/admin_templates/base.html both <link> right BEFORE this
   file, not after -- this file's own @media print block further down
   resets these same variables back to plain black-on-white for
   printed reports, at the same :root/:root[data-theme] specificity
   theme_vars.css's blocks use, so THIS file has to load last to win
   that tie (see that block's own comment for the full reasoning).
   Every rule below that reads var(--accent)/var(--bg)/var(--panel)/
   var(--ink)/var(--muted)/var(--border)/var(--header-bg)/
   var(--menu-bg)/var(--footer-bg)/var(--shade)/var(--shade-strong) is
   unaffected -- these are still the same custom properties, just
   sourced from a generated file instead of hand-edited here. Edit a
   theme's own colors from the admin panel, not this file -- there's
   nothing to hand-edit here anymore. */
* { box-sizing: border-box; }

/* Sticky-footer shell (Sabari, 2026-09-19: "layer 4 hangs in the middle
   of the screen -- fix to bottom of browser if layer 3 is small, move
   down naturally if layer 3 grows"). Before this, body had no height of
   its own -- on a short Details layer (layer 3, .content) the page was
   only as tall as its content, so .app-footer just sat directly under
   that short content with plain body/--bg showing for the rest of the
   browser window below it, instead of staying pinned to the bottom.
   Classic flex-column fix: body is a full-viewport-tall flex column
   (.shell-top, then .content, then .app-footer, in source order, which
   is already exactly the shell's real layer order), and .content is the
   one flexible layer (flex: 1 0 auto below) that absorbs any leftover
   space -- so .app-footer is always pushed to the very bottom of a short
   page, but still lands in normal flow right after a tall one (never
   overlapping it, never needing its own position:fixed/absolute, which
   would have overlapped short content instead). .shell-top's own
   position: sticky (above) is unaffected by body also being a flex
   container -- sticky still positions against the viewport as long as
   nothing here sets overflow, which nothing does. */
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

/* Header -- layer 1 of the four-layer shell (Header / Dynamic Menu /
   Details / Footer). Only the Firm name and Login Name get real
   emphasis; the rest (address/city, FY range, crumb, Valid Until)
   stays small so this never competes with the Details area for
   space. Left block is three lines -- Firm name, Address+City (one
   line), FY range. Right block (.user-block, in .topbar-actions)
   mirrors it with its own three lines -- Login Name + Logout, Valid
   Until, then the crumb (2026-09-17: crumb now lives inside
   .user-block itself, not a separate full-width row below the header
   -- that's what used to leave a gap under line 2 whenever the left
   block was taller than the right one). Address+City combined onto
   one line and the FY range swapped for Valid Until in the right
   block, 2026-09-21, per Sabari. */
/* Header + Dynamic Menu pinned together as one unit while the Details
   layer scrolls underneath (Sabari, 2026-09-18: "keep the top 2 layers
   of UI static"). Wrapping BOTH .topbar and .appnav in one sticky
   container -- rather than sticking each separately, which would need
   .appnav's own `top:` hardcoded to whatever .topbar's height happens
   to be -- keeps working no matter how tall the header gets (the
   Firm/Address/City block or the user-block wrapping onto an extra
   line, Mobile view's own wrapped .topbar-row, etc.): there's nothing
   to keep in sync by hand.
   z-index: 40 is deliberate, not decorative -- `position: sticky`
   with z-index left at its default (auto) turned out NOT to reliably
   paint above the Details content once that content is actually
   scrolled underneath it (confirmed 2026-09-18: without an explicit
   z-index, a `<input>` inside a scrolled Day Book Entry row still won
   hit-testing over the header at the exact same screen point, even
   though .shell-top's own box was genuinely pinned at top:0 -- z-index:
   auto on a sticky/fixed element does NOT behave like z-index:0 for
   painting purposes against plain static in-flow siblings the way it's
   commonly assumed to). 40 sits comfortably above every other z-index
   already in this file (.appnav-panel/.de-suggest at 20, the highest
   before this) so the shell always wins against ordinary page content;
   .overlay (the modal dialog backdrop, below) is bumped to 100 so a
   dialog still always wins against the shell itself. */
.shell-top {
  position: sticky;
  top: 0;
  z-index: 40;
}
/* Mobile only: once the hamburger menu is expanded (.nav-open), the
   stacked item list can end up taller than a short phone's own screen
   -- and a `position: sticky` box never scrolls itself into view, so
   anything past the fold would be permanently unreachable while stuck.
   The nav-toggle button's onclick (base.html) mirrors .nav-open with
   this nav-expanded class on .shell-top itself, so the wrapper just
   drops back to its normal (static) place in the page for as long as
   the full menu is open -- it scrolls with everything else like it
   always did, and goes back to sticky the moment the menu is closed. */
html[data-view="mobile"] .shell-top.nav-expanded { position: static; }

.topbar {
  padding: 10px 24px 8px;
  /* Layer 1's own flat shade (2026-09-18) -- used to share --panel
     with the Details layer and every dropdown/modal; now its own
     step of the theme's 4-shade ramp, see the --header-bg comment
     up in :root. */
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.topbar-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.brand-block { display: flex; flex-direction: column; gap: 1px; }
/* PerfectOne logo + wordmark + divider in the tall (Dashboard) header, left of
   the firm block (2026-10-06). Everything is positioned OUT OF FLOW inside
   .brand-wrap, so the header's height is decided by the firm block alone (as
   before the logo existed) in every browser. A script in base.html sets, from
   the firm block's height --bh: --bl = the logo's side (90% of --bh, so there
   is about 5% more breathing room above and below; 44px in Mobile view), --bp
   = the offset that centres it, and --bx = the wordmark's width + the 14px gap
   before the divider. 58px / 0 / 165px are the no-script fallbacks. The firm
   block is pushed right by logo + gap + wordmark + gap + 1px line + gap (14px
   each). Colours are the theme's variables: tile = --accent, ring and "1" =
   --header-bg; divider = a soft tint of --ink. */
.brand-wrap { --bh: 58px; --bl: 58px; --bp: 0px; --bx: 165px; position: relative; min-width: 0; }
.brand-wrap .brand-block { margin-left: calc(var(--bl) + 29px + var(--bx)); }
.brand-logo { position: absolute; left: 0; top: var(--bp); width: var(--bl); height: var(--bl); display: block; }
.brand-logo svg { display: block; width: 100%; height: 100%; }
.brand-logo .bl-tile { fill: var(--accent); }
.brand-logo .bl-ring { fill: none; stroke: var(--header-bg); }
.brand-logo .bl-one { fill: var(--header-bg); }
.brand-sep { position: absolute; top: var(--bp); bottom: var(--bp); left: calc(var(--bl) + 14px + var(--bx)); width: 1px; background: color-mix(in srgb, var(--ink) 30%, transparent); }
/* Wordmark between logo and divider: "PerfectOne.in" / thin line / tagline in
   one row ("WEB APPLICATIONS"; two rows is a setting), one lock-up that is
   smaller than the logo and vertically CENTRED on it (2026-10-06). The script
   in base.html does the sizing and placing from the font's own letter metrics:
   the tagline sets the width and the name is sized to the same width, so left
   and right edges line up all the way down. The numbers to tune (tagline size,
   gaps, 1 or 2 rows) are at the top of that script (WM). "One" and the thin line are the logo tile's own
   colour (--accent). Hidden in Mobile view and in windows narrower than 1200px
   (the firm name needs the room). */
.brand-id { position: absolute; left: calc(var(--bl) + 14px); top: var(--bp); bottom: var(--bp); display: flex; flex-direction: column; justify-content: space-between; white-space: nowrap; width: max-content; }
.brand-id-name { font-weight: 700; font-size: calc(var(--bl) * 0.58); line-height: 1; color: var(--ink); }
.brand-id > * { flex: 0 0 auto; }   /* never let the 1px line shrink away when the name's box is taller than the logo */
.brand-id-one { color: var(--accent); }   /* "One" in the theme colour (the logo tile's) */
.brand-id-rule { display: block; height: 1px; background: var(--accent); }
.brand-id-tag { font-size: 0.62rem; font-weight: 600; letter-spacing: 0; line-height: 1; color: var(--muted); align-self: center; text-align: center; }   /* tagline: letter-spacing is set by the script (about 75% of the name's width), centred under the name */
.brand-id-bl { display: inline-block; width: 0; height: 0; }   /* baseline marker the script reads */
html[data-view="mobile"] .brand-id { display: none; }
@media (max-width: 1199px) { .brand-id { display: none; } }
/* Mobile view: the firm name wraps onto several lines, so the logo keeps a fixed, modest size and sits centred beside it. */
html[data-view="mobile"] .brand-wrap { --bl: 44px; --bx: 0px; --bp: 0px; }
html[data-view="mobile"] .brand-logo { top: 50%; transform: translateY(-50%); }
.brand { font-weight: 600; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.brand-line { font-size: 0.78em; color: var(--muted); line-height: 1.3; }
/* Left block's 3rd line (the FY range) bold, color matching line 1
   (the Firm name, .brand's own var(--ink)) rather than .brand-line's
   default var(--muted) -- its own modifier class rather than changing
   .brand-line itself, so Address+City just above it (also
   .brand-line) stays regular weight/color/size. font-size bumped +1pt
   over .brand-line's own 0.78em, same em-from-pt math as .user-fy's
   own +2pt comment further down this file (~9.4pt baseline at a 16px
   root -> +1pt -> ~0.86em). */
.brand-line-fy { font-weight: 600; color: var(--ink); font-size: 0.86em; }
/* .fy-step-link -- Layer 1 header's own ◀/▶ around the FY line
   (Sabari, 2026-09-23: "in UI shell layer 1 ... what if we keep
   similar back & forth arrow before & after FY (dates), i mean left
   block 3rd line" -- scoped to "only for the purpose of switching to
   prev / next year. instead of going thru menu & running
   select_firm.py"). Same "always show both, grey out the absent one"
   convention as ledger.html's own .row-ledger-link/.is-disabled pair
   (2026-09-22) -- reuses the shared .is-disabled var(--border) grey
   for consistency, but its own base class rather than .row-ledger-link
   itself: this sits inline in .brand-line-fy's own bold var(--ink)/
   0.86em type (see .brand-line-fy's own comment just above) rather
   than a report table row, so color: inherit picks that up directly
   and a small side margin stands in for .row-ledger-link's own
   column-edge/fixed-gap spacing (neither applies to a plain inline
   header line). */
.fy-step-link {
  display: inline-block;
  margin: 0 4px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.fy-step-link:hover:not(.is-disabled), .fy-step-link:focus-visible:not(.is-disabled) {
  color: var(--accent);
  text-decoration: underline;
}
.fy-step-link.is-disabled {
  color: var(--border);
  cursor: default;
}
.crumb { color: var(--muted); font-size: 0.82em; }
/* Right block (2026-09-17) -- three lines, right-edge aligned
   (align-items: flex-end) same as the left block's Firm/Address+City/FY
   stack is left-edge aligned: line 1 is Login Name with Logout at its
   end (.user-line1, its own row so the two sit side by side), line 2
   is Valid Until (2026-09-21 -- was the FY range, moved to the left
   block instead), line 3 is the crumb -- all in one flex column so
   there's no gap between them beyond this shared 1px. */
.user-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.user-line1 { display: flex; align-items: baseline; gap: 8px; }
.topbar-user { font-weight: 600; font-size: 0.85em; color: var(--ink); }
.user-block .link { font-size: 0.82em; }
/* +2pt over the old 0.78em (~9.4pt at a 16px root) -- CSS has no
   direct "pt" bump on a relative unit, so this is that same increase
   worked out in em (~11.4pt). Class name kept as .user-fy even though
   it now renders the Valid Until line, not the FY range (2026-09-21)
   -- same right-block line 2 slot, same visual weight, not worth a
   rename/churn across base.html for. */
.user-fy { font-size: 0.95em; color: var(--muted); line-height: 1.3; }
/* Once the date shown in .user-fy has actually passed (2026-09-21) --
   same red weight as the admin Clients list's own .tag-expired, just
   plain text here rather than a pill badge (this is a single small
   line in the header, not a list row). */
.user-fy-expired { color: #a11d1d; font-weight: 600; }
/* Dynamic Menu -- layer 2. Persistent on every client-facing screen
   (app.py's context processor builds nav_menu on every request), not
   just the landing page -- that was the actual gap: previously the
   menu only existed as the landing page's own content, so it
   disappeared the moment you opened any other screen. A top-level
   group with children opens as a <details> dropdown (native
   click-to-toggle + keyboard accessible, no JS needed); a top-level
   leaf is a direct link; a top-level separator becomes a vertical
   rule between groups, which actually means something in a horizontal
   bar (unlike the old boxed grid, where it was a no-op). */
.appnav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 4px 20px;
  /* Layer 2's own flat shade (2026-09-18) -- see .topbar's own note
     just above; --menu-bg is one step lighter than --header-bg in
     every theme. */
  background: var(--menu-bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  position: relative;
}
.appnav-link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}
.appnav-link:hover { background: var(--bg); }
.appnav-link.menu-disabled:hover { background: none; }
/* Home icon link (2026-09-20, see base.html's own comment on it) --
   still a plain .appnav-link (same padding, same hover, same Mobile
   override further down), so the bar's height never changes; this
   just centers its one SVG child in place of left-aligned text. */
.appnav-home { display: inline-flex; align-items: center; justify-content: center; }
.appnav-home svg { display: block; }
.appnav-vrule { width: 1px; align-self: stretch; margin: 6px 8px; background: var(--border); }
/* The screen's own heading, moved here from layer 3's .panel-head h1
   and right-aligned (Sabari, 2026-09-18) -- same font-size as that h1
   had (1.15rem, unchanged) so this reads exactly as heavy as the
   heading always did, just relocated. margin-left: auto is what pins
   it to the far right of this bar -- same trick .appnav-changefirm
   used to use before it became a plain leaf (see git history if that
   name means anything later).

   A report's "for the Period X to Y" sub-heading (the old on-screen
   .fy-line, see .appnav-page-subtitle below) joined it right
   underneath, stacked in this same wrapper (Sabari, 2026-09-18) --
   explicitly asked to fit both lines here WITHOUT growing the bar's
   own height. A screen with no sub-heading (most of them) keeps the
   original 8px padding/normal line-height below, unchanged from
   before this existed. Only when a sub-heading is actually present
   (:has(.appnav-page-subtitle)) does the padding trim to 2px and the
   line-height tighten to 1.05, just enough for both lines to still
   fit inside that same original bar height -- see subtitle_test.py's
   own bar-height check for the actual before/after measurement this
   was tuned against. column + flex-end keeps the pair right-aligned
   as a block, justify-content: center keeps that block vertically
   centered within whatever height the bar's other items still set. */
.appnav-page-title-wrap {
  margin-left: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}
.appnav-page-title-wrap:has(.appnav-page-subtitle) {
  padding: 2px 12px;
  line-height: 1.05;
}
.appnav-page-title { font-size: 1.06rem; font-weight: 600; color: var(--ink); } /* was 1.15rem; crumb = 1pt smaller (2026-10-13) */
.appnav-crumb-parent, .appnav-crumb-sep { font-weight: 400; color: var(--ink); }
/* Same size/colour .fy-line always used on screen (0.9rem, var(--muted))
   -- only the location changed, not the look. */
.appnav-page-subtitle { font-size: 0.9rem; font-weight: 400; color: var(--muted); }

/* Subscription expiry notice, Dashboard-only (2026-09-28, see base.
   html's own comment on nav_show_renewal_card there) -- sits in the
   exact same .appnav-page-title-wrap slot nav_page_title otherwise
   fills, just a single right-aligned link/line instead of a two-line
   title+subtitle stack, so it reuses that wrap's own padding/
   positioning as-is rather than needing a second wrapper class.
   -warning/-danger reuse .dash-card-warning/-danger's own exact
   colors (the removed Renewal card's own amber-while-approaching/
   red-once-past treatment) so the notice still reads the same way it
   always did, just relocated -- underlined only on hover, like every
   other .appnav-link, so it doesn't look like plain static text in a
   bar that's otherwise all clickable menu items. */
.appnav-renewal-notice { font-size: 0.92rem; font-weight: 600; text-decoration: none; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.appnav-renewal-notice:hover { text-decoration: underline; }
.appnav-renewal-warning { color: #92400e; }
.appnav-renewal-danger { color: #a11d1d; }

.appnav-dropdown { position: relative; }
.appnav-dropdown > summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--ink);
}
.appnav-dropdown > summary::-webkit-details-marker { display: none; }
.appnav-dropdown > summary::after { content: " \25BE"; color: var(--muted); font-size: 0.8em; }
.appnav-dropdown:hover > summary,
.appnav-dropdown[open] > summary { background: var(--bg); }
.appnav-dropdown > .appnav-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  padding: 6px;
  margin-top: 2px;
}
.appnav-panel-list { list-style: none; margin: 0; padding: 0; }
.appnav-panel-list a,
.appnav-panel-list .menu-disabled {
  display: block;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.appnav-panel-list a:hover { background: var(--bg); }
/* The keyboard cursor in the top menu (static/menu_keys.js: Alt / F10, arrows, Enter, Esc; Sabari 2026-11-24). */
html:not([data-view="mobile"]) .appnav .kb-cur {
  background: color-mix(in srgb, var(--focus-color, var(--accent, #2563eb)) 16%, var(--panel, #fff));
  outline: 2px solid var(--focus-color, var(--accent, #2563eb));
  outline-offset: -2px;
}
/* A nested group (depth 3) inside a dropdown panel -- another
   <details>, indented, its own panel opening as a flush block rather
   than a second floating popup (keeps this to one level of overlay). */
.appnav-subdropdown { margin: 2px 0; }
.appnav-subdropdown > summary {
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
}
.appnav-subdropdown > summary::after { content: " \25BE"; color: var(--muted); font-size: 0.8em; }
.appnav-subdropdown:hover > summary { background: var(--bg); }
.appnav-subdropdown > .appnav-panel {
  position: static;
  box-shadow: none;
  border: none;
  padding: 0 0 0 14px;
  margin: 0;
}
/* Nested group as a SIDE FLYOUT in the normal (desktop) view (Sabari,
   2026-10-03: "sub menu opens like mobile optimized, can it open like
   usual?"): the sub-menu's panel now floats to the RIGHT of its row, level
   with it, instead of unfolding in place and pushing the rows below down.
   Mobile view keeps the in-place block above (a flyout has no room on a
   narrow screen). The row shows a right-pointing arrow; base.html's script
   adds .flip-left when the flyout would run off the window's right edge. */
html:not([data-view="mobile"]) .appnav-subdropdown { position: relative; }
html:not([data-view="mobile"]) .appnav-subdropdown > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
html:not([data-view="mobile"]) .appnav-subdropdown > summary::after { content: "\25B8"; }
html:not([data-view="mobile"]) .appnav-subdropdown[open] > summary { background: var(--bg); }
html:not([data-view="mobile"]) .appnav-subdropdown > .appnav-panel {
  position: absolute;
  top: -7px;
  left: 100%;
  margin: 0 0 0 8px;
  min-width: 200px;
  z-index: 21;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.1);
  padding: 6px;
}
html:not([data-view="mobile"]) .appnav-subdropdown > .appnav-panel.flip-left { left: auto; right: 100%; margin: 0 8px 0 0; }
.appnav-separator-label {
  display: block;
  padding: 6px 10px 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.appnav-separator { border: none; border-top: 1px solid var(--border); margin: 4px 6px; }

/* Full width, same as pharma_platform's shell -- no centered max-width
   column. A Trial Balance / Day Book / Party-wise Sales style report
   genuinely wants the room; padding alone is enough of a side gutter. */
/* 16/20 (was a flat 24) -- matches .appnav's own 20px left/right
   inset above (2026-09-18, part of going flat/borderless below) so a
   report's leftmost column lines up with the menu bar's own items
   instead of sitting further in. */
/* flex: 1 0 auto -- the one flexible layer in body's flex column (see
   body's own comment above): grows to soak up any leftover viewport
   height on a short page (pushing .app-footer down to the bottom
   instead of leaving a gap under it), while never shrinking below its
   own content's natural height on a tall page (so .app-footer still
   lands right after it in normal flow, never overlapping it). */
.content { padding: 16px 20px; flex: 1 0 auto; }
/* A Dashboard-only opt-out of this growth briefly lived here
   (2026-09-21, `body.dashboard-page .content { flex: 0 1 auto; }`,
   Sabari: "reduce the blank space below the grid in layer3") --
   removed the same day once the Dashboard grew a proper Net Profit/
   Loss Trend chart alongside its cards and Accounting Summary widget
   (Sabari, from a live screenshot of the grown page: "layer 4 should
   auto fix to bottom of browser if content is less in layer 3. now
   its hanging somewhere in between" -- i.e. wanting the ordinary
   sticky-footer behaviour back). The page that opt-out was written
   for -- short and still shrinking -- isn't this page anymore, so
   .content's own flex: 1 0 auto above now applies uniformly, same as
   every other screen. */

/* Footer -- layer 4. Version only, low emphasis, same idea as
   pharma_platform's footer (a single central version value, never
   hardcoded a second time). flex-shrink: 0 (2026-09-19, part of the
   sticky-footer fix above) keeps it at its natural height as the last,
   non-growing item of body's flex column -- it should never be asked
   to shrink, but this is the same belt-and-braces the rest of this
   shell already uses (.shell-top's own explicit z-index, etc.). */
.app-footer {
  padding: 10px 20px;
  flex-shrink: 0;
  /* Layer 4's own flat shade (2026-09-18) -- used to be transparent
     (just showed body/--bg through); --footer-bg is the deepest step
     of the theme's ramp, a closing "anchor" under the lighter Details
     layer above it. */
  background: var(--footer-bg);
  color: var(--muted);
  font-size: 0.75rem;
}

/* Gone flat (2026-09-18, Sabari: "layer 3 has a border with little
   space around it, shall we remove that" / "can we fit that flat so
   we can use the space around it") -- no more border/radius. The
   Details layer now marks itself off from the page purely by colour
   (--panel vs --bg, both derived from the same hue but distinct
   lightness steps in every theme -- see :root up top), the same way
   the old bordered card used to, just without a hairline outline
   doubling up with .appnav's own border-bottom right above it.
   Padding is a flat, even 15px on every side (Sabari's own follow-up,
   same day: "3rd layer can appear flat with 15px padding around") --
   .content's own 20px above this is what aligns the coloured band
   itself with .appnav's left edge; this 15px is the separate, purely
   internal breathing room between that band's own edge and whatever
   sits inside it (a grid, a form, a toolbar...). */
.panel {
  background: var(--panel);
  padding: 15px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.panel-head h1 { font-size: 1.15rem; margin: 0; }
/* Added where a screen's own heading (2026-09-18: moved out of here,
   see .appnav-page-title) used to be the FIRST of .panel-head's two
   children, opposite its toolbar/Add-button -- .panel-head's own
   justify-content: space-between only pushes a single remaining child
   to the flex-START by default, so without this override that
   toolbar would suddenly jump from the right edge to the left the
   moment the heading it used to balance against was removed. Left
   OFF the few Add/Edit sub-forms that still carry their own on-screen
   heading (led_groups_form.html and friends) -- those still have two
   real children and still want space-between exactly as before. */
.panel-head-solo { justify-content: flex-end; }
/* .panel-head's own default align-items: center is right for a plain
   heading sitting next to a toolbar, but a couple of screens now put a
   form field (a search box, a Date picker pair) in that left slot
   instead -- shorter/taller than the buttons beside it depending on
   the field, so centering leaves a visibly uneven top/bottom edge.
   flex-end just bottom-aligns the row's own children instead (2026-
   09-20, accheads.html's own Ledger Heads screen first, led_groups.html
   and daybook.html's own date-range selector since -- each of those
   own templates carries the fuller per-screen rationale). */
.panel-head-bottom { align-items: flex-end; }

/* Admin home screen (admin_app.py's index route / home.html) --
   deliberately blank apart from these entry-point cards, one per
   top-level admin section. Add more .home-card links here (not a
   dashboard widget) if the admin panel grows more sections. */
.home-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 6px 4px;               /* 2026-11-27: was 40px / 18px -- all the cards fit one screen now */
}
.home-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 240px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.home-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
}
.home-card-title { font-size: 1.05rem; font-weight: 600; }
.home-card-desc { font-size: 0.85rem; color: var(--muted); }

/* Dashboard's own 2-column layout (2026-09-21, Sabari: "separate the
   dashboard into 2 columns & keep the cards in right side") --
   .dash-main (left) takes whatever space is left over and holds the
   Accounting Summary widget, which is deliberately width: fit-content
   (slim-fit, see .panel.dash-tb's own comment) rather than stretched
   to fill .dash-main -- so widening .dash-side doesn't fight that
   widget for room, it just shrinks .dash-main's own left-over space
   and pulls .dash-side (and its left edge) in closer. .dash-side
   (right) is a fixed-width column so a card there reads as its own
   rail, not a block that reflows with the left column's width. 580px
   -> 680px (2026-09-21, from a live screenshot with a wide empty gap
   between the two columns, Sabari: "there's lot of space in between
   2 columns, 2nd column can widen a bit if possible") -- widened
   again from the original 280px (2026-09-21 follow-up, Sabari: "in
   the dashboard, cards can flow from left to right") to fit first two,
   then three, cards per row side by side inside this same right-hand
   column -- see .dash-cards' own grid below for the actual flow; this
   fixed-width rail concept itself is unchanged, just wider now.
   Stacks back to one column on Mobile view, .dash-side above
   .dash-main, so the KPI cards are the first thing seen there too. */
.dash-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.dash-main { flex: 1 1 auto; min-width: 0; }
.dash-side { flex: 0 0 680px; }
html[data-view="mobile"] .dash-layout { flex-direction: column; }
html[data-view="mobile"] .dash-side { flex-basis: auto; width: 100%; order: -1; }
/* Mobile view keeps cards single-column (same narrow-screen
   simplification every other Mobile view override already applies
   elsewhere in this app) rather than squeezing two per row into a
   phone-width column. */
html[data-view="mobile"] .dash-cards { grid-template-columns: 1fr; }
/* A tablet held upright (touch + portrait, e.g. 1200 x 2000): too narrow for the fixed 680px card column beside the summary, so it stacks
   like Mobile view -- cards on top, the Accounting Summary below, cards full width, the summary below at its own natural width (Sabari, 2026-10-22). The cards keep their 3 columns. */
@media (any-pointer: coarse) and (orientation: portrait) {
  html:not([data-view="mobile"]) .dash-layout { flex-direction: column; }
  html:not([data-view="mobile"]) .dash-side { flex-basis: auto; width: 100%; order: -1; }
  html:not([data-view="mobile"]) .dash-main { width: 100%; flex: 0 0 auto; }
}

/* Client-facing Dashboard's own cards (2026-09-21) -- same shape as
   the admin Home screen's .home-card above (the whole box is the
   link, title + one line of description), just smaller/left-bordered
   rather than a plain neutral tile, since a card like Negative Cash
   Balance carries a status, not just a destination. .dash-card-warning
   is currently unused (Renewal, the card it was introduced for, moved
   to layer 2 -- 2026-09-28, see base.html's own nav_show_renewal_card
   comment there -- kept here anyway as a ready-made amber variant,
   same family as -danger/-success/-accent below, for whatever
   Dashboard card needs it next) -- .dash-card-danger colors that left
   border (and the title) to match the same red .notice-danger weight
   used elsewhere in this app.
   **Flow (2026-09-21 follow-up, Sabari: "in the dashboard, cards can
   flow from left to right")** -- a CSS Grid, fills left-to-right and
   wraps to a new row automatically as more cards are added.
   **3 columns (2026-09-21, Sabari: "let Net Profit, Stock, Sales Vs
   Purchase fit into one row (3 cards) / second row graph / third row
   (2 cards)")** -- equal thirds (`repeat(3, 1fr)`), replacing the
   briefly-lived 2-column `auto 1fr` from earlier the same day (a
   Column-1-auto-sizes-to-content tweak that made sense for 2 columns
   but had nothing sensible to generalize to for 3, since column 1
   alone would now need to fit BOTH Net Profit's short figure AND
   Data Entry done upto's date -- equal thirds keeps every column the
   same width regardless of which row's card happens to be tallest/
   widest). The row layout this produces (today): Net Profit/Loss,
   Inventory, Sales vs Purchase fill row 1 exactly; the Net
   Profit/Loss Trend chart spans every column as its own row 2 right
   after (see .dash-chart-card below, and that card's own comment in
   main.html for why row 1 has to be exactly 3 cards for this to land
   without a gap); Data Entry done upto, Last Backup and Negative Cash
   Balance fill row 3, a clean 3 with no conditional card completing it
   any more (Renewal used to; see .dash-card-warning's own comment
   above).
   Mobile view forces this back to a single column further below (same
   narrow-screen reasoning flex-direction: column above already
   applies to the outer 2-column layout). */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  width: 100%;
}
.dash-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  text-decoration: none;
  color: var(--ink);
  /* Resting shadow (2026-09-21, Sabari: "Net Profit card appears
     beautiful with a shadow like thing in the back. we can apply the
     same to all cards...") -- every card now carries this same soft
     lift at rest, not just on :hover the way the plain neutral shadow
     below used to be the only one. The colored variants underneath
     (-warning/-danger/-success/-accent) each override both this and
     the :hover rule with their own tinted rgba/color-mix so a card's
     shadow always reads as "that card's own color, just soft" rather
     than one flat gray puddle under every card regardless of status. */
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.10);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-card:hover {
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.16);
}
.dash-card-title { font-size: 0.95rem; font-weight: 600; }
.dash-card-desc { font-size: 0.82rem; color: var(--muted); }
.dash-card-warning { border-left-color: #d97706; box-shadow: 0 3px 10px rgba(217, 119, 6, 0.20); }
.dash-card-warning .dash-card-title { color: #92400e; }
.dash-card-warning:hover { box-shadow: 0 4px 14px rgba(217, 119, 6, 0.28); }
.dash-card-danger { border-left-color: #dc2626; box-shadow: 0 3px 10px rgba(220, 38, 38, 0.20); }
.dash-card-danger .dash-card-title { color: #a11d1d; }
.dash-card-danger:hover { box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28); }
/* Net Profit (2026-09-21) -- same amber/red weight as the two above,
   just the positive case: a green in the same family (green-600
   border / green-700 title, matching -warning/-danger's own 600
   border / 700-800 title pairing). Net Loss reuses .dash-card-danger
   itself rather than a separate class -- it's the exact same "this
   needs attention" red the Renewal card already uses once expired. */
.dash-card-success { border-left-color: #16a34a; box-shadow: 0 3px 10px rgba(22, 163, 74, 0.20); }
.dash-card-success .dash-card-title { color: #15803d; }
.dash-card-success:hover { box-shadow: 0 4px 14px rgba(22, 163, 74, 0.28); }
/* Data Entry done upto / Sales vs Purchase (2026-09-21, same round as
   the shadow above) -- these two carry no status of their own (no
   profit/loss, no expiry to warn about), so rather than leaving them
   the plain gray .dash-card look next to three colored cards, they
   pick up the client's own THEME color instead (var(--accent), same
   blue/green/maroon/... every .btn-primary already uses -- see this
   file's own top comment and theme_vars.css) for their left border,
   title and shadow tint. color-mix() (not a fixed rgba() the way the
   three status variants above use) is what lets one rule apply across
   all 20 theme palettes -- including the dark ones -- without a
   generated --accent-rgb companion variable to keep in sync. */
.dash-card-accent { border-left-color: var(--accent); box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 22%, transparent); }
.dash-card-accent .dash-card-title { color: var(--accent); }
.dash-card-accent:hover { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 32%, transparent); }

/* Net Profit/Loss trend chart (2026-09-21, Sabari: "we can build it &
   create a new card in dashboard") -- spans every .dash-cards grid
   column (a bar chart needs real width, unlike every other card here,
   which just sizes to its own text) and otherwise reuses
   .dash-card-accent's own themed border/title/shadow treatment, not a
   fresh look of its own. `grid-column: 1 / -1` rather than a literal
   `span 2`/`span 3` so this keeps spanning correctly however many
   columns .dash-cards has -- already paid off once (2 columns to 3,
   same day, see .dash-cards' own comment above) with no change needed
   here at all. Mobile's 1-column override further down already
   collapses .dash-cards to `1fr`, so no separate mobile rule is
   needed here -- this card just becomes the same single column width
   as every other card there. */
.dash-chart-card { grid-column: 1 / -1; }
.dash-chart { width: 100%; height: auto; display: block; margin-top: 4px; overflow: visible; }
/* Zero-baseline reference line -- var(--border), not var(--accent),
   so it reads as a neutral axis rather than competing with the
   profit/loss bars' own green/red for attention. */
.dash-chart-zero { stroke: var(--border); stroke-width: 1; }
/* Bars reuse the exact same green/red pair .dash-card-success/
   -danger already use for the Net Profit/Net Loss card just above
   this one, so a profit year here and a profit month there always
   read as the same color -- not a separate palette of its own. */
.dash-chart-bar-profit { fill: #16a34a; }
.dash-chart-bar-loss { fill: #dc2626; }
/* A year with no net_profit_paise snapshot yet (never processed) --
   a short vertical tick on the baseline, in var(--muted), rather than
   an empty gap that would look like the chart simply skipped that
   year by mistake. */
.dash-chart-nodata { stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
/* text-anchor: end (not middle) -- required by the -90deg rotation in
   main.html: with the rotation pivoted at each tick's own (cx,
   label_y), "end" is what makes the text read bottom-to-top straight
   down AWAY from that pivot, so it still starts right at its own tick
   rather than drifting off to one side of it. See main.py's
   _profit_chart() for why label_y sits where it does (2026-09-21,
   Sabari: "can we keep the financial year caption rotated" -- then
   "instead of captioning as '2006-07', we can keep it simple as
   '06-07' & rotate 90degree"). */
.dash-chart-tick-label { font-size: 12px; fill: var(--muted); text-anchor: end; }

/* Dashboard's Trial Balance summary widget (2026-09-21, Sabari: "bring
   the tri_bal.py summarized version to dashboard... show this in left
   column") -- sits in .dash-main, a .panel like any report page's own
   table wrapper, just with its own small heading since (unlike a real
   report screen) there's no .appnav-page-title/.panel-head toolbar row
   here to carry one. */
.panel.dash-tb {
  margin-bottom: 20px; width: fit-content; max-width: 100%; overflow-x: auto; padding: 10px 15px;
  /* Same-day follow-up (Sabari: "can we apply the same styling to
     Accounting Summary box") -- this widget carries no status of its
     own either, same case as the Sales vs Purchase/Data Entry cards
     just beside it, so it picks up the exact same .dash-card-accent
     treatment (border, rounded corners, accent-colored left border +
     heading, theme-tinted resting shadow) rather than a bespoke rule
     set -- so the whole .dash-side/.dash-main pairing reads as one
     consistent family of boxes, not a plain flat .panel next to three
     lifted cards. Not a link, so unlike .dash-card-accent this has no
     :hover shadow bump -- that would read as a false clickability
     hint. See .dash-card-accent's own comment (further up this file)
     for why color-mix() rather than a fixed rgba(). */
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--accent) 22%, transparent);
}
.dash-tb-title { font-size: 0.85rem; margin: 0 0 6px; color: var(--accent); font-weight: 600; }

/* Same-day follow-up tuning (Sabari: "make it as 3 column (Group
   Description, Credit, Debit)... should appear like a table, vertical
   & horizontal lines on every rows & columns. make the heading in
   bold font. desc, credit & debit in normal font") -- every other
   .grid in this app (including the full Trial Balance report this
   widget summarizes) is deliberately borderless apart from a bottom
   hairline per row, but this one widget was asked to read as an
   actual boxed table, so it gets its own real vertical + horizontal
   lines on every cell rather than changing .grid itself app-wide.
   Row shading/indent still comes from .tb-group-row/.tb-primary-row
   (financial_statement.html's own classes, reused as-is) -- these
   rules only add the missing borders on top and restore a plain
   (non-uppercase, non-muted) bold header, since .grid th's own
   uppercase/muted/small styling (built for the wider multi-column
   report grids) read too quiet for a 3-column dashboard widget.

   A second round the same day ("make all the 3 column auto adjust
   its horizontal size / also make it tighter vertically") dropped
   .grid's own width: 100% -- a plain HTML table's default sizing
   (shrink-to-fit, each column only as wide as its own widest cell)
   reads better for a compact 3-column widget than stretching Group
   Description/Credit/Debit to fill the whole (fairly wide) left
   column -- and trimmed the row padding down from .grid's own
   default 9px vertical.

   A third round ("still it appears wider, it should appear as narrow
   as possible (slim fit)") found that width: auto here was actually
   losing to .grid's own width: 100% -- same specificity (one class
   each), .grid just happens to be declared LATER in this file, so it
   was winning the cascade regardless of source order up here. Selector
   bumped to .grid.dash-tb-grid (two classes on the one element this
   table already carries) so this always wins on specificity, not
   source order. .dash-tb itself (the .panel card wrapping the heading
   + table + any tally notice) is now width: fit-content too, for the
   same reason -- a .panel is a plain block box, so even with the table
   itself finally shrink-to-fit, the green card around it was still
   stretching to fill .dash-main's own full width on its own.

   Turns out the same order-not-specificity trap was already silently
   overriding TWO more of this widget's own rules below, both now also
   bumped to .grid.dash-tb-grid for the same reason: .grid th, .grid td's
   own padding: 9px 8px (this widget's "tighter vertically" round never
   actually landed) and .grid th's own muted/uppercase/letter-spaced
   styling (this widget's header was never actually bold/plain-case
   either, despite the earlier "make the heading in bold font" round --
   look closely at a live screenshot and it's still grey/uppercase).

   A fourth round ("decrease the font size by 2 points") drops the
   table's own font-size 2pt below .grid's own 0.92rem baseline --
   same calc(<base> +/- Npt) pattern already used elsewhere in this
   file for a point-based bump (.report-letterhead, .panel-head h1/
   .print-report-title, .selectwin-grid) rather than hand-converting
   to em. Set once on the table itself so td inherits it; th needs its
   own copy since font-size is a property th already set explicitly
   above (not something it would otherwise inherit from the table).

   A fifth round ("trying to show this in single screen without
   scrolling -- tighten the vertical spacing a bit, reduce the heading
   font size") -- cell padding dropped from 5px to 2px top/bottom
   (both .grid.dash-tb-grid th/td and the .tb-group-row/.tb-primary-row
   overrides below, so every row shrinks together), .dash-tb-title
   (the "Accounting Summary" heading) down from 1.05rem/10px margin to
   0.85rem/6px, and the .panel card's own inherited 15px top/bottom
   padding trimmed to 10px via .panel.dash-tb (bumped to two classes
   for the same specificity-over-.panel reason as everywhere else in
   this comment -- .panel itself sets padding: 15px on all four
   sides).

   A sixth round ("increase the font size by 1 point in the grid
   without increasing the row size") bumped font-size from
   calc(0.92rem - 2pt) to calc(0.92rem - 1pt) -- but a taller font
   normally means a taller line box too (line-height: normal scales
   WITH font-size), which would have grown every row right back. Fixed
   by pinning line-height to a flat 15px instead of leaving it to
   scale off font-size -- now font-size can move on its own with
   nothing else to compensate for. See main.html's own body_class
   block / body.dashboard-page below for this same round's other half
   ("reduce the blank space below the grid in layer3"). */
.grid.dash-tb-grid { width: auto; border: 1px solid var(--border); font-size: calc(0.92rem - 1pt); }
.grid.dash-tb-grid th,
.grid.dash-tb-grid td {
  border: 1px solid var(--border);
  padding: 2px 10px;
  /* Fixed px line-height rather than a multiplier of font-size --
     decouples row height from font-size entirely, so a later "bigger
     font, same row height" round (see below) is just a font-size
     change with nothing else to compensate. 15px matches what this
     cell's own line-height came out to (line-height: normal, at the
     smaller pre-round-6 font-size) before this was pinned. */
  line-height: 15px;
}
.grid.dash-tb-grid th {
  font-weight: 700;
  font-size: calc(0.92rem - 1pt);
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink);
}
.grid.dash-tb-grid td { font-weight: 400; }
/* .tb-group-row/.tb-primary-row (financial_statement.html) both drop
   or shrink the row's own border-bottom, and adjust their own
   padding-top, for the full report's flatter look -- both overridden
   here so every row keeps its own full box at this widget's own
   tighter padding instead. (Already higher-specificity than either's
   own 1-class rule, so no order trap on these two.) */
.dash-tb-grid .tb-group-row td {
  border: 1px solid var(--border);
  padding: 2px 10px;
}
.dash-tb-grid .tb-primary-row td { padding: 2px 10px; }

.grid { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.grid th, .grid td {
  text-align: left;
  padding: max(1px, calc(9px + var(--lay-gy, 0px))) 8px;
  border-bottom: 1px solid var(--border);
}
.grid th { color: var(--muted); font-weight: 600; font-size: var(--grid-header-size); text-transform: uppercase; letter-spacing: 0.02em; }
.grid .mono { font-variant-numeric: tabular-nums; color: var(--muted); }
.grid .empty { color: var(--muted); text-align: center; padding: 24px 0; }

/* Linked Screens' module <-> Client Type matrix (Sabari, 2026-09-23:
   "in between file & description column we need to bring checkboxes
   (per client type ... map that .py to that client type ... the
   checkbox column should be dynamic"). One narrow column per
   CLIENT_TYPES entry (admin_templates/linked_screens.html loops it
   directly, so the column COUNT here is whatever that list happens to
   be, not fixed at today's 11) -- the header label is rotated -90deg,
   same idiom already approved for the Dashboard chart's own FY
   captions (.dash-chart-tick-label, 2026-09-21), so a longer label
   like "FA (Single Entry)" doesn't force the column itself wide; the
   checkbox column stays a fixed narrow width regardless of label
   length.

   2026-09-23 follow-up, after seeing it rendered ("each section, we
   can draw it as a table with vertical, horizontal & outline" --
   "heading can bottom align") -- unlike the plain row-line-only
   .grid convention every other report table in this app uses, this
   matrix gets full ruled borders (every cell, all four sides, which
   -- combined with border-collapse: collapse from .grid itself --
   also reads as one clean outline around the whole table) since with
   11+ narrow columns a bare row line alone doesn't make it obvious
   which checkbox belongs under which rotated heading. Scoped to
   .mct-grid specifically, not .grid as a whole, so it doesn't change
   any other screen. Header cells are bottom-aligned so a short label
   ("POS") and a long one ("FA (Single Entry)") both sit flush against
   the same baseline right above the checkbox row, instead of each
   starting flush at the TOP of the header row and leaving a ragged
   gap of blank space underneath before the body starts.

   Same-day follow-up ("just like reports, you can apply theme shade
   here in heading") -- the heading row picks up var(--shade), the
   same theme-driven background every report/emphasis row in this app
   already shades with (opening/totals rows, ledger subtotal rows,
   the Dashboard TB summary's own primary row) rather than a flat
   white/transparent header, so it reads clearly as its own row
   against 20+ plain body rows underneath and follows whichever theme
   is active instead of a hardcoded color. */
.mct-grid th, .mct-grid td { border: 1px solid var(--border); }
.mct-grid thead th { vertical-align: bottom; background: var(--shade); }
.mct-grid th.mct-th, .mct-grid td.mct-td { padding: 6px 2px; text-align: center; width: 34px; }
.mct-th-label {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-size: var(--grid-header-size);
  letter-spacing: 0.02em;
}
.mct-td input[type="checkbox"] { width: auto; margin: 0; }

/* User Access Rights (access_rights.html, 2026-09-23) -- a plain
   .grid table, not .mct-grid: only 5 permission columns here (vs up
   to 11+ Client Type columns on Linked Screens/Themes' own
   mct-grid), so horizontal wrapped headers ("Modify (Previous Days)")
   read more clearly at a normal width than mct-grid's narrow
   34px/rotated-heading columns would. */
.rights-grid th, .rights-grid td { border: 1px solid var(--border); }
.rights-grid thead th { background: var(--shade); text-align: center; }
.rights-grid thead th:first-child { text-align: left; }
/* .rights-grid td.rights-td (not just .rights-td) -- Sabari,
   2026-09-27c: "let the checkboxes center align with the table
   headings". Plain `.rights-td { text-align: center }` was ALREADY
   here and never actually took effect: the generic `.grid th, .grid
   td { text-align: left; ... }` rule up above combines an element
   selector with a class (specificity 0,1,1), which beats a
   class-only selector like `.rights-td` (0,1,0) regardless of which
   one comes later in the file -- so every checkbox cell was silently
   still left-aligned under its own centered heading the whole time.
   Adding the element+class back on this side too (0,2,1) settles it
   the right way instead of relying on source order. */
.rights-grid td.rights-td { text-align: center; width: 120px; }
.rights-td input[type="checkbox"] { width: auto; margin: 0; }

/* The combo box picking WHICH login the grid below is showing/editing
   -- its own small form (a plain GET reload, onchange="this.form.
   submit()", same "classic full-page-reload" convention as every
   other picker in this app), sitting just above the rights grid's own
   POST form. */
.ar-login-picker { margin-bottom: 16px; }
.ar-login-picker select { min-width: 260px; }

/* "Can't uncheck" popup's own assignment list (2026-09-23) -- plain
   list, no bullets (matches .nested-tree's own convention elsewhere in
   this app), one light divider per row instead so a run of "Template
   -> Leaf" lines reads as a small table rather than a wall of text;
   capped height + scroll since nothing stops the same module being
   wired to a great many leaves across templates. */
.mct-usage-list { list-style: none; margin: 8px 0; padding: 0; max-height: 240px; overflow-y: auto; }
.mct-usage-list li { padding: 5px 8px; border-bottom: 1px solid var(--border); }
.mct-usage-list li:last-child { border-bottom: none; }

/* Shared "pick one from a list inside a popup" shell -- same capped-
   height/scroll/one-divider-per-row idea as .mct-usage-list just
   above, but every row here IS the clickable choice itself, not a
   static line, so each <li> holds one full-width button instead of
   plain text. First built as .import-template-list for Menu Builder's
   own Import Template popup (menu_builder.html, 2026-09-28: pick
   another same-Client-Type template to copy its menu from); reused
   as-is for Access Setup's Copy User popup (access.html, same day:
   pick another user to copy their ticked access from) -- both apps
   share this one static/style.css (see this file's own top note), and
   the shape is identical, just what's being picked differs, so one
   ruleset under both class names rather than two copies of the same
   five rules. */
.import-template-list, .copy-user-list { list-style: none; margin: 8px 0; padding: 0; max-height: 280px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.import-template-list li, .copy-user-list li { border-bottom: 1px solid var(--border); }
.import-template-list li:last-child, .copy-user-list li:last-child { border-bottom: none; }
.import-template-list button, .copy-user-list button {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; padding: 8px 10px;
  background: none; border: none; cursor: pointer;
  color: var(--ink); font-size: 0.88rem;
}
.import-template-list button:hover, .copy-user-list button:hover { background: var(--shade); }
.import-template-list button .mono, .copy-user-list button .mono { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

.row-actions { white-space: nowrap; text-align: right; }
.inline { display: inline; }

.link {
  background: none; border: none; cursor: pointer;
  color: var(--accent); font-size: 0.88rem; padding: 0 4px;
}
.link:disabled { color: var(--border); cursor: default; }
.link-danger { color: #b91c1c; }
/* Menu Builder: a leaf whose screen is not ticked on Linked Screens for the template's Client Type (2026-10-08) */
.menu-unlinked { color: #b91c1c; }

.tag { padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; }
.tag-on { background: #dcfce7; color: #166534; }
.tag-off { background: #f3f4f6; color: #6b7280; }
/* A THIRD tag color, red rather than just neutral grey -- for Server
   Status's service badges (admin_app.py, 2026-09-17), where "inactive"
   needs to read as a real problem (a crashed gunicorn worker), not the
   same "off, and that's fine" grey .tag-off already means for e.g. a
   disabled client login. Same red .link-danger already uses. */
.tag-danger { background: #fee2e2; color: #b91c1c; }

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
/* Import Data's own Import & Replace button (admin_app.py, 2026-09-17) --
   same red as .tag-danger/.link-danger, for a destructive action that
   isn't just "delete one file" (File Manager's own buttons stay plain
   .link-danger text links) but a full replace of a client's financial
   data with no backup to fall back on. */
.btn-danger { background: #b91c1c; border-color: #b91c1c; color: white; }
.btn-danger:hover { filter: brightness(90%); }
/* Back link, Master edit-forms (accheads/firms/led_groups_form.html),
   2026-09-30, Sabari: "change the caption 'Cancel' to 'Back', also
   apply the theme to that button" -- plain .btn stays neutral (border/
   panel) everywhere else in the app (Close/No/Narration Shortcuts/etc.
   all keep that look on purpose), so theming just this one link needed
   its own class rather than changing .btn itself. Outlined in
   var(--accent) instead of solid-filled like .btn-primary, so Back
   still reads as the lower-emphasis action next to Save's solid fill --
   same accent color, less visual weight. color-mix() for :hover, same
   idiom as .dash-card-accent above, so one rule works across every
   theme palette (including the dark ones) with no extra variable. */
.btn-back { background: var(--panel); border-color: var(--accent); color: var(--accent); }
.btn-back:hover { background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.btn:disabled, .btn-primary:disabled, .btn-danger:disabled, .btn-back:disabled { opacity: 0.6; cursor: default; }

.overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.35);
  align-items: center;
  justify-content: center;
  /* Above .shell-top's own z-index: 40 (2026-09-18) -- a modal dialog
     must always win against the sticky Header/Menu, never sit behind
     it. */
  z-index: 100;
}
.overlay.open { display: flex; }

.dialog {
  background: var(--panel);
  border-radius: 10px;
  padding: 22px 24px;
  width: 420px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
}
.dialog h2 { margin: 0 0 14px; font-size: 1.05rem; }

.dialog label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.dialog input[type="text"],
.dialog input[type="password"],
.dialog textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  /* --input-bg/--input-fg (2026-09-19b), not --panel/--ink -- every
     editable control in the app shares this one pair of theme colors
     now, kept separate from the panel it sits on so a field visibly
     reads as "editable" rather than blending into the background
     (Sabari: "textbox back color, textbox forecolor... may apply to
     combo, editbox, data picker too"). See db.py's Theme Management
     section for where these two colors live. */
  color: var(--input-fg);
  background: var(--input-bg);
}
/* Day Book Entry's own Description editbox (2026-09-20) -- everything
   above already fits a <textarea> (full-width, same border/colors),
   this is just the two things unique to a multi-row box: match the
   rest of the dialog's own font (a bare <textarea> defaults to the
   browser's monospace) and only let it grow taller, never wider than
   the dialog already forces it. */
.dialog textarea { font-family: inherit; resize: vertical; }
.row2 { display: flex; gap: 12px; }
.row2 label { flex: 1; }

/* Delete Client confirmation popup (admin_templates/clients.html,
   2026-09-28) -- Sabari: "show that 10 digit number in separate row
   boldly also up font size by 3 points". A plain window.prompt() (this
   popup's own predecessor) can't be styled at all -- no bold, no
   font-size -- which is the whole reason this became a real .overlay/
   .dialog popup instead. Normal body text throughout this app is
   effectively 12pt (the browser/print-standard mapping for its own
   16px/1rem default -- see .dialog label's own 0.82rem etc., all
   fractions of that same base), so "+3 points" lands the confirmation
   number itself at 15pt -- a plain literal pt value rather than a
   rem/em fraction of it, both so the jump actually reads as "+3pt" at
   a glance and so it stays exactly 3pt bigger regardless of whatever
   the surrounding dialog text's own size is. */
.delete-confirm-number-row {
  margin: 14px 0;
  text-align: center;
  font-weight: 700;
  font-size: 15pt;
}
.delete-confirm-error {
  color: #b91c1c;
  font-size: 0.82rem;
  margin: -6px 0 10px;
}

/* Same field look as .dialog, for a form that's its own full page
   instead of a modal (e.g. client_form.html) -- a Client record is
   going to carry a lot more fields over time (GSTN, DL numbers, FSSAI
   numbers...) than a dialog comfortably holds. */
.form-page label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.form-page input[type="text"],
.form-page input[type="password"],
.form-page input[type="date"],
.form-page select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  /* --input-bg/--input-fg, not --panel/--ink -- see .dialog input's
     own comment above, the first of these rules in source order. */
  color: var(--input-fg);
  background: var(--input-bg);
}
.form-page { max-width: 640px; }

/* client_form.html's own "tight" layout -- Sabari, 2026-09-28, first
   pass: "Make the Add Client screen simple & tight, so that the user
   can avoid scrolling" (paired fields two-to-a-row, label above each
   box); then, on seeing it: "No not like this / refer the screenshot /
   let the name, address & city text boxes align one below other &
   caption sits on the left" -- his own attached VFP desktop screenshot,
   caption-left rather than caption-above. Every field is now one
   .field-row: a fixed-width .field-caption on the left (right-aligned)
   plus the input filling the rest of the row -- since every row's own
   caption column is the SAME width, every input box lines up to the
   same left edge and ends up the same width too, stacked one below the
   other exactly as asked, with no per-field pixel width hand-picked.
   Scoped to .client-form-tight specifically, layered on TOP of
   .form-page/.row2/.hint/.sub-head above rather than editing any of
   those directly, since every one of them is shared by half a dozen
   other Add/Edit screens (theme_form.html, firms_form.html,
   accheads_form.html, nshort_form.html, led_groups_form.html, op_cash's
   own use of .form-page) that were never asked to change shape. */
.client-form-tight .field-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
/* 130px, not the original 190px -- Sabari, 2026-09-28: "i can see lot of
   space on the left on every caption, need to adjust that too". 190px
   was sized for "Trial Balance Column Order", the longest caption this
   form had; now that it's moved into a narrower secondary spot (renamed
   "Debit, Credit Column order", see .client-form-caption-narrow below),
   the longest caption left in this shared column is "Address line 1/2/3"
   / "Admin Username", so the column itself can shrink to fit -- that's
   what was actually showing up as empty space to the left of every
   right-aligned SHORT caption ("Name", "City", ...) sitting in a column
   wider than any of them ever needed. */
.client-form-tight .field-caption {
  flex: 0 0 130px;
  text-align: right;
  font-size: 0.82rem;
  color: var(--muted);
}
/* Every ordinary (one-field) row's own box is a FIXED width -- not
   flex: 1 1 auto filling whatever the caption column leaves behind --
   specifically so shrinking that caption column (above) moves the
   caption+box pair left as a block instead of quietly growing every
   box wider. Sabari was explicit both times a box width changed here
   ("adjust the textbox widths (do not change width of other
   textboxes)", "do not adjust overall textboxes width") -- this is what
   makes that hold structurally instead of by coincidence. 440px matches
   what these boxes already measured before this pass. */
.client-form-tight .field-row input[type="text"],
.client-form-tight .field-row input[type="password"],
.client-form-tight .field-row input[type="date"],
.client-form-tight .field-row select {
  flex: 0 0 440px;
  width: 440px;
  margin-top: 0;
}
/* Enabled/Admin Login Enabled -- a blank .field-caption (same width as
   every real caption) keeps a STANDALONE checkbox row's own checkbox
   starting at that same shared left edge as every text box above/below
   it, instead of hugging the panel's own left margin. Enabled itself no
   longer uses this (it moved onto the Valid Until row, see
   .client-form-split-field below) -- Admin Login Enabled still does. */
.client-form-tight .field-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}
.client-form-tight .field-checkbox input[type="checkbox"] { width: auto; margin: 0; }
/* This form's three two-field rows -- Client ID + Code, Currency +
   Debit, Credit Column order, Valid Until + Enabled (Sabari, 2026-09-28,
   across two requests: "move it side by side along Currency Row",
   "Add Client ID ... keep it side by side along with 'Code'", "move the
   Enabled checkbox to right of 'Valid Until' (side by side, middle
   aligned)") -- each is a plain .field-row holding two
   .client-form-split-field labels (own caption+input pair) instead of
   the usual one field-row = one label. Each half gets roughly half the
   row's own width, so -- UNLIKE the fixed-440px boxes above -- these
   boxes genuinely do narrow to fit two into one row; that's the "adjust
   the textbox widths" Sabari asked for on exactly these fields, never
   meant to extend to any other row. margin-bottom: 0 here matters: each
   .client-form-split-field is still a real <label>, which without this
   would ALSO pick up .form-page label's own 14px margin-bottom on top
   of the OUTER .field-row's 6px above -- exactly the oversized gap
   Sabari flagged after Currency/Debit,Credit first shipped ("tighten
   the space between Currency & Client type row (just like other
   textboxes)"); every split row had it, just most visibly on that one. */
/* Pinned to the SAME total width every ordinary row occupies (130px
   caption + 10px gap + 440px box = 580px) -- Sabari, 2026-09-28: "Client
   ID row & Currency row stretches outside, need to fix that". Without
   this, a .field-row with no fixed-width box of its own (both halves
   are flex: 1 1 50%, no cap) just grows to fill the whole panel width
   available to it, well past 580px, which is exactly why these three
   rows' own boxes were reaching further right than the aligned column
   of single-field boxes above/below them. */
.client-form-tight .client-form-split-row { width: 580px; }
.client-form-tight .client-form-split-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 50%;
  min-width: 0;
  margin-bottom: 0;
}
.client-form-tight .client-form-split-field input[type="text"],
.client-form-tight .client-form-split-field input[type="password"],
.client-form-tight .client-form-split-field input[type="date"],
.client-form-tight .client-form-split-field select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
}
/* The row's FIRST caption (Client ID / Currency / Valid Until) keeps
   the shared .field-caption width so IT still lines up with every other
   row's own caption; the SECOND caption in the row isn't part of that
   shared column at all -- nothing below it needs to line up with it --
   so it's sized to its own text instead of forcing the same fixed width
   twice into one row. */
.client-form-tight .field-caption.client-form-caption-narrow {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* Every .hint lines up under that same shared input column (130px
   caption + 10px gap) rather than starting flush at the panel's own
   left edge, so it still reads as "about the field right above it" even
   though that field's own caption now sits to the left, not above.
   .client-form-hint-full opts back OUT for the one hint that isn't
   about a single field -- the Client Admin Login section's own intro
   paragraph, which reads better at the full row width. */
.client-form-tight .hint { margin: -3px 0 6px 140px; font-size: 0.78rem; line-height: 1.2; }
.client-form-tight .hint.client-form-hint-full { margin-left: 0; }
.client-form-tight .sub-head { margin: 8px 0 3px; }
/* Two columns (Sabari, 2026-09-28: "split the screen into 2 columns and
   move the block 'Client Admin Login' to the right and place the Save,
   Cancel buttons in 2nd column aligned to bottom right") -- widened from
   .form-page's own 640px (this .client-form-tight rule, one class same
   as .form-page's, wins on being later in the file) since two 580px
   columns -- 580px being every row's own already-fixed total width,
   130px caption + 10px gap + 440px box, same number client_form.html's
   own comment on .client-form-split-row uses -- plus a gap between them
   need more than 640px to sit side by side without the right column
   squeezing its own Admin Username/Password boxes narrower than the
   left column's boxes. */
.client-form-tight { max-width: 1200px; }
.client-form-tight .client-form-columns { display: flex; gap: 40px; }
.client-form-tight .client-form-col-left { flex: 0 0 580px; }
/* display: flex column + margin-top: auto on .client-form-actions-bottom
   below is what pushes Save/Cancel down to the BOTTOM of this column
   specifically, not just after the last Admin field -- flex's own
   default align-items: stretch (nothing overrides it here) makes this
   column exactly as tall as .client-form-col-left next to it, which
   Client Admin Login's own handful of fields never fill on their own,
   so without this Save/Cancel would sit high up with empty space below
   them instead of lining up with the left column's own bottom edge. */
.client-form-tight .client-form-col-right {
  flex: 0 0 580px;
  display: flex;
  flex-direction: column;
}
/* .dialog-actions' own default (justify-content: flex-end) already
   right-aligns Save/Cancel -- this form used to override that to
   flex-start back when the buttons sat left-aligned under the single
   column of fields (see client_form.html's own history); now that
   they've moved into the right column, the override is gone and the
   default applies again, which is the "aligned to ... right" half of
   what Sabari asked for; margin-top: auto is the "bottom" half. */
.client-form-tight .client-form-actions-bottom { margin-top: auto; }
/* This screen's own panel-head (its Add/Edit Client heading + Back to
   Clients link) sits right above the now-tightened form -- shrinking
   its bottom margin the same way keeps that gap in proportion instead
   of leaving one old-sized gap floating above an otherwise tight page. */
.client-form-head-tight { margin-bottom: 8px; }

/* Screen Type on Sign In (login.html, 2026-09-17) -- same field rhythm
   as .form-page label above (14px margin-bottom) but a plain <div>,
   not <label> (see login.html's own comment on why), so its own inner
   caption needs the same look spelled out again rather than inheriting
   .form-page label's rule. Reuses the segmented .view-switch look the
   post-login Display dropdown already has (see further down). */
.view-mode-field { margin-bottom: 14px; }
.view-mode-field > span { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }

.checkbox { display: flex; align-items: center; gap: 6px; }
.checkbox input { width: auto; margin: 0; }
/* ledger.html's own date range + checkbox row (2026-09-20, Sabari:
   "let the checkboxes vertically middle align with date textbox") --
   see that template's own comment on this class for the full
   reasoning. .selector-form's own align-items: flex-end anchors each
   item by its own BOTTOM margin edge, so it's margin-bottom (not
   margin-top) that actually moves a flex-end-aligned item -- 8px was
   measured against the actual rendered "From" input box, not guessed
   from font metrics.
   Now shared with interest_statement.html's own "Select New Page for
   Every Ledger" checkbox too (2026-09-20, Sabari: "checkbox alignments
   can match similar to ledger.py") -- same From/To + single checkbox
   row shape, so the name is a bit stale but the class itself is no
   longer ledger-only. Left named as-is rather than a mechanical
   rename across both templates for a cosmetic reason alone. */
.ledger-checkbox-row { margin-bottom: 8px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.flash { margin-bottom: 14px; }
.flash-msg {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.selector-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
/* daybook.html (2026-09-20, Sabari: "bottom align textboxes in the top
   with all those buttons located in the top & right top") -- this
   form now sits INSIDE the same .panel-head-bottom row as the Export/
   Print toolbar, not as its own full-width block above the table any
   more, so it no longer wants a second bottom margin/padding/border of
   its own; .panel-head's already-14px margin-bottom is what separates
   this whole row from the table below now. */
.selector-form-inline { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.selector-form label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
.selector-form select,
.selector-form input[type="date"] {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}

.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .narration { color: var(--muted); font-size: 0.85em; margin-top: 2px; }
.grid .opening-row td, .grid .totals-row td { background: var(--shade); border-top: 2px solid var(--border); border-bottom: 2px solid var(--border); }

/* Day Book's Date column -- DD-MM-YYYY is a touch wider than the old
   YYYY-MM-DD, and a printed page is narrower than the screen needs to
   be, so without this the date wraps mid-string ("01-04-\n2007"),
   which reads badly next to a real printed report that never does
   that. */
.daybook-grid td:first-child, .daybook-grid th:first-child { white-space: nowrap; }
/* Tighter row spacing (2026-09-20, Sabari, final update on this
   report: "tighten the vertical spacing between lines") -- .grid th,
   .grid td's own 9px top/bottom padding (shared with every other
   report's own grid, left as-is there) is what actually sets the gap
   between rows; narrowed to 5px here, Day Book only, so more of the
   day's entries fit on screen without scrolling. Horizontal padding
   (8px) is untouched -- this is about the gap between lines, not
   column spacing. */
.daybook-grid td, .daybook-grid th { padding-top: 5px; padding-bottom: 5px; }
/* SUB TOTAL / BALANCE's own label, column 2 (Sabari, 2026-09-20:
   "in SUB TOTAL & BALANCE inside grid, make it right aligned with
   column 2") -- every entry row's own column 2 holds the actual
   Ledger/Description text, left-aligned same as any other reading
   text; these two summary rows carry no such text, just a label, so
   right-aligning just that cell reads as a total/balance figure's own
   caption butting up against the Credit/Debit columns beside it,
   rather than looking like it's floating at the wrong, un-anchored
   left edge those rows have no other content on. */
.daybook-daytotal-row td:nth-child(2), .daybook-daybalance-row td:nth-child(2) { text-align: right; }
/* SUB TOTAL/BALANCE rows' own shade -- history, all Sabari, all
   2026-09-20:
   1) "in sub total row ... can we change that background color only
      in column 2, 3 & 4", then "we can fill background only on
      column 3 & 4" -- narrowed .grid .totals-row td's own every-
      column shade (Date and the Balance column included) down to
      just Credit and Debit, columns 3 & 4.
   2) "the separator line after balance row stops at column 3, let it
      run through column5" -- BALANCE's own Credit/Debit cells used to
      be print-only (screen-hidden) with its figure folded into a
      separate always-screen-visible Balance column instead, same
      idea as entry rows' own running balance; print-only is
      display:none on screen, which removes a cell from the row's
      layout entirely rather than just hiding it, so this row only
      ever rendered 3 real <td>s on screen and both the figure's own
      position and the border-bottom stopping short traced back to
      that.
   3) "should dynamically sit under column 3/4" -- rather than work
      around that, daybook.html's own BALANCE row now folds into
      Credit/Debit the same way on screen as it already did for
      Print/Excel/PDF (own comment there has the full story) -- same
      ordinary columns 3 & 4 as SUB TOTAL, column 5 empty on both, no
      print-only/no-print split left on this row at all. So both rows
      take the exact same shading now.
   Same .grid .totals-row td specificity (two classes + element) as
   the shared rule above, so this reliably wins regardless of source
   order; border-top/bottom (each row's own top/bottom rule) are
   untouched, still spanning the full row -- only `background` is
   overridden here. */
.grid .daybook-daytotal-row td,
.grid .daybook-daybalance-row td { background: none; }
.grid .daybook-daytotal-row td:nth-child(3),
.grid .daybook-daytotal-row td:nth-child(4),
.grid .daybook-daybalance-row td:nth-child(3),
.grid .daybook-daybalance-row td:nth-child(4) { background: var(--shade); }
/* SUB TOTAL/BALANCE's own border thickness (2026-09-20, Sabari: "the
   line height becomes doubled" in this area) -- .grid .totals-row td
   above (shared with every other report's own subtotal/grand-total
   rows, left as-is there) sets a 2px border-top AND border-bottom on
   every totals-row, twice the ordinary 1px `.grid td` border-bottom
   used everywhere else in the table; with .grid's own border-collapse
   that reads as a visibly heavier line right where SUB TOTAL/BALANCE
   meet the plain entry rows above/below, next to the normal 1px lines
   "after every row" elsewhere. Narrowed back to the same 1px here, on
   just these two Day Book rows, matching everywhere else on this
   table -- same .grid .totals-row td specificity (two classes +
   element), so this reliably wins regardless of source order. Now
   that BALANCE has the same 5 ordinary cells as SUB TOTAL (see the
   shading rule above and daybook.html's own comment on its row), this
   line already runs the full row width on both, no extra rule
   needed. */
.grid .daybook-daytotal-row td,
.grid .daybook-daybalance-row td {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* The Show Year End P&L Posting checkbox's own second line under the
   From/To/Generate row above (2026-09-20, see daybook.html's own
   comment on why it sits outside .selector-form) -- same left inset
   as "From" above it for free (ordinary block flow), this is just its
   own vertical spacing before the table/placeholder message below. */
.daybook-pl-row { margin: 0 0 16px; }

/* Stock & Sales Statement's own two filter checkboxes -- living as a
   THIRD flex child of .panel-head.stock-sales-filter-panel, alongside
   #stock-sales-form (Company/Year/Month/Generate) and .toolbar-actions
   (Export XL/PDF/Print) (2026-10-01, through several follow-ups from
   Sabari: "keep the check boxes side by side" / "move both the
   checkboxes inside the report header box" / most recently "bring
   those checkboxes to 2nd row (below company name combo box) / let
   all the buttons bottom align in 1st row"). flex-basis: 100% is the
   part that actually does that last ask -- in a flex-wrap:wrap
   container (.stock-sales-filter-panel), a child with basis 100% can
   never share a line with anything else, so it's always pushed onto
   its own fresh row regardless of how much space row 1 (form +
   toolbar-actions, which comfortably fit together now that this isn't
   competing with them for room) has left -- robust against a theme/
   font-scale change later shifting exactly where row 1 itself would
   otherwise wrap. Ordinary flex-start (this container's own default)
   left-aligns it at the box's own left edge, same as Company -- the
   first field of row 1 -- lines up at, matching "below company name
   combo box" for free. margin-top separates it from row 1 above (the
   container itself has no row-gap of its own -- see .panel-head). The
   checkboxes themselves are a small inner flex row (14px gap, matching
   .selector-form's own between-field gap) so the two sit side by side
   rather than stacked. */
.stock-sales-filter-checkboxes { display: flex; align-items: center; gap: 14px; flex-basis: 100%; margin-top: 10px; }
/* Caption font-size matches the on-screen grid's own item name column
   (Sabari: "check box caption font size can match item name (inside
   the grid)") -- .stock-sales-grid's own 12.5px, copied here rather
   than shared via a variable since the grid rule lives in a
   completely different part of this stylesheet and a one-off shared
   custom property for a single reused number isn't worth the
   indirection. .checkbox's own base rule (shared with ledger.html/
   daybook.html's own checkboxes elsewhere) sets no font-size of its
   own, so this is a plain addition here, not fighting anything else
   for specificity. */
.stock-sales-filter-checkboxes .checkbox { font-size: 12.5px; }

.notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Import Data's preview/warning box (admin_app.py, 2026-09-17) -- a
   red variant of .notice above, for the one screen in this app where
   the amber "just FYI" tone of .notice would understate what's about
   to happen: importing replaces ALL of a client's existing firm/year
   data, and there's no backup to fall back on if that's a mistake. */
.notice-danger {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #7f1d1d;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: var(--shade); }
.selected-row { background: #eff6ff; }

/* Devices screen (device_list.py) -- the current browser's own device
   code, and the Add-button/already-registered state device_list.html's
   own script toggles between. Plain shade box, not .notice's amber --
   this is informational, not a warning. */
.device-current {
  background: var(--shade);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.device-current .device-uuid-value {
  font-size: 1rem;
  color: var(--ink);
  word-break: break-all;
  margin: 4px 0 10px;
}

/* Backup Data screen (backup_data.py, 2026-09-17) -- the dynamic zip
   password, shown once before download. Same plain-shade-box shape as
   .device-current above (informational, not a warning -- the actual
   caution line below it uses .notice), just its own class since the
   two screens have nothing else in common. */
.backup-password-box {
  background: var(--shade);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.backup-password-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
  margin: 4px 0 0;
}
.sub-head { font-size: 1rem; margin: 20px 0 10px; }
.grid.narrow { max-width: 420px; }

/* Toggle switch -- a real sliding on/off control (Sabari, 2026-09:
   "a slider"), not a plain checkbox, for any two-state field whose
   two sides both deserve an equally prominent label rather than one
   "this is ON" caption (Login Details' own Any Device/Approved Only
   is the first user of this). Built on a plain checkbox for real
   keyboard/form semantics -- .toggle-track/.toggle-thumb are just its
   visual skin, positioned as its own siblings (not children) so the
   `~` selector below can reach them from :checked. The checkbox
   itself is invisible but still occupies the switch's full box
   (opacity: 0, not display: none) so it stays clickable/focusable
   right where it visually is. */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.15s;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: left 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.toggle-switch input:checked ~ .toggle-track { background: var(--accent); }
.toggle-switch input:checked ~ .toggle-thumb { left: 20px; }
.toggle-field { display: flex; align-items: center; gap: 10px; }
.toggle-field-label { font-weight: 600; }

.fy-line { color: var(--muted); font-size: 0.9rem; margin: -6px 0 20px; }

/* Server Status (admin_app.py, 2026-09-17) -- one shared bar look for
   every "X of Y used" figure on that screen (Disk, RAM, Swap), not
   just Disk (started life as .disk-bar/2026-09-17's own Disk Usage
   screen, renamed/generalized once RAM/Swap needed the same look).
   var(--accent) so it still reads sensibly if the client-facing Theme
   variables ever get shared with the admin app -- harmless plain blue
   today, since admin_app.py has no Display/Theme picker of its own.
   .usage-bar-fill-warn/-danger let a caller flag "this one's getting
   full" without a second CSS rule per severity level -- RAM/Swap/Disk
   all share the same >=75%/>=90% thresholds (see server_status()'s own
   docstring in admin_app.py). */
.usage-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--shade-strong);
  overflow: hidden;
  margin: 4px 0 20px;
}
.usage-bar-fill { height: 100%; background: var(--accent); }
.usage-bar-fill.usage-bar-fill-warn { background: #d97706; }
.usage-bar-fill.usage-bar-fill-danger { background: #b91c1c; }
.status-section-head { font-size: 1rem; margin: 28px 0 4px; }
.status-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.status-row .mono { color: var(--muted); font-size: 0.85em; }
.service-list { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 20px; }
.diag-note { color: var(--muted); font-size: 0.82rem; font-style: italic; margin: 2px 0 0 0; }
/* Server Status: two columns on a wide screen (Services + Resources on the
   left, Biggest memory users + PDF maker + SSL on the right); one stacked
   column on a phone/tablet, in the same top-to-bottom order. */
.status-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; align-items: start; }
.status-col { min-width: 0; }
.status-col .diag-note { overflow-wrap: anywhere; }
@media (max-width: 900px) { .status-cols { grid-template-columns: minmax(0, 1fr); } }

/* Print/PDF-only report letterhead (Client name + city) -- see the
   .print-only rule below, and trial_balance.html for where this gets
   its text. Bold, one point larger than the grid header text (the
   size Sabari measured his request against), calc() mixing rem and pt
   directly so it always stays exactly --grid-header-size + 1pt even if
   that variable ever changes. */
.report-letterhead { font-weight: bold; font-size: calc(var(--grid-header-size) + 1pt); margin: 0 0 6px; color: var(--ink); }

/* Print/PDF-only report TITLE (2026-09-18) -- the on-screen heading
   moved out of .panel-head into the Dynamic Menu bar (.appnav-page-
   title above), which is itself hidden for print (see @media print
   below: .topbar, .appnav, .app-footer, .no-print). Without this, a
   printed/PDF report would carry no title at all, only the letterhead
   (Firm name/city) above it. Same font-size the old .panel-head h1
   printed at (calc(1.15rem - 2pt), see the @media print block) --
   this is its exact replacement for print/PDF, not a new size. */
.print-report-title { font-weight: 600; margin: 0 0 4px; color: var(--ink); }

/* Mirror image of .no-print (which has no rule out here because
   "visible on screen" is already the default) -- .print-only needs the
   opposite default, hidden on screen, and only .no-print's own
   @media print block flips it back on. */
.print-only { display: none; }

/* ============================================================
   Stock & Sales Statement -- 2026-10-01, Sabari: "i need the exactly
   same look & feel... should look like the photostat copy of the
   screen shot". Sabari supplied the sibling platform's own
   base_shell.html, which is where ITS .filter-panel/.summary-cards/
   .data-grid/.toolbar classes actually live (report_stock_sales.html
   itself only carries page-specific overrides) -- every pixel value
   below (padding/gap/border-radius/font-size) is copied straight from
   that file, not estimated from the screenshot. Every COLOR, though,
   maps to this app's own existing theme tokens rather than the
   reference's own hardcoded --card-bg/--page-bg/etc, since "theme is
   applied from display" was Sabari's own explicit scope from the
   first round -- only this report's structure/spacing/sizing changes,
   never its colors. Every rule here is scoped to a .stock-sales-*
   class so no other report's .grid/.selector-form/.panel-head/
   .toolbar-actions is touched -- those are shared across every other
   screen in this app and already correctly themed (.btn-toolbar in
   particular went through its own theming pass on 2026-09-17; its
   padding/border-radius/font-size already land within a point or two
   of the reference's own .toolbar .btn.primary, so it's reused as-is,
   not replaced).

   One deliberate omission: the reference's table.data-grid th is
   `position: sticky; top: 0`, keeping the header visible while
   scrolling a long grid. This app's own .topbar is ALSO `position:
   sticky` at the real page top (see that rule's own comment, further
   up this file) -- stacking a second sticky header under/over it
   without knowing that bar's exact live height risks the table header
   either hiding behind the topbar or overlapping it, and that's not
   something to guess at without a live render to check against. Left
   out rather than risk a visible glitch; worth adding later with an
   actual screenshot to verify the offset against.
   ============================================================ */

/* FilterPanel card (Company/Year/Month + the Export/Print toolbar,
   same row) -- base_shell.html's own .filter-panel: flex, wrap, 14px
   gap, bottom-aligned, in a bordered/rounded card. --card-bg maps to
   var(--shade) here (not var(--panel), which is this whole report's
   own OUTER background already -- using the same color for the nested
   card would make its border the only thing visible, no fill
   contrast; var(--shade) is this app's own existing "a visibly
   different, subtly offset surface" token, same role --card-bg plays
   against the reference's own --page-bg). Applied alongside the
   existing .panel-head.panel-head-bottom classes already on this
   element (flex/align-items:flex-end come from those, unchanged) --
   this just adds the card chrome + lets it wrap on a narrow screen. */
.stock-sales-filter-panel {
  /* FLAT (2026-10-10, Sabari): no tinted card around the filters -- background / border / padding gone, 8px gap under it;
     it saves ~30px of height on every stock / purchase / sales report (same flat look as the Parties Accounts reports). */
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* DataGrid card -- base_shell.html's own .data-grid-wrap (border +
   border-radius around the scrollable grid; the existing shared
   .de-grid-wrap class alongside this one already supplies overflow-x:
   auto, untouched). margin-bottom carries the reference's own 20px gap
   before the summary cards below (there, an inline style on that
   specific div; here, the grid card's own margin-bottom reaches the
   same result without inline styles). */
/* Bounded height + its own overflow: auto (2026-10-01, see the sticky-
   header rule just below for why) -- this box now scrolls itself,
   independent of the rest of the page, same proven shape as this
   app's own .dbview-scroll/.selectwin-scroll elsewhere in this file
   (both also a bordered box with a sticky thead inside). 65vh leaves
   healthy room for the filter panel above and the summary cards below
   to both still be on screen alongside at least a few rows of the
   grid -- closer, if anything, to Sabari's own "in VFP usually
   everything is visible in 1 screen" than an unbounded page-scrolling
   table ever was. */
/* margin-bottom 18px (was 20px, 2026-10-03, Sabari: "keep the spacing
   between grid & footer similar to header & grid") -- same 18px the
   header panel (.stock-sales-filter-panel) leaves above this grid, so
   the gap reads identically on both sides of it. */
/* Selector doubled up with .de-grid-wrap (the template carries both
   classes) on purpose: the shared .de-grid-wrap { margin-bottom: 4px }
   rule further down this file has the same specificity as a lone
   .stock-sales-grid-wrap and comes LATER, so it was silently winning --
   the real gap above the footer was 4px, not the 20px/18px written
   here. Two classes outrank it regardless of source order. */
/* FLAT (2026-10-10): bare grid -- no border / rounded card / bottom margin (was 1px border, 8px radius, 18px margin). */
.de-grid-wrap.stock-sales-grid-wrap { border: 0; border-radius: 0; margin-bottom: 0; max-height: 65vh; overflow: auto; }
.stock-sales-grid-wrap .stock-sales-grid th { white-space: nowrap; }

/* DataGrid itself -- base_shell.html's own table.data-grid: 12.5px
   body copy, 8px/10px header padding, 7px/10px body padding (all
   narrower than this app's shared .grid 9px/8px, hence the overrides
   below), striped rows (even rows get var(--shade), the same token
   the filter-panel/summary-cards above use for "a distinct surface"),
   a hover highlight (var(--shade-strong) -- already this app's own
   "one step stronger than --shade" token, so hover reads as a clear
   step up from the plain stripe rather than introducing a new tone),
   and white-space:nowrap on data cells so a long Item Name scrolls
   horizontally (via .stock-sales-grid-wrap's inherited overflow-x)
   rather than wrapping ragged. Centered/bottom-aligned 2-line headers
   (line-height 1.2, matching the print grid's own) were already
   matched last round and are kept as-is. */
.stock-sales-grid { font-size: 12.5px; }
/* Sabari, 2026-10-01: "make the first letter of the word in Caps &
   rest in small letters" -- the header TEXT in the template is already
   written that way per word ("Opening Stock", "Purch. Qty", ...); the
   all-caps look came entirely from this app's shared .grid th { text-
   transform: uppercase } rule (every other report's grid intentionally
   keeps that uppercase look, so this overrides it back to none scoped
   to just this report's own two grids, rather than changing the
   shared rule app-wide). */
/* Tighter vertical spacing (2026-10-03, Sabari: "now grid displays 10
   rows. can we tighten the vertical space a bit to fit 1 or 2 rows") --
   body cells 7px -> 5px top/bottom (row height ~29px -> ~25px) and the
   header 8px -> 6px; horizontal padding untouched, so column widths and
   the frozen S/N + Item Name offset (measured from rendered widths) are
   unaffected. */
.stock-sales-grid th { vertical-align: bottom; line-height: 1.2; text-align: center; padding: max(1px, calc(6px + var(--lay-gy, 0px))) 10px; text-transform: none; }
.stock-sales-grid td { padding: max(1px, calc(5px + var(--lay-gy, 0px))) 10px; white-space: nowrap; }
.stock-sales-grid tbody tr:nth-child(even) td { background: var(--shade); }
.stock-sales-grid tbody tr:hover td { background: var(--shade-strong); }

/* Sticky grid header (2026-10-01, Sabari: "in vfp app the report is
   shown in grid, there the header stays static ... here once we scroll
   below certain level we do not know which column the data belongs
   too") -- every <th> here pins itself to the TOP OF ITS OWN BOX
   (.stock-sales-grid-wrap, above -- NOT the page/viewport) once that
   box's own content scrolls it up to top:0, rather than scrolling away
   with the rows underneath it.

   Why `top: 0` against the WRAPPER rather than something accounting
   for .shell-top (this app's own persistent Header+Menu band) the way
   an earlier version of this comment described: this table also needs
   to scroll HORIZONTALLY (long rows, many columns -- unchanged from
   before this round), which means .stock-sales-grid-wrap already has
   overflow-x: auto on it (.de-grid-wrap, shared base). Per the CSS
   spec, an ancestor with overflow-x set to anything but visible has
   its overflow-y forcibly computed as auto too, even though only the X
   axis was ever written down -- so .stock-sales-grid-wrap was ALREADY
   a vertical scroll container all along, sticky or not, just one with
   no height limit, so nothing ever actually needed to scroll inside
   it. That matters because position: sticky always sticks relative to
   the NEAREST such scroll-container ancestor, never straight to the
   page -- so a `top` measured off .shell-top's own height (the first
   version of this round) was being applied against the WRONG
   reference frame the whole time, and rendered the header stuck
   partway down into row 1/2 immediately, even unscrolled (caught
   during this round's own visual verification, before shipping).

   Rather than fight that, this box now OWNS its own bounded height +
   explicit overflow: auto (.stock-sales-grid-wrap, above) -- the exact
   same shape this app's own .dbview-scroll/.selectwin-scroll elsewhere
   in this file already use for a sticky-thead-inside-a-scrolling-box,
   proven working. `top: 0` against that box is now simply correct, no
   JS measurement needed for this part at all (Item Name's own `left`
   below still needs one, for an unrelated reason).

   z-index: 2, comfortably above plain scrolling body cells (default/
   auto stacking) so rows don't visually paint over the header as they
   scroll underneath it, same idea (smaller numbers, since this is now
   a purely local stacking context -- nothing here needs to out-rank
   .shell-top's own z-index:40 any more). background can't be left
   transparent on a sticky element -- scrolled-under rows would show
   through -- var(--shade-strong) matches this app's own existing
   convention for a sticky grid header elsewhere (.dbview-scroll
   .dbview-grid thead th / .selectwin-scroll .grid thead th, both
   style.css, same token). */
.stock-sales-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--shade-strong);
}

/* Frozen S/N + Item Name columns while scrolling horizontally
   (2026-10-01, Sabari: "just like freeze pan in excel can we keep the
   first 3 columns visible if horizontally scrolled too" -- settled to
   2 columns, S/N + Item Name, in a later follow-up: "freeze S/N + Item
   Name instead" of S/N alone, since a bare row number on its own
   doesn't say which ITEM a row is once you've scrolled right past Item
   Name; Packing stays unfrozen for now, revisited only if client
   feedback actually asks for it). S/N sticks at left: 0 (it's always
   the very first column, nothing needs measuring); Item Name's own
   `left` has to equal S/N's actual rendered width, which depends on
   digit count/font-size/padding -- not safe to hardcode -- so it's
   measured in JS (syncStockSalesStickyOffsets(), this template's own
   <script> block) rather than guessed, same reasoning db_structure.
   html's own stickDbviewFilterRow() already measures its own caption
   row's height for instead of guessing it. Deliberately NOT applied to
   the tfoot TOTAL row
   below (Sabari: "need not freeze grid's own bottom row (total)") --
   that row has no .stock-sales-freeze-sn/-name cells at all, so it
   just scrolls normally, both directions, same as before this round. */
.stock-sales-grid th.stock-sales-freeze-sn,
.stock-sales-grid td.stock-sales-freeze-sn,
.stock-sales-grid th.stock-sales-freeze-name,
.stock-sales-grid td.stock-sales-freeze-name {
  position: sticky;
  left: 0;
}
/* Body cells: a lower z-index than the sticky header (2, above) is
   enough to paint above ordinary scrolling body cells (default/auto
   stacking) as THEY scroll underneath a frozen column, without ever
   outranking the header itself when a row scrolls up past it. Explicit
   background (not transparent) for the same show-through reason as the
   header -- var(--panel), this report's own plain background, is the
   right baseline here (NOT var(--shade-strong) -- these are ordinary
   body rows, not the header) -- .stock-sales-grid's own existing even-
   row/hover rules just above still win over this baseline (more
   specific: tbody tr:nth-child(even)/tr:hover, three chained elements
   vs. this rule's one), so a frozen cell in a striped or hovered row
   still matches the rest of that same row rather than looking like a
   flat, unstriped column cutting through the grid. */
.stock-sales-grid tbody td.stock-sales-freeze-sn,
.stock-sales-grid tbody td.stock-sales-freeze-name {
  z-index: 1;
  background: var(--panel);
}
/* The top-left corner cells (S/N/Item Name's own <th>) are sticky on
   BOTH axes at once -- top (from the plain thead th rule above) AND
   left (from the shared freeze rule above) -- so they need the highest
   z-index of the three layers here, otherwise the plain (non-frozen)
   header cells to their right would paint over them while scrolling
   horizontally (same z-index + later DOM order would otherwise win).
   Selector specificity (two classes vs the plain thead rule's one) is
   what makes this win over the z-index:2 set above for every other
   header cell, without needing !important. */
.stock-sales-grid thead th.stock-sales-freeze-sn,
.stock-sales-grid thead th.stock-sales-freeze-name {
  z-index: 3;
}

/* Jump-to-summary arrow, right after Generate (2026-10-01, Sabari:
   "can we place a some kind of symbol right (like down arrow) after
   Generate button & clicking on that scrolls past the gird & shows
   summary cards" / "small arrow can appear similar to the one we use
   in tree") -- same plain, chromeless, muted look as this app's own
   existing tree-expand toggle (.acc-toggle, above in this file), not
   another .btn-toolbar -- this is a one-shot scroll shortcut, not a
   report action, so it shouldn't visually compete with Generate/Export
   XL/PDF/Print for attention. Slightly larger than .acc-toggle's own
   16px/0.7rem (this is a standalone click target in open space, not a
   glyph squeezed into a dense tree row) and middle-aligned with
   Generate via .selector-form's own align-items: flex-end + this
   button's own padding, rather than copying .acc-toggle's fixed 16px
   width. */
.stock-sales-jump-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 9px 6px;
  flex: none;
}
.stock-sales-jump-btn:hover { color: var(--ink); }

/* Totals summary cards (2026-10-01, Sabari: "exactly same as the
   .html i have provided") -- base_shell.html's own .summary-cards/
   .summary-card: a true CSS grid (auto-fit, 150px minimum column) so
   cards reflow responsively rather than just wrapping a flex row, 12px
   gap, 20px bottom margin. Card chrome/colors follow the same
   var(--shade) card convention as the filter-panel above (again, not
   var(--panel) -- this report's own outer background -- for the same
   contrast reason). no-print (see the template) -- the Print/PDF
   layout has its own label:value footer covering the same totals. */
/* SUPERSEDED 2026-10-03 (Sabari: "let it appear like a box appear like
   header & instead of card like appearance of values, let us make it as
   a textbox") -- the .summary-cards grid + .summary-card tiles that used
   to be here are gone; the footer is now one header-style box
   (.stock-sales-summary-panel) of caption-over-textbox fields, below.
   Same chrome as .stock-sales-filter-panel above (shaded surface, 1px
   border, 8px radius, 14px/16px padding), and the same field look as the
   header's own Company/Year/Month (.selector-form label/select: 0.78rem
   muted caption, 6px/8px padding, 1px border, 6px radius, 0.88rem text,
   --input-bg/--input-fg). Two rows (5 fields, then 4), each a 5-column
   grid with the header's own 14px gap -- same column tracks in both
   rows, so the 4 second-row textboxes line up exactly under the first 4
   of row one instead of stretching wider. Falls back to auto-fill 130px+
   columns on a narrow window/Mobile view. Figures are right-aligned,
   tabular-nums, like every other amount column in this report. */
.stock-sales-summary-panel {
  background: var(--shade);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  /* 0 (was 20px, 2026-10-03, Sabari: "keep the overall padding
     consistent") -- the header box has nothing but the report panel's own
     15px padding around it, so the footer gets exactly the same: no extra
     margin stacked under it. */
  margin-bottom: 0;
  margin-top: 8px; /* the grid above is a bare, margin-less box since the flat layout (2026-10-10) */
}
.stock-sales-summary-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.stock-sales-summary-row + .stock-sales-summary-row { margin-top: 14px; }
.stock-sales-summary-field { min-width: 0; }
/* Narrow window / Mobile view: drop the fixed 5 columns for as many
   130px+ columns as fit, so nothing gets squeezed unreadably thin. */
@media (max-width: 900px) {
  .stock-sales-summary-row { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
html[data-view="mobile"] .stock-sales-summary-row { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.stock-sales-summary-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
.stock-sales-summary-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--input-fg);
  background: var(--input-bg);
}

/* Stock & Sales Statement's own dedicated Print/PDF layout (2026-10-01,
   Sabari: "Build a dedicated reduced print layout", matching the
   sibling platform's own print-only grid+footer). A full-bordered
   every-cell-boxed grid -- deliberately NOT .grid's own border-bottom-
   only convention -- matching the reference's own printed-statement
   look (var(--border) again, not a hardcoded color, so it still
   follows Display). Centered, bottom-aligned 2-line headers same idea
   as .stock-sales-grid th above; a touch smaller font than the on-
   screen grid since this is the printed page, same "print is denser
   than screen" convention .grid.dash-tb-grid already uses elsewhere
   in this app. */
.stock-sales-print-grid { font-size: calc(0.92rem - 2pt); margin-top: 10px; }
.stock-sales-print-grid th, .stock-sales-print-grid td { border: 1px solid var(--border); padding: 3px 6px; text-align: right; }
.stock-sales-print-grid th { text-align: center; vertical-align: bottom; line-height: 1.2; text-transform: none; }
.stock-sales-print-grid td:first-child { text-align: center; }
.stock-sales-print-grid td:nth-child(2), .stock-sales-print-grid td:nth-child(3) { text-align: left; }
.stock-sales-print-footer {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
  font-size: 0.82rem;
  max-width: 420px;
}
.stock-sales-print-footer .f-row { display: flex; justify-content: space-between; gap: 12px; }
.stock-sales-print-footer-wide { grid-column: 1 / -1; margin-top: 6px; }

/* Shared by the persistent shell nav (.appnav-link.menu-disabled) and
   the Menu Builder's own "(no screen linked yet)" hint -- the old
   boxed-grid landing-page menu that first introduced this class is
   gone (the menu lives in the shell now, see base.html), but the
   class name stayed since both remaining users already relied on it. */
.menu-disabled { color: #b8c0cc; font-size: 0.95rem; }
.menu-disabled em { font-style: normal; font-size: 0.8em; }

/* The WHOLE tree -- every level, not just one sibling group -- is ONE
   6-column grid: label, then one column EACH for Move/+Add Child/
   +Separator/Edit/Delete, so every one of those aligns individually top
   to bottom (Sabari) instead of just "actions as a block" -- a row
   missing +Add Child/+Separator (a Separator itself, or a leaf at max
   depth) still renders an EMPTY cell in those two columns (see
   menu_builder.html) purely to hold its place in the column order, so
   Edit/Delete don't slide left into the gap. Column 1 is sized to the
   single widest label anywhere in the tree, and columns 2-6 line up on
   every row regardless of depth. <li>, .catalog-row AND a nested
   <ul class="catalog-tree"> (a heading's own children) are ALL
   collapsed with display: contents, so a heading's children flow as
   flat items straight into this SAME grid instead of starting a
   narrower/wider grid of their own one level down. Indentation moves
   from the old nested-ul's own padding-left onto each row's own label
   span instead (menu_builder.html's inline `padding-left`, scaled by
   node.depth) -- a display:contents element can't render padding/
   border/background of its own. Folding a heading still works exactly
   as before: its .catalog-children ul is what gets `hidden` (see the
   [hidden] override further below), which removes that whole flattened
   subtree from the grid in one shot, display: contents or not. */
.catalog-tree {
  display: grid;
  grid-template-columns: max-content max-content max-content max-content max-content max-content;
  align-items: center;
  column-gap: 10px;
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.catalog-tree > li,
.catalog-row,
.catalog-tree > li > .catalog-tree {
  display: contents;
}
.catalog-row > span:first-child,
.catalog-row > .catalog-mover,
.catalog-row > .catalog-add-child,
.catalog-row > .catalog-add-sep,
.catalog-row > .catalog-clients,
.catalog-row > .catalog-build,
.catalog-row > .catalog-edit,
.catalog-row > .catalog-delete {
  padding: 2px 0;
}
.catalog-row .mono { color: var(--muted); font-size: 0.85em; }
/* Grid items stretch to fill their column by default -- harmless for
   plain left-aligned content, but each action cell still gets an
   explicit justify-self so an EMPTY placeholder cell (see above) never
   accidentally centers/stretches its (nonexistent) content in a way
   that shifts the next column. Shared by both .catalog-tree (Menu
   Builder) and .tmpl-tree (Menu Templates list) below -- same idea,
   just a different column count per page. */
.catalog-mover, .catalog-add-child, .catalog-add-sep, .catalog-clients, .catalog-build, .catalog-edit, .catalog-delete {
  text-align: left;
  justify-self: start;
  white-space: nowrap;
}

/* Fold/expand -- same look as accheads.html's own .acc-toggle, kept as
   a separate class rather than reused directly since that one leans on
   its own .acc-group-row flex `gap` for spacing, which .catalog-row's
   grid-cell label span doesn't have; the margin-right here does the
   same job. .catalog-toggle-spacer is the same width on a LEAF row (no
   children, so no toggle button) purely so every row's label text
   still starts at the same x position regardless. Folding a heading
   just hides its own .catalog-children ul -- toggleNode()/setAllNodes()
   below are menu_builder.html's own copy of accheads.html's
   toggleGroup()/setAllGroups(). The [hidden] rule needs 3 class-level
   selectors (not just 2) to reliably outrank `.catalog-tree > li >
   .catalog-tree { display: contents }` above (2 classes + the `li`
   type selector = the same specificity tier `.catalog-children[hidden]`
   alone sits at, and ties go to whichever rule is LAST -- not worth
   relying on source order for this). */
.catalog-toggle {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.7rem;
  width: 16px;
  margin-right: 6px;
}
.catalog-toggle-spacer { display: inline-block; width: 16px; margin-right: 6px; }
.catalog-tree .catalog-children[hidden] { display: none; }

/* Separator row in the Menu Builder -- a thin rule taking up column 1
   (so it stretches to the tree's own single max label width, same as
   every other row's label), same action columns as every other row so
   Move/Edit/Delete still line up. More room AFTER the rule than before
   it, so the next item down doesn't crowd it -- top padding matches
   every other (now-tightened) row exactly, only the bottom is bigger. */
.catalog-separator-row > span:first-child,
.catalog-separator-row > .catalog-mover,
.catalog-separator-row > .catalog-add-child,
.catalog-separator-row > .catalog-add-sep,
.catalog-separator-row > .catalog-clients,
.catalog-separator-row > .catalog-edit,
.catalog-separator-row > .catalog-delete {
  padding: 2px 0 7px;
}
.catalog-separator-line {
  width: 100%;
  border-top: 1px solid var(--border);
  position: relative;
  height: 0;
}
.catalog-separator-label {
  position: relative;
  top: -9px;
  background: var(--panel);
  padding-right: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Menu Templates screen -- outer layer of its two-layer tree, one
   <details> per Client Type, holding a .tmpl-tree of that type's
   templates as the inner layer. Plain top-to-bottom stack, not the
   floating .appnav-dropdown panel -- this is page content, not a
   topbar menu. */
.type-group {
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}
.type-group:last-of-type { border-bottom: none; }
/* `<summary>`'s native disclosure triangle is its default `display:
   list-item` marker -- overriding display to flex (needed for the
   count badge to dock on the right via space-between) drops that
   marker with nothing standing in for it, which is why this looked
   like it had no expand/collapse affordance at all. list-style/
   ::-webkit-details-marker below explicitly suppress whatever the
   browser would still try to draw, and the ::before glyph on the
   FIRST child (not on .type-group-summary itself) replaces it without
   adding a 3rd flex item that would throw off the space-between
   above -- same &#9660;/&#9654; glyphs menu_builder.html's own
   toggleNode() uses, so both screens read as the same control. */
.type-group-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  padding: 2px 0;
  list-style: none;
}
.type-group-summary::-webkit-details-marker { display: none; }
.type-group-summary > span:first-child::before {
  content: "\25B6";
  display: inline-block;
  width: 14px;
  color: var(--muted);
  font-size: 0.7em;
}
.type-group[open] > .type-group-summary > span:first-child::before {
  content: "\25BC";
}
.type-group-count {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}
.type-group .tmpl-tree, .type-group .client-grid { margin-top: 8px; }
.empty-type { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }

/* Clients list's own "+ Add Client" -- moved off the page's panel-head
   (Sabari, 2026-09-28: "move it under the tree ... so that the new
   client is added to the Client_Type it belongs to") to one copy per
   Client Type group instead, sitting left-aligned right above that
   group's own table (or its "No clients yet" line when empty) so the
   button and the table it fills always read as belonging to each
   other. Plain block, not flex -- a single left-aligned .btn is already
   exactly what's wanted with no extra alignment rules needed. */
.type-group-add { margin: 8px 0; }

/* Menu Templates list -- same per-action-column alignment idea as the
   Menu Builder tree above (label, then one column per action, so
   Build Menu/Edit/Delete each line up top to bottom), just its own
   grid rather than reusing .catalog-tree: this list is flat (no
   nesting to flatten) and only has 3 actions, not 5, and each Client
   Type's own <ul> here is deliberately its OWN grid -- one type's
   longer template names shouldn't push another type's columns over. */
.tmpl-tree {
  display: grid;
  grid-template-columns: max-content max-content max-content max-content;
  align-items: center;
  column-gap: 10px;
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.tmpl-tree > li { display: contents; }

/* Clients list -- same collapsible-by-Client-Type grouping as the Menu
   Templates list above (one <details class="type-group"> per type, same
   disclosure marker), but each group's clients render as a real
   <table class="grid client-grid"> (clients.html's own client_table()
   macro) rather than the old CSS-grid-of-<li>s every other catalog list
   in this file uses -- Sabari, 2026-09-28, after the tree was expanded:
   "make it as a table (vertical, horizontal & outlines) with heading".
   Same full-ruled-border idiom already established for Linked Screens'
   .mct-grid and User Access Rights' .rights-grid (both plain .grid
   otherwise only draws a bottom rule per row) -- every cell gets all
   four sides, which combined with .grid's own border-collapse also
   reads as one clean outline around the whole table, and a real <table>
   means Name/Address/City/Menu Template/Status/Admin Login/Valid Until
   each get their own <th> heading for free instead of none at all.
   Code isn't its own column: the type group heading already identifies
   the client's type, and Sabari wants the internal code folded into the
   Name cell instead, in parens (see client_row() in clients.html). Edit/
   Delete share one trailing column with a blank heading, same
   .row-actions idiom users.html's own table already uses. */
.client-grid th, .client-grid td { border: 1px solid var(--border); }
.client-grid thead th { background: var(--shade); }

/* Valid Until column -- Sabari, 2026-09-21. .tag-expired (red, matches
   the existing .tag-off's danger weight but its own distinct color so
   "Disabled" and "Expired" never look identical at a glance) and
   .tag-expiring (amber -- a softer, "notice this soon" weight,
   deliberately lighter than the red Expired tag). */
.tag-expired {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: 600;
  background: #fde2e2;
  color: #a11d1d;
}
.tag-expiring {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 3px;
  font-size: 0.8em;
  font-weight: 600;
  background: #fff1cc;
  color: #8a6300;
}

/* Trial Balance/Profit & Loss A/c/Balance Sheet -- group/subgroup heading rows (recursive: a
   ledger_groups node at any depth), each head's own row indented one
   step further via an inline padding-left (depth isn't bounded, so no
   fixed set of CSS classes). Primary (top-level) group rows get a
   shaded background, same visual weight the real printed report gives
   them; a subgroup heading is bold but not shaded. */
/* Tighter vertical rhythm than the site's default .grid (9px top/bottom)
   -- this grid tends to run to a lot of rows (every ledger head, every
   FY), so a denser line-to-line spacing reads better here. */
.tb-grid th, .tb-grid td, .wide-grid th, .wide-grid td { padding-top: max(1px, calc(5px + var(--lay-gy, 0px))); padding-bottom: max(1px, calc(5px + var(--lay-gy, 0px))); }
.tb-group-row td { border-bottom: none; padding-top: 7px; }
.tb-primary-row td { background: var(--shade-strong); padding-top: 6px; padding-bottom: 6px; }
.tb-head-name { white-space: normal; }
/* .tb-row-flex -- every "Ledger Description"/Assets/Liabilities cell
   that can carry a "➤" jump-to-Ledger link (financial_statement.html/
   financial_statement_wide.html's own ledger_link() macros) is a flex
   row: the name (+ bracket, for a group) as one child, the link as
   the other, `justify-content: space-between` pushing the link flush
   against the CELL's own right edge. Since every row in a table
   column shares that column's own width (standard HTML table layout,
   not table-layout:fixed here), this makes every "➤" in the column
   line up vertically no matter how long or short that row's own name
   is -- Sabari, 2026-09-22: "can we keep all arrows right aligned in
   column 1", after the original right-after-the-name placement made
   every arrow sit at a different horizontal spot depending on name
   length. `gap` is just a minimum cushion for a name long enough to
   nearly fill the column -- most rows get far more breathing room
   than that from the column's own natural width. A row with no link
   (no r.id/r.head_ids, or the empty-content padding rows) simply
   never renders the second flex child -- space-between with one
   child just left-aligns it, so nothing else needed there. */
.tb-row-flex {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
/* "➤" itself -- Deliberately NOT link-blue/underlined by default --
   these grids read as a plain printed report, and a normal hyperlink
   look would fight that; muted like the rest of the grid's own
   secondary text (.mono above) until hovered, when it picks up the
   theme's own accent color so it stays in step with every theme
   (Display > Theme) rather than a hardcoded color.

   Glyph history: plain "+" (meant "add a new one" elsewhere in the
   app, e.g. Menu Builder's "+ Add Child" -- Sabari flagged the
   collision) -> ↗ (signalled the link's own target="_blank" behavior,
   but read as visually busier than wanted) -> ➤ (current -- Sabari,
   comparing several candidates side by side: "Solid Arrowhead ...
   feels good"; noted as possibly switching to ➜ later if this one
   doesn't hold up). Originally pushed a fixed 5ch from the name
   (Sabari: "keep it at 5 spaces away") via margin-left -- superseded
   by .tb-row-flex's own column-edge alignment above, so margin-left
   is gone; flex-shrink: 0 keeps the glyph itself from ever being
   squeezed by a long name sharing its row. */
.row-ledger-link {
  display: inline-block;
  flex-shrink: 0;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.row-ledger-link:hover:not(.is-disabled), .row-ledger-link:focus-visible:not(.is-disabled) {
  color: var(--accent);
  text-decoration: underline;
}
/* .is-disabled -- ledger.html's own greyed-out ◀/▶ (Sabari, 2026-09-22,
   third round: "instead of hiding the arrow if no data present, you
   can show both arrows & grey out the absent one" -- supersedes the
   original "hide the arrow entirely" call on the same question from
   earlier the same day). A plain <span>, not a disabled <a> -- an
   anchor with no href isn't really a link at all (not focusable, no
   real "disabled" state of its own the way a <button disabled> or
   .link:disabled further up has), so there's nothing more correct
   about keeping the <a> tag here than switching to a <span> once
   there's genuinely nowhere for it to go. Same var(--border) muted-
   grey .link:disabled already uses elsewhere in this file, for the
   same "this control exists but there's nothing behind it right now"
   meaning. */
.row-ledger-link.is-disabled {
  color: var(--border);
  cursor: default;
}
/* .date-jump-link -- ledger.html's own "➤" next to a row's Date,
   jumping to Daybook Entry for that date (Sabari, 2026-09-22). Not
   inside a .tb-row-flex column-edge layout like the financial-
   statement reports' own links -- the Date column here is a narrow,
   fixed-width, fixed-format (DD-MM-YYYY) column, so a plain fixed gap
   already reads cleanly with nothing ragged to line up. Sabari asked
   for "just 2 spaces away" (vs. the flat-grid reports' own "5 spaces"
   next to a variable-length name) -- 2ch rather than a guessed pixel
   value, same reasoning as that 5ch. */
.date-jump-link { margin-left: 2ch; }
/* .head-jump-link -- ledger.html's own "➤" at the end of each block's
   own heading row, jumping to Ledger Edit for that head (Sabari,
   2026-09-22: "add a similar arrow at the end of ledger name, that
   takes us straight to led_edit.py"). Same reasoning as .date-jump-
   link just above: this sits on a heading row, not inside a real
   table column with other rows' own links to line up against, so a
   plain fixed gap reads clean regardless of name length -- kept at
   the same 2ch already established on this same screen rather than
   inventing a third spacing value. */
.head-jump-link { margin-left: 2ch; }
.tb-grid th .mono, .wide-grid th .mono { display: block; font-size: 0.7rem; font-weight: 400; text-transform: none; color: var(--muted); }
/* Vertical rules between columns -- horizontal row borders (.grid's
   own border-bottom, plus totals-row/tb-primary-row's shading) are
   untouched; this only adds a right-hand divider to every cell except
   the last in its row. Every row in this table (group/subgroup heading
   rows included -- see trial_balance.html, which gives each one its
   own 5 real <td>s rather than a single colspan cell) has exactly 5
   cells, so the four divider lines run straight down the whole table
   without breaking across a group's heading bar. The one exception is
   the single "no ledger heads" empty-state row, which does span the
   full width -- nothing to divide there either way.
   .wide-grid (ACC_REP2 -- Profit & Loss A/c (Wide)/Balance Sheet
   (Wide)) shares this same divider rule so its 4 columns (Assets
   Description/Amount, Liabilities Description/Amount) get the same
   vertical rules -- deliberately its OWN class rather than reusing
   .tb-grid, since ACC_REP1's print rule below hides .tb-grid's 4th/5th
   columns and .wide-grid's 4th column (Liabilities Amount) is very
   much not a screen-only Group-Total column. */
.tb-grid th:not(:last-child), .tb-grid td:not(:last-child),
.wide-grid th:not(:last-child), .wide-grid td:not(:last-child) { border-right: 1px solid var(--border); }

/* Report toolbar (Export XL / PDF Portrait / PDF Landscape / Print) --
   used to be a fixed warm-orange pill button (pharma_platform's own
   report-screen look) regardless of the active Display theme, which
   read as "stuck" next to .btn-primary's Generate button, which
   already follows var(--accent) (Sabari, 2026-09-17: "Generate button
   sticks to theme perfectly, but toolbar button stays away from
   theme, need to fix that in all screens"). Now themed the same way
   -- solid var(--accent) fill, same as .btn-primary -- so both read
   as one family on every theme. filter: brightness() for :hover
   (rather than a second hardcoded color) since there's no
   theme-supplied "accent, one shade darker" variable in the palette
   blocks above; darkens correctly against every light AND dark
   theme's own --accent without needing one. This is one shared CSS
   class used by every report screen's toolbar (daybook, checkup,
   ledger, ledger list, interest statement, financial statement/wide,
   trial balance...) -- fixing it here fixes all of them at once, no
   per-template changes needed. */
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-toolbar {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn-toolbar:hover { filter: brightness(90%); }

/* Printing / "Save as PDF" -- hide everything except the report
   itself. printReport() in trial_balance.html sets @page size just
   before calling window.print(); this just strips the chrome around
   the actual table. Also applies to the PDF Portrait/PDF Landscape
   toolbar buttons -- pdf_export.py's Playwright call explicitly
   emulates print media, so it renders under this same block, not a
   second copy of it. */
@media print {
  .topbar, .appnav, .app-footer, .no-print { display: none !important; }
  .content { padding: 0; }
  body { background: #fff; }

  /* Display > Text Size (2026-09-23) is an on-screen accessibility
     preference, same reasoning as the theme-variable reset just below:
     a printed/exported report should come out at its normal, designed
     size on paper regardless of whether the person reading it on a
     Full HD monitor had bumped the shell up to 125% -- html's own
     inline font-size (base.html) is what that preference actually sets,
     so overriding it back to 100% here, !important (inline styles
     otherwise always win over a stylesheet), is what keeps print/PDF
     export unaffected. pdf_export.py's Playwright call explicitly
     emulates print media, so this same rule already covers Export PDF
     too, not just Ctrl+P. */
  html { font-size: 100% !important; }

  /* Every theme's --panel is now a visibly tinted colour on screen
     (2026-09-18, part of the 4-shades-per-layer theme work), not the
     near-white it always used to be -- fine on a monitor, but a
     printed/exported financial statement should stay plain black on
     white paper regardless of which theme happens to be active, same
     as it always has. Resetting every themed variable back to the
     plain default here, for BOTH :root (no theme) and any
     :root[data-theme="..."], is simpler and more robust than adding a
     print override to each individual rule that reads them -- every
     rule in this file already reads var(--panel)/var(--ink)/etc, so
     resetting the variables themselves cascades correctly everywhere
     at once. (This also happens to fix a pre-existing quirk: printing
     while a DARK theme was active used to print light ink on a dark
     --panel with no matching override, since only body's own
     background was ever forced white for print.)

     Must be `:root[data-theme]`, NOT `html[data-theme]` -- a plain
     element+attribute selector is LOWER specificity than the
     `:root[data-theme="dark"]` (etc) blocks in static/theme_vars.css
     (:root's own pseudo-class weight adds to the attribute's), so
     `html[...]` silently lost every specificity tie-break to them
     regardless of source order and never actually overrode anything.
     Matching `:root[data-theme]`'s own specificity exactly is what
     lets source order decide the winner -- and that's now which FILE
     loads last, not just which rule sits last within one file, since
     theme_vars.css moved these into its own generated file
     (2026-09-19): base.html/admin_templates/base.html both link
     theme_vars.css BEFORE this file for exactly this reason -- see
     this file's own top comment. */
  :root, :root[data-theme] {
    --accent: #2563eb; --bg: #ffffff; --panel: #ffffff; --ink: #1f2937;
    --muted: #6b7280; --border: #d7dee6;
    --header-bg: #ffffff; --menu-bg: #ffffff; --footer-bg: #ffffff;
    --input-bg: #ffffff; --input-fg: #1f2937;
    --shade: #f8fafc; --shade-strong: #f1f5f9;
  }

  /* .print-only's counterpart -- see the rule itself for why it
     defaults to hidden. The report letterhead (Client name + city) and
     the print-only report title (.print-report-title, since the
     on-screen heading moved into .appnav, itself hidden above) both
     use it now. */
  .print-only { display: block; }

  /* Report heading ("Trial Balance") two points smaller once printed
     than its normal on-screen size (1.15rem) -- Sabari's own follow-up
     once the new letterhead line above it made the on-screen size look
     too heavy on paper. calc() keeps this relative to the same 1.15rem
     the on-screen heading always used, rather than a second,
     easy-to-drift-out-of-sync magic number. .panel-head h1 no longer
     exists on any screen that prints (2026-09-18) -- kept here anyway
     since a couple of Add/Edit sub-forms still have one, harmless
     dead weight if one is ever printed. */
  .panel-head h1, .print-report-title { font-size: calc(1.15rem - 2pt); }

  /* This second line -- "for the Period ... to ..." -- should match
     the grid header text's size once printed (it's 0.9rem normally,
     sized for on-screen prominence next to the smaller grid). */
  .fy-line { font-size: var(--grid-header-size); }

  /* .panel's own border/background/padding is one box wrapping the
     WHOLE report (title through the table's last row) -- a browser's
     default print pagination only draws that kind of box's border on
     its very first fragment's top edge and its very last fragment's
     bottom edge, leaving every page in between (and the first page's
     bottom, and the last page's top) with no border at all. Sabari
     flagged exactly that pattern on a real multi-page PDF.
     box-decoration-break: clone (Firefox/older WebKit still want the
     -webkit- prefix; Chromium, which is what pdf_export.py actually
     prints with, understands the unprefixed property) makes each
     printed page treat the box as its own complete copy instead --
     full border, background and padding on every single page. */
  .panel {
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }

  /* A <tfoot> carries the browser's built-in table-footer-group
     behaviour, which -- like a <thead> -- repeats it at the bottom of
     EVERY printed page, not just once at the table's real end (this is
     what put the Trial Balance's Total row on every page). Plain
     table-row-group semantics makes it behave like an ordinary row
     again: printed once, wherever the table itself actually ends.
     Affects every report's totals row the same way (Trial Balance,
     Day Book, the P&L/Balance Sheet statement tables), not just this
     one screen. */
  tfoot { display: table-row-group; }

  /* Trial Balance's 4th/5th columns (Credit/Debit <<Group-Total>>) are
     explicitly screen-only -- Sabari's own words when he first asked
     for them ("not linked to items in toolbar"), same reason Export XL
     never carried them. PDF Portrait/PDF Landscape print the live page
     itself (pdf_export.py), so without this they'd leak straight into
     the PDF the same way they would into a plain browser Print --
     hiding them here (rather than a second no-group-total template)
     covers Print and both PDF buttons at once, in the one place that
     already draws the line between "on screen" and "on paper". The
     vertical divider after column 3 (.tb-grid td:not(:last-child))
     keeps working unchanged: it's still not the DOM's last child, just
     a hidden one, so its right border still closes off the visible
     table instead of vanishing. */
  .tb-grid:not(.tb-sbs-grid) th:nth-child(4), .tb-grid:not(.tb-sbs-grid) th:nth-child(5),
  .tb-grid:not(.tb-sbs-grid) td:nth-child(4), .tb-grid:not(.tb-sbs-grid) td:nth-child(5) { display: none; }
  /* ...except Side by Side (side_by_side.py), whose 4th/5th columns are the previous year's Debit/Credit and print. */
}

/* Ledger Opening Setup (op_head.py) -- the same .tb-grid shell every
   printed financial statement already uses (financial_statement.html),
   just with two of its cells turned into editable Credit/Debit boxes
   instead of plain formatted numbers. Narrow and right-aligned so a
   long column of them still reads as a number column, not a stack of
   separate form fields. */
.op-input {
  width: 100%;
  min-width: 90px;
  max-width: 140px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up.
     Its own :disabled variant further down (de-opening-field/de-prev-
     field) already overrides to --shade for the read-only Daybook
     Entry boxes that reuse this class, unaffected by this change. */
  color: var(--input-fg);
  background: var(--input-bg);
}
.op-totals-bar {
  display: flex;
  gap: 24px;
  align-items: baseline;
  margin: 10px 0 4px;
  font-size: 0.92rem;
}
.op-totals-bar .op-diff-ok { color: var(--muted); }
.op-totals-bar .op-diff-bad { color: #b91c1c; font-weight: 600; }

/* Profit Ratio Setup (pratio.py) -- same narrow right-aligned box
   convention as .op-input above, just for a single Ratio% column
   instead of a Credit/Debit pair, and its own totals bar since a 100
   tally is enforced here (Ledger Opening Setup's Credit/Debit never
   is -- see pratio.py's own top docstring for why the two differ). */
.pr-input {
  width: 100%;
  min-width: 90px;
  max-width: 140px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}
.pr-totals-bar {
  display: flex;
  gap: 24px;
  align-items: baseline;
  margin: 10px 0 4px;
  font-size: 0.92rem;
}
.pr-totals-bar .pr-diff-ok { color: var(--muted); }
.pr-totals-bar .pr-diff-bad { color: #b91c1c; font-weight: 600; }

/* Opening Cash Setup (op_cash.py) -- a lone amount box, so it shouldn't
   inherit .form-page input's own width: 100% (fine for a Name/Address
   field, way too wide for one number) -- sized instead to comfortably
   fit a 12-digit rupee amount plus 2 decimals and a leading minus sign
   ("-999999999999.99", 17 characters), per Sabari, rather than
   stretching across the whole panel. */
.form-page input[type="text"].op-cash-input {
  width: 17ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Daybook Entry (day_ent.py) -- the one and only data-entry screen.
   Header bar holds the Transaction Date picker plus the read-only
   Opening Balance pair (reuses .op-input for those two boxes, same
   look as every other disabled/read-only rupee box in this app); the
   grid itself is the plain shared .grid/table look with a couple of
   narrow fixed-width columns; the footer bar mirrors the header bar's
   layout for Previous Balance + live Total/Balance. */
.de-header-bar, .de-footer-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.de-footer-bar { margin-top: 12px; margin-bottom: 0; }
.de-date-field, .de-opening-field, .de-prev-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}
.de-date-field input[type="date"] {
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.88rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}
/* The native calendar-icon affordance only earns its keep in Mobile
   view, where picking a date by hand (rather than typing it) is the
   whole point -- Normal view hides it, same html[data-view="mobile"]
   toggle base.html's own Display > View switch already drives
   elsewhere in this app (Sabari, 2026-09-17). WebKit/Blink-only
   (Chrome, Edge, Safari) -- Firefox doesn't expose this icon to CSS at
   all, so this has no effect there either way. */
#de-date-input::-webkit-calendar-picker-indicator { display: none; }
html[data-view="mobile"] #de-date-input::-webkit-calendar-picker-indicator { display: block; }
.de-prev-field .op-input { width: 120px; }
/* Opening Balance's own pair, right-aligned to sit directly over the
   grid's Credit/Debit columns below it (Sabari, 2026-09-19 -- "right
   align with similar textboxes in grid", grid itself left untouched
   -- every figure below is read from .de-grid's own rules above, not
   changed there).
   .op-col-slot reproduces one Credit/Debit column's own box exactly
   -- same calc(17ch + 26px) width as .de-grid .de-col-amt, in the
   SAME font .grid th itself uses for that calc (--grid-header-size /
   600 weight -- table columns size off the header row's own font,
   not the body row's, so matching .de-col-amt's width for real means
   matching ITS font here too, not .op-input's 0.88rem -- a plain
   ch-calc at .op-input's own font size comes out a different, wrong
   pixel value). The 6px left/right padding mirrors .de-grid td's own
   side padding, so .op-input inside (width: 100%, its own font
   untouched -- .op-input's own font-size rule on the <input> itself
   always wins over whatever this wrapper's font would otherwise
   inherit down to it) ends up exactly the grid input's own size too. */
.op-col-slot {
  width: calc(17ch + 26px);
  padding: 0 6px;
  font-size: var(--grid-header-size);
  font-weight: 600;
}
.op-col-slot .op-input { width: 100%; }
/* Adjacent grid columns sit flush (table cells, no gap) -- this
   negative margin cancels the 8px gap (.de-opening-field's own flex
   gap, or .de-totals's grid column-gap below) between just two
   ADJACENT slots -- i.e. Credit-to-Debit -- wherever .op-col-slot is
   reused; the gap before the first one (the row's own label to its
   Credit box) is unrelated and stays. */
.op-col-slot + .op-col-slot { margin-left: -8px; }
/* Walks the whole pair back from the header bar's flush-right edge
   (which lines up with the grid's outer/row-buttons edge) to the
   grid's actual Debit column edge, by the row-buttons column's own
   width (.de-grid .de-col-rowbtns, read not changed). */
.de-opening-field { margin-right: 56px; }
.de-opening-field .op-input:disabled, .de-prev-field .op-input:disabled,
.de-totals-row .op-input:disabled {
  background: var(--shade);
  color: var(--ink);
}
#de-weekday { font-size: 0.82rem; }

.de-grid-wrap { overflow-x: auto; margin-bottom: 4px; }
.de-grid { table-layout: fixed; }
/* Column widths (2026-09-17, Sabari: Credit/Debit were eating far more
   room than a plain rupee amount ever needs, while Ledger Head and
   Description -- the two columns that actually hold long free text --
   were the ones getting squeezed and truncated; the S/N column was
   then dropped entirely -- every row's own position is already shown
   by the grid's own row order, nothing else in the app ever refers to
   a row by number. Updated same day once the Date box became
   genuinely editable: it auto-fits its own fixed-format content
   (11ch comfortably fits "DD-MM-YYYY"), and Credit/Debit are sized the
   same 17ch as op_cash.py's own money box -- enough for a 12-digit
   rupee amount, 2 decimals, and a leading minus sign). Ledger
   Head/Description split whatever's left by percentage, still
   weighted toward Description. */
/* +26px on top of the raw character count on both of these covers the
   cell's own padding (.de-grid td, 6px each side) plus the input box's
   own padding+border (4px+4px+1px+1px) that box-sizing: border-box
   otherwise eats INTO the 17ch/11ch of text width itself -- without
   it, a real 17-character value like "-999999999999.99" quietly
   overflows the box it was supposedly sized for. */
.de-grid .de-col-date { width: calc(11ch + 26px); }
.de-grid .de-col-head { width: 33%; }
.de-grid .de-col-desc { width: 45%; }
.de-grid .de-col-amt { width: calc(17ch + 26px); }
/* Trailing +/- column (2026-09-17, Sabari: dropped the Add/Delete/Row
   Del toolbar in favour of per-row insert/remove buttons) -- just wide
   enough for the two small buttons, never meant to hold real content
   so it isn't weighted into the Ledger Head/Description split above. */
.de-grid .de-col-rowbtns { width: 56px; }
.de-grid td { vertical-align: top; padding: max(1px, calc(5px + var(--lay-gy, 0px))) 6px; }
.de-rowbtns-cell {
  display: flex;
  gap: 4px;
  justify-content: center;
  padding-top: 3px;
}
.de-row-add, .de-row-del {
  width: 22px;
  height: 22px;
  line-height: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.de-row-add:hover { color: var(--accent); border-color: var(--accent); }
.de-row-del:hover { color: #b91c1c; border-color: #b91c1c; }
.de-row-del:disabled { color: var(--border); border-color: var(--border); cursor: default; }
/* Posted rows (2026-09-30, day_ent.py/led_edit.py's own is_posted --
   a row carried in from another legacy module, e.g. Sales/Purchase/
   Receipts/Payments, DYTRN.POST = .T.) -- read-only here outright.
   Sabari, 2026-09-30: no caption, no distinct row background -- just
   the text itself in the theme's own button colour (var(--accent),
   same as .btn-primary/.de-row-add:hover), so a posted row reads as
   "this text is a different colour than every other row" rather than
   being called out with a banner-style tint or label. */
.de-grid tr.de-row-posted input[readonly] { color: var(--accent); cursor: default; }
/* The per-row Date box defaults to the Transaction Date picked at the
   top of the screen but, per Sabari ("date column in grid is actually
   editable"), is genuinely editable per row -- Save writes each row
   under its OWN date (see save_daybook_entry()'s id-based
   update/insert/delete, not a blind per-date replace), which is what
   lets one entry move to a different day without disturbing anything
   else already sitting on either date. Same centered/tabular-nums
   treatment as before, just no longer muted/shaded, since it's a
   normal editable field now rather than a read-only one. */
.de-grid .de-date-input {
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.de-grid tr.de-row-selected { background: var(--shade); }
.de-grid input { font-size: 0.88rem; }
.de-grid input[type="text"] {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}
.de-grid .num .op-input { width: 100%; min-width: 0; max-width: none; }

.de-head-cell { position: relative; }
/* `position: fixed`, not `absolute` (2026-09-17, Sabari: "the list
   doesn't auto populate in last row" / "popup drops below visibility"
   -- it WAS populating, just invisible). .de-grid-wrap's own
   `overflow-x: auto` silently forces its `overflow-y` to `auto` too
   (a browser can't leave one axis `visible` once the other is
   anything else -- it coerces the visible one to `auto`), which
   clipped this box to nothing for any row near the bottom of the
   table, since the wrap's own box ends exactly at the table's last
   row with no room to spare below it. `position: fixed` positions
   against the viewport instead of that clipping ancestor, escaping it
   entirely -- day_ent.html's own positionSuggestBox() sets this box's
   top/left/width from the input's own getBoundingClientRect() every
   time it opens, flipping it above the input instead of below when
   there's more room there. */
.de-suggest {
  position: fixed;
  z-index: 20;
  max-height: 220px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
.de-suggest-item { padding: 6px 8px; font-size: 0.86rem; cursor: pointer; }
.de-suggest-item:hover { background: var(--shade-strong); }
/* the highlighted (arrow-key / current) row is drawn in the button colour with white text, like the item pickers' .ipk-active (client feedback 2026-11-02: the pale bar was hard to see) */
.de-suggest-item.de-suggest-active, .de-suggest-item.de-suggest-active:hover { background: var(--accent); color: #fff; }

/* Total / Balance (Sabari, 2026-09-19 -- same "right align with the
   grid" treatment as .de-opening-field above, plus Total and Balance
   now stacked as their own two rows instead of sitting side by side).
   A CSS grid, not two independent flex rows, is what guarantees the
   Credit/Debit boxes actually line up between the Total row and the
   Balance row underneath it -- "Total" and "Balance" are different
   lengths, so two separately-flowed flex rows would put their own
   Credit boxes at two different x-positions; a shared grid sizes the
   label column once (to the wider of the two) so both rows' Credit
   boxes start at the same place, and likewise for Debit. Each
   .de-totals-row is display:contents so its own 3 children (label +
   2 .op-col-slot boxes -- see .de-opening-field's own comment on
   those) become direct items of THIS grid rather than of their own
   nested one. Margin-right walks the whole block back off the
   row-buttons column exactly like .de-opening-field's own. */
.de-totals {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  row-gap: 4px;
  column-gap: 8px;
  font-size: 0.92rem;
  margin-right: 56px;
}
.de-totals-row { display: contents; }
.de-totals-row span { color: var(--muted); }

/* Only Save is left here now (2026-09-17, Sabari dropped Add/Delete/
   Row Del/Print/Discard -- see day_ent.py's own top docstring) -- kept
   right-aligned, same spot Save always sat in even back when there
   were other buttons to its left. */
.de-toolbar { justify-content: flex-end; }
.btn-toolbar:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-toolbar:disabled:hover { filter: none; }

/* Description editor dialog (2026-09-20, replacing the old
   F12-triggered floating popup -- see day_ent.html's own comment on
   #de-desc-editor-overlay for why). Plain .overlay/.dialog (styled
   near the top of this file) for the shell itself; the rules below
   are just this dialog's own extra pieces -- the Narration Shortcuts
   panel it can show/hide inside itself, and the two-sided button row
   (Narration Shortcuts on the left, Cancel/OK on the right) that's
   otherwise unlike every other .dialog-actions row in this app (those
   are all right-aligned only). */
.de-desc-editor-actions { justify-content: space-between; }
.de-desc-editor-actions-right { display: flex; gap: 8px; }
.de-shortcut-hint { color: var(--muted); font-size: 0.82em; margin-left: 2px; }
.de-narr-panel { margin: 4px 0 14px; }
.de-narr-panel select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.86rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}
.de-narr-hint { margin: 6px 0 0; font-size: 0.74rem; color: var(--muted); }

.nested-tree { list-style: none; margin: 0; padding: 0; }
.nested-tree li { padding: 3px 0; }
.nested-tree .nested-tree {
  padding-left: 22px;
  margin-top: 2px;
  border-left: 1px solid var(--border);
}

.hint {
  color: var(--muted);
  font-size: 0.82rem;
  margin: -8px 0 12px;
}

.int-block + .int-block { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 18px; }
.int-block-heading { font-size: 1rem; margin: 0 0 4px; }

/* Database Structure's own table-listing rows (db_structure.html,
   2026-10-01, Sabari: "remove those lines between table names, make it
   vertically tighter, so that as many as table names seen without
   scrolling much") -- a scoped sibling of .int-block above rather than
   a change to it (ledger.html's/interest_statement.html's own per-head
   report blocks still want that fuller divider/spacing) -- this is a
   dense list of table names first, not a sequence of printed report
   blocks, so no border-top and only a couple px between consecutive
   COLLAPSED rows. An expanded row's own structure grid already carries
   enough visual weight/margin of its own (.grid's usual row borders) to
   separate it from the next table without needing this too. */
.dbstruct-table-block + .dbstruct-table-block { margin-top: 2px; }

/* Ledger (ledger.py) -- "Show Monthly Sub Totals" Month Total/Month
   Balance rows, same light shading idea as .grid .opening-row/
   .totals-row (see the .grid rule near the top of this file) but its
   own class since these sit INSIDE a block's grid alongside real
   entry rows, not just at the block's own head/foot.
   2026-09-20, Sabari: "the sub total area alignment & background can
   be similar to the one we just applied in daybook.py" -- same
   treatment Day Book's own SUB TOTAL/BALANCE rows ended up with:
   column 2 (the "<Month> Total"/"<Month> Balance" label) right-
   aligned instead of reading like an entry's own left-aligned
   Ledger Description text, and the shade narrowed off Date/the label
   down to just the Credit/Debit value columns (3 & 4) -- Ledger's own
   table has no extra screen-only Balance column the way Day Book's
   does (compute_ledger_account_statement() already folds Month
   Balance into Credit or Debit directly, see that function's own
   month_balance block), so this is the whole fix, no column-collapse
   complications to work around here. */
.ledger-subtotal-row td:nth-child(2) { text-align: right; }
.grid .ledger-subtotal-row td { background: none; }
.grid .ledger-subtotal-row td:nth-child(3),
.grid .ledger-subtotal-row td:nth-child(4) { background: var(--shade); }
/* A block's own closing Total/Balance rows -- same follow-up, Sabari:
   "also right align Total & Balance captions in column 2" -- matches
   Month Total/Month Balance's own label alignment just above, now
   that both live in the same block. Own class (ledger-total-row, see
   ledger.html's own comment on it) rather than plain .totals-row,
   which .daybook-grid also shares with Day Book's own tfoot TOTAL row
   -- that row's own column 2 alignment isn't part of this ask. */
.ledger-total-row td:nth-child(2) { text-align: right; }
/* Consistent column widths across every selected head's own block
   (2026-09-20, Sabari: "will be good if all ledgers align the same
   way") -- see ledger.html's own comment on this class for the full
   reasoning; table-layout: fixed makes each block's <table> honour
   the colgroup widths there instead of auto-sizing from its own
   content, and long Ledger Description text wraps instead of forcing
   that column wider (word-break covers a single very long word with
   no spaces, e.g. a run-together narration, which white-space:
   normal alone wouldn't wrap). */
.ledger-block-grid { table-layout: fixed; }
.ledger-block-grid td:nth-child(2) { word-break: break-word; }

@media print {
  /* "Select New Page for Every Ledger" -- each block after the first
     starts its own printed page when ticked (int_rep.py passes the
     class only when that checkbox is on); a plain browser Print and
     both PDF Portrait/Landscape buttons all render under this same
     @media print block (see the block above), so one rule covers all
     three the same way it already does everywhere else in this file. */
  .int-block-pagebreak { page-break-before: always; }
}

/* Ledger Heads (accheads.py) -- collapsible chart-of-accounts tree.
   Genuinely nested <ul>/<li> (see accheads.html's own recursive
   macro), not the flat depth-indented .tb-grid table every printed
   report here otherwise uses -- that flat shape has no easy way to
   hide an arbitrary subtree, which this screen needs for its
   Expand/Collapse-All and search-filter behaviour. */
.acc-search {
  width: 280px;
  max-width: 60vw;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
}
.acc-tree, .acc-tree .acc-children { list-style: none; margin: 0; padding: 0; }
.acc-tree .acc-children { padding-left: 20px; }
.acc-tree .empty { color: var(--muted); padding: 10px 0; }

.acc-group-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 4px;
}
.acc-toggle {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.7rem;
  width: 16px;
  flex: none;
}
.acc-group-name { font-weight: 600; font-size: 0.9rem; }

.acc-head { padding: 3px 4px 3px 22px; }
.acc-head-link {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.86rem;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.acc-head-link:hover { color: var(--accent); text-decoration: underline; }
.acc-code { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }

/* Ledger Heads Add/Edit form (accheads_form.html) -- a .form-page
   with more field types than client_form.html needed (number,
   textarea), plus the party-detail block that's only enabled for
   Sundry Debtors/Sundry Creditors (see accheads_form.html's own
   script and reports_common.SUNDRY_PARTY_LEGACY_CODES). */
.form-page input[type="number"],
.form-page textarea {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further
     up. (These two previously had no explicit background at all, so
     they were inheriting --panel from their container -- this is a
     small deliberate visual change on these two selectors specifically,
     the Ledger Heads number/textarea fields will now visibly lift off
     the panel like every other field does.) */
  color: var(--input-fg);
  background: var(--input-bg);
  font-family: inherit;
}
.form-page textarea { resize: vertical; min-height: 52px; }

.acc-party-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 16px 8px;
  margin-top: 6px;
}
.acc-party-block[disabled] { opacity: 0.5; }
.acc-party-block legend { font-size: 0.9rem; font-weight: 600; padding: 0 6px; }

.acc-phone-row { display: flex; gap: 10px; }
.acc-phone-row input { flex: 1; }

/* Ledger picker tree (int_rep.py's interest_statement.html, and
   whichever picker screen reuses reports_common.compute_head_picker_tree()
   next) -- same .acc-tree/.acc-group/.acc-toggle shell as the Ledger
   Heads browse tree above, just scrolled inside a fixed-height box
   (same idea as the old .head-picker it replaced) and with a tick-box
   on every node instead of a plain link on heads only. */
.head-picker-tree {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  min-width: 280px;
  max-width: 480px;
}

/* The picker's own popup (interest_statement.html's "Select Heads"
   button) -- same .overlay/.dialog shell users.html's Add/Edit User
   dialog already uses, just wider (a tree needs more room than a
   login form) and with its own small header/close-X since this
   dialog's h2 needs a close button next to it, unlike a plain form
   dialog that only ever closes via Save/Discard. */
.dialog-wide { width: 560px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog-head h2 { margin: 0; }
.dialog-x {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 4px;
}
.dialog-x:hover { color: var(--ink); }

/* "View Previous Financial Year" popup (ledger.html, 2026-09-22 --
   Sabari: "what if instead of opening a new tab, this appears in a
   big window in same page?"). Same .overlay/.dialog shell as
   .dialog-wide just above, just noticeably bigger -- "a big window",
   not a small popup, since a real ledger block can run to many rows
   -- and, unlike every other .dialog here, its own content is a full
   page loaded in an <iframe> (ledger.py's own bare_view -- see that
   flag's own docstring -- already comes stripped of every header/
   menu/footer/toolbar, so it's already exactly the right shape to
   drop straight in here). flex column so the iframe can genuinely
   fill the rest of the dialog's own height below its title row,
   rather than however tall its OWN content happens to render to --
   .dialog's own max-width/max-height (92vw/88vh) still applies on
   top of this, same as .dialog-wide relies on for small screens. */
.dialog-xlarge { width: 1100px; height: 82vh; display: flex; flex-direction: column; }
.prev-year-frame { flex: 1 1 auto; width: 100%; border: none; margin-top: 4px; background: var(--panel); }

/* Database Structure's own View Data popup (db_structure.html,
   2026-10-01 -- Sabari: "dynamically the window can size to 95% of
   visible area & grid can dynamically match the window size" / "remove
   the grey area, next to grey area (inner side) remove the white
   padding. let the grid utilize the full window height"). A separate
   class from .dialog-xlarge just above on purpose -- that one's own
   fixed 1100px/82vh and its share of .dialog's ordinary 22px/24px
   padding are both still exactly right for the Previous Financial Year
   and Projected Values popups, neither of which this request touched.
   95vw/95vh instead of a fixed pixel size so the popup actually scales
   with the browser window, same as .dialog/.dialog-wide/.dialog-fit's
   own vw/vh-based caps elsewhere in this file -- max-width/max-height
   repeat the same figures here (rather than deferring to .dialog's own
   92vw/88vh caps) so this popup always reaches the full 95% Sabari
   asked for instead of getting capped a little short by those slightly
   smaller app-wide defaults. padding: 0 -- unlike every other .dialog
   variant above, which all keep .dialog's own 22px/24px padding around
   their whole content -- moves that breathing room onto just the title
   row instead (.dialog-head override just below) so the iframe below
   it runs edge-to-edge with the popup's own four sides; combined with
   "body.dbview-popup" further down (the iframe DOCUMENT's own .content/
   .panel padding, zeroed the same way), the grid inside ends up with
   nothing left between it and the popup's own edges at all. */
.dialog-dbview { width: 95vw; height: 95vh; max-width: 95vw; max-height: 95vh; display: flex; flex-direction: column; padding: 0; }
.dialog-dbview .dialog-head { padding: 14px 16px; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.dialog-dbview .prev-year-frame { margin-top: 0; }

/* Access/Rights popup (users.html's #user-popup-overlay, 2026-09-27b
   -- Sabari: "keep the window width dynamic. (keep the window width
   as narrow as possible. based on the max width of the menu leaf)").
   A DIFFERENT class from .dialog-xlarge just above on purpose --
   .dialog-xlarge's own fixed 1100px is still needed by the Previous
   Financial Year popup and the Edit/Projected-Values popup, neither
   of which this request touched. Same flex-column shell (the iframe
   still needs to fill the remaining height below the title row) and
   the same 82vh height cap (Sabari's request was width-only), but
   `width` here is only ever a fallback for the instant before
   users.html's own fitUserPopupWidth() (see that script) measures
   the iframe's actual same-origin content and overwrites it inline
   -- that JS is what makes the width "dynamic"; nothing here can
   see into the iframe's own document from CSS alone. min-width keeps
   a very short Access tree (or a Rights grid with only one or two
   Entry screens) from ever going narrower than an ordinary .dialog's
   own default width; max-width is the same 92vw cap .dialog itself
   already uses everywhere else. */
.dialog-fit { width: 600px; min-width: 420px; max-width: 92vw; height: 82vh; display: flex; flex-direction: column; }

/* "Edit / Projected Values" popup (financial_statement.html/
   financial_statement_wide.html's own shared _projection_popup.html
   include, 2026-09-27) -- same .dialog-xlarge shell as the Previous
   Financial Year popup just above (a real editable grid needs the
   same amount of room an iframe'd report page does), just with a
   scrollable <table> instead of an iframe filling the remaining
   height below the Projected Value %/OK row -- same flex: 1 1 auto
   fill as .prev-year-frame, plus its own overflow-y since a table (no
   fixed height of its own) doesn't scroll on its own the way an
   iframe already does. */
.projection-grid-wrap { flex: 1 1 auto; overflow-y: auto; margin-top: 8px; }
/* Totals bar right-aligned to the grid's own Credit/Debit columns
   (Sabari, 2026-09-28: "right align the total columns matching the
   columns in the grid") -- same idea, and same .op-col-slot-style
   technique, as day_ent.html's own Opening Balance/Total/Balance
   boxes lining up with .de-grid's Credit/Debit columns below them
   (see that class's own comment in this file). Can't reuse .op-col-
   slot's own calc(17ch + 26px) as-is, though -- that figure is
   calibrated to .de-grid td's own 6px horizontal padding, whereas
   this popup's table is the plain .grid/.tb-grid shell (padding:
   9px 8px, only the vertical half overridden by .tb-grid td above --
   see that rule), so the padding side of the sum is 8px not 6px.
   .projection-col-amt below is what actually FIXES the grid's own
   Credit/Debit columns to a known width in the first place --
   .tb-grid is plain auto-layout table-wide (every OTHER report using
   it needs its columns sizing off real content, e.g. financial_
   statement.html), so table-layout: fixed is scoped to just .projection-
   grid-wrap's own table, never touching .tb-grid itself. It's a class
   on the Credit/Debit <th>s themselves (like .de-grid's own .de-col-amt
   is on its <th>s), not on a <colgroup> <col> -- a <col> renders no
   text, so a ch-based width set there resolves against a default font
   rather than the th's own (--grid-header-size / 600 weight, same as
   .projection-col-slot below), coming out a different, wrong pixel
   value that the totals bar can't actually match. Same calc(17ch + Npx)
   shape as every other big-rupee-amount box in this app (a full
   12-digit + 2-decimal figure) --
   17ch (text) + 16px (.tb-grid td's own 8px+8px horizontal padding)
   + 14px (.op-input's own 6px+6px padding + 1px+1px border) = 30px. */
.projection-grid-wrap table { table-layout: fixed; }
.projection-col-amt { width: calc(17ch + 30px); }
.projection-col-slot {
  width: calc(17ch + 30px);
  padding: 0 8px;
  font-size: var(--grid-header-size);
  font-weight: 600;
  text-align: right;
}
/* Cancels .op-totals-bar's own 24px gap between just the Credit and
   Debit slots specifically (so they sit flush, touching, exactly like
   the grid's own adjacent Credit/Debit columns do) -- the gap before
   the leading "Total" label and after the trailing diff message is
   unrelated and stays untouched. */
.projection-col-slot + .projection-col-slot { margin-left: -24px; }
/* Matching WIDTH alone (the rules above) isn't enough for true visual
   alignment -- .op-totals-bar has no justify-content override, so its
   flex children just pile up left-to-right after "Total", nowhere near
   the grid's own Credit/Debit columns further right. The diff message
   (already living between "Total" and the Credit/Debit slots) absorbs
   all leftover horizontal space instead, pushing the Credit+Debit slot
   pair flush against the bar's own right edge -- the same effect
   day_ent.html's own .de-header-bar/.de-footer-bar get via
   justify-content: space-between, but done this way instead so the
   SHARED .op-totals-bar class (also used by op_head.py) stays
   untouched. .projection-totals-bar itself needs no rule of its own --
   it's just a scoping hook on the wrapper div. */
.projection-diff-fill { flex: 1 1 auto; }
.acc-group-check, .acc-head-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.86rem;
}
.acc-head-check { justify-content: space-between; }
.acc-group-check input[type="checkbox"],
.acc-head-check input[type="checkbox"] { margin: 0; flex: none; }
.acc-head-check .rate { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }

/* Groups the topbar's own right-hand item (.user-block) under
   margin-left: auto. align-items: flex-start (not center) since
   .user-block is three lines tall (2026-09-17) -- top-aligns it with
   the nav-toggle/brand-block on the left, same reasoning as
   .topbar-row's own flex-start above. (Display moved out of here
   entirely, down into the Dynamic Menu bar, 2026-09-17 -- see
   .display-dropdown below.) */
.topbar-actions { margin-left: auto; display: flex; align-items: flex-start; gap: 14px; }
.topbar-actions .link { margin: 0; font-size: 0.82em; padding: 0; }

/* Display dropdown -- moved into the Dynamic Menu bar (2026-09-17),
   always the LAST pad there (see base.html's own comment on why).
   Deliberately no summary-padding/font-size override anymore -- it
   now uses the plain .appnav-dropdown > summary look every other
   top-level menu pad (Master, Reports, ...) already has, per Sabari.
   Used to anchor its panel to the right edge here (right: 0) since
   this dropdown sits at the far right of the bar and the generic
   .appnav-dropdown > .appnav-panel rule opens flush with the
   SUMMARY's own left edge -- but Sabari asked for it left-aligned
   like every other pad instead (2026-09-23: "display popup right
   aligns the pad, let it left align"), so this override is gone and
   it now just falls through to that same generic rule. */
/* 220px -> 190px (2026-09-17, Sabari: 5 swatches per row instead of
   the flex-wrap default of 6+4) -- .theme-swatches is now a fixed
   5-column grid (see below), whose content is 5*22 + 4*8 = 142px, so
   190px (142px content + 12px padding each side, plus a little
   breathing room) is enough without being wasteful. Each 10-swatch
   block (light, dark) now lands as a clean 5+5 either side of
   .theme-group-break. */
.display-panel { min-width: 190px; padding: 12px; }
.display-section + .display-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.fkey-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
.fkey-row .display-label { margin: 0; font-size: 0.8rem; }
.display-label { display: block; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 6px; }

.view-switch { display: flex; gap: 6px; }
.view-switch button {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.84rem;
  cursor: pointer;
}
.view-switch button.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Display > Text Size (2026-09-23) -- A-/A+ step buttons + current
   percentage + Reset, same row shape as .view-switch just above but
   with a fixed-width readout between the two steppers instead of a
   pair of equal-flex toggle buttons. .font-size-reset reuses the
   existing .link button look (see that class further up this file)
   rather than its own style, since it's a plain text action same as
   every other .link in this panel. */
.font-size-switch { display: flex; align-items: center; gap: 6px; }
.font-size-step {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.font-size-step:hover { border-color: var(--accent); color: var(--accent); }
.font-size-current { flex: 1; text-align: center; font-size: 0.84rem; color: var(--ink); }
.font-size-reset { flex: 0 0 auto; }

/* Fixed 5-column grid (2026-09-17, was flex-wrap, which packed
   however many 22px/8px-gap swatches happened to fit the panel width
   -- 6 in the first row then a stranded 4 -- rather than an even
   split; Sabari asked for 5 per row instead). A grid with an explicit
   column count wraps at exactly 5 regardless of container width, so
   each 10-swatch block (light, dark) always lands as two full rows of
   5, never a lopsided 6+4. */
.theme-swatches { display: grid; grid-template-columns: repeat(5, 22px); gap: 8px; }
.theme-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  cursor: pointer;
  padding: 0;
}
.theme-swatch.active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
/* Forces the light/dark boundary in the swatch grid onto its own row
   (2026-09-17, base.html inserts one of these right before the 11th
   swatch) -- grid-column: 1 / -1 spans the break across all 5
   columns so the very next swatch after it always starts a fresh
   row, with a thin rule + a little breathing room to read as a real
   section break rather than an accidental gap. */
.theme-group-break {
  grid-column: 1 / -1;
  height: 1px;
  margin: 2px 0;
  background: var(--border);
}

/* Display > Theme as one circle + a small window (2026-10-21): .theme-current is the current theme's circle on the Theme row, .theme-pop the window
   with all 20 (the same 5-column .theme-swatches grid as before) opening under it. */
.theme-section { position: relative; }
.theme-current { flex: 0 0 auto; width: 24px; height: 24px; }
.theme-current:hover, .theme-current[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.theme-pop { position: absolute; right: 0; top: calc(100% - 4px); z-index: 60; padding: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }
.theme-pop[hidden] { display: none; }
html[data-view="mobile"] .theme-pop { right: auto; left: 0; }

/* Hamburger toggle for the collapsed Mobile-view menu -- hidden in
   Normal view entirely (there's nothing to expand/collapse; the
   Dynamic Menu already renders inline, same as always). */
.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  cursor: pointer;
  flex: none;
}

/* Mobile view (session['view_mode'] == 'mobile', set via the Display
   dropdown's View switch -- see display.py) -- an explicit user
   choice, not a real-viewport media query, so it applies at any
   window size, same as pharma_platform's own view_mode design. Three
   things change: the Dynamic Menu collapses behind the hamburger
   above instead of sitting inline; grids get denser padding/text so
   more of a report fits without shrinking to illegible; and the
   side gutters tighten up since a phone has no room to spare. Wide
   report tables are wrapped in a horizontally-scrollable
   .mobile-scroll box by base.html's own script rather than by editing
   every report template individually -- every one of them already
   marks its table `class="grid ..."`, so one runtime query catches
   all of them. */
html[data-view="mobile"] .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
html[data-view="mobile"] .topbar-row { flex-wrap: wrap; row-gap: 8px; }
html[data-view="mobile"] .appnav {
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
html[data-view="mobile"] .appnav.nav-open { display: flex; }
html[data-view="mobile"] .appnav-link { padding: 10px 12px; }
html[data-view="mobile"] .appnav-dropdown > .appnav-panel { position: static; box-shadow: none; margin-top: 0; }
html[data-view="mobile"] .appnav-vrule { display: none; }
/* .appnav-page-title-wrap's own margin-left: auto (see above) is what
   pins it to the far right of the DESKTOP bar's single row -- inside
   Mobile's stacked column list that same rule would instead shove it
   off to the right edge of its own line, same bug .appnav-changefirm
   used to have here before it became a plain leaf. Cancelling it back
   to a plain block re-joins it to the same left edge as every other
   stacked item; padding drops to match .appnav-link's own Mobile
   padding just above. align-items switches to flex-start so the
   heading/sub-heading pair now reads left-aligned too, same as every
   other stacked Mobile menu row -- Mobile has its own full-width row
   per item already (no shared-row height budget to protect), so there
   is no need to keep the tightened line-height/padding here. */
html[data-view="mobile"] .appnav-page-title-wrap {
  margin-left: 0;
  padding: 10px 12px;
  align-items: flex-start;
  line-height: normal;
}

/* Trimmed the same way the desktop values above were (2026-09-18,
   going flat/borderless) -- a phone screen has even less width to
   spare for a report grid than desktop does, so the reclaimed space
   matters more here, not less. .panel keeps the same even-on-every-
   side shape the desktop 15px got, just a touch smaller for a
   phone's own width budget. */
html[data-view="mobile"] .content { padding: 10px 12px; }
html[data-view="mobile"] .panel { padding: 12px; }
/* A report's title + its Export XL/PDF/Print toolbar (.panel-head)
   fight for the same row on a phone-width screen -- letting the title
   drop to its own line above the toolbar reads far better than
   squeezing both into one row until the title itself wraps mid-word. */
html[data-view="mobile"] .panel-head { flex-wrap: wrap; gap: 8px; }
html[data-view="mobile"] .grid th, html[data-view="mobile"] .grid td { padding: 6px 6px; font-size: 0.82rem; }
html[data-view="mobile"] .mobile-scroll { overflow-x: auto; }

/* Select Company window (select_firm.html) -- a standalone page (not
   base.html's shell -- there's no menu or nav-context yet at this
   point) styled as a floating window over a dark backdrop, the same
   shape as the old desktop app's own "Select Company" screen: a
   titled window holding the Company grid on top and the Financial
   Year grid underneath, rather than a plain full-page form.

   Every color below was hand-picked navy/light-blue, on the
   assumption this screen would only ever look like the one reference
   screenshot -- Sabari, 2026-09-19: "in select_firm.py, it didn't
   adopt to themes, need a fix" (it also wasn't even linking
   theme_vars.css at all until this same round -- see select_firm.
   html's own head comment). Rebuilt from the same --shade/
   --shade-strong/--header-bg/--footer-bg/--accent/--muted variables
   every other screen's shell already reads from theme_vars.css, so
   this window now recolors itself for all 20 Display > Theme
   palettes (10 light + 10 dark) with no further code changes needed
   here when a NEW theme is added from the admin panel -- same as
   every other themed rule in this file. */
.selectwin-body {
  min-height: 100vh;
  margin: 0;
  /* Same light-to-deep radial shape as the original hand-picked
     gradient, just built from the current theme's own ramp instead of
     one hardcoded navy: --shade-strong (top, the ramp's lightest
     emphasis step) through --bg down to --footer-bg (edges, the
     ramp's own deepest "anchor" step -- see .app-footer's own comment
     on that variable) -- reads as a soft vignette behind the window on
     a light theme and a genuinely dark backdrop on a dark one, exactly
     tracking whatever that theme's own ramp actually is. */
  background: radial-gradient(ellipse at top, var(--shade-strong) 0%, var(--bg) 55%, var(--footer-bg) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 40px;
}
.selectwin-topbar {
  width: 100%;
  max-width: 760px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 4px 14px;
}
.selectwin-client {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.selectwin-logout {
  /* Same var(--accent) every other plain-text link in the app already
     uses (.link, above) -- was a hardcoded light blue that assumed
     this backdrop is always dark. */
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
}
.selectwin-logout:hover { text-decoration: underline; }

.selectwin {
  width: 100%;
  max-width: 760px;
  background: var(--panel);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.selectwin-titlebar {
  /* Same idea as .topbar's own var(--header-bg) (layer 1 of the real
     shell), with a touch of var(--shade-strong) at the top for the
     old "raised title bar" look -- var(--ink) for the text instead of
     a navy hardcoded to assume a light gradient underneath it, which
     is wrong for any dark theme. */
  background: linear-gradient(180deg, var(--shade-strong) 0%, var(--header-bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.selectwin-body-inner { padding: 16px 22px 18px; }

/* Fixed-height scrollable grid box (the "browse window" look) --
   thead sticks to the top of its own scroll container rather than the
   header/body being two separately-laid-out tables, so column widths
   between header and rows can never drift apart the way that trick
   risks. */
.selectwin-scroll {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.selectwin-scroll-narrow { max-height: 170px; }
.selectwin-scroll .grid { margin: 0; }
/* The company grid box is a plain div made keyboard-focusable
   (tabindex, see select_firm.html's own script) so Up/Down can browse
   it -- a visible focus ring is the one bit of feedback that isn't
   already covered by the selected-row highlight below. */
.selectwin-scroll:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.selectwin-scroll .grid thead th {
  position: sticky;
  top: 0;
  background: var(--shade-strong);
  z-index: 1;
}
.selectwin-grid.narrow th:first-child, .selectwin-grid.narrow td:first-child { width: 34px; }
/* A stronger highlight than the plain .selected-row every other grid
   in the app uses -- this window's whole point is to show, at a
   glance, which company is currently in focus (same as the reference
   screenshot's solid highlight bar), so it needs to read clearly
   against the grid rather than blend in. var(--shade-strong) is that
   same "stronger" emphasis step used for a sticky thead's own opaque
   background right above, .tb-primary-row, and the Ledger Head
   suggestion box's own hover/active item -- scoped to .selectwin-grid only, so the plain
   app-wide .selected-row elsewhere is untouched. */
.selectwin-grid tr.selected-row { background: var(--shade-strong); }
.selectwin-grid tr.selected-row td { font-weight: 600; }

/* Tighter row rhythm than the site's default .grid (9px top/bottom,
   0.92rem/0.8rem text) -- this window's own grids, both scoped to
   .selectwin-grid so no other screen's tables are affected. One point
   smaller text, calc()'d off the same base sizes .grid itself uses
   rather than a second, easy-to-drift-out-of-sync magic number. */
.selectwin-grid th, .selectwin-grid td { padding: 5px 8px; font-size: calc(0.92rem - 1pt); }
.selectwin-grid th { font-size: calc(var(--grid-header-size) - 1pt); }

/* View Data grid (db_structure.html's own popup-loaded table-data grid,
   2026-09-30 -- Sabari: "view data link shows generic data viewer in
   same page, it can open as a window and the heading of the grid can
   stay static. make the grid table with vertical, horizontal &
   outlines"). .dbview-scroll is a bounded, independently-scrolling box
   -- same sticky-thead-inside-its-own-scroll-container idea as
   .selectwin-scroll just above -- so the small structure grid above it
   and the Prev/Next bar below it stay in view while just this table's
   own rows scroll underneath its own column headers ("the heading of
   the grid can stay static"). Works both directions (overflow: auto,
   not just overflow-y) since a wide legacy table (SATRN/SADET's e-Way
   Bill columns, say) still needs to scroll horizontally the way the
   plain overflow-x:auto div this replaced already did. Scoped to its
   own two classes rather than touching .grid/.grid.mono app-wide, same
   "new scoped class, not a global .grid change" convention .tb-grid/
   .rights-grid/.mct-grid/.client-grid/.file-tree-grid/.selectwin-grid
   already established for their own one-off needs elsewhere in this
   file. */
.dbview-scroll {
  max-height: 55vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.dbview-scroll .dbview-grid { margin: 0; }
.dbview-scroll .dbview-grid thead th {
  position: sticky;
  top: 0;
  background: var(--shade-strong);
  z-index: 1;
}
/* "make the grid table with vertical, horizontal & outlines" --
   horizontal row lines already come from .grid's own th/td
   border-bottom; this adds the vertical column rules (same
   border-right-on-every-cell-but-the-last technique as .tb-grid/
   .wide-grid's own vertical-rule rule elsewhere in this file) plus a
   table-level border for the outer outline -- sits cleanly alongside
   .grid's own border-collapse: collapse, so it reads as one single
   outline rather than doubled-up edges. */
.dbview-grid { border: 1px solid var(--border); }
.dbview-grid th, .dbview-grid td { border-right: 1px solid var(--border); }
.dbview-grid th:last-child, .dbview-grid td:last-child { border-right: none; }

/* Font/row-height tightened (2026-10-01, Sabari: "grid row font can be
   downsize by 2 points" / "tighten the vertical spacing as much as
   possible") -- scoped to .dbview-grid specifically (not .grid app-wide,
   same convention as .selectwin-grid/.dash-tb-grid's own tightened
   variants just above in this file), so every OTHER report's grid keeps
   its ordinary 0.92rem/9px. calc()'d off .grid's own base 0.92rem rather
   than a second hardcoded size, same idiom .selectwin-grid already uses
   for its own "-1pt". Applies whether this grid is showing inside the
   View Data popup or on a normal, non-popup visit to this same URL --
   same grid either way, so no body.dbview-popup scoping needed here. */
.dbview-grid, .dbview-grid th, .dbview-grid td { font-size: calc(0.92rem - 2pt); }
.dbview-grid th, .dbview-grid td { padding: 3px 6px; }

/* Per-column filter row (2026-10-01, Sabari: "add a text box below
   caption in every header column, that textbox can act like a filter").
   A second <tr> inside the same <thead> as the caption row (db_structure
   .html), so it already inherits position: sticky/background/z-index
   from ".dbview-scroll .dbview-grid thead th" above -- only its own
   `top` needs to differ (it must stick just BELOW the caption row, not
   over it), and that's set from JS (stickDbviewFilterRow(), db_structure
   .html), not a fixed figure here, since the caption row's own real
   height now depends on the tightened font/padding just above and would
   be an easy magic number to leave stale the next time either changes.
   th (not td) for these cells purely to inherit .dbview-grid's existing
   border-right/background styling for free -- the few header-only
   touches that don't fit an input box (uppercase, letter-spacing, the
   bold/muted text color) are reset to plain field styling below instead
   of carrying over onto whatever Sabari types. */
.dbview-filter-row th {
  padding: 3px 4px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}
.dbview-filter-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 3px 6px;
  font: inherit;
  color: var(--input-fg);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Edge-to-edge popup layout (2026-10-01, Sabari: "remove the grey area,
   next to grey area (inner side) remove the white padding. let the grid
   utilize the full window height") -- only while THIS page is itself
   loaded inside the View Data popup's own <iframe> (body_class, set by
   db_structure.html's own bare_view check -- see admin_templates/
   base.html's own body_class block for why this needs a body class at
   all rather than just a bare_view selector). The popup used to stack
   THREE layers of padding around the grid (.dialog-dbview's share of
   .dialog's 22px/24px, then, inside the iframe, .content's 16px/20px and
   .panel's 15px) while .dbview-scroll's own fixed 55vh cap (still exactly
   right for the normal, non-popup page, where a structure grid and this
   app's shell sit above/below it too) left a large dead band of plain
   iframe-body background below the Prev/Next row in a popup that is
   otherwise NOTHING but this one grid. Zeroing .content/.panel's own
   padding and letting .dbview-scroll grow to fill the remaining height
   (flex: 1 1 auto, same shell idiom body/.content/.panel already use
   site-wide -- min-height: 0 on each is required for a flex child to
   actually shrink/grow against its siblings instead of just taking its
   own content's natural height) replaces both at once. height: 100% +
   overflow: hidden on body itself (rather than its usual min-height:
   100%) locks the iframe's own document to EXACTLY the iframe's box, so
   .dbview-scroll's own internal overflow: auto is the only scrollbar
   that can ever appear -- never a second one from the iframe document
   itself quietly growing taller than its box. */
body.dbview-popup { height: 100%; overflow: hidden; }
body.dbview-popup .content { padding: 0; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
body.dbview-popup .panel { padding: 0; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
body.dbview-popup .dbview-scroll { flex: 1 1 auto; max-height: none; min-height: 0; border: none; border-radius: 0; }
body.dbview-popup .dialog-actions { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); flex: 0 0 auto; }

.selectwin-subhead {
  margin: 12px 0 6px;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.selectwin-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

/* File Manager (admin_app.py, 2026-09-17) -- originally native
   <details>/<summary> for each folder's own expand/collapse. Reworked
   2026-09-28 (Sabari: "the columns with file name, number of items,
   date, time stamp, delete & yet to add Download can appear like a
   table with vertical, horizontal & outline with heading") off a plain
   <ul>/<li> tree into real nested <table class="grid file-tree-grid">s,
   folder rows first landing as one <td colspan="5"> holding a <summary>.
   Reworked AGAIN same day (Sabari: "only the heading & detail should
   align properly") once that colspan cell turned out not to line up
   under the real column headings a file row's own <td>s used -- see
   file_manager.html's own render_tree_table() comment for the full
   story. A folder row now gets one real <td> per column, same as a
   file row (Delete/Download just show "—"), and toggleFileTreeDir()
   there replaces <details>/<summary> entirely: a folder is two plain
   sibling <tr>s, and clicking the folder's own row shows/hides the
   very next one.
   .file-tree-grid itself only adds the borders/header-shade on top of
   .grid's own base cell padding/font-size -- identical pairing to
   .client-grid on clients.html's own client_table(). */
.file-tree-grid th, .file-tree-grid td { border: 1px solid var(--border); }
.file-tree-grid thead th { background: var(--shade); }
/* A folder's OWN nested table (its children, once expanded) sits
   inside the file-tree-children-row's <td colspan="5"> -- indented a
   little off the cell's left edge so a deeper level visually reads as
   "inside" the folder above it, same idea .file-tree-children's own
   padding-left played before this became a table. margin/width
   together (rather than just padding-left on the <td>) keep the
   nested table's own right edge lined up with its parent's, instead
   of also creeping past it by the same 20px. */
.file-tree-grid-nested { margin: 4px 0 4px 20px; width: calc(100% - 20px); }
/* The folder row itself -- toggleFileTreeDir() (file_manager.html) is
   wired to its onclick, so the whole row reads as clickable, same as
   a folder row's cursor did back when it was a <summary>. */
.file-tree-dir-row { cursor: pointer; }
.file-tree-dir-row:hover { background: var(--shade); }
/* Its Name <td> keeps the same flex layout .file-tree-dir > summary
   used to provide (triangle glyph + name, left-aligned, small gap) --
   just on a <td> now instead of a <summary>. */
.file-tree-toggle { display: flex; align-items: center; gap: 10px; }
.file-tree-name { flex: 1; overflow-wrap: anywhere; }
/* The ▶/▼ glyph is now plain text content rendered by Jinja
   ('render_tree_table()'s own is_open check), not a CSS ::before --
   <td> has no pseudo-element hook analogous to <summary>'s. Width/
   color/size match the old ::before glyph exactly so the row's
   overall look didn't change, only how the triangle gets there. */
.file-tree-triangle {
  display: inline-block;
  width: 14px;
  color: var(--muted);
  font-size: 0.7em;
}
.file-tree-locked { color: var(--muted); font-size: 0.78rem; font-style: italic; }

/* Themes admin screens (admin_app.py, 2026-09-19) -- see db.py's own
   Theme Management section for the underlying design. themes.html's
   list reuses the existing .catalog-row/.catalog-edit generic grid-row
   helpers (defined above for Menu Builder/Menu Templates/Clients) with
   its own 3-column .theme-tree grid -- chips, label, Edit link. */
.theme-tree {
  display: grid;
  grid-template-columns: max-content max-content max-content;
  align-items: center;
  column-gap: 14px;
  list-style: none;
  margin: 0;
  padding-left: 0;
}
.theme-tree > li { display: contents; }
.theme-chip-row { display: flex; gap: 3px; }
.theme-chip {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border);
  display: inline-block;
}

/* theme_form.html -- the live preview strip at the top (mirrors the
   real 4-layer shell in miniature) and the paired color-swatch+hex-
   text input every field below it uses (Sabari: "manually edit its
   hex values" -- the color swatch alone is fiddly to type an exact
   value into, so every field is BOTH, kept in sync by the form's own
   script). */
.theme-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 18px;
  max-width: 520px;
}
.tp-header, .tp-menu, .tp-footer { padding: 8px 14px; font-size: 0.85rem; }
.tp-details { padding: 16px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tp-details-text { font-size: 0.88rem; }
.tp-details-muted { font-size: 0.78rem; margin-top: 2px; }
.tp-input {
  display: block;
  margin-top: 8px;
  padding: 4px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  width: 140px;
  cursor: default;
}
.tp-btn {
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  cursor: default;
}
.theme-section-title { font-size: 0.92rem; font-weight: 600; margin: 18px 0 10px; }
.theme-section-title:first-of-type { margin-top: 0; }
.theme-color-field { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.theme-color-field input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  background: var(--panel);
}
.theme-color-field input[type="text"] {
  width: 100px;
  margin-top: 0;
  font-family: monospace;
  text-transform: lowercase;
}

/* Ledger Edit (led_edit.py) -- the editable counterpart of Ledger
   Account (ledger.html), reusing Daybook Entry's own .de-* grid/
   header-bar/footer-bar/row-button styling wholesale (that screen's
   own comments cover the shared rules unchanged below) rather than a
   second parallel set -- only what's genuinely DIFFERENT about this
   screen's own layout gets its own rule here: a Date From/To pair
   instead of one Transaction Date, a plain Ledger Head dropdown below
   that, an S/N column day_ent.html's own grid deliberately doesn't
   have, and a footer bar with only Total/Balance in it (no Previous
   Balance box, since every row already shares the one head picked
   above -- see led_edit.py's own top docstring). */
.le-date-range-field {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}
.le-date-range-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
.le-date-range-field input[type="date"] {
  display: block;
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}
.le-head-field {
  margin-bottom: 14px;
}
.le-head-field label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}
/* Sabari, 2026-09-20: was a <select>; now a type-ahead text box (see
   led_edit.html's own comment on the Ledger Head field markup) --
   same visual size/look kept, just targeting an input instead. The
   wrap span is `position: relative` purely as a sensible anchor
   ancestor; the suggestion box itself is `position: fixed` (see
   .de-suggest's own comment further down) so this isn't load-bearing
   for its placement, only tidy. */
.le-head-input-wrap {
  position: relative;
  display: block;
  margin-top: 4px;
  width: 320px;
  max-width: 100%;
}
.le-head-field input[type="text"] {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  /* --input-bg/--input-fg -- see .dialog input's own comment further up. */
  color: var(--input-fg);
  background: var(--input-bg);
}
/* .de-footer-bar's own justify-content: space-between (day_ent.html)
   assumes two children -- Previous Balance on the left, Total/Balance
   on the right -- to actually push apart. This screen only ever has
   the one (.de-totals), so space-between would otherwise leave it
   stranded at the LEFT edge instead of lined up over the grid's own
   Credit/Debit columns on the right; flex-end here is the same fix
   .de-toolbar already applies for Daybook Entry's own solo Save
   button, for the same reason. */
.le-footer-bar-solo { justify-content: flex-end; }

/* S/N -- a column day_ent.html's own grid deliberately dropped (see
   that file's own comment on .de-grid .de-col-date and friends) but
   Sabari's own Ledger Edit screenshot carries one; narrow, centered,
   display-only (led_edit.html's own renumberRows(), never a real form
   field). Description picks up the width day_ent.html's own dropped
   Ledger Head column would have gone to -- no other column here
   carries a percentage width, so this is the only one that needs an
   explicit one under table-layout: fixed (an unclaimed column would
   otherwise size off its own first-row content instead of filling the
   rest of the table). */
.led-edit-grid .de-col-sn { width: calc(4ch + 20px); }
.led-edit-grid .led-col-desc { width: 100%; }
.le-sn-cell { text-align: center; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 8px !important; }

/* Ledger Transfer (led_tran.py/led_tran.html), 2026-09-20 -- a
   read-only, tick-to-select variant of the same grid look: same S/N
   column as led_edit's, and the same Date/Credit/Debit column widths
   day_ent.html's own .de-grid .de-col-date/.de-col-amt use -- but its
   OWN copies of those width rules rather than reusing .de-grid's,
   since this table is plain .grid (no per-cell <input> boxes at all,
   every row here is server-rendered read-only text plus one checkbox)
   and .de-grid carries a few input-specific rules (padding/border on
   `input[type="text"]`, etc.) that would be dead weight applied to a
   table that has none. */
.led-tran-grid { table-layout: fixed; }
.led-tran-grid .de-col-sn { width: calc(4ch + 20px); }
.led-tran-grid .de-col-date { width: calc(11ch + 26px); }
.led-tran-grid .de-col-amt { width: calc(17ch + 26px); }
.led-tran-grid .lt-col-desc { width: 100%; }
/* 56px -- deliberately the exact same width as .de-grid .de-col-rowbtns
   (day_ent.html/led_edit.html's own trailing +/- column) so that
   .de-opening-field's existing `margin-right: 56px` (which walks Op.
   Balance's own pair back from the header bar's flush-right edge to
   line up over the grid's actual Debit column) keeps working here
   unchanged for this screen's own trailing Select column, without
   needing a second, near-duplicate compensating rule. */
.led-tran-grid .de-col-select { width: 56px; }
.lt-select-cell { text-align: center; padding-top: 8px !important; }
.lt-select-cell input[type="checkbox"] { width: auto; margin: 0; }
.lt-select-toolbar { justify-content: flex-end; margin-bottom: 8px; }

/* Firms (firms.py/firms.html), 2026-09-20 -- the random 10-digit code
   in the Delete confirmation's own Step 1 (Sabari: "generate a random
   10 digit number in screen & ask the user to type & validate") --
   large/spaced/monospace purely so it's easy to read back correctly
   while retyping it, the one thing this whole box exists for. */
.firm-delete-code {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-align: center;
  margin: 4px 0 16px;
  color: var(--ink);
}
/* The 2nd/3rd Address lines (firms_form.html) are plain <label>s with
   no visible caption text (Address itself already labels the first
   one) -- kept as real <label> wrappers rather than bare <input>s so
   .form-page's own field rhythm (margin-bottom: 14px between rows)
   stays consistent without a one-off rule, this class only trims the
   otherwise-empty caption line's own leftover height down to 0. */
.firms-address-line { font-size: 0; margin-bottom: 8px !important; }
.firms-checkbox-row { margin-top: 2px; }

/* Stock Report (stk_rep.py, 2026-10-03) -- rides on the Stock & Sales
   grid/header/footer classes (.stock-sales-*); only what's specific to
   its Company group lines and batch sub-lines lives here. Selectors are
   chained (.stock-sales-grid.stk-rep-grid ...) so they out-rank both the
   shared even-row striping and the frozen-column background baseline.
   Striping is switched off: with batch sub-lines under items the row
   parity no longer means anything, so item lines stay plain, batch lines
   get a light shade (visibly belonging to the item above), and the
   Company line is the strongest shade. */
.stock-sales-grid.stk-rep-grid tbody tr td { background: var(--panel); }
/* Zebra stripes follow S/N (2026-10-03, Sabari: "just like Stock & Sales
   Statement ... based on S/N"): even S/N shaded, an item's continuation
   (extra batch) lines carrying their item's stripe. */
.stock-sales-grid.stk-rep-grid tbody tr.stk-rep-even td { background: var(--shade); }
.stock-sales-grid.stk-rep-grid tbody tr.stk-rep-group td { background: var(--shade-strong); font-weight: 600; }
.stock-sales-grid.stk-rep-grid tbody tr.stk-rep-item:hover td,
.stock-sales-grid.stk-rep-grid tbody tr.stk-rep-batch:hover td { background: var(--shade-strong); }
.stk-rep-grid td.batch-no, .stk-rep-grid th.batch-no { text-align: left; }
.stk-rep-print td.batch-no, .stk-rep-print tr.stk-rep-group td { text-align: left; }
.stk-rep-print tr.stk-rep-group td { font-weight: 600; background: var(--shade-strong); }
.stk-rep-print tr.stk-rep-group td.num { text-align: right; }

/* Stock Report header (2026-10-03, Sabari, from his VFP screenshot):
   combos stacked tight with right-aligned captions on the left,
   Generate (+ jump arrow) in a third grid column on the Stock Point row,
   checkboxes stacked in a column beside them, and the toolbar buttons
   bottom-aligned with the Stock Point/Generate row at the right edge. The
   panel is flex-wrap:wrap with align-items:flex-end (.panel-head-bottom),
   so the form (combos+checks) and the toolbar share a row and the
   toolbar's bottom lines up with the form's bottom, i.e. the Stock Point
   row; on a narrow window the toolbar simply wraps below. */
.stk-rep-form { display: block; flex-basis: 100%; }
.stk-rep-combos { display: grid; grid-template-columns: auto 260px auto 1fr; gap: max(0px, calc(4px + var(--lay-fy, 0px))) 12px; align-items: center; }
.stk-rep-combos > label { font-size: 12.5px; font-weight: 600; text-align: right; color: var(--ink); grid-column: 1; }
.stk-rep-combos > select {
  grid-column: 2; width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg);
}

.stk-rep-generate { grid-column: 3; grid-row: 4; display: flex; align-items: center; gap: 10px; align-self: end; margin: -3px 0 0; }
.stk-rep-checks { grid-column: 3 / span 2; grid-row: 1 / span 2; align-self: start; display: grid; grid-template-columns: auto auto; justify-content: start; gap: 8px 28px; padding-top: 4px; }
/* (2026-10-03, Sabari) checkboxes' first column left-aligns with the
   Generate button: both live in the combos grid's column 3. */
.stk-rep-toolbar { grid-column: 4; grid-row: 4; justify-self: end; align-self: end; margin: -4px 0 0; }
.stk-rep-checks .checkbox { font-size: 12.5px; }

/* Total Stock Value, top-right corner of the header (2026-10-03, Sabari:
   footer removed, box moved up into the header). Overlaps the checkbox
   block's wide grid area on purpose -- they never collide visually (the
   checkboxes are left-aligned and short). */
.stk-rep-total-field { grid-column: 4; grid-row: 1 / span 2; justify-self: end; align-self: start; width: 200px; }
.stk-rep-total-field label { display: block; text-align: right; }
/* The shared jump arrow's own 9px vertical padding made the Generate cell
   taller than the combo rows; zeroed here so the Stock Point row keeps the
   same height as the other three. */
.stk-rep-generate .stock-sales-jump-btn { padding: 0 6px; }

.stk-rep-print th:first-child, .stk-rep-print td:first-child { text-align: right; }
.stk-rep-grid td.num:first-child, .stk-rep-grid th.num:first-child { text-align: right; }

/* Stock Report (Company wise) (stk_rep_cw.py, 2026-10-03) -- same header and
   grid as the Stock Report, just three combos (Rack dropped) so the
   Generate button / toolbar sit on grid row 3 instead of row 4, and a
   three-column grid. Company Name is left-aligned (its header too). */
.stk-rep-cw-header .stk-rep-generate, .stk-rep-cw-header .stk-rep-toolbar { grid-row: 3; }
.stk-rep-cw-grid td.stk-rep-cw-name, .stk-rep-cw-grid th.stk-rep-cw-name { text-align: left; }
/* Auto-fit columns + full-width grid (Sabari, 2026-10-03, first on the
   Company wise report, then the Stock Report too): every real column is as
   wide as its content needs; a final, empty filler column soaks up the rest
   so the grid still spans the header's full width and the row lines / zebra
   stripes / header band flow on past the last column. The print/PDF tables
   have no filler -- they just shrink to their real columns. */
.stk-rep-grid th, .stk-rep-grid td, .stk-rep-cw-print th, .stk-rep-cw-print td { white-space: nowrap; }
.stk-rep-grid th:not(.stk-rep-fill), .stk-rep-grid td:not(.stk-rep-fill) { width: 1%; }
.stk-rep-grid .stk-rep-fill { width: auto; padding: 0; }
.stock-sales-print-grid.stk-rep-cw-print { width: auto; }
/* Company wise report's footer: TOTAL label right-aligned in Company Name. */
.stk-rep-cw-grid td.stk-rep-cw-total-label, .stk-rep-aw-grid td.stk-rep-cw-total-label,
.stock-sales-print-grid.stk-rep-cw-print td.stk-rep-cw-total-label { text-align: right; }

/* Stock Report (Age wise) (stk_rep_aw.py, 2026-10-03) -- rides on the Company
   wise report's header/grid styles; only its left-aligned text columns
   (Date, Item Name, Packing, Batch No, Expiry Date, Supplier Name) need a
   rule of their own. */
.stk-rep-aw-grid td.stk-rep-aw-text, .stk-rep-aw-grid th.stk-rep-aw-text { text-align: left; }
.stock-sales-print-grid.stk-rep-aw-print td.stk-rep-aw-text { text-align: left; }

/* Back Date Report slider (templates/_stk_backdate.html, 2026-10-03) -- under
   the checkbox(es) in the header's third grid column. The Stock Report has two
   checkbox rows, so its slider takes row 3 (the Rack row); the three
   one-checkbox reports (.stk-rep-cw-header) take row 2, right under theirs. */
.stk-rep-backdate { grid-column: 3 / span 2; grid-row: 3; align-self: center; display: flex; align-items: center; gap: 10px; }
.stk-rep-cw-header .stk-rep-backdate { grid-row: 2; }
.stk-rep-cw-header .stk-rep-checks { grid-row: 1; }
.stk-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12.5px; color: var(--ink); }
.stk-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.stk-switch-track { position: relative; flex: none; box-sizing: border-box; width: 32px; height: 18px; border-radius: 9px; background: #8b97a6; background: color-mix(in srgb, var(--ink) 38%, var(--bg)); border: 1px solid color-mix(in srgb, var(--ink) 55%, var(--bg)); transition: background .15s, border-color .15s; }
.stk-switch:hover .stk-switch-track { background: color-mix(in srgb, var(--ink) 48%, var(--bg)); }
.stk-switch-track::after { content: ""; position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .45); transition: transform .15s; }
.stk-switch input:checked + .stk-switch-track { background: var(--accent); border-color: var(--accent); }
.stk-switch input:checked + .stk-switch-track::after { transform: translateX(14px); }
.stk-switch input:focus-visible + .stk-switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.stk-asof-input { width: 140px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); }
.stk-asof-input[hidden] { display: none; }
.stk-asof-note { font-size: 11.5px; color: #a11d1d; }

/* Stock Ledger (stk_led.py, 2026-10-03) -- same header as Company wise (three
   rows: dates, item, stock point + Generate/toolbar on row 3). Row 1 holds
   From / To side by side; row 2 the type-ahead Item box. */
.stk-led-header .stk-rep-combos { grid-template-columns: auto max-content auto 1fr; }
.stk-led-dates { grid-column: 2; grid-row: 1; display: flex; align-items: center; gap: 10px; }
.stk-led-dates label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.stk-led-dates input[type="date"] { width: 150px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); }
.stk-led-item { grid-column: 2; grid-row: 2; position: relative; display: flex; align-items: center; gap: 10px; }
.stk-led-item input[type="text"] { width: 100%; box-sizing: border-box; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); }
.stk-led-note { position: absolute; left: 100%; margin-left: 10px; font-size: 11.5px; color: #a11d1d; white-space: nowrap; }
.stk-led-note[hidden] { display: none; }
.stk-led-header .stk-rep-combos > label[for="sl-from"] { grid-row: 1; }
.stk-led-header .stk-rep-combos > label[for="sl-item"] { grid-row: 2; }
.stk-led-header .stk-rep-combos > label[for="sl-stockpoint"], .stk-led-header .stk-rep-combos > select { grid-row: 3; }
.stk-led-grid td.stk-led-l, .stk-led-grid th.stk-led-l, .stk-led-print td.stk-led-l, .stk-led-print th.stk-led-l { text-align: left; }
.stk-led-grid tr.stk-led-open td, .stk-led-print tr.stk-led-open td { font-weight: 600; }
.stk-led-grid td.empty { text-align: center; }

/* Item Picker (static/item_pick.js, item_pick.py, 2026-10-03) -- the shared VFP-style
   multi-column item list. One popup element, fixed-positioned under the active text
   box (it flips above when there is no room below). z-index sits with the other
   drop-down lists (.de-suggest, 20) but above the sticky shell. */
.ipk-pop { position: fixed; z-index: 45; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; box-shadow: 0 6px 18px rgba(15, 23, 42, 0.22); font-size: 0.84rem; color: var(--ink); }
.ipk-pop[hidden] { display: none; }
.ipk-row { display: grid; grid-template-columns: 58px minmax(180px, 2.6fr) 90px minmax(110px, 1.5fr) 80px; column-gap: 10px; align-items: center; padding: 4px 10px; }
.ipk-with-stock .ipk-row { grid-template-columns: 58px minmax(180px, 2.6fr) 90px minmax(110px, 1.5fr) 64px 80px; }
.ipk-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ipk-head { font-weight: 600; font-size: 0.78rem; background: var(--shade-strong); border-bottom: 1px solid var(--border); }
.ipk-body { overflow-y: auto; }
.ipk-item { cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.ipk-item:hover { background: var(--shade-strong); }
.ipk-item b { font-weight: 700; }
.ipk-item.ipk-active, .ipk-item.ipk-active:hover { background: var(--accent); color: #fff; }
.ipk-num { text-align: right; }
.ipk-party .ipk-row { grid-template-columns: 58px minmax(200px, 3fr) minmax(100px, 1.2fr) 110px; }
.ipk-none { padding: 8px 10px; color: var(--muted, #64748b); font-style: italic; }
.ipk-foot { padding: 3px 10px; font-size: 0.74rem; color: var(--muted, #64748b); border-top: 1px solid var(--border); background: var(--shade-strong); }

/* ---- "=" open-in-new-tab icon on menu leaves + layer-3-only tabs
   (Sabari, 2026-10-03) ------------------------------------------------
   A menu leaf's "=" opens that screen in a new tab with only layer 3 (see
   base.html's early <script> for how the tab marks itself). Right-aligned
   in a dropdown row; a small inline icon after a top-level leaf. Normal
   view only -- hidden in Mobile view. */
.appnav-leaf-row { display: flex; align-items: center; }
.appnav-panel-list .appnav-leaf-row > a.appnav-leaf-label { flex: 1; min-width: 0; }
.nav-newtab {
  flex: none;
  padding: 5px 8px;
  margin-left: 10px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
}
.appnav-panel-list a.nav-newtab { display: inline-block; padding: 5px 8px; font-size: 0.9rem; }
.nav-newtab:hover, .appnav-panel-list a.nav-newtab:hover { background: var(--bg); color: var(--ink); }
html[data-view="mobile"] .nav-newtab { display: none; }

/* A layer-3-only tab: header, menu and footer never paint. */
html.focus-tab .shell-top, html.focus-tab .app-footer { display: none !important; }

/* Lock screen for a layer-3-only tab whose Company/Year changed under it
   (or whose sign-in ended). Above everything, including dialogs (z 100). */
.ctx-lock {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, 0.72);
}
.ctx-lock-box {
  max-width: 460px; padding: 22px 26px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.4);
}
.ctx-lock-box h2 { margin: 0 0 10px; font-size: 1.1rem; }
.ctx-lock-hint { color: var(--muted); font-size: 0.85rem; }

/* Non Moving Stocks (non_move.py, 2026-10-04) -- same header as the Stock Ledger but four
   rows: dates (+ the checkbox in the next column), Company, Supplier (type-ahead), Salesman
   + Generate/toolbar on row 4. Ids beat the Stock Ledger's generic "select -> row 3" rule. */
.nm-header .stk-rep-combos > label[for="nm-from"] { grid-row: 1; }
.nm-header .stk-rep-combos > label[for="nm-company"] { grid-row: 2; }
.nm-header .stk-rep-combos > label[for="nm-supplier"] { grid-row: 3; }
.nm-header .stk-rep-combos > label[for="nm-salesman"] { grid-row: 4; }
.nm-header .stk-rep-combos > select#nm-company { grid-row: 2; }
.nm-header .stk-rep-combos > select#nm-salesman { grid-row: 4; }
.nm-sup { grid-column: 2; grid-row: 3; position: relative; }
.nm-sup input[type="text"] { width: 100%; box-sizing: border-box; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); }
.nm-header .stk-rep-generate, .nm-header .stk-rep-toolbar { grid-row: 4; }
.nm-header .stk-rep-checks { grid-row: 1; }
/* Two-page frame (VFP page frame): tabs sit on the top edge of a bordered page; the active
   tab is joined to the page, the other one recedes. */
.nm-frame { margin-top: 10px; }
.nm-tabs { display: flex; gap: 2px; padding-left: 8px; position: relative; z-index: 1; }
.nm-tab { padding: 6px 18px; font-size: 0.86rem; color: var(--ink); background: var(--shade-strong); border: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 6px 6px 0 0; cursor: pointer; margin-bottom: 0; }
.nm-tab:hover { filter: brightness(0.97); }
.nm-tab.nm-active { font-weight: 700; background: var(--panel); border-bottom-color: var(--panel); margin-bottom: -1px; padding-top: 8px; }
.nm-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nm-page { border: 1px solid var(--border); border-radius: 0 6px 6px 6px; padding: 8px; background: var(--panel); }
.nm-page[hidden] { display: none; }
.nm-print-title { font-size: 13px; margin: 10px 0 4px; }
.nm-print-break { break-before: page; page-break-before: always; }
.nm-print td.stk-rep-cw-total-label { text-align: right; }
.nm-print tr.stk-rep-group td, .stk-led-grid tr.stk-rep-group td.stk-led-l { font-weight: 600; }

/* Stock Adjusted Report (stk_adj_rep.py, 2026-10-04) -- Non Moving Stocks' header with three
   rows: dates (+ checkbox), Company, Stock Point + Generate/toolbar on row 3. */
.sar-header .stk-rep-combos > label[for="sa-from"] { grid-row: 1; }
.sar-header .stk-rep-combos > label[for="sa-company"] { grid-row: 2; }
.sar-header .stk-rep-combos > label[for="sa-stockpoint"] { grid-row: 3; }
.sar-header .stk-rep-combos > select#sa-company { grid-row: 2; }
.sar-header .stk-rep-combos > select#sa-stockpoint { grid-row: 3; }
.sar-header .stk-rep-generate, .sar-header .stk-rep-toolbar { grid-row: 3; }

/* Purchase Reports (pur_rep_*.py, templates/_pur_rep_header.html, 2026-10-04) -- Non Moving Stocks'
   header with three rows: dates (+ two stacked checkboxes), Purchase Category, Supplier (type-ahead)
   + Generate/toolbar on row 3. Ids beat the Stock Ledger's generic "select -> row 3" rule. */
.pr-header .stk-rep-combos > label[for="pr-from"] { grid-row: 1; }
.pr-header .stk-rep-combos > label[for="pr-category"] { grid-row: 2; }
.pr-header .stk-rep-combos > label[for="pr-supplier"] { grid-row: 3; }
.pr-header .stk-rep-combos > select#pr-category { grid-row: 2; }
.pr-sup { grid-column: 2; grid-row: 3; position: relative; }
.pr-sup input[type="text"] { width: 100%; box-sizing: border-box; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); }
.pr-header .stk-rep-generate, .pr-header .stk-rep-toolbar { grid-row: 3; }
.pr-header .stk-rep-checks.pr-checks { grid-row: 1 / span 2; grid-template-columns: auto; gap: 6px; }
.pr-print th, .pr-print td { font-size: 9px; padding: 2px 4px; }

/* Purchase Report (Bill wise Details) (pur_rep_bw_det.py, Sabari 2026-10-04) -- three stacked panels: the bill
   list, the selected bill's item lines, then Tax Detail (left) + Less/Db-Cr/Error/TCS/Round off (right). */
.pbd-wrap { border: 1px solid var(--border); border-radius: 8px; overflow: auto; margin-bottom: 10px; }
.pbd-wrap:focus { outline: none; } /* no focus ring (2026-10-10, Sabari) -- the highlighted bill row shows where you are */
.pbd .stock-sales-grid.stk-rep-grid tbody tr { cursor: default; }
.pbd .pbd-list table.stock-sales-grid.stk-rep-grid tbody tr.pbd-sel td { background: var(--accent); color: #fff; }
.pbd .pbd-list .stk-rep-item td, .pbd .pbd-items .stk-rep-item td, .pbd .pbd-tax .stk-rep-item td { white-space: nowrap; }
.pbd-bottom { display: flex; gap: 14px; align-items: flex-start; }
.pbd-bottom .pbd-tax { flex: 1 1 auto; margin-bottom: 0; }
.pbd-extras { flex: 0 0 250px; display: flex; flex-direction: column; gap: 2px; }
.pbd-extra { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.pbd-extra label { font-weight: 700; font-size: 0.85rem; }
.pbd-extra input { width: 110px; text-align: right; padding: 1px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--input-bg); color: var(--input-fg); font-size: 0.88rem; }
.pbd-block { break-inside: avoid; page-break-inside: avoid; margin-bottom: 10px; border-top: 1px solid var(--border); padding-top: 4px; }
.pbd-block table { width: 100%; }
.pbd-print-extras { font-size: 9px; margin: 2px 4px 0; }
.pbd-print-total { font-weight: 700; text-align: right; margin-top: 8px; }
.pbd-printpage .pbd-print-items th, .pbd-printpage .pbd-print-items td,
.pbd-printpage .pbd-print-tax th, .pbd-printpage .pbd-print-tax td { font-size: 9px; padding: 2px 4px; }
.pbd-printpage .pbd-print-items thead th, .pbd-printpage .pbd-print-tax thead th { position: static; }

.pbd-bill td { font-weight: 600; }
.pbd-bill th { text-transform: none; }

/* Sales Reports header (sal_rep_common.py / _sal_rep_header.html, Sabari 2026-10-04): two columns of
   label+field pairs (Date From/To, Sales Category, Customer | Salesman, Area, Login User), the
   Generate right next to the Login User combo on row 3, the toolbar on row 3 at the right edge
   (bottom-aligned with the last row), the total top-right. Grid columns: 1 label | 2 field | 3 label | 4 field |
   5 Generate (row 1: Term label) | 6 (row 1: Term combo) | 7 spacer. */
.sr-header .stk-rep-combos { grid-template-columns: auto max-content auto 175px auto 112px 1fr; column-gap: 8px; }
/* Tighter than the Purchase header so the whole toolbar (Export XL, PDF x2, Print) still fits on one line on a
   1366-px-wide screen. */
.sr-header .stk-led-dates input[type="date"] { width: 132px; }
.sr-header .stk-rep-toolbar { gap: 6px; }
.sr-header .stk-rep-toolbar .btn-toolbar { padding-left: 9px; padding-right: 9px; }
.sr-header .stk-rep-combos > label.sr-l1 { grid-column: 1; }
.sr-header .stk-rep-combos > .sr-f1 { grid-column: 2; }
.sr-header .stk-rep-combos > label.sr-l2 { grid-column: 3; }
.sr-header .stk-rep-combos > .sr-f2 { grid-column: 4; }
.sr-header .stk-rep-combos > label.sr-l3 { grid-column: 5; justify-self: end; }
.sr-header .stk-rep-combos > .sr-f3 { grid-column: 6; }
.sr-header .stk-rep-combos > .sr-r1 { grid-row: 1; }
.sr-header .stk-rep-combos > .sr-r2 { grid-row: 2; }
.sr-header .stk-rep-combos > .sr-r3 { grid-row: 3; }
.sr-header .stk-rep-combos > select.sr-f1, .sr-header .stk-rep-combos > select.sr-f2, .sr-header .stk-rep-combos > select.sr-f3 { width: 100%; }
.sr-header .stk-rep-combos > select:disabled { opacity: .55; cursor: not-allowed; }
/* Customized 1 (2026-11-14): the combos a Customized 1 client has no data for (Salesman, Area, Supply, Login User) are not shown; Generate sits right of the Customer box. */
.sr-header .stk-rep-combos > .sr-hide { display: none !important; }
.sr-header.sr-c1 .stk-rep-generate { grid-column: 3; grid-row: 3; justify-self: start; }
.sr-header .pr-sup { position: relative; }
.sr-header .stk-rep-generate { grid-column: 6; grid-row: 3; justify-self: start; }   /* left edge in line with the Term / Supply combos (3rd column) */
/* (2026-10-07: Generate now stays in the 3rd column on every Sales Report, with or without a last combo.) */
.sr-header .stk-rep-toolbar { grid-column: 6 / span 2; grid-row: 3; flex-wrap: wrap; justify-content: flex-end; }
.sr-header .stk-rep-total-field { grid-column: 7; grid-row: 1 / span 2; }
/* Sales Return Reports (2026-10-27): two boxes (Gross Value, Total Amount) stacked top-right, caption to the left of each box; SR No From / To boxes; list column widths. */
.sr-header .stk-rep-total-field.srr-tot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; align-self: center; width: 250px; }
.sr-header .stk-rep-total-field.srr-tot label { white-space: nowrap; margin: 0; }
.sr-header .stk-rep-total-field.srr-tot input { width: 130px; }
.sr-header .stk-rep-total-field.srr-t1 { grid-row: 1; }
.srr-header .stk-rep-generate, .srr-header .stk-rep-toolbar { grid-row: 2; }       /* two header rows only: Date / Salesman, Customer / Mode */
.prr-header .stk-rep-generate { grid-column: 3; grid-row: 2; }        /* Purchase Return Reports: Date / Supplier only -- Generate right of the Supplier box */
.srr .pbd-list th.srr-w1 { width: 70px; }
.srr .pbd-list th.srr-w2 { width: 120px; }
.srr .pbd-list th.srr-wc { width: 100%; }
.srr .pbd-list th.srr-wcity { width: 190px; }
.srr .pbd-adj .pbd-adj-grid th:nth-child(1) { width: 140px; }
/* Scheme combo (2026-10-21; only a client with Sales Schemes): a 4th label + field pair to the right of Term, the total moves one pair right. */
.sr-header.sr-has-sch .stk-rep-combos { grid-template-columns: auto max-content auto 175px auto 112px auto 140px 1fr; }
.sr-header .stk-rep-combos > label.sr-l4 { grid-column: 7; justify-self: end; }
.sr-header .stk-rep-combos > .sr-f4 { grid-column: 8; width: 100%; }
.sr-header.sr-has-sch .stk-rep-toolbar { grid-column: 6 / span 4; }
.sr-header.sr-has-sch .stk-rep-total-field { grid-column: 9; }

/* Sales Report (Customer wise Summary) (sal_rep_cus_sum.py, Sabari 2026-10-04): Grid 2 (companies) and Grid 3 (items)
   side by side under the customer list. */
.csm-detail { display: flex; gap: 14px; align-items: flex-start; }
.csm-detail .csm-companies { flex: 0 0 34%; margin-bottom: 0; }
.csm-detail .csm-items { flex: 1 1 auto; margin-bottom: 0; min-width: 0; }
.csm .pbd-list tfoot td { position: sticky; bottom: 0; }

/* Sales Report (Salesman wise Summary) (sal_rep_sm_sum.py, Sabari 2026-10-04): the salesman list and the selected
   salesman's company grid side by side. */
.sms-row { display: flex; gap: 14px; align-items: flex-start; }
.sms-row .sms-list { flex: 1 1 58%; min-width: 0; margin-bottom: 0; }
.sms-row .sms-comp { flex: 1 1 42%; min-width: 0; margin-bottom: 0; }
.sms .pbd-list tfoot td { position: sticky; bottom: 0; }

/* Sales Report (Bill wise Summary): the date sub-heading line above each day's bills. */
.stk-rep-subhead td { background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-bottom: 1px solid var(--border); padding-top: 3px; padding-bottom: 3px; }

/* ---------------------------------------------------------------------
   Short header (Layer 1) -- every screen EXCEPT the Dashboard
   (Sabari, 2026-10-05; app.py's shell_compact flag -> .shell-compact on
   .shell-top). The Dashboard keeps the tall header untouched.
   One row, 60% as tall as the Dynamic Menu bar (a small script in
   base.html sets .topbar's height from .appnav's measured height):
     left   = Firm name, bold, FY-sized (the script shrinks it to fit)
     centre = FY range with its  /  arrows
     right  = login name + Logout, same right-edge position as before
   Dropped here: address/city, Valid Until, crumb. FY is 1pt smaller than
   the tall header's (0.86em -> 0.775rem). Normal view only -- Mobile view
   keeps its stacked layout.
   --------------------------------------------------------------------- */
html:not([data-view="mobile"]) .shell-compact .topbar {
  padding: 0 20px;
  height: 25px; /* fallback; base.html's script sets 60% of the menu-bar height */
}
html:not([data-view="mobile"]) .shell-compact .topbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  height: 100%;
  gap: 14px;
}
html:not([data-view="mobile"]) .shell-compact .brand-block { display: contents; }
html:not([data-view="mobile"]) .shell-compact .brand {
  grid-column: 1;
  justify-self: start;
  max-width: 100%;
  min-width: 0;
  font-size: 0.775rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html:not([data-view="mobile"]) .shell-compact .brand-line { display: none; }
html:not([data-view="mobile"]) .shell-compact .brand-line.brand-line-fy {
  display: block;
  grid-column: 2;
  justify-self: center;
  font-size: 0.775rem;
  white-space: nowrap;
}
html:not([data-view="mobile"]) .shell-compact .topbar-actions {
  grid-column: 3;
  justify-self: end;
  margin-left: 0;
  align-items: center;
}
html:not([data-view="mobile"]) .shell-compact .user-fy,
html:not([data-view="mobile"]) .shell-compact .crumb { display: none; }
/* PC: the page-path crumb (row 3 of the right block) is never shown -- on the Dashboard it only repeated the "Dashboard" tab (Sabari, 2026-11-23).
   Phone keeps it: there it is the screen title for a screen that is not a menu leaf. */
html:not([data-view="mobile"]) .user-block .crumb { display: none; }

/* Item wise Party wise Sales (iwpw_sal.py, Sabari 2026-10-05), header from his VFP screenshot, rows as tight as the
   Stock Report's. Column 1: Company, Item Group, Item Name; column 2: Year + Month, Area, Sales Category; Generate under the checkboxes; the checkboxes are one
   column top aligned with row 1, the Total is top-right and the toolbar bottom aligned with row 3. Grid columns:
   1 label | 2 field | 3 label | 4 field | 5 label | 6 field | 7 checks | 8 spacer (Total, toolbar). */
.ip-grid { display: grid; grid-template-columns: auto 230px auto 92px auto 118px auto 1fr; gap: 4px 8px; align-items: center; }
.ip-grid > label:not(.checkbox) { font-size: 12.5px; font-weight: 600; text-align: right; color: var(--ink); }
.ip-grid > select, .ip-itemwrap input[type="text"] {
  width: 100%; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg);
}
.ip-itemwrap { position: relative; }
.ip-itemwrap input[type="text"] { box-sizing: border-box; }
.ip-grid > input[type="date"] {
  width: 100%; box-sizing: border-box; padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg);
}
/* Bounced Orders Report (bounce_rep.py): From / To on row 1, Company Name on row 2, Generate + toolbar right aligned on row 2, Total Value top-right; three tabs. */
.ip-grid.bn-grid { grid-template-columns: auto 190px auto 160px 1fr; }
.ip-grid.bn-grid > .bn-co { grid-column: 2 / span 3; }
.ip-grid.bn-grid > .ip-total { grid-column: 5; grid-row: 1; justify-self: end; align-self: start; width: 200px; }
.ip-grid.bn-grid > .bn-actions { grid-column: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.bn-actions .toolbar-actions { margin: 0; flex-wrap: nowrap; gap: 6px; }
.bn-tabs { display: flex; gap: 2px; margin: 10px 0 0; border-bottom: 1px solid var(--border); }
.bn-tab { border: 1px solid var(--border); border-bottom: 0; background: var(--shade-strong); color: var(--ink); padding: 5px 14px; font-size: 0.88rem; font-weight: 600; border-radius: 6px 6px 0 0; cursor: pointer; }
.bn-tab.active { background: var(--panel); position: relative; top: 1px; }
.bn-print-h { font-size: 1rem; margin: 14px 0 4px; }
@media print { .bn-pane { display: none !important; } }
/* Item wise Party wise Free Claim Report (iwpw_claim.py): the two date fields are wider than Year / Month. */
.ip-grid.ic-grid { grid-template-columns: auto 230px auto 140px auto 140px auto 1fr; }
.ip-grid > select:disabled { opacity: .55; cursor: not-allowed; }
.ip-r1 { grid-row: 1; }
.ip-r2 { grid-row: 2; }
.ip-r3 { grid-row: 3; }
.ip-c1 { grid-column: 1; }
.ip-c2 { grid-column: 2; }
.ip-c3 { grid-column: 3; }
.ip-c4 { grid-column: 4; }
.ip-c5 { grid-column: 5; }
.ip-c6 { grid-column: 6; }
.ip-checks { grid-column: 7; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 4px; align-self: start; padding-left: 14px; }
.ip-checks .checkbox { font-size: 12.5px; white-space: nowrap; }
.ip-checkrow { display: flex; align-items: center; gap: 22px; }
.ip-grid > .ip-span { grid-column: 4 / span 3; }
.ip-grid > .ip-gen { grid-column: 7; justify-self: start; align-self: end; margin: -3px 0 0; padding: 0 0 0 14px; }
/* The toolbar spans the checkbox column and the spacer so all four buttons stay on one line, right-aligned. */
.ip-grid > .ip-tools { grid-column: 7 / span 2; justify-self: end; align-self: end; margin: -4px 0 0; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
.ip-grid > .ip-tools .btn-toolbar { padding-left: 9px; padding-right: 9px; }
.ip-grid > .ip-total { grid-column: 8; grid-row: 1 / span 2; justify-self: end; align-self: start; width: 200px; }
.ip-grid > .ip-total label { display: block; text-align: right; }
.stk-led-grid tr.stk-rep-subtotal td, .stk-led-print tr.stk-rep-subtotal td { font-weight: 600; }
.stock-sales-grid.stk-rep-grid tbody tr.stk-rep-subtotal td { background: var(--panel); border-top: 1px solid var(--border); }

/* ---- Tighter dropdown menu rows, like the desktop (VFP) app (Sabari,
   2026-10-05: "make the menu vertically tighter similar to desktop app").
   Normal view only -- Mobile view keeps the roomy touch-sized rows. Rows
   drop from ~34px to ~22px; panel padding, separators and the "="
   open-in-new-tab icon shrink with them. ---- */
html:not([data-view="mobile"]) .appnav-dropdown > .appnav-panel,
html:not([data-view="mobile"]) .appnav-subdropdown > .appnav-panel { padding: 3px; }
html:not([data-view="mobile"]) .appnav-subdropdown > .appnav-panel { top: -4px; }
html:not([data-view="mobile"]) .appnav-panel-list a,
html:not([data-view="mobile"]) .appnav-panel-list .menu-disabled,
html:not([data-view="mobile"]) .appnav-subdropdown > summary {
  padding: 2px 10px;
  line-height: 1.3;
  border-radius: 4px;
  font-size: 1rem;
}
html:not([data-view="mobile"]) .appnav-subdropdown { margin: 0; }
html:not([data-view="mobile"]) .nav-newtab,
html:not([data-view="mobile"]) .appnav-panel-list a.nav-newtab {
  padding: 2px 8px;
  line-height: 1.3;
  border-radius: 4px;
  font-size: 1rem;
}
html:not([data-view="mobile"]) .appnav-panel .appnav-separator { margin: 2px 4px; }
html:not([data-view="mobile"]) .appnav-panel .appnav-separator-label { padding: 3px 10px 0; }

/* ---- Salesman wise Sales (graph) (sal_rep_sm_gr.py, Sabari 2026-10-05) ----
   Header: Date From/To, then Show Graph / Pie Graph, then Generate + toolbar. Charts are inline SVG (drawn in
   sal_rep_sm_gr.py); Main = categorical slot 1 (blue), Sub = slot 2 (orange), donut slices take the 8 categorical
   slots in order, "Others" = grey. Ink comes from the page's own text colours. ---- */
.sg-header { display: block; }
.sg-form { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 28px; }
.sg-row { display: flex; align-items: center; gap: 10px; }
.sg-row label { font-weight: 600; }
.sg-checks { gap: 22px; }
.sg-actions { margin-left: auto; gap: 14px; }
.sg-chart { margin: 14px 0 8px; }
.sg-title { text-align: center; font-size: 1.35rem; font-weight: 700; color: #2a78d6; margin: 0 0 4px; }
.sg-key { display: flex; justify-content: center; gap: 22px; font-size: 0.9rem; margin-bottom: 4px; }
.sg-key i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.sg-svg { display: block; width: 100%; max-width: 1000px; height: auto; margin: 0 auto; }
.sg-main { fill: #2a78d6; background: #2a78d6; }
.sg-sub { fill: #eb6834; background: #eb6834; }
.sg-s1 { fill: #2a78d6; } .sg-s2 { fill: #eb6834; } .sg-s3 { fill: #1baf7a; } .sg-s4 { fill: #eda100; }
.sg-s5 { fill: #e87ba4; } .sg-s6 { fill: #008300; } .sg-s7 { fill: #4a3aa7; } .sg-s8 { fill: #e34948; }
.sg-s9 { fill: #898781; }
.sg-slice { stroke: #fff; stroke-width: 2; }
.sg-grid { stroke: #e1e0d9; stroke-width: 1; }
.sg-axis { stroke: #c3c2b7; stroke-width: 1; }
.sg-tick, .sg-xlabel, .sg-axtitle, .sg-pct, .sg-leg, .sg-leg-v, .sg-ctr-l { fill: #52514e; font-size: 13px; }
.sg-axtitle { font-weight: 700; fill: #0b0b0b; }
.sg-pct, .sg-leg, .sg-leg-v { fill: #0b0b0b; font-size: 14px; }
.sg-ctr-l { font-size: 13px; }
.sg-ctr-v { fill: #0b0b0b; font-size: 22px; font-weight: 700; }
.sg-table-wrap { max-width: 900px; margin: 10px auto 0; }
@media print {
  .sg-svg { max-width: 100%; }
  .sg-table-wrap { max-width: none; }
}

/* ---- Preferences (preference.py, Sabari 2026-10-05) -- the VFP "Preference (Values)" dialog laid out on a
   2-column grid: percent boxes on the left, Discount for Expiry Return / UPI ID on the right, the invoice
   comment across the bottom. ---- */
.pf-form { max-width: 1180px; margin: 10px auto 0; }
.pf-frame { margin-top: 0; }
.pf-page { padding: 22px 20px; }
.pf-check { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; cursor: pointer; }
.pf-check input[type="checkbox"] { width: auto; margin: 0; }
.pf-page .pf-check { display: flex; margin-bottom: 14px; }
/* tick lists (Sales / Purchase): flow down a column, then into the next, so the page never grows taller than the window (rows set by the page script) */
.pf-ticks { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, max-content); column-gap: 28px; align-content: start; }
.pf-ticks .pf-check { margin-bottom: 10px; }
.pf-ticks .pf-item { display: flex; align-items: center; gap: 22px; margin-bottom: 10px; white-space: nowrap; }
.pf-ticks .pf-item .pf-check { margin-bottom: 0; }
.pf-ticks .pf-sub[hidden] { display: none; }
.pf-page .pf-note { margin-top: 0; }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 30px; max-width: 800px; margin: 0 auto; }
.pf-cell { display: flex; align-items: center; gap: 12px; }
.pf-c1 { grid-column: 1; }
.pf-c2 { grid-column: 2; }
.pf-all { grid-column: 1 / -1; }
.pf-r1 { grid-row: 1; } .pf-r2 { grid-row: 2; } .pf-r3 { grid-row: 3; } .pf-r4 { grid-row: 4; } .pf-r5 { grid-row: 5; } .pf-r6 { grid-row: 6; } .pf-r7 { grid-row: 7; } .pf-r8 { grid-row: 8; }
.pf-l { flex: none; width: 190px; text-align: right; font-weight: 600; margin: 0; }
.pf-c2 .pf-l { width: 240px; white-space: nowrap; }
.pf-actions .btn { text-decoration: none; color: inherit; }
.pf-actions .btn-primary { color: #fff; }
.pf-num { width: 90px; text-align: right; }
.pf-wide { flex: 1; min-width: 0; }
.pf-actions { justify-content: center; gap: 14px; margin-top: 22px; }
.pf-error { max-width: 1180px; margin: 6px auto; }
@media (max-width: 760px) {
  .pf-ticks { grid-auto-flow: row; grid-template-rows: none !important; grid-auto-columns: 1fr; }
  .pf-grid { grid-template-columns: 1fr; }
  .pf-c1, .pf-c2, .pf-all { grid-column: 1; }
  .pf-r1, .pf-r2, .pf-r3, .pf-r4, .pf-r5, .pf-r6, .pf-r7, .pf-r8 { grid-row: auto; }
  .pf-l, .pf-c2 .pf-l { width: 130px; }
}

/* ---- GST scheme section of the Firm screen (firms.py, Sabari 2026-10-05) ---- */
.gst-hist-table { max-width: 640px; margin: 8px 0 14px; }
.gst-change { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 14px 22px; margin: 10px 0 4px; }
.gst-change label { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 0.85rem; color: var(--muted); }
.gst-change select, .gst-change input[type="date"], .gst-change input[type="text"] { font-size: 1rem; color: var(--ink); padding: 6px 8px; }
.gst-hint { margin: 12px 0 0; font-size: 0.85rem; color: var(--muted); }
.gst-pending { max-width: 760px; margin: 10px 0 14px; }
.gst-confirm { display: flex; gap: 12px; }
.muted { color: var(--muted); }
/* Firm screen: Edit (left) and GST Scheme (right) on one row, as wide as the form (640px) so GST Scheme lines up
   with the right end of the Firm Name box. */
.firm-top-row { display: flex; align-items: center; gap: 12px; max-width: 640px; margin-bottom: 14px; }
.firm-top-row #gst-open-btn { margin-left: auto; }

/* Select Company, no companies yet: the Client Admin's "Add your first company" link (2026-10-05). */
.selectwin-addfirm { display: inline-block; margin-top: 12px; text-decoration: none; }

/* Import Data review screen (admin, 2026-10-05): the firm list shown after a legacy .zip is read. */
.import-review-grid td, .import-review-grid th { vertical-align: top; }
.import-review-grid td .hint { margin: 2px 0 0; }
.import-review-grid input[type="text"], .import-review-grid input[type="date"], .import-review-grid select { max-width: 100%; }
.import-review-grid td.num .hint { white-space: nowrap; }

/* Item Master (POS) form (items_pos_form.html): the "Inclusive of Tax" checkbox sits to the right of Sales Rate. */
.ip-rate-row { display: flex; align-items: flex-end; gap: 18px; }
.ip-rate-row > label:first-child { flex: 0 1 220px; }
.ip-rate-row .ip-incl { display: flex; align-items: center; gap: 6px; padding-bottom: 8px; white-space: nowrap; }
.ip-rate-row .ip-incl input[type="checkbox"] { width: auto; margin: 0; }

/* Customer Master (POS) form (customer_pos_form.html): Title is a narrow box beside Customer Name, the address lines
   stack under one caption, and the GST Number shares a row with its validity dates. */
.cp-title-row > .cp-title { flex: 0 0 120px; }
.form-page .cp-addr { margin-top: 6px; }
.cp-gst-row > .cp-gst { flex: 1.4; }
.cp-trans-row > .cp-disc { flex: 0 0 110px; }

/* Header centre slot (base.html {% block header_center %}, 2026-10-06): a small note a screen puts in layer 1, centred in the
   space between the FY (centre of the short header) and the login name -- Sales Entry (Non Batch wise)'s "GST: Regular / Composition". */
html:not([data-view="mobile"]) .shell-compact .topbar-actions { display: flex; width: 100%; min-width: 0; justify-content: flex-end; } /* flex-end: without a centre note the user block stays at the right edge (2026-10-07 fix) */
html:not([data-view="mobile"]) .shell-compact .topbar-actions .user-block { margin-left: 0; flex: 0 0 auto; }
.hdr-center { margin: 0 auto; padding: 0 12px; display: flex; align-items: center; }
.hdr-pill { font-size: 0.7rem; line-height: 1.5; padding: 0 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid color-mix(in srgb, currentColor 45%, transparent); color: inherit; }
.hdr-pill:empty { display: none; }
.hdr-pill.warn { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
html[data-view="mobile"] .hdr-center { margin: 4px 0; padding: 0; }

/* Link from a row posted by a Sales Entry bill to that bill (Daybook Entry, Ledger Edit, Day Book, Ledger): a small
   arrow at the right end of the Description cell. */
.de-desc-cell { position: relative; }
.de-desc-cell.has-sale-link .de-desc-input { padding-right: 2.4em; }
.de-desc-cell .de-sale-link { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.sale-link-cell { position: relative; padding-right: 2.6em; }
.sale-link-cell .sale-bill-link { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
@media print { .sale-bill-link { display: none; } .sale-link-cell { padding-right: 6px; } }

/* Customer Account Statement (cus_stmt.py, 2026-10-08) -- filter rows, the grid's left-aligned text columns, bold bills that
   still owe, the O/B and C/B lines, and the four footer boxes (Opening Balance / Sales / Receipts / Closing Balance). */
.cs-form { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.cs-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; font-size: 0.85rem; color: var(--muted); }
.cs-row input[type="date"], .cs-row select {
  padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem;
  color: var(--input-fg); background: var(--input-bg);
}
.cs-cust { position: relative; flex: 0 1 380px; min-width: 240px; }
.cs-cust input { width: 100%; }
.cs-check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.cs-toolbar { margin-left: auto; }
.cs-wrap { max-height: 62vh; overflow: auto; }
.cs-grid th.cs-l, .cs-grid td.cs-l, .cs-print th.cs-l, .cs-print td.cs-l { text-align: left; }
.cs-grid td, .cs-grid th, .cs-print td, .cs-print th { white-space: nowrap; }
.cs-grid tr.cs-owing td, .cs-print tr.cs-owing td, .cs-grid tr.cs-edge td, .cs-print tr.cs-edge td { font-weight: 700; }
.cs-grid tr.cs-ob td, .cs-grid tr.cs-cb td { background: var(--shade-strong); }
.cs-boxes { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: center; margin-top: 10px; }
.cs-boxes label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.cs-boxes input { width: 130px; text-align: right; font-weight: 700; background: var(--shade); color: var(--ink);
  border: 1px solid var(--border); border-radius: 4px; padding: 4px 6px; }
/* Printed / PDF statement: the four balance figures as two rows of two (Sabari, 2026-10-11), label left, figure right in each half. */
.cs-print-boxes { display: grid; grid-template-columns: repeat(2, 260px); gap: 3px 48px; justify-content: start; margin-top: 6px; font-size: 0.85rem; }
.cs-print-boxes span { display: flex; justify-content: space-between; gap: 12px; }

/* Side by Side (side_by_side.py): trend arrow after the paise of this year's figure -- up green / down red, same &uarr; &darr;
   glyphs as the Menu Builder's move buttons. Screen only: the arrow carries .no-print and the room reserved for it is a
   @media screen padding, so Print / PDF are unchanged. The arrow is positioned in that reserved space so the numbers stay
   in one straight column whether or not a row has an arrow. */
/* The two accounting periods in the header (client feedback, 2026-10-10): bold and centred over their two columns everywhere
   (screen, print, PDF); the 2px size increase is screen only -- print / PDF keep the normal header size. */
.tb-sbs-grid th.sbs-period { text-align: center; font-weight: 800; }
@media screen {
  .tb-sbs-grid td.sbs-cur, .tb-sbs-grid th.sbs-cur { position: relative; padding-right: 26px; }
  .tb-sbs-grid .sbs-arrow { position: absolute; right: 8px; font-weight: 700; font-size: 1.1em; }
  .tb-sbs-grid th.sbs-period { font-size: calc(var(--grid-header-size) + 2px); }
}
/* Side by Side on paper in PORTRAIT (Print and PDF Portrait; client feedback, 2026-10-10): the grid text drops to 8pt (the VFP
   Verdana 8 look) so every record fits on one row instead of the longer ledger names wrapping onto two lines. Landscape keeps
   its normal size (its description column is wide enough), as does the screen. */
@media print and (orientation: portrait) {
  .tb-sbs-grid th, .tb-sbs-grid td, .tb-sbs-grid th.sbs-period { font-size: 8pt; }
  .tb-sbs-grid td { white-space: nowrap; }
}
.tb-sbs-grid .sbs-up { color: #15803d; }
.tb-sbs-grid .sbs-down { color: #b91c1c; }

/* ==== Focus marker (2026-10-10) ====================================================================================
   Shows which control the cursor is in, on every page. Colour: --focus-color = the login's own choice (Display > Focus, set
   inline on <html>), else the theme's --focus (Admin > Themes), else --accent. Style (html[data-focus]): none = Steady (the
   default), "blink" = the marker pulses, "off" = nothing added (the browser's own ring is left alone). Text controls get an
   inner + outer ring (box-shadow, so nothing in a grid moves by a pixel; the inner part is never clipped by a cell); buttons,
   links, ticks and menu headings get an outline (not the report grids -- .stock-sales-grid-wrap / .pbd-wrap / .cs-wrap -- where the highlighted
   row is the marker; Sabari 2026-10-10). Blink is steady in Mobile view and for anyone whose system asks for reduced
   motion. Nothing here applies to print / PDF. */
html { --focus-color: var(--focus, var(--accent, #2563eb)); --focus-ring: color-mix(in srgb, var(--focus-color) 40%, transparent); }

html:not([data-focus="off"]) :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="color"], [type="range"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"]), select, textarea):focus {
  outline: none;
  border-color: var(--focus-color);
  box-shadow: inset 0 0 0 1px var(--focus-color), 0 0 0 3px var(--focus-ring);
}
html:not([data-focus="off"]) :is(input[type="checkbox"], input[type="radio"], input[type="file"], input[type="range"], input[type="button"], input[type="submit"], input[type="reset"], button:not(.acc-alert-btn), a[href], summary, [tabindex]:not([tabindex="-1"], .stock-sales-grid-wrap, .pbd-wrap, .cs-wrap)):focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

@keyframes acc-focus-blink-box {
  0%, 100% { border-color: var(--focus-color); box-shadow: inset 0 0 0 1px var(--focus-color), 0 0 0 3px var(--focus-ring); }
  50%      { border-color: var(--border);      box-shadow: inset 0 0 0 0 transparent, 0 0 0 0 transparent; }
}
@keyframes acc-focus-blink-outline {
  0%, 100% { outline-color: var(--focus-color); }
  50%      { outline-color: transparent; }
}
html[data-focus="blink"] :is(input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="color"], [type="range"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"]), select, textarea):focus {
  animation: acc-focus-blink-box 1s infinite;
}
html[data-focus="blink"] :is(input[type="checkbox"], input[type="radio"], input[type="file"], input[type="range"], input[type="button"], input[type="submit"], input[type="reset"], button:not(.acc-alert-btn), a[href], summary, [tabindex]:not([tabindex="-1"], .stock-sales-grid-wrap, .pbd-wrap, .cs-wrap)):focus-visible {
  animation: acc-focus-blink-outline 1s infinite;
}
@media (prefers-reduced-motion: reduce) {
  html[data-focus="blink"] *:focus, html[data-focus="blink"] *:focus-visible { animation: none !important; }
}
html[data-view="mobile"][data-focus="blink"] *:focus, html[data-view="mobile"][data-focus="blink"] *:focus-visible { animation: none !important; }

@media print {
  *:focus, *:focus-visible { outline: none !important; box-shadow: none !important; animation: none !important; }
}

/* Display > Focus picker (base.html) */
.focus-style-switch { display: flex; gap: 6px; margin-bottom: 8px; }
.focus-style-switch button { flex: 1; border: 1px solid var(--border); background: var(--panel); color: var(--ink); padding: 5px 8px; border-radius: 6px; font-size: 0.84rem; cursor: pointer; }
.focus-style-switch button.active { background: var(--accent); border-color: var(--accent); color: white; }
.focus-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.focus-swatch { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.18); cursor: pointer; padding: 0; }
.focus-swatch.active { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.focus-custom { width: 26px; height: 26px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }

/* Menu Builder drag & drop (2026-10-10; menu_builder.html + admin_app.move_menu_item_to): the caption / grip is the handle, the
   row under the pointer shows where the item will land -- a line above, a line below, or a tint when it goes INSIDE a heading. */
.catalog-caption, .catalog-handle { cursor: grab; }
.catalog-handle { display: inline-block; width: 14px; margin-right: 4px; text-align: center; color: var(--muted); opacity: 0.55; user-select: none; }
.catalog-row:hover .catalog-handle { opacity: 1; }
.catalog-tree li.dragging > .catalog-row > * { opacity: 0.4; }
.catalog-row.drop-before > * { box-shadow: inset 0 3px 0 var(--accent); }
.catalog-row.drop-after > * { box-shadow: inset 0 -3px 0 var(--accent); }
.catalog-row.drop-inside > * { background: color-mix(in srgb, var(--accent) 16%, transparent); }

/* Customer Balance Report (cus_bal.py, 2026-10-10): the grid with the customer's code / address / phones in a panel beside it. */
.cb-layout { display: flex; gap: 16px; align-items: flex-start; }
.cb-grid-wrap { flex: 1 1 auto; min-width: 0; }
.cb-info { flex: 0 0 280px; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; background: var(--shade);
  font-size: 0.88rem; line-height: 1.45; }
.cb-info-block { margin-top: 10px; }

/* Form-control standard (client feedback, 2026-10-10): every single-line box and combo in the client app is one height (29px)
   whatever screen styles it, so a text box sitting beside a combo no longer looks taller or shorter. The boxes inside entry
   grids (Sales / Purchase / Day Book, any table cell, and the amount slots that sit under the Day Book / ledger grid columns)
   keep their compact 26px so a grid row stays slim. Amount boxes keep their right alignment -- only the height is set here.
   Vertical padding is taken to 0 because a box with a fixed height centres its own text, and the old 6-8px padding on the
   data-entry forms would otherwise squeeze the text inside 29px. */
:root { --ctl-h: 29px; }
:is(input:not([type]), input[type="text"], input[type="date"], input[type="number"], input[type="password"], input[type="search"],
    input[type="email"], input[type="tel"], input[type="time"], input[type="month"], select:not([multiple]):not([size])):not(:is(td, th, .de-grid, .sep-grid, .op-col-slot) *) {
  height: var(--ctl-h) !important;
  box-sizing: border-box;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

/* One left edge in the filter rows (client feedback, 2026-10-10): the first label of every row of the statement / balance
   filters sits in a fixed-width right-aligned column -- the same look as the stock-report filters -- so Date From, Customer,
   Supplier and Sale Category boxes all start at the same x down the page. */
.cs-row > label:not(.cs-check):first-child { flex: 0 0 96px; text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cs-cust input { padding-left: 8px; padding-right: 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem;
  color: var(--input-fg); background: var(--input-bg); }

/* Tighter vertical spacing in the Customer / Supplier statement and Customer Balance filters (client feedback, 2026-10-10),
   the same 4px row pitch as the stock / sales / purchase report filters: smaller gap between rows, Generate and the toolbar
   buttons no taller than a box (so a row holding them is not taller than its neighbours), and less space under the form. */
.cs-header { margin-bottom: max(0px, calc(8px + var(--lay-fy, 0px))); }
.cs-form { gap: max(0px, calc(4px + var(--lay-fy, 0px))); }
.cs-row { gap: max(0px, calc(4px + var(--lay-fy, 0px))) 12px; }
.cs-row .btn-toolbar, .cs-row .toolbar-actions .btn-toolbar { min-height: 0; height: 29px; padding-top: 0; padding-bottom: 0; }

/* Buttons the same height as the boxes (client feedback, 2026-10-10): the full-size buttons (.btn, .btn-toolbar -- Save, Generate,
   Export, Back, Exit ...) are 29px like the text boxes and combos beside them. Small buttons inside a table / entry grid
   (row +/-, delete) and the swatch / step / toggle chips keep their own size. A link styled as a button is made inline-flex
   so its caption stays centred in the fixed height. */
:is(.btn, .btn-toolbar):not(:is(td, th, .de-grid, .sep-grid) *) {
  height: var(--ctl-h) !important;
  box-sizing: border-box;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
a:is(.btn, .btn-toolbar):not(:is(td, th, .de-grid, .sep-grid) *) { display: inline-flex; align-items: center; justify-content: center; }

/* Customer Balance Report: the Closing Balance box is the last row of the grid (tfoot), in the Balance column, right aligned so
   its right edge matches the figures above (client feedback, 2026-10-10). Stays visible at the bottom of a scrolling grid. */
.cb-foot td { position: sticky; bottom: 0; background: var(--panel); border-top: 2px solid var(--border); font-weight: 700; white-space: nowrap; }
.cb-foot input { height: 24px; box-sizing: border-box; width: 120px; max-width: 100%; text-align: right; font-weight: 700; background: var(--shade); color: var(--ink);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 6px; }

/* Supplier Balance Report (sup_bal.py): a narrow list like the legacy window -- no side panel, so the grid does not stretch. */
.sb-layout .cb-grid-wrap { max-width: 760px; }

/* A filter row that holds everything on one line (Supplier Balance Report) has no label column to line up with, so its first
   label is not given the fixed 96px right-aligned width -- the row starts at the left edge. */
.cs-row.cs-row-flat > label:not(.cs-check):first-child { flex: 0 0 auto; text-align: left; font-size: inherit; font-weight: inherit; color: inherit; }

/* Customer wise Due List (cus_due.py, 2026-10-10): party after party in one grid. The party name stands on a party's first line, a
   sub total (or a blank line) closes it, the Total Amount box sits in the Balance column; the print gives each party a heading row. */
.dl-wrap { max-height: 66vh; }
.dl-filters { display: grid; grid-template-columns: 96px 70px max-content 150px max-content 110px max-content 240px 1fr; justify-content: start; width: 100%; gap: 4px 12px; align-items: center; }
.dl-filters > label:not(.cs-check) { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.dl-filters .dl-r1 { grid-row: 1; } .dl-filters .dl-r2 { grid-row: 2; } .dl-filters .dl-r3 { grid-row: 3; }
.dl-filters .dl-span-a { grid-column-end: span 3; width: 100%; min-width: 0; }    /* Days box .. Due Date's right edge */
.dl-filters .dl-span-b { grid-column-end: span 3; width: 100%; min-width: 0; }    /* Term box .. Salesman's right edge */
.dl-filters select, .dl-filters input[type="date"] { width: 100%; min-width: 0; }
.dl-filters > label[for="dl-city"] { grid-column: 5; }
.dl-total-field { grid-column: 9; grid-row: 1 / span 2; justify-self: end; align-self: start; width: 200px; }
.dl-total-field label { display: block; text-align: right; }
.dl-total-field input { font-weight: 700; }
.dl-checks { grid-column: 2 / span 3; display: flex; align-items: center; gap: 14px; white-space: nowrap; margin-top: 2px; }
.dl-checks .cs-check { font-size: 0.88rem; }
.dl-gen { grid-column: 6; justify-self: start; }
.dl-filters > label.dl-rep-l { grid-column: 5; }
.dl-filters .dl-rep { grid-column: 6 / span 3; width: 50%; min-width: 0; }      /* City's box is cols 6-8: Rep is half as wide */
.dl-gen-rep { grid-column: 8; margin-left: 26px; }       /* Generate sits just right of the Rep box */
.dl-tools { grid-column: 7 / -1; justify-self: end; margin-left: 0; }
.dl-days { width: 70px; text-align: right; }
.dl-grid td.dl-name { font-weight: 600; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.dl-grid tr.dl-sub td { font-weight: 700; border-top: 1px solid var(--border); background: var(--shade); }
.dl-grid tr.dl-gap td { height: 10px; padding: 0; border: 0; }
.dl-print tr.dl-party td { white-space: normal; font-weight: 400; padding-top: 7px; text-align: left; break-after: avoid; page-break-after: avoid; }
.dl-print tr.dl-sub td { font-weight: 700; border-top: 1px solid #000; }
.dl-print tr.dl-gap td { height: 6px; padding: 0; }
.dl-print tr.dl-total td { font-weight: 700; border-top: 2px solid #000; }

/* Supplier wise Due List (sup_due.py, 2026-10-10): the same filter block as the customer list with fewer boxes -- Days, Due Date, an
   optional Purchase Category combo, the ticks, and Generate + toolbar at the right end of the category row. */
.sd-filters { grid-template-columns: 62px 70px max-content 150px 1fr; }   /* label column just wide enough for "Purchase" / "Category" */
.sd-filters > label[for="dl-cat"] { white-space: normal; line-height: 1.15; }   /* "Purchase Category" wraps onto two lines instead of widening the column */
.sd-filters .sd-total { grid-column: 5; grid-row: 1; justify-self: end; align-self: start; }
.sd-buttons { grid-column: 5; grid-row: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sd-buttons .sd-tools { margin-left: auto; }
/* Supplier Due List grid: every column but the party name hugs its content, so the spare width goes to the party name column and
   S/N / Bill No / Date / amounts sit together instead of being spread evenly across the page. */
.sd-grid th:not(.stk-rep-fill), .sd-grid td:not(.stk-rep-fill) { width: 1px; }
.sd-grid th.stk-rep-fill { padding: max(1px, calc(6px + var(--lay-gy, 0px))) 10px; }
.sd-grid td.stk-rep-fill { padding: max(1px, calc(5px + var(--lay-gy, 0px))) 10px; }

/* FLAT ROLLOUT (2026-10-10, Sabari) -- multi-grid screens (Purchase / Sales Report Bill wise Details): the filter card and the outer
   grid border go flat through the shared .stock-sales-* rules above; the three grids keep a thin border (it is what tells them apart)
   with 6px gaps, and the Less / Db-Cr Note / Error / TCS / Round off boxes sit in two columns beside the Tax Detail. */
.pbd-wrap { margin-bottom: 6px; }
.pbd-bottom { gap: 12px; }
.pbd-extras { flex: 0 0 auto; display: grid; grid-template-columns: auto auto; grid-template-rows: repeat(3, auto);
  grid-auto-flow: column; gap: 4px 18px; align-content: start; }
.pbd-extra { justify-content: flex-end; }
.pbd-extra input { width: 104px; }
.pbd-items-grid th, .pbd-list th { white-space: nowrap; }

/* REPORT GRID LOOK (2026-10-10, Sabari) -- every stock / purchase / sales report grid (.stock-sales-grid-wrap): the header and the
   heading lines (company groups) take the stronger shade, the even-row stripes the lighter one (they used to be the other way round);
   the current row (static/kbd_grid.js: keyboard AND mouse) is highlighted in the accent colour; no focus ring, the highlighted row shows
   where you are. Stripes follow S/N on the stk-rep grids (.stk-rep-even), plain row parity on the Stock & Sales Statement. */
.stock-sales-grid-wrap .stock-sales-grid thead th, .pbd-wrap .stock-sales-grid thead th { background: var(--shade); }
.stock-sales-grid-wrap .stock-sales-grid.stk-rep-grid tbody tr.stk-rep-even td,
.pbd-wrap .stock-sales-grid.stk-rep-grid tbody tr.stk-rep-even td { background: var(--shade-strong); }
.stock-sales-grid-wrap .stock-sales-grid:not(.stk-rep-grid) tbody tr:nth-child(even) td { background: var(--shade-strong); }
.stock-sales-grid-wrap .stock-sales-grid.stk-rep-grid tbody tr.stk-rep-group td { background: var(--shade); }
.stock-sales-grid-wrap:focus { outline: none; }
.stock-sales-grid-wrap .stock-sales-grid tbody tr.kbd-sel td,
.stock-sales-grid-wrap .stock-sales-grid:not(.stk-rep-grid) tbody tr.kbd-sel td,
.stock-sales-grid-wrap .stock-sales-grid:not(.stk-rep-grid) tbody tr.kbd-sel:hover td,
.stock-sales-grid-wrap .stock-sales-grid tbody tr.kbd-sel:hover td,
.stock-sales-grid-wrap .stock-sales-grid.stk-rep-grid tbody tr.kbd-sel td,
.stock-sales-grid-wrap .stock-sales-grid.stk-rep-grid tbody tr.kbd-sel:hover td,
.stock-sales-grid-wrap .stock-sales-grid tbody tr.kbd-sel td.stock-sales-freeze-sn,
.stock-sales-grid-wrap .stock-sales-grid tbody tr.kbd-sel td.stock-sales-freeze-name { background: var(--accent); color: #fff; }
.stock-sales-grid-wrap .stock-sales-grid tbody tr:hover td { cursor: default; }

/* Parties Accounts grids (.cs-wrap: Customer / Supplier Balance, Statement, Due List -- and any report that uses it) get the same look
   as the stock / purchase / sales grids (2026-10-10, Sabari): header + Opening / Closing / subtotal lines in the stronger shade,
   stripes (.kbd-even, added by static/kbd_grid.js) in the lighter one, the current row highlighted, no focus ring. */
.cs-wrap .stock-sales-grid thead th { background: var(--shade); }
.cs-wrap .stock-sales-grid.stk-rep-grid tbody tr.kbd-even td { background: var(--shade-strong); }
.cs-wrap .cs-grid.stk-rep-grid tbody tr.cs-ob td, .cs-wrap .cs-grid.stk-rep-grid tbody tr.cs-cb td { background: var(--shade); }
.cs-wrap:focus { outline: none; }
.cs-wrap .stock-sales-grid tbody tr.kbd-sel td,
.cs-wrap .stock-sales-grid tbody tr.kbd-sel:hover td,
.cs-wrap .stock-sales-grid.stk-rep-grid tbody tr.kbd-sel td,
.cs-wrap .stock-sales-grid.stk-rep-grid tbody tr.kbd-sel:hover td,
.cs-wrap .cs-grid tbody tr.kbd-sel td,
.cs-wrap .stock-sales-grid.stk-rep-grid tbody tr.stk-rep-item.kbd-sel:hover td { background: var(--accent); color: #fff; }

/* Parties Accounts filter boxes = the inventory report boxes (2026-10-10, Sabari: "some boxes look grey / focus changes from rounded
   corners to sharp edges"): the Due List filters (.dl-filters) had no control styling at all (browser grey selects, square corners,
   black text), and the statement / balance filters used 4px corners where the stock / purchase / sales filters use 6px. All six
   now share the one look: 1px theme border, 6px corners, theme input colours, 0.88rem text, 29px height (--ctl-h, above). */
.dl-filters select, .dl-filters input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]) {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg);
  box-sizing: border-box;
}
.dl-filters input[readonly] { background: var(--input-bg); }
/* ... and the read-only result boxes (Opening / Sales / Receipts / Closing, the Closing Balance in the grid foot) are white like the
   inventory Total box -- 6px corners, theme input colours, bold -- instead of the grey-blue fill; the side info card gets 6px too;
   the date / select boxes of the statement + balance filters get the same 8px side padding as the inventory ones. */
.cs-boxes input, .cb-foot input { background: var(--input-bg); color: var(--input-fg); border-radius: 6px; font-size: 0.88rem; }
.cs-boxes input { padding: 4px 8px; }
.cb-foot input { padding: 0 8px; }
.cb-info { border-radius: 6px; }
.cs-row input[type="date"], .cs-row select { padding-left: 8px; padding-right: 8px; }
/* Labels too: every label in the Parties Accounts filters is bold ink 12.5px like the inventory ones (the "To", "Sale Category",
   "Supplier" labels were the lighter grey 0.85rem before); tick-box captions are 12.5px like the inventory tick boxes. */
.cs-row > label:not(.cs-check), .dl-filters > label:not(.cs-check) { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cs-row .cs-check, .dl-checks .cs-check { font-size: 12.5px; }
.cs-row.cs-row-flat > label:not(.cs-check):first-child { font-size: 12.5px; font-weight: 600; color: var(--ink); }

/* Audit Trail + the three Sales graph reports (2026-10-10, crawl of all reports): same pattern as the inventory reports -- themed 6px
   29px filter boxes, bold 12.5px labels, blue toolbar buttons, the table in a stock-sales grid box (stripes, header colour, keyboard /
   mouse highlight from static/kbd_grid.js, fitted to the window). */
.at-form { align-items: center; gap: 4px 14px; }
/* vertical-spacing crawl (2026-10-10): same rhythm as every other report header -- 4px between control rows, 8px to the grid, controls 29px high */
.at-head, .sg-header { margin-bottom: 8px; }
.sg-form { row-gap: 4px; }
.at-form input, .at-form select, .at-form input[type="date"], .sg-form input, .sg-form select, .sg-form input[type="date"] { margin: 0; }   /* .selector-form gave them a 4px top margin */
.at-form label { padding: 0; }
.at-form { flex-direction: column; align-items: flex-start; }
.at-form .at-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }   /* row 1: dates + combos; row 2: Record no. + buttons */
/* Supplier Due List after Generate: Total Amount sits label-left / box-right on the Days row, so the row stays 29px high */
.sd-filters .sd-total { display: flex; align-items: center; gap: 8px; }
.sd-filters .sd-total { width: auto; }
.sd-filters .sd-total label { margin: 0; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sd-filters .sd-total input { width: 150px; margin: 0; }
.at-form label, .sg-row label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.at-form input:not([type="checkbox"]), .at-form select,
.sg-form input[type="date"] {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg);
  box-sizing: border-box;
}
.at-form .at-rec { width: 90px; }
.sg-form .checkbox { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.at-grid td.at-wrap { white-space: normal; }
.sg-table-wrap { max-width: none; margin: 0; }
.sg-chart { margin: 0 0 8px; }
@media print {
  /* the graph reports print their on-screen table: no height box / scroll, and the highlighted row prints like any other row */
  .sg-table-wrap { max-height: none !important; overflow: visible !important; }
  .stock-sales-grid-wrap tr.kbd-sel td, .cs-wrap tr.kbd-sel td { background: transparent !important; color: inherit !important; }
}


/* Customer / Supplier Account Statement header (Sabari, 2026-10-11): one grid so the boxes line up -- row 1 Date From / To, row 2 the
   Customer / Supplier box spanning from the Date From box to the right edge of the To box (+ Sale Category beside it for a client
   that uses categories), row 3 the tick boxes starting under the Customer box, then Generate, the toolbar at the far right. */
.cs-form.cs-stmt { display: grid; grid-template-columns: 96px max-content max-content max-content max-content 1fr; column-gap: 12px; row-gap: max(0px, calc(4px + var(--lay-fy, 0px))); align-items: center; justify-content: start; }
.cs-stmt > label:not(.cs-check) { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.cs-stmt .cs-l1 { grid-column: 1; text-align: right; }
.cs-stmt .cs-lto { grid-column: 3; }
.cs-stmt input[type="date"] { grid-column: 2; }
.cs-stmt .cs-lto + input[type="date"] { grid-column: 4; }
.cs-stmt .cs-cust { grid-column: 2 / span 3; min-width: 0; flex: none; width: 100%; }
.cs-stmt .cs-cat { grid-column: 2 / span 3; width: 100%; min-width: 0; }
.cs-stmt .cs-checkrow { grid-column: 2 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: max(0px, calc(4px + var(--lay-fy, 0px))) 16px; }
.cs-stmt .cs-checkrow .cs-toolbar { margin-left: auto; }
.cs-stmt input[type="date"], .cs-stmt select { padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); }
.cs-stmt .cs-cust input { box-sizing: border-box; }
.cs-stmt .btn-toolbar, .cs-stmt .toolbar-actions .btn-toolbar { min-height: 0; height: 29px; padding-top: 0; padding-bottom: 0; }
.cs-stmt .cs-check { font-size: 12.5px; }
.cs-stmt .cs-check input { margin-left: 0; }

/* Second column of the statement header (Sabari, 2026-10-11): the picked party's address lines and phone numbers in a disabled-looking
   box, as tall as the rows beside it (3 rows = 95px with a Sale Category row, 2 rows = 62px without). The box spans exactly those
   rows, so it never makes a row taller than 29px + 4px; text longer than the box is cut (the full text is in its tooltip). */
.cs-stmt .cs-info { grid-column: 5; align-self: start; box-sizing: border-box; display: flex; flex-direction: column; margin-left: 8px; width: 293px;
  padding: 4px 8px; overflow: hidden; white-space: nowrap; font-size: 0.88rem; line-height: 15px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); cursor: default; }
.cs-stmt .cs-info-2 { grid-row: 1 / span 3; height: 95px; }   /* no Sale Category row: the box still takes 3 rows (nothing else stands in column 5 of row 3) */
.cs-stmt .cs-info-3 { grid-row: 1 / span 3; height: 95px; }

/* Header without a Sale Category row (Sabari, 2026-10-11): the tick boxes stand under the Customer / Supplier box, Generate starts at the
   left edge of the address box (column 5), the toolbar at the far right. Two ticks (a client that tracks customer bills) stack, since
   they cannot both fit under a box. */
.cs-stmt .cs-ticks { display: flex; gap: max(0px, calc(4px + var(--lay-fy, 0px))) 16px; }
.cs-stmt.cs-nocat .cs-checkrow { display: contents; }
.cs-stmt.cs-nocat .cs-ticks { display: contents; }
.cs-stmt.cs-nocat .cs-ticks > .cs-check { grid-column: 2 / span 3; grid-row: 3; justify-self: start; }
.cs-stmt.cs-nocat.cs-two .cs-ticks > .cs-check:last-child { grid-row: 4; }   /* two ticks (customer bill tracking): one per row, Generate beside the second */
.cs-stmt.cs-nocat .cs-checkrow > .btn-toolbar { grid-column: 2 / span 3; grid-row: 3; justify-self: end; margin: 0; }   /* right edge = the Customer / Supplier box's right edge */
.cs-stmt.cs-nocat .cs-checkrow > .cs-toolbar { grid-column: 6; grid-row: 3; justify-self: end; margin-left: 0; }
.cs-stmt.cs-nocat.cs-two .cs-checkrow > .btn-toolbar, .cs-stmt.cs-nocat.cs-two .cs-checkrow > .cs-toolbar { grid-row: 4; }
.cs-stmt .cs-info-line { overflow: hidden; text-overflow: ellipsis; flex: 0 0 auto; }
.cs-stmt .cs-info-phones { font-weight: 700; }   /* every phone number the head has, comma separated, on the last line */
.cs-stmt .cs-info-phones { white-space: normal; text-overflow: clip; }   /* four numbers wrap onto a second line instead of being cut */

/* The four balance boxes (Opening Balance / Sales or Purchases / Receipts or Payments / Closing Balance) moved from the footer to the right
   top of the header (Sabari, 2026-10-11): two rows of two, beside the first two header rows, right edge on the toolbar's right edge. */
.cs-stmt .cs-sum { grid-column: 6; grid-row: 1 / span 2; justify-self: end; align-self: start; margin: 0; display: grid;
  grid-template-columns: auto 130px auto 130px; gap: 4px 8px; align-items: center; justify-content: end; }
.cs-stmt .cs-sum label { display: contents; }
.cs-stmt .cs-sum label > span { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.cs-stmt .cs-sum label:nth-child(even) > span { margin-left: 16px; }
.cs-stmt .cs-sum input { width: 100%; box-sizing: border-box; }
.cs-stmt.cs-nocat.cs-two .cs-ticks > .cs-check { height: 29px; }   /* each tick row is a normal 29px row, so the 3-row address box spans exactly rows 1-3 */

/* Bill wise Outstanding Report (cus_bwo.py, 2026-10-11): the legacy screen's two filter blocks in one grid -- Sales Category / Area / Salesman /
   Company Rep combos on the left (one left edge, right-aligned bold labels), No of Bills / Term beside the first two rows, Generate on the
   third, Total top right and the toolbar at the right end of the Generate row; the list is one grid, oldest bill first. */
.bw-filters { display: grid; grid-template-columns: 96px 280px max-content 150px max-content 1fr; column-gap: 12px; row-gap: max(0px, calc(4px + var(--lay-fy, 0px))); align-items: center; justify-content: start; width: 100%; }
.bw-filters > label { text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.bw-filters .bw-combo { grid-column: 2; width: 100%; min-width: 0; }
.bw-filters > label:not(.bw-l2) { grid-column: 1; }
.bw-filters .bw-l2 { grid-column: 3; }
.bw-filters .bw-r1 { grid-row: 1; } .bw-filters .bw-r2 { grid-row: 2; } .bw-filters .bw-r3 { grid-row: 3; }
.bw-filters .bw-limit, .bw-filters .bw-term { grid-column: 4; width: 100%; min-width: 0; text-align: right; }
.bw-filters .bw-term { text-align: left; }
.bw-filters .bw-gen { grid-column: 5; grid-row: 3; justify-self: start; }
.bw-filters .bw-total { grid-column: 6; grid-row: 1; justify-self: end; align-self: start; width: auto; display: flex; align-items: center; gap: 8px; }
.bw-filters .bw-total label { margin: 0; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.bw-filters .bw-total input { width: 150px; margin: 0; font-weight: 700; }
.bw-filters .bw-tools { grid-column: 6; grid-row: 3; justify-self: end; margin-left: 0; }
.bw-filters select, .bw-filters input[type="text"] { padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); box-sizing: border-box; }
.bw-filters .btn-toolbar { min-height: 0; height: 29px; padding-top: 0; padding-bottom: 0; }
.bw-wrap { max-height: 66vh; }
.bw-grid th:not(.stk-rep-fill), .bw-grid td:not(.stk-rep-fill) { width: 1px; }
.bw-grid th.stk-rep-fill { padding: max(1px, calc(6px + var(--lay-gy, 0px))) 10px; }
.bw-grid td.stk-rep-fill { padding: max(1px, calc(5px + var(--lay-gy, 0px))) 10px; font-weight: 600; }

/* Pending Report (Bill wise), sup_bwo.html (2026-10-12). With a Purchase Category: row 1 = Purchase Category + Total, row 2 = No of Bills (4 digits),
   Generate, toolbar. Without one: one row = No of Bills, Generate, Total, toolbar. Reuses the .bw-filters look (29px themed boxes). */
.bw-filters.sp-filters { grid-template-columns: 124px 64px max-content 1fr max-content; }
.bw-filters.sp-filters > label.sp-cat { grid-column: 1; grid-row: 1; }
.bw-filters.sp-filters .sp-cat.bw-combo { grid-column: 2 / span 3; grid-row: 1; width: 280px; justify-self: start; }
.bw-filters.sp-filters > label.sp-lim-l { grid-column: 1; grid-row: 2; }
.bw-filters.sp-filters .sp-lim { grid-column: 2; grid-row: 2; width: 100%; min-width: 0; text-align: right; }
.bw-filters.sp-filters .sp-gen { grid-column: 3; grid-row: 2; justify-self: start; }
.bw-filters.sp-filters .sp-total { grid-column: 4 / span 2; grid-row: 1; justify-self: end; width: auto; display: flex; align-items: center; gap: 8px; }
.bw-filters.sp-filters .sp-total label { margin: 0; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.bw-filters.sp-filters .sp-total input { width: 150px; margin: 0; font-weight: 700; }
.bw-filters.sp-filters .sp-tools { grid-column: 5; grid-row: 2; justify-self: end; margin-left: 0; }
.bw-filters.sp-nocat { grid-template-columns: 96px 64px max-content 1fr max-content; }
.bw-filters.sp-nocat > label.sp-lim-l, .bw-filters.sp-nocat .sp-lim, .bw-filters.sp-nocat .sp-gen, .bw-filters.sp-nocat .sp-total, .bw-filters.sp-nocat .sp-tools { grid-row: 1; }
.bw-filters.sp-nocat .sp-total { grid-column: 4; }

/* Customer wise Outstanding Report, cus_out.html (2026-10-12): left Date / Salesman / Sales Category, right Area / City / Term (rows 1-3);
   Generate + toolbar on row 3, Total on row 1 (right end); the two ticks under the left boxes (row 3, or row 4 when there is a Sales Category). */
.bw-filters.co-filters { grid-template-columns: 96px 300px max-content 220px max-content 1fr; }
.bw-filters.co-filters input[type="date"] { font-family: inherit; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); box-sizing: border-box; margin: 0; }
.bw-filters.co-filters > label.co-l1 { grid-column: 1; }
.bw-filters.co-filters > label.co-l2 { grid-column: 3; }
.bw-filters.co-filters .co-date { grid-column: 2; width: 150px; justify-self: start; }
.bw-filters.co-filters .co-box1 { grid-column: 2; width: 100%; min-width: 0; }
.bw-filters.co-filters .co-box2 { grid-column: 4; width: 100%; min-width: 0; }
.bw-filters.co-filters .co-r1 { grid-row: 1; } .bw-filters.co-filters .co-r2 { grid-row: 2; } .bw-filters.co-filters .co-r3 { grid-row: 3; }
.bw-filters.co-filters .co-checks { grid-column: 2 / span 3; grid-row: 4; display: flex; align-items: center; gap: 14px; white-space: nowrap; }
.bw-filters.co-filters .co-checks .cs-check { font-size: 12.5px; }
.bw-filters.co-filters .co-gen { grid-column: 5; grid-row: 3; justify-self: start; }
.bw-filters.co-filters .co-tools { grid-column: 6; grid-row: 3; justify-self: end; margin-left: 0; }
.bw-filters.co-filters .co-total { grid-column: 6; grid-row: 1; justify-self: end; align-self: start; width: auto; display: flex; align-items: center; gap: 8px; }
.bw-filters.co-filters .co-total label { margin: 0; white-space: nowrap; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.bw-filters.co-filters .co-total input { width: 150px; margin: 0; font-weight: 700; }
.cs-wrap .stock-sales-grid.stk-rep-grid tbody tr.co-grp:not(.kbd-sel) td { font-weight: 700; background: var(--shade); }
.co-print-grp td { font-weight: 700; }
.bw-grid td.co-gname { font-weight: 700; }

/* Supplier wise Pending Report, sup_out.html (2026-10-12): Date (+ Purchase Category) on top, then ONE row = the two ticks, Generate, toolbar (right
   end); Total at the right end of the first row. Reuses the .co-filters look of the Customer wise Outstanding Report. */
.bw-filters.co-filters.sp-out { grid-template-columns: 96px 300px max-content 1fr; }
.bw-filters.co-filters.sp-out.so-cat { grid-template-columns: 124px 300px max-content 1fr; }
.bw-filters.co-filters.sp-out .co-checks { grid-column: 2; grid-row: 2; }
.bw-filters.co-filters.sp-out.so-cat .co-checks { grid-row: 3; }
.bw-filters.co-filters.sp-out .co-gen { grid-column: 3; grid-row: 2; }
.bw-filters.co-filters.sp-out.so-cat .co-gen { grid-row: 3; }
.bw-filters.co-filters.sp-out .co-tools { grid-column: 4; grid-row: 2; }
.bw-filters.co-filters.sp-out.so-cat .co-tools { grid-row: 3; }
.bw-filters.co-filters.sp-out .co-total { grid-column: 4; grid-row: 1; }

/* Ageing Analysis Report (Outstanding), cus_age.html (2026-10-12; header re-ordered 2026-10-13): row 1 Ageing Slab (+ Total at the right), row 2 Date and
   Sales Category side by side (cursor starts on Date), row 3 Salesman / Area / City and, bottom aligned, Generate + the toolbar; grid = fixed layout so the
   six ageing columns line up with the lower (selected customer's bills) grid; the totals are a sticky footer row. */
.bw-filters.co-filters.ag-filters { grid-template-columns: 96px 150px 94px 130px 28px auto 1fr; column-gap: 10px; }
.bw-filters.co-filters.ag-filters .ag-r1 { grid-row: 1; } .bw-filters.co-filters.ag-filters .ag-r2 { grid-row: 2; } .bw-filters.co-filters.ag-filters .ag-r3 { grid-row: 3; }
.bw-filters.co-filters.ag-filters .ag-c1l { grid-column: 1; } .bw-filters.co-filters.ag-filters .ag-c2l { grid-column: 3; } .bw-filters.co-filters.ag-filters .ag-c3l { grid-column: 5; }
.bw-filters.co-filters.ag-filters .ag-c1 { grid-column: 2; width: 100%; min-width: 0; }
.bw-filters.co-filters.ag-filters .ag-c2 { grid-column: 4; width: 100%; min-width: 0; }
.bw-filters.co-filters.ag-filters .ag-c3 { grid-column: 6; width: 0; min-width: 100%; }   /* long city names must not widen the track: its width comes from the slab above */
.bw-filters.co-filters.ag-filters .co-date { width: 150px; justify-self: start; }
.bw-filters.co-filters.ag-filters .ag-slab { grid-column: 2 / span 5; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.bw-filters.co-filters.ag-filters .ag-actions { grid-column: 7; align-self: end; display: flex; align-items: flex-end; flex-wrap: nowrap; gap: 6px; min-width: 0; white-space: nowrap; }
.bw-filters.co-filters.ag-filters .ag-actions .co-gen { grid-row: auto; grid-column: auto; }
.bw-filters.co-filters.ag-filters .ag-actions .co-tools { grid-row: auto; grid-column: auto; margin-left: auto; }
.bw-filters.co-filters.ag-filters .co-total { grid-column: 7; grid-row: 1; }
.bw-filters.co-filters.ag-filters .ag-actions .btn-toolbar { padding-left: 10px; padding-right: 10px; }
.bw-filters.co-filters.ag-filters .ag-actions .toolbar-actions { flex-wrap: nowrap; gap: 6px; }
.ag-pair { display: inline-flex; align-items: stretch; height: 29px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: var(--input-bg); }
.ag-pair .ag-above { display: flex; align-items: center; padding: 0 8px; font-size: 12.5px; font-weight: 600; color: var(--ink); background: var(--shade-strong); border-right: 1px solid var(--border); }
.bw-filters .ag-pair input[type="text"] { width: 46px; height: 100%; margin: 0; text-align: center; padding: 0 2px; border: 0; border-radius: 0; box-shadow: none; outline: 0; background: transparent; box-sizing: border-box; }
.bw-filters .ag-pair input.ag-from[readonly] { background: var(--shade-strong); color: var(--ink); border-right: 1px solid var(--border); }
.bw-filters .ag-pair input.ag-from.ag-last[readonly] { border-right: 0; width: 52px; }
.bw-filters .ag-pair:focus-within { border-color: var(--accent, #2563eb); box-shadow: 0 0 0 2px rgba(37,99,235,.25); }
.ag-wrap { overflow-y: auto; scrollbar-gutter: stable; }
.ag-grid { table-layout: fixed; width: 100%; }
.ag-grid td, .ag-grid th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-grid th, .ag-grid th.stk-rep-fill { padding: max(1px, calc(6px + var(--lay-gy, 0px))) 8px; vertical-align: middle; }
.ag-grid td.ag-name { font-weight: 600; }
.ag-grid tfoot td { position: sticky; bottom: 0; background: var(--shade); font-weight: 700; border-top: 1px solid var(--border); padding: max(1px, calc(5px + var(--lay-gy, 0px))) 10px; }
.ag-detail { margin-top: 6px; height: 170px; overflow-y: auto; scrollbar-gutter: stable; border: 1px solid var(--border); border-radius: 6px; background: var(--card-bg, transparent); }
.ag-detail .stock-sales-grid thead th { position: sticky; top: 0; background: var(--shade); z-index: 1; }
.ag-detail .stock-sales-grid tbody tr:nth-child(even) td { background: var(--shade-strong); }
.ag-detail .stock-sales-grid td, .ag-detail .stock-sales-grid th { padding: max(1px, calc(5px + var(--lay-gy, 0px))) 10px; }

/* Customer Receipt Report, cus_rec.html (2026-10-13): header = the .co-filters grid in two blocks (Date From / Salesman / Customer / Sales Category on the left,
   To / Term / Area / Bank Name on the right); the "Group by Area Name" tick sits beside Area, Generate + the toolbar bottom aligned beside Bank Name, Total top
   right. Bold rows = voucher type receipts. */
.bw-filters.co-filters.cr-filters { grid-template-columns: 96px 140px max-content 120px max-content 210px 1fr; column-gap: 10px; }
.bw-filters.co-filters.cr-filters.cr-cat { grid-template-columns: 124px 140px max-content 120px max-content 210px 1fr; }
.bw-filters.co-filters.cr-filters .cr-r1 { grid-row: 1; } .bw-filters.co-filters.cr-filters .cr-r2 { grid-row: 2; } .bw-filters.co-filters.cr-filters .cr-r3 { grid-row: 3; }
.bw-filters.co-filters.cr-filters .cr-l1 { grid-column: 1; } .bw-filters.co-filters.cr-filters .cr-l2 { grid-column: 3; } .bw-filters.co-filters.cr-filters .cr-l3 { grid-column: 5; }
.bw-filters.co-filters.cr-filters .cr-b1 { grid-column: 2; width: 100%; min-width: 0; }
.bw-filters.co-filters.cr-filters .cr-b2 { grid-column: 4; width: 100%; min-width: 0; }
.bw-filters.co-filters.cr-filters .cr-b3 { grid-column: 6; width: 100%; min-width: 0; }
.bw-filters.co-filters.cr-filters input[type="date"].cr-b1, .bw-filters.co-filters.cr-filters input[type="date"].cr-b2 { width: 140px; justify-self: start; }
.bw-filters.co-filters.cr-filters .cr-check { grid-column: 6; justify-self: start; margin-left: 0; display: flex; align-items: center; }
.bw-filters.co-filters.cr-filters .cr-actions { grid-column: 7; justify-self: stretch; align-self: end; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; min-width: 0; white-space: nowrap; }
.bw-filters.co-filters.cr-filters .cr-actions .co-gen, .bw-filters.co-filters.cr-filters .cr-actions .co-tools { grid-row: auto; grid-column: auto; }
.bw-filters.co-filters.cr-filters .cr-actions .co-tools { flex-wrap: nowrap; gap: 6px; }
.bw-filters.co-filters.cr-filters .cr-actions .btn-toolbar { padding-left: 9px; padding-right: 9px; }
.bw-filters.co-filters.cr-filters .co-total { grid-column: 7; grid-row: 1; justify-self: end; }
.cr-grid td, .cr-grid th { white-space: nowrap; }
.cr-grid td.stk-rep-fill { font-weight: 400; }
.cr-grid tr.cr-v td, .cr-grid tr.cr-v td.stk-rep-fill, .cr-print tr.cr-v td, .cr-grid td.co-gname { font-weight: 700; }
.cr-note { margin: 4px 2px 0; font-size: 12px; font-weight: 600; color: var(--ink); }

/* Supplier Receipt Report, sup_rec.html (2026-10-13): the Customer Receipt Report's header (.cr-filters) cut down to 5 columns: Date From / To, Supplier, Term / Bank Name
   with Generate after Bank Name and the toolbar at the right end of that row; Total top right. */
.bw-filters.co-filters.cr-filters.sr-filters { grid-template-columns: 96px 150px max-content 200px 1fr; }
.bw-filters.co-filters.cr-filters.sr-filters input[type="date"].cr-b1, .bw-filters.co-filters.cr-filters.sr-filters input[type="date"].cr-b2 { width: 140px; justify-self: start; }   /* a date box keeps its own size; rows 2 and 3 stay aligned on the column widths */
.bw-filters.co-filters.cr-filters.sr-filters .sr-wide { grid-column: 2 / span 3; }
.bw-filters.co-filters.cr-filters.sr-filters .cr-actions, .bw-filters.co-filters.cr-filters.sr-filters .co-total { grid-column: 5; }

/* Sales & Collection Report, sal_coll.html (2026-10-14): the supplier-receipt header (.sr-filters) with Salesman across both columns and Area / Sale Category on the
   last row beside Generate; a narrow 4-column grid (S/N, Date, Sales Amount, Collection Amount) that is only as wide as it needs, with the Total Amount /
   No of Days / Average rows pinned under the two amount columns. */
.sc-wrap { max-height: calc(100vh - 225px); scroll-padding-bottom: 80px; }   /* tall enough for the screen, the 3 footer rows always inside it */
.sc-grid { width: 100%; }
.sc-grid th.stk-rep-fill, .sc-grid td.stk-rep-fill { width: auto; }
.sc-grid td, .sc-grid th { white-space: nowrap; }
.sc-grid th.num, .sc-grid td.num { min-width: 150px; }
.sc-grid tfoot td { position: sticky; background: var(--shade); font-weight: 700; height: 26px; box-sizing: border-box; }
.sc-grid tfoot tr:nth-child(3) td { bottom: 0; } .sc-grid tfoot tr:nth-child(2) td { bottom: 26px; } .sc-grid tfoot tr:nth-child(1) td { bottom: 52px; border-top: 1px solid var(--line, #bbb); }
.sc-print tr.sc-foot td { font-weight: 700; }
.sc-print tr.sc-foot.cs-edge td { border-top: 2px solid #000; }
.bw-filters.co-filters.cr-filters.sr-filters.sc-filters { grid-template-columns: 96px 150px max-content 200px 1fr; }
.bw-filters.co-filters.cr-filters.sr-filters.sc-nocat .cr-actions { grid-column: 3 / -1; }   /* no Sale Category: Generate sits right after Area, the toolbar still at the right end */

/* Purchase & Payment Report, pur_pay.html (2026-10-14): the Sales & Collection page (.sc-*) with only Date From / To in the header; Generate right after To, the toolbar at the right end. */
.bw-filters.co-filters.cr-filters.sr-filters.sc-filters.pp-filters { grid-template-columns: 96px 140px max-content 140px 1fr; }

/* Ageing Analysis Report (Collection), col_age.html (2026-10-14): the Ageing (Outstanding) header (.ag-filters) with Date From / To on row 2 (the To box sits in the
   second column pair, the Area box of a client with Sales Categories in the third), and two grids as wide as their columns need: the table is at least 1390px wide
   (the Party Name / Salesman Name column takes the rest), the first grid scrolls sideways and the receipt / bill grid below follows it (script), so the ageing
   columns of both stay in line. */
.bw-filters.co-filters.ag-filters.ca-filters { grid-template-columns: 96px 150px 94px 140px 34px auto 1fr; }
.bw-filters.co-filters.ag-filters.ca-filters .co-date.ag-c2 { width: 140px; }
.ca-wrap { overflow-x: auto; }
.ca-grid { width: 100%; min-width: 1500px; }
.ca-grid th, .ca-grid td { padding-left: 6px; padding-right: 6px; }
.ca-grid th { white-space: normal; line-height: 1.15; }
.ca-detail { overflow-x: hidden; }
.ca-print td, .ca-print th { font-size: 10px; padding: 2px 4px; }
.ca-detail { height: 150px; }

/* Non Collection Report, non_col.html (2026-10-14): the Ageing header (.ag-filters) without the slab row -- Date From / To on row 1, Salesman / (Sales Category) / Area on row 2
   with Generate + toolbar, Total top right. */
.bw-filters.co-filters.ag-filters.nc-filters { grid-template-columns: 96px 150px 94px 140px 34px 140px 1fr; }
.bw-filters.co-filters.ag-filters.nc-filters.nc-nocat .ag-actions { grid-column: 5 / -1; }   /* no Sales Category: Generate follows the Area box */
.bw-filters.co-filters.ag-filters.nc-filters .co-date.ag-c2 { width: 140px; }

/* Non Billed Report, non_bil.html (2026-10-14): same header as the Non Collection Report (Date From / To, Salesman / (Sales Category) / Area, Generate + toolbar); the grid's
   Last Billed Date / Days / Contact No columns. */
.bw-filters.co-filters.ag-filters.nb-filters { grid-template-columns: 96px 150px 94px 140px 34px 140px 1fr; }
.bw-filters.co-filters.ag-filters.nb-filters .co-date.ag-c2 { width: 140px; }
.bw-filters.co-filters.ag-filters.nb-filters.nb-nocat .ag-actions { grid-column: 5 / -1; }
.bw-filters.co-filters.ag-filters.nb-filters .co-total input { width: 90px; }
.nb-wrap .cs-grid th:nth-child(5), .nb-wrap .cs-grid td:nth-child(5) { width: 112px; }
.nb-wrap .cs-grid th:nth-child(6), .nb-wrap .cs-grid td:nth-child(6) { width: 64px; }
.nb-wrap .cs-grid th:nth-child(7), .nb-wrap .cs-grid td:nth-child(7) { width: 140px; }

/* Reserved Group Trend (grp_trend.py, 2026-10): control bar in the report header pattern (29px controls, 6px radius), a tick-list column and the
   chart. Series colours are the dataviz categorical slots set from the page's script; everything else uses the theme variables. */
.gt-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; width: 100%; }
.gt-bar > label { font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.gt-bar select { height: 29px; padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.88rem; color: var(--input-fg); background: var(--input-bg); box-sizing: border-box; }
.gt-bar .btn-toolbar { min-height: 0; height: 29px; padding-top: 0; padding-bottom: 0; }
.gt-seg { display: inline-flex; }
.gt-seg .btn-toolbar { border-radius: 0; }
.gt-seg .btn-toolbar:first-child { border-radius: 6px 0 0 6px; }
.gt-seg .btn-toolbar:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.gt-seg .btn-toolbar.gt-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.gt-refresh { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.gt-note { font-size: 12px; color: var(--muted); }
.gt-body { display: flex; gap: 12px; align-items: stretch; height: calc(100vh - 205px); min-height: 380px; }
.gt-side { flex: 0 0 214px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.gt-side section { display: flex; flex-direction: column; min-height: 0; flex: 1 1 50%; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); padding: 6px 8px; }
.gt-side h3 { margin: 0 0 2px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
.gt-tools { display: flex; gap: 12px; font-size: 12px; margin-bottom: 4px; }
.gt-list { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
.gt-item { display: flex; align-items: center; gap: 6px; padding: 2px 0; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.gt-item input { margin: 0; }
.gt-item input:disabled + .gt-sw + .gt-name { color: var(--muted); }
.gt-nodata .gt-name { color: var(--muted); font-style: italic; }
.gt-sw { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; visibility: hidden; }
.gt-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); padding: 8px 10px; }
.gt-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; min-height: 18px; margin-bottom: 4px; font-size: 12.5px; color: var(--ink); }
.gt-lg { display: inline-flex; align-items: center; gap: 6px; }
.gt-lgsw { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: 0 0 10px; }
.gt-chart { position: relative; flex: 1 1 auto; min-height: 0; background: var(--panel); }
.gt-chart svg { position: absolute; inset: 0; display: block; }
.gt-grid { stroke: var(--border); stroke-width: 1; opacity: .8; }
.gt-base { stroke: var(--muted); stroke-width: 1; }
.gt-tick { fill: var(--muted); font-size: 11px; }
.gt-unit { fill: var(--muted); font-size: 11px; }
.gt-end { fill: var(--ink); font-size: 11.5px; font-weight: 600; }
.gt-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.gt-dot { stroke: var(--panel); stroke-width: 2; }
.gt-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 190px; padding: 8px 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--border); border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.18); font-size: 12.5px; }
.gt-tip-h { font-weight: 700; margin-bottom: 4px; }
.gt-tip-r { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.gt-tip-n { flex: 1 1 auto; color: var(--ink); }
.gt-tip-r strong { margin-left: 12px; font-variant-numeric: tabular-nums; }
.gt-tablewrap { overflow: auto; flex: 1 1 auto; }
.gt-tbl th.gt-l, .gt-tbl td.gt-l { text-align: left; position: sticky; left: 0; background: var(--panel); white-space: nowrap; }
.gt-tbl td.num, .gt-tbl th.num { white-space: nowrap; }
.gt-empty { margin: 24px 0; text-align: center; color: var(--muted); }
@media print { .gt-side, .gt-bar { display: none; } }
.gt-legend[hidden] { display: none; }

.gt-seg .btn-toolbar:not(.gt-on) { background: var(--input-bg); color: var(--ink); border-color: var(--border); }
.gt-tools a { color: var(--accent); }
.gt-gseg { display: flex; margin: 2px 0 6px; }
.gt-gseg .btn-toolbar { flex: 1 1 auto; height: 24px !important; padding: 0 6px; font-size: 12px; white-space: nowrap; }

/* ===== Mobile drawer (Mobile view only, 2026-10) ======================================================================================
   The phone gets a slim top bar (hamburger, logo on the Dashboard, firm name, the page crumb under it) and the menu becomes a slide-in
   drawer from the left: firm / year switcher / user + Logout at its head (.appnav-mhead, base.html), then the same menu as tap-to-expand
   rows with 48px touch targets (the groups are the same <details> as on the PC, so the open-one-close-the-others script still applies),
   and Display last. Nothing here applies in Normal view. */
.appnav-mhead, .nav-backdrop { display: none; }
html.nav-lock { overflow: hidden; }
html[data-view="mobile"] .shell-top, html[data-view="mobile"] .shell-top.nav-expanded { position: sticky; }
html[data-view="mobile"] .topbar { padding: 6px 10px 4px; }
html[data-view="mobile"] .topbar-row { flex-wrap: wrap; align-items: center; gap: 0 10px; row-gap: 0; }
html[data-view="mobile"] .nav-toggle { width: 40px; height: 40px; font-size: 1.25rem; }
html[data-view="mobile"] .brand-wrap { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 10px; --bl: 32px; }
html[data-view="mobile"] .brand-wrap .brand-block { margin-left: 0; }
html[data-view="mobile"] .brand-logo { position: static; transform: none; flex: none; }
html[data-view="mobile"] .brand-sep, html[data-view="mobile"] .brand-id { display: none; }
html[data-view="mobile"] .topbar-row > .brand-block, html[data-view="mobile"] .brand-wrap .brand-block { flex: 1 1 0; min-width: 0; }
html[data-view="mobile"] .brand { display: block; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html[data-view="mobile"] .brand-line { display: none; }
html[data-view="mobile"] .topbar-actions { flex: 1 0 100%; order: 10; min-width: 0; }
html[data-view="mobile"] .user-block { align-items: flex-start; }
html[data-view="mobile"] .user-line1, html[data-view="mobile"] .user-fy, html[data-view="mobile"] .hdr-center { display: none; }
html[data-view="mobile"] .crumb { display: block; font-size: 0.78rem; padding: 0 2px 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

html[data-view="mobile"] .appnav {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
  width: min(86vw, 340px);
  display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0;
  padding: 0 0 28px;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--menu-bg); border: 0; box-shadow: 6px 0 24px rgba(15, 23, 42, 0.28);
  font-size: 15px;
  transform: translateX(-104%); visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
}
html[data-view="mobile"] .appnav.nav-open { transform: none; visibility: visible; transition: transform 0.22s ease; }
html[data-view="mobile"] .nav-backdrop {
  display: block; position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
}
html[data-view="mobile"] .shell-top.nav-expanded .nav-backdrop { opacity: 1; pointer-events: auto; }

html[data-view="mobile"] .appnav-mhead { display: block; position: relative; padding: 16px 16px 14px; background: var(--header-bg); border-bottom: 1px solid var(--border); }
.mh-firm { font-weight: 700; font-size: 1.05rem; color: var(--ink); padding-right: 40px; overflow-wrap: anywhere; }
.mh-addr { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.mh-fy { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; padding: 3px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; font-weight: 600; font-size: 0.86rem; color: var(--ink); }
.mh-fy .fy-step-link { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 38px; margin: 0; }
.mh-user { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.mh-uname { font-weight: 600; color: var(--ink); }
.mh-logout { padding: 7px 14px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--ink); text-decoration: none; font-size: 0.86rem; }
.mh-sub { margin-top: 8px; font-size: 0.74rem; color: var(--muted); }
.appnav-close { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border: 0; background: transparent; color: var(--ink); font-size: 1.7rem; line-height: 1; cursor: pointer; }

html[data-view="mobile"] .appnav-link,
html[data-view="mobile"] .appnav-dropdown > summary {
  display: flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 0;
  border-bottom: 1px solid var(--border); font-weight: 600; color: var(--ink);
}
html[data-view="mobile"] .appnav-home { justify-content: flex-start; }
html[data-view="mobile"] .appnav-home svg { width: 18px; height: 18px; }
html[data-view="mobile"] .appnav-home::after { content: "Dashboard"; margin-left: 12px; }
html[data-view="mobile"] .appnav-dropdown > summary { justify-content: space-between; }
html[data-view="mobile"] .appnav-dropdown > summary::after,
html[data-view="mobile"] .appnav-subdropdown > summary::after {
  content: ""; width: 8px; height: 8px; margin: 0 4px 3px 8px; font-size: 0; flex: none;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform 0.15s ease;
}
html[data-view="mobile"] .appnav-dropdown[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
html[data-view="mobile"] .appnav-dropdown[open] > summary { background: var(--bg); }
html[data-view="mobile"] .appnav-dropdown > .appnav-panel {
  position: static; min-width: 0; margin: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: var(--panel);
}
html[data-view="mobile"] .appnav-subdropdown > .appnav-panel { padding: 0; background: var(--shade-strong); }
html[data-view="mobile"] .appnav-subdropdown { margin: 0; }
html[data-view="mobile"] .appnav-panel-list a,
html[data-view="mobile"] .appnav-panel-list .menu-disabled {
  display: flex; align-items: center; min-height: 46px; padding: 0 16px 0 28px; border-radius: 0; white-space: normal;
  font-size: 15px; border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}
html[data-view="mobile"] .appnav-panel-list a:active { background: var(--bg); }
html[data-view="mobile"] .appnav-subdropdown > summary {
  min-height: 46px; padding: 0 16px 0 28px; font-size: 15px; font-weight: 600; border-bottom: 1px solid color-mix(in srgb, var(--border) 65%, transparent);
}
html[data-view="mobile"] .appnav-subdropdown .appnav-panel-list a,
html[data-view="mobile"] .appnav-subdropdown .appnav-panel-list .menu-disabled { padding-left: 44px; }
html[data-view="mobile"] .appnav-subdropdown .appnav-subdropdown > summary { padding-left: 44px; }
html[data-view="mobile"] .appnav-leaf-row { display: block; }
html[data-view="mobile"] .appnav-separator-label { display: block; padding: 12px 28px 2px; font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
html[data-view="mobile"] .appnav-panel .appnav-separator { margin: 0; }
html[data-view="mobile"] .appnav-page-title-wrap:has(.appnav-page-title) { display: none; }
html[data-view="mobile"] .display-panel { padding: 12px 16px; }
html[data-view="mobile"] .appnav-panel-list a.nav-newtab { display: none; }

/* Reserved Group Trend on the phone: the tick lists stack above the chart (two lists side by side, short), the chart gets its own height. */
html[data-view="mobile"] .gt-body { flex-direction: column; height: auto; min-height: 0; }
html[data-view="mobile"] .gt-side { flex: none; flex-direction: row; gap: 8px; }
html[data-view="mobile"] .gt-side section { flex: 1 1 0; min-width: 0; }
html[data-view="mobile"] .gt-list { max-height: 190px; }
html[data-view="mobile"] .gt-main { height: 420px; flex: none; }
html[data-view="mobile"] .gt-gseg .btn-toolbar { padding: 0 3px; font-size: 11px; }
html[data-view="mobile"] .gt-refresh { margin-left: 0; width: 100%; justify-content: space-between; }

/* Phone, Dashboard only (the one screen that has the logo): firm name centred in the bar, logo at the right edge. The wrap is padded 50px on its right so the
   name sits at the true middle of the bar (the ☰ button + gap take the same 50px on the left); the redundant "Dashboard" crumb line is dropped. */
html[data-view="mobile"] .brand-wrap { position: relative; justify-content: center; padding-right: 50px; }
html[data-view="mobile"] .brand-wrap .brand-block { flex: 0 1 auto; text-align: center; }
html[data-view="mobile"] .brand-wrap .brand-logo { position: absolute; left: auto; right: 8px; top: 50%; transform: translateY(-50%); }
html[data-view="mobile"] .topbar-row:has(.brand-wrap) .topbar-actions { display: none; }

/* Phone Dashboard: the lock-up block above the cards; the bar itself no longer carries the logo. */
.m-brand { display: none; }
html[data-view="mobile"] .m-brand { display: flex; flex: none; border: 0; padding: 10px 0 14px; }
html[data-view="mobile"] .m-brand .acc-alert-logo { width: 56px; height: 56px; margin-bottom: 8px; }
html[data-view="mobile"] .brand-wrap .brand-logo { display: none; }

/* Display > Normal / Mobile settings tabs */
.disp-tab[hidden] { display: none; }
.disp-using { margin: 0; font-size: 0.82rem; color: var(--muted); }
.disp-note { margin: 8px 0 0; font-size: 0.78rem; color: var(--muted); }
.disp-use-view .btn { width: 100%; }

/* Sales Reports on a phone (mobile.css): these bits exist only for the phone layout and stay out of the Normal view. */
.sr-bar { display: contents; }
.sr-sum, .sr-more-btn, .mc-meta { display: none; }

/* User Access Rights > Reports: the PC | Phone pair of ticks in the first three columns (column widths unchanged). */
.rights-pair { display: inline-flex; align-items: center; justify-content: center; gap: 18px; }
.rights-ico { display: inline-flex; align-items: flex-start; justify-content: center; gap: 12px; color: var(--muted); }
.rights-ico-cell { display: inline-block; text-align: center; line-height: 1.5; }
.rights-ico-cell svg { vertical-align: middle; }
.sg-m-total { display: none; }
.pt-sum { display: none; }

/* ---- Sandbox copy marker (sandbox.py; the attribute is only ever rendered when PERFECTONE_SANDBOX=1, so this does nothing on Live) ---- */
html[data-sandbox] body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: 4px; background: #ea580c; z-index: 100000; pointer-events: none; }
html[data-sandbox] body::after { content: "SANDBOX"; position: fixed; top: 4px; left: 50%; transform: translateX(-50%); padding: 1px 8px 2px; background: #ea580c; color: #fff; font: 700 9px/1.3 system-ui, sans-serif; letter-spacing: .08em; border-radius: 0 0 5px 5px; z-index: 100000; pointer-events: none; }
@media print { html[data-sandbox] body::before, html[data-sandbox] body::after { display: none; } }


/* Stock Report for non-batch clients (stock_report_fly.html, 2026-10-12): Stock / Tax / Total Value boxes stacked in the
   header's top-right corner (same look as the single Total Stock Value box), and the print-only "Company wise Details" heading. */
.stk-rep-totals3 { grid-column: 4; grid-row: 1 / span 3; justify-self: end; align-self: start; width: 230px; display: grid; gap: 4px; }
.stk-rep-totals3 .stock-sales-summary-field { display: grid; grid-template-columns: 90px 1fr; align-items: center; gap: 8px; margin: 0; }
.stk-rep-totals3 .stock-sales-summary-field label { text-align: right; margin: 0; }
.stk-rep-totals3 input { text-align: right; font-weight: 700; }
.stk-rep-print-sub { font-size: 1rem; margin: 18px 0 6px; }
/* Company wise (non-batch): the header has only three rows, so the three boxes sit side by side (caption above) in rows 1-2. */
.stk-rep-totals3.stk-rep-totals3-h { grid-row: 1 / span 2; width: auto; display: flex; gap: 10px; }
.stk-rep-totals3-h .stock-sales-summary-field { display: block; width: 130px; }
.stk-rep-totals3-h .stock-sales-summary-field label { display: block; text-align: right; margin: 0 2px 2px 0; }

/* ------------------------------------------------------------------------------------------------------------
   Select Company -- phone layout (2026-10-13, Sabari: "change / select firm option not optimized for mobile view",
   then "after touching the firm, the year can slide open. just like main menu").
   select_firm.html is a standalone page (no base.html shell), so it carries data-view on <html> itself. On a phone each
   company is a card; touching it slides ITS Financial Years open underneath (one company open at a time, touch again to
   close); the current company opens by itself with the current year ticked, otherwise the newest year is ticked.
   Select is a full-width button stuck to the bottom of the screen (greyed until a year is ticked).
   ------------------------------------------------------------------------------------------------------------ */
html[data-view="mobile"] .selectwin-body { padding: 10px 10px 88px; }
html[data-view="mobile"] .selectwin-topbar { padding: 2px 4px 10px; }
html[data-view="mobile"] .selectwin-client, html[data-view="mobile"] .selectwin-logout { font-size: 0.95rem; padding: 6px 2px; }
html[data-view="mobile"] .selectwin-titlebar { padding: 14px 16px; font-size: 1.1rem; }
html[data-view="mobile"] .selectwin-body-inner { padding: 8px 10px 12px; }
.sf-acc { display: flex; flex-direction: column; gap: 8px; }
.sf-item { border: 1px solid var(--border); border-radius: 10px; background: var(--panel); overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.sf-item.open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.sf-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 60px; padding: 12px 14px; background: transparent; border: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sf-item.open .sf-head { background: var(--shade-strong); }
.sf-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sf-name { font-size: 1.02rem; font-weight: 600; overflow-wrap: anywhere; }
.sf-addr { font-size: 0.85rem; color: var(--muted); overflow-wrap: anywhere; }
.sf-chev { flex: 0 0 auto; width: 10px; height: 10px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .25s; margin-right: 4px; }
.sf-item.open .sf-chev { transform: rotate(45deg); }
/* the slide: grid rows 0fr -> 1fr animates the panel's height without knowing it */
.sf-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .25s ease; }
.sf-item.open .sf-panel { grid-template-rows: 1fr; }
.sf-panel-in { overflow: hidden; min-height: 0; }
.sf-sub { padding: 10px 14px 4px; font-size: 0.78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sf-year { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 14px; border-top: 1px solid var(--border); font-size: 1rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sf-year em { font-style: normal; color: var(--muted); font-size: 0.85rem; padding: 0 3px; }
.sf-year.sel { background: var(--shade-strong); font-weight: 600; }
.sf-year input[type="radio"] { width: 22px; height: 22px; margin: 0; flex: 0 0 auto; }
.sf-none { padding: 14px; text-align: center; color: var(--muted); font-size: 0.95rem; }
html[data-view="mobile"] .selectwin-actions { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-top: 1px solid var(--border); box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.12); z-index: 5; }
html[data-view="mobile"] .selectwin-actions .btn { width: 100%; min-height: 48px; font-size: 1.05rem; }
html[data-view="mobile"] .selectwin-actions .btn:disabled { opacity: .45; cursor: default; }
@media (prefers-reduced-motion: reduce) { .sf-panel, .sf-chev, .sf-item { transition: none; } }
.pf-group { margin: 6px 0 0; padding: 10px 14px 0; border: 1px solid var(--border); border-radius: 8px; max-width: 380px; }
.pf-group legend { padding: 0 8px; font-weight: 600; color: var(--muted); font-size: 0.9rem; }

/* Stock & Sales Statement with a Parent Company picked: a heading row per Company (2026-10-19) */
.stock-sales-grid tbody tr.stk-rep-group td, .stock-sales-print-grid tbody tr.stk-rep-group td { background: var(--shade-strong); font-weight: 600; text-align: left; }

/* Sales Report (Company wise Summary): the Company grid and the Parent Company grid side by side (2026-10-19) */
.csm-top { display: flex; gap: 14px; align-items: flex-start; }
.csm-top .csm-top-col { flex: 1 1 0; min-width: 0; }
.csm-top .pbd-wrap { margin-bottom: 10px; }
.csm-cap { display: none; }
.pbd .pbd-list table.stock-sales-grid.stk-rep-grid tbody tr.pbd-dim td { background: color-mix(in srgb, var(--accent) 24%, transparent); }

/* ---- Master Browse (static/master_browse.js; first user: templates/items.html, 2026-10-20) ----
   The legacy-style master screen: a list with a filter box under every column header, the record's details below it,
   the Entry Bar at the bottom. The list draws only the rows in view (absolute rows inside a spacer) so --mb-row-h is a fixed
   height; the header / filter rows share --mb-cols with the list rows so the columns line up. */
.mb-panel { --mb-cols: minmax(0, 2.6fr) minmax(0, 1fr) minmax(0, 1.8fr) minmax(0, .7fr) 64px; --mb-gap: 8px;
  /* the screen fills the window and never runs past it: master_browse.js sets --mb-h to (window height - the panel's top - a small bottom gap);
     the list takes whatever the details and the buttons leave, never less than ~5 rows (then the page scrolls instead) */
  display: flex; flex-direction: column; height: var(--mb-h, auto); }
.mb-panel > * { flex: 0 0 auto; }
/* little room under the buttons: the panel's own bottom padding and the page's (master_browse.js trims the panel until the page just stops scrolling) */
.mb-panel { padding-bottom: 8px; }
html:not([data-view="mobile"]) .content:has(> .mb-panel) { padding-bottom: 0; }
/* a window too short for the list (>= ~5 rows) AND the whole form: the details scroll inside the screen, so the list and the button bar
   always stay in view (Sabari, 2026-10-22: Ledger Heads on a tablet ran past the window) */
.mb-panel > .mb-form { flex: 0 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
html[data-view="mobile"] .mb-panel > .mb-form { overflow: visible; flex: 0 0 auto; padding-right: 0; }
.mb-panel > .mb-listbox { flex: 1 1 0; min-height: 160px; display: flex; flex-direction: column; }
.mb-p-agro, .mb-p-fmcg { --mb-cols: minmax(0, 2.8fr) minmax(0, 1fr) minmax(0, 2fr) 64px; }      /* no Mfr column on these layouts */
.mb-listbox { border: 1px solid var(--accent); border-radius: 6px; background: var(--panel); overflow: hidden; }
.mb-listbox > * { flex: 0 0 auto; }
.mb-grid { display: grid; grid-template-columns: var(--mb-cols); column-gap: var(--mb-gap); padding: 0 10px; align-items: center; }
.mb-head { background: var(--shade); border-bottom: 1px solid var(--border); padding-right: calc(10px + var(--mb-sbw, 15px)); }
.mb-h { padding: 6px 0 4px; font-size: 0.74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.02em; cursor: pointer; user-select: none; white-space: nowrap; }
.mb-h.mb-asc::after { content: " \25B4"; }
.mb-h.mb-desc::after { content: " \25BE"; }
.mb-h.mb-num, .mb-cell.mb-num { text-align: right; }
/* heading and filter box side by side in one row (simple_master.html): saves a line of height */
.mb-hc { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 0; }
.mb-hc .mb-h { flex: 0 0 auto; padding: 0; }
.mb-hc input { flex: 1 1 0; min-width: 0; box-sizing: border-box; padding: 3px 6px; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 4px; color: var(--input-fg); background: var(--input-bg); }
.mb-f[hidden], .mb-f .mb-inl[hidden] { display: none; }
.mb-fbox { background: var(--shade); padding-bottom: 5px; padding-right: calc(10px + var(--mb-sbw, 15px)); border-bottom: 1px solid var(--border); }
.mb-fbox input { width: 100%; min-width: 0; box-sizing: border-box; padding: 3px 6px; font-size: 0.85rem; border: 1px solid var(--border); border-radius: 4px; color: var(--input-fg); background: var(--input-bg); }
.mb-list { --mb-row-h: max(16px, calc(24px + var(--lay-gy, 0px) * 2)); position: relative; flex: 1 1 0 !important; min-height: 0; overflow-y: scroll; outline: none; background: var(--input-bg); }
.mb-spacer { width: 1px; }
.mb-pool { position: absolute; left: 0; right: 0; top: 0; }
.mb-row { position: absolute; left: 0; right: 0; display: grid; grid-template-columns: var(--mb-cols); column-gap: var(--mb-gap); padding: 0 10px; align-items: center; font-size: 0.88rem; cursor: default; white-space: nowrap; box-sizing: border-box; }
.mb-cell { overflow: hidden; text-overflow: ellipsis; }
.mb-list:not(.mb-kbd) .mb-row:hover { background: var(--shade); }      /* .mb-kbd: the keyboard is driving -- the resting mouse pointer must not light a second row */
.mb-row.mb-sel { background: var(--shade-strong); box-shadow: inset 3px 0 0 var(--accent); }
.mb-list:focus .mb-row.mb-sel { background: var(--accent); color: #fff; }
.mb-editing .mb-listbox { opacity: .55; pointer-events: none; }
.mb-foot { display: flex; justify-content: space-between; align-items: center; padding: 3px 10px; font-size: 0.78rem; color: var(--muted); border-top: 1px solid var(--border); background: var(--shade); }
.mb-clear { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }
.mb-clear:hover { text-decoration: underline; }

.mb-form { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; gap: max(0px, calc(4px + var(--lay-fy, 0px))) 28px; margin-top: 10px; }
.mb-col { min-width: 0; }
.mb-f { display: flex; align-items: center; gap: 6px; margin-bottom: max(0px, calc(3px + var(--lay-fy, 0px))); }
.mb-f > label:first-child { flex: 0 0 122px; white-space: nowrap; text-align: right; font-size: 0.82rem; color: var(--muted); }
.mb-f .mb-inl.mb-push { margin-left: auto; }          /* a paired field that sits at the right end of the row (its box lines up with the box above) */
.mb-f.mb-link a { font-size: 0.82rem; font-weight: 600; color: var(--accent, #1a56c4); text-decoration: underline; }   /* the GST verification link above GST No (Customer Master) */
.mb-f .mb-sfx { flex: 0 0 auto; margin-left: 6px; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }   /* a note after the box, e.g. "(for doctors)" */
.mb-f.mb-spacer { visibility: hidden; }                  /* skip_row: an empty row of the same height, so a column can start on its 2nd row (Customer Master Customised) */
html[data-view="mobile"] .mb-f.mb-spacer { display: none; }
.mb-f .mb-wide { flex-basis: 150px; width: 150px; }
.mb-f .mb-inl { flex: 0 0 auto; margin-left: 6px; font-size: 0.82rem; color: var(--muted); }
.mb-f input[type="text"], .mb-f select { box-sizing: border-box; min-width: 0; padding: 4px 7px; font-size: 0.9rem; border: 1px solid var(--border); border-radius: 4px; color: var(--input-fg); background: var(--input-bg); }
.mb-f input:disabled, .mb-f select:disabled { opacity: 1; color: var(--ink); background: var(--shade); }
.mb-f input[readonly] { background: var(--shade); }
.mb-grow { flex: 1 1 auto; }
.mb-w300 { flex: 0 0 300px; width: 300px; }
.mb-sec { margin: 8px 0 4px; font-weight: 600; font-size: 0.9rem; color: var(--ink); border-bottom: 1px solid var(--border); padding-bottom: 2px; }             /* section caption inside a master's details (GST Master: Ledger Heads) */
html:not([data-view="mobile"]) .mb-form.mb-nc-1.mb-wide-form { grid-template-columns: minmax(0, 1fr); }
.mb-wide-form .mb-f select { flex: 1 1 0; min-width: 0; }
.mb-wide-form .mb-f .mb-inl { flex: 0 0 96px; text-align: right; }
html[data-view="mobile"] .mb-wide-form .mb-f { flex-wrap: wrap; }
.mb-w70 { flex: 0 0 70px; width: 70px; } .mb-w80 { flex: 0 0 80px; width: 80px; } .mb-w100 { flex: 0 0 100px; width: 100px; } .mb-w140 { flex: 0 0 140px; width: 140px; }
.mb-r { text-align: right; }
.mb-f .mb-l2 { flex: 0 0 96px; margin-left: 14px; text-align: right; }
.mb-trio .mb-w100 { flex-basis: 90px; width: 90px; }
.mb-rates { margin: 8px 0 6px; }
.mb-flags { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 2px 0 0 0; }
@media (max-width: 1250px) {      /* a narrower window: the tick boxes drop under the other two columns, in rows */
  .mb-form { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .mb-c3 { grid-column: 1 / -1; }
  .mb-flags { grid-template-columns: repeat(4, auto); justify-content: start; gap: 4px 22px; }
}
.mb-flags.mb-flags-row { grid-template-columns: repeat(2, auto); justify-content: start; gap: 4px 28px; }          /* two ticks: side by side */
.mb-flags label[hidden] { display: none !important; }
.mb-flags label { font-size: 0.86rem; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.mb-msg { font-size: 0.88rem; margin-right: 12px; text-align: right; }
.mb-msg.mb-ok { color: #15803d; } .mb-msg.mb-bad { color: #b91c1c; font-weight: 600; }
.mb-up { display: none; margin: 14px 0 0; padding: 6px 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.mb-f .mb-chk { display: flex; align-items: center; gap: 6px; margin-left: 10px; font-size: 0.82rem; color: var(--muted); white-space: nowrap; }
.mb-extras { margin-top: 12px; }
.mb-extras .mb-f > label:first-child { flex-basis: 112px; }

/* Function keys (static/fkeys.js): a button that owns a key shows it, "Save (F3)" -- only while Display > Function keys is On (PC view) */
html[data-fkeys="on"] [data-fkey]::after { content: " (" attr(data-fkey) ")"; }
/* Report close box (templates/base.html, Esc in static/fkeys.js): the legacy window's red X, at the right end of the menu bar */
.rep-close { flex: 0 0 auto; align-self: center; width: 1.25rem; height: 1.25rem; margin: 0 12px 0 0;   /* 1.25rem = the height of the screen title text beside it */ display: inline-flex; align-items: center; justify-content: center; background: #d4281f; color: #fff; border: 1px solid #a51d16; border-radius: 3px; box-sizing: border-box; text-decoration: none; cursor: pointer; }
.rep-close svg { display: block; width: 0.65rem; height: 0.65rem; }
.rep-close:hover { background: #e8372d; }
.rep-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html[data-view="mobile"] .rep-close, html.focus-tab .rep-close { display: none; }
@media print { .rep-close { display: none; } }
/* Exit has no F-key: Esc (static/fkeys.js) */
html[data-fkeys="on"] #eb-exit::after { content: " (Esc)"; }

/* ---- Screen tabs (static/tabs.js; Sabari, 2026-10-21) ----
   A thin line hangs just below the menu bar and the tabs hang from it (the Sandbox-marker idea): absolutely positioned, so layers 1-4
   never move.  The frame under it is the screen's own layer 3 (the page hides its shell with html.in-frame). */
html[data-tabs="on"] .nav-newtab { display: none; }                       /* the "=" new-tab icon: replaced by tabs */
html.in-frame .shell-top, html.in-frame .app-footer { display: none !important; }
html.in-frame .rep-close { display: none; }
html.in-frame[data-sandbox] body::before, html.in-frame[data-sandbox] body::after { display: none; }   /* the Sandbox marker is drawn once, by the page around the frames */
#tabTitleSlot[hidden] { display: none !important; }
.tab-strip { position: absolute; left: 0; right: 0; top: 100%; height: 2px; background: var(--accent); z-index: 45; pointer-events: none; }
.tab-strip[hidden] { display: none; }
.tab-strip .tabs-row { position: absolute; left: 20px; right: 84px; top: 2px; display: flex; gap: 3px; }   /* right: room for the Help button */
.tabs-row .ptab { flex: 0 1 auto; min-width: 0; }                                                          /* nine tabs: long names shrink with an ellipsis, the open one and Dashboard never do */
.tabs-row .ptab span { overflow: hidden; text-overflow: ellipsis; }
.tabs-row .ptab.act, .tabs-row .ptab-dash { flex-shrink: 0; }
.tabs-row .ptab-dot, .tabs-row .ptab-x { flex: 0 0 auto; }
.ptab { pointer-events: auto; height: 16px; box-sizing: border-box; padding: 0 9px; display: flex; align-items: center; gap: 6px; cursor: pointer; user-select: none;
  font: 600 11px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); white-space: nowrap;
  background: var(--shade-strong, #dde5f4); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 6px 6px; }
.ptab:hover { background: var(--shade, #cfd9ee); }
.ptab.act { background: var(--accent); border-color: var(--accent); color: #fff; }
.ptab svg { display: block; flex: 0 0 auto; }
.ptab-x { display: inline-flex; opacity: .65; margin-left: 2px; }
.ptab-x:hover, .ptab.act .ptab-x { opacity: 1; }
.ptab-dot { width: 6px; height: 6px; border-radius: 50%; background: #d97706; display: inline-block; }
.ptab-dot[hidden] { display: none; }
.ptab.act .ptab-dot { background: #fbbf24; }
.tab-host { position: relative; flex: 1 1 0; min-height: 0; }
.tab-host[hidden] { display: none; }
.tab-host iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--bg); }
.tab-host iframe.ptab-off { visibility: hidden; pointer-events: none; }     /* hidden but still laid out, so the screen's fit-to-window scripts keep working */
html.tabs-active, html.tabs-active body { height: 100%; overflow: hidden; }
html.tabs-active .content, html.tabs-active .app-footer { display: none !important; }
/* the Dashboard header while a screen tab is showing: the short header every other screen has (tabs.js toggles .shell-compact) */
html:not([data-view="mobile"]) .shell-compact .brand-wrap { display: contents; }
html:not([data-view="mobile"]) .shell-compact .brand-wrap > .brand-logo,
html:not([data-view="mobile"]) .shell-compact .brand-wrap > .brand-id,
html:not([data-view="mobile"]) .shell-compact .brand-wrap > .brand-sep { display: none; }
@media print { .tab-strip { display: none; } }

/* Help popup (static/tabs.js) + its button at the right end of the tab strip */
.ptab-help { position: absolute; right: 20px; top: 2px; }
.ptab-help b { font-weight: 700; }
.po-help-box { width: 860px; max-width: 94vw; max-height: 92vh; overflow-y: auto; }
.po-help-cols { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
@media (max-width: 700px) { .po-help-cols { grid-template-columns: 1fr; } }
.po-help-box h3 { margin: 12px 0 4px; font-size: 0.86rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.po-help-box table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.po-help-box td { padding: 3px 0; vertical-align: top; }
.po-help-box td:first-child { width: 44%; white-space: nowrap; padding-right: 12px; }
.po-help-box kbd { display: inline-block; min-width: 18px; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; background: var(--panel); font: 600 0.8rem system-ui, sans-serif; text-align: center; }
.po-help-note { margin: 0 0 6px; padding: 6px 8px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 10%, var(--panel)); font-size: 0.84rem; }
.po-help-act { margin-top: 16px; text-align: right; }

/* Screen tabs: a menu drop-down opens OVER the floating tab strip (the strip hangs just below the menu bar and is z-index 45) */
html[data-tabs="on"] .appnav { position: relative; z-index: 50; }

/* Screen tabs: while the strip shows and the Dashboard tab is the one on screen, a few pixels of air between the strip and the Dashboard cards */
html.po-strip:not(.tabs-active) main.content { margin-top: 10px; }

/* Display > Layout window (2026-10-21).  The sample inside it wears the real report classes, so it shows exactly what the page will do; the
   three variables (--ctl-h control height, --lay-gy added to a grid cell's top / bottom padding, --lay-fy added to the filter rows' gaps) are
   set on it by setLayout() in base.html, and on <html> for the page itself. */
.lay-ov { position: fixed; inset: 0; z-index: 400; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px 12px; overflow-y: auto; }
.lay-ov[hidden] { display: none; }
.lay-win { width: 640px; max-width: 100%; background: var(--panel); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35); padding: 14px 18px 16px; }
.lay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lay-head h2 { margin: 0; font-size: 1.05rem; }
.lay-x { border: 0; background: none; font-size: 1.4rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.lay-x:hover { color: var(--ink); background: var(--shade); }
.lay-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.lay-tab { border: 1px solid transparent; border-bottom: 0; background: none; color: var(--muted); padding: 6px 14px; border-radius: 6px 6px 0 0; font-size: 0.88rem; cursor: pointer; margin-bottom: -1px; }
.lay-tab.active { background: var(--panel); border-color: var(--border); color: var(--ink); font-weight: 600; }
.lay-tab:disabled { opacity: 0.5; cursor: not-allowed; }
.lay-tab small { font-size: 0.68rem; margin-left: 4px; }
.lay-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.lay-preset { border: 1px solid var(--border); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px 6px; cursor: pointer; font-size: 0.9rem; text-align: center; }
.lay-preset small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 2px; }
.lay-preset:hover { border-color: var(--accent); }
.lay-preset.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lay-preset.active small { color: rgba(255, 255, 255, 0.85); }
.lay-sample-wrap { border: 1px dashed var(--border); border-radius: 8px; padding: 10px; background: var(--bg); margin-bottom: 10px; }
.lay-sample-cap { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); margin-bottom: 6px; }
.lay-sample { pointer-events: none; user-select: none; }
.lay-sample .cs-form { margin-bottom: 8px; }
.lay-fine > summary { cursor: pointer; font-size: 0.85rem; color: var(--muted); padding: 4px 0; }
.lay-fine-grid { display: grid; grid-template-columns: 150px 1fr 56px; gap: 8px 10px; align-items: center; margin: 6px 0 4px; font-size: 0.85rem; }
.lay-fine-grid output { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.lay-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; }
.lay-note { font-size: 0.78rem; color: var(--muted); }
.lay-open { border: 1px solid var(--border); background: var(--panel); color: var(--ink); border-radius: 6px; padding: 4px 10px; font-size: 0.82rem; cursor: pointer; }
.lay-open:hover { border-color: var(--accent); color: var(--accent); }

/* Display > Layout > Zebra rows OFF (2026-10-21): plain rows -- the shaded even rows go back to the plain background (the cell's own thin bottom line,
   .grid td's 1px border, is the separator).  Set on <html> for a Reports page and on the Layout window's preview; the hovered row keeps its highlight,
   the frozen S/N + name columns keep the panel colour they always need (they must not show the scrolling cells through). */
[data-zebra="off"] .stock-sales-grid tbody tr:nth-child(even):not(:hover) td:not(.stock-sales-freeze-sn):not(.stock-sales-freeze-name) { background: none; }
[data-zebra="off"] .stock-sales-grid tbody tr:nth-child(even):not(:hover) td.stock-sales-freeze-sn,
[data-zebra="off"] .stock-sales-grid tbody tr:nth-child(even):not(:hover) td.stock-sales-freeze-name { background: var(--panel); }
.lay-zebra { margin: 0 0 10px; padding: 0 2px; }

/* Display > Layout, ENTRY screens (2026-10-21).  Boxes, selects and buttons already follow --ctl-h (the global rule far above); what is added here
   is the rest of an entry screen: the vertical gap between the header's field rows (.sep-row / .rc-row) and the height of the rows of the entry grids
   (.sep-grid bills, .rc-grid receipts / payments; the Day Book / Ledger Edit grid follows --lay-gy through .de-grid td).
   Every rule hangs on html[data-lay-on] (base.html / PoLayout put it there ONLY while a level other than Standard is on), so Standard is the
   untouched old look.  --e-in is the height of a grid input today: 26px on the non-batch screens, 21px on the batch wise ones (measured). */
/* ONE gap between the controls of an entry screen's header, the same 4px as between the filter boxes of a report (Sabari, 2026-10-21: "vertical
   gap in report screens are perfect, can we make the entry screens similar" -- a caption with its box counts as one control, so 4px is the space
   from the bottom of a box to the top of the next row's caption).  It was 7px (sales / purchase / returns / stock adjustment) and 8px (receipts /
   payments).  Always on in Normal view, not only while a Layout level is chosen; the level adds / takes away from this 4px through --lay-fy. */
html:not([data-view="mobile"])[data-lay-area="entry"] .sep-row,
html:not([data-view="mobile"])[data-lay-area="entry"] .rc-row { row-gap: max(0px, calc(4px + var(--lay-fy, 0px))); margin-bottom: max(0px, calc(4px + var(--lay-fy, 0px))); }
/* the Entry preview in the Layout window: the same three variables, on its own small classes (the real entry screens keep their styles inside their pages) */
.lay-erow { display: flex; align-items: center; flex-wrap: wrap; gap: max(0px, calc(4px + var(--lay-fy, 0px))) 14px; margin-bottom: max(0px, calc(4px + var(--lay-fy, 0px))); font-size: 0.85rem; }
.lay-erow label { font-weight: 600; font-size: 12.5px; }
.lay-egrid { border-collapse: collapse; margin: 4px 0 8px; font-size: 0.85rem; }
.lay-egrid th { text-align: left; padding: 4px; font-size: 0.72rem; text-transform: uppercase; color: var(--muted); }
.lay-egrid td { padding: 0 4px; }
.lay-ebar { display: flex; gap: 8px; }

/* Receipt / payment grids (Customer Receipt, Supplier Payment, plain and voucher): exactly the Sales Entry grid pattern (2026-10-21).  Every cell is a
   square-cornered box, 21px high, text 1pt smaller, the boxes touch each other (1px overlap) and there is no line between rows; static/rc_boxes.js
   wraps the saved rows' text in .rc-box, the row being typed in has its own inputs.  The current row is marked by its S/N turning accent colour and
   bold.  Normal view only -- Mobile view keeps its card layout. */
html:not([data-view="mobile"]) .rc-grid { font-size: calc(0.9rem - 1pt); }
html:not([data-view="mobile"]) .rc-grid th { padding: 6px 4px; }
html:not([data-view="mobile"]) .rc-grid td { padding: 0 4px; border-bottom: 0; line-height: 1; }
html:not([data-view="mobile"]) .rc-grid td .rc-box, html:not([data-view="mobile"]) .rc-grid td.c-name input, html:not([data-view="mobile"]) .rc-grid td.c-mode select, html:not([data-view="mobile"]) .rc-grid td.c-pay input {
  display: block; width: 100%; box-sizing: border-box; height: 21px; margin: 0 0 -1px; padding: 0 5px; line-height: 19px; border: 1px solid var(--border); border-radius: 0; font-size: calc(0.9rem - 1pt); }
html:not([data-view="mobile"]) .rc-grid td .rc-box { background: var(--shade-strong); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html:not([data-view="mobile"]) .rc-grid td.num .rc-box, html:not([data-view="mobile"]) .rc-grid td.c-amt .rc-box { text-align: right; font-variant-numeric: tabular-nums; }
html:not([data-view="mobile"]) .rc-grid td.c-sn .rc-box { color: var(--muted); }
html:not([data-view="mobile"]) .rc-grid tr.cur td { background: none; }
html:not([data-view="mobile"]) .rc-grid tr.cur td.c-sn .rc-box { color: var(--accent); font-weight: 700; }
html:not([data-view="mobile"]) .rc-grid tr.locked td .rc-box { color: var(--muted); }
html:not([data-view="mobile"]) .rc-grid td button.de-row-del { height: 20px; min-height: 0; padding-top: 0; padding-bottom: 0; line-height: 1; display: block; margin-bottom: -1px; }
html:not([data-view="mobile"]) .rc-grid tbody tr:first-child td .rc-box, html:not([data-view="mobile"]) .rc-grid tbody tr:first-child td input, html:not([data-view="mobile"]) .rc-grid tbody tr:first-child td select, html:not([data-view="mobile"]) .rc-grid tbody tr:first-child td.c-x button { margin-top: 2px; }
html:not([data-view="mobile"]) .rc-grid tbody tr:last-child td .rc-box, html:not([data-view="mobile"]) .rc-grid tbody tr:last-child td input, html:not([data-view="mobile"]) .rc-grid tbody tr:last-child td select, html:not([data-view="mobile"]) .rc-grid tbody tr:last-child td.c-x button { margin-bottom: 0; }

/* Entry grids, all screens: the Sales Entry (batch wise) pattern (2026-10-21).  The batch wise screens (sal_ent, pur_ent, sal_ret, pur_ret) carry these same rules
   in their own pages; the non-batch, Customised, Stock Conversion and Stock Adjustment screens get them here so every Entry grid looks and measures alike:
   square boxes that touch (1px overlap), 21px high, no line between rows, 1pt smaller text, 2px of air under the heading.  Normal view only. */
html:not([data-view="mobile"]) .sep-grid { font-size: calc(0.9rem - 1pt); }
html:not([data-view="mobile"]) .sep-grid td { padding-top: 0; padding-bottom: 0; border-bottom: 0; line-height: 1; }
html:not([data-view="mobile"]) .sep-grid td input[type="text"] { display: block; font-size: calc(0.9rem - 1pt); margin-bottom: -1px; border-radius: 0; padding-top: 2px; padding-bottom: 2px; }
html:not([data-view="mobile"]) .sep-grid td.c-x button.de-row-del { height: 20px; min-height: 0; padding-top: 0; padding-bottom: 0; line-height: 1; display: block; margin-bottom: -1px; }
html:not([data-view="mobile"]) .sep-grid tbody tr:first-child td input[type="text"], html:not([data-view="mobile"]) .sep-grid tbody tr:first-child td.c-x button { margin-top: 2px; }
html:not([data-view="mobile"]) .sep-grid tbody tr:last-child td input[type="text"] { margin-bottom: 0; }
html:not([data-view="mobile"]) .sep-grid th { padding: 6px 4px; }
html:not([data-view="mobile"]) .sep-grid td { padding-left: 4px; padding-right: 4px; }

/* Display > Layout, ENTRY grids (2026-10-21, Sabari: "assume the grid we have adjusted belongs to Compact").  The 21px touching-box grid above is the Compact
   level; Standard and Comfortable are taller versions of it.  Entry pages always carry the level (data-lay-on, even at Standard).
   --e-h = the height of a grid box: 24 + 1.5 x --lay-gy = 21 Compact (g -2) . 24 Standard (0) . 27 Comfortable (+2); the Fine tune slider moves it too.
   From Comfortable up (data-lay-rows="lines", set by app.py / PoLayout when g >= 2) the grid also draws a thin horizontal line between rows. */
html[data-lay-on][data-lay-area="entry"] { --e-h: max(16px, calc(24px + var(--lay-gy, 0px) * 1.5)); }
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .sep-grid td input[type="text"],
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .sep-grid td select,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] #sep-panel .de-grid td input[type="text"],
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .rc-grid td .rc-box,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .rc-grid td.c-name input,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .rc-grid td.c-mode select,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .rc-grid td.c-pay input { height: var(--e-h); }
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .rc-grid td .rc-box { line-height: calc(var(--e-h) - 2px); }
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .sep-grid td.c-x button.de-row-del,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] .rc-grid td.c-x button.de-row-del,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] #sep-panel .de-grid .de-row-add,
html:not([data-view="mobile"])[data-lay-on][data-lay-area="entry"] #sep-panel .de-grid .de-row-del { height: calc(var(--e-h) - 1px); }
/* horizontal lines: each row gets 2px above and below its boxes and a 1px line; the boxes no longer overlap vertically */
html:not([data-view="mobile"])[data-lay-rows="lines"][data-lay-area="entry"] :is(.sep-grid, .rc-grid, .de-grid) td { padding-top: 2px; padding-bottom: 2px; border-bottom: 1px solid var(--border); }
html:not([data-view="mobile"])[data-lay-rows="lines"][data-lay-area="entry"] :is(.sep-grid, .rc-grid, .de-grid) td :is(input, select, button, .rc-box) { margin-top: 0 !important; margin-bottom: 0 !important; }
/* the same two levels in the Layout window's Entry preview */
.lay-egrid td input { height: max(16px, calc(24px + var(--lay-gy, 0px) * 1.5)); width: 100%; box-sizing: border-box; display: block; margin-bottom: -1px; padding: 0 6px; border: 1px solid var(--border); border-radius: 0; background: var(--input-bg); color: var(--input-fg); font-size: 0.85rem; }
.lay-egrid tr:last-child td input { margin-bottom: 0; }
.lay-edel { height: max(14px, calc(23px + var(--lay-gy, 0px) * 1.5)); border: 1px solid var(--border); background: var(--panel); color: var(--ink); border-radius: 4px; padding: 0 7px; }
[data-lay-rows="lines"] .lay-egrid td { padding-top: 2px; padding-bottom: 2px; border-bottom: 1px solid var(--border); }
[data-lay-rows="lines"] .lay-egrid td input { margin-bottom: 0; }

/* Screen tabs ON (Display > Screen tabs): a screen opened as a tab fills its frame -- no side or bottom padding, 20px at the top (clear of the tab strip that hangs
   from the menu bar).  With tabs OFF the Details layer keeps its normal 16px 20px (Sabari, 2026-10-21).  Normal view only; the Dashboard tab is not a frame and keeps its padding. */
html.in-frame:not([data-view="mobile"]) .content { padding: 20px 0 0; }

/* Master Browse for the small masters (simple_master.py / templates/simple_master.html, 2026-10-21): the labels column fits the longest label (--mb-lw set by the
   page), a date box looks like the other boxes, and the details are as wide as their columns need, not as wide as the window. */
.mb-p-sm .mb-f > label:first-child { flex-basis: var(--mb-lw, 122px); }
.mb-f input[type="date"] { box-sizing: border-box; min-width: 0; padding: 3px 7px; font-size: 0.9rem; border: 1px solid var(--border); border-radius: 4px; color: var(--input-fg); background: var(--input-bg); }
.mb-f input[type="date"]:disabled { opacity: 1; color: var(--ink); background: var(--shade); }
html:not([data-view="mobile"]) .mb-form.mb-nc-1 { grid-template-columns: minmax(0, 620px); }
html:not([data-view="mobile"]) .mb-form.mb-nc-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
html:not([data-view="mobile"]) .mb-form.mb-nc-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.mb-p-sm .mb-flags { margin-left: calc(var(--mb-lw, 122px) + 6px); }
html[data-view="mobile"] .mb-p-sm .mb-flags { margin-left: 0; }

/* Master Browse: a memo box (Remarks) in the details */
.mb-f textarea { box-sizing: border-box; min-width: 0; padding: 4px 7px; font-size: 0.9rem; font-family: inherit; border: 1px solid var(--border); border-radius: 4px; color: var(--input-fg); background: var(--input-bg); resize: vertical; min-height: 54px; }
.mb-f textarea:disabled { opacity: 1; color: var(--ink); background: var(--shade); }
.mb-f:has(textarea) { align-items: flex-start; }
.mb-f:has(textarea) > label:first-child { padding-top: 5px; }
/* fill: a memo box that stretches down to the bottom of its column, level with the last row of the column beside it (Customer Master Customised) */
.mb-col.mb-col-fill { display: flex; flex-direction: column; }
.mb-f.mb-fill { flex: 1 1 auto; margin-bottom: 0; }
.mb-f.mb-fill textarea { align-self: stretch; height: auto; min-height: 30px; resize: none; }
html[data-view="mobile"] .mb-col.mb-col-fill { display: block; }
html[data-view="mobile"] .mb-f.mb-fill { flex: 0 0 auto; }
html[data-view="mobile"] .mb-f.mb-fill textarea { height: auto; resize: vertical; }
/* a note under a field (customer GST scheme / tax) */
.mb-note { margin: 0 0 4px calc(var(--mb-lw, 122px) + 6px); font-size: 0.78rem; color: var(--muted); }
.mb-note.mb-warn { color: #b45309; }
html[data-view="mobile"] .mb-note { margin-left: 0; }

/* Firms: the GST Scheme panel under the details (Master Browse) */
.mb-gst { margin: 12px 0 4px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--shade); font-size: 0.88rem; }
.mb-gst-h { font-weight: 600; margin-bottom: 4px; }
.mb-gst-st { font-weight: 400; color: var(--muted); margin-left: 6px; }
.mb-gst-now { margin-bottom: 6px; }
.mb-gst-tbl { max-width: 560px; margin: 4px 0 8px; }
.mb-gst-chg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 6px; }
.mb-gst-chg label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.mb-gst-chg select, .mb-gst-chg input { padding: 3px 7px; font-size: 0.9rem; border: 1px solid var(--border); border-radius: 4px; color: var(--input-fg); background: var(--input-bg); }
.mb-gst-hint { flex-basis: 100%; font-size: 0.78rem; color: var(--muted); }
.mb-gst .notice-danger { margin: 6px 0; padding: 8px 10px; }

/* Display > Layout, MASTER page (2026-10-21): the Master Browse screens follow the level -- boxes / buttons by --ctl-h (the global rule), the list's
   row height by --lay-gy (24px + 2 x g: 20 Compact . 24 Standard . 28 Comfortable), the gap between field rows by --lay-fy. The preview below is the same
   look in miniature. */
.lay-mlist { border: 1px solid var(--border); border-radius: 6px; background: var(--input-bg); overflow: hidden; margin-bottom: max(0px, calc(8px + var(--lay-fy, 0px))); }
.lay-mhead, .lay-mrow { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) 56px; column-gap: 8px; padding: 0 10px; align-items: center; font-size: 0.88rem; }
.lay-mhead { background: var(--shade); border-bottom: 1px solid var(--border); height: 24px; font-size: 0.74rem; font-weight: 600; color: var(--muted); text-transform: uppercase; }
.lay-mrow { height: max(16px, calc(24px + var(--lay-gy, 0px) * 2)); }
.lay-mrow.sel { background: var(--accent); color: #fff; }
.lay-mhead .n, .lay-mrow .n { text-align: right; }
.lay-mform { max-width: 520px; }

/* Day Book Entry: the ">" button next to the Transaction Date -- a touch screen's date picker has no Enter key, so the button does what Enter does
   (loads the day). Shown only where the main input is a finger (any-pointer: coarse) or in Mobile view, and only while the date box is waiting
   (the script sets [hidden] otherwise). Sabari, 2026-10-22. */
.de-go { display: none; }
@media (any-pointer: coarse) { .de-go:not([hidden]) { display: inline-flex; } }
html[data-view="mobile"] .de-go:not([hidden]) { display: inline-flex; }
.de-go:not([hidden]) { align-items: center; justify-content: center; min-width: 44px; min-height: 0; height: 29px; padding: 0 12px; font-size: 1.1rem; font-weight: 700; line-height: 1; }
.de-go svg { display: block; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Connect Logins (ext_logins.py, 2026-10-27) */
.cl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 12px; }
.cl-bar input[type="text"] { width: 220px; }
.cl-bar .cl-only { display: inline-flex; align-items: center; gap: 4px; }
.cl-bar .cl-count { margin-left: auto; color: var(--muted, #667); font-size: 12px; }
.cl-note { margin: 0 12px 8px; }
.cl-wrap { max-height: calc(100vh - 290px); overflow: auto; margin: 0 12px; }
.cl-grid td, .cl-grid th { white-space: nowrap; }
.cl-grid .cl-pwbox { display: flex; align-items: center; gap: 8px; }
.cl-grid td.cl-pw input { width: 170px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.cl-grid td.cl-off { text-align: center; }
.cl-actions { padding: 10px 12px 14px; }

/* Firm Mapping (firm_map.py, 2026-10-28) */
.fm-tabs { margin: 10px 12px 0; }
.fm-tabs a.nm-tab { text-decoration: none; }
.fm-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 8px 12px; }
.fm-bar input[type="text"] { width: 220px; }
.fm-bar .fm-count { margin-left: auto; color: var(--muted, #667); font-size: 12px; }
.fm-note { margin: 0 12px 8px; }
.fm-wrap { max-height: calc(100vh - 330px); overflow: auto; margin: 0 12px; }
.fm-grid td, .fm-grid th { white-space: nowrap; }
.fm-grid td.fm-cell { min-width: 300px; }
.fm-grid .fm-in { width: 100%; min-width: 280px; }
.fm-grid .fm-in.fm-missing { border-color: #c0392b; color: #c0392b; }
.fm-actions { padding: 10px 12px 14px; display: flex; gap: 14px; align-items: center; }
.fm-pop { position: absolute; z-index: 60; background: var(--panel, #fff); border: 1px solid #99a; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-height: 280px; overflow: auto; }
.fm-pop .fm-opt, .fm-pop .fm-none { padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.fm-pop .fm-none { color: #778; cursor: default; }
.fm-pop .fm-opt:hover, .fm-pop .fm-opt.fm-sel { background: #2563eb; color: #fff; }

/* Web Orders (web_ord.py, 2026-10-30) */
.wo-panel { padding: 10px 12px; }
.wo-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.wo-filter input[type=search] { width: 150px; }
.wo-grid td a { text-decoration: none; }
.wo-grid .empty { text-align: center; padding: 14px; opacity: .75; }
.wo-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 14px; margin-bottom: 6px; }
.wo-title { margin: 0 0 2px; font-size: 1.15rem; }
.wo-sub { margin: 1px 0; font-size: .92rem; }
.wo-pk { opacity: .7; font-size: .85em; }
.wo-st { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .75rem; font-weight: 700; background: #e6e6e6; color: #333; vertical-align: middle; }
.wo-st-sent { background: #fde9c8; color: #7a4b00; }
.wo-st-accepted { background: #d8e8ff; color: #0b3d91; }
.wo-st-billed { background: #d7f2e0; color: #0b6b3a; }
.wo-st-cancelled { background: #f6d8d4; color: #8a1f14; }
.wo-ed { font-size: .72rem; opacity: .75; font-style: italic; }
.wo-msg { margin: 6px 0; padding: 6px 10px; border-radius: 6px; font-size: .92rem; }
.wo-ok { background: #d7f2e0; color: #0b6b3a; }
.wo-err { background: #f6d8d4; color: #8a1f14; }
.wo-qty { width: 90px; text-align: right; }
.wo-hint { margin: 6px 0; font-size: .85rem; opacity: .8; }
.wo-actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 10px; }
.wo-actions form { margin: 0; display: flex; gap: 6px; align-items: center; }
.wo-reject input[type=text] { width: 240px; }
.wo-rej { background: #b42318; color: #fff; }
/* Web Collections: multi-select bar */
.wc-pull { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin: 0 0 8px; padding: 6px 10px; border-radius: 6px; background: #eef3fb; }
.wc-sel b { font-variant-numeric: tabular-nums; }
.wc-hint { font-size: .8rem; opacity: .7; }
.wo-grid th.wc-ck, .wo-grid td.wc-ck { width: 30px; text-align: center; }
@media (max-width: 700px) { .wo-reject input[type=text] { width: 100%; } .wo-reject { width: 100%; } .wo-filter input[type=search] { width: 110px; } }

/* ---- Waiting-work alerts (Sabari, 2026-11-01): home-page card, menu badge, live toast -- static/alerts.js, main.alert_items ---- */
.nav-badge {
  display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px;
  border-radius: 9px; background: #c62828; color: #fff;
  font-size: 0.72rem; font-weight: 700; line-height: 18px; text-align: center; vertical-align: middle;
}
.appnav-dropdown.nav-dot > summary { position: relative; }
.appnav-dropdown.nav-dot > summary::before {
  content: ""; position: absolute; top: 4px; right: 2px; width: 8px; height: 8px; border-radius: 50%; background: #c62828;
}
.alert-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; max-width: 680px; margin-bottom: 14px; }
.alert-card-link { color: inherit; text-decoration: none; }
.alert-card-link:hover { text-decoration: underline; }
.alert-card-num { font-size: 1.8rem; font-weight: 700; line-height: 1.1; color: #c62828; text-decoration: none; }
.alert-card-num.alert-zero { color: var(--muted); }
.alert-card-parts { min-height: 1.2em; }
.alert-card-parts a { color: inherit; text-decoration: none; }
.alert-card-parts a:hover { text-decoration: underline; }
.po-toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999; display: none; align-items: center; gap: 12px;
  max-width: 360px; padding: 10px 12px 10px 16px; border-radius: 8px;
  background: #1f2937; color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.28); font-size: 0.92rem;
}
.po-toast.show { display: flex; }
.po-toast a { color: #fff; text-decoration: underline; }
.po-toast-x { background: none; border: 0; color: #cbd5e1; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 4px; }

/* Batch-stock Dashboard (main.html, main.py _batch_stock_dashboard; Sabari 2026-10-31): three columns, Short Expiry over Non Moving Stocks in the left one, the other two kept for later.
   Each list scrolls inside its own card; one column on Mobile view and on an upright tablet. */
.bd-link { padding: 0; border: 0; background: none; color: var(--accent, var(--ink)); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.bd-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.bd-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.bd-card { padding: 0; overflow: hidden; }
.bd-title { margin: 0; padding: 10px 12px 0; font-size: 1rem; }
.bd-title a { color: var(--ink); text-decoration: none; }
.bd-title a:hover { text-decoration: underline; }
.bd-sub { padding: 0 12px 8px; font-size: 0.78rem; color: var(--muted); }
.bd-wrap { max-height: clamp(200px, calc(50vh - 170px), 520px); overflow: auto; border-top: 1px solid var(--border); }
.bd-t { width: 100%; font-size: 0.86rem; }
.bd-t th { position: sticky; top: 0; z-index: 1; background: var(--shade, var(--panel)); text-align: left; white-space: nowrap; }
.bd-t th.num { text-align: right; }
.bd-t td { padding: 4px 8px; vertical-align: top; }
.bd-t td.num { text-align: right; white-space: nowrap; }
.bd-nw { white-space: nowrap; }
.bd-exp td { color: var(--danger, #b42318); }
.bd-none { margin: 0; padding: 14px 12px; color: var(--muted); font-size: 0.9rem; }
html[data-view="mobile"] .bd-cols { grid-template-columns: 1fr; }
html[data-view="mobile"] .bd-col:empty { display: none; }
@media (any-pointer: coarse) and (orientation: portrait) {
  html:not([data-view="mobile"]) .bd-cols { grid-template-columns: 1fr; }
  html:not([data-view="mobile"]) .bd-col:empty { display: none; }
}
/* the five Short Expiry columns have to fit a phone: tighter cells and smaller type, Item Name wraps */
html[data-view="mobile"] .bd-card .bd-t { font-size: 0.74rem; }
html[data-view="mobile"] .bd-card .bd-t th { font-size: 0.62rem; letter-spacing: 0; padding: 5px 4px; }
html[data-view="mobile"] .bd-card .bd-t td { padding: 4px 4px; }
html[data-view="mobile"] .bd-title { padding-left: 10px; padding-right: 10px; }
html[data-view="mobile"] .bd-sub { padding-left: 10px; padding-right: 10px; }
/* Web Orders / Web Collections waiting inside column 3 of the distributor Dashboard: stacked, full column width */
.bd-col .alert-cards { grid-template-columns: 1fr; max-width: none; margin-bottom: 0; }
/* Dashboard lists as rounded, bordered tables -- the same look as the Connect Home cards (Sabari, 2026-10-31) */
.panel.bd-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; box-shadow: none; }
.bd-card .bd-wrap { border-top: 1px solid var(--border); border-radius: 0; }
.bd-card .bd-t { border-collapse: collapse; }
.bd-card .bd-t td { border-top: 1px solid var(--border); border-bottom: 0; }
.bd-card .bd-t tbody tr:first-child td { border-top: 0; }
.bd-card .bd-t th { border-bottom: 0; border-left: 0; border-right: 0; }

/* Distributor Dashboard = exactly one window (Sabari, 2026-10-31: "make sure the dashboard doesn't grow taller beyond viewport (including UI footer)"): body is the window's height, the
   footer stays at the bottom, the columns take what is left and every list scrolls inside its own card (the two left cards share the height equally). Only if the window is too small
   for the cards' minimum height does the Details layer scroll. "Generated ... Refresh" lives in the footer (base.html). */
.app-footer { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.app-footer-gen { margin: 0; }
body.dash-fit { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
body.dash-fit .content { flex: 1 1 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
body.dash-fit .bd-cols { flex: 1 1 0; min-height: 0; align-items: stretch; }
body.dash-fit .bd-col { min-height: 0; }
body.dash-fit .bd-card { flex: 1 1 0; min-height: 130px; display: flex; flex-direction: column; }
body.dash-fit .bd-card .bd-wrap { flex: 1 1 0; min-height: 0; max-height: none; }
body.dash-fit .bd-card .bd-title, body.dash-fit .bd-card .bd-sub { flex: none; }
body.dash-fit .bd-col:last-child { overflow: auto; }
/* one column on a phone / upright tablet: the lists share the height, the waiting cards keep their own */
html[data-view="mobile"] body.dash-fit .bd-cols { display: flex; flex-direction: column; gap: 10px; }
html[data-view="mobile"] body.dash-fit .bd-col:first-child { flex: 1 1 0; min-height: 276px; }
html[data-view="mobile"] body.dash-fit .bd-col:last-child { flex: none; overflow: visible; }
html[data-view="mobile"] body.dash-fit .app-footer { padding: 6px var(--m-gutter) 8px; }
@media (any-pointer: coarse) and (orientation: portrait) {
  html:not([data-view="mobile"]) body.dash-fit .bd-cols { display: flex; flex-direction: column; gap: 14px; }
  html:not([data-view="mobile"]) body.dash-fit .bd-col:first-child { flex: 1 1 0; min-height: 276px; }
  html:not([data-view="mobile"]) body.dash-fit .bd-col:last-child { flex: none; overflow: visible; }
}
/* phone: the two waiting cards sit side by side and slimmer, so the lists get the room */
html[data-view="mobile"] body.dash-fit .bd-col .alert-cards { grid-template-columns: 1fr 1fr; gap: 8px; }
html[data-view="mobile"] body.dash-fit .bd-col .alert-cards .dash-card { padding: 8px 10px; gap: 2px; }
html[data-view="mobile"] body.dash-fit .bd-col .alert-cards .alert-card-num { font-size: 1.35rem; }
html[data-view="mobile"] body.dash-fit .bd-col .alert-cards .dash-card-title { font-size: 0.85rem; }
html[data-view="mobile"] body.dash-fit .bd-col .alert-cards .alert-card-parts { font-size: 0.7rem; min-height: 0; }
/* Dashboard column 1 cards (Sabari, 2026-10-31): border in the button colour, heading band in Layer 2's (menu bar) background -- title, sub line and the column heads share it */
.panel.bd-card { border: 1px solid var(--accent); }
.bd-card .bd-title, .bd-card .bd-sub { background: var(--menu-bg); }
.bd-card .bd-t th { background: var(--menu-bg); }
.bd-card .bd-wrap { border-top-color: var(--accent); }
html[data-view="mobile"] .bd-card .bd-t th { background: var(--menu-bg); }

/* Customer Master (full profile, 2026-11-04): the columns line up at the BOTTOM -- a shorter column starts lower so its last row is level with the tallest column's */
html:not([data-view="mobile"]) .mb-form.mb-bottom .mb-col { display: flex; flex-direction: column; justify-content: flex-end; }
/* ... and the middle column is as wide as its GST Validity row (label + two 140px dates + "to" = label width + 316px), so every other box in it ends level with the second date box */
html:not([data-view="mobile"]) .mb-form.mb-bottom.mb-nc-3 { grid-template-columns: minmax(0, 1fr) minmax(calc(var(--mb-lw, 122px) + 316px), 1fr) minmax(0, 1fr); }

/* Bill links (bill_links.py): a bill number that opens the bill in its entry screen, and the "Back to ..." bar on that screen */
.bl-link { color: var(--accent); text-decoration: underline dotted; text-underline-offset: 2px; cursor: pointer; }
.bl-link:hover { text-decoration: underline; }
.bl-bar { margin: 0 0 8px; }
.bl-back { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); color: var(--accent); font-size: 0.9rem; font-weight: 600; text-decoration: none; }
.bl-back:hover { background: var(--shade-strong); }
@media print { .bl-link { color: inherit; text-decoration: none; } .bl-bar { display: none; } }
/* the highlighted (keyboard / mouse selected) grid row is accent-coloured: a bill link in it must not be accent too */
tr.kbd-sel td a.bl-link, tr.kbd-sel td a.bl-link:hover { color: #fff; }

/* Master (support) login strip -- templates/base.html, shown only while session['is_master'] (auth.py). */
.support-strip { background: #f59e0b; color: #1f1300; text-align: center; font-size: 0.78rem; font-weight: 600; padding: 3px 10px; line-height: 1.3; }

/* Master Control (admin app): the log turns into one small card per attempt on a phone. */
.master-form { max-width: 460px; }
.master-form input[type="text"], .master-form input[type="password"] { width: 100%; box-sizing: border-box; }
@media (max-width: 700px) {
  table.mclog thead { display: none; }
  table.mclog, table.mclog tbody, table.mclog tr, table.mclog td { display: block; width: 100%; box-sizing: border-box; }
  table.mclog tr { border: 1px solid var(--border, #d9dee8); border-radius: 8px; padding: 6px 10px; margin-bottom: 8px; background: var(--panel, #fff); }
  table.mclog td { border: 0; padding: 2px 0; text-align: left; }
  table.mclog td::before { content: attr(data-label); display: inline-block; min-width: 4.5em; color: var(--muted, #6b7280); font-size: 0.8em; }
}

/* Menu Builder "Show to client" column (2026-11-15): one extra first column of ticks; an unticked row (and everything under an unticked heading) dims. */
.catalog-tree.menu-vis-tree { overflow-x: auto; grid-template-columns: max-content max-content max-content max-content max-content max-content max-content max-content; }
.catalog-row > .catalog-vis { padding: 2px 0; justify-self: center; }
.catalog-separator-row > .catalog-vis { padding: 2px 0 7px; }
.catalog-separator-row > .catalog-separator-line { padding: 2px 0 7px; }
.catalog-vis input { margin: 0; cursor: pointer; }
.menu-vis-legend { margin-bottom: 10px; }
.vis-tag { display: none; margin-left: 8px; font-size: 0.72em; }
li.vis-off > .catalog-row .vis-tag { display: inline-block; }
li.vis-off .catalog-caption, li.vis-off .catalog-separator-line { opacity: 0.45; }
li.vis-off .catalog-vis input { outline: 2px solid #b91c1c; outline-offset: 1px; }

/* Clients list on a phone (2026-11-15: the extra "Login as client" action made the rows wider): the table scrolls inside its own box instead of widening the page. */
@media (max-width: 700px) {
  table.client-grid { display: block; max-width: 100%; overflow-x: auto; }
}

/* Menu Builder "All Clients" link (2026-11-18): one extra action column + its checklist window. A restricted row's link turns into "N Clients". */
.clients-link.is-restricted { color: #b45309; font-weight: 600; }
.clients-link.is-none { color: #b91c1c; }
.clients-pick { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; margin-bottom: 6px; }
.clients-pick label.checkbox { margin: 0; }

/* 2026-12-04 (Sabari): a menu row never wraps onto a second line ("Customer Receipt Entry", "Supplier Payment Entry" ...) -- the panels grow to the widest row
   (the flyout rows were wrapping because the sub-group <summary> had no nowrap and the panel was sized by the narrow top-menu item).  Normal view only. */
html:not([data-view="mobile"]) .appnav-dropdown > .appnav-panel,
html:not([data-view="mobile"]) .appnav-subdropdown > .appnav-panel { width: max-content; max-width: 90vw; }
html:not([data-view="mobile"]) .appnav-subdropdown > summary,
html:not([data-view="mobile"]) .appnav-panel-list a,
html:not([data-view="mobile"]) .appnav-panel-list .menu-disabled { white-space: nowrap; }
