/* ============================================================
   Vidarbha Town Developers — Design Tokens (theme.css)
   Three-layer token architecture:
     Primitive  (raw values)   ->  Semantic  (aliases)  ->  Component  (Bootstrap overrides)
   Reference: Vidarbha Homes SaaS — clean blue accent, light neutral
   surfaces, Inter typeface, soft cards.
   ============================================================ */

/* ---------- LAYER 1 · Primitive tokens ---------- */
:root {
  /* Brand blue scale */
  --ui-blue-50:  #EEF4FF;
  --ui-blue-100: #DDE8FF;
  --ui-blue-200: #B9CEFF;
  --ui-blue-300: #8BACFB;
  --ui-blue-400: #5A85F2;
  --ui-blue-500: #2F6BDB;
  --ui-blue-600: #1D4ED8;
  --ui-blue-700: #1A43B8;
  --ui-blue-800: #16368F;
  --ui-blue-900: #122A66;

  /* Neutral scale */
  --ui-gray-0:   #FFFFFF;
  --ui-gray-50:  #F5F7FA;
  --ui-gray-100: #EDEFF3;
  --ui-gray-200: #E4E9F2;
  --ui-gray-300: #CBD2DF;
  --ui-gray-400: #98A2B3;
  --ui-gray-500: #667085;
  --ui-gray-700: #344054;
  --ui-gray-900: #1F2933;

  /* Semantic status */
  --ui-success: #12A150;
  --ui-success-bg: #E7F7EE;
  --ui-danger:  #E11D48;
  --ui-danger-bg: #FEE4E4;
  --ui-warning: #FF8800;

  /* Typeface + spacing + radius */
  --ui-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ui-space-1: 4px;  --ui-space-2: 8px;  --ui-space-3: 12px; --ui-space-4: 16px;
  --ui-space-5: 20px; --ui-space-6: 24px;  --ui-space-7: 32px; --ui-space-8: 40px;
  --ui-radius-sm: 8px;  --ui-radius: 12px;  --ui-radius-lg: 16px;

  /* Elevation */
  --ui-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
  --ui-shadow-md: 0 4px 12px rgba(16, 24, 40, 0.10);
  --ui-shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.14);
}

/* ---------- LAYER 2 · Semantic aliases ---------- */
:root {
  --ui-primary:        var(--ui-blue-600);
  --ui-primary-hover:  var(--ui-blue-700);
  --ui-primary-soft:   var(--ui-blue-50);
  --ui-primary-soft-2: var(--ui-blue-100);

  --ui-surface:        var(--ui-gray-0);
  --ui-surface-muted:  var(--ui-gray-50);
  --ui-border:         var(--ui-gray-200);
  --ui-border-strong:  var(--ui-gray-300);
  --ui-grid-line:      var(--ui-gray-300);   /* clearly visible table grid lines */

  --ui-text:           var(--ui-gray-900);
  --ui-text-muted:     var(--ui-gray-500);
  --ui-text-inverse:   var(--ui-gray-0);

  --ui-success-soft:   var(--ui-success-bg);
  --ui-danger-soft:    var(--ui-danger-bg);

  --ui-export-csv-bg: #F6F8FC;
  --ui-export-csv-fg: #3B5A8A;
  --ui-export-csv-border: #DCE6F5;
  --ui-export-csv-bg-hover: #EEF4FF;
  --ui-export-csv-border-hover: #C9D9F0;
  --ui-export-excel-bg: #F4FAF6;
  --ui-export-excel-fg: #2F6B4F;
  --ui-export-excel-border: #D3E8DB;
  --ui-export-excel-bg-hover: #E9F6EE;
  --ui-export-excel-border-hover: #BFE0CC;
  --ui-export-pdf-bg: #FBF4F6;
  --ui-export-pdf-fg: #8A4357;
  --ui-export-pdf-border: #EFD6DD;
  --ui-export-pdf-bg-hover: #F7E9ED;
  --ui-export-pdf-border-hover: #E7C2CC;
}

/* ---------- LAYER 3 · Component tokens → Bootstrap overrides ---------- */
:root {
  /* Primary */
  --bs-primary: var(--ui-primary);
  --bs-primary-rgb: 29, 78, 216;
  --bs-link-color: var(--ui-primary);
  --bs-link-color-rgb: 29, 78, 216;
  --bs-link-hover-color: var(--ui-primary-hover);
  --bs-link-hover-color-rgb: 26, 67, 184;

  /* Typography */
  --bs-body-font-family: var(--ui-font);
  --bs-heading-font-family: var(--ui-font);
  --bs-body-bg: var(--ui-surface-muted);
  --bs-body-color: var(--ui-text);
  --bs-body-font-size: 0.95rem;

  /* Borders + surfaces */
  --bs-border-color: var(--ui-border);
  --bs-border-radius: var(--ui-radius-sm);
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: var(--ui-radius);
  --bs-border-radius-xl: var(--ui-radius-lg);
  --bs-tertiary-bg: var(--ui-gray-100);
  --bs-secondary-color: var(--ui-text-muted);

  /* Focus */
  --bs-focus-ring-width: 0.1875rem;
  --bs-focus-ring-color: rgba(29, 78, 216, 0.25);

  /* Success / danger align to brand */
  --bs-success: var(--ui-success);
  --bs-success-rgb: 18, 161, 80;
  --bs-danger: var(--ui-danger);
  --bs-danger-rgb: 225, 29, 72;
}

/* ---------- Base element polish ---------- */
body {
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--ui-surface-muted);
}

h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ui-text);
}

h2 { font-size: 1.6rem; }

a { color: var(--ui-primary); }

/* Cards — soft, subtle, consistent */
.card {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
}
.card .card-body { padding: var(--ui-space-6); }

/* Tables */
.table { --bs-table-bg: var(--ui-surface); }
.table thead th {
  background-color: var(--ui-surface-muted);
  color: var(--ui-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--ui-border);
}
.table td, .table th { border-color: var(--ui-border); padding: 10px 12px; }
.table tbody tr:hover { background-color: var(--ui-primary-soft); }

/* Buttons — rounded, elevated */
.btn { border-radius: var(--ui-radius-sm); font-weight: 600; }
.btn-primary { box-shadow: var(--ui-shadow-sm); }
.btn-primary:hover { --bs-btn-bg: var(--ui-primary-hover); --bs-btn-border-color: var(--ui-primary-hover); }
.btn-outline-secondary { --bs-btn-color: var(--ui-text-muted); --bs-btn-border-color: var(--ui-border-strong); }

/* Forms */
.form-control, .form-select {
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  font-size: 0.9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.15);
}
.form-control.is-invalid, .form-select.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.14);
}
.form-control.is-invalid:focus, .form-select.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.28);
}
.form-label { font-weight: 600; font-size: 0.82rem; color: var(--ui-text); margin-bottom: 6px; }

/* Alerts (messages) */
.alert { border-radius: var(--ui-radius); border: 1px solid var(--ui-border); }
.alert-danger { border-color: rgba(220, 53, 69, 0.35); }

/* ---------- Dashboard quick-link accent cards (kept as class hooks, token-driven) ---------- */
/* Dashboard quick-link accent cards (kept as class hooks, token-driven) */
.stat-card { border: none; border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm); }
.stat-card:hover { box-shadow: var(--ui-shadow-md); transform: translateY(-1px); transition: all .15s ease; }
.stat-received    { border-left: 4px solid var(--ui-success); }
.stat-expenditure { border-left: 4px solid var(--ui-danger); }
.stat-balance     { border-left: 4px solid var(--ui-primary); }

/* ---------- Entry form page ---------- */
.entry-shell { max-width: 920px; }
.form-label { display: block; margin-bottom: .375rem; }
input[type="date"] { min-height: 38px; }
input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
input[type="date"]:focus { border-color: var(--ui-primary); box-shadow: 0 0 0 3px var(--ui-primary-soft); }
.entry-back { font-size: 13px; font-weight: 600; color: var(--ui-text-muted); text-decoration: none; }
.entry-back:hover { color: var(--ui-primary); }
.type-toggle { display: inline-flex; gap: 4px; padding: 4px; background: var(--ui-surface-muted); border: 1px solid var(--ui-border); border-radius: var(--ui-radius); }
.type-chip { border: none; background: transparent; color: var(--ui-text-muted); font-weight: 600; font-size: 14px; padding: 8px 20px; border-radius: calc(var(--ui-radius) - 4px); transition: color .15s ease, background-color .15s ease, box-shadow .15s ease; white-space: nowrap; }
.type-chip:hover { color: var(--ui-text); }
.type-chip.active { background: var(--ui-surface); color: var(--ui-primary); box-shadow: var(--ui-shadow-sm); }
.type-chip.active:hover { color: var(--ui-primary); }
.type-toggle.invalid { border-color: var(--ui-danger); box-shadow: 0 0 0 3px var(--ui-danger-soft); }
.entry-type-error { margin-top: 8px; color: var(--ui-danger); font-size: 12.5px; font-weight: 600; }
.entry-type-error[hidden] { display: none; }
.entry-card { background: var(--ui-surface); border: 1px solid var(--ui-border); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm); }
.account-strip { padding: 18px 22px; }
.entry-form-card { padding: 26px; }
.section-label { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ui-text-muted); margin: 26px 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--ui-border); }
.entry-form-card .section-label:first-child { margin-top: 0; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--ui-primary-soft); color: var(--ui-primary); font-size: 11px; font-weight: 700; }
.amount-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding: 16px 22px; background: var(--ui-primary-soft); border: 1px solid var(--ui-primary-soft-2); border-radius: var(--ui-radius); }
.amount-summary .summary-label { font-size: 14px; font-weight: 700; color: var(--ui-text); }
.amount-summary .form-control { background: transparent; border: none; box-shadow: none; padding: 0; font-size: 22px; font-weight: 700; color: var(--ui-primary); text-align: right; width: auto; min-width: 160px; }

/* ---------- Flatpickr theme ---------- */
.flatpickr-calendar { font-family: var(--ui-font); border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-lg); border: 1px solid var(--ui-border); padding: 4px; }
.flatpickr-day { border-radius: var(--ui-radius-sm); }
.flatpickr-day:hover { background: var(--ui-primary-soft); border-color: transparent; }
.flatpickr-day.today { border-color: var(--ui-primary); color: var(--ui-primary); font-weight: 600; }
.flatpickr-day.today:hover { background: var(--ui-primary-soft); }
.flatpickr-day.selected, .flatpickr-day.selected:hover { background: var(--ui-primary); border-color: var(--ui-primary); color: var(--ui-text-inverse); }
.flatpickr-months .flatpickr-monthDropdown-months, .flatpickr-current-month { font-weight: 600; }

/* Compact date picker — shorter calendar, tighter header, smaller day cells */
.flatpickr-calendar {
  padding: 6px;
  min-width: 236px;
}
.flatpickr-months { padding-top: 4px; }
.flatpickr-months .flatpickr-month { height: 28px !important; font-size: 14px; }
.flatpickr-current-month { height: 26px !important; font-size: 13px; padding: 4px; }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { font-size: 13px; }
.flatpickr-prev-month, .flatpickr-next-month { height: 26px; width: 26px; }
.flatpickr-prev-month svg, .flatpickr-next-month svg { width: 12px; height: 12px; }
.flatpickr-weekdays { padding: 2px 4px !important; }
.flatpickr-weekdays span { font-size: 11px; font-weight: 600; }
.flatpickr-day {
  --dayheight: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  max-height: 26px !important;
  width: 26px !important;
  line-height: 26px !important;
  font-size: 12px !important;
  margin: 1px !important;
}
.flatpickr-day.flatpickr-disabled, .flatpickr-day.prevMonthDay, .flatpickr-day.nextMonthDay {
  min-height: 26px !important;
  max-height: 26px !important;
}

