/* ============================================================
   ISP Billing System — Theme
   Palette: fiber teal, signal amber, slate ink
   ============================================================ */
:root {
  --brand:      #0B5D51;   /* deep fiber teal */
  --brand-dark: #093F38;
  --brand-ink:  #0E2B27;   /* sidebar */
  --amber:      #E8A020;   /* PKR / recovery highlight */
  --bg:         #F3F6F4;
  --card:       #FFFFFF;
  --line:       #E1E8E4;
  /* Dashboard accent colors — distinct hue per KPI type */
  --acc-blue:   #2563EB;
  --acc-blue-bg:#EAF1FE;
  --acc-green:  #15A362;
  --acc-green-bg:#E7F8EF;
  --acc-amber:  #E8A020;
  --acc-amber-bg:#FDF3E2;
  --acc-purple: #7C4DDB;
  --acc-purple-bg:#F1EBFC;
  --acc-teal:   #0B5D51;
  --acc-teal-bg:#E1F0EC;
}

body { background: var(--bg); font-family: "Segoe UI", system-ui, sans-serif; }

.urdu, .urdu-input {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif;
  direction: rtl; text-align: right; line-height: 2;
}
input.urdu-input { font-size: 15px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--brand-ink); color: #cfe0da;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.brand { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-name { font-weight: 700; color: #fff; font-size: 15px; }
.brand-branch {
  display: inline-block; margin-top: 6px; padding: 2px 10px; font-size: 11px;
  background: var(--amber); color: #3a2a00; border-radius: 999px; font-weight: 600;
}
.sidebar .nav { padding: 10px 8px; flex: 1; }
.sidebar .nav-link {
  color: #b9cdc7; border-radius: 8px; padding: 8px 10px; font-size: 13.5px;
  display: flex; align-items: center; gap: 9px;
}
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--brand); color: #fff; }
.nv-ic { width: 18px; text-align: center; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.role-pill { background: rgba(255,255,255,.12); padding: 1px 8px; border-radius: 999px; font-size: 10.5px; text-transform: uppercase; }
.logout-link { color: #f0b6ac; font-size: 12.5px; text-decoration: none; }

.main { flex: 1; min-width: 0; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: 12px 22px; display: flex; align-items: center; gap: 14px;
}
.page-title { font-size: 18px; font-weight: 700; margin: 0; color: var(--brand-dark); }
.topbar-date { margin-left: auto; color: #7a8a85; font-size: 13px; }
.content { padding: 22px; }

@media (max-width: 991px) {
  .sidebar { position: fixed; z-index: 1040; left: -250px; transition: left .2s; height: 100vh; }
  .sidebar.open { left: 0; }
}

/* ---------- Components ---------- */
.card { border: 1px solid var(--line); border-radius: 12px; }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; }
.btn-brand { background: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); color: #fff; }
.btn-outline-brand { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }
.table thead th { background: #EDF3F0; font-size: 12.5px; text-transform: uppercase; letter-spacing: .3px; color: #4a5c56; }
.table td { font-size: 13.5px; vertical-align: middle; }
.stat-card { border-left: 4px solid var(--brand); }
.stat-card.amber { border-left-color: var(--amber); }
.stat-num { font-size: 24px; font-weight: 700; color: var(--brand-dark); }
.stat-lbl { font-size: 12px; color: #7a8a85; text-transform: uppercase; letter-spacing: .4px; }
.badge-active { background: #DDF2E5; color: #14683C; }
.badge-inactive { background: #FBE3E0; color: #A33327; }
.cnic-thumb { width: 110px; height: 70px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; }

/* ---------- Dashboard (professional KPI layout) ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 991px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow .15s, transform .15s; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--kpi-accent, var(--brand));
}
.kpi-card:hover { box-shadow: 0 10px 24px rgba(14,43,39,.10); transform: translateY(-2px); }
.kpi-card.blue   { --kpi-accent: var(--acc-blue); }
.kpi-card.green  { --kpi-accent: var(--acc-green); }
.kpi-card.amber  { --kpi-accent: var(--acc-amber); }
.kpi-card.purple { --kpi-accent: var(--acc-purple); }
.kpi-card.teal   { --kpi-accent: var(--acc-teal); }

.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-top: 2px; }
.kpi-icon {
  width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--kpi-accent, var(--brand)); color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,.12);
}
.kpi-delta { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.kpi-delta.up { background: var(--acc-green-bg); color: #0d7a45; }
.kpi-delta.flat { background: #EDF1EF; color: #67766f; }
.kpi-value { font-size: 27px; font-weight: 800; color: var(--brand-dark); line-height: 1.1; letter-spacing: -.3px; }
.kpi-label { font-size: 12.5px; color: #7a8a85; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.kpi-sub { font-size: 11.5px; color: #9aa9a3; }

/* Trend chart card */
.trend-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.trend-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 4px; }
.trend-title { font-weight: 700; font-size: 14.5px; color: var(--brand-dark); }
.trend-total { font-size: 12.5px; color: #7a8a85; }
.trend-svg-wrap { padding: 4px 10px 8px; }
.trend-axis { font-size: 9.5px; fill: #9aa9a3; }

/* Mode split bars */
.mode-split-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mode-split-label { width: 62px; font-size: 12.5px; font-weight: 600; color: #4a5c56; }
.mode-split-track { flex: 1; height: 8px; background: #EDF3F0; border-radius: 999px; overflow: hidden; }
.mode-split-fill { height: 100%; border-radius: 999px; background: #8a8f8c; }
.mode-split-fill.online { background: var(--acc-amber); }
.mode-split-fill.bank { background: var(--acc-blue); }
.mode-split-amt { width: 78px; text-align: right; font-size: 12px; font-weight: 700; color: var(--brand-dark); }

/* Quick actions */
.qa-grid { display: flex; flex-direction: column; gap: 8px; }
.qa-btn {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--brand-dark); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background .15s, border-color .15s;
}
.qa-btn:hover { background: #EDF3F0; border-color: var(--brand); color: var(--brand-dark); }
.qa-btn .qa-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.qa-btn.b2 .qa-ic { background: var(--acc-amber); }
.qa-btn.b3 .qa-ic { background: var(--acc-blue); }

/* Recent payments (professional row) */
.pay-row-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--acc-purple); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.mode-pill { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.mode-pill.cash { background: #EDF1EF; color: #4a5c56; }
.mode-pill.online { background: var(--acc-amber-bg); color: #9c6a10; }
.mode-pill.bank { background: var(--acc-blue-bg); color: #1d4ed8; }

/* ---------- Login ---------- */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, var(--brand-ink), var(--brand) 130%);
}
.login-card { background: #fff; border-radius: 14px; padding: 32px; width: 100%; max-width: 400px; margin: 16px; }
.login-logo { font-size: 34px; }

/* ---------- Print: Thermal Receipt ---------- */
.thermal {
  width: 76mm; margin: 0 auto; background: #fff; padding: 4mm;
  font-family: "Courier New", monospace; font-size: 12px; color: #000;
}
.thermal .t-center { text-align: center; }
.thermal .t-line { border-top: 1px dashed #000; margin: 4px 0; }
.thermal table { width: 100%; }
.thermal .t-big { font-size: 14px; font-weight: bold; }

/* ---------- Print: A4 Invoice ---------- */
.a4 { width: 210mm; min-height: 285mm; margin: 0 auto; background: #fff; padding: 14mm; color: #111; }
.a4 .inv-head { display: flex; justify-content: space-between; border-bottom: 3px solid var(--brand); padding-bottom: 10px; }
.a4 .inv-title { font-size: 26px; font-weight: 800; color: var(--brand); }
.a4 table.inv { width: 100%; border-collapse: collapse; margin-top: 14px; }
.a4 table.inv th, .a4 table.inv td { border: 1px solid #999; padding: 7px 10px; font-size: 13px; }
.a4 table.inv th { background: #EDF3F0; }
.a4 .inv-total { background: var(--brand); color: #fff; font-weight: 700; }

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .thermal, .a4 { box-shadow: none; margin: 0; }
}
