:root {
  --header-h: 64px;
  --sticky-z: 1045;
}

.sim-header {
  position: sticky;
  top: 0;
  z-index: var(--sticky-z);
  backdrop-filter: saturate(1.2) blur(4px);
  border-bottom: 1px solid var(--border-1, rgba(255,255,255,.2));
}

.sim-top-strip,
.sim-bottom-strip {
  min-height: 78px;
  background: var(--navbar-bg-color, #1f1f1f);
  color: var(--text-color, #fff);
}

.sim-header-container,
.sim-footer-container {
  padding-left: 4px;
  padding-right: 4px;
}

@media (min-width: 768px) {
  .sim-header-container,
  .sim-footer-container {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (min-width: 992px) {
  .sim-header-container,
  .sim-footer-container {
    padding-left: 12px;
    padding-right: 12px;
  }
}

.navbar .navbar-brand {
  padding-left: 0;
  margin-left: 0;
  margin-right: 0;
}

.sim-logo {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  object-fit: contain;
  margin-left: 0;
}

.sim-auth-area {
  position: relative;
  overflow: visible;
  margin-inline-end: 0;
}

.sim-nav {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.sim-header-container.navbar {
  flex-wrap: nowrap;
  position: relative;
  direction: ltr;
}

.sim-nav-left {
  display: flex;
  align-items: center;
  gap: .1rem;
  flex-shrink: 0;
}

/* Absolutely centered — doesn't push left/right content */
.sim-admin-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: .15rem;
  pointer-events: all;
  direction: ltr;
}

html[dir="rtl"] .sim-admin-nav {
  direction: rtl;
}

.sim-nav-right {
  margin-left: auto;
  margin-right: 5vw;
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .sim-nav-right {
    margin-right: 0;
  }
}

.sim-nav-link {
  color: var(--text-color, #fff);
  text-decoration: none;
  border-radius: 6px;
  padding: .5rem 1rem;
  line-height: 1.1;
  white-space: nowrap;
  font-size: 15px;
}

.sim-nav-link:hover,
.sim-nav-link:focus {
  color: var(--primary-color, #0d6efd);
  background: var(--hover-bg-color, rgba(255,255,255,.08));
}

@media (max-width: 767.98px) {
  .sim-admin-nav {
    gap: 0;
  }
  .sim-nav-link {
    padding: .15rem .2rem;
    font-size: clamp(8px, 1.9vw, 12px);
    border-radius: 4px;
  }
  .sim-nav-left {
    margin-left: 0;
  }
  .sim-nav-left .sim-icon-btn,
  .sim-nav-right .sim-icon-btn {
    padding: 0 !important;
  }
  #nav-logo-link {
    margin-left: 5vw;
  }
}

.sim-icon-btn {
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}

.sim-auth-icon {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
  object-fit: contain;
  display: block;
  transition: transform 0.15s ease-out;
}

.sim-auth-icon:hover {
  transform: scale(1.12);
}

#auth-login-icon {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
}

#auth-profile-icon {
  width: 40px;
  height: 40px;
  max-width: 40px;
  max-height: 40px;
}

@media (min-width: 768px) {
  .sim-auth-icon,
  #auth-login-icon,
  #auth-profile-icon {
    width: 48px;
    height: 48px;
    max-width: 48px;
    max-height: 48px;
  }
}

/* User menu dropdown */
.sim-user-menu-toggle::after {
  display: none;
}

.sim-user-dropdown {
  width: max-content;
  min-width: 150px;
  max-width: 200px;
  padding: .25rem 0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

.sim-user-dropdown .dropdown-item {
  padding: .45rem .8rem;
  font-size: .875rem;
  gap: .5rem;
}

.sim-dropdown-icon {
  width: 18px;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: .85;
}

#theme-icon {
  width: 43px;
  height: 43px;
}

.sim-login-icon {
  transform-origin: 50% 50%;
  will-change: transform;
  animation: simLoginTwistPulse 2.5s ease-in-out infinite;
}

@keyframes simLoginTwistPulse {
  0% { transform: rotate(0deg); }
  6% { transform: rotate(-7deg); }
  12% { transform: rotate(7deg); }
  18% { transform: rotate(-5deg); }
  24% { transform: rotate(4deg); }
  30% { transform: rotate(0deg); }
  100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .sim-login-icon {
    animation: none !important;
  }
}

.sim-accessibility-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(0, 0, 0, .15);
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

.sim-footer {
  position: relative;
  border-top: 1px solid var(--border-1, rgba(0,0,0,.2));
}

.sim-footer-nav {
  gap: .3rem 1.35rem;
}

.sim-footer-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--bs-secondary-color);
  text-decoration: none;
  text-transform: uppercase;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .045em;
  line-height: 1.6;
  transition: color .15s ease;
}

.sim-footer-link:hover,
.sim-footer-link:focus-visible {
  color: var(--primary-color, var(--bs-primary));
}

.sim-footer-link-btn {
  cursor: pointer;
}

.sim-footer-dot {
  color: var(--bs-border-color);
  font-size: .9rem;
  line-height: 1;
}

.sim-footer-accessibility {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

.sim-footer-accessibility svg {
  width: 20px;
  height: 20px;
}

body.sim-a11y-text-lg {
  font-size: 1.05rem;
}

body.sim-a11y-high-contrast {
  filter: contrast(1.08) saturate(1.04);
}

body.sim-a11y-reduce-motion *,
body.sim-a11y-reduce-motion *::before,
body.sim-a11y-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
}

.auth-wrap {
  min-height: 70vh;
}

.home-shell {
  min-height: calc(100vh - 156px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

.home-shell-compact {
  min-height: 0;
  padding: 2rem 1rem 1rem;
}

.home-panel {
  max-width: 820px;
  text-align: center;
}

.home-panel-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  text-align: center;
  max-width: 960px;
  width: 100%;
}

.home-panel-compact .home-logo {
  width: 160px;
  height: 160px;
  margin-bottom: .15rem;
  border-radius: 14px;
}

.home-panel-compact h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.home-logo {
  width: 140px;
  height: 140px;
  object-fit: contain;
  border-radius: 14px;
  margin-bottom: 1.25rem;
}


.home-actions {
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

/* Dedicated error pages (403, etc.) — reuse .home-shell/.home-panel centering */
.sim-error-eyebrow {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
  font-weight: 700;
  color: var(--bs-primary);
  margin-bottom: .5rem;
}

.sim-error-title {
  font-family: 'Frank Ruhl Libre', Georgia, serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  margin-bottom: .85rem;
}

.sim-error-body {
  font-size: 1rem;
  color: var(--bs-secondary-color);
  max-width: 520px;
  margin: 0 auto 1.75rem;
  line-height: 1.6;
}

.sim-error-actions {
  display: flex;
  justify-content: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.home-branch-grid {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 680px;
  margin-inline: auto;
}

.home-branch-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-decoration: none;
  color: inherit;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid var(--bs-border-color, #dee2e6);
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  transition: border-color .15s, box-shadow .15s, transform .15s;
  width: clamp(200px, 42vw, 280px);
  background: var(--bs-body-bg, #fff);
  cursor: pointer;
}

.home-branch-card:hover,
.home-branch-card:focus-visible {
  border-color: var(--bs-primary);
  box-shadow: 0 6px 24px rgba(0,0,0,.14);
  transform: translateY(-4px);
  color: inherit;
}

.home-branch-img {
  width: 100%;
  height: auto;
  display: block;
}

.home-branch-label {
  padding: .65rem 1rem;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  border-top: 1px solid var(--bs-border-color, #dee2e6);
}

@media (max-width: 480px) {
  .home-branch-card {
    width: min(280px, 80vw);
  }
}

.auth-card {
  width: 100%;
  max-width: 440px;
}

.auth-card-wide {
  max-width: 720px;
}

.auth-card-pricing {
  width: min(1440px, 94vw);
  max-width: none;
}

.signup-shell {
  width: 100%;
}

.auth-muted {
  opacity: .75;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  opacity: .2;
  background: currentColor;
}

.auth-control input[type="text"],
.auth-control input[type="email"],
.auth-control input[type="password"],
.auth-control input[type="search"] {
  width: 100%;
}

.signup-plan-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  width: min(100%, 1280px);
  margin-inline: auto;
}

.signup-pricing-group {
  padding: 0;
  background: transparent;
}

.signup-pricing-head {
  margin-bottom: .75rem;
  text-align: center;
}

.signup-pricing-head span {
  display: block;
  font-size: .84rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bs-secondary-color);
}

.signup-pricing-head p {
  margin: .25rem 0 0;
  color: var(--bs-secondary-color);
  line-height: 1.35;
}

.signup-pricing-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.signup-pricing-head {
  grid-column: 1 / -1;
}

.signup-price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  min-height: 260px;
  padding: clamp(.85rem, 1.1vw, 1.15rem);
  border: 1px solid color-mix(in srgb, var(--bs-border-color) 65%, transparent);
  border-radius: 8px;
  background: var(--bs-body-bg);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}

.signup-price-card + .signup-price-card {
  margin-top: 0;
}

.signup-price-card:hover,
.signup-price-card:focus-within {
  border-color: var(--bs-primary);
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

.signup-price-card input {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.signup-price-card:has(input:checked) {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-primary) 18%, transparent);
}

.signup-price-card-featured {
  border-color: color-mix(in srgb, var(--bs-primary) 45%, var(--bs-border-color));
}

.signup-tier-kicker,
.signup-price-card strong,
.signup-price-card small {
  display: block;
}

.signup-tier-kicker {
  color: var(--bs-secondary-color);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.signup-price-card strong {
  font-size: clamp(1rem, 1.25vw, 1.25rem);
  line-height: 1.15;
  padding-right: 2rem;
}

.signup-price {
  font-size: clamp(1.35rem, 1.9vw, 1.75rem);
  font-weight: 700;
  line-height: 1.1;
}

.signup-price span {
  font-size: .85rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.signup-price-card small {
  color: var(--bs-secondary-color);
  line-height: 1.35;
}

.signup-price-card ul {
  margin: .35rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--bs-body-color);
}

.signup-price-card li {
  position: relative;
  padding-left: 1.25rem;
  margin-top: .45rem;
  font-size: clamp(.78rem, .85vw, .9rem);
}

.signup-price-card li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--bs-secondary-color);
}

.signup-fields {
  width: min(100%, 460px);
  margin: 1.5rem auto 0;
}

.signup-fields h2 {
  font-size: 1rem;
  text-align: center;
  margin-bottom: 1rem;
}

.signup-fields-secondary {
  margin-top: 1rem;
}

@media (max-width: 760px) {
  .signup-pricing-group {
    grid-template-columns: 1fr;
  }

  .signup-price-card {
    min-height: 0;
  }
}

@media (max-width: 700px) {
  .auth-card-pricing {
    width: min(100%, 98vw);
  }

  .auth-card-pricing .p-4 {
    padding-inline: .75rem !important;
  }

  .signup-pricing-head {
    text-align: start;
  }
}

.google-auth-logo {
  width: 64px;
  height: auto;
  display: inline-block;
}

.sim-workspace {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.sim-page-head,
.sim-detail-head,
.sim-section-title,
.sim-filter-bar,
.sim-head-actions,
.sim-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.sim-page-head,
.sim-detail-head {
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.sim-page-head h1,
.sim-detail-head h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.3rem);
}

.sim-page-head p,
.sim-detail-head p,
.sim-muted {
  color: var(--bs-secondary-color);
}

.sim-filter-bar {
  align-items: stretch;
  margin-bottom: 1rem;
}

.sim-filter-bar input {
  min-width: 0;
  flex: 1 1 320px;
}

.sim-filter-bar select {
  flex: 0 1 180px;
}

.sim-table {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  overflow: hidden;
}

.sim-dashboard-list {
  display: grid;
  gap: 0;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.04));
}
@media (prefers-color-scheme: dark) {
  .sim-dashboard-list { box-shadow: none; }
}
:root[data-bs-theme="dark"]  .sim-dashboard-list { box-shadow: none; }
:root[data-bs-theme="light"] .sim-dashboard-list {
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.04));
}

