:root {
  --navy: #0f2a4a;
  --navy-dark: #081a30;
  --navy-light: #1c3f68;
  --orange: #f5871f;
  --orange-dark: #d9720f;
  --bg: #f3f5f9;
  --border: #e6e9f0;
  --text-muted: #75808f;
  --green: #16a34a;
  --red: #dc2626;
  --bs-primary: var(--navy);
  --bs-primary-rgb: 15, 42, 74;
}

body {
  background: var(--bg);
  font-family: 'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  color: #212936;
  font-size: 14.5px;
}

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

.sidebar {
  width: 258px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand img { width: 40px; height: 40px; border-radius: 9px; background: #fff; object-fit: contain; }
.sidebar .brand-text { font-size: 15px; font-weight: 700; line-height: 1.25; }
.sidebar .brand-text small { display: block; font-weight: 400; font-size: 11px; color: rgba(255,255,255,0.55); }

.sidebar nav { padding: 12px 0; flex: 1; }
.sidebar .nav-section-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.7px;
  color: rgba(255,255,255,0.35); padding: 16px 20px 6px; font-weight: 600;
}
.sidebar a.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 10px 20px;
  color: rgba(255,255,255,0.82); text-decoration: none; font-size: 13.8px;
  border-left: 3px solid transparent; transition: background .15s, border-color .15s;
}
.sidebar a.nav-link i { font-size: 16px; width: 18px; text-align: center; }
.sidebar a.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar a.nav-link.active {
  background: rgba(245,135,31,0.16); border-left-color: var(--orange); color: #fff; font-weight: 600;
}
.sidebar .logout-area { border-top: 1px solid rgba(255,255,255,0.08); padding: 14px 0; }

.main-content { flex: 1; min-width: 0; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 14px 28px; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 19px; margin: 0; color: var(--navy); font-weight: 700; }
.topbar .avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}

.page-content { padding: 26px 28px; }

/* ============ KPI Cards ============ */
.kpi-card {
  background: #fff; border-radius: 14px; padding: 20px 22px; border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15,42,74,0.04); position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
}
.kpi-card.c-orange::before { background: var(--orange); }
.kpi-card.c-navy::before { background: var(--navy); }
.kpi-card.c-green::before { background: var(--green); }
.kpi-card.c-red::before { background: var(--red); }
.kpi-card .kpi-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; font-weight: 600; }
.kpi-card .kpi-value { font-size: 25px; font-weight: 800; color: var(--navy); }
.kpi-card .kpi-icon {
  position: absolute; right: 16px; top: 16px; width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 17px; opacity: .12;
}

