/* Vendhan billing - app tweaks layered on top of the Hope UI theme */
:root { --brand:#3a57e8; --brand-rgb:58,87,232; --brand-dark:#2841c8; --brand-2:#6c4cf0; --brand-soft:#eef2ff; }

/* Sidebar menu icons use Bootstrap Icons instead of Hope UI's inline SVGs */
.iq-main-menu .nav-link .icon .bi { font-size:1.15rem; line-height:1; }
.iq-main-menu .nav-link .icon { display:inline-flex; align-items:center; justify-content:center; }

/* Company name can be long - keep the sidebar brand tidy */
.sidebar .sidebar-header .logo-title,
.iq-navbar .navbar-brand .logo-title {
  font-size:.95rem; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:190px;
}
.iq-navbar .navbar-brand .bi { font-size:1.4rem; }

/* Keep dense, business-like tables */
.table > :not(caption) > * > * { padding:.5rem .6rem; }
.table-sm td, .table-sm th { font-size:.88rem; }
.num { text-align:right; font-variant-numeric:tabular-nums; }
.line-table input { min-width:60px; }

/* Stat cards on the dashboard */
.stat-card { border-left:4px solid var(--brand); }
.stat-card .stat-value { font-size:1.5rem; font-weight:700; }
.stat-card .stat-label { text-transform:uppercase; font-size:.72rem; letter-spacing:.5px; color:#8a92a6; }

/* Soft badges */
.badge-soft-danger { background:#fde8e8; color:#c0392b; }
.badge-soft-warning { background:#fff3cd; color:#8a6d1d; }
.badge-soft-success { background:#e6f4ea; color:#1e7e34; }
.badge-soft-secondary { background:#eef0f3; color:#5c6670; }
.badge-soft-dealer { background:#fff1db; color:#a35200; border:1px solid #f5c58a; }

.form-label { font-weight:600; }
.required::after { content:" *"; color:#c0392b; }
a { text-decoration:none; }

/* Print */
@media print {
  .d-print-none { display:none !important; }
  aside.sidebar, .iq-navbar, .footer { display:none !important; }
  main.main-content { margin:0 !important; padding:0 !important; }
  body { background:#fff; font-size:12px; }
  .container-fluid { max-width:100%; }
  .print-box { border:1px solid #000 !important; box-shadow:none !important; }
  .card { box-shadow:none; }
  @page { margin:12mm; }
}
.doc-print { max-width:820px; margin:0 auto; background:#fff; padding:24px; }
.doc-print h1 { font-size:1.4rem; }
.doc-print table { width:100%; border-collapse:collapse; }
.doc-print table th, .doc-print table td { border:1px solid #999; padding:5px 7px; }
.doc-print .totals td { border:0; }

/* Searchable selects (Tom Select) — match Hope UI inputs */
.ts-wrapper.form-select { padding: 0; border: 0; background-image: none; box-shadow: none; }
.ts-wrapper .ts-control { min-height: calc(1.5em + 1rem + 2px); border: 1px solid #eee; border-radius: .25rem; background: #fff; }
.ts-wrapper.focus .ts-control { border-color: var(--bs-primary, #3a57e8); box-shadow: none; }
.ts-wrapper.field-missing .ts-control { border-color: #dc3545 !important; background: #fff0f0 !important; }
.ts-dropdown .option.active { background: var(--brand-soft); color: inherit; }

/* Item search results (bill / quotation / purchase lines): fixed to the viewport so the
   scrolling .table-responsive can't clip it; above sticky headers, below Bootstrap modals (1055). */
.item-search-results { position: fixed; z-index: 1050; min-width: 380px; max-width: min(640px, calc(100vw - 8px)); overflow-y: auto;
  /* solid card of its own: the highlighted / hovered row is a tint, so without this the page behind showed through it */
  background: var(--bs-body-bg, #fff); border: 1px solid rgba(15, 23, 42, .12); border-radius: .5rem; isolation: isolate; }
.item-search-results > .list-group-item { background-clip: padding-box; }
html.dark .item-search-results { background: var(--surface-2, #1a2238); border-color: var(--line, #262e46); }
.item-search-results .list-group-item { font-size: .875rem; }
.item-search-results .list-group-item.active { background: var(--brand-soft); color: inherit; border-color: rgba(0,0,0,.125); }

/* Bill view: floating side panel (payment / UPI QR / bill options), opened with the gear button */
.bill-side-panel { position: fixed; top: 90px; right: 16px; z-index: 1045; width: 330px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 110px); overflow-y: auto; background: var(--bs-body-bg, #fff); border-radius: .5rem;
  box-shadow: 0 .5rem 2rem rgba(0,0,0,.2); padding: 12px; transform: translateX(calc(100% + 32px)); visibility: hidden;
  transition: transform .2s ease, visibility .2s; }
.bill-side-panel.show { transform: none; visibility: visible; }
.bill-side-panel .card { box-shadow: none; border: 1px solid rgba(0,0,0,.08); }
@media print { .bill-side-panel { display: none !important; } }

/* ------------------------------------------------------------------ Quick Bill (invoices/quick.php) */
.qb-search > .bi { position:absolute; left:20px; top:50%; transform:translateY(-50%); font-size:1.5rem; color:var(--brand); pointer-events:none; }
.qb-search > .form-control { height:68px; font-size:1.35rem; padding-left:58px; padding-right:64px; border:2px solid #d9def0; border-radius:14px;
  box-shadow:0 6px 24px rgba(58,87,232,.08); }
.qb-search > .form-control:focus { border-color:var(--brand); box-shadow:0 0 0 .25rem rgba(58,87,232,.15), 0 6px 24px rgba(58,87,232,.12); }
.qb-kbd { position:absolute; right:18px; top:50%; transform:translateY(-50%); background:#eef0f7; color:#6b7280; border:1px solid #d9def0; }
.qb-drop { position:absolute; left:0; right:0; top:calc(100% + 6px); z-index:1040; background:#fff; border-radius:12px;
  box-shadow:0 12px 40px rgba(20,30,70,.18); max-height:min(460px, 60vh); overflow-y:auto; padding:6px; }
.qb-drop > button { display:flex; align-items:center; gap:12px; width:100%; text-align:left; border:0; background:none; padding:10px 12px; border-radius:8px; }
.qb-drop > button:hover, .qb-drop > button.active { background:var(--brand-soft); }
.qb-drop-title { font-size:.75rem; text-transform:uppercase; letter-spacing:.5px; color:#8a92a6; padding:6px 12px; }
.qb-drop .qb-new { color:var(--brand); font-weight:600; border-top:1px solid #eef0f3; border-radius:0 0 8px 8px; }
.qb-drop-items > button { padding:12px 14px; }
.qb-stock { font-size:.78rem; padding:3px 9px; border-radius:20px; background:#e6f4ea; color:#1e7e34; white-space:nowrap; }
.qb-stock.low { background:#fff3cd; color:#8a6d1d; } .qb-stock.out { background:#fde8e8; color:#c0392b; }
.qb-prices { display:flex; flex-direction:column; align-items:flex-end; min-width:96px; font-variant-numeric:tabular-nums; font-weight:600; }
.qb-prices .dl { color:#a35200; font-size:.85rem; }
.qb-bal { white-space:nowrap; font-size:.85rem; color:#1e7e34; } .qb-bal.is-due { color:#c0392b; font-weight:700; }

.qb-cust-chip { display:inline-flex; align-items:center; gap:6px; padding:6px 12px; border-radius:20px; background:var(--brand-soft); color:var(--brand-dark); font-weight:600; }
.qb-cust-chip.is-direct { background:#fff3cd; color:#7a5c00; }
.qb-x { border:0; background:rgba(0,0,0,.08); border-radius:50%; width:20px; height:20px; line-height:18px; padding:0; font-size:1rem; color:inherit; }
.qb-cust-search { flex:1 1 240px; min-width:240px; }   /* stays on the same line as the customer chip */
.qb-cust-search > .bi { position:absolute; left:12px; top:50%; transform:translateY(-50%); color:#8a92a6; }
.qb-cust-search > .form-control { padding-left:36px; }
.qb-dues { margin-top:10px; border-top:1px dashed #e3e6ef; padding-top:10px; }
.qb-dues-head { display:flex; flex-wrap:wrap; gap:16px; align-items:center; }
.qb-due-amt { display:flex; flex-direction:column; padding:8px 16px; border-radius:10px; min-width:150px; }
.qb-due-amt span { font-size:.72rem; text-transform:uppercase; letter-spacing:.5px; }
.qb-due-amt strong { font-size:1.6rem; line-height:1.15; font-variant-numeric:tabular-nums; }
.qb-due-amt.is-due { background:#fde8e8; color:#c0392b; } .qb-due-amt.is-clear { background:#e6f4ea; color:#1e7e34; }
.qb-dues-facts { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:2px 16px; color:#5c6670; flex:1; }
.qb-dues-facts .bi { color:#8a92a6; margin-right:4px; }
.qb-bills { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
.qb-bill { display:flex; flex-direction:column; padding:6px 10px; border-radius:8px; border:1px solid #e3e6ef; border-left:4px solid #8a92a6; color:inherit; min-width:150px; }
.qb-bill:hover { background:#f7f8fc; }
.qb-bill span { font-size:.75rem; color:#5c6670; } .qb-bill strong { font-variant-numeric:tabular-nums; } .qb-bill em { font-size:.72rem; font-style:normal; color:#8a92a6; }
.qb-bill.mid { border-left-color:#e0a800; } .qb-bill.old { border-left-color:#c0392b; } .qb-bill.old em { color:#c0392b; font-weight:600; }

.qb-lines .table td { vertical-align:middle; }
.qb-lqty { width:132px; margin:auto; flex-wrap:nowrap; } .qb-lqty .form-control { min-width:44px; }
.qb-lines input[data-f=rate] { max-width:120px; margin-left:auto; }
@keyframes qbFlash { from { background:#fff3cd; } to { background:transparent; } }
.qb-flash > td { animation:qbFlash 1.2s ease-out; }

.qb-sum { position:sticky; top:90px; }
.qb-total-box { background:linear-gradient(135deg, var(--brand), #6c4cf0); color:#fff; border-radius:14px; padding:16px; }
.qb-total { font-size:2.6rem; font-weight:800; line-height:1.1; font-variant-numeric:tabular-nums; }
.qb-sum-table td { padding:.3rem 0 !important; }
.qb-modes { display:grid; grid-template-columns:repeat(4, 1fr); gap:6px; }
.qb-modes button { display:flex; flex-direction:column; align-items:center; gap:2px; border:1px solid #d9def0; background:#fff; border-radius:10px; padding:8px 4px; font-size:.82rem; font-weight:600; color:#5c6670; }
.qb-modes button .bi { font-size:1.2rem; }
.qb-modes button.active { border-color:var(--brand); background:var(--brand-soft); color:var(--brand); }
.qb-modes button[data-mode=Credit].active { border-color:#c0392b; background:#fde8e8; color:#c0392b; }
.qb-save { padding:14px; font-size:1.15rem; border-radius:12px; }

.qb-pop { position:fixed; inset:0; z-index:1060; background:rgba(15,20,45,.45); display:flex; align-items:flex-start; justify-content:center; padding:12vh 16px 16px; }
.qb-pop-card { background:#fff; border-radius:16px; width:100%; max-width:480px; padding:20px; box-shadow:0 20px 60px rgba(0,0,0,.3); animation:qbPopIn .12s ease-out; }
@keyframes qbPopIn { from { transform:translateY(-8px) scale(.98); opacity:0; } to { transform:none; opacity:1; } }
.qb-ptype { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.qb-ptype button { display:flex; flex-direction:column; align-items:flex-start; border:2px solid #e3e6ef; background:#fff; border-radius:12px; padding:10px 14px; }
.qb-ptype button span { font-size:.8rem; color:#5c6670; } .qb-ptype button strong { font-size:1.25rem; font-variant-numeric:tabular-nums; }
.qb-ptype button.active { border-color:var(--brand); background:var(--brand-soft); }
.qb-ptype button[data-t=dealer].active { border-color:#f5a04a; background:#fff1db; }
.qb-ptype kbd, .qb-pop .btn kbd { font-size:.65rem; padding:1px 4px; background:rgba(0,0,0,.12); color:inherit; }
.qb-qty .form-control { font-size:1.4rem; }
@media (max-width: 575.98px) {
  .qb-search > .form-control { height:56px; font-size:1.1rem; }
  .qb-total { font-size:2rem; }
  .qb-kbd { display:none; }
}

/* Sidebar arrow: hover hint with the keyboard shortcut */
.sidebar .sidebar-toggle[data-hint]::after {
  content: attr(data-hint) "  ·  Ctrl+B"; position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: #1f2937; color: #fff; font-size: .75rem; font-weight: 500; white-space: pre; padding: 4px 9px; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18); opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none; z-index: 1100;
}
.sidebar .sidebar-toggle[data-hint]:hover::after { opacity: 1; visibility: visible; }

/* Bill view: customer name links to the customer ledger; prints as plain text */
.bill-cust-link:hover { text-decoration: underline; }
@media print { .bill-cust-link { color: inherit !important; font-weight: inherit !important; text-decoration: none !important; } }

/* Quick Bill full screen: only the bill, no sidebar / top bar / footer */
body.qb-full .sidebar, body.qb-full .iq-navbar, body.qb-full .footer { display:none !important; }
body.qb-full .main-content { margin-left:0 !important; width:100% !important; }
body.qb-full .content-inner { padding-top:1rem !important; }

/* Footer: developer credit (Code We Media) */
.footer .footer-body { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem 1rem; }
.app-credit-logo { position:relative; display:inline-block; line-height:0; }
.app-credit-logo img { height:40px; width:auto; transition:opacity .2s; }
.app-credit-logo .mono { opacity:.75; }
.app-credit-logo .color { position:absolute; left:0; top:0; opacity:0; }
.app-credit-logo:hover .mono { opacity:0; }
.app-credit-logo:hover .color { opacity:1; }

/* Quick Bill: F4 hint inside the customer search box */
.qb-cust-search > .form-control { padding-right:48px; }
.qb-kbd.qb-kbd-sm { right:10px; font-size:.75rem; padding:.1rem .4rem; pointer-events:none; }

/* Top header: slimmer bar + text account menu ("Admin ▾") instead of the avatar */
.iq-navbar.navbar { --bs-navbar-padding-y: .25rem; margin:.75rem 1rem 0; }
.iq-navbar .navbar-inner { min-height:44px; }
.iq-navbar .navbar-collapse:not(.offcanvas-collapse) .navbar-nav li.nav-item { padding:0 !important; }
.iq-navbar .nav-account { display:flex !important; align-items:center; gap:.45rem; padding:.35rem .75rem !important;
  border:1px solid #e3e6ef; border-radius:.5rem; color:#232d42 !important; font-weight:600; font-size:.875rem; line-height:1.2;
  transition:background-color .15s, border-color .15s; }
.iq-navbar .nav-account:hover, .iq-navbar .nav-account[aria-expanded="true"] { background:#f5f6fa; border-color:#cfd5e6; }
.iq-navbar .nav-account .bi-chevron-down { font-size:.7rem; color:#8a92a6; transition:transform .2s; }
.iq-navbar .nav-account[aria-expanded="true"] .bi-chevron-down { transform:rotate(180deg); }
.iq-navbar .nav-account::after { display:none; }
.nav-account-menu { min-width:13rem; margin-top:.4rem !important; font-size:.875rem; }

/* Sidebar menu: compact items; active page = coloured text + underline (no filled button) */
.sidebar .sidebar-body .iq-main-menu { padding-top:.5rem; }
.sidebar.sidebar-default .sidebar-body .nav-item .nav-link:not(.static-item) {
  padding:.32rem .9rem; margin:1px 0; font-size:.85rem; line-height:1.35; border-radius:.25rem; }
.sidebar .sidebar-body .nav-item .nav-link .icon { font-size:.95rem; }
.sidebar .sidebar-body .nav-item .nav-link .item-name { margin-left:.65rem; }
.sidebar.sidebar-default .nav-link:not(.static-item).active,
.sidebar.sidebar-default .nav-link:not(.static-item)[aria-expanded=true] {
  background:transparent; color:var(--bs-primary) !important; box-shadow:none; font-weight:600; }
.sidebar.sidebar-default .nav-link.active .item-name {
  text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:5px; }
.sidebar.sidebar-default .nav-link:not(.static-item):hover:not(.active):not([aria-expanded=true]) {
  background:transparent; color:var(--bs-primary); }
/* collapsed (icon-only) menu: underline the icon instead */
.sidebar.sidebar-mini .nav-link.active .icon { border-bottom:2px solid var(--bs-primary); padding-bottom:2px; }

/* Narrower side menu (Hope UI default 16.2rem / 4.8rem collapsed) */
body { --sidebar-width: 12.75rem; }
.sidebar.sidebar-mini { --sidebar-width: 4.25rem; }
.sidebar.sidebar-hover:hover { --sidebar-width: 12.75rem; }
.sidebar .sidebar-header { padding-left:.9rem; padding-right:.9rem; }
.sidebar .sidebar-header .logo-title { font-size:.95rem; }

/* Open / close menu button: a triangle on the menu edge (◀ open, ▶ collapsed).
   Shape is drawn on ::before so the ::after hover hint is not clipped. */
.sidebar .sidebar-toggle { width:16px; height:30px; right:-16px; top:18px; padding:0; border-radius:0;
  background:transparent !important; box-shadow:none !important;
  filter:drop-shadow(0 3px 6px rgba(58,87,232,.35)); transition:filter .2s, transform .2s; }
.sidebar .sidebar-toggle > .icon { display:none !important; }
.sidebar .sidebar-toggle::before { content:""; position:absolute; inset:0;
  background:linear-gradient(135deg, #5b77ff 0%, var(--bs-primary) 55%, #2a3fb8 100%);
  clip-path:polygon(0 50%, 100% 0, 100% 100%); transition:transform .35s ease, clip-path .35s ease; }
.sidebar.sidebar-mini .sidebar-toggle::before { clip-path:polygon(0 0, 100% 50%, 0 100%); }
.sidebar .sidebar-toggle:hover { filter:drop-shadow(0 4px 10px rgba(58,87,232,.55)); transform:scale(1.12); }

/* Sidebar brand: shop name wraps (max 2 lines) and stays inside the narrower menu */
.sidebar .sidebar-header .navbar-brand { padding:.7rem 0; min-width:0; flex:1 1 auto; margin-right:0; }
.sidebar .sidebar-header .logo-main { flex:0 0 auto; }
.sidebar .sidebar-header .logo-main img { width:28px !important; height:28px !important; }
.sidebar .sidebar-header .logo-title {
  font-size:.78rem; font-weight:700; line-height:1.2; margin-left:.5rem !important; min-width:0; max-width:none;
  white-space:normal; overflow:hidden; text-overflow:clip; overflow-wrap:anywhere;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }

/* Top bar: even slimmer, small account button */
.iq-navbar.navbar { --bs-navbar-padding-y: .125rem; margin-top:.5rem; }
.iq-navbar .navbar-inner { min-height:36px; flex-wrap:nowrap; gap:.75rem; }
.iq-navbar .nav-account { padding:.15rem .55rem !important; font-size:.78rem; gap:.3rem; border-radius:.375rem; }
.iq-navbar .nav-account .bi-chevron-down { font-size:.6rem; }

/* Top bar: scrolling strip of today's reminders (pauses on hover so links can be clicked) */
.rem-ticker { flex:1 1 auto; min-width:0; align-items:center; gap:.5rem; height:28px;
  background:#f5f7ff; border:1px solid #e3e8fb; border-radius:.375rem; overflow:hidden; font-size:.78rem; }
.rem-ticker-label { flex:0 0 auto; align-self:stretch; display:flex; align-items:center; gap:.3rem; padding:0 .6rem;
  background:var(--bs-primary); color:#fff !important; font-weight:600; }
.rem-ticker-label .badge { background:#fff; color:var(--bs-primary); font-size:.68rem; padding:.15em .45em; }
.rem-ticker-viewport { flex:1 1 auto; min-width:0; overflow:hidden; white-space:nowrap;
  mask-image:linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.rem-ticker-track { display:inline-flex; animation:remTicker 40s linear infinite; }
.rem-ticker:hover .rem-ticker-track, .rem-ticker:focus-within .rem-ticker-track { animation-play-state:paused; }
.rem-ticker-run { display:inline-flex; align-items:center; }
@keyframes remTicker { from { transform:translateX(0); } to { transform:translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .rem-ticker-track { animation:none; } .rem-ticker-viewport { overflow-x:auto; } }
.rem-item { display:inline-flex; align-items:center; gap:.35rem; padding:0 .9rem; border-right:1px solid #dde3f7; color:#4b5563; }
.rem-item a { color:#232d42; font-weight:600; }
.rem-item a:hover { color:var(--bs-primary); text-decoration:underline; }
.rem-type { font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color:var(--bs-primary); }
.rem-veh { font-family:var(--bs-font-monospace); font-size:.72rem; color:#6b7280; }
.rem-due { color:#6b7280; }
.rem-item.overdue .rem-due { color:#c03221; font-weight:600; }
.rem-item .rem-wa { color:#1aa053 !important; font-size:.9rem; }
.rem-item.sent { opacity:.5; }
.rem-item.rem-all { color:var(--bs-primary); font-weight:600; border-right:0; }
.rem-ticker-empty { padding:0 .75rem; color:#6b7280; }

/* Quick Bill: keep the customer list and the product list above the cards below them.
   (Dark mode blurs each card and the cards rise in on load — both put every card on its own layer,
   so without this the bill-items card covered the customer search results.) */
.qb .qb-cust   { position:relative; z-index:6; }
.qb .qb-search { position:relative; z-index:5; }
.qb-cust-search > .qb-drop { left:auto; min-width:min(460px, calc(100vw - 48px)); }   /* wide list even though the box is short */

/* Frozen action column: the last column of a scrolling table (edit / clone / delete / view buttons) stays in view on
   the right while the rest scrolls sideways. Tables get .sticky-actions from app.js (or by hand); data-no-sticky opts out.
   The cell keeps its row colour (table-warning, table-light …) layered over the card colour, and hover still shows. */
.sticky-actions { --sticky-bg: var(--bs-card-bg, #fff); overflow: clip !important; }   /* the theme's overflow:hidden would stop sticky; clip still rounds the corners */
html.dark .sticky-actions { --sticky-bg: var(--surface); }
.sticky-actions > :not(caption) > tr > :last-child {
  position: sticky; right: 0; z-index: 2;
  background-color: var(--sticky-bg);
  background-image: linear-gradient(var(--bs-table-bg, transparent), var(--bs-table-bg, transparent));
}
.has-hscroll > .sticky-actions > :not(caption) > tr > :last-child::before {   /* soft edge, only while the table scrolls sideways */
  content: ""; position: absolute; top: 0; bottom: 0; left: -8px; width: 8px; pointer-events: none;
  background: linear-gradient(to left, rgba(16, 24, 40, .08), transparent);
}
html.dark .has-hscroll > .sticky-actions > :not(caption) > tr > :last-child::before { background: linear-gradient(to left, rgba(0, 0, 0, .35), transparent); }
.sticky-actions > thead > tr > :last-child { z-index: 3; }
@media print { .sticky-actions > :not(caption) > tr > :last-child { position: static; } .sticky-actions > :not(caption) > tr > :last-child::before { display: none; } }

/* Side menu: an entry with a sub-menu (Reports). The arrow turns when it is open. */
.sidebar .nav-group > .nav-link .right-icon { margin-left: auto; font-size: .75rem; transition: transform .2s; }
.sidebar .nav-group > .nav-link[aria-expanded="true"] .right-icon { transform: rotate(90deg); }
.sidebar .nav-group > .nav-link[aria-expanded="true"] { color: var(--brand, #3a57e8); }
/* sub-menu: a tree under the group — a thin theme-coloured line from the group icon, a small branch to each page,
   smaller rounded items, and the current page as a soft pill with a dot on the line */
.sidebar .sub-nav {
  --tree: rgba(var(--brand-rgb, 58, 87, 232), .22);
  list-style: none; position: relative;
  margin: .1rem 0 .4rem calc(1.6rem - 3px) !important; padding: .15rem 0 .15rem .6rem !important;   /* line under the group icon centre */
  border-left: 2px solid var(--tree);
}
.sidebar .sub-nav > .nav-item { margin: 1px 0 !important; padding-left: 0 !important; position: relative; }
.sidebar .sub-nav > .nav-item::before {   /* branch */
  content: ""; position: absolute; left: -.6rem; top: 50%; width: .45rem; height: 2px; border-radius: 2px; background: var(--tree);
}
.sidebar .sub-nav .nav-link {
  padding: .3rem .4rem .3rem .45rem !important; margin: 0 .15rem 0 0 !important; font-size: .82rem; line-height: 1.3; min-height: 0;
  border-radius: .55rem !important; color: var(--bs-secondary-color, #6b7280) !important; background: transparent !important; box-shadow: none !important;
  transition: background-color .15s, color .15s, transform .15s;
}
.sidebar .sub-nav .nav-link .icon { margin-right: .4rem; font-size: .85rem; opacity: .75; }
.sidebar .sub-nav .nav-link .item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .sub-nav .nav-link .nav-key { display: none; }
.sidebar .sub-nav .nav-link:hover { background: rgba(var(--brand-rgb, 58, 87, 232), .08) !important; color: var(--brand, #3a57e8) !important; transform: translateX(2px); }
.sidebar .sub-nav .nav-link.active {
  background: rgba(var(--brand-rgb, 58, 87, 232), .13) !important; color: var(--brand, #3a57e8) !important; font-weight: 600;
}
.sidebar .sub-nav .nav-link.active .icon { opacity: 1; }
.sidebar .sub-nav > .nav-item:has(> .nav-link.active)::before { background: var(--brand, #3a57e8); }
.sidebar .sub-nav > .nav-item:has(> .nav-link.active)::after {   /* dot on the line */
  content: ""; position: absolute; left: calc(-.6rem - 5px); top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%;
  background: var(--brand, #3a57e8); box-shadow: 0 0 0 3px var(--bs-body-bg, #fff);
}
html.dark .sidebar .sub-nav > .nav-item:has(> .nav-link.active)::after { box-shadow: 0 0 0 3px var(--surface, #131a2d); }

/* Reports: chart cards and the table toolbar (filter + Excel / PDF / Image) */
.rk-card .card-header { background: transparent; }
.rk-chart { min-height: 260px; }
.rk-form .ts-wrapper { min-width: 200px; }   /* searchable filters (customer, supplier, category) */
.rk-tools { border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,.08)); }
.rk-tools .rk-filter { width: 240px; }
@media (max-width: 575.98px) { .rk-tools .rk-filter { width: 100%; } }
@media print { .rk-dl, .rk-tools { display: none !important; } .rk-card { break-inside: avoid; } }
/* collapsed (icons-only) menu: an open group shows its pages as smaller centred icons instead of a blank gap */
/* The collapsed menu does not widen on hover, so these apply always (not only off-hover — that brought the tree
   indent back under the mouse and pushed the icons out of sight). No tree line or indent: the open group's pages sit
   in a soft tray as centred icons; the current page is a filled theme-coloured icon. Names show as tooltips. */
.sidebar.sidebar-mini .sub-nav {
  margin: .1rem .3rem .35rem !important; padding: .2rem 0 !important; border-left: 0;
  background: rgba(var(--brand-rgb, 58, 87, 232), .06); border-radius: .65rem;
}
.sidebar.sidebar-mini .sub-nav > .nav-item::before, .sidebar.sidebar-mini .sub-nav > .nav-item::after { display: none; }
.sidebar.sidebar-mini .sub-nav .nav-link {
  justify-content: center; padding: .4rem 0 !important; margin: 1px .25rem !important; transform: none !important;
}
.sidebar.sidebar-mini .sub-nav .nav-link .item-name, .sidebar.sidebar-mini .sub-nav .nav-link .nav-key { display: none !important; }
.sidebar.sidebar-mini .sub-nav .nav-link .icon {
  display: inline-flex !important; margin: 0 !important; font-size: .9rem; opacity: .75; border-bottom: 0 !important; padding-bottom: 0 !important;
}
.sidebar.sidebar-mini .sub-nav .nav-link .icon {
  width: 1.75rem; height: 1.75rem; align-items: center; justify-content: center; border-radius: 50%;
  border: 1.5px solid transparent !important; transition: border-color .15s, background-color .15s, color .15s;
}
.sidebar.sidebar-mini .sub-nav .nav-link, .sidebar.sidebar-mini .sub-nav .nav-link:hover,
.sidebar.sidebar-mini .sub-nav .nav-link.active { background: transparent !important; }
.sidebar.sidebar-mini .sub-nav .nav-link:hover .icon { opacity: 1; color: var(--brand, #3a57e8); background: rgba(var(--brand-rgb, 58, 87, 232), .08); }
/* current page: theme-coloured icon inside a theme-coloured circle */
.sidebar.sidebar-mini .sub-nav .nav-link.active .icon {
  opacity: 1; color: var(--brand, #3a57e8); border-color: var(--brand, #3a57e8) !important;
  background: rgba(var(--brand-rgb, 58, 87, 232), .12);
}
.sidebar.sidebar-mini .nav-group > .nav-link .right-icon { display: none; }

/* Data tables (assets/js/pager.js): one slim toolbar above, info + pages below. Controls are 30px high, same radius,
   quiet borders; the brand colour marks only what is active. Rows off the page are hidden on screen; print shows all. */
tr.pg-off, tr.pg-filtered { display: none !important; }
.pg-col-off { display: none !important; }
@media print { tr.pg-off { display: table-row !important; } }
.dt-top, .dt-bottom {
  --dt-h: 30px; --dt-line: var(--bs-border-color, rgba(0,0,0,.1)); --dt-muted: var(--bs-secondary-color, #6b7280);
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .55rem .75rem; font-size: .8rem;
}
.dt-top { border-bottom: 1px solid var(--dt-line); }
.dt-bottom { border-top: 1px solid var(--dt-line); justify-content: space-between; color: var(--dt-muted); }
.dt-bottom b { color: var(--bs-body-color); font-weight: 600; }
.dt-size { display: inline-flex; align-items: center; gap: .4rem; margin: 0; color: var(--dt-muted); white-space: nowrap; }
.dt-size .form-select { width: auto; height: var(--dt-h); min-height: 0; padding: 0 1.7rem 0 .55rem; font-size: .8rem; background-position: right .45rem center; border-radius: .4rem; }
.dt-right { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-left: auto; }
.dt-slot:empty { display: none; }
.dt-search { position: relative; }
.dt-search .bi { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); font-size: .75rem; color: var(--dt-muted); pointer-events: none; }
.dt-search .form-control { height: var(--dt-h); min-height: 0; width: 210px; padding: 0 .6rem 0 1.75rem; font-size: .8rem; border-radius: .4rem; }
.dt-btn {
  display: inline-flex; align-items: center; gap: .35rem; height: var(--dt-h); padding: 0 .65rem; font-size: .78rem; font-weight: 500; line-height: 1;
  color: var(--bs-body-color); background: transparent; border: 1px solid var(--dt-line); border-radius: .4rem; white-space: nowrap;
  transition: border-color .15s, color .15s, background-color .15s;
}
.dt-btn .bi { font-size: .85rem; color: var(--dt-muted); transition: color .15s; }
.dt-btn:hover, .dt-btn[aria-expanded="true"], .dt-btn.on { border-color: var(--brand, #3a57e8); color: var(--brand, #3a57e8); }
.dt-btn:hover .bi, .dt-btn[aria-expanded="true"] .bi, .dt-btn.on .bi { color: var(--brand, #3a57e8); }
.dt-btn.dropdown-toggle::after { margin-left: .15rem; vertical-align: .12em; border-top-width: .28em; border-left-width: .28em; border-right-width: .28em; }
.dt-btn-primary { border-color: rgba(var(--brand-rgb, 58, 87, 232), .45); color: var(--brand, #3a57e8); }
.dt-btn-primary .bi { color: var(--brand, #3a57e8); }
.dt-cols { min-width: 13rem; max-height: 320px; overflow-y: auto; font-size: .8rem; padding: .3rem 0; }
.dt-cols .dropdown-item { display: flex; align-items: center; gap: .5rem; padding: .3rem .85rem; cursor: pointer; }
.dt-cols .form-check-input { margin: 0; flex: 0 0 auto; }
.dt-top .dropdown-menu { font-size: .8rem; }
.dt-bottom .pagination { gap: 3px; }
.dt-bottom .page-link {
  min-width: 28px; height: 28px; padding: 0 .45rem; display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; border-radius: .35rem !important; border: 1px solid var(--dt-line); color: var(--bs-body-color); background: transparent;
}
.dt-bottom .page-link:hover { border-color: var(--brand, #3a57e8); color: var(--brand, #3a57e8); background: transparent; }
.dt-bottom .page-item.active .page-link { background: var(--brand, #3a57e8); border-color: var(--brand, #3a57e8); color: #fff; }
.dt-bottom .page-item.disabled .page-link { opacity: .45; background: transparent; }
.dt-table.dt-compact > :not(caption) > * > * { padding-top: .22rem !important; padding-bottom: .22rem !important; }
.dt-table.dt-compact { font-size: .92em; }
@media (max-width: 575.98px) {
  .dt-right { width: 100%; margin-left: 0; }
  .dt-search { flex: 1 1 100%; } .dt-search .form-control { width: 100%; }
  .dt-btn span { display: none; }                  /* icons only on phones; the title says what each does */
  .dt-bottom { justify-content: center; }
}