/* ---------- Entry list page ---------- */
.list-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 16px; flex-wrap: wrap; margin-bottom: 16px; }
@media (min-width: 992px) {
  .list-toolbar .list-count { display: none; }
}
.list-count { font-size: 12.5px; font-weight: 600; color: var(--ui-text-muted); }
.type-chip { text-decoration: none; }
.list-card { overflow: hidden; }
.list-card .table { margin: 0; font-family: var(--ui-font); border-collapse: separate; border-spacing: 0; }
/* Header: column lines (right border on all but last) + row line under header */
.list-card .table thead th { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ui-text-muted); background: var(--ui-surface-muted); border-bottom: 1px solid var(--ui-grid-line); border-top: none; padding: 10px 6px; white-space: nowrap; }
.list-card .table thead th:not(:last-child) { border-right: 1px solid var(--ui-grid-line); }
/* Body: full grid — row lines + column lines (all but last column get right border) */
.list-card .table td { padding: 9px 6px; vertical-align: middle; border-bottom: 1px solid var(--ui-grid-line); color: var(--ui-text); background: var(--ui-surface); font-size: 12.5px; }
.list-card .table td:not(:last-child) { border-right: 1px solid var(--ui-grid-line); }
.list-card .table tbody tr:last-child td { border-bottom: none; }
.list-card .table tbody tr:hover td { background: var(--ui-surface-muted); }
.entry-no-cell { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.date-cell { white-space: nowrap; color: var(--ui-text-muted); font-size: 12.5px; }
.party-cell { font-weight: 600; }
.particulars-cell { max-width: 110px; color: var(--ui-text-muted); }
.cell-muted { color: var(--ui-text-muted); }
.mode-cell { }
.action-cell { width: 1%; }
.action-cell .btn-sm { padding: 2px 7px; font-size: 12px; }
.action-cell form { margin: 0; }
.amount-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12px; }
.amount-col { text-align: right; }
.total-cell { font-weight: 700; }
/* Click-to-reveal amounts: plain text look, muted while masked */
.amount-reveal {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--ui-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  display: inline-block;
  min-width: 5.5ch;
  text-align: right;
  cursor: pointer;
}
.amount-cell .amount-reveal { min-width: 13ch; }
.amount-reveal:hover { color: var(--ui-text); text-decoration: underline dotted; text-underline-offset: 3px; }
.amount-reveal:focus-visible { outline: 2px solid var(--ui-primary); outline-offset: 2px; border-radius: 3px; }
.amount-reveal.is-revealed { color: var(--ui-text); cursor: pointer; }
.amount-reveal.is-revealed:hover { color: var(--ui-text); text-decoration: underline dotted; text-underline-offset: 3px; }
.dash-value .amount-reveal,
.detail-amount-value .amount-reveal,
.t-value .amount-reveal,
.bungalow-balance-title .amount-reveal,
.bungalow-balance-row p .amount-reveal {
  font-size: inherit;
  font-weight: inherit;
  min-width: 0;
}
.type-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.type-badge.badge-received { color: var(--ui-success); background: var(--ui-success-soft); }
.type-badge.badge-expenditure { color: var(--ui-danger); background: var(--ui-danger-soft); }
.list-empty { padding: 56px 20px; text-align: center; color: var(--ui-text-muted); }
.list-empty svg { color: var(--ui-border-strong); margin-bottom: 12px; }
.list-empty .empty-title { font-size: 15px; font-weight: 700; color: var(--ui-text); margin-bottom: 4px; }
.list-empty .empty-sub { font-size: 14px; margin-bottom: 18px; }
.list-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 0 4px; }
.list-pagination .page-info { font-size: 12.5px; font-weight: 600; color: var(--ui-text-muted); }
.list-pagination nav { display: flex; align-items: center; gap: 4px; }
.list-pagination .page-link, .list-pagination .page-nav, .list-pagination .page-dots { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 9px; border-radius: var(--ui-radius-sm); font-size: 12.5px; font-weight: 600; text-decoration: none; }
.list-pagination .page-link { color: var(--ui-text-muted); background: transparent; border: none; }
.list-pagination .page-link:hover { background: var(--ui-primary-soft); color: var(--ui-primary); }
.list-pagination .page-link.active { background: var(--ui-primary); color: var(--ui-text-inverse); }
.list-pagination .page-dots { color: var(--ui-text-muted); padding: 0 4px; }
.list-pagination .page-nav { color: var(--ui-primary); border: 1px solid var(--ui-border); background: transparent; }
.list-pagination .page-nav:hover { border-color: var(--ui-primary); background: var(--ui-primary-soft); }
.list-pagination .page-link { line-height: 1; }
.list-pagination button { cursor: pointer; font-family: inherit; }
@media (max-width: 575.98px) {
  .list-toolbar .type-chip { padding: 8px 14px; }
}

/* ---------- Entry Detail (View) ---------- */
.detail-back { margin-bottom: 16px; }
.detail-back-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ui-text-muted);
  text-decoration: none; padding: 6px 12px;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
}
.detail-back-link:hover { color: var(--ui-primary); border-color: var(--ui-primary); background: var(--ui-primary-soft); }

.detail-card {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  padding: 28px 32px; max-width: 760px;
}
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding-bottom: 20px; border-bottom: 1px solid var(--ui-border); margin-bottom: 22px;
}
.detail-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ui-text-muted); margin-bottom: 4px; }
.detail-no { font-family: var(--ui-font); font-weight: 800; font-size: 28px; letter-spacing: -0.02em; color: var(--ui-text); margin: 0; font-variant-numeric: tabular-nums; }
.detail-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.detail-badge {
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px;
}
.detail-badge.badge-received { color: var(--ui-success); background: var(--ui-success-soft); }
.detail-badge.badge-expenditure { color: var(--ui-danger); background: var(--ui-danger-soft); }
.detail-date { font-size: 13px; color: var(--ui-text-muted); font-variant-numeric: tabular-nums; }

.detail-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 28px;
  margin-bottom: 28px;
}
.detail-item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.detail-item-full { grid-column: 1 / -1; }
.detail-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ui-text-muted); }
.detail-value { font-size: 15px; font-weight: 600; color: var(--ui-text); word-break: break-word; }
.detail-muted { color: var(--ui-text-muted); font-weight: 400; font-style: italic; }
.detail-particulars { font-weight: 400; line-height: 1.55; }

.detail-amounts {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.detail-amount {
  background: var(--ui-surface-muted); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.detail-amount-label { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ui-text-muted); }
.detail-amount-value { font-size: 15px; font-weight: 700; color: var(--ui-text); font-variant-numeric: tabular-nums; }
.detail-amount-total { background: var(--ui-primary-soft); border-color: var(--ui-blue-200); }
.detail-amount-total .detail-amount-label { color: var(--ui-primary); }
.detail-amount-total .detail-amount-value { color: var(--ui-primary); }

@media (max-width: 575.98px) {
  .detail-card { padding: 20px; }
  .detail-header { flex-direction: column; }
  .detail-header-right { flex-direction: row; align-items: center; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-amounts { grid-template-columns: 1fr; }
}

/* ---------- Bungalows & Customers management ---------- */
.bungalow-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 20px; }
.bungalow-stat {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
}
.bungalow-stat-num { font-family: var(--ui-font); font-size: 28px; font-weight: 800; letter-spacing: -0.02em; color: var(--ui-text); font-variant-numeric: tabular-nums; }
.bungalow-stat-label { font-size: 12px; font-weight: 600; color: var(--ui-text-muted); }
.bungalow-stat-sold .bungalow-stat-num { color: var(--ui-success); }
.bungalow-stat-pending .bungalow-stat-num { color: var(--ui-danger); }

.section-title { font-family: var(--ui-font); font-size: 16px; font-weight: 700; color: var(--ui-text); margin: 0; }
.bungalow-add-card { padding: 20px 22px; margin-bottom: 22px; }
.bungalow-add-card .section-title { margin-bottom: 16px; }
.bungalow-add-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 16px; margin-bottom: 16px; }
.bungalow-add-grid .form-field-wide { grid-column: 1 / -1; }
.bungalow-add-grid .form-field { display: flex; flex-direction: column; gap: 5px; }
.bungalow-add-grid .form-label { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ui-text-muted); }
.bungalow-add-grid .form-control { font-size: 13.5px; padding: 8px 10px; }
.field-error { font-size: 12px; color: var(--ui-danger); font-weight: 600; }
.btn-add { font-size: 14px; padding: 9px 20px; }

.bungalow-list-card .list-toolbar {
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.bungalow-list-toolbar-left { display: flex; align-items: baseline; gap: 10px; }
.bungalow-jump { display: flex; align-items: center; gap: 8px; }
.bungalow-jump-label {
  font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ui-text-muted);
  white-space: nowrap;
}
.bungalow-jump-select {
  font-size: 13px; padding: 6px 30px 6px 10px;
  min-width: 200px; max-width: 280px;
  border-radius: var(--ui-radius-sm);
}
.bungalow-table { margin: 0; font-family: var(--ui-font); border-collapse: separate; border-spacing: 0; }
.bungalow-table thead th { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ui-text-muted); background: var(--ui-surface-muted); border-bottom: 1px solid var(--ui-grid-line); border-top: none; padding: 10px 6px; white-space: nowrap; }
.bungalow-table thead th:not(:last-child) { border-right: 1px solid var(--ui-grid-line); }
.bungalow-table td { padding: 10px 6px; vertical-align: middle; border-bottom: 1px solid var(--ui-grid-line); color: var(--ui-text); background: var(--ui-surface); font-size: 12.5px; }
.bungalow-table td:not(:last-child) { border-right: 1px solid var(--ui-grid-line); }
.bungalow-table tbody tr:last-child td { border-bottom: none; }
.bungalow-table tbody tr:hover td { background: var(--ui-surface-muted); }
.bungalow-no-cell { font-weight: 700; font-variant-numeric: tabular-nums; }
.bungalow-customer-cell { font-weight: 600; }
.bungalow-entries-cell { text-align: center; font-variant-numeric: tabular-nums; }
.type-badge.badge-pending { color: var(--ui-text-muted); background: var(--ui-surface-muted); border: 1px solid var(--ui-border); }
.bungalow-actions-col { width: 220px; }
.bungalow-actions-col .btn-sm { font-size: 12px; padding: 3px 10px; white-space: nowrap; }

/* ---------- Ledger Book (side tables) ---------- */
/* Ledger page fills the viewport and never triggers page scroll —
   only LHS/RHS tables scroll internally. app-content padding = 56px top/bottom. */
.ledger-page {
  height: calc(100vh - var(--ui-header-h) - 56px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ledger-page-statement {
  height: auto;
  overflow: visible;
}
/* Ledger filter row: uniform labels, inputs, and month clear button */
.ledger-filters {
  align-items: flex-start;
}
.page-entries .ledger-filters {
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 16px;
  margin-left: 0;
  margin-right: 0;
}
.page-entries .ledger-filters > .col-md-3 {
  min-width: 0;
}
.page-entries .ledger-filters .form-label {
  display: block;
  min-height: 14px;
  margin-bottom: 6px;
}
.page-entries .ledger-filters .form-control,
.page-entries .ledger-filters .form-select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  padding-top: 8px;
  padding-bottom: 8px;
  border-radius: var(--ui-radius-sm);
}
.page-entries .ledger-filters .ledger-filter-row {
  width: 100%;
  min-width: 0;
}
.page-entries .ledger-filters .ledger-filter-row .form-select {
  min-height: 44px;
  height: 44px;
}
.page-entries .ledger-filters .ledger-clear-btn {
  min-height: 44px;
  height: 44px;
  padding-top: 0;
  padding-bottom: 0;
  border-radius: var(--ui-radius-sm);
}
@media (max-width: 767.98px) {
  .page-entries .ledger-filters {
    padding: 12px;
  }
  .page-entries .ledger-filters > .col-md-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}
@media (max-width: 575.98px) {
  .page-entries .ledger-filters .ledger-filter-row {
    gap: 8px;
  }
  .page-entries .ledger-filters .ledger-clear-btn {
    min-width: 64px;
  }
}
.ledger-filters .form-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ui-text-muted);
  margin-bottom: 5px;
}
.ledger-filters .form-control,
.ledger-filters .form-select {
  font-size: 14px;
  padding: 8px 10px;
  min-height: 40px;
}
.ledger-filter-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.ledger-filter-row .form-select {
  flex: 1 1 auto;
  min-width: 0;
}
.ledger-clear-btn {
  flex: 0 0 auto;
  padding: 0 14px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border-radius: var(--ui-radius-sm);
}
@media (max-width: 767.98px) {
  .ledger-filters .form-control,
  .ledger-filters .form-select {
    font-size: 16px;
  }
}
.ledger-page #ledger-sides {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.ledger-page #received-container,
.ledger-page #expenditure-container {
  height: calc(100% - 24px);
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.ledger-page .ledger-side-head {
  flex-shrink: 0;
}
.ledger-page .ledger-side-scroll {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
}
.ledger-page .ledger-side-pager {
  flex-shrink: 0;
  border-top: 1px solid var(--ui-border);
}
/* Header + filters + footer stay at natural height; only #ledger-sides grows */
.ledger-page > .ledger-fixed,
.ledger-page .ledger-balance-footer {
  flex: 0 0 auto;
}
@media (max-width: 991.98px) {
  /* stacked layout on small screens — allow natural page scroll again */
  .ledger-page { height: 100dvh; overflow: auto; }
  .ledger-page #ledger-sides { flex: none; overflow: visible; }
  .ledger-page #received-container,
  .ledger-page #expenditure-container { height: auto; }
  .ledger-page .ledger-side-scroll { flex: none; max-height: 480px; }
}
.ledger-side-scroll {
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  scrollbar-width: thin;
}
.ledger-side-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.ledger-side-scroll::-webkit-scrollbar-thumb { background: var(--ui-gray-300); border-radius: 3px; }
.ledger-side-scroll::-webkit-scrollbar-track { background: transparent; }

/* Bungalow expenditure listed but excluded from totals */
.ledger-excluded-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 6px;
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ui-text-muted);
  background: var(--ui-gray-50, #f8f9fa);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
}
.ledger-excluded-icon {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1.3;
  color: var(--ui-text-muted);
}
.ledger-table {
  margin: 0;
  font-size: 0.85rem;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 780px; /* wide enough to trigger its own horizontal scroll inside each side */
}
.ledger-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 9px 8px;
  border-bottom: 1px solid var(--ui-grid-line);
}
.ledger-table thead.table-success th { background: var(--ui-success-soft); color: var(--ui-success); }
.ledger-table thead.table-danger th { background: var(--ui-danger-soft); color: var(--ui-danger); }
.ledger-table tfoot th {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 11px 8px;
  position: sticky;
  bottom: 0;
  z-index: 1;
}
/* Cash / Bank / Overall totals — larger + bolder so the summary row reads clearly */
.ledger-table tfoot th.text-end {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: normal;
  text-transform: none;
}
.ledger-table tfoot.table-success th { background: var(--ui-success-soft); }
.ledger-table tfoot.table-danger th { background: var(--ui-danger-soft); }
.ledger-table td {
  padding: 8px 8px;
  vertical-align: middle;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--ui-border);
  white-space: nowrap;
}
/* Per-column widths: readable floor; table scrolls horizontally inside each side */
.ledger-table td:nth-child(1) { min-width: 48px; }                    /* No */
.ledger-table td:nth-child(2) { min-width: 96px; }                    /* Date */
.ledger-table td:nth-child(3) { min-width: 160px; max-width: 240px; white-space: normal; overflow-wrap: break-word; } /* Particulars */
.ledger-table td:nth-child(4) { min-width: 96px; }                    /* A */
.ledger-table td:nth-child(5) { min-width: 96px; }                    /* B */
.ledger-table td:nth-child(6) { min-width: 104px; }                   /* Total */
.ledger-table td:nth-child(7) { min-width: 72px; }                    /* Action */
.ledger-table tbody tr:last-child td { border-bottom: none; }
.ledger-table tbody tr:hover td { background: var(--ui-surface-muted); }
.ledger-table td .btn-sm { padding: 2px 8px; font-size: 11px; }

