/* Demo prototype pages — executive shell + demo banner layout fixes */

:root {
  --demo-banner-h: 44px;
}

/* ── Demo banner (prototype pages do not load demo-workspace.css) ── */
body.zg-demo-prototype.has-demo-banner {
  padding-top: 0 !important;
}

body.zg-demo-prototype .demo-mode-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  height: var(--demo-banner-h);
  background: linear-gradient(90deg, #0a0a0a 0%, #161616 50%, #0a0a0a 100%);
  border-bottom: 1px solid rgba(224, 180, 76, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

body.zg-demo-prototype .demo-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  overflow: hidden;
}

body.zg-demo-prototype .demo-banner-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--accent, #F97316), var(--accent-2, #EA580C));
  color: #0a0a0a;
}

body.zg-demo-prototype .demo-banner-text {
  flex: 1;
  font-size: 12px;
  color: rgba(230, 236, 247, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

body.zg-demo-prototype .demo-banner-text strong {
  color: #fff;
  font-weight: 600;
}

body.zg-demo-prototype .demo-banner-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

body.zg-demo-prototype .demo-banner-cta {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 100px;
  background: var(--accent, #F97316);
  color: #0a0a0a;
  text-decoration: none;
  white-space: nowrap;
}

body.zg-demo-prototype .demo-banner-link {
  font-size: 11px;
  font-weight: 600;
  color: rgba(230, 236, 247, 0.6);
  text-decoration: none;
  white-space: nowrap;
}

/* Shell body — banner must not sit in horizontal flex row beside main */
body.has-demo-banner.zg-exec-shell-body,
body.zg-demo-prototype.zg-exec-shell-body {
  padding-top: 0 !important;
  flex-direction: column;
}

body.zg-demo-prototype.zg-exec-shell-body .sidebar.zg-sidebar-premium {
  top: var(--demo-banner-h);
  height: calc(100vh - var(--demo-banner-h));
}

body.zg-demo-prototype.zg-exec-shell-body:not(.demo-report-page) .zg-shell-main {
  padding-top: var(--demo-banner-h);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-left: var(--zg-shell-sidebar, 264px);
}

/* Remove duplicate top toolbar — sidebar + demo crumb provide navigation */
body.zg-demo-prototype .rv-toolbar {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  border: none !important;
}

body.zg-demo-prototype .zg-shell-content {
  padding: 0 !important;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(249, 115, 22, 0.06), transparent 55%),
    radial-gradient(700px 380px at 88% 0%, rgba(249, 115, 22, 0.05), transparent 50%),
    var(--bg, #0a0a0a);
}

body.zg-demo-prototype .zg-shell-content > [id$='-root'],
body.zg-demo-prototype .zg-shell-content > [id$='-content'] {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: calc(100vh - var(--demo-banner-h));
  box-sizing: border-box;
}

/* Prototype documents — centered, full readable width */
body.zg-demo-prototype .kg-document,
body.zg-demo-prototype .pi-document,
body.zg-demo-prototype .bs-document,
body.zg-demo-prototype .dc-document,
body.zg-demo-prototype .pe-document,
body.zg-demo-prototype .it-page,
body.zg-demo-prototype .ei-document,
body.zg-demo-prototype .es-document,
body.zg-demo-prototype .bt-document,
body.zg-demo-prototype .ih-document {
  width: 100%;
  max-width: min(1140px, 100%) !important;
  margin: 0 auto !important;
  padding: 20px 24px 56px !important;
  box-sizing: border-box;
}

body.zg-demo-prototype #kg-root,
body.zg-demo-prototype #pi-root,
body.zg-demo-prototype #bs-root,
body.zg-demo-prototype #dc-root,
body.zg-demo-prototype #it-root,
body.zg-demo-prototype #ih-root,
body.zg-demo-prototype #es-root,
body.zg-demo-prototype #ei-root,
body.zg-demo-prototype #bt-root,
body.zg-demo-prototype #pe-root {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.zg-demo-prototype .kg-content-wrap,
body.zg-demo-prototype .pi-content-wrap,
body.zg-demo-prototype .bs-content-wrap,
body.zg-demo-prototype .dc-content-wrap,
body.zg-demo-prototype .pe-content-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Demo page chrome strip */
body.zg-demo-prototype .zg-demo-proto-head {
  max-width: min(1140px, 100%);
  margin: 0 auto;
  padding: 16px 24px 0;
  box-sizing: border-box;
}

body.zg-demo-prototype .zg-demo-proto-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 4px;
}

body.zg-demo-prototype .zg-demo-proto-crumb a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

body.zg-demo-prototype .zg-demo-proto-crumb a:hover {
  text-decoration: underline;
}

body.zg-demo-prototype .zg-demo-proto-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  line-height: 1.45;
  word-break: break-word;
}

body.zg-demo-prototype .zg-demo-proto-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0a0a;
  white-space: nowrap;
}

