* {
  margin-top: 0px;
  box-sizing: border-box;
}
body {
  margin: 0;
  padding: 0;
  font-family: 'PT Sans', 'Segoe UI', Tahoma, sans-serif;
  background-color: #eef2f7;
}
.outborders {
  width: 96%;
  height: auto;
  margin: 30px 2%;
}
.tophead {
  box-shadow: 0 6px 9px rgba(0,0,0,0.18);
  background: linear-gradient(to right, #1a3a52, #16222A);
  padding: 18px 20px;
  margin-bottom: 16px;
  border-radius: 6px 6px 0 0;
}
#h1 {
  font-size: 22px;
  margin: 0 0 14px 0;
  letter-spacing: 0.5px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}
.filter-group label {
  display: block;
  color: #b8d4e8;
  font-size: 12px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.filter-group select,
.filter-group input {
  padding: 7px 10px;
  border: 1px solid #4a6a7a;
  border-radius: 4px;
  background: #fff;
  font-size: 13px;
  min-width: 130px;
}
#datesearch {
  padding: 8px 22px;
  background: #e8a317;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  color: #1a1a1a;
  font-size: 13px;
}
#datesearch:hover { background: #f5bc2a; }

/* KPI Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.kpi-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-left: 4px solid #3A6073;
}
.kpi-card.critical { border-left-color: #c0392b; }
.kpi-card.warning  { border-left-color: #e67e22; }
.kpi-card.success  { border-left-color: #27ae60; }
.kpi-card.info     { border-left-color: #2980b9; }
.kpi-card.purple   { border-left-color: #8e44ad; }
.kpi-label {
  font-size: 11px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: #1a3a52;
}
.kpi-sub {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}
.trend-up   { color: #27ae60; font-weight: 700; }
.trend-down { color: #c0392b; font-weight: 700; }
.trend-flat { color: #999; font-weight: 700; }

/* Panels */
.panel {
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.panel h3 {
  margin: 0 0 14px 0;
  font-size: 14px;
  color: #1a3a52;
}
.panel h3 .sub {
  font-weight: 400;
  color: #888;
  font-size: 12px;
  margin-left: 8px;
}

/* Two column layout */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}