.sim-dashboard-item {
  border-bottom: 1px solid var(--bs-border-color);
  padding: .85rem 1rem;
}
.sim-dashboard-item:last-child {
  border-bottom: none;
}

.sim-dashboard-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.sim-simulation-link {
  text-decoration: none;
  color: inherit;
  display: block;
  text-align: left;
  padding: .35rem 0;
  min-width: 0;
}

.sim-simulation-link:hover .sim-dashboard-name,
.sim-simulation-link:focus .sim-dashboard-name {
  color: var(--bs-link-color);
}

.sim-dashboard-name {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  font-weight: 700;
  line-height: 1.15;
}

.sim-dashboard-fast-actions {
  align-items: center;
}

.sim-dashboard-expanded {
  padding: .75rem 0 1rem;
}

.sim-collapse-strip {
  display: flex;
  gap: .5rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: .65rem 0;
  border-top: 1px solid var(--bs-border-color);
  border-bottom: 1px solid var(--bs-border-color);
  margin: .75rem 0;
}

.sim-collapse-strip::-webkit-scrollbar {
  display: none;
}

.sim-collapse-strip a {
  text-decoration: none;
  padding: .35rem .65rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sim-collapse-strip a:hover,
.sim-collapse-strip a:focus {
  background: var(--bs-tertiary-bg);
}

.sim-dashboard-expanded-body {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.sim-dashboard-expanded-body h2 {
  font-size: 1.2rem;
  margin: 0 0 .25rem;
}

.sim-dashboard-expanded-body p {
  margin: 0;
  color: var(--bs-secondary-color);
}

.sim-dashboard-status-block {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sim-table-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.8fr) 110px 140px 100px 100px minmax(250px, 1fr);
  gap: 1rem;
  align-items: center;
  padding: .95rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.sim-table-row:last-child {
  border-bottom: 0;
}

.sim-table-head {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
  color: var(--bs-secondary-color);
  background: rgba(127, 127, 127, .08);
}

.sim-title-link {
  font-weight: 700;
  text-decoration: none;
}

.sim-mobile-meta {
  display: none;
}

.sim-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sim-status,
.sim-chip {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--bs-border-color);
}

.sim-status-active,
.sim-status-completed,
.sim-status-running,
.sim-status-pending {
  color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
  border-color: color-mix(in srgb, var(--bs-primary) 30%, transparent);
}

.sim-status-paused,
.sim-status-cancel_requested {
  color: var(--bs-secondary-color);
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
}

.sim-status-archived,
.sim-status-failed {
  color: #842029;
  background: rgba(220, 53, 69, .14);
  border-color: rgba(220, 53, 69, .25);
}

.llm-pick-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .25rem;
}

.llm-pick-card {
  flex: 1 1 0;
  min-width: 7rem;
  max-width: 13rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .65rem .9rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: center;
  transition: border-color .12s, background .12s;
}

.llm-pick-card:hover {
  border-color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle, rgba(13,110,253,.08));
}

.llm-pick-card.active {
  border-color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle, rgba(13,110,253,.12));
  color: var(--bs-primary);
}

.llm-pick-card strong { display: block; font-size: .9rem; }
.llm-pick-card small  { font-size: .75rem; opacity: .7; }

.llm-test-result { transition: color .2s; }

.sim-chip-sm {
  font-size: .72rem;
  min-height: 1.35rem;
  padding: .1rem .4rem;
  width: fit-content;
  align-self: flex-start;
  max-width: max-content;
}

.sim-llm-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  min-width: 0;
}

.sim-chip-active {
  color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 12%, transparent);
  border-color: color-mix(in srgb, var(--bs-primary) 30%, transparent);
}

.sim-chip-progress {
  color: var(--bs-secondary-color);
  background: var(--bs-secondary-bg);
  border-color: var(--bs-border-color);
}

.sim-chip-failed {
  color: #842029;
  background: rgba(220, 53, 69, .14);
  border-color: rgba(220, 53, 69, .25);
}

.sim-empty {
  padding: 3rem 1rem;
  text-align: center;
}

.sim-crumb {
  font-size: .9rem;
  margin-bottom: .25rem;
  color: var(--bs-secondary-color);
}

.sim-section-nav {
  position: sticky;
  top: 78px;
  z-index: 2;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: .5rem;
  padding: .65rem 0;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  margin-bottom: 1rem;
}

.sim-section-nav::-webkit-scrollbar {
  display: none;
}

.sim-section-nav a {
  text-decoration: none;
  padding: .35rem .65rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.sim-section-nav a:hover,
.sim-section-nav a:focus {
  background: var(--bs-tertiary-bg);
}

.sim-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}

.sim-metrics div {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: .9rem;
}

.sim-metrics strong {
  display: block;
  font-size: 1.6rem;
}

.sim-metrics span {
  color: var(--bs-secondary-color);
}

.sim-section {
  padding: 1.5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  background: var(--bs-body-bg);
  margin-bottom: 1rem;
  scroll-margin-top: 150px;
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.04));
}
@media (prefers-color-scheme: dark) {
  .sim-section { box-shadow: none; }
}
:root[data-bs-theme="dark"]  .sim-section { box-shadow: none; }
:root[data-bs-theme="light"] .sim-section {
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.04));
}

.sim-section-title {
  justify-content: space-between;
  margin-bottom: .75rem;
}

.sim-section h2 {
  margin: 0;
  font-size: 1.25rem;
}

.sim-section h3 {
  font-size: 1rem;
  margin-bottom: .5rem;
}

.sim-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.sim-preline {
  white-space: pre-line;
}

.sim-check-list {
  display: grid;
  gap: .5rem;
}

.sim-check {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: .75rem;
  align-items: start;
  padding: .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
}

.sim-check > span {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sim-check p {
  margin: .15rem 0 0;
  color: var(--bs-secondary-color);
}

.sim-check.is-ok > span {
  color: #198754;
}

.sim-check.is-warn > span {
  color: #b58100;
}

.sim-compact-list {
  display: grid;
  gap: .5rem;
}

.sim-list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
}

.sim-list-item span {
  display: block;
}

/* Participants list — email label */
.sim-user-email {
  font-size: .9rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Participants list — horizontal role chips */
.sim-user-roles {
  display: flex;
  flex-wrap: nowrap;
  gap: .3rem;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
}

.sim-user-code {
  font-size: .8rem;
  white-space: nowrap;
}

.sim-role-checkboxes {
  display: grid;
  gap: .5rem;
}

@media (max-width: 480px) {
  .sim-user-roles .sim-chip-sm {
    font-size: .6rem;
    padding: .15rem .4rem;
  }
}

/* Radio-option rows in modals (download modal, etc.) */
.sim-radio-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .65rem .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.sim-radio-option:has(input:checked) {
  border-color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 5%, transparent);
}

.sim-radio-option input[type="radio"] {
  flex-shrink: 0;
  margin-top: .2rem;
  accent-color: var(--bs-primary);
}

/* Variable checkbox list in Run Analysis modal */
.sim-var-cb-list {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  overflow: hidden;
}

.sim-var-cb-header {
  background: var(--bs-tertiary-bg, rgba(0,0,0,.04));
  border-bottom: 1px solid var(--bs-border-color);
  margin-bottom: 0;
  cursor: pointer;
  padding: .55rem .75rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  font-size: .9rem;
}

.sim-var-cb-items {
  padding: .25rem .5rem .25rem .75rem;
}

.sim-var-cb-row {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .35rem .25rem;
  cursor: pointer;
  font-size: .9rem;
  border-radius: 4px;
  margin-bottom: 0;
}

.sim-var-cb-row:hover {
  background: var(--bs-tertiary-bg, rgba(0,0,0,.03));
}

.sim-var-cb-row .form-check-input {
  flex-shrink: 0;
  margin-top: .15rem;
  accent-color: var(--bs-primary);
}

.sim-run-banner {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: center;
  padding: .75rem;
  border: 1px solid rgba(25, 135, 84, .25);
  border-radius: 8px;
  background: rgba(25, 135, 84, .08);
  margin-bottom: .75rem;
}

