/* ATW Collectrix dashboard styles. Loaded BEFORE tailwind.css, so Tailwind utilities on an element win over these.
   One design system: dark ink sidebar, white top bar, cool-grey canvas, blue primary (matches the blue-600 used in the screens). */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff4ff;
  --ink: #0f172a;
  --text: #1e293b;
  --muted: #5b6b80;
  --canvas: #f3f5f9;
  --surface: #ffffff;
  --line: #e4e8ef;
  --line-strong: #d3d9e3;
  --side-bg: #0d1424;
  --side-bg-2: #111a2e;
  --side-line: #1e2a42;
  --side-text: #b6c0d3;
  --side-muted: #8592ab;
  --sidebar-w: 260px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --radius: 14px;
}

/* ===== Shell: fills the whole viewport ===== */
html, body { height: 100%; }
body.app-canvas {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  font-family: "Plus Jakarta Sans", Inter, system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
}
.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
}
.app-column {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}
.app-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 24px clamp(16px, 2.2vw, 40px) 40px;
  flex: 1;
}

/* ===== Sidebar ===== */
.app-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: linear-gradient(180deg, var(--side-bg-2) 0%, var(--side-bg) 100%);
  border-right: 1px solid var(--side-line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 14px;
  z-index: 40;
  transition: width 0.2s ease;
}
.app-sidebar::-webkit-scrollbar { width: 4px; }
.app-sidebar::-webkit-scrollbar-thumb { background: #2a3752; border-radius: 4px; }

.sb-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px 14px;
}
.sb-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.55);
}
.sb-logo img { display: block; width: 100%; height: 100%; border-radius: 10px; }
.sb-brand-text { flex: 1; min-width: 0; line-height: 1.15; }
.sb-brand-name { color: #fff; font-size: 17px; font-weight: 800; letter-spacing: -0.02em; }
.sb-brand-name .sb-brand-atw {
  margin-left: 7px;
  vertical-align: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(215, 150, 36, 0.18);
  color: #fbbf24;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}
.sb-brand-tag { color: var(--side-muted); font-size: 10.5px; font-weight: 500; margin-top: 2px; white-space: nowrap; }
.sb-collapse-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 1px solid var(--side-line);
  background: transparent;
  color: var(--side-muted);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sb-collapse-btn:hover { color: #fff; background: #1a2540; }

.sb-company { margin-bottom: 8px; }
.sb-company-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--side-line);
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.sb-company-btn:hover { background: rgba(255, 255, 255, 0.07); border-color: #2c3a58; }
.sb-company-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #1b2a4a;
  color: #8fb8ff;
  font-size: 12px;
}
.sb-company-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.sb-company-name { font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-company-meta { font-size: 10.5px; color: var(--side-muted); margin-top: 1px; }
.sb-company-caret { font-size: 10px; color: var(--side-muted); }
.company-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: max(100%, 280px);
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 44px -18px rgba(15, 23, 42, 0.45);
  z-index: 60;
  padding: 6px;
}

.sb-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.nav-section {
  margin: 16px 10px 6px;
  color: var(--side-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.nav-section.is-active { color: #c9d3e6; }
/* hide a heading when the user's role hides every link under it */
.nav-section:not(:has(+ .nav-group > .nav-link:not(.hidden))) { display: none; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--side-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-link i { width: 18px; text-align: center; font-size: 13.5px; color: #7d8ba6; flex-shrink: 0; transition: color 0.15s ease; }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav-link:hover i { color: #c9d3e6; }
.nav-link.is-active {
  background: rgba(59, 130, 246, 0.16);
  color: #fff;
  font-weight: 600;
}
.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #3b82f6;
}
.nav-link.is-active i { color: #7fb0ff; }
.nav-badge {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-badge.is-danger { background: #e11d48; }
#msme-risk-badge:not(.hidden) { display: inline-flex; }

.sb-agent {
  margin-top: 14px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid var(--side-line);
  background: rgba(255, 255, 255, 0.03);
}
.sb-agent-row { display: flex; align-items: flex-start; gap: 9px; }
.sb-agent-row > i { margin-top: 2px; font-size: 13px; }
.sb-agent-text { display: flex; flex-direction: column; min-width: 0; }
.sb-agent-title { color: #e7ecf5; font-size: 12px; font-weight: 600; }
.sb-agent-detail { color: var(--side-muted); font-size: 11px; margin-top: 1px; }
.sb-agent-link {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 600;
  color: #8fb8ff;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.sb-agent-link:hover { color: #c3d9ff; text-decoration: underline; }

/* Collapsed (icon rail) — desktop only */
@media (min-width: 1024px) {
  body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); padding-left: 10px; padding-right: 10px; }
  body.sidebar-collapsed .sb-brand { flex-direction: column; gap: 10px; padding-left: 0; padding-right: 0; }
  body.sidebar-collapsed .sb-collapse-btn i { transform: rotate(180deg); }
  body.sidebar-collapsed .sb-brand-text,
  body.sidebar-collapsed .sb-company-text,
  body.sidebar-collapsed .sb-company-caret,
  body.sidebar-collapsed .nav-text,
  body.sidebar-collapsed .sb-agent-text,
  body.sidebar-collapsed .sb-agent-link span { display: none; }
  body.sidebar-collapsed .sb-company-btn { justify-content: center; padding: 8px 0; }
  body.sidebar-collapsed .company-menu { position: fixed; left: calc(var(--sidebar-w-collapsed) + 8px); top: 64px; width: 300px; }
  body.sidebar-collapsed .nav-section { font-size: 0; margin: 12px 14px 8px; height: 1px; background: var(--side-line); }
  body.sidebar-collapsed .nav-link { justify-content: center; padding: 10px 0; }
  body.sidebar-collapsed .nav-link.is-active::before { left: -10px; }
  body.sidebar-collapsed .nav-badge {
    position: absolute;
    top: 3px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 9px;
  }
  body.sidebar-collapsed .sb-agent { padding: 10px 0; display: flex; flex-direction: column; align-items: center; }
  body.sidebar-collapsed .sb-agent-link { margin-top: 6px; }
}

/* ===== Top bar ===== */
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--topbar-h);
  padding: 10px clamp(16px, 2.2vw, 40px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
.topbar-divider { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.search-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 1;
  min-width: 200px;
  max-width: 520px;
  height: 38px;
  padding: 0 10px 0 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f6f8fb;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.search-btn:hover { border-color: var(--line-strong); background: #fff; }
.search-btn kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
}
.topbar-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.topbar-pill:hover { border-color: var(--line-strong); }
.mode-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 38px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f3f5f9;
}
.mode-switch .mode-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px 0 7px;
}
.mode-btn {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #4b5b70;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.mode-btn:hover { color: var(--ink); }
.mode-btn.is-off { background: #be123c; color: #fff; }
.mode-btn.is-exec { background: #fff; color: #1d4ed8; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 0 0 1px #dbe4f5; }
.mode-btn.is-live { background: #047857; color: #fff; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: #f3f5f9; color: var(--ink); }
.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, 0.55);
  transition: background 0.15s ease;
}
.primary-btn:hover { background: var(--primary-hover); }
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 10px 0 4px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
}
.user-chip:hover { background: #f3f5f9; border-color: var(--line); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
#current-user-role { text-transform: uppercase; letter-spacing: 0.04em; font-size: 9.5px; font-weight: 600; }

/* ===== Mobile / tablet: off-canvas sidebar ===== */
.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 39;
}
.sidebar-scrim.is-open { display: block; }
.menu-toggle { display: none; }
@media (max-width: 1023.98px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: 16px 0 40px -24px rgba(0, 0, 0, 0.5);
  }
  .app-sidebar.is-open { transform: none; }
  .sb-collapse-btn { display: none; }
  .menu-toggle { display: inline-flex; }
  .mode-switch .mode-label, .topbar-divider { display: none; }
}
@media (max-width: 767.98px) {
  .search-btn { min-width: 0; }
  .search-btn kbd, .search-placeholder { display: none; }
  .search-btn { flex: 0 0 38px; width: 38px; padding: 0; justify-content: center; }
  .topbar-actions { gap: 6px; }
  .app-content { padding: 16px 14px 32px; }
}

/* ===== Content: cards, headings, tables ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
}
.app-content .bg-white.rounded-2xl,
.app-content .bg-white.rounded-xl {
  border-color: var(--line) !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.02);
}
.app-content .rounded-2xl { border-radius: var(--radius); }
.app-content h1 { letter-spacing: -0.02em; }
.app-content .font-black { font-weight: 800; letter-spacing: -0.02em; }
.app-content .font-extrabold { letter-spacing: -0.015em; }
.app-content table thead th {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #55657a;
  background: #f8fafc;
}
.app-content table tbody tr:hover { background: #f8fafc; }
tbody tr { transition: background-color 0.15s ease; }

.statement-scroll::-webkit-scrollbar { width: 5px; height: 5px; }
.statement-scroll::-webkit-scrollbar-track { background: transparent; }
.statement-scroll::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9999px; }
.statement-scroll::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.app-column::-webkit-scrollbar { width: 10px; }
.app-column::-webkit-scrollbar-thumb { background: #cfd6e2; border-radius: 10px; border: 3px solid var(--canvas); }

/* Glassmorphism helpers used by a few panels */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
}
.glass-dark {
  background: linear-gradient(180deg, rgba(15,23,42,0.7), rgba(15,23,42,0.5));
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.06);
}

/* Inputs */
input, select, textarea { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

/* Animations */
@keyframes pulse-subtle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(0.98); }
}
.animate-pulse-subtle { animation: pulse-subtle 2s infinite ease-in-out; }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }   /* none, so a finished fade leaves no containing block for fixed children */
}
.animate-fade-in-up { animation: fadeInUp 0.3s ease-out both; }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-slide-down { animation: slideDown 0.3s ease-out both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* opacity only: a transform here would trap fixed-position children (focus mode) inside the page */
.app-content > [id^="tab-"]:not(.hidden) { animation: fadeIn 0.2s ease-out both; }

.card-hover { transition: box-shadow 0.2s ease, border-color 0.2s ease; }
.card-hover:hover { box-shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.18); }
.badge-pulse { animation: none; }
button:active:not(:disabled) { transform: scale(0.98); }

.gradient-text {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-left: clamp(16px, 2.2vw, 40px) !important;
  padding-right: clamp(16px, 2.2vw, 40px) !important;
}

html { scroll-behavior: smooth; }

/* ===== Accessibility ===== */
.skip-link { position: absolute; left: 8px; top: -64px; z-index: 300; background: #0f172a; color: #fff;
             padding: 10px 16px; border-radius: 8px; font-weight: 700; font-size: 13px; text-decoration: none; }
.skip-link:focus { top: 8px; outline: 3px solid #93c5fd; outline-offset: 2px; }
main:focus { outline: none; }
/* A visible keyboard focus indicator everywhere (controls that style their own ring keep it) */
:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }
.app-sidebar :focus-visible { outline-color: #93c5fd; }
#auth-gate :focus-visible { outline-color: #2563eb; }
[inert] { pointer-events: none; }

/* ---- Text colours that were below WCAG AA (4.5:1) on light surfaces ---- */
body main .text-slate-400:not(.on-dark *), body [role="dialog"] .text-slate-400:not(.on-dark *),
body [role="alertdialog"] .text-slate-400, body #auth-gate .text-slate-400, body .search-btn .text-slate-400,
body .app-footer .text-slate-400, body .company-menu .text-slate-400 { color: #5b6b80; }
body main .text-slate-500:not(.on-dark *), body [role="dialog"] .text-slate-500 { color: #4b5b70; }
body main .text-slate-300:not(.on-dark *), body .app-footer .text-slate-300 { color: #5b6b80; }
body main .text-rose-600:not(.on-dark *) { color: #be123c; }
body main .text-emerald-600 { color: #047857; }
body main .text-emerald-500 { color: #047857; }
body main .text-amber-600, body main .text-amber-500 { color: #b45309; }
body main .text-orange-500, body main .text-orange-600 { color: #c2410c; }
body main .text-rose-500, body [role="dialog"] .text-rose-500 { color: #be123c; }
body main .text-blue-600 { color: #1d4ed8; }
body main .text-blue-500 { color: #1d4ed8; }
body main .text-indigo-500 { color: #4338ca; }
body main .text-cyan-600, body main .text-sky-600 { color: #0e7490; }
body main .text-purple-500, body main .text-purple-600 { color: #7e22ce; }
body main .text-brand-500, body main .text-brand-600 { color: #24524c; }
body .bg-amber-600 { background-color: #b45309; }       /* white text on these needs >= 4.5:1 */
body .bg-emerald-600 { background-color: #047857; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .animate-pulse, .animate-ping, .animate-spin { animation: none !important; }
}

/* ---- Settings sub-tabs ---- */
.settings-tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 4px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.settings-tab {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 9px 14px; border-radius: 10px; border: 0; background: transparent;
  font-size: 12px; font-weight: 700; color: #4b5b70; cursor: pointer; transition: background .15s, color .15s;
}
.settings-tab:hover { background: #f1f5f9; color: #0f172a; }
.settings-tab.is-active { background: #1d4ed8; color: #fff; }
.settings-tab:focus-visible { outline: 2px solid #1d4ed8; outline-offset: 2px; }

/* ===== Cockpit report page (Power BI-style) ===== */
.pbi-page { display: flex; flex-direction: column; gap: 14px; }
.pbi-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: #fff; border: 1px solid var(--line); border-radius: 8px;
  border-top: 3px solid #118dff;
}
.pbi-title { font-size: 20px; font-weight: 700; color: #252423; letter-spacing: -0.02em; line-height: 1.2; }
.pbi-subtitle { font-size: 12px; color: #605e5c; margin-top: 2px; }
.pbi-dot { margin: 0 4px; color: #b3b0ad; }
.pbi-slicers { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pbi-slicer { display: flex; align-items: center; gap: 8px; }
.pbi-slicer-label { font-size: 10.5px; font-weight: 700; color: #605e5c; text-transform: uppercase; letter-spacing: 0.06em; }
.pbi-seg { display: inline-flex; border: 1px solid #c8c6c4; border-radius: 4px; overflow: hidden; }
.pbi-seg button {
  min-width: 40px; height: 30px; padding: 0 10px; border: 0; background: #fff; color: #323130;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.pbi-seg button + button { border-left: 1px solid #c8c6c4; }
.pbi-seg button:hover { background: #f3f2f1; }
.pbi-seg button.is-on { background: #0f6cbd; color: #fff; }
.pbi-refresh {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 4px;
  border: 1px solid #c8c6c4; background: #fff; color: #323130; font-size: 12px; font-weight: 600; cursor: pointer;
}
.pbi-refresh:hover { background: #f3f2f1; }

/* KPI cards */
.pbi-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1400px) { .pbi-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 700px) { .pbi-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .pbi-kpi { padding: 12px 12px 10px; } .pbi-kpi-value { font-size: 20px; } .pbi-kpi-label { font-size: 11px; } }
.pbi-kpi {
  position: relative; display: flex; flex-direction: column; min-width: 0; padding: 14px 16px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.pbi-kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kpi, #118dff); }
.pbi-kpi-label { font-size: 12px; font-weight: 600; color: #605e5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbi-kpi-value {
  font-size: 26px; font-weight: 700; color: #252423; letter-spacing: -0.02em; line-height: 1.15; margin-top: 6px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.pbi-kpi-value.is-bad { color: #c4314b; }
.pbi-kpi-sub { font-size: 11.5px; color: #605e5c; margin-top: 3px; min-height: 16px; }
.pbi-kpi-sub strong { color: #323130; }
.pbi-kpi-foot { font-size: 11px; color: #605e5c; margin-top: 6px; }
.pbi-kpi-bar { height: 5px; border-radius: 3px; background: #edebe9; margin-top: 10px; overflow: hidden; }
.pbi-kpi-bar span { display: block; height: 100%; width: 0; background: var(--kpi, #118dff); border-radius: 3px; transition: width .4s ease; }
.pbi-spark { height: 34px; margin-top: auto; padding-top: 6px; color: var(--kpi, #118dff); }
.pbi-delta { font-weight: 700; }
.pbi-delta.is-up { color: #107c10; }
.pbi-delta.is-down { color: #c4314b; }

/* Layout grid of visuals */
.pbi-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: start; }
.pbi-span-4 { grid-column: span 4; }
.pbi-span-8 { grid-column: span 8; }
@media (max-width: 1180px) {
  .pbi-grid > .pbi-span-4:not(.pbi-stack) { grid-column: span 6; }
  .pbi-grid > .pbi-span-8, .pbi-grid > .pbi-stack,
  .pbi-grid > .pbi-span-8 + .pbi-span-4,
  .pbi-grid > .pbi-span-4:nth-child(3):last-child { grid-column: span 12; }
}
@media (max-width: 760px) { .pbi-grid > * { grid-column: span 12 !important; } }
.pbi-stack { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 1180px) and (min-width: 761px) {
  .pbi-stack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
}

/* Visual container */
.pbi-visual { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 14px; min-width: 0; }
.pbi-visual.pbi-flush { padding: 0; overflow: hidden; }
.pbi-visual.pbi-flush .pbi-visual-head { padding: 12px 14px 10px; margin: 0; }
.pbi-visual-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pbi-visual-title { font-size: 13.5px; font-weight: 700; color: #252423; letter-spacing: -0.01em; }
.pbi-visual-sub { font-size: 11px; color: #605e5c; margin-top: 1px; }
.pbi-visual-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.pbi-tool {
  width: 26px; height: 26px; border-radius: 4px; border: 0; background: transparent; color: #605e5c;
  font-size: 11.5px; cursor: pointer; opacity: 0; transition: opacity .15s ease, background .15s ease;
}
.pbi-visual:hover .pbi-tool, .pbi-tool:focus-visible, .pbi-visual.is-focus .pbi-tool { opacity: 1; }
@media (hover: none) { .pbi-tool { opacity: 1; } }
.pbi-tool:hover { background: #f3f2f1; color: #252423; }
.pbi-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: #605e5c; }
.pbi-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pbi-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.pbi-legend i.is-line { height: 3px; width: 14px; border-radius: 2px; }
@media (max-width: 640px) { .pbi-visual-tools .pbi-legend { display: none; } }

.pbi-chart { position: relative; width: 100%; overflow: hidden; }
.pbi-chart svg { display: block; }
.pbi-h-280 { height: 280px; }
.pbi-h-240 { height: 240px; }
.pbi-h-130 { height: 130px; }
.pbi-h-auto { min-height: 60px; }
.pbi-empty { display: flex; align-items: center; justify-content: center; height: 100%; min-height: 60px; padding: 16px; text-align: center; font-size: 12px; color: #605e5c; }
td.pbi-empty { display: table-cell; height: auto; padding: 32px 16px; }

/* SVG text + marks */
.pbi-gridline { stroke: #edebe9; stroke-width: 1; }
.pbi-axis { font-size: 10.5px; fill: #605e5c; font-family: inherit; }
.pbi-cat { font-size: 11.5px; fill: #323130; font-weight: 500; font-family: inherit; }
.pbi-val { font-size: 11px; fill: #252423; font-weight: 700; font-family: inherit; font-variant-numeric: tabular-nums; }
.pbi-donut-value { font-size: 17px; fill: #252423; font-weight: 700; font-family: inherit; }
.pbi-gauge-value { font-size: 22px; fill: #252423; font-weight: 700; font-family: inherit; }
.pbi-mark { transition: opacity .12s ease; }
.pbi-chart svg:hover .pbi-mark:not(:hover) { opacity: .4; }
.pbi-mark.is-link { cursor: pointer; }

/* Donut + legend */
.pbi-donut { display: flex; flex-direction: column; align-items: center; gap: 14px; height: 100%; justify-content: center; }
.pbi-donut.is-side { flex-direction: row; justify-content: flex-start; }
.pbi-donut svg { flex-shrink: 0; }
.pbi-legend-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; width: 100%; }
.pbi-legend-list li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #323130; }
.pbi-legend-list.is-compact { gap: 6px; margin-top: 12px; }
.pbi-swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.pbi-legend-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbi-legend-val { font-weight: 700; font-variant-numeric: tabular-nums; color: #252423; }

/* Gauges + mini stats */
.pbi-gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pbi-mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #edebe9; }
.pbi-mini-stats div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pbi-mini-stats span { font-size: 10.5px; color: #605e5c; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbi-mini-stats strong { font-size: 14px; color: #252423; font-variant-numeric: tabular-nums; }
.pbi-mini-stats strong.is-bad { color: #c4314b; }

/* 100% stacked bar + callout */
.pbi-stack100 { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: #edebe9; }
.pbi-stack100 span { display: block; height: 100%; }
.pbi-stack100 span + span { border-left: 2px solid #fff; }
.pbi-callout {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; padding: 8px 10px; border-radius: 4px;
  background: #fdf3f4; border-left: 3px solid #d64550; font-size: 11.5px; color: #750b1c;
}
.pbi-callout i { margin-top: 2px; color: #d64550; }

/* Table with data bars + heat cells */
.pbi-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.app-content .pbi-table thead th {
  text-align: left; padding: 8px 10px; font-size: 11px; font-weight: 700; color: #252423;
  text-transform: none; letter-spacing: 0; background: #faf9f8;
  border-top: 1px solid #edebe9; border-bottom: 2px solid #c8c6c4; white-space: nowrap;
}
.app-content .pbi-table thead th.pbi-num { text-align: right; }
.pbi-table td { padding: 9px 10px; border-bottom: 1px solid #edebe9; color: #323130; white-space: nowrap; }
.app-content .pbi-table tbody tr:hover { background: #f3f9ff; }
.pbi-table .pbi-num { text-align: right; }
.pbi-rank { color: #8a8886; width: 32px; }
@media (max-width: 1440px) { .pbi-col-phone { display: none; } .pbi-table .pbi-strong { max-width: 220px; overflow: hidden; text-overflow: ellipsis; } }
@media (max-width: 1320px) { #cockpit-top-debtors-body .pbi-person-name { display: none; } }
.pbi-strong { font-weight: 600; color: #252423; }
.pbi-mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; color: #605e5c; }
.pbi-databar { position: relative; min-width: 96px; height: 22px; display: flex; align-items: center; justify-content: flex-end; padding-right: 2px; }
.pbi-databar span { position: absolute; left: 0; top: 3px; bottom: 3px; background: #cfe5ff; border-radius: 2px; }
.pbi-databar b { position: relative; font-weight: 700; color: #252423; font-variant-numeric: tabular-nums; }
.pbi-heat { display: inline-block; min-width: 42px; padding: 3px 8px; border-radius: 3px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.pbi-heat.h0 { background: #dff6dd; color: #0b5a08; }
.pbi-heat.h1 { background: #fff4ce; color: #6b5100; }
.pbi-heat.h2 { background: #fde7dd; color: #8a3b14; }
.pbi-heat.h3 { background: #fbd9dc; color: #8e1b2b; }
.pbi-heat.h4 { background: #8b1a2b; color: #fff; }
.pbi-person { display: inline-flex; align-items: center; gap: 8px; max-width: 170px; }
.pbi-person-name { overflow: hidden; text-overflow: ellipsis; }
.pbi-avatar {
  width: 24px; height: 24px; border-radius: 999px; background: #e1effe; color: #12239e; font-size: 9.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.pbi-link-btn {
  height: 26px; padding: 0 10px; border-radius: 4px; border: 1px solid #c8c6c4; background: #fff; color: #0f6cbd;
  font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.pbi-link-btn:hover { background: #f3f9ff; border-color: #118dff; }

/* Recent activity */
.pbi-activity { display: flex; flex-direction: column; }
.pbi-activity-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f3f2f1; font-size: 12px; }
.pbi-activity-row:last-child { border-bottom: 0; }
.pbi-activity-icon {
  width: 28px; height: 28px; border-radius: 999px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: #e1effe; color: #0f6cbd; font-size: 12px;
}
.pbi-activity-icon.is-wa { background: #dff6dd; color: #107c10; }
.pbi-activity-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pbi-activity-main .pbi-strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pbi-activity-meta { font-size: 11px; color: #605e5c; }
.pbi-status { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 3px; }
.pbi-status.is-ok { background: #dff6dd; color: #0b5a08; }
.pbi-status.is-bad { background: #fde7e9; color: #a4262c; }

/* Tooltip */
.pbi-tooltip {
  position: fixed; z-index: 400; pointer-events: none; opacity: 0; transition: opacity .08s ease;
  max-width: 280px; padding: 8px 10px; border-radius: 4px; background: #252423; color: #fff;
  font-size: 11.5px; line-height: 1.5; white-space: pre-line; box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.pbi-tooltip.is-on { opacity: 1; }

/* Focus mode */
.pbi-visual.is-focus { position: fixed; inset: 24px; z-index: 80; display: flex; flex-direction: column; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .45); }
.pbi-visual.is-focus .pbi-chart { flex: 1; height: auto; }
body.pbi-focus-open .app-content > [id^="tab-"] { animation: none; }
body.pbi-focus-open::after { content: ""; position: fixed; inset: 0; background: rgba(37, 36, 35, .45); z-index: 79; }

/* Receivables by state / by executive sections */
.pbi-span-6 { grid-column: span 6; }
@media (max-width: 1180px) { .pbi-grid > .pbi-span-6 { grid-column: span 12; } }
.pbi-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pbi-h-200 { height: 200px; }
.pbi-split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 14px; align-items: start; }
@media (max-width: 560px) { .pbi-split { grid-template-columns: 1fr; } }
.pbi-view-all {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 4px 2px;
  color: #0f6cbd; font-size: 12px; font-weight: 600; cursor: pointer;
}
.pbi-view-all:hover { text-decoration: underline; }
.pbi-view-all i { font-size: 10px; }
.app-content .pbi-table-compact thead th { padding: 7px 10px; background: #faf9f8; }
.pbi-table-compact td { padding: 8px 10px; }
.pbi-dot-swatch { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }
.pbi-avatar.is-solid { color: #fff; width: 28px; height: 28px; font-size: 10px; }
.pbi-bar-cell { width: 42%; }
.pbi-bar-track { display: block; height: 16px; border-radius: 3px; background: transparent; }
.pbi-bar-track span { display: block; height: 100%; border-radius: 3px; min-width: 3px; }
.pbi-table-compact .pbi-person { max-width: 240px; }
.search-btn kbd { white-space: nowrap; flex-shrink: 0; line-height: 1.4; }
.search-btn > span { min-width: 0; }
.search-placeholder { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* India state map */
.pbi-h-map { height: 340px; }
.pbi-map-legend { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 6px; font-size: 10.5px; color: #605e5c; }
.pbi-map-legend i { width: 22px; height: 8px; border-radius: 2px; display: inline-block; }
.pbi-map-legend span:first-child { margin-right: 4px; }
.pbi-map-legend span:last-child { margin-left: 4px; }
.pbi-map-note { margin-top: 4px; text-align: center; font-size: 10.5px; color: #605e5c; }

/* Links that look like nav buttons (Help & Tools, Field app) */
a.nav-link { text-decoration: none; }
