:root {
  --bg: #f4f7fb;
  --bg-alt: #eaf0f8;
  --text: #0f172a;
  --text-muted: #475569;
  --card: rgba(255, 255, 255, 0.9);
  --card-soft: rgba(248, 250, 252, 0.85);
  --border: rgba(215, 225, 238, 0.9);
  --accent: #0ea5e9;
  --accent-strong: #0369a1;
  --success: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --glow: 0 0 0 transparent;
  --shadow: 0 16px 28px -20px rgba(15, 23, 42, 0.45);
}

html[data-theme="dark"] {
  --bg: #050816;
  --bg-alt: #0d1329;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --card: rgba(17, 27, 51, 0.72);
  --card-soft: rgba(23, 35, 63, 0.75);
  --border: rgba(56, 189, 248, 0.2);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --success: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
  --glow: 0 0 24px rgba(56, 189, 248, 0.18);
  --shadow: 0 22px 36px -26px rgba(0, 0, 0, 0.9);
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

body {
  position: relative;
  min-height: 100vh;
  background: radial-gradient(circle at 5% 0%, var(--bg-alt), var(--bg));
  color: var(--text);
}

body.ecr-futuristic::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(120deg, #020617, #0f172a, #082f49, #0f172a, #020617);
  background-size: 320% 320%;
  animation: gradientShift 18s ease infinite;
  opacity: 0.45;
  pointer-events: none;
}

body.ecr-futuristic::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.06;
  background-image: radial-gradient(circle at 1px 1px, #fff 1px, transparent 0);
  background-size: 3px 3px;
}

.ecr-surface {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ecr-soft {
  background: var(--card-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.ecr-pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ecr-badge-demo {
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  background: rgba(56, 189, 248, 0.14);
}

.ecr-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.ecr-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -16px rgba(56, 189, 248, 0.8);
  border-color: rgba(56, 189, 248, 0.55);
}

.ecr-btn:focus-visible {
  outline: 2px solid rgba(56, 189, 248, 0.6);
  outline-offset: 2px;
}

.ecr-btn::after {
  content: "";
  position: absolute;
  width: 160px;
  height: 160px;
  left: var(--ripple-x, 50%);
  top: var(--ripple-y, 50%);
  border-radius: 999px;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(255, 255, 255, 0.25);
  transition: transform 0.5s ease, opacity 0.5s ease;
  opacity: 0;
  pointer-events: none;
}

.ecr-btn:active::after {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.ecr-btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  border-color: transparent;
}

.ecr-muted {
  color: var(--text-muted);
}

.ecr-kpi-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.ecr-kpi-value {
  font-size: 1.95rem;
  font-weight: 700;
  line-height: 1.15;
}

.ecr-delta {
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  border: 1px solid transparent;
}

.ecr-delta-up {
  color: #86efac;
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.44);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.22);
}

.ecr-delta-down {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.44);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.22);
}

.ecr-skeleton {
  min-height: 124px;
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.15) 25%, rgba(148, 163, 184, 0.28) 50%, rgba(148, 163, 184, 0.15) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.ecr-fade-up {
  animation: ecrFadeUp 0.36s ease both;
}

@keyframes ecrFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bo-left-nav {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding-right: 0.25rem;
}

.bo-accordion-section {
  border: 1px solid rgba(56, 189, 248, 0.15);
  border-radius: 12px;
  margin-bottom: 0.55rem;
  background: rgba(15, 23, 42, 0.28);
}

.bo-accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.75rem;
  font-size: 0.83rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.bo-accordion-toggle:hover {
  color: #bae6fd;
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.bo-chevron {
  transition: transform 0.25s ease;
}

.bo-chevron.is-open {
  transform: rotate(180deg);
}

.bo-accordion-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.bo-route-link {
  display: block;
  margin: 0.25rem 0.5rem 0.45rem;
  border: 1px solid transparent;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  font-size: 0.86rem;
}

.bo-route-link:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.bo-route-link.is-active {
  border-color: rgba(56, 189, 248, 0.5);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(14, 165, 233, 0.08));
  color: #e0f2fe;
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.16);
}

.ecr-breadcrumb a {
  color: #7dd3fc;
}

.ecr-breadcrumb a:hover {
  color: #bae6fd;
  text-decoration: underline;
}

.ecr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  display: grid;
  place-items: center;
  z-index: 9999;
}

.ecr-modal {
  width: min(760px, 92vw);
  max-height: 85vh;
  overflow: auto;
  border-radius: 16px;
}

.tabulator {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
}

.tabulator .tabulator-header {
  background: rgba(15, 23, 42, 0.75);
  color: #cbd5e1;
  position: sticky;
  top: 0;
  z-index: 2;
}

.tabulator .tabulator-header .tabulator-col,
.tabulator .tabulator-row .tabulator-cell {
  border-right-color: var(--border);
}

.tabulator .tabulator-row {
  border-top-color: var(--border);
  transition: background 0.2s ease, transform 0.2s ease;
}

.tabulator .tabulator-row:hover {
  background: rgba(56, 189, 248, 0.08);
}
