/* ────────────────────────────────────────────────────────────
   RHDC বিলিং সিস্টেম — Global CSS
   Bangla font: SolaimanLipi (primary) + Nikosh (fallback)
   Theme: Clean white / light only
   ──────────────────────────────────────────────────────────── */
/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  /* ── Data Table ─────────────────────────────────────────────── */
  .table-wrap {
    overflow-x: auto;
    border-radius: var(--r-xl, 1.25rem);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
  }
  table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--surface);
  }
  table.data-table thead {
    background: linear-gradient(to right, #f8fafc, #f0fdf4);
    position: sticky;
    top: 0;
    z-index: 1;
  }
  table.data-table thead th {
    padding: 0.9rem 1rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-800, #166534);
    border-bottom: 2px solid var(--brand-200, #bbf7d0);
    white-space: nowrap;
    font-family: 'SolaimanLipi', 'Nikosh', sans-serif;
  }
  table.data-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
  }
  table.data-table tbody tr:hover {
    background: linear-gradient(to right, #fafffe, #f0fdf4);
  }
  table.data-table tbody td {
    padding: 0.8rem 1rem;
    vertical-align: middle;
  }
  table.data-table tfoot td {
    padding: 0.9rem 1rem;
    font-weight: 700;
    background: var(--surface-alt);
    border-top: 2px solid var(--border);
  }

  /* ── Detail row ─────────────────────────────────────────────── */
  .detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-muted, #f1f5f9);
    font-size: 0.9rem;
  }
  .detail-row:last-child { border-bottom: none; }
  .detail-label  { color: var(--text-soft); font-size: 0.82rem; font-weight: 500; flex-shrink: 0; min-width: 130px; }
  .detail-value  { color: var(--text-body); font-weight: 600; text-align: right; }

  /* ── Summary strip ──────────────────────────────────────────── */
  .summary-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--r-xl, 1.25rem);
    overflow: hidden;
    margin-bottom: 1.5rem;
  }
  .summary-item { background: var(--surface); padding: 1rem 1.25rem; text-align: center; }
  .summary-item-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.3rem; }
  .summary-item-value { font-size: 1.35rem; font-weight: 800; color: var(--text-main); }

  /* ── Filter bar ─────────────────────────────────────────────── */
  .filter-bar { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-end; }
  .filter-group { display: flex; flex-direction: column; gap: 0.35rem; min-width: 150px; flex: 1; }
  .filter-group label { font-size: 0.78rem; font-weight: 600; color: var(--text-soft); }
  .filter-actions { display: flex; gap: 0.5rem; align-items: flex-end; padding-bottom: 0.05rem; }

  /* ── Empty state ────────────────────────────────────────────── */
  .empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--text-muted); }
  .empty-state svg { width: 3rem; height: 3rem; margin: 0 auto 1rem; opacity: 0.3; }
  .empty-state p { font-size: 0.9rem; font-weight: 500; }
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'SolaimanLipi', 'Nikosh', 'Hind Siliguri', sans-serif;
  font-weight: 700;
  color: var(--text-main);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  background: #ffffff;
  border-right: 1.5px solid #e9f5ee;
  box-shadow: 2px 0 20px rgba(16,185,129,0.06);
}