/* ---------- Bungalow Detail (View) ---------- */
.bungalow-detail-card { max-width: none; }
.bungalow-detail-card .detail-amount-total.net-negative {
  background: var(--ui-danger-soft);
  border-color: var(--ui-danger);
}
.bungalow-detail-card .detail-amount-total.net-negative .detail-amount-label,
.bungalow-detail-card .detail-amount-total.net-negative .detail-amount-value {
  color: var(--ui-danger);
}

.bungalow-header-card { max-width: none; padding: 14px 20px; }
.bungalow-header-card .detail-eyebrow { font-size: 9.5px; }
.bungalow-header-card .detail-no { font-size: 21px; }
.bungalow-header-card .section-title { font-size: 13px; }
.bungalow-header-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.bungalow-header-meta .detail-badge { font-size: 11px; padding: 3px 10px; }
.bungalow-header-meta .detail-date { font-size: 12.5px; }
.bungalow-header-meta .detail-badge.badge-pending { color: var(--ui-text-muted); background: var(--ui-surface-muted); border: 1px solid var(--ui-border); }
.bungalow-customer-grid { margin-bottom: 0; gap: 8px 20px; }
.bungalow-customer-grid .detail-label { font-size: 9.5px; }
.bungalow-customer-grid .detail-value { font-size: 13.5px; }
.bungalow-header-card .detail-amounts {
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--ui-border);
  gap: 8px;
}
.bungalow-header-card .detail-amount { padding: 6px 12px; gap: 1px; }
.bungalow-header-card .detail-amount-label { font-size: 9.5px; }
.bungalow-header-card .detail-amount-value { font-size: 15px; }

.bungalow-side-card {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  padding: 18px; height: 100%;
  display: flex; flex-direction: column;
}
.bungalow-side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.bungalow-side-title { font-family: var(--ui-font); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--ui-text); margin: 0; }
.bungalow-side-count { font-size: 13px; font-weight: 600; color: var(--ui-text-muted); }
.bungalow-side-table-wrap {
  max-height: 620px; overflow: auto; flex: 1;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  font-size: .8rem;
  scrollbar-width: thin;
}
.bungalow-side-table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.bungalow-side-table-wrap::-webkit-scrollbar-thumb { background: var(--ui-gray-300); border-radius: 3px; }
.bungalow-side-table-wrap::-webkit-scrollbar-track { background: transparent; }
.bungalow-side-table { margin: 0; }
.bungalow-side-table thead th {
  position: sticky; top: 0; z-index: 1;
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 12px 3px; white-space: nowrap;
  border-bottom: 1px solid var(--ui-grid-line);
}
.bungalow-side-table thead.table-success th { background: var(--ui-success-soft); }
.bungalow-side-table thead.table-danger th { background: var(--ui-danger-soft); }
.bungalow-side-table td { padding: 14px 3px; vertical-align: middle; border-bottom: 1px solid var(--ui-border); background: var(--ui-surface); font-size: 12.5px; }
.bungalow-side-table tbody tr:last-child td { border-bottom: none; }
.bungalow-side-table tbody tr:hover td { background: var(--ui-surface-muted); }
.bungalow-side-table .amount-cell { font-size: 12.5px; }
.bungalow-side-table .action-cell .btn-sm { padding: 2px 5px; font-size: 11px; }
.bungalow-side-empty { text-align: center; color: var(--ui-text-muted); padding: 18px 8px !important; }
.bungalow-side-totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 8px;
  margin-top: 12px; padding: 10px 12px;
  background: var(--ui-surface-muted); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm); text-align: center;
}
.bungalow-side-totals .t-label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--ui-text-muted); margin-bottom: 2px; }
.bungalow-side-totals .t-value { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

.bungalow-expenditure-card {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  padding: 18px;
}
.bungalow-expenditure-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.bungalow-expenditure-heading { min-width: 0; }
.bungalow-expenditure-heading .bungalow-side-count { display: block; margin-top: 2px; }
.bungalow-expenditure-toggle {
  flex: 0 0 auto;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  background: var(--ui-surface-muted); color: var(--ui-text-muted);
  transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .16s ease;
}
.bungalow-expenditure-toggle:hover {
  background: var(--ui-primary-soft); color: var(--ui-primary);
  border-color: var(--ui-primary); transform: translateY(-1px);
}
.bungalow-expenditure-toggle:active { transform: translateY(0) scale(.97); }
.bungalow-expenditure-toggle:focus-visible {
  outline: 2px solid var(--ui-primary); outline-offset: 2px;
}
.expenditure-chevron {
  width: 18px; height: 18px;
  transition: transform .18s ease;
}
.bungalow-expenditure-toggle[aria-expanded="true"] .expenditure-chevron {
  transform: rotate(90deg);
}
.bungalow-expenditure-form { padding-top: 16px; }
@media (prefers-reduced-motion: reduce) {
  .bungalow-expenditure-toggle, .expenditure-chevron { transition: none; }
  .bungalow-expenditure-toggle:hover,
  .bungalow-expenditure-toggle:active { transform: none; }
}
.bungalow-expenditure-table thead th {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 12px 10px; border-bottom: 1px solid var(--ui-grid-line);
  background: var(--ui-surface-muted); color: var(--ui-text-muted);
}
.bungalow-expenditure-table td { padding: 10px; border-bottom: 1px solid var(--ui-border); font-size: 13px; }
.bungalow-expenditure-table tbody tr:last-child td { border-bottom: none; }
.bungalow-expenditure-table tfoot th {
  padding: 12px 10px; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--ui-text);
  border-top: 1px solid var(--ui-grid-line); background: var(--ui-surface-muted);
}
.expenditure-input {
  max-width: 160px; margin-left: auto; text-align: right;
  font-variant-numeric: tabular-nums;
}
.expenditure-gst-input { max-width: 170px; }
.expenditure-name-input { max-width: 100%; min-width: 220px; }
.bungalow-expenditure-pair { display:flex; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.bungalow-expenditure-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

.bungalow-balance-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 16px;
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
}
.bungalow-balance-title { font-family: var(--ui-font); font-size: 13.5px; font-weight: 700; color: var(--ui-text); margin: 0 0 2px; font-variant-numeric: tabular-nums; }

.bungalow-detail-actions {
  margin-top: 18px;
  display: flex; gap: 10px; flex-wrap: wrap;
}

@media (max-width: 767.98px) {
  .bungalow-summary { grid-template-columns: 1fr; }
  .bungalow-add-grid { grid-template-columns: 1fr 1fr; }
  .bungalow-add-grid .form-field-wide { grid-column: 1 / -1; }
  .bungalow-detail-card { padding: 20px; }
  .bungalow-list-card .list-toolbar { align-items: stretch; flex-direction: column; }
  .bungalow-jump { width: 100%; }
  .bungalow-jump-select { flex: 1 1 auto; min-width: 0; width: 100%; max-width: none; }
}
@media (max-width: 575.98px) {
  .bungalow-add-grid { grid-template-columns: 1fr; }
  .bungalow-actions-col { width: auto; }
  .bungalow-actions-col .d-inline-flex { flex-wrap: wrap; }
}

/* ---------- Ledger Book statement (party mode) ---------- */
.statement-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  box-shadow: var(--ui-shadow-sm);
  padding: 28px;
}
.statement-letterhead {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--ui-border);
}
.statement-company {
  font-family: var(--ui-font); font-size: 22px; font-weight: 800;
  letter-spacing: .08em; color: var(--ui-text); margin: 0;
}
.statement-location {
  font-size: 11px; font-weight: 600; letter-spacing: .18em;
  text-transform: uppercase; color: var(--ui-text-muted); margin-top: 4px;
}
.statement-meta { text-align: right; }
.statement-bungalow { font-size: 15px; font-weight: 700; color: var(--ui-text); }
.statement-period {
  display: inline-block; margin-top: 8px;
  font-size: 11.5px; font-weight: 600; color: var(--ui-text-muted);
  background: var(--ui-surface-muted);
  border: 1px solid var(--ui-border); border-radius: 999px;
  padding: 3px 12px;
}
.statement-panels {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  margin-top: 20px;
}
.statement-panel {
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.statement-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ui-border);
}
.statement-panel-received .statement-panel-head { background: var(--ui-success-soft); }
.statement-panel-expenditure .statement-panel-head { background: var(--ui-danger-soft); }
.statement-panel-title {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ui-text);
}
.statement-panel-count { font-size: 10.5px; font-weight: 600; color: var(--ui-text-muted); }
.statement-table-wrap { overflow-x: auto; flex: 1 1 auto; }
.statement-table { width: 100%; margin: 0; border-collapse: collapse; }
.statement-table th {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ui-text-muted);
  padding: 9px 14px; white-space: nowrap;
  background: var(--ui-surface); border-bottom: 1px solid var(--ui-border);
}
.statement-table td {
  padding: 9px 14px; font-size: 12.5px; vertical-align: middle;
  color: var(--ui-text); border-bottom: 1px solid var(--ui-border);
}
.statement-table tbody tr:last-child td { border-bottom: none; }
.statement-table tbody tr:hover td { background: var(--ui-surface-muted); }
.statement-col-date { width: 26%; }
.statement-col-amount { width: 28%; }
.statement-col-mode { width: 16%; }
.statement-date { font-variant-numeric: tabular-nums; color: var(--ui-text-muted); }
.statement-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.statement-mode-chip {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  color: var(--ui-text-muted); background: var(--ui-surface-muted);
  border: 1px solid var(--ui-border); border-radius: 999px;
  padding: 2px 8px;
}
.statement-empty { text-align: center; color: var(--ui-text-muted); padding: 18px 14px !important; }
.statement-panel-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--ui-surface-muted);
  border-top: 1px solid var(--ui-border);
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--ui-text);
}
.statement-panel-total .statement-amount { font-size: 14px; }
.statement-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px;
  margin-top: 20px;
}
.statement-summary-cell {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 16px;
  background: var(--ui-surface-muted);
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
}
.statement-summary-label {
  font-size: 10px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ui-text-muted); line-height: 1.4;
}
.statement-summary-value {
  font-size: 18px; font-weight: 800;
  font-variant-numeric: tabular-nums; color: var(--ui-text);
}
.statement-value-received { color: var(--ui-success); }
.statement-value-expenditure { color: var(--ui-danger); }
.statement-summary-balance {
  background: var(--ui-primary-soft);
  border-color: var(--ui-primary-soft-2);
}
.statement-value-balance { color: var(--ui-primary); }

@media (max-width: 991.98px) {
  .statement-panels { grid-template-columns: 1fr; }
  .statement-summary { grid-template-columns: 1fr; }
  .statement-meta { text-align: left; }
}
@media (max-width: 575.98px) {
  .statement-card { padding: 18px; }
  .statement-company { font-size: 18px; }
}

@media print {
  .app-sidebar, .app-header, .skip-link, .ledger-fixed, .ledger-balance-footer { display: none !important; }
  .app-content { padding: 0 !important; }
  .statement-card { box-shadow: none; border: none; padding: 0; }
  .statement-table tbody tr:hover td { background: transparent; }
}

/* Ledger Book balance footer (bottom bar) */
.ledger-balance-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
}
.ledger-bottom-summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.ledger-bottom-item {
  display: inline-flex; align-items: baseline; gap: 7px;
  padding: 6px 10px;
  background: var(--ui-surface-muted);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
}
.ledger-bottom-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ui-text-muted); }
.ledger-bottom-value { font-size: 14px; font-weight: 700; color: var(--ui-text); font-variant-numeric: tabular-nums; }
.ledger-bottom-balance {
  background: var(--ui-primary-soft);
  border-color: var(--ui-primary-soft-2);
}
.ledger-bottom-balance .ledger-bottom-value { color: var(--ui-primary); }
.ledger-balance-title { font-family: var(--ui-font); font-size: 16px; font-weight: 700; color: var(--ui-text); margin: 10px 0 2px; font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
:root {
  --ui-navy-700: #16294F;
  --ui-navy-800: #122343;
  --ui-navy-900: #0F1E3D;
  --ui-navy-950: #0A1730;

  --ui-sidebar-bg: var(--ui-navy-900);
  --ui-sidebar-text: rgba(255, 255, 255, 0.92);
  --ui-sidebar-muted: rgba(255, 255, 255, 0.55);
  --ui-sidebar-hover-bg: rgba(255, 255, 255, 0.06);
  --ui-sidebar-active-bg: rgba(47, 107, 219, 0.22);
  --ui-sidebar-accent: var(--ui-blue-400);
  --ui-sidebar-border: rgba(255, 255, 255, 0.08);

  --ui-sidebar-w: 248px;
  --ui-header-h: 56px;
  --ui-nav-h: 40px;
  --ui-nav-radius: 8px;
}

body { background: var(--ui-surface-muted); }

.skip-link {
  position: absolute; left: -9999px; top: 8px; z-index: 1100;
  padding: 8px 14px; border-radius: var(--ui-radius-sm);
  background: var(--ui-surface); color: var(--ui-primary);
  font-weight: 600; box-shadow: var(--ui-shadow-md);
}
.skip-link:focus { left: 8px; }

.app-shell {
  display: grid;
  grid-template-columns: var(--ui-sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

.app-sidebar {
  --bs-offcanvas-width: var(--ui-sidebar-w);
  background-color: var(--ui-sidebar-bg) !important;
  color: var(--ui-sidebar-text);
  display: flex;
  flex-direction: column;
  width: var(--ui-sidebar-w);
}
@media (min-width: 768px) {
  .app-sidebar { position: sticky; top: 0; height: 100vh; }
}

.app-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--ui-sidebar-border);
}
.app-brand-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.app-logo-mark { display: block; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.app-brand-name { font-size: 14px; font-weight: 800; letter-spacing: .06em; color: var(--ui-text-inverse); }
.app-brand-sub { font-size: 9px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ui-sidebar-muted); }
.app-sidebar-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 0; border-radius: var(--ui-radius-sm);
  background: transparent; color: var(--ui-sidebar-muted); font-size: 22px; line-height: 1;
}
.app-sidebar-close:hover { background: var(--ui-sidebar-hover-bg); color: var(--ui-text-inverse); }