.sim-danger-zone {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--bs-border-color);
}

.sim-form-page {
  max-width: 960px;
}


.sim-edit-form {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 1rem;
}

.sim-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.sim-form-field-wide {
  grid-column: 1 / -1;
}

.sim-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.sim-inline-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.sim-inline-form input {
  width: min(260px, 100%);
}

@media (max-width: 767.98px) {
  .sim-logo {
    width: clamp(50px, 14vw, 58px);
    height: clamp(50px, 14vw, 58px);
  }

  .sim-header-container.navbar {
    padding-left: 0;
    padding-right: 0;
  }

  .sim-auth-icon:hover {
    transform: scale(1.05);
  }

  .sim-top-strip,
  .sim-bottom-strip {
    min-height: 66px;
  }

  .sim-nav {
    order: 3;
    width: 100%;
    padding-bottom: .5rem;
  }

  .sim-workspace {
    padding: 1rem .75rem 2rem;
  }

  .sim-page-head,
  .sim-detail-head,
  .sim-filter-bar,
  .sim-section-title,
  .sim-dashboard-summary,
  .sim-dashboard-expanded-body,
  .sim-list-item {
    align-items: stretch;
    flex-direction: column;
  }

  .sim-dashboard-summary,
  .sim-dashboard-expanded-body {
    display: flex;
  }

  .sim-head-actions,
  .sim-actions {
    justify-content: flex-start;
  }

  .sim-filter-bar select,
  .sim-filter-bar input {
    flex-basis: auto;
  }

  .sim-table {
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .sim-table-head {
    display: none;
  }

  .sim-table-row {
    display: block;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: .75rem;
  }

  .sim-table-row > div {
    margin-bottom: .65rem;
  }

  .sim-table-row > div:last-child {
    margin-bottom: 0;
  }

  .sim-table-row > div[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    color: var(--bs-secondary-color);
    margin-bottom: .2rem;
  }

  .sim-mobile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: .35rem;
    color: var(--bs-secondary-color);
    font-size: .9rem;
  }

  .sim-section-nav {
    position: static;
  }

  .sim-two-col,
  .sim-form-grid {
    grid-template-columns: 1fr;
  }

  .sim-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .35rem;
  }

  .sim-metrics div {
    min-width: 0;
    padding: .5rem .25rem;
    text-align: center;
  }

  .sim-metrics strong {
    font-size: clamp(.95rem, 5vw, 1.25rem);
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sim-metrics span {
    display: block;
    font-size: clamp(.5rem, 2.1vw, .72rem);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sim-check {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .sim-footer-accessibility {
    right: 6px;
  }
}

@media (max-width: 767.98px) {
  .sim-metrics {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    align-items: stretch;
    gap: clamp(.2rem, 1.5vw, .4rem);
    width: 100%;
  }

  .sim-metrics > div {
    width: auto;
    min-width: 0;
    max-width: none;
    padding: clamp(.35rem, 1.8vw, .5rem) .15rem;
    box-sizing: border-box;
  }

  .sim-metrics > div strong {
    font-size: clamp(.78rem, 4.5vw, 1.18rem);
  }

  .sim-metrics > div span {
    font-size: clamp(.42rem, 2.2vw, .68rem);
    letter-spacing: 0;
  }
}

[dir="auto"],
textarea[dir="auto"],
input[dir="auto"] {
  unicode-bidi: plaintext;
}

.sim-workspace textarea[dir],
.sim-workspace input[dir] {
  text-align: start;
  unicode-bidi: plaintext;
}

.sim-workspace textarea[dir="rtl"],
.sim-workspace input[dir="rtl"] {
  direction: rtl;
}

.sim-workspace textarea[dir="ltr"],
.sim-workspace input[dir="ltr"] {
  direction: ltr;
}

.sim-field-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  margin-inline-start: .35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--bs-secondary-color);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: text-top;
  padding: 0;
}

.sim-field-help:hover,
.sim-field-help:focus {
  color: var(--bs-body-color);
  background: transparent;
  box-shadow: none;
}

.sim-field-help-source {
  display: none;
}

.sim-help-popover {
  --bs-popover-max-width: 260px;
  --bs-popover-border-radius: 8px;
  --bs-popover-body-padding-x: .75rem;
  --bs-popover-body-padding-y: .6rem;
  font-size: .85rem;
}

.chat-preview-shell,
.chat-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0;
}

.chat-preview-panel,
.chat-main,
.chat-side {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
}

.chat-preview-panel {
  padding: 1.25rem;
}

.chat-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.chat-preview-head h1,
.chat-side h1 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  margin: .35rem 0;
}

.chat-preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 1rem;
}

.chat-preview-section {
  padding: 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
}

.chat-preview-section h2 {
  font-size: 1.05rem;
  margin-bottom: .85rem;
}

.chat-instructions {
  color: var(--bs-body-color);
}

.chat-ai-disclaimer {
  border-inline-start: 4px solid var(--bs-warning);
  background: rgba(255, 193, 7, .12);
  padding: .75rem .85rem;
  border-radius: 6px;
}

.chat-ai-disclaimer-attention {
  border-color: var(--bs-danger);
  background: rgba(220, 53, 69, .14);
  box-shadow: 0 0 0 .2rem rgba(220, 53, 69, .18);
}

.chat-preview-actions {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  margin-top: 1rem;
}

body:has(.chat-conversation-shell) main > .container-fluid {
  padding-inline: 0;
}

body:has(.chat-conversation-shell) .sim-footer {
  display: none;
}

body:has(.chat-conversation-shell) main {
  min-height: calc(100dvh - 78px);
}

.chat-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 190px);
}

.chat-conversation-shell {
  width: 100vw;
  min-height: calc(100dvh - 78px);
  margin-inline: calc(50% - 50vw);
  padding: clamp(.65rem, 1.5vw, 1.1rem);
  display: flex;
  grid-template-columns: none;
  background:
    radial-gradient(560px 280px at 12% 0%, rgba(13, 110, 253, .10), transparent 70%),
    radial-gradient(620px 320px at 88% 8%, rgba(32, 201, 151, .08), transparent 68%),
    var(--background-color, var(--bs-body-bg));
}

.chat-main {
  width: 100%;
  min-height: calc(100vh - 190px);
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .08);
}

.chat-conversation-shell .chat-main {
  min-height: 0;
  height: calc(100dvh - 78px - clamp(1.3rem, 3vw, 2.2rem));
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-side {
  padding: 1rem;
  align-self: start;
}

.chat-side-block + .chat-side-block {
  margin-top: 1rem;
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .35rem clamp(.2rem, 1.4vw, 1rem) .75rem;
  border-bottom: 0;
}

.chat-title-group {
  min-width: 0;
}

.chat-title-group h1 {
  font-size: clamp(1.05rem, 1.1vw, 1.25rem);
  line-height: 1.25;
  margin: .15rem 0 0;
  overflow-wrap: anywhere;
}

.chat-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
}

.chat-thread {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: clamp(.75rem, 1.8vw, 1.4rem) clamp(.35rem, 1.5vw, 1.1rem);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  background: transparent;
}

.chat-message {
  max-width: min(74ch, 86%);
  padding: .78rem .9rem;
  border-radius: 16px;
  border: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
}

.chat-message-user {
  align-self: flex-end;
  background: rgba(13, 110, 253, .12);
  border-bottom-right-radius: 6px;
}

.chat-message-bot {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
}

.chat-message-ltr {
  text-align: left;
}

.chat-message-rtl {
  text-align: right;
}

.chat-message-system {
  align-self: center;
  max-width: min(80ch, 96%);
  background: rgba(108, 117, 125, .08);
  font-size: .84rem;
  border-style: dashed;
}

/* Observer comment visible to participant — amber tint, centered, non-intrusive */
.chat-message-assistant {
  align-self: center;
  max-width: min(74ch, 86%);
  background: color-mix(in srgb, var(--bs-warning) 10%, transparent);
  border-color: color-mix(in srgb, var(--bs-warning) 28%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--bs-warning) 55%, transparent);
  border-radius: 10px;
}

.chat-message-assistant .chat-message-meta {
  color: color-mix(in srgb, var(--bs-warning) 70%, var(--bs-secondary-color));
}

/* Observer-only: hidden bot instruction (only rendered in observe.html) */
.chat-message-observer-instruction {
  align-self: stretch;
  max-width: 100%;
  background: color-mix(in srgb, var(--bs-info) 6%, transparent);
  border-color: color-mix(in srgb, var(--bs-info) 18%, transparent);
  border-style: dashed;
  border-radius: 8px;
  color: var(--bs-secondary-color);
  font-size: .8rem;
  font-style: italic;
}

.chat-message-observer-instruction .chat-message-meta {
  color: color-mix(in srgb, var(--bs-info) 55%, var(--bs-secondary-color));
}

.obs-instructions-panel {
  border-top: 1px solid var(--bs-border-color);
  padding: .65rem .9rem;
  background: transparent;
  flex: 0 0 auto;
  max-height: 220px;
  overflow-y: auto;
}

.obs-instructions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .55rem;
  color: var(--bs-secondary-color);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.obs-instructions-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

.obs-instructions-list {
  display: grid;
  gap: .5rem;
}

.obs-instruction-card {
  display: grid;
  gap: .45rem;
  padding: .55rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
}

.obs-instruction-text {
  width: 100%;
  resize: vertical;
  min-height: 2.75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: .45rem .55rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font: inherit;
  font-size: .86rem;
}

.obs-instruction-actions {
  display: flex;
  gap: .45rem;
  justify-content: flex-end;
}

.obs-instruction-actions button {
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: .25rem .55rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  font-size: .76rem;
}

.obs-instruction-delete {
  color: var(--bs-danger) !important;
  border-color: color-mix(in srgb, var(--bs-danger) 40%, var(--bs-border-color)) !important;
}

.obs-instructions-empty {
  color: var(--bs-secondary-color);
  font-size: .82rem;
}

.chat-message-meta {
  font-size: .78rem;
  color: var(--bs-secondary-color);
  margin-bottom: .3rem;
}