/* Reveal animations — show immediately in demo */
body.zg-demo-prototype .rv-reveal,
body.zg-demo-prototype .kg-section,
body.zg-demo-prototype .pi-section,
body.zg-demo-prototype .bs-section,
body.zg-demo-prototype .dc-section,
body.zg-demo-prototype .pe-section {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
  visibility: visible !important;
}

body.zg-demo-prototype .rv-reveal.rv-visible {
  opacity: 1 !important;
  transform: none !important;
}

/* No floating / hover drift in demo */
body.zg-demo-prototype .pro-lock,
body.zg-demo-prototype .kg-kpi-card,
body.zg-demo-prototype .pi-metric-card,
body.zg-demo-prototype .bs-scenario-card,
body.zg-demo-prototype .bs-stat-card,
body.zg-demo-prototype .demo-proto-card {
  animation: none !important;
}

body.zg-demo-prototype .kg-kpi-card:hover,
body.zg-demo-prototype .pi-metric-card:hover,
body.zg-demo-prototype .bs-stat-card:hover {
  transform: none !important;
}

/* KPI period tabs — prevent badge overlap */
body.zg-demo-prototype .kg-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-top: 12px;
}

body.zg-demo-prototype .kg-period-tab {
  display: inline-flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: center !important;
  gap: 3px !important;
  min-height: 44px;
  padding: 10px 16px !important;
  white-space: normal !important;
  position: relative !important;
}

body.zg-demo-prototype .kg-period-soon {
  display: block !important;
  position: static !important;
  margin: 0 !important;
  font-size: 8px !important;
  line-height: 1.2 !important;
  letter-spacing: 0.08em !important;
  transform: none !important;
}

/* Cover headers — contain decorative layers */
body.zg-demo-prototype .kg-cover,
body.zg-demo-prototype .pi-cover,
body.zg-demo-prototype .bs-cover,
body.zg-demo-prototype .dc-cover,
body.zg-demo-prototype .pe-cover {
  overflow: hidden !important;
  isolation: isolate;
  word-break: break-word;
}

body.zg-demo-prototype .kg-cover::before,
body.zg-demo-prototype .pi-cover::before,
body.zg-demo-prototype .bs-cover::before,
body.zg-demo-prototype .pe-cover::before {
  pointer-events: none;
  max-width: 55%;
}

