/* ─────────────────────────────────────────────────────────────
   Zackgo Reports — Executive Dashboard Layout (shared)
   Shell, cards, KPIs, tabs — used by dashboard-executive + demo-executive
────────────────────────────────────────────────────────────── */

:root {
  --brand-navy: #0f0f0f;
  --brand-navy-deep: #0a0a0a;
  --accent: #F97316;
  --accent-2: #EA580C;
  --accent-soft: rgba(249, 115, 22, .14);
  --accent-strong: rgba(249, 115, 22, .30);
  --success: #F97316;
  --success-soft: rgba(249, 115, 22, .14);
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, .14);
  --info: #60A5FA;
  --info-soft: rgba(96, 165, 250, .14);
  --violet: #A78BFA;
  --violet-soft: rgba(167, 139, 250, .14);
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar: 264px;
  --demo-banner-h: 44px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: .22s;
}

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-grad-1: rgba(96, 165, 250, .07);
  --bg-grad-2: rgba(249, 115, 22, .10);
  --bg-grad-3: rgba(167, 139, 250, .05);
  --bg-solid: #0f0f0f;
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .09);
  --surface-solid: #161616;
  --surface-elev: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --text: #E6ECF7;
  --text-strong: #FFFFFF;
  --text-dim: rgba(230, 236, 247, .68);
  --text-mute: rgba(230, 236, 247, .46);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 32px -14px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-lg: 0 32px 80px -30px rgba(0, 0, 0, .7), 0 8px 24px -12px rgba(0, 0, 0, .35);
  --dot-color: rgba(255, 255, 255, .035);
  --navy: #0a0a0a;
  --grey-100: var(--border);
  --grey-300: var(--text-mute);
  --grey-500: var(--text-dim);
  --grey-700: var(--text);
  --green: var(--success);
  --amber: var(--accent);
  --red: var(--danger);
  --off-white: var(--surface-2);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F4F4F5;
  --bg-grad-1: rgba(249, 115, 22, .05);
  --bg-grad-2: rgba(96, 165, 250, .04);
  --bg-grad-3: rgba(124, 58, 237, .03);
  --bg-solid: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F3F5F9;
  --surface-3: #E9EDF3;
  --surface-solid: #FFFFFF;
  --surface-elev: linear-gradient(180deg, #FFFFFF, #FBFCFE);
  --border: rgba(15, 23, 42, .08);
  --border-strong: rgba(15, 23, 42, .14);
  --text: #111827;
  --text-strong: #0a0a0a;
  --text-dim: rgba(11, 18, 32, .66);
  --text-mute: rgba(11, 18, 32, .46);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 24px -10px rgba(15, 23, 42, .14), 0 2px 6px rgba(15, 23, 42, .06);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .18), 0 8px 20px -12px rgba(15, 23, 42, .10);
  --dot-color: rgba(15, 23, 42, .045);
  --navy: #0f0f0f;
  --grey-100: #EEF1F6;
  --grey-300: #CBD3DF;
  --off-white: var(--surface-2);
}

html, body { height: 100%; }

body.demo-executive-page,
body.zg-exec-dashboard-body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: "cv11", "ss01", "ss03", "cv02";
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at -10% -20%, var(--bg-grad-1), transparent 60%),
    radial-gradient(900px 640px at 110% 10%, var(--bg-grad-2), transparent 55%),
    radial-gradient(900px 600px at 50% 120%, var(--bg-grad-3), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

body.demo-executive-page::before,
body.zg-exec-dashboard-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--dot-color) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 40%, transparent 80%);
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background: var(--surface-elev), var(--bg-solid);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: transform .35s var(--ease);
}

:root[data-theme="dark"] .sidebar {
  background:
    radial-gradient(600px 260px at 0% 0%, rgba(249, 115, 22, .08), transparent 55%),
    radial-gradient(500px 320px at 100% 100%, rgba(96, 165, 250, .06), transparent 60%),
    linear-gradient(180deg, rgba(10, 10, 10, .94) 0%, rgba(15, 15, 15, .96) 100%);
}

:root[data-theme="light"] .sidebar {
  background: #FFFFFF;
  box-shadow: 1px 0 0 var(--border), 0 10px 40px -20px rgba(15, 23, 42, .10);
}

.sidebar-company {
  margin: 6px 14px 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.sidebar-company-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 5px;
}

.sidebar-company-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-company-plan {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
  border-radius: 100px;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-2);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .8px;
}

:root[data-theme="dark"] .sidebar-company-plan { color: var(--accent); }

.sidebar-company-plan::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 8px 12px;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}

.sidebar-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-mute);
  font-weight: 700;
  padding: 14px 10px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .18s var(--ease), color .18s var(--ease);
  margin-bottom: 2px;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
  font-family: inherit;
}

.nav-item:hover { background: var(--surface-2); color: var(--text-strong); }

.nav-item.active {
  color: var(--text-strong);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 100px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 10px rgba(249, 115, 22, .6);
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-mute);
}

.nav-item.active .nav-item-icon { color: var(--accent); }
.nav-item-icon svg { width: 18px; height: 18px; stroke-width: 1.75; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer-note {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-mute);
  margin-top: auto;
}

