:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #101936;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e6ebf2;
  --navy: #061b3a;
  --navy-2: #09264f;
  --cyan: #08a7bc;
  --cyan-dark: #057f95;
  --cyan-soft: #e6f7fb;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --green: #11a36a;
  --green-soft: #e9f9f0;
  --red: #ef3d43;
  --red-soft: #ffeded;
  --amber: #f59e0b;
  --amber-soft: #fff3df;
  --purple: #7c3aed;
  --purple-soft: #f0ebff;
  --shadow: 0 12px 28px rgba(16, 25, 54, .08);
  --shadow-soft: 0 8px 18px rgba(16, 25, 54, .05);
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 62% -10%, rgba(8, 167, 188, .08), transparent 26%), var(--bg);
  color: var(--text);
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--cyan); }
button, input, select, textarea { font: inherit; }

/* Auth, setup and diagnostics */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(8, 167, 188, .22), transparent 36%), linear-gradient(135deg, #061b3a, #f6f9fc 58%);
}

.login-card {
  width: 100%;
  max-width: 450px;
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(230,235,242,.9);
  border-radius: 26px;
  padding: 34px;
  box-shadow: 0 24px 55px rgba(6, 27, 58, .18);
}

.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 { margin: 14px 0 6px; font-size: 1.85rem; letter-spacing: -.02em; }
.login-brand p { color: var(--muted); margin: 0; line-height: 1.55; }

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, #02c5d6, #0879b9);
  box-shadow: 0 14px 28px rgba(8, 167, 188, .26);
}

.brand-mark.large {
  width: 64px;
  height: 64px;
  border-radius: 21px;
  margin: 0 auto;
  font-size: 1.5rem;
}

label {
  display: block;
  font-weight: 800;
  font-size: .86rem;
  margin: 0 0 8px;
  color: #1d2b4f;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 13px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(8, 167, 188, .8);
  box-shadow: 0 0 0 4px rgba(8, 167, 188, .12);
}

.login-card input { margin-bottom: 14px; }

.btn {
  border: 0;
  border-radius: 13px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 850;
  cursor: pointer;
  transition: .16s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), #0578b8);
  color: white;
  box-shadow: 0 12px 22px rgba(8, 167, 188, .2);
}

.btn-primary:hover {
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 16px 26px rgba(8, 167, 188, .28);
}