.chat-message-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-last-turn-note {
  margin: .4rem 0 0;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: color-mix(in srgb, var(--bs-warning) 65%, var(--bs-secondary-color));
}

.chat-message-body-typing::after {
  content: "";
  display: inline-block;
  width: .55ch;
  height: 1em;
  margin-inline-start: .12rem;
  border-right: 2px solid currentColor;
  vertical-align: -.12em;
  animation: chat-caret-blink 1s steps(1) infinite;
}

@keyframes chat-caret-blink {
  50% {
    opacity: 0;
  }
}

.chat-empty {
  margin: auto;
  color: var(--bs-secondary-color);
  text-align: center;
}

.chat-composer {
  width: min(100%, 1320px);
  margin: 0 auto;
  border-top: 0;
  padding: .45rem clamp(.35rem, 1.5vw, 1.1rem) calc(.85rem + env(safe-area-inset-bottom));
  display: grid;
  gap: .5rem;
  background: transparent;
}

.chat-status {
  min-height: 1.25rem;
  color: var(--bs-secondary-color);
  font-size: .85rem;
  line-height: 1.25;
  padding: 0 .75rem;
}

.chat-status[hidden] {
  display: block;
  visibility: hidden;
}

.chat-status[data-tone="error"] {
  color: var(--bs-danger);
}

.chat-status[data-tone="success"] {
  color: var(--bs-success);
}

.chat-aux-action {
  min-height: 36px;
}

.chat-session-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  padding-top: .1rem;
}

.chat-session-actions form {
  display: inline-flex;
}

.chat-session-actions .chat-aux-action {
  border: 1px solid color-mix(in srgb, var(--text-color, currentColor) 22%, transparent);
  border-radius: 999px;
  background: transparent;
  color: var(--text-color, var(--bs-body-color));
  padding: .42rem .9rem;
  font-size: .86rem;
  line-height: 1.2;
  text-decoration: none;
}

.chat-session-actions .chat-aux-action:hover,
.chat-session-actions .chat-aux-action:focus-visible {
  border-color: var(--bs-primary);
  color: var(--bs-primary);
}

.chat-input-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: .55rem;
  width: 100%;
  min-height: 54px;
  border: 1px solid color-mix(in srgb, var(--text-color, currentColor) 18%, transparent);
  border-radius: 28px;
  background: color-mix(in srgb, var(--background-color, var(--bs-body-bg)) 94%, var(--text-color, currentColor) 6%);
  padding: .42rem .48rem .42rem 1rem;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .16);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.chat-input-wrap[dir="rtl"] {
  flex-direction: row-reverse;
  padding: .42rem 1rem .42rem .48rem;
}

.chat-input-wrap:focus-within {
  border-color: rgba(13, 110, 253, .55);
  box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .12);
}

.chat-composer textarea {
  flex: 1 1 auto;
  width: auto;
  resize: none;
  min-height: 36px;
  max-height: 150px;
  border: 0;
  border-radius: 0;
  padding: .43rem .25rem;
  background: transparent;
  color: var(--bs-body-color);
  line-height: 1.35;
  overflow-y: auto;
}

.chat-composer textarea:focus {
  outline: 0;
  box-shadow: none;
}

.chat-primary-action {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--text-color, currentColor) 18%, transparent);
  border-radius: 50%;
  background: var(--chat-control-btn-bg, var(--background-color, var(--bs-body-bg)));
  color: var(--chat-send-triangle-color, currentColor);
  box-shadow: 0 10px 22px var(--chat-control-btn-shadow, rgba(0, 0, 0, .22));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .12s ease, opacity .12s ease, background-color .12s ease;
}

.chat-primary-action:hover:not(:disabled),
.chat-primary-action:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(13, 110, 253, .55);
  background: var(--chat-control-btn-bg, var(--background-color, var(--bs-body-bg)));
}

.chat-primary-action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.chat-primary-action[data-mode="voice"] .chat-send-glyph {
  display: none;
}

.chat-primary-action[data-mode="send"] .chat-primary-action-icon {
  display: none;
}

.chat-primary-action[data-mode="stop"] {
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: 0;
}

.chat-primary-action[data-mode="stop"] .chat-send-glyph,
.chat-primary-action[data-mode="stop"] .chat-primary-action-icon {
  display: none;
}

.chat-stop-label[hidden] {
  display: none;
}

.chat-voice-listening .chat-primary-action[data-mode="stop"] {
  animation: chat-voice-pulse 1.35s ease-out infinite;
  border-color: rgba(243, 156, 90, .82);
}

.chat-primary-action-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
}

.chat-send-glyph {
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 18px solid var(--chat-send-triangle-color, currentColor);
  margin-left: 3px;
}

.chat-voice-panel {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  /* backdrop captures clicks so clicking outside the circle closes the panel */
  pointer-events: auto;
  cursor: default;
}

.chat-voice-panel[hidden] {
  display: none;
}

.chat-voice-mode-btn {
  width: clamp(110px, 16vw, 140px);
  height: clamp(110px, 16vw, 140px);
  border: 2px solid color-mix(in srgb, var(--text-color, currentColor) 22%, transparent);
  background: var(--chat-control-btn-bg, var(--background-color, var(--bs-body-bg)));
  border-radius: 50%;
  padding: 0;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 18px 42px var(--chat-control-btn-shadow, rgba(0, 0, 0, .25));
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.chat-voice-mode-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--chat-voice-icon-url, url("../img/icons/simulator_voice_mode_dark.png"));
  background-repeat: no-repeat;
  background-position: center;
  background-size: 46px 46px;
  border-radius: 50%;
}

html[data-bs-theme="light"] .chat-voice-mode-btn::before {
  background-image: url("../img/icons/simulator_voice_mode_light.png");
}

.chat-voice-mode-btn[aria-pressed="true"] {
  border-color: rgba(243, 156, 90, .82);
  background: rgba(243, 156, 90, .10);
  animation: chat-voice-pulse 1.35s ease-out infinite;
}

.chat-voice-panel-hint {
  margin: 0;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
  opacity: .75;
  color: var(--text-color, var(--bs-body-color));
  pointer-events: none;
  text-align: center;
}

.chat-voice-exit-btn {
  border: 1px solid color-mix(in srgb, var(--text-color, currentColor) 25%, transparent);
  background: transparent;
  color: var(--bs-body-color);
  border-radius: 999px;
  padding: .35rem .85rem;
  font-size: .82rem;
  pointer-events: auto;
}

.chat-voice-exit-btn:hover,
.chat-voice-exit-btn:focus {
  border-color: var(--bs-secondary-color);
  background: var(--bs-secondary-bg);
}

/* Row wrapper that holds the input box + the voice-mode pill side-by-side */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: .45rem;
}

.chat-input-row .chat-input-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

/* Voice mode toggle — shown when both hold-to-record and free-speech are enabled */
.chat-hold-mode-open .chat-vmt,
.chat-voice-listening .chat-vmt {
  display: none;
}

/* pill hides when there's text (primary button switches to send, voice not relevant) */
.chat-input-row:has(textarea:not(:placeholder-shown)) .chat-vmt {
  visibility: hidden;
  pointer-events: none;
}

.chat-vmt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--text-color, currentColor) 20%, transparent);
  background: color-mix(in srgb, var(--background-color, var(--bs-body-bg)) 90%, var(--text-color, currentColor) 10%);
  flex-shrink: 0;
  /* vertically center the pill with the 44px voice button:
     button bottom-padding is .42rem; pill height ~44px so no extra offset needed */
  margin-bottom: 0;
}

.chat-vmt-btn {
  padding: .3rem .65rem;
  border: none;
  border-bottom: 1px solid color-mix(in srgb, var(--text-color, currentColor) 12%, transparent);
  background: transparent;
  color: var(--bs-secondary-color);
  font-size: .72rem;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  text-align: center;
  transition: background .12s ease, color .12s ease;
  white-space: nowrap;
}

.chat-vmt-btn:last-child {
  border-bottom: none;
}

.chat-vmt-btn.active {
  background: var(--bs-primary);
  color: #fff;
}

.chat-vmt-btn:not(.active):hover {
  background: color-mix(in srgb, var(--text-color, currentColor) 8%, transparent);
  color: var(--bs-body-color);
}

[dir="rtl"] .chat-vmt {
  order: -1;
}

@keyframes chat-voice-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(243, 156, 90, .42), 0 12px 30px var(--chat-control-btn-shadow, rgba(0, 0, 0, .22));
  }
  70% {
    box-shadow: 0 0 0 13px rgba(243, 156, 90, 0), 0 12px 30px var(--chat-control-btn-shadow, rgba(0, 0, 0, .22));
  }
  100% {
    box-shadow: 0 0 0 0 rgba(243, 156, 90, 0), 0 12px 30px var(--chat-control-btn-shadow, rgba(0, 0, 0, .22));
  }
}

@media (max-width: 860px) {
  .chat-preview-grid,
  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-main {
    min-height: 560px;
  }

  .chat-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-topbar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .chat-preview-shell,
  .chat-shell {
    width: 100%;
    padding: 0;
  }

  .chat-preview-panel,
  .chat-side,
  .chat-main {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .chat-message {
    max-width: 94%;
  }

  .chat-shell.chat-mobile-voice-focus {
    padding-top: .5rem;
  }

  .chat-shell.chat-mobile-voice-focus .chat-topbar-actions,
  .chat-shell.chat-mobile-voice-focus [data-voice-mode="stream"],
  .chat-shell.chat-mobile-voice-focus .chat-primary-action {
    display: none;
  }

  .chat-shell.chat-mobile-voice-focus .chat-main {
    min-height: calc(100vh - 150px);
  }

  .chat-shell.chat-mobile-voice-focus .chat-thread {
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    max-height: min(42vh, 360px);
    opacity: .82;
  }

  .chat-shell.chat-mobile-voice-focus .chat-composer {
    position: sticky;
    bottom: 0;
    background: var(--bs-body-bg);
    z-index: 2;
  }

  .chat-shell.chat-mobile-voice-focus .chat-voice-panel {
    gap: 16px;
  }

  .chat-shell.chat-mobile-voice-focus [data-voice-mode="record"] {
    width: clamp(140px, 38vw, 180px);
    height: clamp(140px, 38vw, 180px);
  }

  .chat-shell.chat-mobile-voice-focus [data-voice-mode="record"]::before {
    background-size: 60px 60px;
  }
}

/* ══════════════════════════════════════════════════════════════
   Home dashboard (role-based)
   ══════════════════════════════════════════════════════════════ */

.home-dashboard {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
}

.home-section {
  margin-bottom: 1.25rem;
}
.home-section:not(.home-alerts-strip) {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.04));
}
@media (prefers-color-scheme: dark) {
  .home-section:not(.home-alerts-strip) { box-shadow: none; }
}
:root[data-bs-theme="dark"]  .home-section:not(.home-alerts-strip) { box-shadow: none; }
:root[data-bs-theme="light"] .home-section:not(.home-alerts-strip) {
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.04));
}