body.zg-demo-prototype .kg-cover-title,
body.zg-demo-prototype .pi-cover-title,
body.zg-demo-prototype .bs-cover-title,
body.zg-demo-prototype .pe-cover-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Snapshot / KPI numbers stay in card bounds */
body.zg-demo-prototype .kg-snapshot-grid,
body.zg-demo-prototype .kg-kpi-grid,
body.zg-demo-prototype .pi-snapshot-main,
body.zg-demo-prototype .pi-metric-grid,
body.zg-demo-prototype .bs-snapshot-stats,
body.zg-demo-prototype .pe-scenario-controls {
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

body.zg-demo-prototype .kg-snapshot-num,
body.zg-demo-prototype .kg-kpi-val,
body.zg-demo-prototype .pi-snapshot-num,
body.zg-demo-prototype .bs-stat-val,
body.zg-demo-prototype .dcc-score {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Sidebar logo — no overlap */
body.zg-demo-prototype .sidebar-logo {
  flex-wrap: nowrap;
  overflow: hidden;
  min-width: 0;
  text-decoration: none;
}

body.zg-demo-prototype .sidebar-logo-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

body.zg-demo-prototype .sidebar-company-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.zg-demo-prototype .zg-shell-back-dashboard {
  word-break: break-word;
}

/* Scenario / control panels — full width, no overflow bleed */
body.zg-demo-prototype .pe-scenario-controls,
body.zg-demo-prototype .bs-controls-panel {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 900px) {
  body.zg-demo-prototype.zg-exec-shell-body .sidebar.zg-sidebar-premium {
    top: var(--demo-banner-h);
    height: calc(100vh - var(--demo-banner-h));
  }

  body.zg-demo-prototype.zg-exec-shell-body .zg-shell-main {
    margin-left: 0;
  }

  body.zg-demo-prototype .demo-banner-text {
    display: none;
  }

  body.zg-demo-prototype .kg-document,
  body.zg-demo-prototype .pi-document,
  body.zg-demo-prototype .bs-document,
  body.zg-demo-prototype .dc-document,
  body.zg-demo-prototype .pe-document {
    padding: 16px 16px 48px !important;
  }

  body.zg-demo-prototype .kg-cover,
  body.zg-demo-prototype .pi-cover,
  body.zg-demo-prototype .bs-cover,
  body.zg-demo-prototype .pe-cover {
    padding: 28px 22px !important;
  }

  body.zg-demo-prototype .kg-cover-title,
  body.zg-demo-prototype .pi-cover-title,
  body.zg-demo-prototype .bs-cover-title,
  body.zg-demo-prototype .pe-cover-title {
    font-size: 24px !important;
  }

  body.zg-demo-prototype .zg-demo-proto-head {
    padding: 12px 16px 0;
  }
}

/* ── Demo report page — executive shell + report viewer ── */
/* Black palette — match executive sidebar (not report-viewer green tint) */
body.zg-demo-prototype.demo-report-page {
  --bg: #0a0a0a;
  --bg-solid: #0f0f0f;
  --bg-grad-1: rgba(96, 165, 250, .07);
  --bg-grad-2: rgba(249, 115, 22, .10);
  --bg-grad-3: rgba(167, 139, 250, .05);
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .06);
  --surface-3: rgba(255, 255, 255, .09);
  --surface-solid: #161616;
  --surface-glass: rgba(15, 15, 15, .88);
  --surface-elev: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --card-grad: linear-gradient(180deg, rgba(255, 255, 255, .055) 0%, rgba(255, 255, 255, .015) 100%);
  --dot-color: rgba(255, 255, 255, .035);
  --border: rgba(255, 255, 255, .08);
  --border-strong: rgba(255, 255, 255, .14);
  --success: #F97316;
  --success-soft: rgba(249, 115, 22, .12);
  --cover-grad: linear-gradient(135deg, #0a0a0a 0%, #161616 38%, #1a1a1a 62%, #0a0a0a 100%);
}

body.zg-demo-prototype.demo-report-page,
body.zg-demo-prototype.demo-report-page.zg-exec-shell-body {
  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) !important;
  background-attachment: fixed !important;
}

body.zg-demo-prototype.demo-report-page::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%);
}

body.zg-demo-prototype.demo-report-page .zg-shell-main {
  display: block;
  min-height: calc(100vh - var(--demo-banner-h, 44px));
  overflow: visible;
  background: transparent !important;
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding-top: var(--demo-banner-h, 44px);
}

/* Full-width immersive read — no executive sidebar */
body.zg-demo-prototype.demo-report-page #zg-exec-sidebar,
body.zg-demo-prototype.demo-report-page .sidebar.zg-sidebar-premium {
  display: none !important;
}

body.zg-demo-prototype.demo-report-page .zg-shell-hamburger,
body.zg-demo-prototype.demo-report-page .zg-shell-overlay {
  display: none !important;
}

body.zg-demo-prototype.demo-report-page .zg-shell-content {
  overflow: visible;
  padding: 0 !important;
  background: transparent !important;
}

body.zg-demo-prototype.demo-report-page .rv-chrome-stack {
  display: block !important;
  position: sticky;
  top: var(--rv-chrome-top, var(--demo-banner-h, 44px));
  z-index: 100;
  flex-shrink: 0;
  background: var(--bg-solid);
  border-bottom: 1px solid var(--border);
}

body.zg-demo-prototype.demo-report-page .rv-chrome-stack .rv-toolbar {
  display: flex !important;
  height: 64px;
  min-height: 64px;
  padding: 0 28px;
  background: color-mix(in oklab, var(--bg-solid) 78%, transparent);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-bottom: 1px solid var(--border);
}

