:root {
  /* Simple, accessibility-friendly palette */
  --app-bg: #ffffff;
  --app-text: #111827;
  --card-bg: #ffffff;
  --card-border: #e5e7eb;
  --muted-text: #6b7280;
  --accent: #2563eb;
  --accent-2: #10b981;
  --nav-bg: #ffffff;
  --nav-border: #e5e7eb;
}


/* App shell */
.app-shell {
  min-height: 100vh;
  background: var(--app-bg);
  color: var(--app-text);
}

.app-body {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.app-sidebar {
  flex: 0 0 340px;
  max-width: 340px;
}

.app-main {
  flex: 1 1 0;
  min-width: 0;
}

@media (max-width: 992px) {
  .app-sidebar {
    flex: 1 1 100%;
    max-width: none;
  }
}

.app-navbar {
  background: var(--nav-bg) !important;
  border-bottom: 1px solid var(--nav-border) !important;
}


.app-navbar .nav-link {
  color: var(--app-text) !important;
}

.app-navbar .nav-link:hover {
  text-decoration: underline;
}

.app-navbar .nav-link.active {
  color: var(--app-text) !important;
  background: rgba(37, 99, 235, 0.10) !important;
  border: 1px solid rgba(37, 99, 235, 0.18) !important;
}

.app-navbar .navbar-brand {
  color: var(--app-text) !important;
}

@media (max-width: 992px) {
  .app-navbar .nav-link {
    padding: 10px 12px;
  }
}

.glass-card,
.card {
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.glass-card,
.glass-card * ,
.card,
.card * {
  color: var(--app-text);
}


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

/* Strategy Lab workspace */
.experiment-shell {
  overflow: hidden;
  border-radius: 22px !important;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.10) !important;
}

.experiment-shell > .card-body {
  padding: 0;
}

.experiment-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.5rem, 4vw, 3.5rem);
  background:
    radial-gradient(circle at 85% 20%, rgba(45, 212, 191, 0.32), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #1d4ed8 58%, #0f766e 120%);
}

.experiment-hero::after {
  content: "";
  position: absolute;
  width: 240px;
  height: 240px;
  right: -90px;
  bottom: -150px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
}

.experiment-eyebrow,
.section-kicker {
  color: #0f766e !important;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.experiment-eyebrow {
  color: #99f6e4 !important;
}

.experiment-title {
  max-width: 780px;
  margin: 0.35rem 0 0.65rem;
  color: #fff !important;
  font-size: clamp(2rem, 5vw, 4.25rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.experiment-subtitle {
  max-width: 680px;
  margin: 0;
  color: rgba(255, 255, 255, 0.82) !important;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.experiment-workflow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #dbeafe;
  border-bottom: 1px solid #bfdbfe;
}

.workflow-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.7rem;
  padding: 1rem 1.1rem;
  background: #eff6ff;
}

.workflow-step > span {
  grid-row: 1 / 3;
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  background: #2563eb;
  border-radius: 50%;
  font-weight: 800;
}

.workflow-step > strong {
  font-size: 0.92rem;
}

.workflow-step > small {
  color: var(--muted-text) !important;
}

.experiment-shell .btn-row.mb-2,
.experiment-mode-tabs,
.experiment-mode-tabs + .tab-content {
  margin-left: clamp(1rem, 3vw, 2.5rem);
  margin-right: clamp(1rem, 3vw, 2.5rem);
}

.experiment-shell .btn-row.mb-2 {
  margin-top: 1.25rem;
}

.experiment-mode-tabs .nav-link {
  padding: 0.9rem 1.2rem;
  border-radius: 12px 12px 0 0;
  font-weight: 700;
}

.lab-section-heading {
  margin: 0.5rem 0 1.2rem;
  padding-left: 1rem;
  border-left: 4px solid #14b8a6;
}

.lab-section-heading h4 {
  margin: 0.15rem 0 0.2rem;
}

.experiment-advanced {
  margin-bottom: 1rem;
}

.experiment-advanced .accordion-button {
  font-weight: 700;
  background: #f8fafc;
}

.experiment-command-bar {
  position: sticky;
  z-index: 10;
  bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
}

.experiment-run-actions {
  flex-direction: row;
}

.experiment-run-actions .btn:first-child {
  min-width: 150px;
}

/* Learn page */
.learn-page {
  max-width: 1320px;
  margin: 0 auto;
}

.learn-hero {
  padding: clamp(1.5rem, 4vw, 3.5rem);
  color: #fff;
  background: linear-gradient(135deg, #172554, #1e40af 62%, #0f766e);
  border-radius: 22px;
}

.learn-hero * {
  color: inherit;
}

.learn-kicker {
  color: #99f6e4 !important;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.learn-title {
  max-width: 820px;
  margin: 0.35rem 0 0.65rem;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.learn-intro {
  max-width: 760px;
  margin-bottom: 1.5rem;
  color: rgba(255, 255, 255, 0.82) !important;
  font-size: 1.08rem;
}

.learn-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.learn-anchor {
  padding: 0.5rem 0.75rem;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  text-decoration: none;
}

.learn-anchor:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lesson-card {
  position: relative;
  margin-bottom: 1rem;
  padding: clamp(1.2rem, 3vw, 2rem);
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  scroll-margin-top: 90px;
}

.lesson-number {
  display: inline-flex;
  width: 34px;
  height: 34px;
  margin-bottom: 0.75rem;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #2563eb;
  border-radius: 50%;
  font-weight: 800;
}

.learn-result {
  margin-top: 1rem;
  padding: 1rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 14px;
}

.lesson-score-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.lesson-score {
  display: flex;
  flex-direction: column;
  padding: 0.65rem;
  text-align: center;
  background: #fff;
  border-radius: 10px;
}

.lesson-score small {
  color: var(--muted-text);
}

.lesson-score strong {
  font-size: 1.75rem;
}

.concept-grid > div > div {
  height: 100%;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 12px;
}

.learn-sidebar {
  position: sticky;
  top: 86px;
  padding: 1.25rem;
  background: #f8fafc;
  border: 1px solid var(--card-border);
  border-radius: 16px;
}

.learn-sidebar dt {
  margin-top: 0.8rem;
}

.learn-sidebar dd {
  color: var(--muted-text);
}

/* Scorecard pills */
.scorecard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.score-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.02);
}

.score-label {
  font-size: 14px;
  color: var(--app-text);
  font-weight: 600;
}

.score-bubble {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  border: 1px solid transparent;
  flex: 0 0 auto;
}

.score-bubble-yes {
  color: #065f46;
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.35);
}

