/* Shared responsive safeguards for both the modern and legacy ERP pages. */
html, body { max-width: 100%; overflow-x: hidden; }
#mobile-quick-create { display: none; }

/* Keep the Book Blurbs logo proportional and leave the toggle its own space. */
@media (min-width: 992px) {
  .two-col-sidebar .sidebar .sidebar-logo .logo img,
  .two-col-sidebar .sidebar .sidebar-logo .dark-logo img { display: block; width: auto !important; max-width: 145px !important; height: 32px; object-fit: contain; object-position: left center; }
  .two-col-sidebar .sidebar .sidebar-logo #toggle_btn { right: 12px !important; }
}

.table-responsive { -webkit-overflow-scrolling: touch; }

@media (max-width: 991.98px) {
  .page-wrapper { margin-left: 0 !important; width: 100%; }
  .page-wrapper .content { padding: 16px; }
  .page-header, .page-header .d-flex, .card-header .d-flex { flex-wrap: wrap; gap: 10px; }
  .page-header .btn, .card-header .btn { white-space: nowrap; }
  .card, .card-body { min-width: 0; }
  .modal-dialog { margin: 12px; max-width: calc(100% - 24px); }
  .dataTables_wrapper .row { row-gap: 12px; }
  .dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length { text-align: left; }
}

