:root {
  /* Corporate BI / ERP surfaces */
  --bg: #e9eef3;
  --bg-elevated: #ffffff;
  --bg-subtle: #f4f7fa;
  --ink: #152033;
  --muted: #5a6b7c;
  --line: #cfd8e3;
  --line-strong: #b7c4d2;
  --brand: #0d6e6e;
  --brand-dark: #0a5252;
  --brand-soft: #e2f3f3;
  --brand-mid: #149494;
  --accent: #b45309;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --info: #175cd3;
  --sidebar: #0b1a28;
  --sidebar-text: #c5d0db;
  --sidebar-muted: #7d8f9e;
  --shadow: 0 1px 2px rgba(15, 32, 51, 0.06), 0 1px 3px rgba(15, 32, 51, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 32, 51, 0.1);
  --radius: 6px;
  --radius-lg: 8px;
  --font: "Source Sans 3", "IBM Plex Sans", "Segoe UI", sans-serif;
  --display: "Source Sans 3", "IBM Plex Sans", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", "Consolas", monospace;
  --chart-1: #0d6e6e;
  --chart-2: #b54708;
  --chart-3: #175cd3;
  --chart-4: #b42318;
  --chart-5: #0ea5e9;
  --chart-6: #3f6212;
  --chart-grid: #e4eaf0;
  --pbi-canvas: #eef2f6;
  --pbi-visual-bg: #ffffff;
  --control-h: 2.15rem;
  --topbar-h: 3.15rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--brand); }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0 0 0.4rem;
  color: var(--ink);
}
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 0.85rem; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.82rem; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  background: linear-gradient(160deg, #0b1a28 0%, #0d6e6e 48%, #e9eef3 48.2%);
}

.auth-card {
  width: min(420px, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.75rem 1.85rem;
}

.brand-mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--brand-dark);
  margin-bottom: 0.2rem;
  letter-spacing: -0.02em;
}
.brand-mark span { color: var(--accent); }

.auth-card h1 { font-size: 1.35rem; margin-top: 0.75rem; }
.auth-card .sub { margin-bottom: 1.25rem; font-size: 0.9rem; }

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0.75rem 0 0.3rem;
}