.home-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--bs-secondary-color);
  margin-bottom: 1rem;
}

/* Researcher action cards */
.home-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1rem;
}

.home-action-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: color-mix(in srgb, var(--bs-body-bg) 96%, var(--bs-secondary-bg));
  min-width: 0;
  transition: border-color .12s, background .12s, transform .12s;
}

.home-action-card:hover,
.home-action-card:focus-visible {
  border-color: var(--bs-primary);
  background: color-mix(in srgb, var(--bs-primary) 6%, var(--bs-body-bg));
  transform: translateY(-1px);
  color: inherit;
  text-decoration: none;
}

.home-action-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.home-action-card-body strong,
.home-action-card-body span {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Participant simulation cards */
.home-sim-card {
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.home-sim-card-header {
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg, rgba(0,0,0,.03));
}

.home-sim-card-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 .15rem;
}

.home-sim-card-desc {
  font-size: .875rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-sim-sessions {
  padding: .5rem 0;
}

.home-sim-session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 1.25rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.home-sim-session-row:last-child {
  border-bottom: none;
}

.home-sim-session-info {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}

.home-sim-session-name {
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-sim-session-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   Home — Observe (live sessions) section
   ══════════════════════════════════════════════════════════════ */

.home-section-title {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.home-live-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4em;
  height: 1.4em;
  padding: 0 .35em;
  border-radius: 999px;
  background: var(--bs-danger);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
}

.home-observe-list {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 12px;
  overflow: hidden;
}

.home-observe-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.home-observe-row:last-child {
  border-bottom: none;
}

.home-observe-info {
  display: flex;
  flex-direction: column;
  gap: .08rem;
  min-width: 0;
}

.home-observe-sim {
  font-weight: 600;
  font-size: .92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-observe-session {
  font-size: .82rem;
  color: var(--bs-secondary-color);
}

.home-observe-participant {
  font-size: .78rem;
}

/* ══════════════════════════════════════════════════════════════
   Observer chat view — two-column layout
   ══════════════════════════════════════════════════════════════ */

/* Root layout: sidebar + main side-by-side */
.obs-layout {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ── Left sidebar ─────────────────────────────────────────── */
.obs-sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--bs-border-color);
  background: var(--bs-body-bg);
  overflow: hidden;
}

.obs-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
  flex-shrink: 0;
}

.obs-sidebar-title {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bs-secondary-color);
}

.obs-sidebar-close {
  display: none; /* shown only on mobile */
  background: none;
  border: none;
  padding: .2rem;
  cursor: pointer;
  color: var(--bs-secondary-color);
  line-height: 1;
}

.obs-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: .35rem 0;
}

.obs-conv-item {
  display: block;
  padding: .55rem 1rem;
  text-decoration: none;
  color: var(--bs-body-color);
  border-left: 3px solid transparent;
  transition: background .12s, border-color .12s;
}

.obs-conv-item:hover {
  background: var(--bs-secondary-bg);
  color: var(--bs-body-color);
}

.obs-conv-item.active {
  background: color-mix(in srgb, var(--bs-primary) 8%, transparent);
  border-left-color: var(--bs-primary);
}

.obs-conv-item-inner {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
}

.obs-conv-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bs-secondary-color);
  flex-shrink: 0;
  margin-top: .35rem;
}

.obs-conv-status-dot.live {
  background: var(--bs-success);
  animation: chat-voice-pulse 1.8s ease-out infinite;
}

.obs-conv-info {
  min-width: 0;
}

.obs-conv-name {
  font-size: .85rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obs-conv-meta {
  font-size: .75rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.obs-conv-empty {
  padding: .75rem 1rem;
}

.obs-sidebar-footer {
  padding: .55rem 1rem;
  border-top: 1px solid var(--bs-border-color);
  font-size: .72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--bs-secondary-color);
  flex-shrink: 0;
}

/* ── Right main panel ─────────────────────────────────────── */
.obs-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative; /* needed for chat-voice-panel absolute overlay */
}

.obs-main .chat-thread {
  flex: 1 1 auto;
  min-height: 0;
}

/* ── Topbar inside obs-main ───────────────────────────────── */
.chat-observe-topbar {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem clamp(.5rem, 2vw, 1rem);
  border-bottom: 1px solid var(--bs-border-color);
  flex-shrink: 0;
}

.chat-observe-title-group {
  flex: 1;
  min-width: 0;
}

.chat-observe-title-group h1 {
  font-size: clamp(.95rem, 2vw, 1.15rem);
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-observe-subtitle {
  font-size: .78rem;
  color: var(--bs-secondary-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Right cluster: status + stop */
.obs-topbar-right {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-shrink: 0;
}

.chat-observe-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  color: var(--bs-secondary-color);
}

.chat-observe-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bs-secondary-color);
  flex-shrink: 0;
}

.chat-observe-status-dot.live {
  background: var(--bs-success);
  animation: chat-voice-pulse 1.8s ease-out infinite;
}

/* Stop session button */
.obs-stop-btn {
  font-size: .78rem;
  padding: .28rem .7rem;
  border-radius: 6px;
  border: 1px solid var(--bs-danger);
  background: transparent;
  color: var(--bs-danger);
  cursor: pointer;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.obs-stop-btn:hover {
  background: var(--bs-danger);
  color: #fff;
}

.obs-stop-confirm-row {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.obs-stop-confirm-input {
  width: 7rem;
  font-size: .78rem;
  padding: .25rem .5rem;
  border: 1px solid var(--bs-danger);
  border-radius: 6px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
}

.obs-stop-confirm-btn {
  font-size: .78rem;
  padding: .25rem .6rem;
  border-radius: 6px;
  border: 1px solid var(--bs-danger);
  background: var(--bs-danger);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.obs-stop-confirm-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.obs-stop-cancel-btn {
  font-size: .78rem;
  padding: .25rem .6rem;
  border-radius: 6px;
  border: 1px solid var(--bs-border-color);
  background: transparent;
  color: var(--bs-secondary-color);
  cursor: pointer;
  white-space: nowrap;
}

@keyframes obs-stop-pulse {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ── Hamburger (mobile only, hidden on desktop) ───────────── */
.obs-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 32px;
  height: 32px;
  padding: 4px;
  background: none;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}

.obs-hamburger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--bs-body-color);
  transition: opacity .15s;
}

.obs-hamburger:hover span {
  background: var(--bs-primary);
}

/* ── Mobile backdrop ──────────────────────────────────────── */
.obs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 1040;
  backdrop-filter: blur(1px);
}

.obs-backdrop.obs-backdrop-show {
  display: block;
}

/* ── Mobile: drawer mode ──────────────────────────────────── */
@media (max-width: 767.98px) {
  .obs-hamburger {
    display: flex;
  }

  .obs-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    bottom: 0;
    width: 280px;
    z-index: 1050;
    transition: left .25s cubic-bezier(.4, 0, .2, 1);
    box-shadow: none;
  }

  .obs-sidebar.obs-sidebar-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, .2);
  }

  .obs-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .obs-layout {
    height: 100dvh;
    width: 100%;
  }

  .chat-observe-topbar {
    gap: .5rem;
    padding: .5rem .65rem;
  }

  .obs-layout .sim-crumb,
  .chat-observe-status {
    display: none;
  }

  .obs-stop-btn {
    padding-inline: .55rem;
  }

}

/* ── Observer composer ────────────────────────────────────── */
.chat-observe-composer {
  border-top: 1px solid var(--bs-border-color);
  padding: .65rem clamp(.5rem, 2vw, 1rem) calc(.85rem + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: .55rem;
  background: transparent;
  flex-shrink: 0;
}

.chat-obs-recipient {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--bs-border-color);
  align-self: flex-start;
  font-size: .78rem;
}

.chat-obs-recipient-btn {
  padding: .28rem .85rem;
  border: none;
  background: transparent;
  color: var(--bs-secondary-color);
  cursor: pointer;
  font-size: inherit;
  line-height: 1.4;
  transition: background .12s, color .12s;
  white-space: nowrap;
}

.chat-obs-recipient-btn.active[data-recipient="bot"] {
  background: var(--bs-info);
  color: #fff;
}

