/* ==========================================================================
   Velio Tracking Suite — Executive Dashboard Stylesheet
   Theme: Dashboard Template Inspired (#eae9e9, #201e1d, #ec3013)
   ========================================================================== */

:root {
  --color-bg-app: #eae9e9;
  --color-header: #201e1d;
  --color-accent: #ec3013;
  --color-accent-hover: #d2280d;
  --color-accent-700: #8c1908;
  --color-neutral-900: #1d1d1f;
  --color-neutral-800: #2d2d2f;
  --color-neutral-600: #5d5d62;
  --color-neutral-500: #86868b;
  --color-neutral-300: #d2d2d7;
  --color-neutral-200: #e2e2e7;
  --color-neutral-100: #f5f5f7;
  --color-card-bg: #ffffff;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--color-bg-app);
  color: var(--color-neutral-900);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── App Layout: Left Sidebar + Main Content ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Left Sidebar Navigation ── */
.sidebar {
  width: 260px;
  background: var(--color-header);
  color: #ffffff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 0 8px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--color-accent);
  color: #ffffff;
  font-weight: 800;
  font-size: 20px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-info h2 {
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.brand-info span {
  font-size: 10px;
  color: #a0a0a0;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-menu-label {
  font-size: 10px;
  font-weight: 700;
  color: #76767a;
  letter-spacing: 0.08em;
  padding: 0 8px;
  margin-bottom: 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: #c0c0c0;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
}

.nav-item:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}

.nav-item.active {
  background: var(--color-accent);
  color: #ffffff;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.badge-status {
  font-size: 11px;
  font-weight: 700;
  color: #a0a0a0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #00c853;
  border-radius: 50%;
  box-shadow: 0 0 6px #00c853;
}

/* ── Main Content Area ── */
.main-content {
  flex: 1;
  padding: 24px 32px;
  max-width: 1500px;
  overflow-x: hidden;
}

/* ── Top Toolbar Header ── */
.top-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.toolbar-title-area h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-neutral-900);
}

.toolbar-subtitle {
  font-size: 11px;
  color: var(--color-neutral-500);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-refresh {
  background: var(--color-header);
  color: #ffffff;
  border: none;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-refresh:hover {
  background: #000000;
}

/* ── Filter Bar Toolbar ── */
.filter-bar {
  background: var(--color-card-bg);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.filter-item label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.select-control {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-sm);
  background-color: var(--color-neutral-100);
  color: var(--color-neutral-900);
  outline: none;
  cursor: pointer;
}

.select-control:focus {
  border-color: var(--color-accent);
}

/* Horizontal Date Pill Bar */
.date-pill-group {
  display: flex;
  background: var(--color-neutral-100);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-neutral-300);
  gap: 2px;
}

.date-pill-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-neutral-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.date-pill-btn:hover {
  background: var(--color-neutral-200);
  color: var(--color-neutral-900);
}

.date-pill-btn.active {
  background: var(--color-accent);
  color: #ffffff;
}

.custom-date-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
}

.custom-date-inputs input[type="date"] {
  padding: 5px 8px;
  font-size: 12px;
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-sm);
}

/* Scorecards */
.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.scorecard {
  background: var(--color-card-bg);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
}

.scorecard-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.scorecard-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--color-neutral-900);
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.scorecard-note {
  font-size: 11px;
  color: var(--color-neutral-500);
}

/* Card Panels */
.card-panel {
  background: var(--color-card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
  margin-bottom: 24px;
}

.panel-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--color-neutral-900);
  margin-bottom: 4px;
}

.panel-subtitle {
  font-size: 12px;
  color: var(--color-neutral-500);
  margin-bottom: 20px;
}

/* Funnel Bars Container */
.funnel-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
}

