/* ==========================================================================
   Vyapar-style theme for Ultimate POS (India edition)
   1) tokens  2) shell: sidebar + header  3) legacy page polish  4) vx components
   ========================================================================== */
:root {
  --vx-navy: #1b2a3a;
  --vx-navy-2: #23364a;
  --vx-navy-3: #2e4660;
  --vx-side-text: #c3cfdb;
  --vx-red: #ed1a3b;
  --vx-red-d: #c8102e;
  --vx-blue: #1789fc;
  --vx-blue-d: #0b6fd6;
  --vx-green: #0f9d58;
  --vx-amber: #f59e0b;
  --vx-bg: #f3f5f9;
  --vx-card: #ffffff;
  --vx-line: #e3e8ef;
  --vx-line-2: #eef1f5;
  --vx-text: #1e293b;
  --vx-muted: #64748b;
  --vx-radius: 10px;
  --vx-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --theme-700: #1789fc;
  --theme-800: #0b6fd6;
  --theme-900: #0a5bb0;
}

body, .tw-font-sans { font-family: 'Inter', 'Segoe UI', 'Noto Sans', system-ui, -apple-system, Arial, sans-serif !important; }
body.tw-bg-gray-100, main.tw-bg-gray-100, .content-wrapper { background: var(--vx-bg) !important; }

/* ---------------- Sidebar (dark navy like Vyapar desktop) ---------------- */
aside.side-bar { background: var(--vx-navy) !important; border-right: 0 !important; }
aside.side-bar .theme-logo-bg { background: #14212e !important; border: 0 !important; height: 60px; justify-content: flex-start !important; padding: 0 16px; }
aside.side-bar .side-bar-heading { color: #fff !important; font-weight: 700 !important; font-size: 15px !important; text-align: left !important; letter-spacing: .2px; }
aside.side-bar .tw-border-r, aside.side-bar #side-bar { border-right: 0 !important; }
aside.side-bar .tw-bg-gray-100 { background: var(--vx-navy-2) !important; border-color: var(--vx-navy-3) !important; }
aside.side-bar #sidebar-search { color: #e2e8f0 !important; }
aside.side-bar #sidebar-search::placeholder { color: #8da0b3 !important; }
#side-bar { padding-top: 6px !important; }
#side-bar > a, #side-bar > div > a.drop_down {
  color: var(--vx-side-text) !important; font-size: 13.5px !important; font-weight: 500 !important;
  padding: 9px 12px !important; border-radius: 8px !important; position: relative;
}
#side-bar a svg, #side-bar a i { color: #8da0b3 !important; }
#side-bar .theme-sidebar-hover:hover, #side-bar .theme-sidebar-hover:focus { background: rgba(255,255,255,.06) !important; color: #fff !important; }
#side-bar .theme-sidebar-hover:hover svg { color: #fff !important; }
#side-bar .theme-sidebar-active, #side-bar a.theme-sidebar-active {
  background: var(--vx-navy-3) !important; color: #fff !important;
}
#side-bar .theme-sidebar-active::before {
  content: ''; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--vx-red);
}
#side-bar .theme-sidebar-active svg, #side-bar .theme-sidebar-active i { color: #fff !important; }
#side-bar .chiled { padding-inline-start: 2.5rem !important; }
#side-bar .chiled > .tw-absolute { background: var(--vx-navy-3) !important; }
#side-bar .chiled a { color: #9fb0c2 !important; font-size: 13px !important; padding: 5px 0 !important; }
#side-bar .chiled a:hover, #side-bar .theme-sidebar-child-active { color: #fff !important; }
#side-bar .theme-sidebar-child-active { font-weight: 600 !important; }
#side-bar .theme-sidebar-child-active::before { content: '•'; color: var(--vx-red); margin-inline-end: 6px; }
.vx-sub-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #6f849a; font-weight: 700; padding: 8px 0 2px; }
#sidebar-no-results { color: #8da0b3 !important; border: 0 !important; }

