*
{
  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(170px, 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-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;
}

/* Aging bar */
.aging-section
{
  background: #fff;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.aging-section h3
{
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #1a3a52;
}
.aging-bars
{
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 10px;
}
.aging-seg
{
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  min-width: 2%;
  transition: width 0.4s;
}
.seg-0-30  { background: #27ae60; }
.seg-31-60 { background: #f39c12; }
.seg-61-90 { background: #e67e22; }
.seg-90p   { background: #c0392b; }
.aging-legend
{
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 12px;
  color: #555;
}
.aging-legend span
{
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.legend-dot
{
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.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; }

.priority-badge
{
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.priority-critical { background: #fdecea; color: #c0392b; border: 1px solid #e74c3c; }
.priority-high     { background: #fef5e7; color: #d35400; border: 1px solid #e67e22; }
.priority-medium   { background: #fef9e7; color: #b7950b; border: 1px solid #f1c40f; }
.priority-low      { background: #eafaf1; color: #1e8449; border: 1px solid #27ae60; }

.amt-outstanding { color: #c0392b; font-weight: 700; }
.amt-paid        { color: #27ae60; font-weight: 600; }
.days-overdue    { color: #c0392b; font-weight: 600; }
.days-ok         { color: #555; }

.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; }
.btn-call
{
  background: #27ae60;
  color: #fff;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 4px;
}
.btn-call:hover { background: #1e8449; }

/* 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: 960px;
  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: 70vh;
  overflow-y: auto;
}
.detail-grid
{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 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; }

.call-notes
{
  background: #fffbea;
  border: 1px solid #f1c40f;
  border-radius: 6px;
  padding: 14px 16px;
  margin-top: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #555;
}
.call-notes strong { color: #1a3a52; }

.contact-link
{
  color: #2980b9;
  text-decoration: none;
}
.contact-link:hover { text-decoration: underline; }

.payment-freq-bar
{
  display: inline-block;
  height: 8px;
  border-radius: 4px;
  background: #ddd;
  width: 60px;
  vertical-align: middle;
  margin-right: 6px;
  overflow: hidden;
}
.payment-freq-fill
{
  height: 100%;
  border-radius: 4px;
  background: #27ae60;
}