.nav-icon { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.58rem 0.85rem;
  border-radius: var(--radius-btn);
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.nav-item:hover { background: #f0fdf4; color: var(--brand); }

.nav-active {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0) !important;
  color: var(--brand-dark) !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(22,163,74,0.15);
}

.nav-item-mob {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-btn);
  color: #374151;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s;
}
.nav-item-mob:hover { background: #f0fdf4; color: var(--brand); }

.nav-section-label {
  padding: 0.35rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #94a3b8;
  margin-top: 0.5rem;
}

/* ══════════════════════════════════════════════════════════════
   RHDC বিলিং সিস্টেম — Design System v3.0
   Font: SolaimanLipi (Bangla primary) · Nikosh (fallback)
   ══════════════════════════════════════════════════════════════ */

@import url('https://fonts.maateen.me/solaiman-lipi/font.css');
@import url('https://fonts.maateen.me/nikosh/font.css');
@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@300;400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

:root {
  --brand:          #16a34a;
  --brand-50:       #f0fdf4;
  --brand-100:      #dcfce7;
  --brand-200:      #bbf7d0;
  --brand-300:      #86efac;
  --brand-500:      #22c55e;
  --brand-600:      #16a34a;
  --brand-700:      #15803d;
  --brand-800:      #166534;
  --brand-900:      #14532d;
  --surface:        #ffffff;
  --surface-alt:    #f8fafc;
  --surface-muted:  #f1f5f9;
  --surface-hover:  #f0fdf4;
  --border:         #e2e8f0;
  --border-muted:   #f1f5f9;
  --border-brand:   #bbf7d0;
  --text-main:      #0f172a;
  --text-body:      #1e293b;
  --text-soft:      #64748b;
  --text-muted:     #94a3b8;
  --danger:         #dc2626;
  --danger-bg:      #fef2f2;
  --warning:        #d97706;
  --warning-bg:     #fffbeb;
  --info:           #0ea5e9;
  --info-bg:        #f0f9ff;
  --success:        #16a34a;
  --success-bg:     #f0fdf4;
  --r-sm:   0.5rem; --r-md: 0.75rem; --r-lg: 1rem;
  --r-xl:   1.25rem; --r-2xl: 1.5rem; --r-full: 9999px;
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:  0 10px 15px rgba(0,0,0,0.07), 0 4px 6px rgba(0,0,0,0.05);
  --shadow-brand: 0 4px 14px rgba(22,163,74,0.25);
  --shadow-brand-lg: 0 8px 20px rgba(22,163,74,0.3);
  --t-fast: 0.12s ease; --t-base: 0.18s ease; --t-slow: 0.3s ease;
  /* legacy aliases */
  --brand-light:  #dcfce7; --brand-dark: #166534; --accent: #0ea5e9;
  --shadow: 0 2px 16px rgba(16,185,129,0.08), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg-old: 0 8px 32px rgba(16,185,129,0.12), 0 2px 8px rgba(0,0,0,0.08);
  --radius-card: 1.25rem; --radius-btn: 0.75rem; --radius-input: 0.6rem;
}
.kpi-card::before {
  /* ── KPI / Stat cards ───────────────────────────────────────── */
  .kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-xl, 1.25rem);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }
  .kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .kpi-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--kpi-color, linear-gradient(90deg, #16a34a, #0ea5e9));
  }
  .kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: var(--r-lg, 1rem);
    margin-bottom: 1rem;
  }
  .kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: -0.02em;
  }
  .kpi-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-soft);
    margin-bottom: 0.4rem;
  }
  .kpi-change { font-size: 0.78rem; font-weight: 500; margin-top: 0.4rem; }
  white-space: nowrap;
  user-select: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--brand-500, #22c55e); outline-offset: 2px; }
