/* ============================================================
   RAZAKAR BUDGET — Design System v4  (Premium SaaS 2026)
   ============================================================ */

:root {
  /* Brand */
  --rb-primary:        #082F49;
  --rb-primary-soft:   #E0F2FE;
  --rb-primary-dark:   #051E30;
  --rb-primary-rgb:    8, 47, 73;
  --rb-secondary:      #047857;
  --rb-accent:         #B7791F;
  --rb-actuals:        #7C3AED;

  /* Semantic */
  --rb-danger:         #B91C1C;
  --rb-success:        #047857;
  --rb-warning:        #B7791F;
  --rb-info:           #0369A1;

  /* Surface */
  --rb-body-bg:        #F6F8FB;
  --rb-card-bg:        #FFFFFF;
  --rb-surface-soft:   #F8FAFC;
  --rb-border:         #E2E8F0;
  --rb-text:           #0F172A;
  --rb-muted:          #64748B;

  /* Layout */
  --rb-sidebar-width:  280px;
  --rb-topbar-h:       72px;
  --rb-radius:         18px;
  --rb-radius-sm:      10px;
  --rb-shadow:         0 1px 3px rgba(0,0,0,.05), 0 4px 20px rgba(8,47,73,.07);
  --rb-shadow-md:      0 8px 32px rgba(8,47,73,.12), 0 2px 8px rgba(0,0,0,.05);
  --rb-shadow-lg:      0 20px 60px rgba(8,47,73,.16);

  /* Bootstrap overrides */
  --bs-primary:        #082F49;
  --bs-primary-rgb:    8, 47, 73;
  --bs-success:        #047857;
  --bs-success-rgb:    4, 120, 87;
  --bs-danger:         #B91C1C;
  --bs-danger-rgb:     185, 28, 28;
  --bs-warning:        #B7791F;
  --bs-warning-rgb:    183, 121, 31;
  --bs-info:           #0369A1;
  --bs-info-rgb:       3, 105, 161;
  --bs-link-color:     #082F49;
  --bs-link-hover-color: #051E30;
}

/* ── Reset / Base ── */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
@media (min-width: 768px) { html { font-size: 15px; } }

body {
  background: var(--rb-body-bg);
  color: var(--rb-text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  font-size: 14px;
  font-feature-settings: "kern" 1;
  margin: 0;
  overflow: hidden;
  height: 100vh;
}

/* ── Layout wrapper ── */
#wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar-wrapper {
  width: var(--rb-sidebar-width);
  min-width: var(--rb-sidebar-width);
  background: linear-gradient(180deg, #082F49 0%, #0F172A 100%);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  transition: width .28s ease, min-width .28s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
#sidebar-wrapper.toggled {
  width: 0;
  min-width: 0;
  overflow: hidden;
}
#sidebar-wrapper::-webkit-scrollbar { width: 4px; }
#sidebar-wrapper::-webkit-scrollbar-track { background: transparent; }
#sidebar-wrapper::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Brand area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .875rem;
  padding: 0 1.25rem;
  height: var(--rb-topbar-h);
  border-bottom: 1px solid rgba(255,255,255,.07);
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #93C5FD;
  flex-shrink: 0;
}
.sidebar-brand-info { overflow: hidden; }
.sidebar-brand-name {
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.sidebar-brand-sub {
  font-size: .65rem;
  color: rgba(255,255,255,.38);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sidebar-brand-text {
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

/* Nav section labels */
.sidebar-section-label {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.27);
  padding: 1.4rem 1.4rem .35rem;
  white-space: nowrap;
}

.sidebar-nav { padding: .625rem .75rem; flex: 1; }

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .625rem 1rem;
  border-radius: 10px;
  font-size: .845rem;
  font-weight: 500;
  color: rgba(255,255,255,.52);
  white-space: nowrap;
  transition: all .18s;
  margin-bottom: 2px;
  text-decoration: none;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-link i {
  font-size: .95rem;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.9);
}
.sidebar-nav .nav-link.active {
  background: rgba(255,255,255,.1);
  border-left-color: #B7791F;
  color: #fff;
  font-weight: 600;
}
.sidebar-nav .nav-link.active i { color: #B7791F; }

/* ── Main content wrapper ── */
#page-content-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  height: var(--rb-topbar-h);
  background: var(--rb-card-bg);
  border-bottom: 1px solid var(--rb-border);
  box-shadow: 0 1px 0 rgba(0,0,0,.03), 0 4px 16px rgba(8,47,73,.04);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 98;
}
.topbar-toggle {
  background: none;
  border: none;
  color: var(--rb-muted);
  padding: .4rem .5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.3rem;
  line-height: 1;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--rb-body-bg); color: var(--rb-primary); }