.app-sidebar .app-sidebar-body {
  display: flex; flex-direction: column; flex: 1 1 auto;
  padding: 14px 12px 16px; overflow-y: auto;
}

.app-nav { display: flex; flex-direction: column; gap: 18px; }
.app-nav-group { display: flex; flex-direction: column; gap: 2px; }
.app-nav-label {
  padding: 0 10px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ui-sidebar-muted);
}
.app-nav-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  min-height: var(--ui-nav-h); padding: 0 10px;
  border-radius: var(--ui-nav-radius);
  color: var(--ui-sidebar-muted); text-decoration: none;
  font-size: 13.5px; font-weight: 600;
  transition: background-color .15s ease, color .15s ease;
}
.app-nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }
.app-nav-link:hover { background: var(--ui-sidebar-hover-bg); color: var(--ui-text-inverse); }
.app-nav-link.active { background: var(--ui-sidebar-active-bg); color: var(--ui-text-inverse); }
.app-nav-link.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--ui-sidebar-accent);
}
.app-sidebar-foot {
  margin-top: auto; padding: 14px 10px 0;
  border-top: 1px solid var(--ui-sidebar-border);
  font-size: 11px; color: var(--ui-sidebar-muted);
}

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-header {
  position: sticky; top: 0; z-index: 1020;
  display: flex; align-items: center; gap: 12px;
  min-height: var(--ui-header-h); padding: 0 20px;
  background: var(--ui-surface); border-bottom: 1px solid var(--ui-border);
}
.app-header-title { display: flex; flex-direction: column; line-height: 1.15; }
.app-header-eyebrow {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ui-text-muted);
}
.app-header-page { font-size: 15px; font-weight: 700; color: var(--ui-text); }
.app-header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.app-header-admin-mobile { margin-left: 2px; }
.app-admin-trigger {
  min-height: 44px; min-width: 44px; padding: 0 8px 0 0;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--ui-border); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-text);
}
.app-admin-trigger:hover { background: var(--ui-surface-muted); }
.app-admin-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ui-primary); color: var(--ui-surface);
  font-size: 12px; font-weight: 800; line-height: 1;
}
.app-admin-label { font-size: 12px; font-weight: 700; white-space: nowrap; }
.app-admin-menu {
  min-width: 190px; padding: 4px;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow-lg);
}
.app-admin-menu .dropdown-item {
  min-height: 40px; display: flex; align-items: center;
  padding: 6px 10px; border-radius: var(--ui-radius-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.app-admin-menu .dropdown-item:hover { background: var(--ui-surface-muted); }
.app-admin-menu .dropdown-divider { margin: 4px 0; }
.app-admin-menu form { margin: 0; }
.app-menu-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--ui-border); border-radius: var(--ui-radius-sm);
  background: var(--ui-surface); color: var(--ui-text);
}
.app-menu-btn svg { width: 20px; height: 20px; }
.app-menu-btn:hover { background: var(--ui-surface-muted); }

.app-content { flex: 1 1 auto; padding: 24px 28px 32px; background: var(--ui-surface-muted); }

@media (max-width: 767.98px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-header { padding: 0 16px; }
  .app-content { padding: 16px 16px 24px; }
}

/* ---------- Shared page header ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ui-text-muted); margin-bottom: 4px;
}
.page-title {
  font-family: var(--ui-font); font-size: 24px; font-weight: 800;
  letter-spacing: -0.01em; color: var(--ui-text); margin: 0;
}
.page-sub { font-size: 13.5px; color: var(--ui-text-muted); margin: 4px 0 0; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 575.98px) {
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* ---------- Dashboard ---------- */
.dash-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.dash-stat {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 4px;
  border-left: 4px solid var(--ui-border-strong);
}
.dash-stat-received { border-left-color: var(--ui-success); }
.dash-stat-expenditure { border-left-color: var(--ui-danger); }
.dash-stat-balance { border-left-color: var(--ui-primary); }
.dash-label {
  font-size: 11px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ui-text-muted);
}
.dash-value {
  font-size: 24px; font-weight: 800; letter-spacing: -0.01em;
  color: var(--ui-text); font-variant-numeric: tabular-nums;
}
.dash-stat-received .dash-value { color: var(--ui-success); }
.dash-stat-expenditure .dash-value { color: var(--ui-danger); }
.dash-stat-balance .dash-value { color: var(--ui-primary); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.dash-tile {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px; text-decoration: none;
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  transition: box-shadow .15s ease, transform .15s ease;
}
.dash-tile:hover { box-shadow: var(--ui-shadow-md); transform: translateY(-1px); }
.dash-tile-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--ui-radius);
  background: var(--ui-primary-soft); color: var(--ui-primary); flex-shrink: 0;
}
.dash-tile-icon svg { width: 20px; height: 20px; }
.dash-tile-received .dash-tile-icon { background: var(--ui-success-soft); color: var(--ui-success); }
.dash-tile-expenditure .dash-tile-icon { background: var(--ui-danger-soft); color: var(--ui-danger); }
.dash-tile-title { font-size: 15px; font-weight: 700; color: var(--ui-text); }
.dash-tile-sub { font-size: 12.5px; color: var(--ui-text-muted); }

.dash-recent { padding: 0; overflow: hidden; }
.dash-recent-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--ui-border);
}
.dash-recent-head h3 { font-size: 15px; font-weight: 700; margin: 0; color: var(--ui-text); }
.dash-recent-head a { font-size: 12.5px; font-weight: 600; text-decoration: none; }
.dash-empty { padding: 40px 20px; text-align: center; color: var(--ui-text-muted); font-size: 13.5px; }
@media (max-width: 767.98px) {
  .dash-summary { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ---------- Export page ---------- */
.export-grid { display: flex; flex-wrap: wrap; row-gap: 14px; }
@media (min-width: 992px) {
  .export-grid { column-gap: 14px; }
  .export-grid > .col-lg-6 {
    flex: 1 1 calc(50% - 7px);
    width: calc(50% - 7px);
    max-width: calc(50% - 7px);
  }
}
.export-card {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-sm);
  display: flex; flex-direction: column; height: 100%;
}
.export-card .list-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--ui-border);
}
.export-form { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.export-side-row { display: flex; flex-wrap: wrap; gap: 8px; }
.export-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; align-items: end; }
.export-field { display: flex; flex-direction: column; min-width: 0; }
.export-chip { position: relative; margin: 0; }
.export-chip input { position: absolute; opacity: 0; pointer-events: none; }
.export-chip span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--ui-border); border-radius: 999px;
  background: var(--ui-surface); color: var(--ui-text-muted);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.export-chip input:checked + span {
  background: var(--ui-primary-soft); border-color: var(--ui-primary); color: var(--ui-primary);
}
.export-chip input:focus-visible + span { box-shadow: 0 0 0 3px var(--ui-primary-soft); }
.export-formats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.export-format-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; box-shadow: none; }
.export-format-btn svg { width: 15px; height: 15px; }
.export-format-btn.export-csv {
  --bs-btn-color: var(--ui-export-csv-fg);
  --bs-btn-bg: var(--ui-export-csv-bg);
  --bs-btn-border-color: var(--ui-export-csv-border);
  --bs-btn-hover-color: var(--ui-export-csv-fg);
  --bs-btn-hover-bg: var(--ui-export-csv-bg-hover);
  --bs-btn-hover-border-color: var(--ui-export-csv-border-hover);
  --bs-btn-active-color: var(--ui-export-csv-fg);
  --bs-btn-active-bg: var(--ui-export-csv-bg-hover);
  --bs-btn-active-border-color: var(--ui-export-csv-border-hover);
}
.export-format-btn.export-excel {
  --bs-btn-color: var(--ui-export-excel-fg);
  --bs-btn-bg: var(--ui-export-excel-bg);
  --bs-btn-border-color: var(--ui-export-excel-border);
  --bs-btn-hover-color: var(--ui-export-excel-fg);
  --bs-btn-hover-bg: var(--ui-export-excel-bg-hover);
  --bs-btn-hover-border-color: var(--ui-export-excel-border-hover);
  --bs-btn-active-color: var(--ui-export-excel-fg);
  --bs-btn-active-bg: var(--ui-export-excel-bg-hover);
  --bs-btn-active-border-color: var(--ui-export-excel-border-hover);
}
.export-format-btn.export-pdf {
  --bs-btn-color: var(--ui-export-pdf-fg);
  --bs-btn-bg: var(--ui-export-pdf-bg);
  --bs-btn-border-color: var(--ui-export-pdf-border);
  --bs-btn-hover-color: var(--ui-export-pdf-fg);
  --bs-btn-hover-bg: var(--ui-export-pdf-bg-hover);
  --bs-btn-hover-border-color: var(--ui-export-pdf-border-hover);
  --bs-btn-active-color: var(--ui-export-pdf-fg);
  --bs-btn-active-bg: var(--ui-export-pdf-bg-hover);
  --bs-btn-active-border-color: var(--ui-export-pdf-border-hover);
}
.export-note { margin: 14px 0 0; font-size: 12.5px; color: var(--ui-text-muted); }
.export-form .export-note { margin: 0; }
/* ---------- Standalone side pages ---------- */
.side-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.side-summary-cell {
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius); box-shadow: var(--ui-shadow-sm);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 2px;
}
.side-summary-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ui-text-muted);
}
.side-summary-value {
  font-size: 17px; font-weight: 800; color: var(--ui-text);
  font-variant-numeric: tabular-nums;
}
.side-side-received .side-summary-value { color: var(--ui-success); }
.side-side-expenditure .side-summary-value { color: var(--ui-danger); }
.side-filter-card { padding: 16px 20px; margin-bottom: 16px; }
@media (max-width: 767.98px) { .side-summary { grid-template-columns: 1fr; } }

/* ---------- Standalone form page ---------- */
.standalone-page {
  min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px; background: var(--ui-surface-muted);
}
.standalone-card {
  width: 100%; max-width: 720px;
  background: var(--ui-surface); border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg); box-shadow: var(--ui-shadow-md);
  padding: 28px;
}
.standalone-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.standalone-brand .app-brand-name { color: var(--ui-text); }
.standalone-brand .app-brand-sub { color: var(--ui-text-muted); }
.standalone-title { font-size: 22px; font-weight: 800; color: var(--ui-text); margin: 0; }
@media (max-width: 575.98px) { .standalone-card { padding: 20px; } }

/* ---------- Sign in ---------- */
.login-page { align-items: center; }
.login-card { max-width: 420px; }
.login-intro { color: var(--ui-text-muted); margin: 6px 0 22px; }

/* ============================================================
   Mobile redesign (<=767px) — bottom nav, compact shell, card lists.
   Desktop (>=768px) intentionally unchanged.
   ============================================================ */
.mobile-tabbar { display: none; }
.app-header-brand { display: none; }
.bungalow-add-toggle { display: none; }