.chat-obs-recipient-btn.active[data-recipient="user"] {
  background: color-mix(in srgb, var(--bs-warning) 75%, transparent);
  color: var(--bs-dark, #212529);
}

.chat-obs-recipient-btn:not(.active):hover {
  color: var(--bs-body-color);
  background: var(--bs-secondary-bg);
}

.chat-obs-hint {
  font-size: .75rem;
  color: var(--bs-secondary-color);
  min-height: 1rem;
}

/* ── Observer composer — overrides on top of .chat-composer ── */

/* Add border-top to separate from thread */
.chat-observe-composer {
  border-top: 1px solid var(--bs-border-color);
  padding-bottom: calc(.85rem + env(safe-area-inset-bottom));
}

/* The observer mode picker must stay visible even when text is typed —
   override the :has rule that hides .chat-vmt on text input */
.chat-input-row:has(textarea:not(:placeholder-shown)) .obs-vmt {
  visibility: visible;
  pointer-events: auto;
}

/* Colour the active state by observer intervention mode */
.obs-vmt {
  overflow-x: auto;
}

.obs-vmt .chat-vmt-btn {
  padding-inline: .65rem;
}

.obs-vmt .chat-vmt-btn.active[data-mode="next_turn"],
.obs-vmt .chat-vmt-btn.active[data-mode="persistent"] {
  background: var(--bs-info);
  color: #fff;
}

.obs-vmt .chat-vmt-btn.active[data-mode="force_response"] {
  background: color-mix(in srgb, var(--bs-success) 78%, transparent);
  color: #fff;
}

.obs-vmt .chat-vmt-btn.active[data-mode="participant"] {
  background: color-mix(in srgb, var(--bs-warning) 75%, transparent);
  color: var(--bs-dark, #212529);
}

@media (max-width: 560px) {
  .chat-observe-composer {
    padding: .5rem .55rem calc(.65rem + env(safe-area-inset-bottom));
    gap: .45rem;
  }

  .chat-observe-composer .chat-input-row {
    flex-direction: column;
    align-items: stretch;
    gap: .45rem;
  }

  .chat-observe-composer .chat-input-wrap {
    min-height: 50px;
    border-radius: 24px;
  }

  .chat-observe-composer textarea {
    font-size: .88rem;
  }

  .chat-observe-composer .obs-vmt {
    width: 100%;
    flex-direction: row;
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .chat-observe-composer .obs-vmt .chat-vmt-btn {
    flex: 1 0 auto;
    min-width: max-content;
    border-bottom: 0;
    border-inline-end: 1px solid color-mix(in srgb, var(--text-color, currentColor) 12%, transparent);
    padding: .42rem .55rem;
    font-size: .72rem;
  }

  .chat-observe-composer .obs-vmt .chat-vmt-btn:last-child {
    border-inline-end: 0;
  }
}

/* ── Two-stage confirm state for participant finish button ─── */
.chat-aux-action-confirm {
  color: var(--bs-danger) !important;
  border-color: var(--bs-danger) !important;
  font-weight: 600;
}

/* ══════════════════════════════════════════════════════════════
   Feedback page
   ══════════════════════════════════════════════════════════════ */

.feedback-main {
  display: flex;
  flex-direction: column;
}

.feedback-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feedback-card {
  border: 1px solid var(--bs-border-color);
  border-radius: .65rem;
  overflow: hidden;
}

.feedback-card-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--bs-secondary-color);
  padding: .5rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg, rgba(0,0,0,.03));
}

.feedback-card-body {
  padding: 1rem;
  line-height: 1.7;
  text-align: start;   /* follows dir="auto" — LTR or RTL automatically */
}

.feedback-manual {
  color: var(--bs-secondary-color);
}

.feedback-pending {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--bs-secondary-color);
}

.feedback-pending-spinner {
  font-size: 1.5rem;
}

.feedback-nav {
  padding: 1rem;
  border-top: 1px solid var(--bs-border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.feedback-nav-btn {
  flex-shrink: 0;
}

.feedback-nav-arrow {
  margin-left: .25rem;
}

/* ══════════════════════════════════════════════════════════════
   Essay analysis page
   ══════════════════════════════════════════════════════════════ */

.sim-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.sim-page-header {
  margin-bottom: 2rem;
}

.sim-page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: .25rem 0 .5rem;
}

.essay-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 768px) {
  .essay-layout {
    grid-template-columns: 1fr;
  }
}

.essay-panel {
  border: 1px solid var(--bs-border-color);
  border-radius: .75rem;
  overflow: hidden;
}

.essay-panel-head {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--bs-secondary-color);
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg, rgba(0,0,0,.03));
}

.essay-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--bs-border-color);
}

.essay-tab {
  flex: 1;
  padding: .55rem .75rem;
  font-size: .875rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--bs-secondary-color);
  cursor: pointer;
  transition: color .12s, border-color .12s;
}

.essay-tab:hover {
  color: var(--bs-body-color);
}

.essay-tab.essay-tab-active {
  color: var(--bs-primary);
  border-bottom-color: var(--bs-primary);
}

.essay-tab-panel {
  padding: .75rem;
}

.essay-textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  padding: .65rem .85rem;
  font-size: .9rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  line-height: 1.6;
  font-family: inherit;
}

.essay-textarea:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