body.zg-demo-prototype.demo-report-page .rv-chrome-stack .rm-toolbar-bar {
  display: block !important;
  background: var(--bg-solid) !important;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

body.zg-demo-prototype.demo-report-page .rm-jump-nav {
  background: transparent;
}

body.zg-demo-prototype.demo-report-page #rv-root {
  width: 100% !important;
  max-width: min(1140px, 100%) !important;
  margin: 0 auto !important;
  padding: 0 28px !important;
  box-sizing: border-box;
}

body.zg-demo-prototype.demo-report-page #rv-content {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  box-sizing: border-box;
}

body.zg-demo-prototype.demo-report-page .zg-demo-proto-head {
  max-width: 100%;
  margin: 0;
  padding: 20px 0 8px;
}

body.zg-demo-prototype.demo-report-page #rv-content:has(.rv-doc-nav) {
  display: block !important;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Section rail hidden — jump via reading-bar pills only */
body.zg-demo-prototype.demo-report-page .rv-doc-nav {
  display: none !important;
}

body.zg-demo-prototype.demo-report-page .rv-document {
  width: 100%;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 8px 0 48px !important;
  box-sizing: border-box;
}

body.zg-demo-prototype.demo-report-page .rv-card,
body.zg-demo-prototype.demo-report-page .rv-dash-score-card,
body.zg-demo-prototype.demo-report-page .rv-kpi-card,
body.zg-demo-prototype.demo-report-page .rv-section-header {
  background: var(--surface-elev), var(--surface);
  border-color: var(--border);
}

body.zg-demo-prototype.demo-report-page .rv-dash-grid {
  grid-template-columns: minmax(200px, 280px) minmax(0, 1fr);
  gap: 20px;
}

body.zg-demo-prototype.demo-report-page .rv-toolbar .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);
  padding: 0;
}

body.zg-demo-prototype.demo-report-page .rv-toolbar .theme-toggle svg {
  width: 16px;
  height: 16px;
  position: absolute;
}

:root[data-theme="dark"] body.zg-demo-prototype.demo-report-page .rv-toolbar .theme-toggle .icon-sun { opacity: 1; }
:root[data-theme="dark"] body.zg-demo-prototype.demo-report-page .rv-toolbar .theme-toggle .icon-moon { opacity: 0; }
:root[data-theme="light"] body.zg-demo-prototype.demo-report-page .rv-toolbar .theme-toggle .icon-sun { opacity: 0; }
:root[data-theme="light"] body.zg-demo-prototype.demo-report-page .rv-toolbar .theme-toggle .icon-moon { opacity: 1; }

@media (max-width: 900px) {
  body.zg-demo-prototype.demo-report-page .rv-chrome-stack .rv-toolbar {
    height: auto;
    min-height: 60px;
    padding: 10px 16px;
  }

  body.zg-demo-prototype.demo-report-page #rv-root {
    padding: 0 16px !important;
  }

  body.zg-demo-prototype.demo-report-page .rv-document {
    padding: 8px 0 32px !important;
    padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body.zg-demo-prototype.demo-report-page .zg-demo-proto-head {
    padding: 12px 0 8px;
  }

  body.zg-demo-prototype.demo-report-page .rv-dash-grid,
  body.zg-demo-prototype.demo-report-page .rv-kpi-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Reading toolbar — horizontal scroll on narrow screens */
body.zg-demo-prototype.demo-report-page .rm-toolbar-bar {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

body.zg-demo-prototype.demo-report-page .rm-toolbar-bar::-webkit-scrollbar {
  display: none;
}

body.zg-demo-prototype.demo-report-page .rm-toolbar {
  flex-wrap: nowrap;
  min-width: min-content;
}

@media (max-width: 640px) {
  body.zg-demo-prototype.demo-report-page .rm-jump-btn,
  body.zg-demo-prototype.demo-report-page .rm-mode-btn,
  body.zg-demo-prototype.demo-report-page .rm-role-btn {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 10px;
  }

  body.zg-demo-prototype.demo-report-page .rm-toolbar-primary {
    gap: 8px;
  }
}

@media (max-width: 480px) {
  body.zg-demo-prototype.demo-report-page .rm-toolbar-primary {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  body.zg-demo-prototype.demo-report-page .rm-mode-switch,
  body.zg-demo-prototype.demo-report-page .rm-role-switch {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.zg-demo-prototype * {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