@media (max-width: 767.98px) {

  /* ---------- App shell ---------- */
  .app-header { min-height: 54px; padding: 0 12px; gap: 9px; }
  .app-menu-btn { display: none; }
  .app-header-brand { display: inline-flex; align-items: center; flex-shrink: 0; text-decoration: none; }
  .app-header-brand .app-logo-mark { width: 30px; height: 30px; }
  .app-header-title { min-width: 0; }
  .app-header-eyebrow { display: none; }
  .app-header-page { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-header-actions .btn { min-height: 36px; padding: 6px 12px; font-size: 12.5px; white-space: nowrap; }
  .app-content { padding: 14px 12px calc(86px + env(safe-area-inset-bottom)); }
  .app-sidebar { display: none !important; }

  /* ---------- Bottom tab bar ---------- */
  .mobile-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: var(--ui-surface);
    border-top: 1px solid var(--ui-border);
    box-shadow: 0 -10px 30px rgba(15, 30, 61, .08);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
  }
  .mobile-tab {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; min-height: 48px; padding: 3px 2px;
    border-radius: 12px; text-decoration: none;
    color: var(--ui-text-muted); font-size: 9.5px; font-weight: 700;
    letter-spacing: .02em; -webkit-tap-highlight-color: transparent;
  }
  .mobile-tab svg { width: 21px; height: 21px; }
  .mobile-tab.active { color: var(--ui-primary); background: var(--ui-primary-soft); }
  .mobile-tab:active { background: var(--ui-surface-muted); }
  .mobile-tab-add { color: var(--ui-primary); }
  .mobile-tab-add-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 46px; height: 46px; margin-top: -22px; margin-bottom: 1px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ui-blue-500), var(--ui-blue-600));
    color: #fff; border: 3px solid var(--ui-surface);
    box-shadow: 0 8px 18px rgba(37, 99, 235, .35);
  }
  .mobile-tab-add-btn svg { width: 22px; height: 22px; }
  .mobile-tab-add.active { background: transparent; }
  .mobile-tab-add.active .mobile-tab-add-btn { box-shadow: 0 0 0 3px var(--ui-primary-soft), 0 8px 18px rgba(37, 99, 235, .35); }

  /* ---------- Page headers ---------- */
  .page-dashboard .page-head,
  .page-entries .page-head,
  .page-bungalows .page-head { display: none; }
  .page-head { margin-bottom: 12px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 12.5px; }
  .page-side .page-head { flex-direction: row; align-items: flex-start; }
  .page-side .page-head .page-eyebrow,
  .page-side .page-head .page-sub { display: none; }
  .page-entry-form .page-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 10px; }
  .page-entry-form .page-head .page-eyebrow,
  .page-entry-form .page-head .page-sub { display: none; }
  .entry-back, .detail-back-link { font-size: 12.5px; }

  /* ---------- Touch targets + form rhythm ---------- */
  .btn:not(.btn-sm) { min-height: 42px; }
  .app-content .form-control,
  .app-content .form-select,
  .standalone-card .form-control,
  .standalone-card .form-select { font-size: 16px; min-height: 44px; }
  textarea.form-control { min-height: 84px; }
  .form-label { font-size: 11px; margin-bottom: 4px; }
  .entry-form-card, .account-strip, .bungalow-add-card, .side-filter-card { padding: 14px; border-radius: 14px; }
  .entry-form-card { padding: 16px 14px; }
  .account-strip { margin-bottom: 10px !important; }
  .account-strip select {
    width: 100%; min-height: 44px; padding: 8px 10px;
    font-size: 16px; color: var(--ui-text);
    background: var(--ui-surface); border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
  }
  .account-strip .row, .side-filter-card .row { row-gap: 10px; }
  .side-filter-card .col-md-2 { flex: 0 0 50%; max-width: 50%; }
  .entry-form-card .btn-lg { padding-left: 16px; padding-right: 16px; }
  .page-entry-form .type-toggle-wrap { width: 100%; }
  .page-entry-form .type-toggle { width: 100%; }
  .page-entry-form .type-toggle .type-chip { flex: 1 1 0; text-align: center; }
  .section-title { font-size: 13px; }
  .entry-card { border-radius: 14px; }

  /* ---------- Shared table → card system ---------- */
  .mobile-cards { display: block; width: 100%; border: 0 !important; margin-bottom: 0; min-width: 0 !important; }
  .mobile-cards thead { display: none; }
  .mobile-cards tbody { display: block; }
  .mobile-cards tbody tr {
    display: grid;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 14px;
    box-shadow: var(--ui-shadow-sm);
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  .mobile-cards tbody tr:last-child { margin-bottom: 0; }
  .mobile-cards tbody td {
    display: block; min-width: 0 !important;
    border: 0 !important; padding: 2px 0 !important;
    background: transparent !important; box-shadow: none !important;
    font-size: 13px; text-align: left; white-space: normal;
  }
  .mobile-cards tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 9px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--ui-text-muted);
    margin-bottom: 1px;
  }
  .mobile-cards tbody td.amount-cell { font-size: 12.5px; font-variant-numeric: tabular-nums; }
  .mobile-cards tbody td .amount-reveal { font-size: 12.5px; font-weight: 600; min-width: 0; }
  .mobile-cards tbody tr.mobile-empty-row {
    display: block; padding: 0; border: 0; box-shadow: none; background: transparent;
  }
  .mobile-cards tbody tr.mobile-empty-row td { display: block; }
  .mobile-cards tbody td.action-cell { display: flex; justify-content: flex-end; gap: 8px; width: auto; }
  .mobile-cards .table-responsive { border: 0; }

  /* Shared mini amount boxes inside cards */
  .mobile-cards .amount-cell[data-label] {
    background: var(--ui-surface-muted) !important;
    border-radius: 9px;
    padding: 7px 8px !important;
  }

  /* ---------- All Entries cards ---------- */
  .entries-table tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px; }
  .entries-table tbody td:nth-child(1) { grid-row: 1; grid-column: 1 / 3; font-size: 15px; font-weight: 800; color: var(--ui-text); padding-top: 0 !important; }
  .entries-table tbody td:nth-child(2) { grid-row: 2; grid-column: 1 / 3; font-size: 11.5px; color: var(--ui-text-muted); }
  .entries-table tbody td:nth-child(3) { grid-row: 1 / 3; grid-column: 3; align-self: start; justify-self: end; padding-top: 0 !important; }
  .entries-table tbody td:nth-child(4) { grid-row: 3; grid-column: 1 / -1; margin-top: 7px; }
  .entries-table tbody td:nth-child(5) { grid-row: 4; grid-column: 1 / -1; }
  .entries-table tbody td:nth-child(4),
  .entries-table tbody td:nth-child(5) { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .entries-table tbody td:nth-child(4)::before,
  .entries-table tbody td:nth-child(5)::before { margin-bottom: 0; flex-shrink: 0; }
  .entries-table tbody td:nth-child(4) > *, .entries-table tbody td:nth-child(5) > * { text-align: right; }
  .entries-table tbody td:nth-child(6) { grid-row: 5; grid-column: 1 / -1; margin-top: 7px; line-height: 1.45; }
  .entries-table tbody td:nth-child(7) { grid-row: 6; grid-column: 1; margin-top: 9px; }
  .entries-table tbody td:nth-child(8) { grid-row: 6; grid-column: 2; margin-top: 9px; }
  .entries-table tbody td:nth-child(9) { grid-row: 6; grid-column: 3; margin-top: 9px; }
  .entries-table tbody td:nth-child(10) {
    grid-row: 7; grid-column: 1 / -1;
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 10px; padding-top: 9px !important;
    border-top: 1px solid var(--ui-border) !important;
  }
  .entries-table tbody td:nth-child(10) .d-inline-flex { flex-direction: row !important; align-items: center; gap: 8px !important; }
  .entries-table tbody td:nth-child(10) form { margin: 0; }
  .entries-table tbody td:nth-child(10) .btn { min-height: 34px; padding: 5px 14px; }

  /* ---------- Dashboard ---------- */
  .dash-summary { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .dash-stat { padding: 12px 14px; border-radius: 14px; gap: 5px; }
  .dash-stat:last-child { grid-column: 1 / -1; }
  .dash-label { font-size: 9.5px; letter-spacing: .05em; }
  .dash-value { font-size: 20px; }
  .dash-value .amount-reveal { font-size: inherit; min-width: 0; }
  .dash-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
  .dash-tile { padding: 14px; border-radius: 14px; }
  .dash-tile-title { font-size: 14px; }
  .dash-recent { border-radius: 14px; }
  .dash-recent-head { padding: 12px 14px; }
  .dash-recent .table-responsive { margin: 0 10px 10px; }
  .dash-recent table { margin-bottom: 0; }
  .dash-recent-table tbody tr { grid-template-columns: auto 1fr; column-gap: 10px; }
  .dash-recent-table tbody td:nth-child(1) { grid-row: 1; grid-column: 1; font-size: 14.5px; font-weight: 800; padding-top: 0 !important; }
  .dash-recent-table tbody td:nth-child(2) { grid-row: 2; grid-column: 1; font-size: 11.5px; color: var(--ui-text-muted); }
  .dash-recent-table tbody td:nth-child(3) { grid-row: 1; grid-column: 2; justify-self: end; padding-top: 0 !important; }
  .dash-recent-table tbody td:nth-child(4) { grid-row: 2; grid-column: 2; justify-self: end; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--ui-text-muted); }
  .dash-recent-table tbody td:nth-child(5) {
    grid-row: 3; grid-column: 1 / -1;
    display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
    margin-top: 8px; padding-top: 8px !important;
    border-top: 1px solid var(--ui-border) !important;
  }
  .dash-recent-table tbody td:nth-child(5)::before { margin-bottom: 0; }
  .dash-recent-table tbody td:nth-child(5) .amount-reveal { font-size: 15px; font-weight: 800; }

  /* ---------- Bungalows & Customers ---------- */
  .bungalow-summary { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
  .bungalow-stat { padding: 10px 8px; border-radius: 12px; gap: 2px; text-align: center; align-items: center; }
  .bungalow-stat-num { font-size: 22px; }
  .bungalow-stat-label { font-size: 9px; line-height: 1.2; }
  .bungalow-add-card { margin-bottom: 12px; }
  .bungalow-add-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .bungalow-add-toggle { display: inline-flex; align-items: center; min-height: 34px; }
  .bungalow-add-grid { gap: 10px; }
  .btn-add { width: 100%; min-height: 44px; }
  .bungalow-list-card .list-toolbar { padding: 12px 14px; }
  .bungalow-table tbody tr { grid-template-columns: 1fr auto; column-gap: 10px; }
  .bungalow-table tbody td:nth-child(1) { grid-row: 1; grid-column: 1; font-size: 15px; font-weight: 800; padding-top: 0 !important; }
  .bungalow-table tbody td:nth-child(2) { grid-row: 1; grid-column: 2; justify-self: end; padding-top: 0 !important; }
  .bungalow-table tbody td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; margin-top: 7px; }
  .bungalow-table tbody td:nth-child(4) { grid-row: 3; grid-column: 1 / -1; }
  .bungalow-table tbody td:nth-child(5) { grid-row: 4; grid-column: 1 / -1; }
  .bungalow-table tbody td:nth-child(6) { grid-row: 5; grid-column: 1 / -1; }
  .bungalow-table tbody td:nth-child(3),
  .bungalow-table tbody td:nth-child(4),
  .bungalow-table tbody td:nth-child(5),
  .bungalow-table tbody td:nth-child(6) { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  .bungalow-table tbody td:nth-child(3)::before,
  .bungalow-table tbody td:nth-child(4)::before,
  .bungalow-table tbody td:nth-child(5)::before,
  .bungalow-table tbody td:nth-child(6)::before { margin-bottom: 0; flex-shrink: 0; }
  .bungalow-table tbody td:nth-child(7) {
    grid-row: 6; grid-column: 1 / -1;
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-top: 10px; padding-top: 9px !important;
    border-top: 1px solid var(--ui-border) !important;
  }
  .bungalow-table tbody td:nth-child(7) .d-inline-flex {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px !important;
  }
  .bungalow-table tbody td:nth-child(7) .btn { flex: 1 1 0; min-height: 36px; }
  .bungalow-table tbody td:nth-child(7) .btn:focus,
  .bungalow-table tbody td:nth-child(7) .btn:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -2px;
    box-shadow: none;
  }
  .bungalow-table tbody td:nth-child(7) form { flex: 1 1 0; margin: 0; }
  .bungalow-table tbody td:nth-child(7) form .btn { width: 100%; }

  /* ---------- Ledger Book tables ---------- */
  .ledger-side-scroll { overflow: visible; max-height: none !important; border: 0; }
  .ledger-page .ledger-side-scroll { overflow: visible; max-height: none !important; }
  .ledger-side-head { margin-bottom: 6px !important; }
  .ledger-table tbody tr { grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 8px; }
  .ledger-table tbody td:nth-child(1) { grid-row: 1; grid-column: 1 / 4; font-size: 13.5px; font-weight: 800; padding-top: 0 !important; }
  .ledger-table tbody td:nth-child(2) { grid-row: 1; grid-column: 4 / 7; font-size: 11.5px; text-align: right; color: var(--ui-text-muted); padding-top: 0 !important; }
  .ledger-table tbody td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; margin-top: 3px; line-height: 1.45; }
  .ledger-table tbody td:nth-child(4) { grid-row: 3; grid-column: 1 / 4; margin-top: 9px; }
  .ledger-table tbody td:nth-child(5) { grid-row: 3; grid-column: 4 / 7; margin-top: 9px; }
  .ledger-table tbody td:nth-child(6) { grid-row: 4; grid-column: 1 / -1; margin-top: 9px; }
  .bungalow-side-table tbody td:nth-child(6)::before {
    display: inline; margin-right: 6px; margin-bottom: 0;
  }
  .ledger-table tbody td:nth-child(4),
  .ledger-table tbody td:nth-child(5),
  .ledger-table tbody td:nth-child(6) { background: var(--ui-surface-muted) !important; border-radius: 9px; padding: 7px 8px !important; font-weight: 600; }
  .ledger-table tbody td:nth-child(6) { font-weight: 800; }
  .ledger-table tbody td.text-end { text-align: left !important; }
  .ledger-table tbody td:nth-child(7) {
    grid-row: 5; grid-column: 4 / 7;
    display: flex; justify-content: flex-end; align-items: center;
    margin-top: 10px; padding-top: 9px !important;
    border-top: 1px solid var(--ui-border) !important;
  }
  .ledger-table tbody td:nth-child(7) .btn,
  .bungalow-side-table tbody td:nth-child(8) .btn {
    min-height: 40px; padding: 0 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px;
  }
  .ledger-table tfoot { display: block; }
  .ledger-table tfoot tr {
    display: flex; flex-wrap: wrap; align-items: flex-start;
    gap: 8px 12px;
    background: var(--ui-surface-muted);
    border: 1px solid var(--ui-border); border-radius: 12px;
    padding: 9px 12px; margin-top: 2px;
  }
  .ledger-table tfoot th { flex: 0 0 calc(50% - 6px); border: 0 !important; padding: 2px 4px !important; font-size: 11.5px; text-align: left !important; background: transparent !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .ledger-table tfoot th:nth-child(4) {
    flex-basis: 100%;
    padding-top: 7px !important;
    border-top: 1px solid var(--ui-border) !important;
    font-size: 13px;
  }
  .ledger-table tfoot th:nth-child(2)::before,
  .ledger-table tfoot th:nth-child(3)::before,
  .ledger-table tfoot th:nth-child(4)::before {
    display: block;
    font-size: 8.5px; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ui-text-muted); font-weight: 700;
  }
  .ledger-table tfoot th:nth-child(2)::before { content: "A"; }
  .ledger-table tfoot th:nth-child(3)::before { content: "B"; }
  .ledger-table tfoot th:nth-child(4)::before { content: "Total"; }
  .ledger-table tfoot th[colspan], .ledger-table tfoot th:empty { display: none; }
  .page-ledger .page-title { font-size: 20px; }
  .page-ledger .page-eyebrow { display: none; }
  .ledger-fixed > .btn-group { width: 100%; display: flex; }
  .ledger-fixed > .btn-group .btn { flex: 1 1 0; min-height: 34px; }
  .ledger-filters { margin-bottom: 2px; }
  .ledger-filters .col-md-3 { flex: 0 0 100%; max-width: 100%; }
  .ledger-filters .col-md-3:nth-child(2),
  .ledger-filters .col-md-3:nth-child(3) { flex: 0 0 calc(50% - 5px); max-width: calc(50% - 5px); }
  .ledger-filter-row { display: flex; gap: 8px; }
  .ledger-filter-row .form-select { flex: 1 1 auto; }
  .ledger-clear-btn { flex-shrink: 0; min-height: 44px; }
  #ledger-sides { --bs-gutter-y: 12px; }
  .ledger-balance-footer { padding: 12px 14px; border-radius: 14px; position: sticky; bottom: 0; z-index: 3; background: var(--ui-surface); box-shadow: 0 -2px 8px rgba(0,0,0,0.06); }
  .ledger-balance-title { font-size: 13.5px; }
  .ledger-excluded-note { margin-top: 10px; font-size: 12px; }

  /* Mobile: Fixed bottom balance bar — hidden at top, shows on scroll */
  @media (max-width: 991.98px) {
    .ledger-page { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
    .ledger-balance-footer { position: fixed; left: 0; right: 0; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 1040; border-radius: 14px 14px 0 0; box-shadow: 0 -4px 16px rgba(15, 30, 61, 0.12); transition: transform 0.25s ease, opacity 0.25s ease; }
    .ledger-balance-footer.hidden { transform: translateY(120%); opacity: 0; pointer-events: none; }
  }

  /* ---------- Bungalow detail ---------- */
  .detail-back { margin-bottom: 10px; }
  .page-bungalow-detail .bungalow-detail-card { padding: 16px; border-radius: 14px; }
  .page-bungalow-detail .bungalow-header-band { --bs-gutter-x: 0; --bs-gutter-y: 12px; }
  .detail-no { font-size: 23px; }
  .page-bungalow-detail .section-title { margin-bottom: 6px !important; }
  .page-bungalow-detail .detail-grid { grid-template-columns: 1fr 1fr; gap: 9px 14px; margin-bottom: 14px; }
  .page-bungalow-detail .detail-label { font-size: 9px; }
  .page-bungalow-detail .detail-value { font-size: 13px; }
  .page-bungalow-detail .detail-amounts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .page-bungalow-detail .detail-amount { padding: 8px 9px; border-radius: 10px; }
  .page-bungalow-detail .detail-amount-label { font-size: 8px; letter-spacing: .04em; }
  .page-bungalow-detail .detail-amount-value { font-size: 12.5px; }
  .page-bungalow-detail .detail-amount-value .amount-reveal { font-size: inherit; min-width: 0; }
  .bungalow-side-card { padding: 14px; border-radius: 14px; }
  .bungalow-side-head { margin-bottom: 8px; }
  .bungalow-expenditure-card { padding: 14px; border-radius: 14px; }
  .expenditure-input, .expenditure-gst-input { max-width: 100%; width: 100%; }
  .bungalow-side-table-wrap { max-height: none; overflow: visible; }
  .bungalow-side-table tbody tr { grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 8px; }
  .bungalow-side-table tbody td:nth-child(1) { grid-row: 1; grid-column: 1 / 4; font-size: 13px; font-weight: 800; padding-top: 0 !important; }
  .bungalow-side-table tbody td:nth-child(2) { grid-row: 1; grid-column: 4 / 7; font-size: 11.5px; text-align: right; color: var(--ui-text-muted); padding-top: 0 !important; }
  .bungalow-side-table tbody td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; margin-top: 3px; line-height: 1.45; }
  .bungalow-side-table tbody td:nth-child(4) { grid-row: 3; grid-column: 1 / 4; margin-top: 9px; }
  .bungalow-side-table tbody td:nth-child(5) { grid-row: 3; grid-column: 4 / 7; margin-top: 9px; }
  .bungalow-side-table tbody td:nth-child(7) { grid-row: 4; grid-column: 1 / -1; margin-top: 9px; }
  .bungalow-side-table tbody td:nth-child(6) {
    grid-row: 5; grid-column: 1 / 4;
    margin-top: 8px; padding-top: 8px !important;
    border-top: 1px solid var(--ui-border) !important;
    text-align: left !important;
    line-height: 1.45;
  }
  .bungalow-side-table tbody td:nth-child(8) {
    grid-row: 5; grid-column: 4 / 7;
    display: flex; justify-content: flex-end; align-items: center;
    margin-top: 8px; padding-top: 8px !important;
    border-top: 1px solid var(--ui-border) !important;
  }

  .bungalow-side-totals { padding: 8px; gap: 6px; margin-top: 10px; }
  .bungalow-side-totals .t-value { font-size: 12.5px; }
  .bungalow-side-totals .t-value .amount-reveal { font-size: inherit; min-width: 0; }
  .bungalow-balance-row { padding: 12px 14px; gap: 10px; border-radius: 14px; }
  .bungalow-balance-title { font-size: 13px; }
  .bungalow-balance-title .amount-reveal { min-width: 0; }
  .bungalow-balance-row p .amount-reveal { min-width: 0; }
  .bungalow-detail-actions .btn { flex: 1 1 auto; min-height: 42px; }

  /* ---------- Received / Expenditure side pages ---------- */
  .side-summary { grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
  .side-summary-cell { padding: 9px 10px; border-radius: 12px; }
  .side-summary-label { font-size: 8.5px; }
  .side-summary-value { font-size: 13.5px; }
  .side-filter-card { margin-bottom: 12px; }
  .side-entries-table tbody tr { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px; }
  .side-entries-table td:nth-child(2) { grid-row: 1; grid-column: 1 / 3; font-size: 13.5px; font-weight: 800; padding-top: 0 !important; }
  .side-entries-table td:nth-child(1) { grid-row: 1; grid-column: 3; font-size: 11.5px; text-align: right; color: var(--ui-text-muted); padding-top: 0 !important; }
  .side-entries-table td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; margin-top: 3px; line-height: 1.45; }
  .side-entries-table td:nth-child(4) { grid-row: 3; grid-column: 1; margin-top: 9px; }
  .side-entries-table td:nth-child(5) { grid-row: 3; grid-column: 2; margin-top: 9px; }
  .side-entries-table td:nth-child(6) { grid-row: 3; grid-column: 3; margin-top: 9px; }
  .side-entries-table td:nth-child(4),
  .side-entries-table td:nth-child(5),
  .side-entries-table td:nth-child(6) { background: var(--ui-surface-muted) !important; border-radius: 9px; padding: 7px 8px !important; font-weight: 600; }
  .side-entries-table td:nth-child(6) { font-weight: 800; }
  .side-entries-table td.text-end { text-align: left !important; }
  .side-entries-table td:nth-child(7) {
    grid-row: 4; grid-column: 1 / -1;
    display: flex; justify-content: flex-end; gap: 8px;
    margin-top: 10px; padding-top: 9px !important;
    border-top: 1px solid var(--ui-border) !important;
  }
  .side-entries-table td:nth-child(7) form { display: flex; gap: 8px; margin: 0; }
  .side-entries-table td:nth-child(7) .btn { min-height: 34px; }

  /* ---------- Entry detail ---------- */
  .page-entry-detail .detail-card { padding: 18px 16px; max-width: none; }
  .page-entry-detail .detail-header { margin-bottom: 16px; padding-bottom: 14px; }
  .page-entry-detail .detail-grid { grid-template-columns: 1fr 1fr; gap: 12px 14px; margin-bottom: 16px; }
  .page-entry-detail .detail-amounts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .page-entry-detail .detail-amount { padding: 8px 9px; border-radius: 10px; min-width: 0; }
  .page-entry-detail .detail-amount-label { font-size: 8px; letter-spacing: .04em; }
  .page-entry-detail .detail-amount-value { font-size: 12.5px; }

  .export-card .list-toolbar { flex-direction: column; align-items: flex-start; gap: 4px; }
  .export-chip span { min-height: 44px; padding: 0 12px; font-size: 12.5px; }

  /* ---------- Standalone customer form ---------- */
  .standalone-page { padding: 16px 12px; }
  .standalone-card { padding: 18px 16px; border-radius: 14px; }
  .standalone-title { font-size: 20px; }
}


