/* TuniBill — Modern Dashboard (scoped to .tb-dash, content-only) */
.tb-dash {
  --tb-blue: #2b6cb0;
  --tb-blue-dark: #1e4e8c;
  --tb-sky: #22b8e6;
  --tb-teal: #0fc5bb;
  --tb-ink: #0c1d3a;
  --tb-text: #334155;
  --tb-muted: #718096;
  --tb-border: #e2e8f0;
  --tb-card: #ffffff;
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  color: var(--tb-text);
}

/* Hero */
.tb-dash-hero {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 26px 28px;
  margin-bottom: 20px;
  color: #fff;
  background: linear-gradient(120deg, #123a6d 0%, #2b6cb0 55%, #22b8e6 100%);
  box-shadow: 0 14px 34px rgba(18, 58, 109, 0.28);
}
.tb-dash-hero::before,
.tb-dash-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
}
.tb-dash-hero::before { width: 340px; height: 340px; right: -110px; top: -150px; }
.tb-dash-hero::after { width: 210px; height: 210px; right: 130px; bottom: -120px; background: rgba(255,255,255,0.07); }
.tb-dash-hero-inner { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.tb-dash-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: #d6ecff; background: rgba(255,255,255,0.14); border: 1px solid rgba(255,255,255,0.25); padding: 5px 12px; border-radius: 999px; margin-bottom: 10px; }
.tb-dash-hero h1 { margin: 0 0 6px; font-size: 24px; font-weight: 800; letter-spacing: -0.4px; color: #fff !important; }
.tb-dash-hero p { margin: 0; font-size: 13.5px; color: rgba(255,255,255,0.88); max-width: 560px; }
.tb-dash-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; text-decoration: none !important;
  padding: 10px 16px; border-radius: 12px; border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  white-space: nowrap;
}
.tb-btn-light { background: #fff; color: #123a6d !important; box-shadow: 0 6px 16px rgba(0,0,0,0.18); }
.tb-btn-light:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(0,0,0,0.22); }
.tb-btn-ghost { background: rgba(255,255,255,0.14); color: #fff !important; border-color: rgba(255,255,255,0.35); }
.tb-btn-ghost:hover { background: rgba(255,255,255,0.24); transform: translateY(-1px); }

/* KPI grid */
.tb-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.tb-kpi {
  background: var(--tb-card); border: 1px solid var(--tb-border); border-radius: 16px;
  padding: 18px; position: relative; overflow: hidden;
  box-shadow: 0 6px 20px rgba(12, 29, 58, 0.07);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tb-kpi:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(12,29,58,0.12); }
.tb-kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tb-accent, #2b6cb0); }
.tb-kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tb-kpi-ico { width: 46px; height: 46px; border-radius: 13px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; background: var(--tb-accent, #2b6cb0); box-shadow: 0 6px 14px rgba(12,29,58,0.2); }
.tb-kpi-ico svg { width: 18px; height: 18px; }
.tb-kpi-delta { font-size: 11.5px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; }
.tb-kpi-delta.up { background: #e6f7ed; color: #15803d; }
.tb-kpi-delta.down { background: #fdecec; color: #b91c1c; }
.tb-kpi-delta.info { background: #e8f5fd; color: #0369a1; }
.tb-kpi-value { font-size: 23px; font-weight: 800; letter-spacing: -0.5px; color: var(--tb-ink); font-variant-numeric: tabular-nums; }
.tb-kpi-value small { font-size: 13px; font-weight: 700; color: var(--tb-muted); }
.tb-kpi-label { font-size: 12.5px; font-weight: 600; color: var(--tb-muted); margin-top: 2px; }
.tb-kpi-sub { font-size: 12px; color: #94a3b8; margin-top: 8px; }
.tb-kpi-sub strong { color: var(--tb-text); }

/* Panels */
.tb-grid-2 { display: grid; grid-template-columns: 1.65fr 1fr; gap: 16px; margin-bottom: 20px; }
.tb-grid-3 { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.tb-panel { background: var(--tb-card); border: 1px solid var(--tb-border); border-radius: 16px; box-shadow: 0 6px 20px rgba(12,29,58,0.07); overflow: hidden; }
.tb-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 12px; border-bottom: 1px solid #eef2f7; }
.tb-panel-head h3 { margin: 0; font-size: 14.5px; font-weight: 800; color: var(--tb-ink) !important; letter-spacing: -0.2px; }
.tb-panel-head p { margin: 2px 0 0; font-size: 12px; color: var(--tb-muted); }
.tb-panel-head a.tb-link-more { font-size: 12.5px; font-weight: 700; color: var(--tb-blue); text-decoration: none; }
.tb-panel-head a.tb-link-more:hover { text-decoration: underline; }
.tb-panel-body { padding: 14px 18px 18px; }
.tb-panel-body.flush { padding: 0; }
.tb-chart-box { position: relative; height: 290px; }
.tb-chart-box.sm { height: 230px; }
.tb-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--tb-muted); padding: 0 18px 14px; }
.tb-legend span { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tb-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Tables */
.tb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tb-table th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; color: #64748b; padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--tb-border); white-space: nowrap; }
.tb-table td { padding: 11px 14px; border-bottom: 1px solid #eef2f7; color: var(--tb-text); vertical-align: middle; }
.tb-table tr:last-child td { border-bottom: 0; }
.tb-table tbody tr { transition: background 0.12s ease; }
.tb-table tbody tr:hover { background: #f6fafd; }
.tb-table a { color: var(--tb-blue); font-weight: 700; text-decoration: none; }
.tb-table a:hover { text-decoration: underline; }
.tb-client-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tb-avatar-sm { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #2b6cb0, #22b8e6); }
.tb-num { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--tb-ink); white-space: nowrap; }
.tb-muted-sm { font-size: 12px; color: var(--tb-muted); }
.tb-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; white-space: nowrap; }
.tb-badge.payé, .tb-badge.paye, .tb-badge.valide { background: #e6f7ed; color: #15803d; }
.tb-badge.partielle, .tb-badge.paye_partielle { background: #fef3c7; color: #b45309; }
.tb-badge.cours, .tb-badge.en { background: #e0f2fe; color: #0369a1; }
.tb-badge.envoye, .tb-badge.envoyé { background: #ede9fe; color: #6d28d9; }
.tb-badge.annuler, .tb-badge.annulé { background: #fdecec; color: #b91c1c; }

/* Top clients */
.tb-top-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef2f7; }
.tb-top-item:last-child { border-bottom: 0; }
.tb-top-rank { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 9px; background: #f1f5f9; color: #475569; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.tb-top-item:first-child .tb-top-rank { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.tb-top-info { flex: 1 1 auto; min-width: 0; }
.tb-top-info strong { display: block; font-size: 13px; color: var(--tb-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-top-info small { font-size: 11.5px; color: var(--tb-muted); }
.tb-top-bar { height: 6px; border-radius: 999px; background: #eef2f7; margin-top: 6px; overflow: hidden; }
.tb-top-bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2b6cb0, #22b8e6); }
.tb-top-amount { font-size: 13px; font-weight: 800; color: var(--tb-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Lists */
.tb-list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eef2f7; }
.tb-list-item:last-child { border-bottom: 0; }
.tb-list-ico { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; color: #fff; }
.tb-list-info { flex: 1 1 auto; min-width: 0; }
.tb-list-info strong { display: block; font-size: 13px; color: var(--tb-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-list-info small { font-size: 11.5px; color: var(--tb-muted); }
.tb-empty { text-align: center; padding: 26px 12px; color: #94a3b8; font-size: 13px; }
.tb-empty i { display: block; font-size: 22px; margin-bottom: 8px; color: #cbd5e1; }

/* Mini stat strip (inside panels: depenses / stock) */
.tb-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.tb-mini-stats > div { background: #f8fafc; border: 1px solid var(--tb-border); border-radius: 12px; padding: 10px 12px; }
.tb-mini-stats strong { display: block; font-size: 16px; font-weight: 800; color: var(--tb-ink); font-variant-numeric: tabular-nums; letter-spacing: -0.3px; }
.tb-mini-stats small { font-size: 11px; font-weight: 600; color: var(--tb-muted); }
.tb-mini-stats .tb-alert-low strong { color: #b45309; }
.tb-mini-stats .tb-alert-expiring strong { color: #c2410c; }
.tb-mini-stats .tb-alert-expired strong { color: #b91c1c; }

/* Quick nav */
.tb-quick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tb-quick a { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 8px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--tb-border); text-decoration: none !important; font-size: 12px; font-weight: 700; color: var(--tb-text); transition: all 0.15s ease; }
.tb-quick a i { font-size: 18px; color: var(--tb-blue); }
.tb-quick a:hover { background: #fff; border-color: #38bdf8; transform: translateY(-2px); box-shadow: 0 10px 22px rgba(12,29,58,0.10); }

@media (max-width: 1200px) {
  .tb-kpis { grid-template-columns: repeat(2, 1fr); }
  .tb-grid-2, .tb-grid-3 { grid-template-columns: 1fr; }
  .tb-quick { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .tb-dash-hero { padding: 20px; }
  .tb-dash-hero h1 { font-size: 19px; }
  .tb-kpis { grid-template-columns: 1fr; }
  .tb-quick { grid-template-columns: repeat(2, 1fr); }
  .tb-chart-box { height: 240px; }
}