@media (max-width: 575.98px) {
  /* The fixed mobile header must not cover the page heading or the first action. */
  .page-wrapper { padding-top: 56px !important; }
  .page-wrapper .content { padding: 12px; }
  #mobile-quick-create { display: block !important; position: absolute; z-index: 1068; top: 11px; right: 54px; }
  #mobile-quick-create > a { width: 34px; height: 34px; min-width: 34px; min-height: 34px; padding: 0; }
  /* The hidden desktop sidebar logo left a second 56px gap above the menu. */
  .two-col-sidebar .sidebar-menu { margin-top: 0 !important; }

  /* Bootstrap/Popper adds a translate transform; remove it so this panel stays below the fixed header while the page scrolls. */
  #mobile-quick-create .dropdown-menu {
    position: fixed !important;
    top: 56px !important;
    right: 12px !important;
    bottom: auto !important;
    left: auto !important;
    margin: 0 !important;
    transform: none !important;
    z-index: 1070 !important;
  }
  .page-header h3, .page-header h4 { font-size: 1.1rem; }
  .btn { min-height: 38px; }
  .form-control, .form-select { min-height: 40px; }
  .table { min-width: 620px; }
  .card-header, .card-body { padding: 14px; }
  .breadcrumb { font-size: .8rem; }

  /* Compact editable line cards: Invoice, Debit Note, Purchase and PO. */
  #slItems, #dnItems, #productBox tbody { display: block; }
  #slItems tr, #dnItems tr, #productBox .prod-row {
    position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px; margin: 10px 0; padding: 12px; border: 1px solid #d9e1ec;
    border-radius: 9px; background: #fff;
  }
  #slItems td, #dnItems td, #productBox .prod-row td { display: block !important; min-width: 0; border: 0 !important; padding: 0 !important; }
  #slItems td:first-child, #dnItems td:first-child, #productBox .prod-row td:first-child { grid-column: 1 / -1; padding-right: 34px !important; font-size: .9rem; }
  #slItems td:first-child small, #dnItems td:first-child small, #productBox .prod-row td:first-child .text-muted { margin-top: 3px; font-size: .75rem; }
  #slItems td:not(:first-child):not(:last-child)::before,
  #dnItems td:not(:first-child):not(:last-child)::before,
  #productBox .prod-row td:not(:first-child):not(:last-child)::before { display: block; margin-bottom: 3px; color: #60738d; font-size: .7rem; font-weight: 700; }

  /* Invoice: Unit is intentionally hidden on phones; tax appears only when enabled. */
  #slItems td:nth-child(2) { display: none !important; }
  #slItems td:nth-child(3)::before { content: 'MRP'; }
  #slItems td:nth-child(4)::before { content: 'Quantity'; }
  #slItems td:nth-child(5)::before { content: 'Discount %'; }
  #slItems td:nth-child(6)::before { content: 'Net Rate'; }
  #slItems td:nth-child(7)::before { content: 'Tax %'; }
  #slItems td:nth-child(8)::before { content: 'Amount'; }
  #slItems td:nth-child(7)[style*="display: none"] { display: none !important; }

  /* Debit note: keep original purchase quantity, remove no useful data, and make return qty prominent. */
  #dnItems td:nth-child(2)::before { content: 'Purchase Qty'; }
  #dnItems td:nth-child(3)::before { content: 'MRP'; }
  #dnItems td:nth-child(4)::before { content: 'Return Qty'; }
  #dnItems td:nth-child(5)::before { content: 'Discount %'; }
  #dnItems td:nth-child(6)::before { content: 'Net Rate'; }
  #dnItems td:nth-child(7)::before { content: 'GST %'; }
  #dnItems td:nth-child(8)::before { content: 'Amount'; }

  /* Purchase / PO: Gross is hidden as Net Amount is the actionable figure. */
  #productBox .prod-row td:nth-child(2)::before { content: 'MRP'; }
  #productBox .prod-row td:nth-child(3)::before { content: 'Quantity'; }
  #productBox .prod-row td:nth-child(4) { display: none !important; }
  #productBox .prod-row td:nth-child(5)::before { content: 'Discount %'; }
  #productBox .prod-row td:nth-child(6)::before { content: 'GST %'; }
  #productBox .prod-row td:nth-child(7)::before { content: 'Net Amount'; }

  #slItems td:last-child, #dnItems td:last-child { position: absolute; top: 9px; right: 9px; display: block !important; }
  #slItems td:last-child .btn, #dnItems td:last-child .btn { min-height: 30px; min-width: 30px; padding: 2px 7px; }
  #slItems .form-control, #dnItems .form-control, #productBox .form-control { min-height: 38px; padding: 7px 9px; font-size: .9rem; }
  #slItems td:nth-child(4) .form-control, #dnItems td:nth-child(4) .form-control, #productBox .prod-row td:nth-child(3) .form-control { font-size: 1rem; font-weight: 700; }

  /* Extra-small phone treatment: more lines on screen without sacrificing tap targets. */
  #slItems tr, #dnItems tr, #productBox .prod-row { gap: 6px 10px; margin: 7px 0; padding: 9px; border-radius: 8px; }
  #slItems td:first-child, #dnItems td:first-child, #productBox .prod-row td:first-child { font-size: .85rem; padding-right: 38px !important; overflow-wrap: anywhere; }
  #slItems td:not(:first-child):not(:last-child)::before, #dnItems td:not(:first-child):not(:last-child)::before, #productBox .prod-row td:not(:first-child):not(:last-child)::before { margin-bottom: 1px; font-size: .66rem; }
  #slItems .form-control, #dnItems .form-control, #productBox .form-control { min-height: 35px; padding: 5px 8px; font-size: .85rem; }
  #slItems td:last-child .btn, #dnItems td:last-child .btn { width: 28px; height: 28px; min-height: 28px; min-width: 28px; padding: 0; border-radius: 50%; border-color: #ff3d4d; background: #fff1f2; color: #e11d48; font-weight: 700; box-shadow: 0 1px 2px rgba(225,29,72,.16); }
  #slItems td:last-child .btn:hover, #dnItems td:last-child .btn:hover { background: #e11d48; color: #fff; }

  /* Six price/quantity values fit in two compact rows beneath the product name. */
  #slItems tr, #dnItems tr, #productBox .prod-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px 7px; padding: 8px; }
  #slItems td:first-child, #dnItems td:first-child, #productBox .prod-row td:first-child { font-size: .83rem; padding-right: 35px !important; }
  #slItems td:not(:first-child):not(:last-child)::before, #dnItems td:not(:first-child):not(:last-child)::before, #productBox .prod-row td:not(:first-child):not(:last-child)::before { font-size: .63rem; }
  #slItems .form-control, #dnItems .form-control, #productBox .form-control { min-height: 32px; padding: 4px 6px; font-size: .82rem; }
  #slItems td:nth-child(4) .form-control, #dnItems td:nth-child(4) .form-control, #productBox .prod-row td:nth-child(3) .form-control { font-size: .94rem; }
  #productBox .prod-row td:first-child .text-muted { display: none; }

  /* Product picker: retain the complete book title rather than ellipsising it. */
  .slps-head, .slps-row { grid-template-columns: minmax(0, 1fr) 72px 48px !important; gap: 6px !important; }
  .slps-drop { max-height: 300px !important; }
  .slps-head { padding: 7px 9px !important; font-size: 10px !important; }
  .slps-row { padding: 7px 9px !important; font-size: .79rem !important; }
  .slps-title { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; line-height: 1.18; }
  .slps-mrp, .slps-stock { font-size: .75rem; white-space: nowrap; }

  /* The desktop table header is not needed once line items become cards. */
  #slItems.closest-does-not-exist, #dnItems.closest-does-not-exist { display: none; }
  #slItems { border-top: 0; }
  #slItems tr:first-child, #dnItems tr:first-child, #productBox .prod-row:first-child { margin-top: 0; }
  #slItems, #dnItems, #productBox table { min-width: 0 !important; }
  #slItems, #dnItems { width: 100%; }
  #slItems::before, #dnItems::before { content: ''; }
  #slItems { }
  .table-responsive:has(#slItems), .table-responsive:has(#dnItems), #productBox .table-responsive { overflow: visible; }
  .table-responsive:has(#slItems) thead, .table-responsive:has(#dnItems) thead, #productBox .table-responsive thead { display: none; }

  /* Summary tables must not inherit the wide desktop-table width. */
  table:has(#slSub), table:has(#dnMrpTotal) { min-width: 0 !important; width: 100% !important; table-layout: fixed; }
  table:has(#slSub) th, table:has(#dnMrpTotal) th { width: 62%; font-size: .78rem; white-space: nowrap; }
  table:has(#slSub) td, table:has(#dnMrpTotal) td { width: 38%; font-size: .8rem; white-space: nowrap; overflow: visible; }

  /* Notes and terms are intentionally shorter on mobile. */
  #slNotes, #slTerms, #dnReason, #dnTerms, #notes { min-height: 48px !important; height: 48px !important; }

  /* Final compact pass for narrow 320–375px screens. */
  #slItems tr, #dnItems tr, #productBox .prod-row { gap: 4px 6px; margin: 5px 0; padding: 6px; }
  #slItems .form-control, #dnItems .form-control, #productBox .form-control { min-height: 29px; padding: 3px 5px; font-size: .8rem; }
  #slItems td:first-child small, #dnItems td:first-child small { margin-top: 1px; }
  #slNotes, #slTerms, #dnReason, #dnTerms, #notes { min-height: 42px !important; height: 42px !important; }

  /* Invoice / bundle card redesign: title + MRP header, then 2 × 2 touch-friendly fields. */
  #slItems tr { grid-template-columns: minmax(0, 1fr) 92px; gap: 9px 10px; padding: 11px; border-color: #e2e7f0; box-shadow: 0 2px 8px rgba(31,41,55,.04); }
  #slItems td:first-child { grid-column: 1; grid-row: 1; align-self: start; padding: 0 35px 0 0 !important; font-size: .92rem; font-weight: 600; }
  #slItems td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; align-self: start; color: #5733eb; font-size: 1.1rem; font-weight: 800; }
  #slItems td:nth-child(3)::before { content: 'MRP' !important; color: #677085; font-size: .68rem; font-weight: 700; }
  #slItems td:nth-child(2), #slItems td:nth-child(6) { display: none !important; }
  #slItems td:nth-child(4), #slItems td:nth-child(5), #slItems td:nth-child(7), #slItems td:nth-child(8) { border-top: 1px solid #edf0f5 !important; padding-top: 7px !important; }
  #slItems td:nth-child(4) { grid-column: 1; grid-row: 2; }
  #slItems td:nth-child(5) { grid-column: 2; grid-row: 2; }
  #slItems td:nth-child(7) { grid-column: 1; grid-row: 3; }
  #slItems td:nth-child(8) { grid-column: 2; grid-row: 3; background: #f7f5ff; border-radius: 6px; padding: 7px !important; color: #2f1ecb; font-weight: 800; }
  #slItems td:nth-child(8)::before { content: 'Amount' !important; }
  #slItems td:nth-child(4)::before { content: 'Quantity' !important; }
  #slItems td:nth-child(5)::before { content: 'Discount (%)' !important; }
  #slItems td:nth-child(7)::before { content: 'GST (%)' !important; }
  #slItems td:nth-child(7)[style*="display: none"] { display: none !important; }

  /* Make the totals area read like a simple receipt, with Grand Total highlighted. */
  table:has(#slSub) { margin-top: 12px !important; border: 1px solid #e3e6ef; border-radius: 9px; overflow: hidden; background: #fbfbff; }
  table:has(#slSub) tr { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-bottom: 1px dashed #d4d8e3; }
  table:has(#slSub) tr:last-child { border-bottom: 0; background: #f3efff; padding: 11px 10px; font-size: 1rem; }
  table:has(#slSub) th, table:has(#slSub) td { width: auto !important; padding: 0 !important; border: 0 !important; }
  table:has(#slSub) tr:last-child td { color: #5a32ed; font-size: 1.12rem; font-weight: 800; }

  /* Keep the Invoice / Bundle MRP clear of the remove control. */
  #slItems td:nth-child(3) { padding-right: 30px !important; }
  #slItems td:last-child { top: 5px; right: 5px; }
  #slItems td:last-child .btn { width: 23px; height: 23px; min-width: 23px; min-height: 23px; font-size: .8rem; }

  /* Debit Note: use the same title-and-price card layout while retaining purchase quantity. */
  #dnItems tr { grid-template-columns: minmax(0, 1fr) 92px; gap: 8px 10px; padding: 11px; border-color: #e2e7f0; box-shadow: 0 2px 8px rgba(31,41,55,.04); }
  #dnItems td:first-child { grid-column: 1; grid-row: 1; align-self: start; padding: 0 35px 0 0 !important; font-size: .92rem; font-weight: 600; }
  #dnItems td:nth-child(3) { grid-column: 2; grid-row: 1; padding-right: 30px !important; text-align: right; align-self: start; color: #5733eb; font-size: 1.1rem; font-weight: 800; }
  #dnItems td:nth-child(3)::before { content: 'MRP' !important; color: #677085; font-size: .68rem; font-weight: 700; }
  #dnItems td:nth-child(6) { display: none !important; }
  #dnItems td:nth-child(2), #dnItems td:nth-child(4), #dnItems td:nth-child(5), #dnItems td:nth-child(7) { border-top: 1px solid #edf0f5 !important; padding-top: 7px !important; }
  #dnItems td:nth-child(2) { grid-column: 1; grid-row: 2; }
  #dnItems td:nth-child(4) { grid-column: 2; grid-row: 2; }
  #dnItems td:nth-child(5) { grid-column: 1; grid-row: 3; }
  #dnItems td:nth-child(7) { grid-column: 2; grid-row: 3; }
  #dnItems td:nth-child(8) { grid-column: 1 / -1; grid-row: 4; background: #f7f5ff; border-top: 1px solid #edf0f5 !important; border-radius: 6px; padding: 7px !important; color: #2f1ecb; font-weight: 800; }
  #dnItems td:nth-child(2)::before { content: 'Purchase Qty' !important; }
  #dnItems td:nth-child(4)::before { content: 'Return Qty' !important; }
  #dnItems td:nth-child(5)::before { content: 'Discount (%)' !important; }
  #dnItems td:nth-child(7)::before { content: 'GST (%)' !important; }
  #dnItems td:nth-child(8)::before { content: 'Amount' !important; }
  #dnItems td:last-child { top: 5px; right: 5px; }
  #dnItems td:last-child .btn { width: 23px; height: 23px; min-width: 23px; min-height: 23px; font-size: .8rem; }

  /* Purchase and Purchase Order: the matching compact card pattern. */
  #productBox .prod-row { grid-template-columns: minmax(0, 1fr) 92px; gap: 8px 10px; padding: 11px; border-color: #e2e7f0; box-shadow: 0 2px 8px rgba(31,41,55,.04); }
  #productBox .prod-row td:first-child { grid-column: 1; grid-row: 1; align-self: start; padding: 0 !important; font-size: .92rem; font-weight: 600; }
  #productBox .prod-row td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; align-self: start; color: #5733eb; font-size: 1.1rem; font-weight: 800; }
  #productBox .prod-row td:nth-child(2)::before { content: 'MRP' !important; color: #677085; font-size: .68rem; font-weight: 700; }
  #productBox .prod-row td:nth-child(3), #productBox .prod-row td:nth-child(5), #productBox .prod-row td:nth-child(6), #productBox .prod-row td:nth-child(7) { border-top: 1px solid #edf0f5 !important; padding-top: 7px !important; }
  #productBox .prod-row td:nth-child(3) { grid-column: 1; grid-row: 2; }
  #productBox .prod-row td:nth-child(5) { grid-column: 2; grid-row: 2; }
  #productBox .prod-row td:nth-child(6) { grid-column: 1; grid-row: 3; }
  #productBox .prod-row td:nth-child(7) { grid-column: 2; grid-row: 3; background: #f7f5ff; border-radius: 6px; padding: 7px !important; color: #2f1ecb; font-weight: 800; }
  #productBox .prod-row td:nth-child(3)::before { content: 'Quantity' !important; }
  #productBox .prod-row td:nth-child(5)::before { content: 'Discount (%)' !important; }
  #productBox .prod-row td:nth-child(6)::before { content: 'GST (%)' !important; }
  #productBox .prod-row td:nth-child(7)::before { content: 'Amount' !important; }

  /* When tax is off, keep the three remaining invoice values on one compact row. */
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:first-child { grid-column: 1 / -1; grid-row: 1; padding-right: 96px !important; }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:nth-child(3) { position: absolute; top: 10px; right: 35px; grid-column: auto; grid-row: auto; padding: 0 !important; }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:nth-child(4) { grid-column: 1; grid-row: 2; }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:nth-child(5) { grid-column: 2; grid-row: 2; }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:nth-child(8) { grid-column: 3; grid-row: 2; min-width: 0; padding: 7px 6px !important; }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:nth-child(8)::before { font-size: .63rem; }

  /* Primary action stays full-width and visible at the end of a mobile form. */
  #slPost, #slSaveNew, #slPrintNew, #dnPost, #dnSave, #purchaseSave, #poSave { width: 100%; min-height: 42px; margin: 0 !important; }

  /* Final card header alignment: ordinary prices and a remove button pinned to the real top-right corner. */
  #slItems td:nth-child(3), #dnItems td:nth-child(3), #productBox .prod-row td:nth-child(2) { color: #273043 !important; font-size: .9rem !important; font-weight: 500 !important; }
  #slItems td:nth-child(8), #dnItems td:nth-child(8), #productBox .prod-row td:nth-child(7) { color: #273043 !important; background: #f8fafc !important; font-weight: 500 !important; }
  #slItems td:last-child, #dnItems td:last-child { top: 8px !important; right: 8px !important; z-index: 2; }
  #slItems td:last-child .btn, #dnItems td:last-child .btn { width: 24px !important; height: 24px !important; min-width: 24px !important; min-height: 24px !important; border-radius: 50% !important; }
  #slItems td:nth-child(3), #dnItems td:nth-child(3) { position: absolute !important; top: 11px !important; right: 42px !important; padding: 0 !important; }
  #slItems td:first-child, #dnItems td:first-child { padding-right: 122px !important; }
  #slItems tr:has(td:nth-child(7)[style*="display: none"]) td:nth-child(3) { right: 42px !important; }

  /* Compact KPI/stat cards: two summary cards per phone row across ERP pages. */
  .erp-kpi-grid > [class*="col-"],
  #slRealtimeDashboard .row.g-2.mb-3 > [class*="col-"],
  #slRealtimeDashboard .row.g-3.mb-3 > [class*="col-"],
  .content > .row.g-2.mb-3 > [class*="col-"]:has(> .card.h-100),
  .content > .row.g-3.mb-3 > [class*="col-"]:has(> .card.h-100) {
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
  }
  .erp-kpi-grid { --bs-gutter-x: .55rem; --bs-gutter-y: .55rem; }
  .erp-kpi-grid .card,
  #slRealtimeDashboard .row.g-2.mb-3 > [class*="col-"] > .card,
  #slRealtimeDashboard .row.g-3.mb-3 > [class*="col-"] > .card,
  .content > .row.g-2.mb-3 > [class*="col-"]:has(> .card.h-100) > .card,
  .content > .row.g-3.mb-3 > [class*="col-"]:has(> .card.h-100) > .card { min-height: 0 !important; border-radius: 9px; }
  .erp-kpi-grid .card-body,
  #slRealtimeDashboard .row.g-2.mb-3 > [class*="col-"] > .card > .card-body,
  #slRealtimeDashboard .row.g-3.mb-3 > [class*="col-"] > .card > .card-body,
  .content > .row.g-2.mb-3 > [class*="col-"]:has(> .card.h-100) > .card > .card-body,
  .content > .row.g-3.mb-3 > [class*="col-"]:has(> .card.h-100) > .card > .card-body { padding: 10px !important; }
  .erp-kpi-grid h3,
  #slRealtimeDashboard .row.g-2.mb-3 > [class*="col-"] h3,
  #slRealtimeDashboard .row.g-3.mb-3 > [class*="col-"] h3,
  .content > .row.g-2.mb-3 > [class*="col-"]:has(> .card.h-100) h3,
  .content > .row.g-3.mb-3 > [class*="col-"]:has(> .card.h-100) h3 { margin: 4px 0 !important; font-size: clamp(.95rem, 4.6vw, 1.12rem); line-height: 1.16; letter-spacing: -.02em; overflow-wrap: anywhere; }
  .erp-kpi-grid .text-muted,
  #slRealtimeDashboard .row.g-2.mb-3 > [class*="col-"] .text-muted,
  #slRealtimeDashboard .row.g-3.mb-3 > [class*="col-"] .text-muted,
  .content > .row.g-2.mb-3 > [class*="col-"]:has(> .card.h-100) .text-muted,
  .content > .row.g-3.mb-3 > [class*="col-"]:has(> .card.h-100) .text-muted { font-size: .72rem; }
  /* Hide the supporting line/link, never the h3 value (it also uses mt-2). */
  .erp-kpi-grid small,
  .erp-kpi-grid .card-body > .mt-2:not(h3) { display: none !important; }

  /* Shared mobile chrome: keep the header controls visible above an opened sidebar. */
  .header { z-index: 1065 !important; }
  .sidebar-overlay { z-index: 1060 !important; }
  .sidebar, .two-col-sidebar { z-index: 1062 !important; }
  .header .profile-dropdown .avatar { width: 34px; height: 34px; min-width: 34px; border-radius: 50%; background: #eef2f7; color: #667085; }
  .header .profile-dropdown .avatar .isax { font-size: 19px; line-height: 1; }
  .header .profile-dropdown .dropdown-toggle::after { display: none; }
}

/* Shared header controls must remain visible on the white header. */
.header .btn-menubar,
.header .btn-menubar i,
.header .theme-toggle,
.header .theme-toggle i {
  color: #172b4d !important;
}
.header .notification_item .badge {
  border-color: #fff !important;
}
.header .input-icon-addon i {
  color: #172b4d !important;
}
html[data-bs-theme="dark"] .header .btn-menubar,
html[data-bs-theme="dark"] .header .btn-menubar i,
html[data-bs-theme="dark"] .header .theme-toggle,
html[data-bs-theme="dark"] .header .theme-toggle i {
  color: #f8fafc !important;
}
html[data-bs-theme="dark"] .header .input-icon-addon i {
  color: #f8fafc !important;
}

/* Desktop profile trigger: retain a clear user icon instead of only its status dot. */
.header .profile-dropdown > .dropdown-toggle .avatar {
  width: 34px !important;
  height: 34px !important;
  min-width: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 50% !important;
  background: #172b4d !important;
  color: #fff !important;
}
.header .profile-dropdown > .dropdown-toggle .avatar .isax {
  color: #fff !important;
  font-size: 18px !important;
}

/* === Dashboard phone/header polish: 2026-08-22 === */
@media (max-width: 575.98px) {
  /* Dashboard top toolbar: no page title, compact subtitle/action row. */
  #slDashboard .sl-dashboard-toolbar {
    margin-bottom: 10px !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
  }
  #slDashboard .sl-dashboard-subtitle {
    min-width: 0;
    font-size: .72rem !important;
    line-height: 1.25;
  }
  #slDashboard .sl-dashboard-toolbar .btn {
    flex: 0 0 auto;
    min-height: 34px !important;
    padding: 6px 9px;
    font-size: .72rem;
    white-space: nowrap;
  }

  /* KPI cards: two per row, but give the full card width to long Indian currency values. */
  #slDashboard > .row.g-3.mb-3:first-of-type {
    --bs-gutter-x: .55rem;
    --bs-gutter-y: .55rem;
  }
  #slDashboard .sl-kpi-col {
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
  }
  #slDashboard .sl-kpi-card {
    min-height: 112px !important;
    border-radius: 10px !important;
    overflow: hidden;
  }
  #slDashboard .sl-kpi-card .card-body {
    position: relative;
    padding: 10px !important;
  }
  #slDashboard .sl-kpi-content {
    position: relative;
    min-width: 0;
    height: 100%;
  }
  #slDashboard .sl-kpi-label {
    padding-right: 30px;
    font-size: .70rem !important;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #slDashboard .sl-kpi-value {
    display: block;
    width: 100%;
    margin: 12px 0 5px !important;
    font-size: clamp(.83rem, 3.7vw, 1.02rem) !important;
    line-height: 1.08 !important;
    letter-spacing: -.035em;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
  }
  #slDashboard .sl-kpi-sub {
    display: block !important;
    font-size: .64rem !important;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #slDashboard .sl-kpi-icon {
    position: absolute !important;
    top: 0;
    right: 0;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
  }
  #slDashboard .sl-kpi-icon i {
    font-size: 15px !important;
  }

  /* The base template hides the desktop user menu on mobile. Keep its dedicated mobile profile trigger visible. */
  .header .mobile-user-menu.profile-dropdown {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 0 !important;
    right: 7px !important;
    width: 42px !important;
    height: 56px !important;
    padding: 0 !important;
    line-height: normal !important;
    z-index: 1076 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .header .mobile-user-menu.profile-dropdown > .dropdown-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  .header .mobile-user-menu.profile-dropdown .avatar {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    background: #172b4d !important;
    color: #fff !important;
    border-radius: 50% !important;
  }
  .header .mobile-user-menu.profile-dropdown .avatar i {
    display: inline-block !important;
    color: #fff !important;
    font-size: 18px !important;
  }
  #mobile-quick-create {
    right: 56px !important;
  }
}

@media (max-width: 360px) {
  #slDashboard .sl-kpi-value {
    font-size: .78rem !important;
    letter-spacing: -.045em;
  }
  #slDashboard .sl-kpi-card .card-body {
    padding: 8px !important;
  }
}