@media (max-width: 359.98px) {
  .dash-grid { grid-template-columns: 1fr; }
  .list-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .list-toolbar .type-chip { padding: 6px 8px; font-size: 12.5px; }

  .side-summary { grid-template-columns: 1fr 1fr; }
  .side-summary-cell:last-child { grid-column: 1 / -1; }
  .dash-value { font-size: 16px; }

  .detail-amounts { grid-template-columns: 1fr 1fr !important; }
  .detail-amounts .detail-amount:last-child { grid-column: 1 / -1; }
  .bungalow-side-totals { grid-template-columns: 1fr 1fr; }
  .bungalow-side-totals > div:last-child { grid-column: 1 / -1; }

  .entries-table tbody tr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .entries-table tbody td:nth-child(1) { grid-column: 1 / 5; }
  .entries-table tbody td:nth-child(2) { grid-column: 1 / -1; }
  .entries-table tbody td:nth-child(3) { grid-column: 5 / 7; }
  .entries-table tbody td:nth-child(7) { grid-row: 6; grid-column: 1 / 4; }
  .entries-table tbody td:nth-child(8) { grid-row: 6; grid-column: 4 / 7; }
  .entries-table tbody td:nth-child(9) { grid-row: 7; grid-column: 1 / -1; }
  .entries-table tbody td:nth-child(10) { grid-row: 8; }

  .side-entries-table tbody tr { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .side-entries-table td:nth-child(2) { grid-column: 1 / 4; }
  .side-entries-table td:nth-child(1) { grid-column: 4 / 7; }
  .side-entries-table td:nth-child(4) { grid-row: 3; grid-column: 1 / 4; }
  .side-entries-table td:nth-child(5) { grid-row: 3; grid-column: 4 / 7; }
  .side-entries-table td:nth-child(6) { grid-row: 4; grid-column: 1 / -1; }
  .side-entries-table td:nth-child(7) { grid-row: 5; }
}

.side-entries-table .amount-reveal { font-size: inherit; }
.side-entries-table .total-cell .amount-reveal { font-weight: 700; }

.amounts-master-bar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 16px;
}
.amounts-master {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-sm);
    box-shadow: var(--ui-shadow-sm);
    font-size: 13px; font-weight: 600;
    color: var(--ui-text-muted);
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.amounts-master:hover {
    color: var(--ui-primary); border-color: var(--ui-primary);
    background: var(--ui-primary-soft);
}
.amounts-master[aria-pressed="true"] {
    color: var(--ui-primary); border-color: var(--ui-primary);
    background: var(--ui-primary-soft);
}
.amounts-master-icon svg { display: block; }

@media (max-width: 767.98px) {
    .amounts-master-bar { margin-bottom: 10px; }
    .amounts-master { font-size: 12.5px; padding: 5px 12px; min-height: 44px; }
}

/* ---------- Customer popup modal (entry form) ---------- */
@media (min-width: 768px) {
  #customer-popup .modal-body { max-height: 60vh; overflow-y: auto; }
  #customer-popup .list-group-item .btn-group .btn { font-size: 12px; padding: 4px 10px; }
}

@media (max-width: 767.98px) {
  /* Pin header + footer, make body the only scrolling region.
     svh = small viewport height, so the box always fits above mobile
     browser chrome (URL bar) instead of hiding the footer behind it. */
  #customer-popup .modal-dialog.modal-dialog-scrollable {
    height: calc(100vh - 2 * var(--bs-modal-margin, 0.5rem));
    height: calc(100svh - 2 * var(--bs-modal-margin, 0.5rem));
  }
  #customer-popup .modal-content {
    max-height: 100%; height: 100%;
    display: flex; flex-direction: column;
    border-radius: 16px; border: 0; box-shadow: none;
  }
  #customer-popup .modal-header {
    flex: 0 0 auto;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ui-border);
    background: var(--ui-surface);
    border-radius: 16px 16px 0 0;
  }
  #customer-popup .modal-title { font-size: 16px; font-weight: 700; }
  #customer-popup .modal-body {
    flex: 1 1 auto; min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px 14px;
    background: var(--ui-surface-muted);
  }
  #customer-popup .modal-footer {
    flex: 0 0 auto;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--ui-border);
    background: var(--ui-surface);
    border-radius: 0 0 16px 16px;
    display: flex; gap: 10px; justify-content: flex-end;
  }
  #customer-popup .modal-footer .btn { flex: 1 1 0; min-height: 44px; padding: 8px 16px; }

  /* The visible "box" that scrolls: the .list-group inside modal-body */
  #customer-popup .list-group {
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--ui-shadow-sm);
  }
  #customer-popup .list-group-item {
    padding: 11px 12px;
    border: 0;
    border-bottom: 1px solid var(--ui-border);
    flex-wrap: wrap; row-gap: 8px; column-gap: 10px;
    background: var(--ui-surface);
  }
  #customer-popup .list-group-item:last-child { border-bottom: 0; }

  /* Left text block: title + subtitle, always full-width on mobile */
  #customer-popup .list-group-item > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }
  #customer-popup .list-group-item strong { font-size: 14px; font-weight: 700; display: block; }
  #customer-popup .list-group-item .small { font-size: 11.5px; }

  /* Button group: full-width second row, buttons evenly spaced */
  #customer-popup .list-group-item .btn-group {
    flex: 1 1 100%;
    display: flex; gap: 8px;
  }
  #customer-popup .list-group-item .btn-group .btn {
    flex: 1 1 0;
    min-height: 44px;
    font-size: 12.5px;
    padding: 6px 10px;
    white-space: nowrap;
    justify-content: center;
    border-radius: var(--ui-radius-sm);
    margin-left: 0;
  }
  #customer-popup .list-group-item .btn-group .btn-outline-primary { order: 0; }
}

.confirm-action-content { overflow: hidden; }

.confirm-action-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 0;
  border: 0;
}

.confirm-action-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--ui-danger);
  background: var(--ui-danger-soft);
}

.confirm-action-icon svg { width: 20px; height: 20px; }

.confirm-action-heading {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.confirm-action-heading .modal-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.confirm-action-header .btn-close {
  width: 32px;
  height: 32px;
  align-self: flex-start;
  border-radius: 8px;
  color: var(--ui-text-muted);
}

.confirm-action-header .btn-close:hover {
  color: var(--ui-text);
  background: var(--ui-surface-muted);
}

.confirm-action-body { padding: 18px 20px 20px 72px; }

.confirm-action-message {
  margin: 0;
  color: var(--ui-text);
  font-size: 14px;
  line-height: 1.55;
}

.confirm-action-message strong { font-weight: 700; }

.confirm-action-detail {
  margin: 8px 0 0;
  color: var(--ui-text-muted);
  font-size: 12.5px;
  line-height: 1.55;
}

.confirm-action-footer {
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--ui-border);
  background: #FCFDFF;
}

.confirm-action-footer .btn {
  min-height: 42px;
  min-width: 104px;
  font-size: 13px;
}