.funnel-step-name {
  width: 240px;
  font-weight: 600;
  color: var(--color-neutral-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 12px;
}

.funnel-bar-track {
  flex: 1;
  height: 28px;
  background: var(--color-neutral-100);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  display: flex;
  cursor: pointer;
}

.funnel-bar-fill {
  height: 100%;
  background: var(--color-header);
  transition: width 0.4s ease;
}

.funnel-bar-fill.skipped {
  background: #ff9800;
}

.funnel-meta {
  width: 220px;
  text-align: right;
  font-size: 12px;
  color: var(--color-neutral-600);
  padding-left: 12px;
}

.dropoff-tag {
  color: #d32f2f;
  font-weight: 700;
  margin-left: 4px;
}

.annotation-box {
  background: var(--color-neutral-100);
  border-left: 4px solid var(--color-accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-neutral-800);
  margin-top: 20px;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: var(--color-neutral-100);
  padding: 10px 14px;
  font-weight: 700;
  color: var(--color-neutral-600);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--color-neutral-200);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-neutral-200);
  color: var(--color-neutral-900);
}

.data-table tr:hover td {
  background: var(--color-neutral-100);
}

/* Dashboard B Reference Theme Overrides */
.ref-dashboard-box {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid #e2e2e7;
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.ref-dashboard-header {
  margin-bottom: 20px;
}

.ref-filter-pills-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ref-filter-label {
  font-size: 11px;
  font-weight: 700;
  color: #86868b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ref-pill-group {
  display: inline-flex;
  background: #ffffff;
  border: 1px solid #d2d2d7;
  border-radius: 4px;
  padding: 2px;
  gap: 2px;
}

.ref-pill-btn {
  background: transparent;
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #1d1d1f;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ref-pill-btn:hover {
  background: #f5f5f7;
}

.ref-pill-btn.active {
  background: #ec3013;
  color: #ffffff;
}

.ref-filter-callout {
  font-size: 11px;
  color: #ec3013;
  font-weight: 600;
  max-width: 420px;
  text-align: right;
  line-height: 1.4;
  border-left: 2px solid #ec3013;
  padding-left: 10px;
}

/* Grids */
.ref-grid-2col {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: stretch;
}

.ref-card {
  background: #f5f5f7;
  border: 1px solid #e2e2e7;
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  position: relative;
}

.ref-card-label {
  font-size: 10px;
  font-weight: 700;
  color: #86868b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.ref-card-sublabel {
  font-size: 11px;
  color: #86868b;
}

.ref-card-dashed-note {
  font-size: 10px;
  color: #86868b;
  border-bottom: 1px dashed #86868b;
}

/* Headline K Tile Monospace with Increased Vertical Height */
.headline-k-tile {
  background: #f5f5f7;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  min-height: 380px;
}

.ref-k-big-val {
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: 64px;
  font-weight: 900;
  color: #ec3013;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 10px 0;
}

.ref-k-verdict {
  font-size: 13px;
  color: #5d5d62;
  font-weight: 700;
}

.ref-k-divider {
  height: 1px;
  background: #d2d2d7;
  margin: 16px 0;
}

.ref-k-formula-box {
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #5d5d62;
  line-height: 1.6;
  background: rgba(0,0,0,0.03);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.ref-k-cycle-box {
  margin-top: 16px;
}

.ref-cycle-val {
  font-size: 24px;
  font-weight: 800;
  color: #1d1d1f;
  letter-spacing: -0.02em;
}

.ref-cycle-sub {
  font-size: 10px;
  color: #86868b;
}

.ref-scorecard-val {
  font-size: 30px;
  font-weight: 800;
  color: #1d1d1f;
  letter-spacing: -0.03em;
  margin: 4px 0;
}

.ref-scorecard-sub {
  font-size: 11px;
  color: #86868b;
}

/* Waterfall Rows */
.ref-waterfall-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ref-waterfall-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.ref-waterfall-stage-name {
  width: 220px;
  font-weight: 700;
  color: #1d1d1f;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
}

.ref-waterfall-bar-track {
  flex: 1;
  height: 24px;
  background: #e2e2e7;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.ref-waterfall-bar-fill {
  height: 100%;
  background: #ec3013;
  transition: width 0.4s ease;
}

.ref-waterfall-meta {
  width: 180px;
  text-align: right;
  font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, monospace;
  font-weight: 600;
  color: #1d1d1f;
}

/* Build Spec Footer Grid */
.ref-build-spec-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e2e2e7;
}

.ref-spec-card {
  background: #f5f5f7;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e2e7;
}

.ref-spec-title {
  font-size: 10px;
  font-weight: 800;
  color: #ec3013;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.ref-spec-body {
  font-size: 11px;
  color: #5d5d62;
  line-height: 1.4;
}

.tree-badge {
  font-size: 10px;
  font-weight: 800;
  background: #ec3013;
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.activated {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-badge.pending {
  background: #fff3e0;
  color: #ef6c00;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.bar-tooltip-popup {
  position: fixed;
  z-index: 1000;
  background: #201e1d;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 12px;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  max-width: 300px;
}

.bar-tooltip-popup.active {
  opacity: 1;
}

.tooltip-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tooltip-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
}

.tooltip-badge.optional {
  background: #ff9800;
  color: #000;
}

.tooltip-badge.required {
  background: var(--color-accent);
  color: #fff;
}

.tooltip-stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.tooltip-stat-label {
  color: #a0a0a0;
}

.tooltip-stat-val {
  font-weight: 700;
}

.tooltip-stat-val.accent {
  color: #ff9800;
}

.tooltip-bar-mini {
  height: 6px;
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  display: flex;
  overflow: hidden;
  margin-top: 8px;
}

.tooltip-bar-fill-dark {
  background: #ffffff;
}

.tooltip-bar-fill-red {
  background: #ff9800;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(234, 233, 233, 0.7);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-neutral-800);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-neutral-300);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .scorecard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .ref-grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Dashboard C Specific Metabase Reference Spec Layout Styles */
.c-headline-box {
  border: 2px solid #ec3013;
  border-radius: var(--radius-md);
  padding: 20px;
  background: #ffffff;
  margin-bottom: 16px;
}

.c-gen-cols-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 0 16px 0;
  align-items: flex-end;
}

.c-gen-col-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.c-gen-val {
  font-size: 28px;
  font-weight: 800;
  color: #1d1d1f;
  margin-bottom: 8px;
}

.c-gen-val.accent {
  color: #ec3013;
}

.c-gen-val.seed {
  font-size: 24px;
  color: #86868b;
  font-weight: 700;
}

.c-gen-bar {
  width: 100%;
  height: 12px;
  border-radius: 2px;
  background: #e2e2e7;
}

.c-gen-bar.seed { background: #1d1d1f; height: 4px; }
.c-gen-bar.dark { background: #3a3a3c; height: 40px; }
.c-gen-bar.red { background: #ec3013; height: 16px; }
.c-gen-bar.red-sm { background: #ec3013; height: 8px; }

.c-gen-label {
  font-size: 13px;
  font-weight: 700;
  color: #1d1d1f;
  margin-top: 10px;
}

.c-gen-sub {
  font-size: 11px;
  color: #86868b;
}

.c-insight-banner {
  background: rgba(236, 48, 19, 0.06);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #ec3013;
  margin-top: 12px;
}

/* ── Slide-Over Story Drawer Styles ── */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 9998;
  transition: opacity 0.3s ease;
}

.story-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 440px;
  max-width: 90vw;
  height: 100vh;
  background: #ffffff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-drawer.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e2e7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafafa;
}

.drawer-close-btn {
  background: transparent;
  border: none;
  font-size: 18px;
  font-weight: 700;
  color: #86868b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.drawer-close-btn:hover {
  background: #e2e2e7;
  color: #1d1d1f;
}

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.timeline-item {
  position: relative;
  padding-left: 32px;
  padding-bottom: 24px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: #e2e2e7;
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: absolute;
  left: 3px;
  top: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ec3013;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 2px #ec3013;
}

.timeline-title {
  font-size: 14px;
  font-weight: 700;
  color: #1d1d1f;
}

.timeline-time {
  font-size: 11px;
  color: #86868b;
  margin-bottom: 4px;
}

.timeline-detail {
  font-size: 12px;
  color: #3a3a3c;
  background: #f5f5f7;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 6px;
}