.score-bubble-no {
  color: var(--muted-text);
  background: rgba(107, 114, 128, 0.10);
  border-color: rgba(107, 114, 128, 0.25);
}

@media (max-width: 576px) {
  .scorecard-grid {
    grid-template-columns: 1fr;
  }
}

/* Focus states */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.55);
  outline-offset: 2px;
}

/* Dash DataTable */
.dash-table-container .dash-spreadsheet-container .dash-spreadsheet-inner table {
  border-color: var(--card-border) !important;
}

/* Button rows (wrap nicely on mobile) */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* Tabs: allow horizontal scroll on small screens */
@media (max-width: 576px) {
  .nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .nav-tabs .nav-link {
    white-space: nowrap;
  }
}

/* Mobile-first polish */
@media (max-width: 576px) {
  /* Reduce overall padding density */
  .card-body {
    padding: 0.95rem;
  }

  /* Navbar: make collapsed actions easy to tap */
  .app-navbar .navbar-collapse .nav-item,
  .app-navbar .navbar-collapse .nav-link,
  .app-navbar .navbar-collapse .btn {
    width: 100%;
  }
  .app-navbar .navbar-collapse .btn {
    justify-content: center;
  }

  /* Stack action buttons vertically (big touch targets) */
  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-row .btn {
    width: 100%;
  }

  .experiment-workflow {
    grid-template-columns: 1fr 1fr;
  }

  .workflow-step {
    padding: 0.8rem;
  }

  .workflow-step > small {
    display: none;
  }

  .experiment-shell .btn-row.mb-2,
  .experiment-mode-tabs,
  .experiment-mode-tabs + .tab-content {
    margin-left: 0.75rem;
    margin-right: 0.75rem;
  }

  .experiment-command-bar {
    align-items: stretch;
    flex-direction: column;
    bottom: 0.35rem;
  }

  .experiment-run-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .experiment-run-actions .btn,
  .experiment-run-actions .btn:first-child {
    width: auto;
    min-width: 0;
  }

  .experiment-run-actions .btn:first-child {
    grid-column: 1 / -1;
  }

  .learn-hero {
    border-radius: 16px;
  }

  .learn-nav {
    flex-direction: column;
  }

  .learn-anchor {
    border-radius: 10px;
  }

  .lesson-score-row {
    grid-template-columns: 1fr;
  }

  .learn-sidebar {
    position: static;
  }

  /* Tables: better horizontal swipe behavior */
  .dash-table-container,
  .dash-table-container .dash-spreadsheet-container {
    -webkit-overflow-scrolling: touch;
  }
}
