/* =============================================================================
   SPACE HOME DECORS — application stylesheet
   Mobile first. Breakpoints: <768 phone, 768-1199 tablet, >=1200 desktop.
   ========================================================================== */

:root {
  --brand:        #0f766e;
  --brand-dark:   #115e59;
  --brand-light:  #ccfbf1;
  --accent:       #d97706;
  --accent-light: #fef3c7;

  --sidebar-bg:   #0b1d26;
  --sidebar-fg:   #cbd5e1;
  --sidebar-active:#ffffff;

  --ink:          #0f172a;
  --ink-2:        #475569;
  --ink-3:        #94a3b8;
  --line:         #e2e8f0;
  --surface:      #ffffff;
  --canvas:       #f1f5f9;

  --ok:   #16a34a;
  --warn: #d97706;
  --bad:  #dc2626;

  --radius:   14px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.18);
  --shadow-lg:0 12px 40px -12px rgba(15,23,42,.28);
  --sidebar-w: 254px;
  --topbar-h:  60px;
}

* { -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  overflow-x: hidden;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

.btn { --bs-btn-font-weight: 500; border-radius: 10px; }
.btn-primary {
  --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark); --bs-btn-disabled-bg: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.btn-accent {
  --bs-btn-color:#fff; --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent);
  --bs-btn-hover-color:#fff; --bs-btn-hover-bg:#b45309; --bs-btn-hover-border-color:#b45309;
}
.form-control, .form-select { border-radius: 10px; border-color: #cbd5e1; font-size: .95rem; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(15,118,110,.15);
}
.form-label { font-weight: 600; font-size: .82rem; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .3px; margin-bottom: .3rem; }
.form-label .req { color: var(--bad); margin-left: 2px; }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }

/* ---------- Login ---------------------------------------------------------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(1200px 600px at 15% 0%, #134e4a 0%, #0b1d26 55%, #060f14 100%);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 34px 30px 30px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .mark {
  width: 58px; height: 58px; border-radius: 16px; margin: 0 auto 12px;
  display: grid; place-items: center; color: #fff; font-size: 26px;
  background: linear-gradient(135deg, var(--brand), #0891b2);
}
.auth-brand h1 { font-size: 1.22rem; font-weight: 800; letter-spacing: .06em; margin: 0; }
.auth-brand p { color: var(--ink-3); font-size: .82rem; margin: 4px 0 0; letter-spacing: .04em; }
.auth-tabs { display: flex; gap: 6px; background: var(--canvas); padding: 4px;
  border-radius: 12px; margin-bottom: 18px; }
.auth-tabs button { flex: 1; border: 0; background: transparent; padding: 8px;
  border-radius: 9px; font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.auth-tabs button.active { background: #fff; color: var(--brand); box-shadow: var(--shadow); }

/* ---------- App shell ------------------------------------------------------ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  position: fixed; inset: 0 auto 0 0; z-index: 1045;
  display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); }
.sidebar-head {
  padding: 16px 18px; display: flex; align-items: center; gap: 11px;
  border-bottom: 1px solid rgba(255,255,255,.08); min-height: var(--topbar-h);
}
.sidebar-head .mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), #0891b2); color: #fff; flex: none;
}
.sidebar-head b { color: #fff; font-size: .85rem; letter-spacing: .07em; line-height: 1.15; }
.sidebar-head small { color: #64748b; font-size: .66rem; letter-spacing: .12em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px 24px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #1e3a47; border-radius: 3px; }
.nav-group { color: #52708033; font-size: .64rem; text-transform: uppercase;
  letter-spacing: .16em; padding: 14px 12px 6px; color: #64748b; font-weight: 700; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin-bottom: 2px;
  border-radius: 10px; color: var(--sidebar-fg); font-size: .9rem; font-weight: 500;
}
.sidebar-nav a i { font-size: 1.02rem; width: 20px; text-align: center; opacity: .85; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px -6px var(--brand); }
.sidebar-nav a.active i { opacity: 1; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.sidebar-user .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none;
}
.sidebar-user .meta { min-width: 0; }
.sidebar-user .meta b { color: #fff; font-size: .84rem; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user .meta span { font-size: .7rem; color: #64748b; }

.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 1040;
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  position: sticky; top: 0; z-index: 1030;
}
.topbar .burger {
  border: 0; background: transparent; font-size: 1.4rem; color: var(--ink);
  width: 40px; height: 40px; border-radius: 10px;
}
.topbar .burger:hover { background: var(--canvas); }
.topbar-title { font-weight: 700; font-size: .98rem; margin: 0; }
.topbar-spacer { flex: 1; }
.topbar .quick-new { white-space: nowrap; }

.page { padding: 18px 16px 90px; max-width: 1480px; width: 100%; margin: 0 auto; }

.page-head {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start;
  justify-content: space-between; margin-bottom: 16px;
}
.page-title { font-size: 1.32rem; font-weight: 750; margin: 0; letter-spacing: -.01em; }
.page-title i { color: var(--brand); }
.page-sub { color: var(--ink-2); font-size: .87rem; margin: 4px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.app-card { border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); background: var(--surface); margin-bottom: 16px; }
.app-card > .card-body { padding: 16px; }
.card-title-row { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-title-row h2 { font-size: 1rem; font-weight: 700; margin: 0; }

/* ---------- Stat cards ------------------------------------------------------ */
.stat-grid { display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.stat-link { color: inherit; display: block; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px; display: flex; gap: 13px; align-items: flex-start;
  box-shadow: var(--shadow); height: 100%; transition: transform .15s, box-shadow .15s;
}
.stat-link:hover .stat-card { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon { width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 1.15rem; }
.stat-primary .stat-icon { background: var(--brand-light); color: var(--brand-dark); }
.stat-accent  .stat-icon { background: var(--accent-light); color: #b45309; }
.stat-ok      .stat-icon { background: #dcfce7; color: #15803d; }
.stat-bad     .stat-icon { background: #fee2e2; color: #b91c1c; }
.stat-info    .stat-icon { background: #e0f2fe; color: #0369a1; }
.stat-body { min-width: 0; }
.stat-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 700; }
.stat-value { font-size: 1.42rem; font-weight: 750; letter-spacing: -.02em; margin-top: 2px;
  word-break: break-word; }
.stat-sub { font-size: .78rem; color: var(--ink-2); margin-top: 2px; }

/* ---------- Profile pages (supplier / customer detail) ---------------------- */
.profile-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start;
  margin-bottom: 18px; }

.profile-card > .card-body { padding: 20px 16px; }
.profile-head { text-align: center; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.profile-avatar {
  width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; display: grid; place-items: center;
  font-size: 1.8rem; font-weight: 750; letter-spacing: .02em;
  box-shadow: 0 8px 20px -8px var(--brand);
}
.profile-name { font-size: 1.12rem; font-weight: 750; letter-spacing: -.01em;
  color: var(--ink); word-break: break-word; }
.profile-sub { font-size: .84rem; color: var(--ink-2); margin-top: 2px; word-break: break-word; }

.profile-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 16px 0; }
.profile-actions .btn { white-space: nowrap; }

.balance-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  font-weight: 700; color: var(--ink-3); margin-bottom: 8px; }
.balance-list { display: flex; flex-direction: column; gap: 2px; }
.balance-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: .86rem; color: var(--ink-2); }
.balance-row:nth-child(odd) { background: #f8fafc; }
.balance-row b { font-weight: 700; color: var(--ink); }
.balance-total { margin-top: 6px; background: var(--brand-light) !important;
  color: var(--brand-dark); font-weight: 650; }
.balance-total b { font-size: 1rem; }

.profile-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: .78rem; color: var(--ink-3); text-align: center; }
.profile-foot b { color: var(--ink-2); }

.detail-list { display: flex; flex-direction: column; }
.detail-row { display: grid; grid-template-columns: 1fr; gap: 2px;
  padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.detail-row:last-child { border-bottom: 0; }
.detail-k { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 700; color: var(--ink-3); }
.detail-v { font-size: .9rem; color: var(--ink); font-weight: 550; word-break: break-word; }
.detail-pre { white-space: pre-line; font-weight: 450; color: var(--ink-2); }

@media (min-width: 768px) {
  .detail-row { grid-template-columns: 170px minmax(0, 1fr); gap: 16px; align-items: baseline; }
  .detail-k { padding-top: 1px; }
}
@media (min-width: 992px) {
  .profile-grid { grid-template-columns: 320px minmax(0, 1fr); }
}

/* ---------- Tables ---------------------------------------------------------- */
.app-table-wrap { border-radius: var(--radius-sm); }
.app-table { margin: 0; font-size: .9rem; }
.app-table thead th {
  background: #f8fafc; color: var(--ink-2); font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line);
  white-space: nowrap; padding: 10px 12px;
}
.app-table tbody td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr:hover { background: #f8fafc; }
.row-clickable { cursor: pointer; }
/* "Walk-in Customer" leads the customer list on the billing and quotation
   screens. It is an option, not a record, so it is set apart from the names
   under it. */
.psr-item.psr-walkin { background: #f8fafc; border-bottom: 1px solid var(--line, #e2e8f0); }
.psr-item.psr-walkin .psr-name { font-weight: 650; }
/* A cancelled bill or quotation keeps its number and stays on the list, so the
   row itself has to read as cancelled at a glance — not just the badge. */
.app-table tbody tr.row-cancelled { opacity: .6; }
.app-table tbody tr.row-cancelled .strong,
.app-table tbody tr.row-cancelled .text-money { text-decoration: line-through; }
.app-table .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.app-table .strong { font-weight: 650; }
.mono { font-variant-numeric: tabular-nums; }

.app-pager { display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 12px 4px 2px; flex-wrap: wrap; }
.app-pager .page-link { color: var(--brand); border-radius: 8px; }
.app-pager .page-item.active .page-link { background: var(--brand); border-color: var(--brand); }
.pager-info { color: var(--ink-3); font-size: .8rem; }

.empty-state { text-align: center; padding: 42px 16px; color: var(--ink-3); }
.empty-state i { font-size: 2.4rem; opacity: .5; display: block; margin-bottom: 10px; }
.empty-state p { margin: 0 0 12px; }

/* ---------- Filters --------------------------------------------------------- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.filter-bar .form-control, .filter-bar .form-select { max-width: 230px; }
.custom-range { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.custom-range .form-control { width: 155px; }
.range-sep { color: var(--ink-3); font-size: .82rem; }
.search-box { position: relative; flex: 1 1 240px; max-width: 340px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none; }
.search-box input { padding-left: 36px; }

/* ---------- Billing screen -------------------------------------------------- */
.bill-grid { display: grid; gap: 16px; grid-template-columns: 1fr; align-items: start; }
.bill-summary-col { position: sticky; top: calc(var(--topbar-h) + 12px); }

.product-search-results {
  position: absolute; z-index: 1050; left: 0; right: 0; top: calc(100% + 4px);
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto;
}
.product-search-results .psr-item { padding: 10px 13px; cursor: pointer;
  border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; gap: 10px; }
.product-search-results .psr-item:last-child { border-bottom: 0; }
.product-search-results .psr-item:hover,
.product-search-results .psr-item.active { background: var(--brand-light); }
.psr-item .psr-name { font-weight: 600; font-size: .9rem; }
.psr-item .psr-meta { font-size: .76rem; color: var(--ink-2); display: flex; gap: 10px; flex-wrap: wrap; }
/* A row both adds the product and carries its own edit / delete buttons. */
.psr-item .psr-main { flex: 1; min-width: 0; }
.psr-item .psr-actions { display: flex; gap: 4px; flex: none; }
.psr-item .psr-actions .btn { --bs-btn-padding-y: 2px; --bs-btn-padding-x: 7px;
  --bs-btn-font-size: .74rem; }
.psr-item.psr-empty { cursor: default; }
.flex-none { flex: none; }

.items-table input { border: 1px solid transparent; background: #f8fafc;
  border-radius: 8px; padding: 5px 8px; width: 100%; font-size: .88rem; }
.items-table input:focus { background: #fff; border-color: var(--brand); outline: 0; }
.items-table .qty-input, .items-table .rate-input, .items-table .disc-input {
  text-align: right; font-variant-numeric: tabular-nums; }

/* Chrome parks the number spinner on top of right-aligned text, so in a column
   this narrow the quantity ended up hidden behind the little arrows. The boxes
   are typed into, not clicked up and down, so the spinner goes. */
.items-table input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.items-table input[type="number"]::-webkit-outer-spin-button,
.items-table input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0; }

.summary-row { display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; font-size: .92rem; }
.summary-row .lbl { color: var(--ink-2); }
.summary-row .val { font-variant-numeric: tabular-nums; font-weight: 600; }
.summary-row.total { border-top: 2px solid var(--ink); margin-top: 8px; padding-top: 12px;
  font-size: 1.05rem; }
.summary-row.total .val { font-size: 1.3rem; font-weight: 800; }
.summary-row.muted .val { color: var(--ink-2); font-weight: 500; }
.summary-row.discount .val { color: var(--bad); }

.discount-toggle-box { background: #f8fafc; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; margin: 10px 0; }
.override-box { background: var(--accent-light); border: 1px solid #fcd34d;
  border-radius: var(--radius-sm); padding: 12px; margin-top: 10px; }
.locked-note { font-size: .76rem; color: var(--ink-3); }

/* ---------- Misc ------------------------------------------------------------ */
.toast-host { position: fixed; right: 14px; bottom: 14px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px; max-width: min(94vw, 380px); }
.app-toast { display: flex; align-items: flex-start; gap: 10px; color: #fff;
  padding: 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg);
  font-size: .9rem; animation: toastIn .25s ease; }
.app-toast i { font-size: 1.05rem; margin-top: 1px; }
.app-toast.hide { opacity: 0; transform: translateY(6px); transition: .3s; }
.app-toast-success { background: #15803d; }
.app-toast-danger  { background: #b91c1c; }
.app-toast-warning { background: #b45309; }
.app-toast-info    { background: #0369a1; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

.busy-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 2100;
  display: none; place-items: center; backdrop-filter: blur(1px); }
.busy-overlay.show { display: grid; }
.busy-box { background: #fff; padding: 20px 26px; border-radius: 14px; display: flex;
  align-items: center; gap: 14px; box-shadow: var(--shadow-lg); font-weight: 500; }
.busy-box .spinner-border { color: var(--brand); }

.modal-content { border: 0; border-radius: 16px; box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid var(--line); padding: 14px 18px; }
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-body { padding: 18px; }
.modal-footer { border-top: 1px solid var(--line); padding: 12px 18px; }

.badge { font-weight: 600; border-radius: 7px; padding: .32em .6em; font-size: .74rem; }

.attach-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--canvas);
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: .84rem; }

.kbd { background: #f1f5f9; border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; font-size: .74rem; font-family: monospace; }

.low-stock { color: var(--bad); font-weight: 650; }
.text-money { font-variant-numeric: tabular-nums; white-space: nowrap; }

.report-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.report-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 15px; font-size: .85rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.report-tabs button.active { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- Reports & Analytics Center --------------------------------------
 * The landing screen is a catalogue of reports, grouped the way a shop thinks
 * about them. Each group is a card, each report a row inside it.
 * -------------------------------------------------------------------------- */
.hub-search-card .card-body { padding: 12px 14px; }
.report-hub { display: grid; gap: 16px; align-items: start;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.hub-card .card-body { padding: 0; }
.hub-head { display: flex; align-items: center; gap: 10px;
  padding: 13px 15px; border-bottom: 1px solid var(--line); }
.hub-head h2 { margin: 0; font-size: .97rem; font-weight: 700; flex: 1; }
.hub-icon { width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-size: .92rem; }
.hub-count { font-size: .7rem; font-weight: 600; color: var(--ink-2); }
.hub-list { padding: 5px 0; }
.hub-item { display: flex; align-items: center; gap: 11px; padding: 9px 15px;
  color: inherit; text-decoration: none; border-left: 3px solid transparent;
  transition: background .12s, border-color .12s; }
.hub-item:hover { background: var(--brand-light); border-left-color: var(--brand); }
.hub-item-icon { width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: grid; place-items: center; font-size: .8rem;
  background: #f1f5f9; color: var(--ink-2); }
.hub-item:hover .hub-item-icon { background: #fff; color: var(--brand-dark); }
.hub-item-text { flex: 1; min-width: 0; }
.hub-item-text b { display: block; font-size: .85rem; font-weight: 600; line-height: 1.3; }
.hub-item-text small { display: block; font-size: .73rem; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hub-item-go { font-size: .75rem; color: var(--ink-3); flex: none; }
.hub-item:hover .hub-item-go { color: var(--brand); }

/* An open report keeps its group beside it. */
.report-nav { display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 12px; }
.report-nav-group { font-size: .8rem; font-weight: 600; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; }
.report-nav .report-tabs { padding-bottom: 0; flex: 1 1 240px; }
.report-heading { margin-bottom: 12px; }
.report-heading h2 { margin: 0 0 2px; font-size: 1.06rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px; }

/* ---------- Bar chart (no chart library, prints as it looks) ---------------- */
.bar-chart { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 1.15fr) minmax(0, 3fr) auto;
  align-items: center; gap: 10px; }
.bar-label { font-size: .8rem; color: var(--ink-2); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: #f1f5f9; border-radius: 999px; height: 15px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-dark)); }
.bar-fill.neg { background: linear-gradient(90deg, #f87171, var(--bad)); }
.bar-value { font-size: .8rem; font-weight: 650; text-align: right; white-space: nowrap; }
.bar-sub { display: block; font-size: .69rem; font-weight: 500; color: var(--ink-3); }

@media (max-width: 575.98px) {
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; }
}

/* ---------- Responsive ------------------------------------------------------ */
@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
  .main { margin-left: var(--sidebar-w); }
  .sidebar-backdrop { display: none; }
  .topbar .burger { display: none; }
  .page { padding: 22px 24px 60px; }
  .bill-grid { grid-template-columns: minmax(0, 1fr) 372px; }
}
@media (min-width: 1600px) { .bill-grid { grid-template-columns: minmax(0, 1fr) 400px; } }

@media (max-width: 991.98px) { .hide-md { display: none !important; } }

@media (max-width: 767.98px) {
  .hide-sm { display: none !important; }
  .page { padding: 14px 12px 90px; }
  .page-title { font-size: 1.15rem; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 10px; }
  .stat-card { padding: 12px; gap: 10px; }
  .stat-icon { width: 36px; height: 36px; font-size: 1rem; }
  .stat-value { font-size: 1.15rem; }
  .filter-bar .form-control, .filter-bar .form-select, .search-box { max-width: none; }
  .search-box { flex-basis: 100%; }
  .custom-range .form-control { width: calc(50% - 30px); }

  /* Stacked card rows instead of a horizontally scrolling table */
  .app-table.stack-sm thead { display: none; }
  .app-table.stack-sm, .app-table.stack-sm tbody, .app-table.stack-sm tr,
  .app-table.stack-sm td { display: block; width: 100%; }
  .app-table.stack-sm tr { border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 10px; padding: 6px 4px; background: #fff; }
  .app-table.stack-sm td { border: 0; display: flex; justify-content: space-between;
    gap: 14px; padding: 6px 12px; text-align: right !important; }
  .app-table.stack-sm td::before { content: attr(data-label); font-weight: 650;
    color: var(--ink-3); font-size: .74rem; text-transform: uppercase;
    letter-spacing: .05em; text-align: left; }
  .app-table.stack-sm td:empty { display: none; }
  .modal-body { padding: 14px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
}

/* Mobile bottom quick bar for billing */
.mobile-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
  background: #fff; border-top: 1px solid var(--line); padding: 9px 12px;
  display: none; gap: 8px; box-shadow: 0 -6px 20px -12px rgba(15,23,42,.4);
}
.mobile-actions .btn { flex: 1; }
@media (max-width: 991.98px) { .mobile-actions.show { display: flex; } }

@media print {
  .sidebar, .topbar, .page-actions, .mobile-actions, .toast-host { display: none !important; }
  .main { margin-left: 0; }
  body { background: #fff; }
}