.essay-dropzone {
  border: 2px dashed var(--bs-border-color);
  border-radius: .65rem;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.essay-dropzone:hover,
.essay-dropzone:focus-visible,
.essay-dropzone.essay-dropzone-over {
  border-color: var(--bs-primary);
  background: var(--bs-primary-bg-subtle, rgba(13,110,253,.05));
  outline: none;
}

.essay-dropzone-icon svg {
  width: 36px;
  height: 36px;
  color: var(--bs-secondary-color);
  margin-bottom: .5rem;
}

.essay-file-list {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.essay-file-item {
  font-size: .85rem;
  padding: .3rem .6rem;
  border: 1px solid var(--bs-border-color);
  border-radius: .4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.essay-config-section {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.essay-config-section:last-child {
  border-bottom: none;
}

.essay-config-label {
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .4rem;
  display: block;
}

.essay-config-textarea {
  width: 100%;
  border: 1px solid var(--bs-border-color);
  border-radius: .5rem;
  padding: .55rem .75rem;
  font-size: .9rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  resize: vertical;
  font-family: inherit;
}

.essay-config-textarea:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

.essay-variables-placeholder {
  padding: .5rem 0;
}

.essay-run-row {
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.essay-run-note {
  flex: 1;
}


/* ── Analysis dashboard ─────────────────────────────────────────────────── */

.adb-toolbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.adb-toolbar-label {
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.adb-sim-select {
  max-width: 420px;
}

.adb-state-msg {
  display: flex;
  align-items: center;
  padding: 1rem 0;
  color: var(--bs-secondary-color);
}

.adb-empty-state {
  padding: 3rem 0;
  text-align: center;
}

.adb-table {
  margin: 0;
}

.adb-th {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: var(--bs-secondary-color);
  border-bottom-width: 1px;
  white-space: nowrap;
}

.adb-th-session {
  text-align: center;
  min-width: 100px;
}

.adb-th-actions {
  min-width: 280px;
}

.adb-td {
  vertical-align: middle;
}

.adb-td-session {
  text-align: center;
}

.adb-td-participant {
  min-width: 160px;
}

.adb-participant-code {
  display: block;
}

.adb-participant-email {
  display: block;
}

.adb-td-actions {
  min-width: 260px;
}

.adb-actions-row {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  align-items: center;
}

.adb-action-btn {
  white-space: nowrap;
}

.adb-result-text {
  white-space: pre-wrap;
  font-size: .9rem;
  line-height: 1.65;
  text-align: start;
}


/* ── Text analysis project list ────────────────────────────────────────── */

.ta-list-wrap {
  max-width: 640px;
}

.ta-new-project-form {
  display: flex;
  gap: .6rem;
  margin-bottom: 1.5rem;
}

.ta-new-project-input {
  flex: 1 1 0;
}

.ta-project-list {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.ta-project-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background .12s, border-color .12s;
}

.ta-project-card:hover {
  background: var(--bs-tertiary-bg);
  border-color: var(--bs-primary);
}

.ta-project-card-body {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.ta-project-card-body strong,
.ta-project-card-body span {
  display: block;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 560px) {
  .home-card-grid {
    gap: .65rem;
  }

  .home-action-card {
    padding: .9rem 1rem;
  }

  .home-action-card-body strong {
    font-size: .95rem;
  }

  .home-action-card-body span {
    font-size: .78rem;
  }

  .ta-new-project-form {
    gap: .45rem;
  }

  .ta-project-card {
    padding: .75rem .85rem;
  }
}

/* ── Workspace layout ───────────────────────────────────────────────────── */

.ta-workspace-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.ta-breadcrumb {
  font-size: .9rem;
  color: var(--bs-secondary-color);
}

.ta-breadcrumb a {
  color: var(--bs-secondary-color);
  text-decoration: none;
}

.ta-breadcrumb a:hover {
  text-decoration: underline;
}

.ta-header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ── Top-level workspace tabs ────────────────────────────────────────────── */

.ta-ws-tab-bar {
  margin-bottom: 0;
  border-bottom: 2px solid var(--bs-border-color);
}

.ta-ws-panel {
  border: 1px solid var(--bs-border-color);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--bs-body-bg);
  margin-bottom: 1.5rem;
}

.ta-ws-subpanel {
  padding: 1rem;
}

/* ── Text items ─────────────────────────────────────────────────────────── */

.ta-text-items {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.ta-text-item {
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: .6rem;
}

.ta-text-item-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}

.ta-text-item-header .ta-text-label {
  flex: 1;
}

.ta-textarea {
  width: 100%;
  font-size: .9rem;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: .5rem .6rem;
  resize: vertical;
}

.ta-textarea:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

/* ── Drop zone ──────────────────────────────────────────────────────────── */

.ta-dropzone {
  border: 2px dashed var(--bs-border-color);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.ta-dropzone:hover,
.ta-dropzone-over {
  border-color: var(--bs-primary);
  background: rgba(13,110,253,.04);
}

.ta-dropzone-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto .6rem;
  color: var(--bs-secondary-color);
}

.ta-dropzone-icon svg {
  width: 100%;
  height: 100%;
}

/* ── Document list ──────────────────────────────────────────────────────── */

.ta-doc-list {
  margin-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.ta-doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .45rem .5rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
}

.ta-doc-item-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  flex: 1;
}

.ta-doc-name {
  font-size: .88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ta-doc-size {
  flex-shrink: 0;
}

.ta-doc-item-status {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

.ta-status-ready {
  color: #0a3622;
  background: rgba(25,135,84,.18);
  border-color: rgba(25,135,84,.35);
}

.ta-status-failed {
  color: #58151c;
  background: rgba(220,53,69,.12);
  border-color: rgba(220,53,69,.3);
}

.ta-status-pending,
.ta-status-extracting {
  color: #664d03;
  background: rgba(255,193,7,.18);
  border-color: rgba(255,193,7,.35);
}

/* ── Corpus toolbar ─────────────────────────────────────────────────────── */

.ta-corpus-toolbar {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
  flex-wrap: wrap;
}

/* ── Run section (inside Run tab) ────────────────────────────────────────── */

.ta-run-section {
  padding: .85rem 0;
  border-bottom: 1px solid var(--bs-border-color);
}

.ta-run-section:last-of-type {
  border-bottom: none;
}

.ta-run-checklist {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .2rem;
}

.ta-run-item-checklist {
  max-height: 180px;
}

.ta-run-check-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem .1rem;
  font-size: .88rem;
  cursor: pointer;
}

/* ── Config sections ────────────────────────────────────────────────────── */

.ta-config-section {
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--bs-border-color);
}

.ta-config-section:last-child {
  border-bottom: none;
}

.ta-config-label {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bs-secondary-color);
  margin-bottom: .5rem;
  display: block;
}

.ta-config-textarea {
  width: 100%;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: .5rem .6rem;
  font-size: .9rem;
  resize: vertical;
}

.ta-config-textarea:focus {
  outline: none;
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 3px rgba(13,110,253,.15);
}

/* ── Right config panel tabs ────────────────────────────────────────────── */

.ta-cfg-panel {
  padding: 1rem;
  flex: 1 1 0;
  overflow-y: auto;
}

/* ── Variable cards ─────────────────────────────────────────────────────── */

.ta-var-card {
  padding: .65rem .75rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  margin-bottom: .5rem;
  background: var(--bs-body-bg);
  transition: border-color .15s;
}

.ta-var-card:hover {
  border-color: var(--bs-primary);
}

.ta-var-card-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.ta-var-name {
  font-weight: 600;
  font-size: .9rem;
  flex: 1 1 0;
  min-width: 60px;
}

.ta-var-type-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .15em .55em;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .03em;
  flex-shrink: 0;
}

.ta-var-type-text,
.ta-var-type-number,
.ta-var-type-boolean,
.ta-var-type-category {
  background: var(--bs-secondary-bg);
  color: var(--bs-secondary-color);
  border: 1px solid var(--bs-border-color);
}

.ta-var-card-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
  font-size: .82rem;
}

.ta-var-desc,
.ta-var-opts {
  margin-top: .25rem;
  font-size: .8rem;
  line-height: 1.4;
}

/* ── Run row ────────────────────────────────────────────────────────────── */

.ta-run-row {
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.ta-run-status-msg {
  flex: 1;
}

/* ── Results section ────────────────────────────────────────────────────── */

.ta-results-section {
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
}

.ta-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

.ta-state-msg {
  display: flex;
  align-items: center;
  padding: .5rem 0;
  color: var(--bs-secondary-color);
}

.ta-results-table th,
.ta-results-table td {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.ta-reasoning-cell {
  font-size: .82rem;
  color: var(--bs-secondary-color);
  max-width: 260px;
}

.sim-billing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.sim-billing-card,
.sim-credit-alert {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
}

.sim-billing-card {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.sim-billing-card > strong {
  font-size: 1.6rem;
  line-height: 1.1;
}

.sim-billing-card .form-control.sim-field-missing {
  border-color: var(--bs-danger) !important;
  box-shadow: 0 0 0 .18rem rgba(220, 53, 69, .25) !important;
}

.sim-credit-alert {
  padding: .85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (max-width: 560px) {
  .sim-credit-alert {
    align-items: stretch;
    flex-direction: column;
  }
}

.sim-inline-form,
.sim-table-filter {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, auto) auto;
  gap: .75rem;
  align-items: end;
}

.sim-table-filter {
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, auto)) auto;
}

.sim-inline-label {
  display: grid;
  gap: .25rem;
  color: var(--bs-secondary-color);
  font-size: .86rem;
}

.sim-admin-table {
  --bs-table-bg: transparent;
}

.sim-admin-table th {
  color: var(--bs-secondary-color);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.sim-role-row-form {
  min-width: 280px;
}

.plans-page {
  width: min(1280px, 94vw);
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.plans-head {
  text-align: center;
  display: grid;
  gap: .75rem;
  justify-items: center;
  margin-bottom: 2rem;
}

.plans-head h1 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  margin: 0;
}

.plans-head p {
  max-width: 680px;
  color: var(--bs-secondary-color);
  margin: 0;
}

.plans-tabs {
  display: inline-flex;
  gap: .25rem;
  border: 1px solid var(--bs-border-color);
  border-radius: 999px;
  padding: .25rem;
}

.plans-tabs a {
  color: var(--bs-secondary-color);
  text-decoration: none;
  border-radius: 999px;
  padding: .35rem .9rem;
  font-weight: 600;
  font-size: .9rem;
}

.plans-tabs a.active {
  background: var(--bs-body-color);
  color: var(--bs-body-bg);
}

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

.plans-group {
  margin-top: 2rem;
}

.plans-group > h2 {
  font-size: clamp(1.3rem, 2vw, 1.75rem);
  margin-bottom: 1rem;
}

.plans-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-card {
  border: 1px solid var(--bs-border-color);
  border-radius: 8px;
  padding: 1.5rem;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.25rem;
  background: var(--bs-body-bg);
}

.plan-card.featured {
  border-color: var(--bs-primary);
  box-shadow: 0 10px 32px rgba(13, 110, 253, .12);
}

.plan-kicker {
  display: block;
  color: var(--bs-secondary-color);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .35rem;
}

.plan-card h2 {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  margin-bottom: .65rem;
}

.plan-price {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  font-weight: 700;
  margin-bottom: 1rem;
}

.plan-price span {
  font-size: .95rem;
  color: var(--bs-secondary-color);
  font-weight: 500;
}

.plan-card p,
.plan-features {
  color: var(--bs-secondary-color);
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .65rem;
  font-size: .92rem;
}

.plan-features li::before {
  content: "✓";
  color: var(--bs-primary);
  font-weight: 700;
  margin-right: .55rem;
}

@media (max-width: 760px) {
  .sim-inline-form,
  .sim-table-filter {
    grid-template-columns: 1fr;
  }

  .plans-page {
    width: min(100%, 96vw);
  }

  .plan-card {
    min-height: auto;
  }

  /* Plans scroll horizontally on mobile instead of stacking */
  .plans-grid {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: .75rem;
    gap: .85rem;
    /* remove grid layout */
    grid-template-columns: unset;
  }

  .plans-grid > * {
    flex: 0 0 min(240px, 65vw);
    max-width: min(240px, 65vw);
    scroll-snap-align: start;
  }

  .plan-card {
    padding: 1rem;
    gap: .85rem;
  }

  .plan-price {
    font-size: clamp(1.5rem, 7vw, 2rem);
    margin-bottom: .6rem;
  }

  .plan-features {
    gap: .45rem;
    font-size: .85rem;
  }

  /* Pills stay on one line and scroll if needed */
  .plans-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .plans-tabs a {
    white-space: nowrap;
  }
}

/* ── Home page additions ─────────────────────────────────────────────────── */

/* Danger-tinted institution card (pending deletion) */
.home-action-card-danger {
  border-color: rgba(var(--bs-danger-rgb), .35);
  background: color-mix(in srgb, var(--bs-danger) 5%, var(--bs-body-bg));
}
.home-action-card-danger:hover,
.home-action-card-danger:focus-visible {
  border-color: var(--bs-danger);
  background: color-mix(in srgb, var(--bs-danger) 10%, var(--bs-body-bg));
}

/* Compact one-line alert strip */
.home-alerts-strip {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 2rem;
}

.sim-credit-alert-compact {
  padding: .5rem .9rem;
  border-radius: 6px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.sim-credit-alert-overuse {
  padding: .6rem 1rem;
  border-radius: 6px;
  font-size: .9rem;
  background: color-mix(in srgb, var(--bs-danger) 12%, transparent);
  border-left: 3px solid var(--bs-danger);
  color: var(--bs-body-color);
}


.home-no-role {
  padding: 3rem 1rem;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Cookie consent banner (fixed bottom) ────────────────────────────────── */
.sim-cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  background: var(--bs-body-bg);
  border-top: 1px solid var(--bs-border-color);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, .1);
  padding: .75rem 1.25rem;
}

.sim-cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sim-cookie-banner-text {
  flex: 1 1 280px;
  font-size: .85rem;
  color: var(--bs-body-color);
  line-height: 1.5;
}

.sim-cookie-details-toggle {
  font-size: .85rem;
  text-decoration: underline;
  color: inherit;
}

.sim-cookie-banner-details {
  font-size: .8rem;
  color: var(--bs-secondary-color);
  margin-top: .5rem;
  padding-top: .5rem;
  border-top: 1px solid var(--bs-border-color);
  width: 100%;
}

.sim-cookie-banner-details table {
  width: 100%;
  border-collapse: collapse;
}

.sim-cookie-banner-details td {
  padding: .2rem .5rem .2rem 0;
  vertical-align: top;
}

.sim-cookie-banner-details td:first-child {
  font-weight: 600;
  white-space: nowrap;
  padding-right: 1rem;
  color: var(--bs-body-color);
}

.sim-cookie-banner-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
  align-items: center;
}

.sim-cookie-declined-notice {
  background: rgba(255,193,7,.1);
  border: 1px solid rgba(255,193,7,.3);
  border-radius: 6px;
  padding: .6rem .9rem;
  font-size: .875rem;
  margin-bottom: 1rem;
}

/* ── Language switcher ─────────────────────────────────────────────────── */
.sim-lang-switcher {
  position: relative;
}

.sim-lang-toggle {
  color: var(--text-color, #eee) !important;
}

.sim-lang-icon {
  display: block;
  width: 24px;
  height: 24px;
}

.sim-lang-menu {
  min-width: 10rem;
  text-align: start;
}

.sim-lang-menu-item {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.sim-lang-code {
  min-width: 2.2rem;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--text-muted-color, #888);
}

/* ── Light-mode button contrast fixes ──────────────────────────────────────
   Bootstrap's secondary gray (#6c757d) is ~4.16:1 on white — below the
   4.5:1 WCAG AA minimum for text. In dark mode Bootstrap handles this
   automatically; these overrides correct light mode only.
   ── */
[data-bs-theme="light"] .btn-outline-secondary {
  --bs-btn-color: #495057;
  --bs-btn-border-color: #6c757d;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #495057;
  --bs-btn-hover-border-color: #495057;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #495057;
  --bs-btn-active-border-color: #495057;
}

[data-bs-theme="light"] .btn-secondary {
  --bs-btn-bg: #495057;
  --bs-btn-border-color: #495057;
  --bs-btn-hover-bg: #3d4348;
  --bs-btn-hover-border-color: #3d4348;
  --bs-btn-active-bg: #3d4348;
  --bs-btn-active-border-color: #3d4348;
}

/* ── Landing page shared components ─────────────────────────────────────────
   Shared across home, for_schools, for_researchers, for_organizations.
   Page-specific overrides (avatar shape, RTL bubbles, etc.) stay in each
   template's extra_styles block.
   ── */

/* Viewport-fixed atmospheric gradient — lives on <body> via .page-gradient class
   so it covers the full viewport and stays put as content scrolls over it.
   Using background-image (not shorthand) preserves Bootstrap's background-color. */
body.page-gradient {
  background-image: radial-gradient(ellipse 120% 65% at 50% 0%,
    color-mix(in srgb, var(--bs-primary) 15%, var(--bs-body-bg)) 0%,
    var(--bs-body-bg) 100%);
  background-attachment: fixed;
}
@media (prefers-color-scheme: dark) {
  body.page-gradient {
    background-image: radial-gradient(ellipse 120% 65% at 50% 0%,
      color-mix(in srgb, var(--bs-primary) 16%, var(--bs-body-bg)) 0%,
      var(--bs-body-bg) 100%);
  }
}
:root[data-bs-theme="dark"]  body.page-gradient {
  background-image: radial-gradient(ellipse 120% 65% at 50% 0%,
    color-mix(in srgb, var(--bs-primary) 16%, var(--bs-body-bg)) 0%,
    var(--bs-body-bg) 100%);
}
:root[data-bs-theme="light"] body.page-gradient {
  background-image: radial-gradient(ellipse 120% 65% at 50% 0%,
    color-mix(in srgb, var(--bs-primary) 15%, var(--bs-body-bg)) 0%,
    var(--bs-body-bg) 100%);
}

/* Shared floating card — used by marketing sections and app dashboard sections */
.page-card {
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 16px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.05));
}
@media (prefers-color-scheme: dark) {
  .page-card { box-shadow: none; }
}
:root[data-bs-theme="dark"]  .page-card { box-shadow: none; }
:root[data-bs-theme="light"] .page-card {
  box-shadow: 0 2px 24px color-mix(in srgb, var(--bs-primary) 8%, rgba(0,0,0,.05));
}

/* .lp-mktg-page is now a structural wrapper only — gradient lives on body */
.lp-mktg-page {}

/* Compact global hero — eyebrow + one-line pitch, sits above the audience tab bar */
.lp-mktg-hero {
  text-align: center;
  padding: 2.75rem 1.5rem 1.25rem;
}
.lp-mktg-headline {
  font-size: clamp(1.2rem, 2.8vw, 1.65rem);
  font-weight: 700;
  font-family: 'Frank Ruhl Libre', Georgia, serif;
  color: var(--bs-body-color);
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 0 auto;
  max-width: 540px;
}

.lp-back          { padding: .85rem 1.5rem; }
.lp-section       { padding: 3.5rem 1.5rem; }

/* Marketing alt-sections sit directly on the page gradient — no frame of their own.
   Legibility comes from the inner .lp-card / .lp-qa elements, not this wrapper. */
.lp-section-alt {
  margin: 2rem 1rem;
}
@media (min-width: 860px) {
  .lp-section-alt { margin-inline: auto; max-width: 1100px; }
}

.lp-inner         { max-width: 860px; margin: 0 auto; }
.lp-inner-sm      { max-width: 640px; margin: 0 auto; }
.lp-section-title { font-size: 1.35rem; font-weight: 700; text-align: center;
                    margin-bottom: 2.25rem;
                    font-family: 'Frank Ruhl Libre', Georgia, serif; }

.lp-hero          { text-align: center; padding: 3.5rem 1.5rem 2rem; }
.lp-eyebrow       { font-size: .75rem; font-weight: 700; letter-spacing: .13em;
                    text-transform: uppercase; color: var(--bs-primary); margin-bottom: .65rem; }
.lp-hero h1       { font-size: clamp(1.75rem, 4vw, 2.6rem); font-weight: 800;
                    line-height: 1.18; letter-spacing: -.02em; margin-bottom: .9rem;
                    font-family: 'Frank Ruhl Libre', Georgia, serif; }
.lp-hero-sub      { font-size: 1.05rem; color: var(--bs-secondary-color);
                    line-height: 1.65; margin: 0 auto; max-width: 520px; }

.lp-chat          { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color);
                    border-radius: 14px; padding: 1.25rem 1.4rem;
                    box-shadow: 0 4px 24px rgba(0,0,0,.07); font-size: .9rem;
                    max-width: 500px; margin: 2rem auto 0; text-align: start; }
.lp-chat-label    { font-size: .7rem; font-weight: 700; letter-spacing: .09em;
                    text-transform: uppercase; color: var(--bs-secondary-color); margin-bottom: .9rem; }
.lp-chat-row      { display: flex; gap: .7rem; margin-bottom: .85rem; }
.lp-chat-row:last-child { margin-bottom: 0; }
.lp-avatar-ai     { background: var(--bs-primary); color: #fff; }
.lp-avatar-user   { background: var(--bs-secondary-bg); color: var(--bs-body-color); }
.lp-bubble        { border-radius: 4px 14px 14px 14px; padding: .55rem .9rem;
                    background: var(--bs-secondary-bg); line-height: 1.5;
                    color: var(--bs-body-color); font-size: .875rem; }
.lp-bubble-ai     { background: color-mix(in srgb, var(--bs-primary) 9%, var(--bs-body-bg));
                    border-radius: 14px 14px 14px 4px; }

.lp-grid          { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
                    gap: 1.1rem; }
.lp-card          { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color);
                    border-radius: 12px; padding: 1.35rem 1.4rem; }
.lp-card h3       { font-size: .9375rem; font-weight: 700; margin-bottom: .3rem; }
.lp-card p        { font-size: .855rem; color: var(--bs-secondary-color);
                    margin: 0; line-height: 1.55; }

.lp-steps         { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; text-align: center; }
@media (max-width: 580px) { .lp-steps { grid-template-columns: 1fr; } }
.lp-step-num      { width: 42px; height: 42px; border-radius: 50%; background: var(--bs-primary);
                    color: #fff; font-weight: 800; font-size: 1rem; display: inline-flex;
                    align-items: center; justify-content: center; margin-bottom: .7rem; }
.lp-step h3       { font-size: .9375rem; font-weight: 700; margin-bottom: .3rem; }
.lp-step p        { font-size: .855rem; color: var(--bs-secondary-color); margin: 0; line-height: 1.55; }

/* ── In-depth scenario sections (for_schools / for_researchers) ──────────────
   Each numbered eyebrow ("1 · Introducing new material") is a genuine step in
   a real sequence — a teaching moment or a research phase — not decoration. */
.lp-scenario + .lp-scenario { margin-top: 3.5rem; }
.lp-scenario-intro { font-size: .96rem; color: var(--bs-secondary-color); line-height: 1.7;
                     max-width: 640px; margin: 0 auto 2.25rem; text-align: center; }

/* Teachers page: 4-beat flow (agent → conversation → feedback → analysis) reusing .lp-step */
.lp-flow          { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.75rem 1.25rem; text-align: center; }
@media (max-width: 860px) { .lp-flow { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .lp-flow { grid-template-columns: 1fr; } }

/* Researchers page: explanation + a concrete worked example */
.lp-example {
  margin-top: 1.15rem;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bs-primary) 6%, transparent);
  border-inline-start: 3px solid color-mix(in srgb, var(--bs-primary) 45%, transparent);
}
.lp-example-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--bs-primary);
  margin-bottom: .35rem;
}
.lp-example p { margin: 0; font-size: .875rem; color: var(--bs-body-color); line-height: 1.6; }