.confirm-action-footer .btn:focus-visible,
.confirm-action-header .btn-close:focus-visible {
  outline: 3px solid rgba(29, 78, 216, 0.28);
  outline-offset: 2px;
}

@media (max-width: 575.98px) {
  .confirm-action-header { padding: 18px 18px 0; }
  .confirm-action-body { padding: 16px 18px 18px 70px; }
  .confirm-action-footer { padding: 14px 18px 18px; }
  .confirm-action-footer .btn { flex: 1 1 0; min-width: 0; }
}

body.page-petty-cash {
  --pc-bg: var(--ui-gray-50);
  --pc-surface: var(--ui-gray-0);
  --pc-surface-raised: var(--ui-blue-50);
  --pc-ink: var(--ui-gray-900);
  --pc-muted: var(--ui-gray-500);
  --pc-line: var(--ui-border);
  --pc-line-strong: var(--ui-border-strong);
  --pc-accent: var(--ui-blue-600);
  --pc-danger: #E11D48;
  --ui-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ui-primary: var(--ui-blue-600);
  --ui-primary-hover: var(--ui-blue-700);
  --ui-primary-soft: var(--ui-blue-50);
  --ui-primary-soft-2: var(--ui-blue-100);
  --ui-surface: var(--ui-gray-0);
  --ui-surface-muted: var(--ui-gray-50);
  --ui-border: var(--ui-gray-200);
  --ui-border-strong: var(--ui-gray-300);
  --ui-grid-line: var(--ui-gray-300);
  --ui-text: var(--ui-gray-900);
  --ui-text-muted: var(--ui-gray-500);
  --ui-text-inverse: var(--ui-gray-0);
  --ui-success: #12A150;
  --ui-success-bg: #E7F7EE;
  --ui-danger: #E11D48;
  --ui-danger-bg: #FEE4E4;
  --bs-body-bg: var(--ui-gray-50);
  --bs-body-color: var(--ui-gray-900);
  --bs-primary: var(--ui-blue-600);
  --bs-primary-rgb: 29, 78, 216;
  --bs-success: #12A150;
  --bs-success-rgb: 18, 161, 80;
  --bs-danger: #E11D48;
  --bs-danger-rgb: 225, 29, 72;
  --bs-secondary-color: var(--ui-gray-500);
  --bs-focus-ring-color: rgba(29, 78, 216, 0.25);
}

body.page-petty-cash .app-content {
  background: var(--ui-gray-50);
}

body.page-petty-cash .app-header {
  background: var(--ui-gray-0);
  border-bottom: 1px solid var(--ui-border);
}

body.page-petty-cash .mobile-tab-add-btn {
  background: var(--ui-blue-600);
  color: var(--ui-gray-0);
  box-shadow: var(--ui-shadow-sm);
}

body.page-petty-cash .mobile-tab-add.active .mobile-tab-add-btn {
  box-shadow: 0 0 0 3px var(--ui-primary-soft-2), var(--ui-shadow-sm);
}

body.page-petty-cash .pc-cash-position {
  position: relative;
  overflow: hidden;
  padding: 20px 22px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-gray-0);
  box-shadow: var(--ui-shadow-sm);
  animation: pc-cash-enter 0.32s ease-out both;
}

body.page-petty-cash .pc-cash-position::after {
  content: none;
}

@keyframes pc-cash-enter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

body.page-petty-cash .pc-hero-grid,
body.page-petty-cash .pc-usage {
  position: relative;
  z-index: 1;
}

body.page-petty-cash .pc-eyebrow,
body.page-petty-cash .pc-action-kicker,
body.page-petty-cash .pc-section-kicker {
  margin: 0 0 6px;
  color: var(--ui-blue-600);
  font-family: var(--ui-font);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.page-petty-cash .pc-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(250px, 0.85fr);
  gap: 20px;
  align-items: stretch;
}

body.page-petty-cash .pc-hero-main {
  display: flex;
  flex-direction: column;
}

body.page-petty-cash .pc-hero-title {
  margin: 0;
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--pc-ink);
}

body.page-petty-cash .pc-hero-sub {
  max-width: 52ch;
  margin: 8px 0 0;
  color: var(--pc-muted);
  font-size: 13px;
  line-height: 1.55;
}

body.page-petty-cash .pc-balance-block {
  margin-top: auto;
  padding-top: 18px;
}

body.page-petty-cash .pc-balance-label,
body.page-petty-cash .pc-meta-label {
  display: block;
  color: var(--pc-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.page-petty-cash .pc-balance-value {
  margin: 6px 0 0;
  color: var(--pc-ink);
  font-size: clamp(30px, 3.2vw, 40px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

body.page-petty-cash .pc-balance-meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

body.page-petty-cash .pc-meta-item {
  padding: 12px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--ui-gray-0), var(--ui-gray-50));
}

body.page-petty-cash .pc-meta-value {
  display: block;
  margin-top: 5px;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

body.page-petty-cash .pc-meta-note {
  display: block;
  margin-top: 4px;
  color: var(--pc-muted);
  font-size: 12px;
}

body.page-petty-cash .pc-meta-value--in { color: var(--pc-accent); }
body.page-petty-cash .pc-meta-value--out { color: var(--pc-danger); }

body.page-petty-cash .pc-usage {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--ui-border);
}

body.page-petty-cash .pc-usage-head,
body.page-petty-cash .pc-usage-legend {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--pc-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

body.page-petty-cash .pc-usage-head {
  margin-bottom: 10px;
  font-weight: 600;
}

body.page-petty-cash .pc-usage-percent {
  color: var(--pc-ink);
}

body.page-petty-cash .pc-usage-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--ui-blue-100);
}

body.page-petty-cash .pc-usage-fill {
  display: block;
  height: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ui-blue-500), var(--ui-blue-700));
  transition: width 0.35s ease;
}

body.page-petty-cash .pc-usage-legend {
  margin-top: 10px;
}

body.page-petty-cash .pc-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

body.page-petty-cash .pc-actions.pc-actions--single {
  grid-template-columns: minmax(0, 1fr);
}

body.page-petty-cash .pc-actions.pc-actions--single .pc-action-card {
  width: 100%;
}

body.page-petty-cash .pc-actions.pc-actions--single .pc-form {
  grid-template-columns: minmax(170px, 220px) minmax(170px, 220px) minmax(0, 1fr);
  align-items: end;
}

body.page-petty-cash .pc-actions.pc-actions--single .pc-form p:last-of-type {
  grid-column: auto;
}

body.page-petty-cash .pc-actions.pc-actions--single .pc-form .pc-btn {
  grid-column: 1 / -1;
  justify-self: start;
  width: auto;
  min-width: 180px;
  padding-inline: 20px;
}

body.page-petty-cash .pc-action-card {
  padding: 24px;
  border: 1px solid var(--pc-line);
  border-radius: 16px;
  background: var(--pc-surface);
  box-shadow: var(--ui-shadow-sm);
}

body.page-petty-cash .pc-action-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.page-petty-cash .pc-action-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ui-radius-sm);
  font-family: var(--ui-font);
  font-size: 18px;
  font-weight: 700;
}

body.page-petty-cash .pc-action-mark--fund {
  color: var(--ui-blue-700);
  background: var(--ui-blue-50);
}

body.page-petty-cash .pc-action-mark--expense {
  color: var(--ui-danger);
  background: var(--ui-danger-bg);
}

body.page-petty-cash .pc-action-title,
body.page-petty-cash .pc-section-title {
  margin: 0;
  color: var(--pc-ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

body.page-petty-cash .pc-action-title {
  font-size: 15px;
}

body.page-petty-cash .pc-action-copy {
  margin: 12px 0 20px;
  color: var(--pc-muted);
  font-size: 13px;
  line-height: 1.5;
}

body.page-petty-cash .pc-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

body.page-petty-cash .pc-form p {
  margin: 0;
}

body.page-petty-cash .pc-form p:last-of-type {
  grid-column: 1 / -1;
}

body.page-petty-cash .pc-form label {
  margin-bottom: 5px;
  color: var(--pc-muted);
  font-size: 11px;
  font-weight: 600;
}

body.page-petty-cash .pc-form .form-control {
  width: 100%;
  min-height: 42px;
  color: var(--pc-ink);
  background: var(--ui-gray-0);
  border-color: var(--ui-border-strong);
}

body.page-petty-cash .pc-form .form-control::placeholder {
  color: var(--ui-gray-400);
}

body.page-petty-cash .pc-form .form-control:focus {
  color: var(--pc-ink);
  background: var(--ui-gray-0);
  border-color: var(--ui-blue-500);
  box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.16);
}

body.page-petty-cash .pc-btn {
  grid-column: 1 / -1;
  min-height: 42px;
  margin-top: 4px;
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-radius-sm);
  font-weight: 600;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

body.page-petty-cash .pc-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--ui-shadow-sm);
}

body.page-petty-cash .pc-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

body.page-petty-cash .pc-btn--fund {
  color: var(--ui-gray-0);
  background: var(--ui-blue-600);
  border-color: var(--ui-blue-600);
}

body.page-petty-cash .pc-btn--fund:hover {
  background: var(--ui-blue-700);
  border-color: var(--ui-blue-700);
}

body.page-petty-cash .pc-btn--expense {
  color: var(--ui-blue-700);
  background: var(--ui-blue-50);
  border-color: var(--ui-blue-100);
}

body.page-petty-cash .pc-btn--expense:hover {
  background: var(--ui-blue-100);
}

body.page-petty-cash .pc-insufficient {
  position: relative;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin: -4px 0 18px;
  padding: 14px 46px 14px 14px;
  border: 1px solid var(--ui-danger);
  border-left: 4px solid var(--ui-danger);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-danger-bg);
}

body.page-petty-cash .pc-insufficient[hidden] {
  display: none;
}

body.page-petty-cash .pc-insufficient-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--pc-muted);
  background: transparent;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

body.page-petty-cash .pc-insufficient-close:hover {
  color: var(--ui-danger);
  background: rgba(225, 29, 72, 0.08);
}

body.page-petty-cash .pc-insufficient-close:focus-visible {
  outline: 2px solid var(--ui-blue-500);
  outline-offset: 2px;
}

body.page-petty-cash .pc-insufficient:focus {
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(225, 29, 72, 0.18);
}

body.page-petty-cash .pc-insufficient-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ui-danger);
  background: var(--ui-gray-0);
}

body.page-petty-cash .pc-insufficient-icon svg {
  width: 18px;
  height: 18px;
}

body.page-petty-cash .pc-insufficient-title {
  margin: 0 0 4px;
  color: var(--pc-ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

body.page-petty-cash .pc-insufficient-detail {
  margin: 0;
  color: var(--pc-ink);
  font-size: 12.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

body.page-petty-cash .pc-insufficient-hint {
  margin: 4px 0 0;
  color: var(--pc-muted);
  font-size: 12px;
}

body.page-petty-cash .pc-insufficient-action {
  display: none;
}

body.page-petty-cash .pc-form .errorlist,
body.page-petty-cash #pettyCashEditModalBody .errorlist {
  margin: 6px 0 0;
  padding-left: 16px;
  color: var(--ui-danger);
  font-size: 12px;
  font-weight: 600;
}

body.page-petty-cash .pc-form .form-control[aria-invalid="true"],
body.page-petty-cash #pettyCashEditModalBody .form-control[aria-invalid="true"] {
  border-color: var(--ui-danger);
  background: var(--ui-gray-0);
}

body.page-petty-cash .pc-form .form-control[aria-invalid="true"]:focus,
body.page-petty-cash #pettyCashEditModalBody .form-control[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 0.2rem rgba(225, 29, 72, 0.16);
}

body.page-petty-cash .pc-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

body.page-petty-cash .pc-ledger-card.detail-card {
  max-width: none;
  padding: 22px 24px;
  border: 1px solid var(--pc-line);
  border-radius: 16px;
  background: var(--pc-surface);
  box-shadow: var(--ui-shadow-sm);
}

body.page-petty-cash .pc-ledger-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

body.page-petty-cash .pc-entry-count {
  padding: 5px 10px;
  border: 1px solid var(--pc-line);
  border-radius: 999px;
  color: var(--pc-muted);
  font-family: var(--ui-font);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

body.page-petty-cash .pc-ledger-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.page-petty-cash .pc-history-link {
  color: var(--pc-accent);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}

body.page-petty-cash .pc-history-link:hover {
  text-decoration: underline;
}

body.page-petty-cash .pc-table-wrap {
  border: 1px solid var(--pc-line);
  border-radius: 12px;
}

body.page-petty-cash .pc-table {
  --bs-table-bg: transparent;
  --bs-table-striped-bg: transparent;
  --bs-table-hover-bg: var(--ui-blue-50);
  color: var(--pc-ink);
  font-size: 12.5px;
}

body.page-petty-cash .pc-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ui-gray-50);
  color: var(--pc-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

body.page-petty-cash .pc-table td,
body.page-petty-cash .pc-table th {
  padding: 11px 12px;
  border-color: var(--pc-line);
  vertical-align: middle;
}

body.page-petty-cash .pc-table tbody tr:last-child td {
  border-bottom: 0;
}

body.page-petty-cash .pc-table tbody tr:hover {
  background: var(--bs-table-hover-bg);
}

body.page-petty-cash .pc-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

body.page-petty-cash .pc-amount--in { color: var(--pc-accent); }
body.page-petty-cash .pc-amount--out { color: var(--pc-danger); }
body.page-petty-cash .pc-badge--auto {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ui-success);
  background: var(--ui-success-soft);
  vertical-align: middle;
}
body.page-petty-cash .pc-auto-hint {
  font-size: 12px;
  color: var(--ui-text-muted);
  white-space: nowrap;
  cursor: help;
}

body.page-petty-cash .pc-empty {
  padding: 26px 12px;
  color: var(--pc-muted);
  text-align: center;
}

body.page-petty-cash .pc-history-page {
  max-width: 1180px;
  margin: 0 auto;
}

body.page-petty-cash .pc-history-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

body.page-petty-cash .pc-history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