/* ── Main + topbar ── */
.main {
  margin-left: var(--sidebar);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100vh;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.topbar {
  padding: 0 28px;
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--bg-solid) 70%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 15px; font-weight: 700; color: var(--text-strong); letter-spacing: -.2px; }
.topbar-sub { font-size: 12px; color: var(--text-mute); margin-top: 1px; font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.hamburger {
  display: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  font-size: 0;
  color: var(--text);
  cursor: pointer;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
}

.hamburger::before {
  content: "";
  display: block;
  width: 16px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  color: var(--text);
}

.theme-toggle svg { width: 16px; height: 16px; stroke-width: 2; }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { transition: opacity .25s ease, transform .25s ease; position: absolute; }
:root[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; }
:root[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; }
:root[data-theme="light"] .theme-toggle .icon-sun { opacity: 0; }
:root[data-theme="light"] .theme-toggle .icon-moon { opacity: 1; }

.content {
  padding: 28px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  max-width: 1600px;
  width: 100%;
  scroll-padding-top: 12px;
}

.tab-content { display: none; animation: edlFade .35s ease; }
.tab-content.active { display: block; }

@keyframes edlFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ── Sections + KPI ── */
.section-eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

:root[data-theme="dark"] .section-eyebrow { color: var(--accent); }

.section-eyebrow::before {
  content: "";
  width: 18px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.section-sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; line-height: 1.55; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 0;
}

.kpi-card {
  position: relative;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: var(--surface-elev);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  isolation: isolate;
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: .9;
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 12px;
}

.kpi-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1;
  margin-bottom: 10px;
  letter-spacing: -.8px;
  font-variant-numeric: tabular-nums;
}

.kpi-change {
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 100px;
  font-weight: 700;
}

.kpi-change.up { color: #EA580C; background: var(--success-soft); }
.kpi-change.down { color: #DC2626; background: var(--danger-soft); }
.kpi-change.neutral { color: var(--text-dim); background: var(--surface-2); }

:root[data-theme="dark"] .kpi-change.up { color: #FB923C; }
:root[data-theme="dark"] .kpi-change.down { color: #FCA5A5; }

/* ── Cards ── */
.card {
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.card-sub { font-size: 12px; color: var(--text-mute); margin-top: 3px; font-weight: 500; }
.card-body { padding: 22px; color: var(--text-dim); font-size: 13px; }

/* ── Reports + buttons ── */
.filter-btn {
  padding: 7px 14px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
}

.filter-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071A14;
  border-color: transparent;
  font-weight: 700;
}

.report-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-radius: 10px;
  margin: 0 -8px;
  transition: background .2s ease;
}

.report-row:hover { background: var(--surface-2); }
.report-row:last-child { border-bottom: none; }

.report-type-badge {
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  flex-shrink: 0;
}

.weekly { background: var(--info-soft); color: #2563EB; }
.monthly { background: var(--violet-soft); color: #7C3AED; }

.report-row-name { font-size: 13.5px; font-weight: 600; color: var(--text-strong); margin-bottom: 3px; }
.report-row-meta { font-size: 12px; color: var(--text-mute); }
.report-row-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.btn-sm {
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  text-decoration: none;
}

.btn-sm-outline { border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.btn-sm-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #071A14;
  font-weight: 700;
}

.blind-spot-alert {
  position: relative;
  padding: 16px 18px 16px 22px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-strong);
}

.blind-spot-alert::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 100px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.bs-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--accent-2);
  font-weight: 800;
  margin-bottom: 6px;
  display: block;
}

:root[data-theme="dark"] .bs-label { color: var(--accent); }
.bs-text { font-size: 13.5px; color: var(--text); line-height: 1.7; }

.trend-chart { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.trend-chart .tbar {
  flex: 1;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  min-height: 4px;
}

.copilot-log {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.copilot-msg {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.55;
  max-width: 92%;
}

.copilot-msg.user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(249, 115, 22, .25);
  color: var(--text-strong);
}

.copilot-msg.bot {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.copilot-input-row { display: flex; gap: 8px; }
.copilot-input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.copilot-input-row input:focus { border-color: var(--accent); }

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.stat-val { font-size: 18px; font-weight: 800; color: var(--text-strong); }
.stat-label { font-size: 11px; color: var(--text-mute); font-weight: 500; }
.stats-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }

.dept-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.dept-compare-card {
  background: var(--surface-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.dept-compare-name { font-size: 14px; font-weight: 700; color: var(--text-strong); }
.dept-compare-score { font-size: 26px; font-weight: 800; margin: 8px 0; font-variant-numeric: tabular-nums; }
.dept-compare-bar-bg { height: 8px; background: var(--surface-2); border-radius: 100px; overflow: hidden; margin-bottom: 8px; }
.dept-compare-bar { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }

/* ── Demo banner offsets ── */
body.has-demo-banner .sidebar {
  top: var(--demo-banner-h);
  height: calc(100vh - var(--demo-banner-h));
}

body.has-demo-banner .main {
  min-height: calc(100vh - var(--demo-banner-h));
  height: calc(100vh - var(--demo-banner-h));
}

body.has-demo-banner .topbar {
  top: var(--demo-banner-h);
}

body.has-demo-banner .sidebar-overlay {
  top: var(--demo-banner-h);
}

body.demo-executive-page .kpi-card:hover,
body.demo-executive-page .card:hover {
  transform: none !important;
}

/* ── Mobile ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 15, .55);
  backdrop-filter: blur(6px);
  z-index: 49;
}

.sidebar-overlay.open { display: block; }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .main { margin-left: 0; }
  .content { padding: 18px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .topbar { padding: 0 16px; height: 60px; }
  .card-body { padding: 18px; }
  .kpi-card { padding: 18px; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; gap: 10px; }
  .content { padding: 14px; }
  .kpi-val { font-size: 24px; }
  .report-row { flex-direction: column; align-items: flex-start; }
  .report-row-actions { width: 100%; justify-content: flex-end; }
}