/* ---------------- Header (white bar with Vyapar actions) ---------------- */
.theme-header-bg { background: #fff !important; background-image: none !important; border-bottom: 1px solid var(--vx-line) !important; }
.theme-header-bg .theme-btn-bg {
  background: #f1f4f8 !important; color: #334155 !important; box-shadow: none !important; --tw-ring-color: transparent !important;
}
.theme-header-bg .theme-btn-bg:hover { background: #e6ebf2 !important; color: #0f172a !important; }
.theme-header-bg .theme-btn-bg svg { color: #475569; }
.theme-header-bg summary.theme-btn-bg span, .theme-header-bg .theme-btn-bg { font-weight: 500; }
.vx-quick { gap: 8px; align-items: center; }
.vx-qbtn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 18px;
  font-size: 13px; font-weight: 600; text-decoration: none !important; cursor: pointer; list-style: none; white-space: nowrap;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.vx-qbtn::-webkit-details-marker { display: none; }
.vx-qbtn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(15, 23, 42, .12); }
.vx-plus { font-size: 17px; line-height: 1; font-weight: 500; }
.vx-qbtn-sale { background: var(--vx-red); color: #fff !important; }
.vx-qbtn-sale:hover { background: var(--vx-red-d); }
.vx-qbtn-purchase { background: var(--vx-blue); color: #fff !important; }
.vx-qbtn-purchase:hover { background: var(--vx-blue-d); }
.vx-qbtn-more { background: #fff; color: var(--vx-blue) !important; border: 1px solid #bcd9fb; }
.vx-more { position: relative; }
.vx-more[open] > summary { background: #eaf4ff; }
.vx-more-menu {
  position: absolute; right: 0; top: 42px; z-index: 1050; background: #fff; border: 1px solid var(--vx-line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .16); display: flex; gap: 8px; padding: 12px; min-width: 420px;
}
.vx-more-col { flex: 1; display: flex; flex-direction: column; }
.vx-more-h { font-size: 11px; font-weight: 700; color: var(--vx-muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px 4px; }
.vx-more-menu a { padding: 7px 10px; border-radius: 8px; color: var(--vx-text) !important; font-size: 13px; text-decoration: none !important; }
.vx-more-menu a:hover { background: #f1f6fd; color: var(--vx-blue) !important; }

/* ---------------- Legacy page polish (AdminLTE / Bootstrap 3) ---------------- */
.content-header h1 { font-size: 22px !important; font-weight: 700 !important; color: var(--vx-text) !important; }
.content-header h1 small { color: var(--vx-muted) !important; }
.box, .tw-dw-card, .tw-bg-white.tw-shadow-sm, .tw-bg-white.tw-shadow-md {
  border-radius: var(--vx-radius) !important; border: 1px solid var(--vx-line) !important; box-shadow: var(--vx-shadow) !important;
}
.box { border-top-width: 1px !important; }
.box-header.with-border { border-bottom: 1px solid var(--vx-line-2) !important; }
.box-title { font-weight: 600 !important; }
.table > thead > tr > th, table.dataTable thead th {
  background: #f6f8fb !important; color: #475569 !important; font-weight: 600 !important; font-size: 12px !important;
  text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--vx-line) !important;
}
.table > tbody > tr > td { border-top: 1px solid var(--vx-line-2) !important; vertical-align: middle !important; }
.table-striped > tbody > tr:nth-of-type(odd) { background: #fbfcfe !important; }
.table-hover > tbody > tr:hover, table.dataTable tbody tr:hover { background: #f2f7ff !important; }
.form-control, .select2-container--default .select2-selection--single, .select2-container--default .select2-selection--multiple {
  border-radius: 8px !important; border-color: #d6dde6 !important; box-shadow: none !important; min-height: 34px;
}
.form-control:focus { border-color: var(--vx-blue) !important; box-shadow: 0 0 0 3px rgba(23, 137, 252, .15) !important; }
.input-group-addon { border-color: #d6dde6 !important; background: #f6f8fb !important; border-radius: 8px 0 0 8px; }
.btn { border-radius: 8px !important; font-weight: 500; }
.btn-primary, .bg-primary, .tw-dw-btn-primary { background-color: var(--vx-blue) !important; border-color: var(--vx-blue) !important; }
.btn-primary:hover { background-color: var(--vx-blue-d) !important; }
.btn-success { background-color: var(--vx-green) !important; border-color: var(--vx-green) !important; }
.btn-danger { background-color: var(--vx-red) !important; border-color: var(--vx-red) !important; }
.label, .badge { border-radius: 10px !important; font-weight: 600 !important; }
.nav-tabs-custom > .nav-tabs > li.active { border-top-color: var(--vx-blue) !important; }
.modal-content { border-radius: 14px !important; border: 0 !important; box-shadow: 0 20px 50px rgba(15, 23, 42, .25) !important; }
.modal-header { border-bottom: 1px solid var(--vx-line-2) !important; }
.tw-dw-btn-primary, .tw-bg-gradient-to-r.tw-from-indigo-600 { background-image: none !important; background-color: var(--vx-blue) !important; color: #fff !important; border-radius: 8px !important; }
.tw-bg-gradient-to-r.tw-from-indigo-600:hover { background-color: var(--vx-blue-d) !important; }
.small-box, .info-box { border-radius: var(--vx-radius) !important; }

/* ==========================================================================
   vx components (India pages)
   ========================================================================== */
.vx-page { padding: 18px 22px 40px; color: var(--vx-text); }
.vx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.vx-title { font-size: 21px; font-weight: 700; margin: 0; color: var(--vx-text); }
.vx-sub { color: var(--vx-muted); font-size: 13px; margin-top: 2px; }
.vx-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.vx-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--vx-line);
  background: #fff; color: var(--vx-text) !important; font-size: 13px; font-weight: 600; text-decoration: none !important; cursor: pointer; white-space: nowrap;
}
.vx-btn:hover { background: #f6f8fb; }
.vx-btn-blue { background: var(--vx-blue); border-color: var(--vx-blue); color: #fff !important; }
.vx-btn-blue:hover { background: var(--vx-blue-d); }
.vx-btn-red { background: var(--vx-red); border-color: var(--vx-red); color: #fff !important; }
.vx-btn-red:hover { background: var(--vx-red-d); }
.vx-btn-green { background: #25d366; border-color: #25d366; color: #fff !important; }
.vx-btn-green:hover { background: #1fb456; }
.vx-btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.vx-card { background: var(--vx-card); border: 1px solid var(--vx-line); border-radius: var(--vx-radius); box-shadow: var(--vx-shadow); }
.vx-card-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--vx-line-2); }
.vx-card-h h3 { font-size: 14.5px; font-weight: 700; margin: 0; }
.vx-card-b { padding: 14px 16px; }
.vx-grid { display: grid; gap: 14px; }
.vx-g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.vx-g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vx-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.vx-g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .vx-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vx-g3, .vx-g-main { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .vx-g2, .vx-g4 { grid-template-columns: 1fr; } .vx-page { padding: 14px 12px 32px; } }
.vx-kpi { padding: 14px 16px; position: relative; overflow: hidden; }
.vx-kpi .k-label { font-size: 12.5px; color: var(--vx-muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.vx-kpi .k-value { font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.vx-kpi .k-foot { font-size: 12px; color: var(--vx-muted); margin-top: 4px; }
.vx-kpi .k-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.vx-kpi.recv { border-left: 4px solid var(--vx-green); }
.vx-kpi.pay { border-left: 4px solid var(--vx-red); }
.vx-kpi.sale { border-left: 4px solid var(--vx-blue); }
.vx-kpi.neutral { border-left: 4px solid #94a3b8; }
.vx-green { color: var(--vx-green) !important; }
.vx-red { color: var(--vx-red) !important; }
.vx-blue { color: var(--vx-blue) !important; }
.vx-muted { color: var(--vx-muted) !important; }
.vx-up { color: var(--vx-green); font-weight: 700; }
.vx-down { color: var(--vx-red); font-weight: 700; }
.vx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.vx-table th { text-align: left; background: #f6f8fb; color: #475569; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 9px 12px; border-bottom: 1px solid var(--vx-line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.vx-table td { padding: 9px 12px; border-bottom: 1px solid var(--vx-line-2); vertical-align: middle; }
.vx-table tr:hover td { background: #f7faff; }
.vx-table .r, .vx-table th.r { text-align: right; font-variant-numeric: tabular-nums; }
.vx-table td.r { white-space: nowrap; } /* keep "₹ 22,975.00" on one line in narrow panes */
.vx-table .c { text-align: center; }
.vx-table tfoot td { font-weight: 700; background: #f8fafc; border-top: 1px solid var(--vx-line); }
.vx-table-wrap { overflow: auto; max-height: 70vh; }
.vx-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 700; }
.vx-badge.paid { background: #e7f7ee; color: #0b7a43; }
.vx-badge.due { background: #fde8eb; color: #c8102e; }
.vx-badge.partial { background: #fff4de; color: #9a5b00; }
.vx-badge.info { background: #e8f2fe; color: #0b6fd6; }
.vx-badge.gray { background: #eef1f5; color: #475569; }
.vx-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--vx-line); margin-bottom: 14px; overflow-x: auto; }
.vx-tabs a, .vx-tabs button { padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--vx-muted) !important; border: 0; background: none;
  border-bottom: 2px solid transparent; text-decoration: none !important; white-space: nowrap; cursor: pointer; }
.vx-tabs a.active, .vx-tabs button.active { color: var(--vx-blue) !important; border-bottom-color: var(--vx-blue); }
.vx-tabs .cnt { background: #eef1f5; color: #475569; border-radius: 9px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.vx-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vx-filter select, .vx-filter input { height: 34px; border: 1px solid #d6dde6; border-radius: 8px; padding: 0 10px; font-size: 13px; background: #fff; color: var(--vx-text); }
.vx-empty { text-align: center; padding: 36px 12px; color: var(--vx-muted); }
.vx-empty b { display: block; color: var(--vx-text); font-size: 15px; margin-bottom: 4px; }
.vx-list { list-style: none; margin: 0; padding: 0; }
.vx-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--vx-line-2); font-size: 13px; }
.vx-list li:last-child { border-bottom: 0; }
.vx-list .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vx-pill { display: inline-flex; gap: 6px; align-items: center; background: #f1f4f8; border-radius: 16px; padding: 4px 10px; font-size: 12px; font-weight: 600; color: #334155; }
.vx-note { background: #f0f7ff; border: 1px solid #cfe5fd; color: #0b4f99; border-radius: 10px; padding: 10px 14px; font-size: 13px; }
.vx-warn { background: #fff8e6; border-color: #fde3a7; color: #8a5300; }
.vx-section-label { font-size: 11px; font-weight: 700; color: var(--vx-muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.vx-form .form-group label { font-weight: 600; font-size: 13px; color: #334155; }
.vx-form .help { font-size: 12px; color: var(--vx-muted); margin-top: 4px; }
.vx-switch { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 13px; }
.vx-switch input { width: 16px; height: 16px; }
.vx-3b td:first-child { font-weight: 600; }
.vx-num { font-variant-numeric: tabular-nums; }
.vx-bar { height: 6px; background: #eef1f5; border-radius: 4px; overflow: hidden; }
.vx-bar span { display: block; height: 100%; background: var(--vx-blue); border-radius: 4px; }

/* Login page */
.vx-login-brand { color: #fff; }

@media print {
  aside.side-bar, .theme-header-bg, .vx-actions, .vx-filter, .no-print { display: none !important; }
  .vx-page { padding: 0; }
}

/* ---------------- Login / register (auth pages) ---------------- */
.vx-login-row { display: flex; align-items: center; flex-wrap: wrap; min-height: calc(100vh - 140px); }
.vx-login-brand { color: #e2e8f0; padding: 10px 10px 30px; }
.vx-lb-logo { display: inline-block; font-weight: 800; font-size: 15px; letter-spacing: .3px; color: #fff; background: var(--vx-red); padding: 6px 12px; border-radius: 8px; }
.vx-lb-title { color: #fff; font-size: 30px; line-height: 1.25; font-weight: 800; margin: 18px 0 18px; letter-spacing: -.3px; }
.vx-lb-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.vx-lb-list li { position: relative; padding-left: 26px; font-size: 14px; color: #c3cfdb; line-height: 1.45; }
.vx-lb-list li::before { content: '✓'; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border-radius: 50%; background: rgba(15, 157, 88, .2); color: #34d399; font-size: 11px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.vx-lb-list b { color: #fff; }
.vx-lb-foot { margin-top: 22px; font-size: 12.5px; color: #8da0b3; }
.vx-login-card { box-shadow: 0 24px 60px rgba(0, 0, 0, .35) !important; border: 0 !important; }
.vx-login-card button[type=submit] { background: var(--vx-red) !important; background-image: none !important; }
.vx-login-card button[type=submit]:hover { background: var(--vx-red-d) !important; }
@media (max-width: 991px) { .vx-lb-title { font-size: 22px; } .vx-login-brand { padding-top: 40px; } }

/* Floating bulk-action bar (challans: combine into one invoice) */
.vx-actionbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1040; display: flex; align-items: center; gap: 10px;
  background: #0f172a; color: #fff; border-radius: 14px; padding: 10px 12px 10px 18px; box-shadow: 0 12px 32px rgba(15, 23, 42, .28); max-width: calc(100vw - 32px); }
.vx-actionbar[hidden] { display: none; }
.vx-actionbar-info { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-actionbar .vx-muted { color: #94a3b8; }
.vx-actionbar .vx-btn:not(.vx-btn-blue) { background: transparent; color: #e2e8f0 !important; border-color: #475569; }
.vx-actionbar .vx-btn:not(.vx-btn-blue):hover { background: #1e293b; }

/* Billing helpers: party-wise last rate hint and profit chip */
.vx-party-rate { display: inline-block; margin-top: 3px; font-size: 11px; font-weight: 600; color: #0b6fd6; background: #e8f2fe; border-radius: 8px; padding: 1px 7px; }
.vx-party-rate a { color: #64748b; margin-left: 4px; text-decoration: underline; cursor: pointer; }
.vx-profit-chip { position: fixed; z-index: 1030; left: 14px; bottom: 74px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
  background: #fff; border: 1px solid #dbe3ee; border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: #334155;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
.vx-profit-chip[hidden] { display: none; }
.vx-profit-chip .v { font-variant-numeric: tabular-nums; }
.vx-profit-chip.neg .v { color: #c8102e; }
.vx-profit-chip.pos .v { color: #0b7a43; }
.vx-profit-chip .mask { letter-spacing: 2px; color: #94a3b8; }

/* ==========================================================================
   Design refresh: legacy list screens (.vx-legacy on <section class="content">)
   sells, purchases, products, contacts, expenses, stock report, profit & loss
   ========================================================================== */
.content.vx-legacy { padding: 18px 22px 40px; color: var(--vx-text); }
.vx-legacy .vx-legacy-head { margin-bottom: 14px; }
.vx-legacy .vx-title .vx-range { font-size: 12px; font-weight: 600; vertical-align: middle; margin-left: 8px; letter-spacing: 0; }
.vx-legacy .vx-legacy-kpis { margin-bottom: 14px; }
.vx-legacy .vx-legacy-kpis .k-value { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-legacy .vx-legacy-kpis .k-foot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vx-legacy > .row { margin-left: 0; margin-right: 0; }
.vx-legacy > .row > [class*="col-"] { padding-left: 0; padding-right: 0; }

/* cards: filters (components.filters) + widget (components.widget) */
.vx-legacy .tw-ring-1.tw-ring-gray-200, .vx-legacy .tw-ring-1.tw-rounded-xl {
  --tw-ring-shadow: 0 0 #0000 !important; border: 1px solid var(--vx-line) !important; border-radius: var(--vx-radius) !important;
  box-shadow: var(--vx-shadow) !important; margin-bottom: 14px !important;
}
.vx-legacy .pf-btn { padding: 10px 16px !important; }
.vx-legacy .pf-btn > span > span:first-child { width: 24px !important; height: 24px !important; }
.vx-legacy .pf-inner > div { padding: 4px 16px 6px !important; }
.vx-legacy .pf-inner > div, .vx-legacy .pf-inner > div > form {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 14px; align-items: end;
}
.vx-legacy .pf-inner > div > form { grid-column: 1 / -1; }
.vx-legacy .pf-inner [class*="col-"] { width: auto !important; float: none !important; padding: 0 !important; min-width: 0; }
.vx-legacy .pf-inner .clearfix, .vx-legacy .pf-inner > div > br { display: none; }
.vx-legacy .pf-inner .form-group { margin-bottom: 10px; }
.vx-legacy .pf-inner label { font-size: 12px; font-weight: 600; color: var(--vx-muted); margin-bottom: 4px; }
.vx-legacy .pf-inner .checkbox label, .vx-legacy .pf-inner label > strong { color: var(--vx-text); font-size: 13px; }
.vx-legacy .pf-inner .form-control, .vx-legacy .pf-inner .select2-selection { height: 34px !important; font-size: 13px; }

.vx-legacy .box-header { padding: 6px 8px 10px !important; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.vx-legacy .box-header .box-title { font-size: 14.5px !important; font-weight: 700 !important; color: var(--vx-text); }
.vx-legacy .box-header .box-tools { position: static !important; display: flex; gap: 8px; flex-wrap: wrap; }
.vx-legacy .tw-py-2.tw-align-middle { padding-left: 4px !important; padding-right: 4px !important; }

/* DataTables toolbar: length | export buttons | search on one wrapping line */
.vx-legacy .dataTables_wrapper > .row:first-child {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px !important; text-align: left;
}
.vx-legacy .dataTables_wrapper > .row:first-child::before, .vx-legacy .dataTables_wrapper > .row:first-child::after { display: none; }
.vx-legacy .dataTables_wrapper > .row:first-child > [class*="col-"] { width: auto !important; float: none !important; padding: 0 !important; }
.vx-legacy .dataTables_wrapper > .row:first-child > .col-sm-8 { flex: 1 1 auto; }
.vx-legacy .dataTables_wrapper > .row:first-child > .col-sm-3 { margin-left: auto; }
.vx-legacy .dataTables_length label, .vx-legacy .dataTables_filter label { margin: 0; font-size: 12.5px; color: var(--vx-muted); font-weight: 500; }
.vx-legacy .dataTables_length select { height: 30px; border-radius: 7px; border: 1px solid #d6dde6; padding: 0 6px; margin: 0 4px; }
.vx-legacy .dataTables_filter input { height: 32px !important; width: 220px !important; margin: 0 !important; border-radius: 8px !important;
  border: 1px solid #d6dde6 !important; padding: 0 10px 0 30px !important; font-size: 13px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E") no-repeat 10px center; }
.vx-legacy .dt-buttons { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; }
.vx-legacy .dt-buttons .btn, .vx-legacy .dt-buttons .dt-button {
  height: 30px; padding: 0 10px !important; border-radius: 7px !important; border: 1px solid var(--vx-line) !important; background: #fff !important;
  color: #334155 !important; font-size: 12px !important; font-weight: 600 !important; box-shadow: none !important; margin: 0 !important;
  display: inline-flex; align-items: center; gap: 4px;
}
.vx-legacy .dt-buttons .btn:hover { background: #f6f8fb !important; color: var(--vx-blue) !important; }

/* table body: dense rows, single-line cells, readable numbers */
.vx-legacy table.dataTable, .vx-legacy .table { font-size: 13px; }
.vx-legacy table.dataTable > thead > tr > th, .vx-legacy table.dataTable > tbody > tr > td, .vx-legacy .table-responsive .table td {
  white-space: nowrap; padding: 8px 10px !important; border-left: 0 !important; border-right: 0 !important;
}
.vx-legacy table.dataTable > thead > tr > th { font-size: 11px !important; padding-top: 9px !important; padding-bottom: 9px !important; }
.vx-legacy table.dataTable > thead > tr > th.sorting, .vx-legacy table.dataTable > thead > tr > th.sorting_asc,
.vx-legacy table.dataTable > thead > tr > th.sorting_desc { padding-right: 26px !important; }
/* DataTables scrollX keeps a zero-height copy of the header inside the body: keep it collapsed */
.vx-legacy .dataTables_scrollBody > table > thead > tr > th, .vx-legacy .dataTables_scrollBody > table > thead > tr > td {
  padding-top: 0 !important; padding-bottom: 0 !important; border-top: 0 !important; border-bottom: 0 !important; height: 0 !important;
}
.vx-legacy .box-header { justify-content: flex-start; text-align: left; }
.vx-legacy #profit_margin:not(:empty)::after { content: '%'; font-size: 16px; margin-left: 2px; color: var(--vx-muted); }
.vx-legacy .table-bordered, .vx-legacy .dataTables_scrollHeadInner table, .vx-legacy .dataTables_scrollBody table { border-left: 0 !important; border-right: 0 !important; }
.vx-legacy .table-striped > tbody > tr:nth-of-type(odd) { background: #fff !important; }
.vx-legacy tfoot tr.footer-total, .vx-legacy tfoot tr.bg-gray, .vx-legacy .dataTables_scrollFoot tfoot tr { background: #f8fafc !important; font-weight: 700; font-size: 13px !important; }
.vx-legacy tfoot td { white-space: nowrap; padding: 9px 10px !important; border-top: 1px solid var(--vx-line) !important; }
.vx-legacy td .btn-group .dropdown-toggle, .vx-legacy td .btn-xs { border-radius: 7px !important; }
.vx-legacy td .label, .vx-legacy td .badge { font-size: 11px; padding: 3px 8px; }
.vx-legacy .dataTables_scrollBody { border-bottom: 0 !important; }
.vx-legacy .dataTables_info { font-size: 12.5px; color: var(--vx-muted); padding-top: 12px !important; }
.vx-legacy .dataTables_paginate { padding-top: 8px !important; }
.vx-legacy .pagination > li > a, .vx-legacy .pagination > li > span { border: 1px solid var(--vx-line); color: #334155; margin: 0 2px; border-radius: 7px !important; font-size: 12.5px; padding: 5px 10px; }
.vx-legacy .pagination > .active > a, .vx-legacy .pagination > .active > a:hover { background: var(--vx-blue) !important; border-color: var(--vx-blue) !important; color: #fff !important; }
.vx-legacy .dataTables_processing { border-radius: 10px; border: 1px solid var(--vx-line); box-shadow: var(--vx-shadow); }

/* tabs inside legacy screens (products, profit & loss) look like .vx-tabs */
.vx-legacy .nav-tabs-custom { background: #fff; border: 1px solid var(--vx-line); border-radius: var(--vx-radius); box-shadow: var(--vx-shadow); }
.vx-legacy .nav-tabs-custom > .nav-tabs { display: flex; overflow-x: auto; border-bottom: 1px solid var(--vx-line) !important; padding: 0 8px; }
.vx-legacy .nav-tabs-custom > .nav-tabs > li { border-top: 0 !important; margin-bottom: -1px; float: none; }
.vx-legacy .nav-tabs-custom > .nav-tabs > li > a { padding: 11px 14px; font-size: 13px; font-weight: 600; color: var(--vx-muted) !important;
  border: 0 !important; border-bottom: 2px solid transparent !important; background: none !important; white-space: nowrap; margin: 0; }
.vx-legacy .nav-tabs-custom > .nav-tabs > li.active > a { color: var(--vx-blue) !important; border-bottom-color: var(--vx-blue) !important; }
.vx-legacy .nav-tabs-custom > .nav-tabs > li > a i { color: inherit; opacity: .7; margin-right: 3px; }
.vx-legacy .nav-tabs-custom > .tab-content { padding: 12px 14px; }

/* profit & loss */
.vx-legacy .vx-pl-filters .select2-container { min-width: 200px; }
.vx-legacy #pl_data_div { margin-left: -15px; margin-right: -15px; }
.vx-legacy #pl_data_div .table th, .vx-legacy #pl_data_div .table td { white-space: normal; font-size: 13px; }

/* ---- Add Sale / Add Purchase / Add Item forms (.vx-formpage) ---- */
.vx-formpage .vx-sec > .tw-p-2 { padding: 0 !important; }
.vx-formpage .vx-sec .box-header {
  padding: 11px 18px !important; margin: 0; border-bottom: 1px solid var(--vx-line-2); background: #fafbfd; border-radius: var(--vx-radius) var(--vx-radius) 0 0;
}
.vx-formpage .vx-sec .box-header .box-title { font-size: 12px !important; text-transform: uppercase; letter-spacing: .06em; color: #475569 !important; }
.vx-formpage .vx-sec .box-header .box-title::before { content: ''; display: inline-block; width: 3px; height: 12px; border-radius: 2px; background: var(--vx-blue); margin-right: 8px; vertical-align: -1px; }
.vx-formpage .vx-sec .tw-py-2.tw-align-middle { padding: 14px 18px 4px !important; }
.vx-formpage .vx-sec .tw-flow-root::after { content: ''; display: table; clear: both; }
.vx-formpage label { font-size: 12.5px; font-weight: 600; color: #334155; margin-bottom: 4px; }
.vx-formpage .form-group { margin-bottom: 14px; }
.vx-formpage .form-control, .vx-formpage .select2-container--default .select2-selection--single { height: 36px; font-size: 13.5px; }
.vx-formpage textarea.form-control { height: auto; }
.vx-formpage .input-group-addon { min-width: 36px; }
.vx-formpage .help-block, .vx-formpage .tw-text-sm.tw-text-gray-500 { font-size: 12px; color: var(--vx-muted); }
.vx-formpage .vx-sec-items table thead th { background: #f6f8fb !important; }
.vx-formpage .table > tbody > tr > td { white-space: normal; }
/* location picker above the form */
.vx-formpage > .row:first-of-type .input-group { max-width: 340px; }

/* sticky save bar: sticks to the bottom of the viewport while the form is on screen */
.vx-savebar { position: sticky; bottom: 0; z-index: 25; margin: 6px 0 0 !important; }
.vx-savebar > [class*="col-"] { padding-left: 0; padding-right: 0; }
.vx-savebar-in {
  display: flex !important; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .97); border: 1px solid var(--vx-line); border-radius: 12px 12px 0 0; padding: 10px 16px !important;
  box-shadow: 0 -6px 20px rgba(15, 23, 42, .08); backdrop-filter: blur(4px);
}
.vx-savebar .vx-savebar-hint { margin-right: auto; font-size: 12.5px; color: var(--vx-muted); }
.vx-savebar .btn-group { display: flex; flex-wrap: wrap; gap: 8px; float: none; }
.vx-savebar .btn-group > .tw-dw-btn { border-radius: 8px !important; margin: 0 !important; float: none; }
.vx-savebar .tw-dw-btn-lg { height: 40px; min-height: 40px; font-size: 14px; padding: 0 18px; }
.vx-savebar #submit-sell, .vx-savebar #submit_purchase_form { min-width: 120px; }
.vx-savebar #save-and-print { background: var(--vx-green) !important; border-color: var(--vx-green) !important; }

@media (max-width: 767px) {
  .vx-savebar-in { padding: 8px 10px !important; }
  .vx-savebar .vx-savebar-hint { display: none; }
  .vx-savebar .tw-dw-btn-lg { height: 38px; min-height: 38px; font-size: 13px; padding: 0 12px; }
}

@media (max-width: 767px) {
  .content.vx-legacy { padding: 12px 10px 32px; }
  .vx-legacy .vx-head { align-items: flex-start; }
  .vx-legacy .vx-actions { width: 100%; }
  .vx-legacy .vx-legacy-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .vx-legacy .vx-legacy-kpis .vx-kpi { padding: 10px 12px; }
  .vx-legacy .vx-legacy-kpis .k-value { font-size: 17px; }
  .vx-legacy .vx-legacy-kpis .k-label { font-size: 11.5px; }
  .vx-legacy .dataTables_wrapper > .row:first-child > .col-sm-3 { margin-left: 0; width: 100% !important; }
  .vx-legacy .dataTables_filter input { width: 100% !important; }
  .vx-legacy .dataTables_filter label { width: 100%; }
}
@media print {
  .vx-legacy .vx-legacy-kpis, .vx-legacy .pf-btn { display: none !important; }
  .content.vx-legacy { padding: 0; }
}