.btn-secondary { background: #eef3f8; color: #14213f; }
.btn-secondary:hover, .btn-soft:hover { background: #e1e9f2; color: #14213f; }
.btn-soft { background: white; border: 1px solid var(--line); color: #475467; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #ffd8d8; color: #b42318; }
.btn-sm { padding: 7px 10px; border-radius: 10px; font-size: .84rem; }
.full-btn { width: 100%; margin-top: 8px; }

.hint, .muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.green { color: var(--green); }
.red { color: var(--red); }

/* App shell */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 270px;
  background: radial-gradient(circle at 10% 0%, rgba(8, 167, 188, .32), transparent 32%), linear-gradient(180deg, #06204a 0%, #06172f 100%);
  color: #eaf6ff;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  box-shadow: 18px 0 42px rgba(6, 27, 58, .16);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
  padding: 0 4px;
}

.brand-name {
  font-size: 1.32rem;
  font-weight: 950;
  letter-spacing: -.02em;
  line-height: 1.05;
}

.brand-sub {
  color: #3dd3e2;
  font-size: .77rem;
  letter-spacing: .28em;
  margin-top: 5px;
  font-weight: 900;
}

.side-nav { flex: 1; }

.nav-divider {
  height: 1px;
  background: rgba(255,255,255,.1);
  margin: 16px 6px;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border-radius: 12px;
  color: rgba(234,246,255,.86);
  margin-bottom: 9px;
  font-weight: 800;
  position: relative;
}

.side-nav a:hover {
  color: white;
  background: rgba(255,255,255,.08);
}

.side-nav a.active {
  background: linear-gradient(135deg, #0db8d2, #087eb6);
  color: white;
  box-shadow: 0 13px 28px rgba(7,126,182,.34);
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 950;
}

.side-nav a.active .nav-icon {
  background: rgba(255,255,255,.22);
}

.sidebar-footer {
  color: rgba(234,246,255,.62);
  font-size: .8rem;
  padding: 0 4px;
}

.sidebar-footer small {
  display: block;
  margin-top: 4px;
}

.main-area {
  margin-left: 270px;
  width: calc(100% - 270px);
  min-height: 100vh;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 32px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 9px 12px;
}

.global-search {
  width: min(520px, 45vw);
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  padding: 0 13px;
}

.global-search span {
  color: #98a2b3;
  font-weight: 900;
}

.global-search input {
  border: 0;
  box-shadow: none;
  padding: 12px 0;
  background: transparent;
}

.global-search input:focus {
  box-shadow: none;
}

.topbar-spacer { flex: 1; }

.top-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--red);
  font-weight: 950;
  position: relative;
}

.top-icon span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  font-size: .75rem;
}

.top-date {
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 800;
  color: #475467;
  white-space: nowrap;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #13264b, #08a7bc);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.user-meta {
  display: grid;
  line-height: 1.1;
}

.user-meta strong { font-size: .93rem; }
.user-meta span { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.logout-link { color: #475467; font-size: 1.1rem; }

.page-heading {
  padding: 26px 32px 0;
  max-width: 1900px;
  width: min(100%, 1900px);
  margin: 0 auto;
}

.page-heading h1 {
  margin: 0;
  font-size: 1.72rem;
  letter-spacing: -.03em;
}

.page-heading p {
  margin: 7px 0 0;
  color: var(--muted);
}

.content {
  padding: 24px 32px 34px;
  max-width: 1900px;
  width: min(100%, 1900px);
  margin: 0 auto;
}

.alert {
  padding: 13px 15px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: white;
  font-weight: 700;
}

.alert-success {
  background: var(--green-soft);
  border-color: #b9f0d0;
  color: #087443;
}

.alert-error {
  background: var(--red-soft);
  border-color: #ffd0d0;
  color: #b42318;
}

.alert-info {
  background: var(--blue-soft);
  border-color: #cfe0ff;
  color: #1d4ed8;
}


/* Logout and sidebar user card */
.topbar-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 10px 16px;
  margin-left: 12px;
  border-radius: 14px;
  color: #dc2626;
  background: #fff5f5;
  border: 1px solid #fecaca;
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}

.topbar-logout-btn:hover {
  color: #fff;
  background: #dc2626;
  border-color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(220, 38, 38, .18);
}

.sidebar-user-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.sidebar-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-user-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #ffffff;
  font-weight: 950;
  background: linear-gradient(135deg, #08b8d8, #12c7a7);
  box-shadow: 0 12px 22px rgba(8, 184, 216, .22);
}

.sidebar-user-meta {
  min-width: 0;
}

.sidebar-user-meta strong {
  display: block;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-meta span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, .62);
  font-size: 11px;
  text-transform: capitalize;
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 11px 12px;
  border-radius: 13px;
  color: #ffffff;
  background: rgba(220, 38, 38, .92);
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 13px;
  font-weight: 850;
  text-decoration: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.sidebar-logout-btn:hover {
  color: #ffffff;
  background: #ef4444;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(220, 38, 38, .22);
}

/* Cards, stats and dashboard */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.stats-grid.compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  color: inherit;
  min-height: 118px;
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  color: inherit;
}

.stat-card span {
  color: #475467;
  font-weight: 900;
  font-size: .84rem;
}

.stat-card strong {
  font-size: 1.34rem;
  letter-spacing: -.02em;
}

.stat-card small {
  color: var(--muted);
}

.stat-card .stat-top {
  display: flex;
  align-items: center;
  gap: 13px;
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 1.08rem;
}

.stat-card .trend {
  margin-top: 3px;
  font-weight: 900;
  font-size: .82rem;
}

.stat-card.accent .stat-icon,
.stat-card.accent-icon .stat-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.stat-card.success .stat-icon {
  background: var(--green-soft);
  color: var(--green);
}

.stat-card.danger .stat-icon {
  background: var(--red-soft);
  color: var(--red);
}

.stat-card.warning .stat-icon {
  background: var(--amber-soft);
  color: var(--amber);
}

.stat-card.purple .stat-icon {
  background: var(--purple-soft);
  color: var(--purple);
}

.stat-card.success strong { color: #0b6f49; }
.stat-card.danger strong { color: #b42318; }
.stat-card.warning strong { color: #b45309; }

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, .85fr) minmax(320px, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.dashboard-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 18px;
  margin-bottom: 18px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.card-header h2 {
  margin: 0;
  font-size: 1.04rem;
  letter-spacing: -.02em;
}

.card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.card-link {
  color: var(--cyan-dark);
  font-weight: 900;
  font-size: .88rem;
}

.chart-card { min-height: 328px; }

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 0 20px 8px;
  color: #475467;
  font-weight: 750;
  font-size: .86rem;
}

.legend-dot {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 99px;
  vertical-align: middle;
  margin-right: 7px;
  background: var(--cyan);
}

.legend-dot.blue { background: #174a9c; }

.line-chart {
  width: 100%;
  height: 240px;
  display: block;
  padding: 0 12px 12px;
}

.chart-axis { stroke: #eef2f7; stroke-width: 1; }
.chart-label { fill: #667085; font-size: 11px; font-weight: 700; }

.chart-line-lent {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-paid {
  fill: none;
  stroke: #174a9c;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-fill {
  fill: rgba(8, 167, 188, .08);
}

.donut-wrap {
  padding: 24px 20px;
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 178px;
  height: 178px;
  border-radius: 50%;
  background: conic-gradient(var(--cyan) 0 var(--active-deg), var(--blue) var(--active-deg) var(--paid-deg), var(--red) var(--paid-deg) var(--overdue-deg), #e3e8ef var(--overdue-deg) 360deg);
  display: grid;
  place-items: center;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.donut-center {
  position: relative;
  z-index: 2;
  text-align: center;
  display: grid;
  gap: 2px;
}

.donut-center strong { font-size: 1.55rem; }
.donut-center span { color: var(--muted); font-size: .78rem; font-weight: 800; }

.status-list {
  display: grid;
  gap: 13px;
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  font-weight: 800;
}

.status-line small {
  color: var(--muted);
  font-weight: 800;
}

.status-line .bullet {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  background: var(--cyan);
}

.status-line.paid .bullet { background: var(--blue); }
.status-line.overdue .bullet { background: var(--red); }
.status-line.closed .bullet { background: #98a2b3; }

.upcoming-list {
  padding: 5px 18px 16px;
  display: grid;
  gap: 2px;
}

.upcoming-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.upcoming-item:last-child { border-bottom: 0; }

.initial-bubble {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ad6a00;
  background: #fff1da;
  font-size: .76rem;
  font-weight: 950;
}

.upcoming-main strong {
  display: block;
  font-size: .9rem;
}

.upcoming-main small,
.upcoming-amount small {
  color: var(--muted);
  font-weight: 750;
}

.upcoming-amount { text-align: right; }

.days-pill {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fff1e8;
  color: #fb6514;
  font-weight: 950;
  font-size: .78rem;
  margin-top: 6px;
}

.quick-card .card-header { border-bottom: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fbfcfe;
  color: #667085;
  letter-spacing: .02em;
  font-size: .78rem;
  font-weight: 900;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdff; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 30px !important;
}

.money-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: .76rem;
  font-weight: 950;
  white-space: nowrap;
}

.badge-active,
.badge-pending {
  color: #1957b8;
  background: var(--blue-soft);
}

.badge-paid {
  color: #087443;
  background: var(--green-soft);
}

.badge-overdue {
  color: #d92d20;
  background: var(--red-soft);
}

.badge-admin {
  color: #6941c6;
  background: var(--purple-soft);
}

.badge-staff {
  color: #057f95;
  background: var(--cyan-soft);
}

/* Toolbars and forms */
.quick-actions,
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.toolbar.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  min-width: 280px;
  box-shadow: var(--shadow-soft);
}

.search-box input {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 12px 0;
}

.search-box input:focus { box-shadow: none; }

.summary-pill {
  background: white;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.tabs {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: white;
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 999px;
  color: #475467;
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.tab span {
  background: #eef3f8;
  color: #475467;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
}

.tab.active {
  background: linear-gradient(135deg, var(--cyan), #087eb6);
  border-color: transparent;
  color: white;
}

.tab.active span {
  background: rgba(255,255,255,.22);
  color: white;
}

.narrow-card { max-width: 820px; }
.form-card { max-width: 980px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  padding: 20px;
}

.form-grid .full { grid-column: 1 / -1; }

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.summary-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
}

.summary-strip span {
  color: var(--muted);
  font-weight: 900;
}

.summary-strip strong {
  font-size: 1.1rem;
  color: var(--cyan-dark);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  margin: 0 0 14px;
}

.breadcrumb a { color: var(--cyan-dark); }

.profile-card,
.loan-header-card {
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.profile-card h2,
.loan-header-card h2 {
  margin: 0 0 8px;
}

.profile-card p,
.loan-header-card p {
  margin: 6px 0;
}

.profile-actions,
.loan-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox input { width: auto; }

.progress-line { padding: 20px; }

.progress-line > div:first-child {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 900;
  margin-bottom: 10px;
}

.progress {
  height: 12px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), #0bc58a);
  border-radius: inherit;
}

.pay-card { border-left: 5px solid var(--cyan); }

.table-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.mini-table th,
.mini-table td {
  padding: 10px 12px;
}

/* Report widgets */
.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.report-note {
  padding: 18px 20px;
  color: var(--muted);
  line-height: 1.55;
}

.sidebar-overlay { display: none; }



/* Board card extra information */
.board-stats-grid .board-card {
  min-height: 188px;
}

.stat-details {
  display: grid;
  gap: 8px;
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.stat-details div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.stat-details span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
}

.stat-details b {
  color: #1d2b4f;
  font-size: .82rem;
  font-weight: 950;
  text-align: right;
}

.swal2-popup {
  border-radius: 22px !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.swal2-title {
  color: var(--text) !important;
  letter-spacing: -.03em !important;
}

.swal2-confirm,
.swal2-cancel {
  border-radius: 12px !important;
  font-weight: 850 !important;
}

@media (max-width: 1280px) {
  .stats-grid,
  .stats-grid.compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-main-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-main-grid .chart-card {
    grid-column: 1 / -1;
  }

  .dashboard-bottom-grid,
  .grid-two {
    grid-template-columns: 1fr;
  }

  .report-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-105%);
    transition: .2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(6,27,58,.46);
    z-index: 15;
  }

  .main-area {
    margin-left: 0;
    width: 100%;
  }

  .menu-btn { display: inline-flex; }

  .topbar {
    padding: 0 16px;
    height: 70px;
  }

  .global-search {
    width: 100%;
    max-width: none;
  }

  .top-date,
  .user-meta {
    display: none;
  }

  .topbar-logout-btn {
    min-height: 38px;
    padding: 8px 11px;
    margin-left: 4px;
    font-size: 12px;
  }

  .page-heading {
    padding: 22px 16px 0;
  }

  .content {
    padding: 18px 16px 28px;
  }

  .stats-grid,
  .stats-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-card,
  .loan-header-card {
    flex-direction: column;
  }

  .dashboard-main-grid,
  .dashboard-bottom-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

@media (max-width: 560px) {
  body { font-size: 14px; }

  .stats-grid,
  .stats-grid.compact {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box {
    min-width: 100%;
  }

  .btn {
    width: 100%;
  }

  .actions .btn,
  .inline-form .btn,
  .card-header .btn {
    width: auto;
  }

  .topbar {
    gap: 10px;
  }

  .top-icon {
    display: none;
  }

  .user-menu {
    border-left: 0;
    padding-left: 0;
  }

  .topbar-logout-btn {
    width: auto;
    min-width: 42px;
    padding: 8px 10px;
  }

  .topbar-logout-btn .logout-text {
    display: none;
  }

  .sidebar-user-card {
    margin-top: 12px;
  }

  .page-heading h1 {
    font-size: 1.4rem;
  }
}
/* Dashboard board cards should have enough room for all details */
.board-stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .board-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .board-stats-grid {
    grid-template-columns: 1fr;
  }
}
/* =========================================================
   Enterprise banking dashboard refinement
   Drop-in overrides for wider dashboard, large KPI cards,
   responsive grids, visible overflow, charts, and tables.
   ========================================================= */

:root {
  --shadow: 0 18px 42px rgba(16, 25, 54, .10);
  --shadow-soft: 0 10px 26px rgba(16, 25, 54, .065);
  --shadow-hover: 0 24px 56px rgba(16, 25, 54, .13);
}

/* Wider working area for large monitors */
.main-area {
  min-width: 0;
}

.page-heading,
.content {
  max-width: 1900px;
  width: min(100%, 1900px);
}

.content {
  overflow: visible;
}

/* Safer layout sizing across all dashboard containers */
.app-shell,
.main-area,
.page-heading,
.content,
.card,
.stat-card,
.table-card,
.chart-card,
.dashboard-main-grid,
.dashboard-bottom-grid,
.grid-two,
.report-grid,
.stats-grid,
.board-stats-grid {
  min-width: 0;
}

/* KPI grid: flexible fintech layout */
.stats-grid,
.stats-grid.compact,
.board-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 22px;
  align-items: stretch;
  margin-bottom: 24px;
}

/* KPI cards: taller, equal height, no clipped content */
.stat-card,
.board-stats-grid .board-card {
  min-height: 260px;
  height: 100%;
  padding: 26px;
  border-radius: 22px;
  overflow: visible;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.stat-card::before,
.board-stats-grid .board-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, rgba(8, 167, 188, .95), rgba(37, 99, 235, .75));
  pointer-events: none;
}

.stat-card:hover,
.board-stats-grid .board-card:hover,
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.stat-card .stat-top {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.stat-card .stat-top > div {
  min-width: 0;
  flex: 1 1 auto;
}

.stat-card .stat-icon {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 18px;
  font-size: 1.35rem;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55);
}

.stat-card span {
  display: block;
  margin-bottom: 12px;
  color: #475467;
  font-size: .88rem;
  font-weight: 950;
  letter-spacing: .01em;
  line-height: 1.3;
}

.stat-card strong {
  display: block;
  max-width: 100%;
  font-size: clamp(1.7rem, 1.15vw + 1.05rem, 2.75rem);
  line-height: 1.08;
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.stat-card small,
.stat-card .trend {
  display: block;
  max-width: 100%;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stat-card .trend {
  margin-top: 8px;
  font-size: .88rem;
}

.stat-details {
  gap: 10px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stat-details div {
  align-items: flex-start;
  gap: 14px;
}

.stat-details span,
.stat-details b {
  line-height: 1.35;
}

.stat-details b {
  max-width: 58%;
  overflow-wrap: anywhere;
}

/* Main dashboard section layout */
.dashboard-main-grid {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 24px;
}

.dashboard-bottom-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 24px;
}

.grid-two {
  gap: 22px;
}

/* General cards: visible overflow and modern spacing */
.card,
.table-card,
.chart-card,
.quick-card,
.pay-card {
  overflow: visible;
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card {
  margin-bottom: 22px;
}

.card-header {
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 22px 24px;
}

.card-header h2 {
  font-size: 1.12rem;
  line-height: 1.25;
}

.card-header p {
  line-height: 1.45;
}

.card-link {
  white-space: nowrap;
}

/* Charts: larger drawing area */
.chart-card {
  min-height: 420px;
}

.chart-card .card-header {
  padding-bottom: 18px;
}

.chart-legend {
  padding: 0 24px 12px;
}

.line-chart {
  width: 100%;
  height: 320px;
  min-height: 320px;
  padding: 0 16px 18px;
}

.donut-wrap {
  min-height: 320px;
  padding: 28px 24px;
  overflow: visible;
}

/* Status and upcoming cards should not clip content */
.status-list,
.upcoming-list,
.upcoming-item,
.upcoming-main,
.upcoming-amount {
  min-width: 0;
}

.status-line {
  align-items: flex-start;
}

.status-line strong,
.status-line small,
.upcoming-main strong,
.upcoming-main small,
.upcoming-amount strong,
.upcoming-amount small {
  overflow-wrap: anywhere;
}

.upcoming-list {
  padding: 8px 22px 20px;
  gap: 4px;
}

.upcoming-item {
  grid-template-columns: 46px minmax(0, 1fr) minmax(112px, auto);
  gap: 14px;
  padding: 14px 0;
}

.initial-bubble {
  width: 38px;
  height: 38px;
}

/* Tables: horizontal scrolling, no layout breaking */
.table-wrap,
.card .table-wrap,
.table-card .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.table-wrap table,
.table-card table,
.card table {
  min-width: 780px;
}

table {
  table-layout: auto;
}

th,
td {
  white-space: nowrap;
}

td {
  overflow-wrap: normal;
}

td .badge,
td .btn,
td .actions {
  white-space: nowrap;
}

.money-cell {
  white-space: nowrap;
}

/* Better touch and keyboard accessibility */
.btn,
.tab,
.side-nav a,
.card-link,
.top-icon,
.summary-pill {
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, color .16s ease, border-color .16s ease;
}

.btn:focus-visible,
.tab:focus-visible,
.side-nav a:focus-visible,
.card-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(8, 167, 188, .24);
  outline-offset: 3px;
}

/* Large desktop polish */
@media (min-width: 1440px) {
  .content {
    padding-left: 36px;
    padding-right: 36px;
  }

  .page-heading {
    padding-left: 36px;
    padding-right: 36px;
  }
}

/* Medium desktop and tablet */
@media (max-width: 1280px) {
  .stats-grid,
  .stats-grid.compact,
  .board-stats-grid {
    grid-template-columns: repeat(2, minmax(360px, 1fr));
    gap: 20px;
  }

  .dashboard-main-grid,
  .dashboard-bottom-grid,
  .grid-two,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-main-grid .chart-card {
    grid-column: auto;
  }
}

@media (max-width: 920px) {
  .stats-grid,
  .stats-grid.compact,
  .board-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .stat-card,
  .board-stats-grid .board-card {
    min-height: 260px;
    padding: 22px;
  }

  .stat-card strong {
    font-size: clamp(1.5rem, 3.6vw, 2.25rem);
  }

  .line-chart {
    height: 300px;
    min-height: 300px;
  }

  .chart-card {
    min-height: 400px;
  }

  .upcoming-item {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .upcoming-amount {
    grid-column: 2;
    text-align: left;
  }
}

/* Mobile */
@media (max-width: 560px) {
  .page-heading,
  .content {
    max-width: 100%;
    width: 100%;
  }

  .stats-grid,
  .stats-grid.compact,
  .board-stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .stat-card,
  .board-stats-grid .board-card {
    min-height: 260px;
    padding: 20px;
    border-radius: 20px;
  }

  .stat-card .stat-top {
    gap: 14px;
  }

  .stat-card .stat-icon {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
  }

  .stat-card strong {
    font-size: clamp(1.55rem, 8vw, 2.2rem);
  }

  .card,
  .table-card,
  .chart-card {
    border-radius: 20px;
  }

  .card-header {
    padding: 18px;
  }

  .chart-legend {
    padding-left: 18px;
    padding-right: 18px;
  }

  .line-chart {
    height: 280px;
    min-height: 280px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .chart-card {
    min-height: 380px;
  }

  .donut-wrap {
    padding: 22px 18px;
  }

  .donut {
    width: 160px;
    height: 160px;
  }

  .donut::after {
    width: 96px;
    height: 96px;
  }

  .table-wrap table,
  .table-card table,
  .card table {
    min-width: 720px;
  }

  th,
  td {
    padding: 12px 13px;
  }

  .stat-details div {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .stat-details b {
    max-width: 100%;
    text-align: left;
  }
}