body.page-petty-cash .pc-history-actions .dropdown-menu {
  min-width: 160px;
  border: 1px solid var(--pc-line);
  border-radius: 12px;
  box-shadow: var(--ui-shadow-md);
}

body.page-petty-cash .pc-history-actions .dropdown-item {
  font-size: 13px;
  font-weight: 500;
}

body.page-petty-cash .pc-history-actions .dropdown-item:hover,
body.page-petty-cash .pc-history-actions .dropdown-item:focus {
  background: var(--ui-blue-50);
  color: var(--ui-blue-700);
}

body.page-petty-cash .pc-history-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid var(--pc-line);
  border-radius: 16px;
  background: var(--pc-surface);
  box-shadow: var(--ui-shadow-sm);
}

body.page-petty-cash .pc-history-filters label {
  display: block;
  margin-bottom: 6px;
  color: var(--pc-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.page-petty-cash .pc-history-filter-actions {
  display: flex;
  gap: 8px;
}

body.page-petty-cash .pc-btn--secondary {
  color: var(--pc-ink);
  background: var(--pc-surface);
  border: 1px solid var(--pc-line);
}

body.page-petty-cash .pc-btn--secondary:hover {
  background: var(--ui-blue-50);
}

@media (max-width: 767px) {
  body.page-petty-cash .pc-history-top {
    flex-direction: column;
  }

  body.page-petty-cash .pc-history-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  body.page-petty-cash .pc-actions,
  body.page-petty-cash .pc-history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  body.page-petty-cash .app-content {
    padding: 14px 12px calc(86px + env(safe-area-inset-bottom));
  }
  body.page-petty-cash .pc-cash-position {
    padding: 22px 18px;
    border-radius: 14px;
  }
  body.page-petty-cash .pc-hero-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  body.page-petty-cash .pc-balance-block {
    padding-top: 18px;
  }
  body.page-petty-cash .pc-balance-value {
    font-size: 34px;
  }
  body.page-petty-cash .pc-action-card,
  body.page-petty-cash .pc-ledger-card.detail-card {
    padding: 18px 16px;
  }
  body.page-petty-cash .pc-form,
  body.page-petty-cash .pc-actions.pc-actions--single .pc-form {
    grid-template-columns: 1fr;
  }
  body.page-petty-cash .pc-form p:last-of-type,
  body.page-petty-cash .pc-actions.pc-actions--single .pc-form p:last-of-type {
    grid-column: auto;
  }
  body.page-petty-cash .pc-actions.pc-actions--single .pc-form .pc-btn {
    width: 100%;
  }
  body.page-petty-cash .pc-insufficient {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 40px 12px 12px;
  }
  body.page-petty-cash .pc-insufficient-icon {
    width: 28px;
    height: 28px;
  }
  body.page-petty-cash .pc-insufficient-icon svg {
    width: 16px;
    height: 16px;
  }

  body.page-petty-cash .pc-btn {
    width: 100%;
    min-height: 48px;
  }
  body.page-petty-cash .pc-ledger-head {
    flex-direction: column;
    gap: 8px;
  }
  body.page-petty-cash .pc-table td,
  body.page-petty-cash .pc-table th {
    padding: 10px 8px;
    font-size: 11.5px;
  }
}

body.page-petty-cash a:focus-visible,
body.page-petty-cash button:focus-visible,
body.page-petty-cash input:focus-visible,
body.page-petty-cash select:focus-visible {
  outline: 2px solid var(--pc-accent);
  outline-offset: 2px;
}

body.page-petty-cash .pc-btn:focus-visible {
  outline: 2px solid var(--ui-blue-600);
  outline-offset: 2px;
}

body.page-petty-cash .skip-link {
  left: 8px;
  transform: translateY(-250%);
}

body.page-petty-cash .skip-link:focus {
  left: 8px;
  transform: none;
}

body.page-petty-cash .pc-history-grid {
  min-width: 0;
}

body.page-petty-cash .pc-ledger-card.detail-card {
  min-width: 0;
  overflow: hidden;
}

body.page-petty-cash .pc-table-wrap {
  max-width: 100%;
}

body.page-petty-cash .pc-table {
  table-layout: fixed;
}

body.page-petty-cash .mobile-tabbar {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

body.page-petty-cash .mobile-tab:not(.mobile-tab-add) {
  min-width: 0;
  overflow: hidden;
}

@media (max-width: 575.98px) {
  body.page-petty-cash .skip-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  body.page-petty-cash .pc-form .form-control {
    min-height: 44px;
  }
  body.page-petty-cash .pc-amount {
    white-space: normal;
  }
  body.page-petty-cash .pc-table td,
  body.page-petty-cash .pc-table th {
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-petty-cash .pc-cash-position {
    animation: none;
  }
  body.page-petty-cash .pc-action-card,
  body.page-petty-cash .pc-btn,
  body.page-petty-cash .pc-usage-fill {
    transition: none;
  }
}

.pc-action-cell {
  white-space: nowrap;
}

.pc-action-btn {
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.pc-action-btn + .pc-action-btn {
  margin-left: 0.25rem;
}

.pc-action-btn:focus-visible,
.pc-action-btn--delete:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.pc-action-btn:disabled,
.pc-action-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.pc-action-btn--delete {
  color: #b42318;
  border-color: rgba(180, 35, 24, 0.35);
}

.pc-action-btn--delete:hover:not(:disabled),
.pc-action-btn--delete:focus-visible:not(:disabled) {
  color: #ffffff;
  background-color: #b42318;
  border-color: #b42318;
}

/* ---------- Audit trail ---------- */
@media (min-width: 768px) {
  .page-audit .page-head { align-items: center; }
}
.audit-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  padding: 16px;
  margin-bottom: 18px;
}
.audit-filter-field { min-width: 0; }
.audit-filter-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ui-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.audit-filter-field .form-control,
.audit-filter-field .form-select { min-height: 38px; font-size: 13px; }
.audit-filter-actions { display: flex; align-items: center; gap: 8px; }
.audit-list { display: grid; gap: 12px; }
.audit-card {
  padding: 16px 18px;
  border-left: 4px solid var(--ui-border-strong);
  overflow: hidden;
}
.audit-card--created { border-left-color: var(--ui-success); }
.audit-card--updated { border-left-color: var(--ui-primary); }
.audit-card--deleted { border-left-color: var(--ui-danger); }
.audit-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.audit-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.audit-heading { font-size: 15px; font-weight: 800; color: var(--ui-text); }
.audit-time { color: var(--ui-text-muted); font-size: 12px; white-space: nowrap; }
.audit-badge--created { color: var(--ui-success); background: var(--ui-success-soft); }
.audit-badge--updated { color: var(--ui-primary); background: var(--ui-primary-soft); }
.audit-badge--deleted { color: var(--ui-danger); background: var(--ui-danger-soft); }
.audit-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  margin-top: 14px;
}
.audit-meta--petty { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.audit-meta-label {
  display: block;
  color: var(--ui-text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.audit-meta-value { color: var(--ui-text); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.audit-particulars { margin: 14px 0 0; color: var(--ui-text); font-size: 13.5px; overflow-wrap: anywhere; }
.audit-reference { margin: 4px 0 0; color: var(--ui-text-muted); font-size: 12px; }
.audit-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-grid-line);
}
.audit-amounts span { display: block; color: var(--ui-text-muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.audit-amounts strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.audit-diff-wrap { margin-top: 14px; }
.audit-diff th { color: var(--ui-text-muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.audit-diff td { font-size: 12.5px; vertical-align: top; overflow-wrap: anywhere; }
.audit-diff td:first-child { font-weight: 700; color: var(--ui-text-muted); }
.audit-no-change { margin: 12px 0 0; color: var(--ui-text-muted); font-size: 13px; }
.audit-card-foot { margin-top: 12px; color: var(--ui-text-muted); font-size: 12px; }
@media (max-width: 991.98px) {
  .audit-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 575.98px) {
  .audit-card { padding: 14px; }
  .audit-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-amounts { gap: 12px; }
  .mobile-tab span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 359.98px) {
  .audit-filters { grid-template-columns: 1fr; }
  .audit-meta { grid-template-columns: 1fr; }
}

.bank-summary { margin-bottom: 16px; }
.bank-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}
.bank-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-lg);
    box-shadow: var(--ui-shadow-sm);
    min-height: 108px;
    justify-content: space-between;
}
.bank-card:hover {
    border-color: var(--ui-primary);
    color: inherit;
}
.bank-card-name {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--ui-text-muted);
}
.bank-card-balance {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--ui-primary);
    font-variant-numeric: tabular-nums;
}
.bank-card-meta {
    font-size: 12px;
    color: var(--ui-text-muted);
}
.bank-card-warning {
    border: 1px solid rgba(255, 136, 0, 0.35);
    background: rgba(255, 136, 0, 0.06);
}
.bank-card-warning .bank-card-balance {
    color: var(--ui-warning);
}
.bank-cell {
    white-space: nowrap;
}
.bank-unassigned {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border: 1px solid rgba(255, 136, 0, 0.35);
    border-radius: 999px;
    background: rgba(255, 136, 0, 0.10);
    color: var(--ui-warning);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.bank-review-banner {
    border-color: rgba(255, 136, 0, 0.45);
    background: rgba(255, 136, 0, 0.06);
}
#bank-field {
    min-width: 0;
}
#bank-field[hidden] {
    display: block;
    visibility: hidden;
}
@media (max-width: 767.98px) {
    .bank-summary-grid { grid-template-columns: 1fr; }
}

/* Funding split (O/C vs B/C) */
.detail-subvalue {
  margin-top: 2px; font-size: 12.5px; font-weight: 600;
  color: var(--ui-text-muted); font-variant-numeric: tabular-nums;
}
.bungalow-sanction-strip {
  display: flex; flex-wrap: wrap; align-items: flex-end;
  justify-content: space-between; gap: 12px 20px;
  margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--ui-border);
}
.bungalow-sanction-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bungalow-sanction-label {
  margin: 0; font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase; color: var(--ui-text);
}
.bungalow-sanction-hint { font-size: 11.5px; color: var(--ui-text-muted); }
.bungalow-sanction-form { min-width: 280px; }
.bungalow-sanction-form .form-control { font-variant-numeric: tabular-nums; }
.funding-chip {
  display: inline-block; margin-top: 3px; padding: 1px 7px;
  border-radius: 999px; font-size: 10px; font-weight: 700;
  letter-spacing: .04em; line-height: 1.5;
}
.funding-chip-oc { color: var(--ui-success); background: var(--ui-success-soft); }
.funding-chip-bc { color: var(--ui-blue-500); background: rgba(37, 99, 235, .12); }

@media (max-width: 575.98px) {
  .bungalow-sanction-strip { align-items: stretch; }
  .bungalow-sanction-form { min-width: 100%; }
}

.statement-mode-chip-oc { color: var(--ui-success); background: var(--ui-success-soft); border-color: transparent; }
.statement-mode-chip-bc { color: var(--ui-blue-500); background: rgba(37, 99, 235, .12); border-color: transparent; }
.statement-mode-chip-none { color: var(--ui-text-muted); }

.bungalow-receivable-card { padding: 16px 18px; }
.bungalow-receivable-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 8px 16px; margin-bottom: 12px;
}
.bungalow-receivable-card .table-responsive { overflow-x: visible; }
.bungalow-receivable-table { width: 100%; table-layout: fixed; }
.bungalow-receivable-table th,
.bungalow-receivable-table td { font-variant-numeric: tabular-nums; vertical-align: middle; }
.bungalow-receivable-table thead th {
  font-size: 10px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--ui-text-muted);
  border-bottom: 1px solid var(--ui-border); padding: 7px 8px;
  white-space: normal; line-height: 1.3;
}
.bungalow-receivable-table tbody th,
.bungalow-receivable-table tbody td { padding: 9px 8px; font-size: 12.5px; }
.bungalow-receivable-table tbody th { font-weight: 700; color: var(--ui-text); white-space: normal; width: 18%; }
.bungalow-receivable-table tbody td { font-weight: 600; white-space: nowrap; }
.bungalow-balance-row-inner {
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ui-border);
  background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
  box-shadow: none; border-radius: 0; padding-left: 0; padding-right: 0; padding-bottom: 0;
}
@media (max-width: 991.98px) {
  .bungalow-receivable-card .table-responsive { overflow-x: auto; }
  .bungalow-receivable-table { table-layout: auto; min-width: 680px; }
}
@media (max-width: 767.98px) {
  .bungalow-receivable-card { padding: 14px; }
  .bungalow-receivable-table tbody th { min-width: 130px; }
}


/* Export bungalow summary toggle */
.export-fields-bungalow { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
.export-field-bungalow-select { min-width: 0; }
.export-field-summary { min-width: 220px; }
.export-summary-toggle {
  display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 10px 14px;
  border: 1px solid var(--ui-border);
  border-radius: 12px; background: var(--ui-surface-muted);
  cursor: pointer; user-select: none;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.export-summary-toggle:hover { border-color: var(--ui-border-strong); background: var(--ui-surface); }
.export-summary-toggle:focus-within { box-shadow: 0 0 0 3px rgba(37,99,235,.12); border-color: var(--ui-blue-500); }
.export-summary-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.export-summary-toggle-ui {
  width: 44px; height: 26px; flex: 0 0 auto;
  border-radius: 999px; background: #cbd5e1; padding: 3px;
  transition: background-color .18s ease;
}
.export-summary-toggle-ui span {
  display: block; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transition: transform .18s ease;
}
.export-summary-toggle input:checked + .export-summary-toggle-ui { background: var(--ui-blue-500, #2563eb); }
.export-summary-toggle input:checked + .export-summary-toggle-ui span { transform: translateX(18px); }
.export-summary-toggle-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.export-summary-toggle-title { font-size: 13px; font-weight: 700; color: var(--ui-text); line-height: 1.2; }
.export-summary-toggle-sub { font-size: 11px; color: var(--ui-text-muted); line-height: 1.3; }
@media (max-width: 767.98px) {
  .export-fields-bungalow { grid-template-columns: 1fr; }
  .export-field-summary { min-width: 0; }
}