/* Monthly trend bar chart */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  padding: 10px 4px 0 4px;
  overflow-x: auto;
  border-bottom: 2px solid #d6e0e8;
}
.trend-col {
  flex: 1 0 42px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 42px;
}
.trend-bar {
  width: 70%;
  background: linear-gradient(to top, #2980b9, #5dade2);
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height 0.4s;
  position: relative;
}
.trend-bar:hover { background: linear-gradient(to top, #1a6fa0, #3498db); }
.trend-barval {
  font-size: 10px;
  color: #2c4a5e;
  margin-bottom: 3px;
  font-weight: 600;
  white-space: nowrap;
}
.trend-lbl {
  font-size: 10px;
  color: #777;
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}
.trend-cnt {
  font-size: 9px;
  color: #999;
  text-align: center;
}

/* Paymode split */
.split-bars {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.split-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  min-width: 2%;
  transition: width 0.4s;
}
.seg-paid  { background: #27ae60; }
.seg-topay { background: #e67e22; }
.split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: #555;
}
.split-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 2px;
  display: inline-block;
}

/* Mini ranking lists */
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed #e3e9ee;
  font-size: 13px;
}
.rank-list li:last-child { border-bottom: none; }
.rank-num {
  width: 22px; height: 22px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #2c4a5e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rank-name { flex: 1; font-weight: 600; color: #1a3a52; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-val { color: #2980b9; font-weight: 700; white-space: nowrap; }
.rank-bar-wrap { flex: 1.4; background: #eef2f5; height: 8px; border-radius: 4px; overflow: hidden; }
.rank-bar-fill { height: 100%; background: linear-gradient(to right, #2980b9, #5dade2); border-radius: 4px; }

/* Tabs */
.tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 2px solid #2c4a5e;
}
.tab-btn {
  padding: 9px 18px;
  background: #dde6ec;
  border: none;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: #4a6a7a;
}
.tab-btn.active { background: #2c4a5e; color: #fff; }
.tab-btn:hover:not(.active) { background: #c8d6df; }

.tableb {
  border: 1px solid #ccc;
  background: #fff;
  border-radius: 0 0 6px 6px;
  overflow-x: auto;
}
#abc {
  background-color: #f8fafb;
  width: 100% !important;
}
#abc thead td, #abc thead th {
  background: #2c4a5e;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 10px 8px;
  border-right: 1px solid #3d6078;
  white-space: nowrap;
}
#abc tbody td {
  padding: 8px;
  font-size: 13px;
  border-right: 1px dotted #ccc;
  vertical-align: middle;
}
#abc tbody tr:nth-child(even) { background: #f4f8fa; }
#abc tbody tr:hover { background: #e8f4fc; }

.amt-freight { color: #1e8449; font-weight: 700; }
.val-weight  { color: #2980b9; font-weight: 600; }
.muted { color: #888; }

.share-bar {
  display: inline-block;
  height: 8px;
  border-radius: 4px;
  background: #eef2f5;
  width: 70px;
  vertical-align: middle;
  margin-right: 6px;
  overflow: hidden;
}
.share-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(to right, #27ae60, #58d68d);
}

.btn-detail {
  background: #2980b9;
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.btn-detail:hover { background: #1a6fa0; }

.contact-link { color: #2980b9; text-decoration: none; }
.contact-link:hover { text-decoration: underline; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.55);
  z-index: 9999;
  overflow-y: auto;
  padding: 30px 20px;
}
.modal-box {
  background: #fff;
  max-width: 1000px;
  margin: 0 auto;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  overflow: hidden;
}
.modal-header {
  background: linear-gradient(to right, #1a3a52, #16222A);
  color: #fff;
  padding: 16px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-header h2 { margin: 0; font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}
.modal-body {
  padding: 20px 22px;
  max-height: 72vh;
  overflow-y: auto;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.detail-item {
  background: #f4f8fa;
  border-radius: 6px;
  padding: 12px 14px;
}
.detail-item .dl { font-size: 11px; color: #888; text-transform: uppercase; }
.detail-item .dv { font-size: 15px; font-weight: 600; color: #1a3a52; margin-top: 4px; }
.detail-section h4 {
  margin: 18px 0 10px 0;
  font-size: 14px;
  color: #1a3a52;
  border-bottom: 2px solid #3A6073;
  padding-bottom: 6px;
}
.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.detail-table th {
  background: #2c4a5e;
  color: #fff;
  padding: 8px;
  text-align: left;
}
.detail-table td {
  padding: 7px 8px;
  border-bottom: 1px solid #eee;
}
.detail-table tr:nth-child(even) { background: #f8fafb; }

.insight-box {
  background: #fffbea;
  border: 1px solid #f1c40f;
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #555;
}
.insight-box strong { color: #1a3a52; }

/* ---- Bank analyser additions ---- */
.amt-credit { color: #1e8449; font-weight: 700; }
.amt-debit  { color: #c0392b; font-weight: 700; }
.net-pos    { color: #1e8449; font-weight: 700; }
.net-neg    { color: #c0392b; font-weight: 700; }

/* grouped credit/debit trend */
.trend-pair {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 160px;
}
.trend-pair .trend-bar { width: 14px; }
.trend-bar.cr { background: linear-gradient(to top, #27ae60, #58d68d); }
.trend-bar.cr:hover { background: linear-gradient(to top, #1e8449, #27ae60); }
.trend-bar.dr { background: linear-gradient(to top, #c0392b, #ec7063); }
.trend-bar.dr:hover { background: linear-gradient(to top, #922b21, #c0392b); }
.trend-bar.net-up   { background: linear-gradient(to top, #27ae60, #58d68d); }
.trend-bar.net-down { background: linear-gradient(to top, #c0392b, #ec7063); }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.chip-cr { background: #27ae60; }
.chip-dr { background: #c0392b; }