/* ============ Panels ============ */
.panel {
  background: #fff; border-radius: 14px; border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15,42,74,0.04); margin-bottom: 24px;
}
.panel-head {
  padding: 16px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.panel-head h2 { font-size: 15.5px; margin: 0; color: var(--navy); font-weight: 700; }
.panel-body { padding: 20px 22px; }

/* ============ Buttons ============ */
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-light); border-color: var(--navy-light); color: #fff; }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { background: var(--orange-dark); border-color: var(--orange-dark); color: #fff; }
.btn-outline-navy { border-color: var(--navy); color: var(--navy); }
.btn-outline-navy:hover { background: var(--navy); color: #fff; }

/* ============ Badges ============ */
.badge-b1 { background: #e6f0fb; color: #1a5da8; }
.badge-b2 { background: #fdeee0; color: var(--orange-dark); }
.badge-shared { background: #e9f8ef; color: var(--green); }
.text-credit { color: var(--green); font-weight: 700; }
.text-debit { color: var(--red); font-weight: 700; }
.text-net-pos { color: var(--green); font-weight: 700; }
.text-net-neg { color: var(--red); font-weight: 700; }

/* ============ Month Navigator ============ */
.month-nav {
  display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 20px; flex-wrap: wrap;
}
.month-nav .month-label { font-size: 16px; font-weight: 700; color: var(--navy); min-width: 145px; text-align: center; }
.month-nav .nav-circle {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: #f7f9fc;
  color: var(--navy); display: flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 700;
}
.month-nav .nav-circle:hover { background: var(--navy); color: #fff; }
.month-nav .nav-circle.disabled { opacity: .3; pointer-events: none; }
.month-nav input[type="month"] { border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 13.5px; }

/* ============ Bank Tabs ============ */
.bank-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.bank-tabs a {
  padding: 11px 18px; border-radius: 11px; background: #fff; border: 1px solid var(--border);
  color: var(--navy); text-decoration: none; font-size: 13.8px; font-weight: 600;
  display: flex; align-items: center; gap: 9px; transition: all .15s;
}
.bank-tabs a .tab-bal { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.bank-tabs a.active { background: linear-gradient(135deg, var(--navy), var(--navy-light)); border-color: var(--navy); color: #fff; }
.bank-tabs a.active .tab-bal { color: rgba(255,255,255,0.85); }
.bank-tabs a:hover:not(.active) { border-color: var(--orange); }

/* ============ Voucher Form ============ */
.voucher-topcard {
  background: linear-gradient(135deg, var(--navy), var(--navy-light)); border-radius: 14px;
  padding: 22px 26px; color: #fff; margin-bottom: 20px;
}
.voucher-topcard .vch-pill {
  background: var(--orange); font-weight: 800; font-size: 19px; padding: 8px 18px;
  border-radius: 8px; display: inline-block; letter-spacing: .5px;
}
.voucher-topcard .vch-total { font-size: 27px; font-weight: 800; }
.voucher-topcard .vch-label { font-size: 11.5px; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: .5px; }
.voucher-topcard .mismatch-pill {
  background: rgba(220,38,38,0.18); border: 1px solid rgba(220,38,38,0.4); color: #ffd7d3;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.voucher-topcard .match-pill {
  background: rgba(22,163,74,0.18); border: 1px solid rgba(22,163,74,0.4); color: #c9f4d8;
  padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
}

.vrow {
  background: #fbfcfe; border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px 6px;
  margin-bottom: 12px; position: relative;
}
.vrow .vrow-tag {
  font-size: 11px; font-weight: 700; color: var(--orange-dark); text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 10px; display: block;
}
.vrow .remove-btn {
  position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; border-radius: 50%;
  border: 1px solid #f5c2bd; background: #fdeceb; color: var(--red); display: flex;
  align-items: center; justify-content: center; cursor: pointer;
}
.vrow .remove-btn:hover { background: var(--red); color: #fff; }
.add-row-dashed {
  border: 2px dashed var(--border); background: #fff; color: var(--navy); border-radius: 11px;
  padding: 13px; width: 100%; text-align: center; font-weight: 600; cursor: pointer; margin-bottom: 18px;
}
.add-row-dashed:hover { border-color: var(--orange); color: var(--orange-dark); }

/* ============ DataTables polish ============ */
table.dataTable { font-size: 13.3px; }
table.dataTable thead th {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%) !important;
  color: #fff !important;
  border-color: var(--navy) !important;
  font-weight: 700 !important;
}
table.dataTable thead th.sorting:before,
table.dataTable thead th.sorting:after,
table.dataTable thead th.sorting_asc:before,
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:before,
table.dataTable thead th.sorting_desc:after {
  color: rgba(255,255,255,0.6) !important;
}
table.dataTable tbody tr:nth-child(odd) { background: #f8fafc; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select { border-radius: 8px; border: 1px solid var(--border); }
.dt-buttons .btn {
  border-radius: 8px !important; font-size: 12.5px !important; padding: 6px 14px !important;
  margin-right: 6px; border: 1px solid var(--border) !important; color: var(--navy) !important; background: #fff !important;
}
.dt-buttons .btn:hover { background: var(--navy) !important; color: #fff !important; }

/* ============ Login ============ */
.login-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
}
.login-card { background: #fff; border-radius: 16px; padding: 42px 38px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); text-align: center; }
.login-card img { width: 68px; height: 68px; margin-bottom: 14px; border-radius: 12px; }

/* ============ Misc ============ */
.section-note { font-size: 12.5px; color: var(--text-muted); }
@media (max-width: 992px) { .sidebar { display: none; } }