.lp-cta           { background: var(--bs-primary); color: #fff; text-align: center; padding: 3.5rem 1.5rem; }
.lp-cta h2        { font-size: 1.6rem; font-weight: 800; margin-bottom: .65rem;
                    font-family: 'Frank Ruhl Libre', Georgia, serif; }
.lp-cta p         { font-size: .975rem; opacity: .82; margin-bottom: 1.75rem; }
.lp-cta-btn       { display: inline-block; background: #fff; color: var(--bs-primary);
                    border-radius: 8px; padding: .75rem 2rem; font-weight: 700;
                    font-size: .975rem; text-decoration: none; transition: opacity .15s; }
.lp-cta-btn:hover { opacity: .88; color: var(--bs-primary); }
.lp-cta-btn[type="button"] { border: none; cursor: pointer; }

/* Try-free two-choice layout (unauthenticated landing pages) */
.lp-try-choices       { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.75rem; }
.lp-try-choice        { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; text-align: start;
                         background: rgba(255,255,255,.15); color: #fff;
                         border: 1.5px solid rgba(255,255,255,.4); border-radius: 10px;
                         padding: 1.15rem 1.25rem; min-width: 220px; flex: 1; max-width: 280px;
                         transition: background .15s, border-color .15s; }
.lp-try-choice:hover  { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.6); }
.lp-try-choice strong { font-size: .975rem; font-weight: 700; }
.lp-try-choice span   { font-size: .84rem; opacity: .82; line-height: 1.45; }
.lp-try-choice-btn    { display: inline-block; background: #fff; color: var(--bs-primary);
                         border-radius: 999px; padding: .45rem 1.1rem; font-weight: 700;
                         font-size: .82rem; text-decoration: none; margin-top: auto;
                         transition: opacity .15s, transform .15s; }
.lp-try-choice-btn:hover { opacity: .88; color: var(--bs-primary); transform: translateY(-1px); }

/* Hebrew/RTL body font — Assistant has excellent Hebrew coverage */
[dir="rtl"] body {
  font-family: 'Assistant', system-ui, -apple-system, sans-serif;
}