.topbar-page-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--rb-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-spacer { flex: 1; }

.topbar-sep {
  width: 1px;
  height: 24px;
  background: var(--rb-border);
  flex-shrink: 0;
}

.topbar-user-info {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-size: .82rem;
}
.topbar-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #082F49 0%, #1E6091 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(8,47,73,.25);
}
.topbar-username {
  font-weight: 600;
  color: var(--rb-text);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 480px) { .topbar-username { display: none; } }

.topbar-logout {
  background: none;
  border: 1px solid var(--rb-border);
  color: var(--rb-muted);
  border-radius: 8px;
  padding: .35rem .75rem;
  font-size: .8rem;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .35rem;
  transition: all .15s;
  white-space: nowrap;
}
.topbar-logout:hover { background: #fef2f2; border-color: #fca5a5; color: #B91C1C; }

/* ── Page main scroll area ── */
.page-main {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}
@media (max-width: 575px) { .page-main { padding: 1.25rem; } }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-header-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--rb-text);
  margin: 0;
  line-height: 1.2;
  letter-spacing: -.025em;
}
.page-header-sub {
  font-size: .8rem;
  color: var(--rb-muted);
  font-weight: 400;
  margin-top: .2rem;
}
.btn-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--rb-card-bg);
  border: 1px solid var(--rb-border);
  color: var(--rb-muted);
  text-decoration: none;
  transition: all .18s;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.btn-back:hover { border-color: var(--rb-primary); color: var(--rb-primary); background: var(--rb-primary-soft); }

/* ── Cards ── */
.card {
  background: var(--rb-card-bg);
  border: 1px solid var(--rb-border) !important;
  border-radius: var(--rb-radius) !important;
  box-shadow: var(--rb-shadow) !important;
  transition: box-shadow .22s, transform .22s;
}
.card-header {
  background: var(--rb-surface-soft) !important;
  border-bottom: 1px solid var(--rb-border) !important;
  padding: 1rem 1.5rem !important;
  font-weight: 600;
  font-size: .9rem;
  color: var(--rb-text);
  border-radius: calc(var(--rb-radius) - 1px) calc(var(--rb-radius) - 1px) 0 0 !important;
}
.card-body { padding: 1.5rem; }