input, select, textarea {
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-size: 0.92rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { height: auto; min-height: 4.5rem; padding: 0.55rem 0.65rem; }
input:hover, select:hover, textarea:hover { border-color: #9aabbc; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.45rem 0.85rem;
  min-height: var(--control-h);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.btn-primary {
  background: var(--brand);
  border-color: var(--brand-dark);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-ghost:hover {
  background: var(--bg-subtle);
  border-color: var(--brand);
  color: var(--brand-dark);
  text-decoration: none;
}
.btn-danger { background: var(--danger); border-color: #912018; color: #fff; }
.btn-block { width: 100%; margin-top: 1rem; }
.btn-sm { padding: 0.28rem 0.55rem; min-height: 1.85rem; font-size: 0.8rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.form-error {
  background: #fef3f2;
  color: var(--danger);
  border: 1px solid #fecdca;
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.85rem;
  font-size: 0.88rem;
}

.auth-links { margin-top: 1.1rem; font-size: 0.88rem; text-align: center; }

.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
body.sidebar-collapsed .app-shell {
  grid-template-columns: 68px 1fr;
}
body.sidebar-collapsed .sidebar {
  padding-left: 0.35rem;
  padding-right: 0.35rem;
  overflow-x: hidden;
}
body.sidebar-collapsed .sidebar .brand-mark {
  font-size: 0;
  padding: 0.35rem;
  position: relative;
}
body.sidebar-collapsed .sidebar .brand-mark::after {
  content: 'S';
  font-size: 1.05rem;
  font-weight: 700;
  color: #5eead4;
}
body.sidebar-collapsed .sidebar .brand-mark span { display: none; }
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-section-title {
  display: none;
}
body.sidebar-collapsed .sidebar a.nav-link {
  justify-content: center;
  padding-left: 0.55rem;
  padding-right: 0.55rem;
}
body.sidebar-collapsed .nav-close { display: none !important; }
body.sidebar-collapsed .brand-row { justify-content: center; }

body.sidebar-hidden .app-shell,
body.focus-mode .app-shell {
  grid-template-columns: 1fr;
}
body.sidebar-hidden .sidebar,
body.focus-mode .sidebar {
  display: none;
}
body.focus-mode .ask-page-chrome,
body.focus-mode .pbi-tab-nav,
body.focus-mode .bi-workflow,
body.focus-mode .dash-related-nav {
  display: none !important;
}
body.focus-mode .ask-page-header p { display: none; }
body.focus-mode .content {
  padding: 0.75rem 1rem 1rem;
  max-width: none;
}
body.focus-mode .bi-ask-tall {
  min-height: calc(100vh - 5.5rem);
  max-height: calc(100vh - 5.5rem);
}
.sidebar {
  background: linear-gradient(180deg, #0b1a28 0%, #08141f 55%, #060f18 100%);
  color: var(--sidebar-text);
  padding: 0.75rem 0.5rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  overflow-y: auto;
  max-height: 100vh;
  position: sticky;
  top: 0;
  border-right: 1px solid #061018;
  z-index: 40;
}
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.35rem 0.45rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.45rem;
}
.sidebar .brand-mark {
  color: #fff;
  padding: 0.2rem 0.35rem;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: none;
  margin-bottom: 0;
}
.sidebar .brand-mark span { color: #5eead4; }
.nav-close { display: none; color: #cbd5e1 !important; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; }
.nav-section { margin-bottom: 0.4rem; }
.nav-section-title {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--sidebar-muted);
  padding: 0.5rem 0.65rem 0.2rem;
}
.sidebar a.nav-link {
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  font-weight: 550;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-left: 3px solid transparent;
  margin: 1px 0;
  line-height: 1.2;
}
.sidebar a.nav-link:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  text-decoration: none;
}
.sidebar a.nav-link.active {
  background: rgba(13, 110, 110, 0.38);
  color: #fff;
  border-left-color: #5eead4;
  text-decoration: none;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.12);
}
.nav-ico {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  opacity: 0.88;
}
.sidebar a.nav-link.active .nav-ico,
.sidebar a.nav-link:hover .nav-ico { opacity: 1; }
.nav-label { min-width: 0; }
.nav-toggle {
  display: inline-flex;
  align-items: center;
  color: var(--ink) !important;
  padding: 0.35rem !important;
}
.nav-toggle .nav-ico { width: 1.25rem; height: 1.25rem; }
.topbar-focus-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  color: var(--ink) !important;
}
.topbar-focus-btn .nav-ico { width: 1.05rem; height: 1.05rem; }
.topbar-focus-btn[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
}
.topbar-focus-label { font-size: 0.78rem; font-weight: 600; }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 15, 24, 0.45);
  z-index: 35;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
.topbar-identity { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0.45rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
.topbar strong { font-size: 0.92rem; }
.topbar-right { display: flex; align-items: center; gap: 0.55rem; }
.topbar-right select {
  width: auto;
  min-width: 10rem;
  height: 2rem;
  font-size: 0.85rem;
  padding: 0.2rem 0.5rem;
}
.content { padding: 1.15rem 1.35rem 1.75rem; max-width: 1600px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.page-header h1 { margin-bottom: 0.15rem; }
.page-header > div:first-child p {
  margin: 0;
  font-size: 0.88rem;
  max-width: 52rem;
}
.page-header .pbi-page-actions,
.page-header > div:last-child:not(.panel):not(.cards) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.75rem;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.85rem 0.95rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--brand);
}
a.stat-card.is-nav {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, transform 0.12s;
}
a.stat-card.is-nav:hover {
  border-color: var(--brand-mid);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
  text-decoration: none;
}
.stat-card .label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}
.stat-card .value {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-card .hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.3rem; }

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.95rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fafbfc 0%, #f3f6f9 100%);
  min-height: 2.65rem;
}
.panel-header strong { font-size: 0.92rem; font-weight: 650; }
.panel-body { padding: 0.85rem 0.95rem; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--line-strong);
  position: sticky;
  top: 0;
  z-index: 1;
}
table.data tbody tr:nth-child(even) { background: #fafcfd; }
table.data tbody tr:hover { background: var(--brand-soft); }
table.data td a { font-weight: 600; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid transparent;
}
.badge.muted { background: #eef2f6; color: var(--muted); border-color: var(--line); }
.badge.danger { background: #fef3f2; color: var(--danger); border-color: #fecdca; }
.badge.green { background: #ecfdf3; color: #067647; border-color: #abefc6; }
.badge.amber { background: #fffaeb; color: #b54708; border-color: #fedf89; }
.badge.red { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.badge.unknown { background: #eef2f6; color: var(--muted); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.kpi-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.85rem;
  background: #fff;
  box-shadow: var(--shadow);
}
.kpi-card .kpi-name {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.kpi-card .kpi-value {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kpi-card .kpi-meta { font-size: 0.72rem; color: var(--muted); margin-top: 0.3rem; }
.kpi-card.status-Green { border-left: 3px solid #12b76a; }
.kpi-card.status-Amber { border-left: 3px solid #f79009; }
.kpi-card.status-Red { border-left: 3px solid #f04438; }
.kpi-card.status-Unknown { border-left: 3px solid #98a2b3; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(72px, auto);
  gap: 0.75rem;
  align-items: stretch;
  min-height: 320px;
  position: relative;
}
.dash-grid.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(1px);
  z-index: 5;
  border-radius: var(--radius);
}
.dash-widget {
  min-height: 120px;
  background: #fff;
}
.dash-widget .chart-canvas {
  width: 100%;
  height: 220px;
  display: block;
}

/* �� Power BI�style dashboard canvas �� */
.pbi-dash-page .content,
.pbi-page { max-width: none; }
.pbi-page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}
.pbi-breadcrumb { font-size: 0.8rem; margin: 0 0 0.15rem; color: var(--muted); }
.pbi-breadcrumb a { color: var(--muted); }
.pbi-page-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }

.pbi-canvas-wrap {
  background: var(--pbi-canvas);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.pbi-canvas { padding: 0.85rem; }

.pbi-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: var(--pbi-visual-bg);
  border-bottom: 1px solid var(--line);
  font-size: 0.82rem;
}
.pbi-toolbar.is-sticky {
  position: sticky;
  top: 0;
  z-index: 8;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.92);
}
.pbi-toolbar-left, .pbi-toolbar-right { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.pbi-toolbar-label { color: var(--muted); }
.pbi-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(6,118,71,0.15);
  animation: pbi-pulse 2s ease infinite;
}
@keyframes pbi-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
.pbi-icon-btn.is-spinning { animation: pbi-spin 0.8s linear infinite; }
@keyframes pbi-spin { to { transform: rotate(360deg); } }
.pbi-toggle { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; color: var(--muted); cursor: pointer; }
.pbi-toggle input { width: auto; margin: 0; }

/* Slicer ribbon */
.pbi-slicer-ribbon {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.85rem;
  box-shadow: 0 2px 8px rgba(20,33,43,0.04);
  overflow: hidden;
}
.pbi-slicer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  padding: 0.75rem 0.85rem;
}
.pbi-slicer-group { display: flex; flex-direction: column; gap: 0.35rem; min-width: 120px; }
.pbi-slicer-grow { flex: 1 1 180px; }
.pbi-slicer-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.pbi-slicer-select { min-width: 10rem; padding: 0.45rem 0.6rem; font-size: 0.88rem; }
.pbi-saved-view-row { display: flex; gap: 0.35rem; align-items: center; }
.pbi-saved-view-row .pbi-slicer-select { min-width: 12rem; flex: 1; }
.pbi-slicer-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.slicer-chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.slicer-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.slicer-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pbi-slicer-actions { display: flex; gap: 0.35rem; align-items: center; margin-left: auto; }
.pbi-slicer-advanced {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  padding: 0 0.85rem 0.75rem;
  border-top: 1px dashed var(--line);
  margin-top: -0.25rem;
  padding-top: 0.75rem;
}
.pbi-slicer-field { font-size: 0.82rem; min-width: 160px; }
.pbi-slicer-field input { padding: 0.45rem 0.6rem; font-size: 0.88rem; }
.pbi-slicer-view-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.pbi-drill-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  background: var(--brand-soft);
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}
.pbi-drill-label { font-weight: 700; color: var(--brand-dark); font-size: 0.75rem; text-transform: uppercase; }
.pbi-drill-chip {
  background: #fff;
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-weight: 600;
  color: var(--brand-dark);
}

/* Visual tiles */
.pbi-visual {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(20,33,43,0.06);
  transition: box-shadow 0.15s;
}
.pbi-visual:hover { box-shadow: 0 4px 14px rgba(20,33,43,0.08); }
.pbi-visual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  min-height: 2.25rem;
}
.pbi-visual-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--display);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbi-visual-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.pbi-visual-hint { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pbi-visual-body { flex: 1; padding: 0.5rem 0.65rem 0.65rem; min-height: 0; }
.pbi-chart-body { position: relative; height: 100%; min-height: 180px; }
.pbi-chart-body .chart-canvas { width: 100% !important; height: 100% !important; min-height: 180px; }

.pbi-chart-type-group {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  gap: 0;
}
.pbi-chart-type {
  border: none;
  background: #fff;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.45rem;
  cursor: pointer;
}
.pbi-chart-type.active { background: var(--brand-soft); color: var(--brand-dark); }
.pbi-chart-type:hover:not(.active) { background: #f8fafb; }
.pbi-chart-design-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  align-items: center;
  margin-left: 0.35rem;
}
.pbi-design-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--dot, #0f766e);
  padding: 0;
  cursor: pointer;
}
.pbi-design-dot.active { border-color: var(--text, #101828); outline: 1px solid #fff; }
.pbi-design-dot:hover { transform: scale(1.1); }
.pbi-toolbar-hint { margin-left: 0.75rem; font-size: 0.75rem; opacity: 0.85; }
.chart-type-picker { margin: 0.25rem 0 0.5rem; }

/* KPI cards */
.pbi-kpi-card {
  padding: 0.85rem 0.95rem;
  justify-content: space-between;
}
.pbi-kpi-card.status-Green { border-left: 4px solid #12b76a; }
.pbi-kpi-card.status-Amber { border-left: 4px solid #f79009; }
.pbi-kpi-card.status-Red { border-left: 4px solid #f04438; }
.pbi-kpi-card.status-Unknown { border-left: 4px solid #98a2b3; }
.pbi-kpi-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.pbi-kpi-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.pbi-kpi-value {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0.35rem 0;
}
.pbi-kpi-foot { display: flex; align-items: center; gap: 0.45rem; font-size: 0.75rem; color: var(--muted); }
.pbi-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.pbi-status-dot.green { background: #12b76a; }
.pbi-status-dot.amber { background: #f79009; }
.pbi-status-dot.red { background: #f04438; }
.pbi-status-dot.unknown { background: #98a2b3; }
.pbi-kpi-trend { font-weight: 700; margin-left: auto; }
.pbi-kpi-trend.up { color: var(--ok); }
.pbi-kpi-trend.down { color: var(--danger); }
.pbi-kpi-spark { width: 72px; height: 28px; color: var(--brand); opacity: 0.85; flex-shrink: 0; }
.pbi-kpi-card.is-nav {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.12s;
}
.pbi-kpi-card.is-nav:hover {
  box-shadow: 0 6px 18px rgba(15, 106, 90, 0.12);
  border-color: var(--brand);
  transform: translateY(-1px);
}
.pbi-kpi-nav {
  margin-left: auto;
  font-weight: 700;
  color: var(--brand-dark);
  font-size: 0.72rem;
}
.pbi-visual-open {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-dark);
  text-decoration: none;
  white-space: nowrap;
}
.pbi-visual-open:hover { text-decoration: underline; }
.dash-related-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: linear-gradient(90deg, #f3faf7, #fafbfc);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.dash-related-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-right: 0.25rem;
}
.dash-related-link {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}
.dash-related-link:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  text-decoration: none;
}
.bi-predefined-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.95rem;
  margin: 0.75rem 0 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
}
.bi-next-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.75rem 0.95rem;
  margin: 0.65rem 0 0.85rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--info);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
}
.bi-next-banner .hint { margin: 0.2rem 0 0; }
.bi-next-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.bi-map-item { padding: 0.25rem 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.bi-map-item:last-child { border-bottom: 0; }
.bi-predefined-banner .hint { margin: 0.2rem 0 0; }
.pbi-tpl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.65rem;
}

/* Table visual */
.pbi-table-wrap { overflow: auto; max-height: 100%; }
.pbi-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.pbi-table th {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-bottom: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  background: var(--pbi-visual-bg);
}
.pbi-table td { padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--line); }
.pbi-table tr.alt td { background: #fafbfc; }
.pbi-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.pbi-table td.empty { text-align: center; color: var(--muted); padding: 1.5rem; }

.pbi-empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }

/* Dashboard gallery (list) */
.pbi-gallery-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.75rem;
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pbi-gallery-count { font-size: 0.88rem; color: var(--muted); margin-right: auto; }
.pbi-gallery-count strong { color: var(--ink); }
.pbi-gallery-search { flex: 1 1 200px; max-width: 320px; margin: 0; }
.pbi-gallery-search input {
  width: 100%;
  margin: 0;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  border-radius: 8px;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  border: 0;
}
[data-gallery-item].is-filtered-out { display: none !important; }

.pbi-dash-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.pbi-dash-card {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.pbi-dash-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(20, 33, 43, 0.1);
  border-color: #b8c9c4;
}
.pbi-dash-card-preview {
  background: linear-gradient(135deg, var(--brand-soft), #f3f5f7);
  padding: 1rem;
  min-height: 108px;
}
.pbi-dash-card-mock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}
.pbi-dash-card-mock span {
  background: rgba(255,255,255,0.85);
  border-radius: 4px;
  height: 28px;
  border: 1px solid rgba(15,106,90,0.12);
}
.pbi-dash-card-mock span:nth-child(1) { grid-column: span 2; height: 36px; }
.pbi-dash-card-mock span:nth-child(2) { grid-column: span 2; height: 36px; }
.pbi-dash-card-body { padding: 0.85rem 1rem 1rem; flex: 1; display: flex; flex-direction: column; }
.pbi-dash-card-body h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.pbi-dash-card-meta { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0.5rem 0; }
.pbi-dash-card-actions { margin-top: auto; display: flex; gap: 0.35rem; }
.pbi-template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.pbi-template-item {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pbi-template-item:hover {
  border-color: #b8c9c4;
  box-shadow: 0 4px 14px rgba(20,33,43,0.06);
}
.pbi-template-item .btn { align-self: flex-start; margin-top: 0.35rem; }
.pbi-tpl-section { margin-bottom: 1.1rem; }
.pbi-tpl-section-title {
  font-size: 0.92rem;
  margin: 0 0 0.55rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.pbi-tpl-chip {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #eef2f4;
  color: var(--muted);
  width: fit-content;
}
.pbi-tpl-chip.is-sales,
.pbi-template-item.is-sales .pbi-tpl-chip { background: #d8efe9; color: var(--brand-dark); }
.pbi-tpl-chip.is-yoy,
.pbi-template-item.is-yoy .pbi-tpl-chip { background: #f3e6dc; color: #8a4b22; }
.pbi-tpl-chip.is-ops,
.pbi-template-item.is-ops .pbi-tpl-chip { background: #e8eef8; color: #334155; }
.pbi-template-item.is-yoy { background: linear-gradient(180deg, #fbf6f1, #fafbfc); }
.pbi-template-item.is-sales { background: linear-gradient(180deg, #f3faf7, #fafbfc); }
.pbi-tpl-panel > summary.panel-header { list-style: none; }
.pbi-tpl-panel > summary::-webkit-details-marker { display: none; }

.chart-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.chart-lib-card {
  display: flex;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chart-lib-card:hover {
  border-color: var(--brand);
  box-shadow: 0 4px 14px rgba(15,106,90,0.1);
}
.chart-lib-icon {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}
.chart-lib-card .hint { margin: 0.25rem 0 0; font-size: 0.8rem; }

.pbi-tab-nav {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.35rem;
}
.pbi-tab {
  padding: 0.45rem 0.85rem;
  border-radius: 8px 8px 0 0;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  text-decoration: none;
}
.pbi-tab:hover { color: var(--brand-dark); background: var(--brand-soft); text-decoration: none; }
.pbi-tab.active { color: var(--brand-dark); background: var(--brand-soft); border-bottom: 2px solid var(--brand); }

.pbi-grid-inputs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Presentation / fullscreen mode (dashboards + reports) */
body.dash-present .sidebar,
body.dash-present .nav-backdrop,
body.dash-present .nav-toggle { display: none !important; }
body.dash-present .app-shell { grid-template-columns: 1fr; }
body.dash-present .topbar { display: none; }
body.dash-present .content { padding: 0.65rem; }
body.dash-present .pbi-page-header .pbi-breadcrumb,
body.dash-present .pbi-page-actions a[href="#/dashboards"],
body.dash-present .pbi-page-actions a[href="#/reports"],
body.dash-present .workflow-ribbon,
body.dash-present .rpt-analytic-flow,
body.dash-present .related-nav,
body.dash-present .dash-related-nav,
body.dash-present .pbi-tab-nav,
body.dash-present .bi-predefined-banner,
body.dash-present .filter-bar,
body.dash-present .pbi-slicer-ribbon { display: none; }
body.dash-present .rpt-page .pbi-canvas-wrap {
  border: none;
  box-shadow: none;
  min-height: calc(100vh - 1.5rem);
}
body.dash-present .rpt-chart-visual,
body.dash-present #rpt-canvas { min-height: calc(100vh - 7rem); }
body.dash-present .rpt-chart-visual canvas { max-height: none !important; }

.widget-edit-row label { margin-top: 0.35rem; }
.widget-edit-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  background: #fafbfc;
}

.sales-peak td { background: #fff4e5 !important; }
.sales-year-total td { font-weight: 600; background: #f2f4f7; }
.sales-yoy td:last-child { font-weight: 600; }

.sales-fy-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0.25rem 0 0.75rem;
}
.sales-fy-strip-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 0.25rem;
}
.sales-fy-chip {
  border: 1px solid var(--line) !important;
  font-weight: 650;
}
.sales-fy-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
.sales-fy-card {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.sales-fy-card:hover,
.sales-fy-card:focus-visible {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  outline: none;
}
.sales-fy-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sales-fy-fs {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: #e9eef3;
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 1rem;
  overflow: auto;
}
.sales-fy-fs-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.sales-fy-fs-bar strong { font-size: 1.35rem; margin-right: 0.5rem; }
.sales-fy-fs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.sales-fy-fs-nav { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; }
.sales-fy-fs-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.sales-fy-fs-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
}
.sales-fy-fs-chart { height: min(52vh, 420px); position: relative; }
.sales-fy-fs-table-panel .panel-body { max-height: min(62vh, 560px); }
body.sales-fy-present { overflow: hidden; }
body.sales-fy-present .app-shell { visibility: hidden; }

@media (max-width: 900px) {
  .sales-fy-fs-body { grid-template-columns: 1fr; }
  .sales-fy-fs-chart { height: 260px; }
}
.prod-peak td { background: #e8f4ea !important; }
.prod-year-total td { font-weight: 600; background: #f2f4f7; }
.prod-yoy td:nth-child(n+2) { font-weight: 600; }

.brief-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.85rem; }
.brief-kpi-row { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.brief-kpi { min-width: 108px; }
a.brief-kpi.is-nav {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  border-left: 3px solid var(--brand);
  transition: border-color 0.12s, box-shadow 0.12s;
}
a.brief-kpi.is-nav:hover {
  border-color: var(--brand-mid);
  box-shadow: var(--shadow);
  text-decoration: none;
}
.brief-kpi-go {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.brief-kpi .label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.brief-kpi .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.brief-alerts { display: flex; flex-direction: column; gap: 0.45rem; }
.brief-alert {
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--line-strong);
  background: var(--bg-subtle);
  font-size: 0.88rem;
}
.brief-alert strong { display: block; margin-bottom: 0.15rem; font-size: 0.86rem; }
.brief-alert.critical { border-left-color: #b42318; background: #fef3f2; }
.brief-alert.warning { border-left-color: #b54708; background: #fffaeb; }
.brief-alert.info { border-left-color: #175cd3; background: #eff8ff; }
.text-warn { color: #c0392b; }
.text-ok { color: #1e7e34; }
.qual-peak td { background: #fde8e8 !important; }
.qual-year-total td { font-weight: 600; background: #f2f4f7; }
.qual-yoy td:nth-child(n+2) { font-weight: 600; }
.mp-peak td { background: #fef9e7 !important; }
.mp-year-total td { font-weight: 600; background: #f2f4f7; }
.oee-peak td { background: #eef2ff !important; }
.oee-year-total td { font-weight: 600; background: #f2f4f7; }

.report-table tr.row-group td {
  background: #f2f4f7;
  font-weight: 600;
}
.report-table tr.row-section td {
  background: #e8eef5;
  font-weight: 600;
  font-size: .95rem;
}
.report-table tr.row-grand td {
  background: #eef7f5;
  font-weight: 700;
  border-top: 2px solid var(--brand, #0f766e);
}

/* �� Report viewer (Zoho / PBI�style) �� */
.rpt-view-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.rpt-view-btn {
  border: none;
  background: transparent;
  padding: 0.4rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.rpt-view-btn + .rpt-view-btn { border-left: 1px solid var(--line); }
.rpt-view-btn:hover { color: var(--brand-dark); background: var(--brand-soft); }
.rpt-view-btn.active {
  background: var(--brand);
  color: #fff;
}
.rpt-chart-types { display: inline-flex; gap: 0.2rem; }
.rpt-chart-types.is-hidden { display: none; }
.rpt-design-row {
  display: inline-flex;
  gap: 0.25rem;
  align-items: center;
  padding: 0.15rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.rpt-design-row.is-hidden { display: none; }
.rpt-design-swatch {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: 0.2rem;
  cursor: pointer;
}
.rpt-design-swatch span { display: flex; gap: 2px; }
.rpt-design-swatch i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.rpt-design-swatch.selected,
.rpt-design-swatch:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.rpt-analytic-flow {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f7fafb 0%, #fff 100%);
}
.rpt-analytic-flow-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}
.rpt-analytic-flow-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.rpt-flow-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
a.rpt-flow-chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.rpt-flow-chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.rpt-flow-chip.is-muted { opacity: 0.55; cursor: default; }

.rpt-drill-row { cursor: pointer; }
.rpt-drill-row:hover { background: var(--brand-soft); }
.rpt-list-row.rpt-drill-row:hover .rpt-list-bar span { filter: brightness(0.95); }

.rpt-pack-bi { margin-top: 0.25rem; }
.rpt-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
}
.rpt-pack-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.75rem 0.85rem 0.5rem;
}
.rpt-pack-tile h4 {
  margin: 0;
  font-size: 0.92rem;
}
.rpt-pack-chart { height: 200px; position: relative; margin: 0.35rem 0; }
.rpt-pack-top {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.rpt-pack-top li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--line-subtle, #eef2f6);
}
.rpt-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}

.rpt-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.rpt-kpi {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}
.rpt-kpi .label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.rpt-kpi .value {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 0.2rem;
  color: var(--ink);
}
.rpt-kpi .hint { font-size: 0.8rem; margin: 0.15rem 0 0; }

.rpt-visual {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
}
.rpt-table-wrap { max-height: min(70vh, 720px); }

.rpt-list { padding: 0.5rem 0; }
.rpt-list-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid #f0f2f4;
}
.rpt-list-row:hover { background: #f8fafb; }
.rpt-list-rank {
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.rpt-list-label { font-weight: 600; margin-bottom: 0.25rem; }
.rpt-list-bar {
  height: 6px;
  background: #eef2f4;
  border-radius: 99px;
  overflow: hidden;
}
.rpt-list-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), #2a9d8f);
  border-radius: 99px;
}
.rpt-list-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.rpt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
  padding: 0.85rem;
  background: transparent;
  border: none;
}
.rpt-card {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: 0 2px 8px rgba(20,33,43,0.04);
}
.rpt-card.is-top {
  border-color: var(--brand);
  box-shadow: 0 4px 16px rgba(15,106,90,0.12);
}
.rpt-card-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rpt-card-value {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 700;
}
.rpt-card-meta { font-size: 0.75rem; color: var(--muted); margin-top: 0.35rem; }

.rpt-chart-visual { padding-bottom: 0.25rem; }

.rpt-export-group {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.rpt-export-group .btn {
  border: none;
  border-radius: 0;
  border-left: 1px solid var(--line);
  margin: 0;
}
.rpt-export-group .btn:first-child { border-left: none; }

.rpt-kpi-strip { animation: rpt-fade 0.35s ease; }
@keyframes rpt-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

.dash-grid-enter .pbi-visual {
  animation: rpt-fade 0.4s ease both;
}
.dash-grid-enter .pbi-visual:nth-child(2) { animation-delay: 0.04s; }
.dash-grid-enter .pbi-visual:nth-child(3) { animation-delay: 0.08s; }
.dash-grid-enter .pbi-visual:nth-child(4) { animation-delay: 0.12s; }
.dash-grid-enter .pbi-visual:nth-child(5) { animation-delay: 0.16s; }
.dash-grid-enter .pbi-visual:nth-child(6) { animation-delay: 0.2s; }

.pbi-dash-card-preview.is-sales {
  background: linear-gradient(135deg, #d8efe9, #e8f0f8);
}
.pbi-dash-card-preview.is-yoy {
  background: linear-gradient(135deg, #f3e6dc, #efe8e0);
}
.pbi-dash-card-preview.is-ops {
  background: linear-gradient(135deg, #e2e8f4, #eef2f7);
}
.rpt-card-preview-label {
  margin-top: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-dark);
  opacity: 0.85;
}
.pbi-dash-card-preview.is-yoy .rpt-card-preview-label { color: #8a4b22; }
.pbi-dash-card-preview.is-ops .rpt-card-preview-label { color: #334155; }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: repeat(6, 1fr); }
  .pbi-slicer-row { flex-direction: column; align-items: stretch; }
  .pbi-slicer-actions { margin-left: 0; width: 100%; justify-content: flex-end; }
  .pbi-visual-header { flex-wrap: wrap; }
  .rpt-kpi-strip { grid-template-columns: 1fr 1fr; }
  .pbi-gallery-bar { flex-direction: column; align-items: stretch; }
  .pbi-gallery-search { max-width: none; }
  .rpt-export-group { width: 100%; }
  .rpt-export-group .btn { flex: 1; }

  /* App-like report viewer on tablet/phone */
  .rpt-page .pbi-page-header p:not(.pbi-breadcrumb) { display: none; }
  .rpt-page .pbi-page-actions .btn-sm { font-size: 0.78rem; }
  .rpt-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    position: sticky;
    top: var(--topbar-h, 52px);
    z-index: 15;
    background: #fff;
    padding: 0.55rem 0.65rem;
    border-bottom: 1px solid var(--line);
  }
  .rpt-toolbar .pbi-toolbar-left { display: none; }
  .rpt-toolbar .pbi-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }
  .rpt-view-toggle {
    order: -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-radius: 10px;
    overflow: hidden;
  }
  .rpt-view-btn {
    flex: 1;
    text-align: center;
    padding: 0.55rem 0.2rem;
    font-size: 0.78rem;
    font-weight: 650;
  }
  #rpt-view-chart { display: none; }
  .rpt-design-row { width: 100%; justify-content: flex-start; overflow-x: auto; }
  .rpt-chart-types { width: 100%; }
  .rpt-cards { grid-template-columns: 1fr 1fr; gap: 0.55rem; }
  .rpt-card { padding: 0.75rem; }
  .rpt-card-value { font-size: 1.15rem; }
  .rpt-list-row { padding: 0.65rem 0.55rem; }
  .rpt-pack-grid { grid-template-columns: 1fr; }
  .rpt-chart-visual { min-height: 280px; }
  .rpt-table-wrap { max-height: 62vh; margin: 0 -0.25rem; }
  .rpt-design-studio {
    grid-template-columns: 1fr !important;
  }
  .rpt-preview-panel { order: -1; }
}

@media (max-width: 560px) {
  .rpt-kpi-strip { grid-template-columns: 1fr 1fr; gap: 0.45rem; }
  .rpt-kpi .value { font-size: 1.05rem; }
  .rpt-cards { grid-template-columns: 1fr; }
  .rpt-page .pbi-page-header h1 { font-size: 1.15rem; }
  .rpt-page .workflow-ribbon { display: none; }
  body.dash-present .content { padding: 0.35rem; }
  body.dash-present .rpt-toolbar { top: 0; }
}

.toast-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  z-index: 1000;
}
.toast {
  background: var(--sidebar);
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius);
  min-width: 220px;
  max-width: min(360px, 92vw);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  border-left: 3px solid var(--brand-mid);
}
.toast.error { background: #7f1d1d; border-left-color: #fca5a5; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 26, 40, 0.55);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 0.75rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.modal {
  width: min(520px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line-strong);
}
.modal.modal-md { width: min(640px, 100%); }
.modal.modal-lg { width: min(780px, 100%); }
.modal > h2,
.modal-head {
  margin: 0;
  padding: 0.85rem 1.1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
  font-weight: 700;
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #fff 0%, #f7f9fb 100%);
  z-index: 1;
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}
.modal-head h2 { margin: 0; font-size: 1.05rem; border: 0; padding: 0; }
.modal-head .hint { margin: 0.2rem 0 0; }
.modal-body,
.modal > form {
  padding: 0.75rem 1.1rem 1rem;
  display: block;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.75rem 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--bg-subtle);
  position: sticky;
  bottom: 0;
}
.form-section {
  margin: 0.85rem 0 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}
.form-section:first-of-type { margin-top: 0.35rem; }
.form-section-title {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 0.75rem;
}
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid > .span-2 { grid-column: span 2; }
.form-grid > .span-3 { grid-column: span 3; }
.form-grid > .span-4 { grid-column: span 4; }
.form-field { min-width: 0; }
.form-field label,
.form-section label,
.modal label {
  margin-top: 0;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
}
.form-field .hint,
.form-section .hint { margin: 0.25rem 0 0; font-size: 0.75rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.panel-body {
  overflow-x: auto;
}
.table-wrap,
.panel-body:has(> table.data) {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.data {
  min-width: 640px;
}

.org-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.master-tabs {
  display: grid;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.master-tab-group {
  padding: 0.7rem 0.8rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}
.master-tab-group-title {
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
@media (max-width: 900px) {
  .org-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.35rem;
    scrollbar-width: thin;
    margin-bottom: 0.5rem;
  }
  .org-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  .master-tab-group {
    padding: 0.65rem 0.7rem 0.2rem;
  }
  .pbi-tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
.org-tab {
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.org-tab:hover { text-decoration: none; border-color: var(--brand); }
.org-tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }

.org-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1rem;
  align-items: start;
}
.tree-list { list-style: none; margin: 0; padding: 0; }
.tree-list ul { list-style: none; margin: 0; padding: 0; }
.tree-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid #eef2f4;
  font-size: 0.9rem;
}
.tree-empty { color: var(--muted); padding: 0.5rem 0; }

/* �� BI / Zoho workflow �� */
.bi-workflow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.bi-workflow-steps { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.bi-step {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.bi-step:hover { text-decoration: none; border-color: var(--brand); color: var(--brand-dark); }
.bi-step.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.bi-step.done { background: var(--brand-soft); border-color: transparent; color: var(--brand-dark); }
.bi-step-num {
  width: 1.25rem; height: 1.25rem;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.72rem;
  background: rgba(0,0,0,0.06);
}
.bi-step.active .bi-step-num { background: rgba(255,255,255,0.25); }
.bi-step-arrow { color: var(--muted); font-size: 0.85rem; }
.bi-workflow-links { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.bi-cat-tabs {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.bi-cat-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}
.bi-cat-tab:hover { text-decoration: none; border-color: var(--brand); }
.bi-cat-tab.active { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.bi-cat-count {
  font-size: 0.72rem;
  opacity: 0.8;
  background: rgba(0,0,0,0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}
.bi-cat-tab.active .bi-cat-count { background: rgba(255,255,255,0.2); }

.sales-360-lenses {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin: 0 0 1rem;
}
.sales-360-lens {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(180deg, #fff 0%, #f7f8fa 100%);
  transition: border-color .15s, box-shadow .15s;
}
.sales-360-lens:hover { border-color: var(--brand); text-decoration: none; }
.sales-360-lens.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
  background: #fff;
}
.sales-360-lens strong { font-size: 0.9rem; }
.sales-360-lens .hint { font-size: 0.72rem; margin: 0; }
.sales-360-kpis { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.sales-360-body { margin-bottom: 1rem; }
.btn-group { display: inline-flex; gap: 0; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }

.bi-wizard-modal { width: min(640px, 100%); max-height: min(90vh, 820px); overflow: auto; padding: 0; }
.bi-wizard-modal.bi-wizard-wide { width: min(920px, 100%); }
.bi-wizard-modal > .bi-wizard-head,
.bi-wizard-modal > form { padding: 1rem 1.25rem; }
.bi-wizard-head h2 { margin-bottom: 0.15rem; }
.bi-wizard-progress {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  flex-wrap: wrap;
}
.bi-wizard-progress li {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-bottom: 0.25rem;
  border-bottom: 2px solid transparent;
}
.bi-wizard-progress li.active { color: var(--brand-dark); border-color: var(--brand); }
.bi-wizard-progress li.done { color: var(--ok); }
.bi-wiz-label { font-weight: 700; margin: 0.75rem 0 0.5rem; color: var(--ink); }
.bi-cat-picker, .bi-tpl-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.bi-cat-card, .bi-tpl-card {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fafbfc;
  cursor: pointer;
  font: inherit;
}
.bi-cat-card.selected, .bi-tpl-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
  background: #fff;
}
.bi-cat-card.is-sales { border-left: 3px solid var(--brand); }
.bi-cat-card.is-yoy { border-left: 3px solid #c45c26; }
.bi-cat-card.is-ops { border-left: 3px solid #475569; }
.bi-wiz-data-links { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.65rem; font-size: 0.85rem; }
.bi-check { display: flex; align-items: center; gap: 0.45rem; font-size: 0.9rem; margin-top: 0.75rem; }
.bi-check input { width: auto; margin: 0; }
.bi-wiz-actions { margin-top: 1.25rem; }

.bi-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
  margin-top: 0.5rem;
}
.bi-setup-card {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.bi-setup-card h3 { margin: 0; font-size: 1rem; }
.bi-setup-card .btn { align-self: flex-start; }
.bi-setup-card.is-sales { background: linear-gradient(180deg, #f3faf7, #fff); }
.bi-setup-card.is-yoy { background: linear-gradient(180deg, #fbf6f1, #fff); }
.bi-setup-card.is-ops { background: linear-gradient(180deg, #f4f6fa, #fff); }

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}
.role-card {
  background: var(--pbi-visual-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.role-card header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}
.role-card h3 { margin: 0; font-size: 1rem; flex: 1; }
.role-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-height: 140px;
  overflow: auto;
}
.badge.green { background: #d1fadf; color: #067647; }

/* Template studio + Chart.js designs */
.bi-wiz-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  align-items: start;
}
.bi-wiz-preview-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  background: #fff;
}
.bi-wiz-preview-canvas-wrap {
  height: 200px;
  position: relative;
}
.bi-wiz-preview-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.bi-semantic-map { margin-top: 0.75rem; }
.bi-map-gap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.bi-map-col {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: #fafbfc;
  font-size: 0.85rem;
}
.bi-map-col ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.bi-map-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
.chart-design-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.chart-design-swatch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
}
.chart-design-swatch.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}
.chart-design-dots {
  display: flex;
  gap: 3px;
}
.chart-design-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.chart-design-gallery { display: flex; flex-direction: column; gap: 1.25rem; }
.chart-design-block header { margin-bottom: 0.5rem; }
.chart-design-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.65rem;
}
.chart-design-card {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.chart-design-card:hover { border-color: var(--brand); }
.chart-design-canvas-wrap {
  height: 110px;
  padding: 0.35rem;
  background: #f8fafc;
}
.chart-design-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-design-card figcaption {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.tpl-studio {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 1rem;
  margin-top: 0.5rem;
  align-items: start;
}
.tpl-studio-scroll {
  max-height: min(70vh, 720px);
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.tpl-studio-item .bi-tpl-meta {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.tpl-studio-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}
.tpl-studio-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  body.sidebar-collapsed .app-shell,
  body.sidebar-hidden .app-shell { grid-template-columns: 1fr; }
  body.sidebar-collapsed .sidebar,
  body.sidebar-hidden .sidebar {
    display: flex;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 86vw);
    max-height: 100vh;
    transform: translateX(-105%);
    padding: 0.75rem 0.5rem 1.35rem;
  }
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .nav-section-title,
  body.sidebar-collapsed .sidebar .brand-mark span { display: initial; }
  body.sidebar-collapsed .sidebar .brand-mark { font-size: 1.08rem; }
  body.sidebar-collapsed .sidebar .brand-mark::after { content: none; }
  body.sidebar-collapsed .sidebar a.nav-link { justify-content: flex-start; padding-left: 0.7rem; padding-right: 0.7rem; }
  .nav-toggle { display: inline-flex; align-items: center; }
  .nav-close { display: inline-flex; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(288px, 86vw);
    max-height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    flex-wrap: nowrap;
  }
  body.nav-open .sidebar { transform: translateX(0); display: flex; }
  body.nav-open .nav-backdrop { display: block !important; }
  .grid-2 { grid-template-columns: 1fr; }
  .org-layout { grid-template-columns: 1fr; }
  .bi-cat-picker, .bi-tpl-picker { grid-template-columns: 1fr; }
  .bi-wiz-split, .bi-map-gap, .bi-map-fields, .tpl-studio { grid-template-columns: 1fr; }
  .content { padding: 1rem; }
  .page-header { align-items: stretch; }
  .page-header > div:last-child,
  .pbi-page-actions { width: 100%; }
  .page-header .btn,
  .pbi-page-actions .btn { flex: 1 1 auto; justify-content: center; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .form-grid,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .form-grid > .span-2,
  .form-grid > .span-3,
  .form-grid > .span-4 { grid-column: span 2; }
  .modal { width: min(100%, 100%); border-radius: 12px; }
  .bi-wizard-modal { width: min(100%, 100%) !important; }
}

@media (max-width: 560px) {
  .form-grid,
  .form-grid-3,
  .form-grid-4 { grid-template-columns: 1fr; }
  .form-grid > .span-2,
  .form-grid > .span-3,
  .form-grid > .span-4 { grid-column: span 1; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; justify-content: center; }
  .stat-card .value { font-size: 1.35rem; }
  table.data { min-width: 520px; font-size: 0.82rem; }
}

/* �� Corporate BI polish layer �� */
.panel-body:has(> table.data) { padding: 0; overflow-x: auto; }
.panel-body > table.data { min-width: 100%; }
.panel-body > table.data th:first-child,
.panel-body > table.data td:first-child { padding-left: 0.95rem; }
.panel-body > table.data th:last-child,
.panel-body > table.data td:last-child { padding-right: 0.95rem; }

.filter-bar,
.flt-bar,
[class*="filter-bar"] {
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow);
}

.slicer-chip {
  border-radius: var(--radius) !important;
}

.pbi-canvas-wrap,
.pbi-slicer-ribbon {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.content > .panel + .panel,
.content > .cards + .panel,
.content > .bi-predefined-banner + .panel {
  margin-top: 0.85rem;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #b7c4d2;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-track { background: transparent; }

/* �� Data sources pending flow �� */
.ds-flow-strip {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.ds-flow-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 140px;
  min-width: 120px;
  opacity: 0.55;
}
.ds-flow-step.active,
.ds-flow-step.done { opacity: 1; }
.ds-flow-num {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  color: var(--muted);
  flex-shrink: 0;
}
.ds-flow-step.active .ds-flow-num {
  background: var(--brand);
  border-color: var(--brand-dark);
  color: #fff;
}
.ds-flow-step.done .ds-flow-num {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-dark);
}
.ds-flow-step strong { font-size: 0.88rem; display: block; }
.ds-flow-step .hint { margin: 0.1rem 0 0; font-size: 0.75rem; }
.ds-flow-arrow {
  align-self: center;
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0 0.15rem;
}

.ds-kpi-row { margin-bottom: 1rem; }
.ds-pending-panel { margin-bottom: 1rem; border-left: 3px solid #b54708; }

.page-loading {
  display: grid;
  place-items: center;
  min-height: 40vh;
  gap: 0.75rem;
  text-align: center;
}
.page-loading-bar {
  width: min(220px, 50vw);
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  background-size: 200% 100%;
  animation: page-load-slide 1s linear infinite;
}
@keyframes page-load-slide {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.ds-connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.55rem;
}
.ds-connector {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.7rem;
  background: var(--bg-subtle);
}
.ds-connector.is-ready {
  background: #fff;
  border-left: 3px solid var(--brand);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  width: 100%;
}
.ds-connector.is-ready:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand) 35%, transparent);
}
.ds-connector.is-pending {
  opacity: 0.72;
  border-left: 3px solid var(--line-strong);
}
.ds-connector-name { font-weight: 700; font-size: 0.88rem; margin-bottom: 0.25rem; }
.ds-connector-status { margin-bottom: 0.25rem; }

.ds-import-modal .modal-body { padding-top: 0.35rem; }
.ds-wiz-steps {
  display: flex;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0.65rem 1.1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-subtle);
  flex-wrap: wrap;
}
.ds-wiz-steps li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--muted);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
}
.ds-wiz-steps li.active {
  color: var(--brand-dark);
  background: #fff;
  border-color: var(--brand);
}
.ds-wiz-steps li.done { color: var(--ok); }
.ds-wiz-num {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  background: #fff;
  border: 1px solid var(--line);
}
.ds-wiz-steps li.active .ds-wiz-num {
  background: var(--brand);
  border-color: var(--brand-dark);
  color: #fff;
}
.ds-wiz-steps li.done .ds-wiz-num {
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--ok);
}

.ds-dropzone {
  position: relative;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  text-align: center;
  background: #fff;
}
.ds-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  height: 100%;
}
.ds-dropzone p { margin: 0.2rem 0; }
.ds-check-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.9rem !important;
  font-weight: 600 !important;
  color: var(--ink) !important;
  margin-top: 1.35rem !important;
}
.ds-check-label input { width: auto; height: auto; margin: 0; }
.ds-profile-kpis { margin: 0.65rem 0 0.85rem; }
.ds-profile-kpis .stat-card .value { font-size: 1.25rem; }
.ds-map-table { max-height: 260px; margin-bottom: 0.35rem; border: 1px solid var(--line); border-radius: var(--radius); }

.ds-done {
  text-align: center;
  padding: 0.75rem 0.5rem 0.25rem;
}
.ds-done-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ok);
  background: #ecfdf3;
  border: 1px solid #abefc6;
  border-radius: 4px;
  padding: 0.2rem 0.55rem;
}
.ds-done-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin: 1rem 0 0.25rem;
}

@media (max-width: 900px) {
  .ds-flow-arrow { display: none; }
  .ds-connector-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}

/* Report design studio � live preview panel */
.rpt-design-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 0.85rem;
  align-items: start;
}
.rpt-preview-panel {
  position: sticky;
  top: calc(var(--topbar-h, 52px) + 0.5rem);
}
.rpt-preview-canvas-wrap {
  margin-top: 0.75rem;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.65rem;
  min-height: 240px;
}
.rpt-preview-canvas-wrap canvas {
  width: 100% !important;
  max-height: 240px;
}
.rpt-design-page .chart-design-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

/* �� BI Ask assistant �� */
.bi-ask {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.bi-ask.panel > .panel-body.bi-ask-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.bi-ask-workspace {
  overflow: hidden;
}
.bi-ask-tall {
  min-height: min(68vh, 640px);
  height: calc(100vh - 13.5rem);
  max-height: calc(100vh - 10rem);
}
.ask-page .bi-ask-tall {
  height: calc(100vh - 15.5rem);
}
body.focus-mode .ask-page .bi-ask-tall {
  height: calc(100vh - 5.5rem);
  max-height: calc(100vh - 5.5rem);
}
.bi-ask .panel-header,
.bi-ask-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-shrink: 0;
}
.bi-ask-toolbar-right { display: flex; align-items: center; gap: 0.5rem; }
.bi-ask-ready { white-space: nowrap; font-size: 0.75rem; }
.bi-ask-bubble.is-pending {
  border-style: dashed;
  opacity: 0.92;
}
.bi-ask-bubble.is-pending .bi-ask-summary::before {
  content: '';
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.4rem;
  border: 2px solid var(--brand);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -0.1rem;
  animation: bi-ask-spin 0.7s linear infinite;
}
@keyframes bi-ask-spin { to { transform: rotate(360deg); } }
.bi-ask-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.bi-ask-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.2rem;
  flex-shrink: 0;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.bi-ask-chip {
  border: 1px solid var(--line);
  background: var(--bg-subtle);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.32rem 0.75rem;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.bi-ask-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.bi-ask-log {
  flex: 1 1 auto;
  min-height: 8rem;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.15rem 0.15rem 0.85rem;
  scrollbar-width: thin;
}
.bi-ask-msg { display: flex; width: 100%; min-width: 0; }
.bi-ask-msg.user { justify-content: flex-end; }
.bi-ask-msg.assistant { justify-content: flex-start; }
.bi-ask-bubble {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  overflow: hidden;
  box-sizing: border-box;
}
.bi-ask-msg.user .bi-ask-bubble {
  width: auto;
  max-width: min(640px, 92%);
  background: var(--brand-soft);
  border-color: #b7dede;
}
.bi-ask-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}
.bi-ask-headline {
  flex: 1 1 12rem;
  min-width: 0;
  font-size: 1.02rem;
  line-height: 1.3;
}
.bi-ask-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  flex: 0 1 auto;
}
.bi-ask-summary { margin: 0 0 0.55rem; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.bi-ask-kpi {
  margin-bottom: 0.65rem;
  font-size: 1.15rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.bi-ask-table-wrap {
  overflow: auto;
  max-height: none;
  margin: 0.35rem 0 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.bi-ask-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.bi-ask-table th,
.bi-ask-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.bi-ask-table thead th {
  position: sticky;
  top: 0;
  background: #f7faf9;
  z-index: 1;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.bi-ask-table tr.alt td { background: #fafcfb; }
.bi-ask-item { font-weight: 600; }
.bi-ask-val { font-variant-numeric: tabular-nums; }
.bi-ask-yoy { white-space: nowrap; color: var(--muted); }
.bi-ask-links { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.bi-ask-understood {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.bi-ask-understood summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
}
.bi-ask-understood summary::-webkit-details-marker { display: none; }
.bi-ask-understood[open] summary { margin-bottom: 0.25rem; }
.bi-ask-section-label { margin: 0.35rem 0 0.25rem; }
.bi-ask-form,
.bi-ask-dock {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 0 -0.15rem;
  padding: 0.65rem 0.15rem 0.1rem;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--bg-elevated) 28%, var(--bg-elevated) 100%);
  border-top: 1px solid var(--line);
}
.bi-ask-input {
  flex: 1;
  min-width: 0;
  min-height: var(--control-h);
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: inherit;
  background: #fff;
}
.bi-ask-dock .btn { flex: 0 0 auto; border-radius: 999px; padding-inline: 1.15rem; }

@media (max-width: 900px) {
  .bi-ask-tall,
  .ask-page .bi-ask-tall {
    height: auto;
    min-height: min(62vh, 520px);
    max-height: none;
  }
  .bi-ask-log { max-height: min(55vh, 420px); }
  .topbar-focus-label { display: none; }
  body.focus-mode .bi-ask-tall,
  body.focus-mode .ask-page .bi-ask-tall {
    min-height: calc(100vh - 6.5rem);
    height: auto;
    max-height: none;
  }
  body.focus-mode .bi-ask-log { max-height: calc(100vh - 14rem); }
}

@media (max-width: 560px) {
  .bi-ask-dock { flex-wrap: wrap; }
  .bi-ask-dock .btn { width: 100%; }
  .bi-ask-table th:nth-child(3),
  .bi-ask-table td:nth-child(3) { display: none; }
}

/* �� Sales stepped loading �� */
.sales-load { gap: 1rem; }
.sales-load-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  width: min(340px, 92vw);
  display: grid;
  gap: 0.45rem;
}
.sales-load-step {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.sales-load-mark {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex: 0 0 auto;
  background: transparent;
}
.sales-load-step.is-active { color: var(--ink); font-weight: 600; }
.sales-load-step.is-active .sales-load-mark {
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.sales-load-step.is-done { color: var(--ok); }
.sales-load-step.is-done .sales-load-mark {
  border-color: var(--ok);
  background: var(--ok);
}
.sales-load-step.is-error { color: var(--danger); }
.sales-load-step.is-error .sales-load-mark {
  border-color: var(--danger);
  background: var(--danger);
}

.sc-actions, .deep-recs { margin: 0; padding-left: 1.1rem; }
.sc-actions li, .deep-recs li { margin-bottom: 0.35rem; }
.deep-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 900px) {
  .deep-split { grid-template-columns: 1fr; }
}
.deep-picker label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.bi-ask-recs { margin: 0.5rem 0 0.75rem; }
.bi-ask-recs ul, .bi-ask-rec-list { margin: 0.35rem 0 0; padding-left: 0; list-style: none; }
.bi-ask-rec {
  margin-bottom: 0.55rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-left: 3px solid var(--muted);
  background: #fff;
}
.bi-ask-rec.sev-critical { border-left-color: var(--danger, #f04438); }
.bi-ask-rec.sev-high { border-left-color: var(--warn, #f79009); }
.bi-ask-rec.sev-medium { border-left-color: #6366f1; }
.bi-ask-rec.sev-info { border-left-color: var(--brand); }
.bi-ask-rec.sev-critical strong { color: var(--danger); }
.bi-ask-rec.sev-high strong { color: var(--warn); }
.bi-ask-rec-top { display: flex; gap: 0.4rem; align-items: center; margin-bottom: 0.2rem; }
.bi-ask-rec-kind {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.bi-ask-rec-sev {
  font-size: 0.65rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: #f2f4f7;
  color: var(--muted);
}
.bi-ask-exports { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }

.mkt-360-strip { margin-bottom: 1rem; }
.mkt-360-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.65rem;
}
.mkt-aspect-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  text-align: left;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
}
.mkt-aspect-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.mkt-aspect-icon {
  font-size: 1.1rem;
  color: var(--brand-dark, var(--brand));
  line-height: 1;
}
.mkt-ask-header h1 { margin-bottom: 0.25rem; }