.btn[disabled], .btn:disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  border-color: #15803d;
  box-shadow: 0 4px 14px rgba(22,163,74,0.25);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  box-shadow: 0 6px 18px rgba(22,163,74,0.35);
  transform: translateY(-1px);
  color: #fff;
}
.btn-secondary {
  background: #fff;
  color: var(--text-body, #1e293b);
  border-color: var(--border, #e2e8f0);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.btn-secondary:hover {
  background: var(--surface-alt, #f8fafc);
  border-color: #cbd5e1;
  color: var(--text-body, #1e293b);
}
.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  border-color: #b91c1c;
  box-shadow: 0 2px 8px rgba(220,38,38,0.25);
}
.btn-danger:hover { transform: translateY(-1px); color: #fff; }
.btn-warning { background: linear-gradient(135deg, #d97706, #b45309); color: #fff; border-color: #b45309; }
.btn-warning:hover { transform: translateY(-1px); color: #fff; }
.btn-info { background: linear-gradient(135deg, #0ea5e9, #0284c7); color: #fff; border-color: #0284c7; }
.btn-info:hover { transform: translateY(-1px); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-soft); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-muted); color: var(--text-body); }
.btn-sm  { padding: 0.4rem 0.9rem; font-size: 0.82rem; }
.btn-xs  { padding: 0.25rem 0.65rem; font-size: 0.75rem; border-radius: var(--r-sm, 0.5rem); }
.btn-lg  { padding: 0.8rem 1.75rem; font-size: 1rem; }

/* ── Forms ──────────────────────────────────────────────────── */
/* ── Forms ──────────────────────────────────────────────────── */
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.45rem;
  font-family: 'SolaimanLipi', 'Nikosh', 'Hind Siliguri', sans-serif;
}
.form-hint  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.3rem; }
.form-error { font-size: 0.78rem; color: var(--danger);     margin-top: 0.3rem; }

.form-control {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1.5px solid #d1d5db;
  border-radius: var(--r-md, 0.75rem);
  font-size: 0.9rem;
  font-family: 'SolaimanLipi', 'Nikosh', 'Hind Siliguri', sans-serif;
  color: var(--text-body, #1e293b);
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
  outline: none;
  line-height: 1.5;
  appearance: none;
  -webkit-appearance: none;
}
.form-control:hover:not(:disabled) { border-color: #9ca3af; }
.form-control:focus {
  border-color: var(--brand, #16a34a);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.15);
  background: #fff;
}
.form-control::placeholder { color: #9ca3af; font-weight: 400; }
.form-control:disabled { background: var(--surface-muted, #f1f5f9); color: var(--text-muted); cursor: not-allowed; }

textarea.form-control { min-height: 110px; resize: vertical; }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='2' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19.5 8.25l-7.5 7.5-7.5-7.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: var(--surface);
}
table.data-table thead {
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}
table.data-table thead th {
  padding: 0.85rem 1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-dark);
  border-bottom: 2px solid #bbf7d0;
  white-space: nowrap;
}
table.data-table tbody tr {
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.1s;
}
table.data-table tbody tr:hover { background: #f8fffe; }
table.data-table tbody td {
  padding: 0.75rem 1rem;
  vertical-align: middle;
}
table.data-table tfoot td {
  padding: 0.85rem 1rem;
  font-weight: 700;
  background: #f8fafc;
  border-top: 2px solid #e2e8f0;
}

/* ── Status badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-paid     { background: #dcfce7; color: #166534; }
.badge-partial  { background: #fef3c7; color: #92400e; }
.badge-overdue  { background: #fee2e2; color: #991b1b; }
.badge-draft    { background: #f1f5f9; color: #475569; }
.badge-issued   { background: #e0f2fe; color: #0c4a6e; }
.badge-cancelled{ background: #f4f4f5; color: #52525b; }
.badge-posted   { background: #ede9fe; color: #4c1d95; }
.badge-active   { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f4f4f5; color: #52525b; }
.badge-cash     { background: #d1fae5; color: #065f46; }
.badge-bank     { background: #dbeafe; color: #1e40af; }
.badge-mobile   { background: #fce7f3; color: #9d174d; }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: #ffffff;
  border-bottom: 1.5px solid #e9f5ee;
  box-shadow: 0 1px 8px rgba(16,185,129,0.06);
}

/* ── Alert / message ────────────────────────────────────────── */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1.5px solid;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.alert-success { background: #f0fdf4; border-color: #86efac; color: #166534; }
.alert-error   { background: #fff1f2; border-color: #fca5a5; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.alert-info    { background: #f0f9ff; border-color: #7dd3fc; color: #0c4a6e; }

/* ── Section header ─────────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}
.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-soft);
  margin-top: 0.2rem;
}

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  height: 2.2rem;
  padding: 0 0.5rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: all 0.15s;
}
.page-link:hover { background: #f0fdf4; border-color: var(--brand); color: var(--brand); }
.page-link.active { background: var(--brand); border-color: var(--brand); color: white; font-weight: 700; }
.page-link.disabled { opacity: 0.45; pointer-events: none; }

/* ── Print ──────────────────────────────────────────────────── */
.no-print { }
.print-only { display: none; }
@media print {
  .no-print { display: none !important; }
  .print-only { display: block !important; }
  nav, aside, header, .sidebar, .topbar, .pagination { display: none !important; }
  body { background: #fff !important; color: #000 !important; font-size: 12pt; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .lg\:pl-72 { padding-left: 0 !important; }
}

@media (max-width: 640px) {
  .page-title { font-size: 1.25rem; }
  .kpi-value  { font-size: 1.5rem; }
  .btn        { padding: 0.5rem 0.9rem; font-size: 0.82rem; }
  table.data-table { font-size: 0.82rem; }
  table.data-table thead th, table.data-table tbody td { padding: 0.6rem 0.7rem; }
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-money  { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.font-bn     { font-family: 'SolaimanLipi', 'Nikosh', sans-serif !important; }
.divider     { border: none; border-top: 1px solid var(--border-muted, #f1f5f9); margin: 1rem 0; }
.form-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted, #94a3b8);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-muted, #f1f5f9);
  margin-bottom: 1.25rem;
}

/* ── Spinner ──────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid var(--brand-100, #dcfce7);
  border-top-color: var(--brand-600, #16a34a);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

/* ── Fade-in ──────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn 0.25s ease both; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Accessibility */
:focus-visible { outline: 2px solid var(--brand-500, #22c55e); outline-offset: 2px; }