/* ── Stat / KPI Cards ── */
.stat-card {
  background: var(--rb-card-bg);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  padding: 1.5rem;
  box-shadow: var(--rb-shadow);
  transition: box-shadow .22s, transform .22s;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #082F49, #1E6091);
  opacity: 0;
  transition: opacity .22s;
  border-radius: var(--rb-radius) var(--rb-radius) 0 0;
}
.stat-card:hover {
  box-shadow: var(--rb-shadow-md);
  transform: translateY(-3px);
}
.stat-card:hover::after { opacity: 1; }
.stat-card .stat-info { flex: 1; min-width: 0; }
.stat-card .stat-value {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  color: var(--rb-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  margin-bottom: .35rem;
}
.stat-card .stat-label {
  font-size: .78rem;
  color: var(--rb-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Stat Icon ── */
.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon-sm { width: 40px !important; height: 40px !important; font-size: 1.1rem !important; border-radius: 10px !important; }

.stat-icon-primary  { background: var(--rb-primary-soft); color: #082F49; }
.stat-icon-draft    { background: #F1F5F9; color: #475569; }
.stat-icon-pending  { background: #FEF3C7; color: #92400E; }
.stat-icon-approved { background: #DCFCE7; color: #166534; }
.stat-icon-rejected { background: #FEE2E2; color: #991B1B; }
.stat-icon-payment  { background: #DBEAFE; color: #1E40AF; }
.stat-icon-settled  { background: #CCFBF1; color: #134E4A; }
.stat-icon-balance  { background: #DCFCE7; color: #166534; }

/* ── Tables ── */
.table {
  font-size: .8125rem;
  color: var(--rb-text);
  margin-bottom: 0;
  border-collapse: collapse;
}
.table thead th {
  font-size: .695rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--rb-muted);
  border-bottom: 1px solid var(--rb-border) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  padding: .9rem 1.25rem !important;
  white-space: nowrap;
  background: var(--rb-surface-soft) !important;
}
.table tbody td {
  padding: 1rem 1.25rem !important;
  vertical-align: middle;
  border-color: var(--rb-border) !important;
  border-left: none !important;
  border-right: none !important;
}
.table tbody tr:first-child td { border-top: none !important; }
.table-sm tbody td { padding: .6rem 1rem !important; }
.table-hover tbody tr:hover > * { background-color: #F0F6FF !important; }
.table-bordered th, .table-bordered td {
  border: none !important;
  border-bottom: 1px solid var(--rb-border) !important;
}
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-light td, .table-light th { background-color: var(--rb-surface-soft) !important; }

td.text-end, th.text-end { font-variant-numeric: tabular-nums; }

/* ── Forms ── */
.form-control, .form-select {
  border-color: var(--rb-border);
  border-radius: var(--rb-radius-sm) !important;
  font-size: .855rem;
  color: var(--rb-text);
  background: #fff;
  min-height: 44px;
  transition: border-color .15s, box-shadow .15s;
  padding: .55rem .925rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--rb-primary) !important;
  box-shadow: 0 0 0 3px rgba(8,47,73,.1) !important;
  outline: none;
}
.form-control::placeholder { color: #94A3B8; }
.form-control-sm, .form-select-sm {
  min-height: 34px;
  font-size: .8rem;
  border-radius: 8px !important;
  padding: .3rem .65rem;
}
textarea.form-control { min-height: auto; }
.form-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--rb-text);
  margin-bottom: .35rem;
  display: block;
}
.input-group-text {
  background: var(--rb-surface-soft);
  border-color: var(--rb-border);
  color: var(--rb-muted);
  font-size: .855rem;
}
.form-check-input:checked { background-color: var(--rb-primary); border-color: var(--rb-primary); }

/* ── Premium Form Sections ── */
.form-section {
  background: var(--rb-card-bg);
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  box-shadow: var(--rb-shadow);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.form-section-header {
  display: flex;
  align-items: center;
  gap: .875rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--rb-border);
}
.form-section-icon {
  width: 40px;
  height: 40px;
  background: var(--rb-primary-soft);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: var(--rb-primary);
  flex-shrink: 0;
}
.form-section-title {
  font-size: .925rem;
  font-weight: 700;
  color: var(--rb-text);
  margin: 0;
  line-height: 1.3;
}
.form-section-desc {
  font-size: .78rem;
  color: var(--rb-muted);
  margin-top: .15rem;
}
.form-section-header-actions {
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Sticky bottom action bar ── */
.form-action-bar {
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--rb-border);
  padding: 1rem 2rem;
  margin: 1.5rem -2rem -2rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  z-index: 20;
  box-shadow: 0 -4px 20px rgba(8,47,73,.07);
}
@media (max-width: 575px) {
  .form-action-bar { padding: .875rem 1.25rem; margin: 1.25rem -1.25rem -1.25rem; }
}

/* ── Buttons ── */
.btn {
  font-size: .855rem;
  font-weight: 600;
  border-radius: var(--rb-radius-sm);
  transition: all .18s;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 42px;
  padding: .45rem 1.15rem;
}
.btn-sm { font-size: .78rem; padding: .3rem .875rem; border-radius: 8px; min-height: 34px; }
.btn-xs { font-size: .72rem; padding: .2rem .6rem; border-radius: 6px; min-height: 28px; }

.btn-icon {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0 !important;
  border-radius: 50% !important;
  justify-content: center;
}
.btn-icon.btn-sm { width: 30px; height: 30px; min-height: 30px; }

.btn-primary {
  --bs-btn-bg:                 #082F49;
  --bs-btn-border-color:       #082F49;
  --bs-btn-hover-bg:           #051E30;
  --bs-btn-hover-border-color: #051E30;
  --bs-btn-active-bg:          #051E30;
  --bs-btn-color:              #fff;
  background-color: #082F49 !important;
  border-color: #082F49 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(8,47,73,.28);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: #051E30 !important;
  border-color: #051E30 !important;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(8,47,73,.36) !important;
}

.btn-outline-primary {
  --bs-btn-color:              #082F49;
  --bs-btn-border-color:       #082F49;
  --bs-btn-hover-bg:           #082F49;
  --bs-btn-hover-border-color: #082F49;
  --bs-btn-hover-color:        #fff;
  color: #082F49 !important;
  border-color: #082F49 !important;
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
  background-color: #082F49 !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #fff !important;
  border-color: #CBD5E1 !important;
  color: #082F49 !important;
}
.btn-secondary:hover, .btn-secondary:focus {
  background-color: var(--rb-body-bg) !important;
  border-color: var(--rb-primary) !important;
  color: var(--rb-primary) !important;
}

.btn-outline-secondary {
  color: #64748B !important;
  border-color: #CBD5E1 !important;
}
.btn-outline-secondary:hover, .btn-outline-secondary:focus {
  background-color: var(--rb-body-bg) !important;
  border-color: var(--rb-primary) !important;
  color: var(--rb-primary) !important;
}

.btn-success {
  background-color: #047857 !important;
  border-color: #047857 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(4,120,87,.22);
}
.btn-success:hover, .btn-success:focus {
  background-color: #036344 !important;
  border-color: #036344 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(4,120,87,.3) !important;
}

.btn-danger {
  background-color: #B91C1C !important;
  border-color: #B91C1C !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(185,28,28,.22);
}
.btn-danger:hover, .btn-danger:focus {
  background-color: #991B1B !important;
  border-color: #991B1B !important;
  transform: translateY(-1px);
}

.btn-outline-danger {
  color: #B91C1C !important;
  border-color: #B91C1C !important;
}
.btn-outline-danger:hover {
  background-color: #B91C1C !important;
  color: #fff !important;
}

.btn-warning {
  background-color: #B7791F !important;
  border-color: #B7791F !important;
  color: #fff !important;
}
.btn-warning:hover, .btn-warning:focus {
  background-color: #92400E !important;
  border-color: #92400E !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-info {
  background-color: #0369A1 !important;
  border-color: #0369A1 !important;
  color: #fff !important;
}
.btn-info:hover, .btn-info:focus {
  background-color: #075985 !important;
  border-color: #075985 !important;
  color: #fff !important;
  transform: translateY(-1px);
}

.btn-actuals {
  background: #7C3AED;
  color: #fff;
  border-color: #7C3AED;
  box-shadow: 0 2px 8px rgba(124,58,237,.22);
}
.btn-actuals:hover, .btn-actuals:focus {
  background: #6D28D9;
  border-color: #6D28D9;
  color: #fff;
  transform: translateY(-1px);
}

/* ── Status Badges — Pill ── */
.badge {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: .35em .8em;
  border-radius: 999px;
}

.badge-Draft            { background: #F1F5F9 !important; color: #475569 !important; }
.badge-PendingApproval  { background: #FEF3C7 !important; color: #92400E !important; }
.badge-Approved         { background: #DCFCE7 !important; color: #166534 !important; }
.badge-Rejected         { background: #FEE2E2 !important; color: #991B1B !important; }
.badge-PaymentReleased  { background: #DBEAFE !important; color: #1E40AF !important; }
.badge-ActualsSubmitted { background: #EDE9FE !important; color: #5B21B6 !important; }
.badge-Settled          { background: #CCFBF1 !important; color: #134E4A !important; }

.badge.bg-success { background: #DCFCE7 !important; color: #166534 !important; }
.badge.bg-danger  { background: #FEE2E2 !important; color: #991B1B !important; }
.badge.bg-warning { background: #FEF3C7 !important; color: #92400E !important; }
.badge.bg-info    { background: #DBEAFE !important; color: #1E40AF !important; }
.badge.bg-primary { background: var(--rb-primary-soft) !important; color: #082F49 !important; }

.badge-soft-warning  { background: #FEF3C7; color: #92400E; }
.badge-soft-success  { background: #DCFCE7; color: #166534; }
.badge-soft-danger   { background: #FEE2E2; color: #991B1B; }
.badge-soft-info     { background: #DBEAFE; color: #1E40AF; }
.badge-soft-primary  { background: var(--rb-primary-soft); color: #082F49; }
.badge-soft-actuals  { background: #EDE9FE; color: #5B21B6; }

.badge-days-critical { background: #FEE2E2; color: #991B1B; }
.badge-days-warning  { background: #FEF3C7; color: #92400E; }
.badge-days-ok       { background: #F1F5F9; color: #475569; }

.badge-extra  { background: #EDE9FE; color: #7C3AED; font-size: .65rem; }
.badge-overdue { background: #FEE2E2; color: #991B1B; font-size: .65rem; }

/* ── Filter Pills ── */
.filter-pills { display: flex; gap: .4rem; flex-wrap: wrap; }
.filter-pill {
  padding: .375rem 1rem;
  border-radius: 999px;
  font-size: .775rem;
  font-weight: 500;
  border: 1px solid var(--rb-border);
  background: var(--rb-card-bg);
  color: var(--rb-muted);
  cursor: pointer;
  text-decoration: none;
  transition: all .18s;
  display: inline-block;
  line-height: 1.5;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.filter-pill:hover { border-color: var(--rb-primary); color: var(--rb-primary); background: var(--rb-primary-soft); }
.filter-pill.active {
  background: var(--rb-primary);
  border-color: var(--rb-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(8,47,73,.25);
}
.filter-pill-unsettled { border-color: #fca5a5 !important; color: #B91C1C !important; }
.filter-pill-unsettled:hover, .filter-pill-unsettled.active {
  background: #B91C1C !important; border-color: #B91C1C !important; color: #fff !important;
}

/* ── Alerts ── */
.alert {
  border-radius: var(--rb-radius-sm);
  font-size: .855rem;
  border: none !important;
}
.alert-success {
  background: #F0FDF4;
  color: #166534;
  border-left: 4px solid #16A34A !important;
}
.alert-danger {
  background: #FEF2F2;
  color: #991B1B;
  border-left: 4px solid #DC2626 !important;
}

/* ── Login ── */
.login-page {
  min-height: 100vh;
  display: flex;
  overflow: auto;
}
.login-brand-panel {
  width: 440px;
  min-height: 100vh;
  background: linear-gradient(160deg, #163050 0%, #082F49 60%, #0369A1 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  top: -100px; right: -100px;
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
  bottom: -60px; left: -80px;
}
.login-brand-logo {
  width: 80px; height: 80px;
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; color: #fff;
  margin-bottom: 1.5rem;
  position: relative; z-index: 1;
}
.login-brand-panel h2 { font-size: 1.6rem; font-weight: 800; margin-bottom: .5rem; text-align: center; position: relative; z-index: 1; }
.login-brand-panel p { font-size: .9rem; color: rgba(255,255,255,.7); text-align: center; max-width: 260px; line-height: 1.6; position: relative; z-index: 1; }
.login-brand-features { margin-top: 2.5rem; display: flex; flex-direction: column; gap: .85rem; width: 100%; max-width: 280px; position: relative; z-index: 1; }
.login-brand-feature { display: flex; align-items: center; gap: .75rem; font-size: .82rem; color: rgba(255,255,255,.8); }
.login-brand-feature i { font-size: 1rem; color: #B7791F; flex-shrink: 0; }
.login-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; background: #F6F8FB; }
.login-box { width: 100%; max-width: 420px; }
.login-card { background: #fff; border-radius: 18px; padding: 2.5rem; box-shadow: var(--rb-shadow-md); border: 1px solid var(--rb-border); }
.login-card h4 { font-size: 1.35rem; font-weight: 700; color: var(--rb-text); }
@media (max-width: 767px) {
  .login-brand-panel { display: none; }
  .login-form-panel { background: linear-gradient(160deg, #051E30 0%, #0369A1 100%); padding: 1.25rem; }
  .login-card { padding: 1.75rem; }
  body.login-body { overflow: auto; height: auto; }
}

/* ── Mobile sidebar ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 150;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sidebar-overlay.show { display: block; }

@media (max-width: 767px) {
  body { overflow: auto; height: auto; }
  #wrapper { min-height: 100vh; height: auto; overflow: visible; }
  #sidebar-wrapper {
    position: fixed !important;
    left: 0; top: 0;
    height: 100% !important;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .28s ease !important;
    width: var(--rb-sidebar-width) !important;
    min-width: var(--rb-sidebar-width) !important;
    overflow-y: auto !important;
  }
  #sidebar-wrapper.toggled {
    width: var(--rb-sidebar-width) !important;
    min-width: var(--rb-sidebar-width) !important;
    overflow-y: auto !important;
  }
  #sidebar-wrapper.mobile-open { transform: translateX(0) !important; }
  #page-content-wrapper { height: auto; overflow: visible; }
  .page-main { overflow: visible; }
  .topbar { padding: 0 1.25rem; }
}

/* ── Detail info rows ── */
.info-item small { font-size: .72rem; color: var(--rb-muted); font-weight: 500; display: block; margin-bottom: .15rem; }
.info-item div { font-size: .875rem; color: var(--rb-text); }

/* ── Account balance ── */
.account-balance {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--rb-success);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}

/* ── Semantic text colours ── */
.text-actuals { color: #7C3AED !important; }
.text-settled  { color: #047857 !important; }
.text-primary  { color: var(--rb-primary) !important; }
.text-success  { color: var(--rb-success) !important; }
.text-danger   { color: var(--rb-danger)  !important; }
.text-info     { color: var(--rb-info)    !important; }
.text-warning  { color: var(--rb-warning) !important; }
.text-muted    { color: var(--rb-muted)   !important; }

/* ── Row variants ── */
.row-extra > td { background: #FAF5FF !important; }
.table-hover .row-extra:hover > td { background: #F3EBFF !important; }

/* Overdue/unsettled: left red border, no background fill */
.row-unsettled > td { background-color: transparent !important; }
.row-unsettled > td:first-child { border-left: 3px solid #B91C1C !important; }
.table-hover .row-unsettled:hover > td { background-color: #FEF2F2 !important; }

/* ── Select2 theme ── */
.select2-container--bootstrap-5 .select2-selection {
  font-size: .855rem !important;
  border-color: var(--rb-border) !important;
  border-radius: var(--rb-radius-sm) !important;
  min-height: 44px !important;
}
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  line-height: 44px !important;
  padding-left: .925rem !important;
}
.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--rb-primary) !important;
  box-shadow: 0 0 0 3px rgba(8,47,73,.1) !important;
}
.select2-container--bootstrap-5 .select2-dropdown {
  border-color: var(--rb-border) !important;
  border-radius: var(--rb-radius-sm) !important;
  box-shadow: var(--rb-shadow-md) !important;
}
.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: var(--rb-primary-soft) !important;
  color: var(--rb-primary) !important;
}

/* ── DataTables ── */
table.dataTable thead th,
table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc,
table.dataTable thead th.sorting_asc_disabled,
table.dataTable thead th.sorting_desc_disabled {
  background: var(--rb-surface-soft) !important;
  color: var(--rb-muted) !important;
  font-size: .695rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: .07em !important;
  padding: .9rem 1.25rem !important;
  white-space: nowrap !important;
  border-bottom: 1px solid var(--rb-border) !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
}
table.dataTable thead .sorting::before,
table.dataTable thead .sorting_asc::before { display: none !important; }
table.dataTable thead .sorting::after,
table.dataTable thead .sorting_asc::after,
table.dataTable thead .sorting_desc::after { opacity: .2; }

table.dataTable tbody td {
  padding: 1rem 1.25rem !important;
  vertical-align: middle;
  border-color: var(--rb-border) !important;
  border-left: none !important;
  border-right: none !important;
  font-size: .8125rem;
  color: var(--rb-text);
}
table.dataTable.table-hover tbody tr:hover > * { background-color: #F0F6FF !important; }
table.dataTable { border-collapse: collapse !important; }

/* DataTables controls */
.dataTables_wrapper { padding: 0 !important; }
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_filter {
  font-size: .8rem;
  color: var(--rb-muted);
  padding: .875rem 1.5rem !important;
}
div.dataTables_wrapper div.dataTables_filter { text-align: right; }
div.dataTables_wrapper > .row:first-child {
  margin: 0 !important;
  border-bottom: 1px solid var(--rb-border);
  background: var(--rb-surface-soft);
}
div.dataTables_wrapper > .row:first-child > div { padding: 0 !important; }
div.dataTables_wrapper > .row:last-child {
  margin: 0 !important;
  border-top: 1px solid var(--rb-border);
  background: var(--rb-surface-soft);
}
div.dataTables_wrapper > .row:last-child > div { padding: 0 !important; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--rb-border) !important;
  border-radius: 8px !important;
  font-size: .8rem !important;
  padding: .3rem .75rem !important;
  color: var(--rb-text) !important;
  background: #fff !important;
  min-height: 34px;
}
.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--rb-primary) !important;
  box-shadow: 0 0 0 3px rgba(8,47,73,.1) !important;
  outline: none !important;
}
.dataTables_wrapper .dataTables_info {
  font-size: .78rem;
  color: var(--rb-muted);
  padding: .75rem 1.5rem !important;
}
.dataTables_wrapper .dataTables_paginate { padding: .625rem 1.5rem !important; }
.dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  font-size: .78rem !important;
  padding: .3rem .7rem !important;
  border: 1px solid var(--rb-border) !important;
  margin: 0 2px !important;
  color: var(--rb-muted) !important;
}
.dataTables_paginate .paginate_button:hover {
  background: var(--rb-primary-soft) !important;
  border-color: var(--rb-primary) !important;
  color: var(--rb-primary) !important;
}
.dataTables_paginate .paginate_button.current,
.dataTables_paginate .paginate_button.current:hover {
  background: var(--rb-primary) !important;
  border-color: var(--rb-primary) !important;
  color: #fff !important;
}
.dataTables_paginate .paginate_button.disabled,
.dataTables_paginate .paginate_button.disabled:hover {
  opacity: .35;
  color: var(--rb-muted) !important;
  background: none !important;
}
div.dataTables_wrapper div.dataTables_paginate ul.pagination { margin: 0; }

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 2rem;
  text-align: center;
  color: var(--rb-muted);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .28; }
.empty-state-title { font-size: 1rem; font-weight: 700; color: var(--rb-text); margin-bottom: .4rem; }
.empty-state-text { font-size: .855rem; margin-bottom: 1.5rem; max-width: 300px; }

/* ── Skeletons ── */
.skeleton {
  background: linear-gradient(90deg, #F0F4F8 25%, #E8EDF2 50%, #F0F4F8 75%);
  background-size: 400% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.skeleton-text    { height: 14px; border-radius: 4px; }
.skeleton-text-sm { height: 11px; border-radius: 4px; }
.skeleton-circle  { border-radius: 50%; }
