/* Variables globales pour les couleurs et les dimensions */
:root {
  /* Accent de marque — source unique de vérité.
     Toute nouvelle teinte d'accent doit réutiliser ces tokens.
     Exceptions volontaires : la rampe chaude de l'écran de connexion
     (--cv2-auth-orange*) et le spectre décoratif project-current-spectrum. */
  --accent: #ea6c00;
  --accent-hover: #d96200;
  --accent-on-dark: #fb923c;
  --accent-soft: rgba(234, 108, 0, 0.12);
  --accent-ring: rgba(234, 108, 0, 0.25);

  /* Rayons — échelle unique. Les valeurs littérales 50% (cercle) et les rayons
     composites (ex. 12px 0 0 12px) restent explicites : ce ne sont pas des
     marches d'échelle. */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --dark-bg: #000;
  --light-bg: #fff;
  --active-border-color: var(--accent);
  --active-bg-light: #0000000d;
  --active-bg-dark: #495057;
  --avatar-size: 30px;
  
  /* Reactable Theme Variables */
  --rt-color: #000;
  --rt-bg-color: #fff;
  --rt-header-bg: #f8f9fa;
  --rt-border-color: #e9ecef;
  --rt-hover-color: rgba(0, 0, 0, 0.075);
  --rt-input-bg: #fff;
  --rt-input-color: #000;
  --rt-selection-color: var(--accent);
  --rt-striped-color: rgba(0, 0, 0, 0.02);
  --rt-highlight-color: rgba(0, 0, 0, 0.075);
  --rt-button-hover-bg: #e9ecef;
  --rt-button-active-bg: #dee2e6;
  
  /* Edit style variables */
  --edit-icon-color: #6c757d;
  --edit-icon-hover-color: #495057;
  --edit-box-bg: #fff;
  --edit-box-border: #ddd;
  --edit-box-color: #212529;
}

/* Dark mode theme variables */
.dark-mode {
  --rt-color: hsl(233, 9%, 87%);
  --rt-bg-color: transform;
  --rt-header-bg: #495057;
  --rt-border-color: hsl(233, 9%, 22%);
  --rt-hover-color: hsl(233, 12%, 24%);
  --rt-input-bg: #000;
  --rt-input-color: hsl(233, 9%, 87%);
  --rt-striped-color: hsl(233, 12%, 22%);
  --rt-highlight-color: hsl(233, 12%, 24%);
  --rt-button-hover-bg: #000;
  --rt-button-active-bg: hsl(233, 9%, 28%);
  --rt-expander-button-color: #000;
  
  /* Dark mode edit style variables */
  --edit-icon-color: #adb5bd;
  --edit-icon-hover-color: #e9ecef;
  --edit-box-bg: #343a40;
  --edit-box-border: #495057;
  --edit-box-color: #f8f9fa;
}

/* Styles de base */
html {
  height: 100vh;
  overflow-y: hidden;
}

body {
  height: 100%;
  margin: 0;
  padding: 0;
}
.rt-search{
  background-color: transparent !important;
}
/* Wrapper et contenu */
.content-wrapper {
  background-color: var(--light-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.content-wrapper > .content {
  padding: 10px 0 !important;
}

/* Mode sombre */
.dark-mode .content-wrapper,
.dark-mode .card {
  background-color: var(--dark-bg)!important;
  color: var(--light-bg)!important;
}

/* Barre de navigation */
.navbar {
  padding: 0.59rem !important;
}

.brand-link {
  padding: 0.75rem 0.5rem !important;
}

.layout-navbar-fixed.sidebar-mini-md.sidebar-collapse .wrapper .brand-link,
.layout-navbar-fixed.sidebar-mini.sidebar-collapse .wrapper .brand-link {
  height: 3.45rem !important;
}

/* Onglets et cartes */
.nav-tabs .nav-link {
  border: none;
  border-radius: 0.25rem 0.25rem 0 0;
}

.nav-tabs .nav-link.active,
.dark-mode .nav-tabs .nav-link.active {
  border-bottom: 3px solid var(--active-border-color);
  border-top: none;
}

.nav-tabs .nav-item.show .nav-link,
.nav-tabs .nav-link.active {
  background-color: var(--active-bg-light) !important;
}

.dark-mode .nav-tabs .nav-link.active {
  background-color: var(--active-bg-dark) !important;
}

.card-warning.card-outline-tabs > .card-header a.active {
  border-bottom: 3px solid var(--active-border-color);
  border-top: none;
}

/* Contenu des onglets */
.tab-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.tab-content > .active {
  display: contents !important;
}

.tab-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Formulaires */
.form-group {
  margin-bottom: 0;
}

#projects-share_email .form-control {
  height: calc(2.1rem + 1px) !important;
}

/* Modales */
.md .modal-sm,
.mdl .modal-sm,
.mdxl .modal-sm {
  margin: 0 0 0 auto;
  animation: slideInRight 0.25s both;
}

.md .modal-sm { max-width: 33%; }
.mdl .modal-sm { max-width: 43%; }
.mdxl .modal-sm { max-width: 60%; }

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

.md .modal-content,
.mdl .modal-content,
.mdxl .modal-content {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 0.5rem !important;
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.7rem;
}

.modal-footer {
  padding: 0.5rem !important;
  justify-content: flex-start;
}

.mdxl .modal-body {
  padding: 0;
}

/* Avatars */
.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  margin-right: -10px;
  border: 1px solid var(--light-bg);
  object-fit: cover;
}

.dark-mode .avatar {
  border-color: gray;
}

.avatar:not(img) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #007bff;
  color: var(--light-bg);
  font-size: 14px;
  font-weight: 700;
}

.additional-members {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  background-color: #e0e0e0;
  color: #333;
  font-size: 12px;
  font-weight: 700;
}

.cv2-user-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.65rem;
  padding: 1rem;
  text-align: center;
}

.cv2-user-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
}

.cv2-avatar-change {
  cursor: pointer;
  font-weight: 600;
}

/* Utilitaires */
.center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Barre latérale */
.nav-sidebar > .nav-item {
  margin-bottom: 0.5rem;
}

/* ---------------------------------------------------------------------------
   Sign-in screen (landing-inspired: peach atmosphere + glass card)
--------------------------------------------------------------------------- */
#cv2-auth-screen {
  --cv2-auth-brown: #7c3318;
  --cv2-auth-orange: #f4813a;
  --cv2-auth-orange2: var(--accent);
  --cv2-auth-orange3: #ff9555;
  --cv2-auth-peach: #fde8d8;
  --cv2-auth-peach2: #fbd5bc;
  --cv2-auth-bg: #fefaf7;
  --cv2-auth-text: #1a0f09;
  --cv2-auth-text2: #6b4535;
  --cv2-auth-text3: #b8896e;
  --cv2-auth-border: rgba(124, 51, 24, 0.1);
  --cv2-auth-gold: #f4b400;
  --cv2-auth-green: #28a745;
  --cv2-auth-blue: #007bff;
  --cv2-auth-shadow: 0 4px 28px rgba(124, 51, 24, 0.07);
  --cv2-auth-shadow-lg: 0 16px 56px rgba(124, 51, 24, 0.13);

  position: fixed;
  inset: 0;
  z-index: 1500;
  overflow: auto;
  background: var(--cv2-auth-bg);
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--cv2-auth-text);
}

body.cv2-app-ready #cv2-auth-screen,
body.cv2-access-gate #cv2-auth-screen {
  display: none;
}

#cv2-auth-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.cv2-auth-blob {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(90px);
}

.cv2-auth-blob-1 {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, #ffd4b8 0%, transparent 70%);
  top: -250px;
  right: -150px;
  opacity: 0.5;
  animation: cv2AuthBlobFloat 32s ease-in-out infinite alternate;
}

.cv2-auth-blob-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #fecbb0 0%, transparent 70%);
  bottom: 5%;
  left: -180px;
  opacity: 0.4;
  animation: cv2AuthBlobFloat 40s ease-in-out infinite alternate-reverse;
}

.cv2-auth-blob-3 {
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, #ffe8d5 0%, transparent 70%);
  top: 38%;
  left: 38%;
  opacity: 0.35;
  animation: cv2AuthBlobFloat 28s ease-in-out infinite alternate;
}

@keyframes cv2AuthBlobFloat {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(30px, 20px) scale(1.06); }
}

.cv2-auth-shell {
  position: relative;
  z-index: 1;
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(340px, 0.8fr);
  align-items: center;
  gap: clamp(12px, 3vw, 40px);
  padding: 0 clamp(8px, 2vw, 24px);
}

.cv2-auth-brand {
  display: flex;
  align-items: center;
  padding: 48px clamp(20px, 3.5vw, 48px);
}

.cv2-auth-brand-inner {
  max-width: 640px;
  width: 100%;
  margin-left: auto;
  margin-right: clamp(12px, 2.5vw, 36px);
}

.cv2-auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.4rem 1.05rem;
  margin-bottom: 1.35rem;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid var(--cv2-auth-peach2);
  color: var(--cv2-auth-orange2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  box-shadow: var(--cv2-auth-shadow);
  animation: cv2AuthRise 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.08s both;
}

.cv2-auth-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cv2-auth-orange);
  animation: cv2AuthPulse 2s ease-in-out infinite;
}

@keyframes cv2AuthPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.7); }
}

.cv2-auth-wordmark {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: clamp(2.6rem, 5.5vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 0.95;
  color: var(--cv2-auth-text);
  animation: cv2AuthRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.16s both;
}

.cv2-auth-brand-mark {
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  border-radius: 3px;
  vertical-align: 0.12em;
  background:
    linear-gradient(
      135deg,
      var(--cv2-auth-gold) 0 33%,
      var(--cv2-auth-green) 33% 66%,
      var(--cv2-auth-blue) 66%
    );
}

.cv2-auth-byline {
  margin: 0.65rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--cv2-auth-text3);
  animation: cv2AuthRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.22s both;
}

.cv2-auth-byline strong {
  color: var(--cv2-auth-text);
  font-weight: 600;
}

.cv2-auth-tagline {
  margin: 1.1rem 0 0;
  max-width: 36ch;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: clamp(1.05rem, 1.8vw, 1.3rem);
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.02em;
  color: var(--cv2-auth-brown);
  animation: cv2AuthRise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.cv2-auth-flow {
  margin: 2rem 0 0;
  padding: 0;
  background: none;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  animation: cv2AuthRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.42s both;
}

.cv2-auth-flow-kicker,
.cv2-auth-flow-title {
  display: none;
}

/* Flow diagram (landing connectors section, compact for auth) */
.cv2-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(40px, 64px) auto minmax(40px, 64px) minmax(0, 1.15fr);
  align-items: center;
  gap: 0;
  width: 100%;
  max-width: 640px;
}

.cv2-flow__sources {
  display: grid;
  grid-template-columns: repeat(4, minmax(44px, 56px));
  gap: 10px;
  justify-content: end;
}

.cv2-flow-tile {
  aspect-ratio: 1;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(124, 51, 24, 0.08);
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(124, 51, 24, 0.06);
}

.cv2-flow-tile img {
  width: 52%;
  height: 52%;
  object-fit: contain;
}

.cv2-flow-tile--dim {
  opacity: 0.34;
}

.cv2-flow__wires {
  position: relative;
  height: 168px;
  align-self: center;
}

.cv2-flow__wires svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cv2-flow__wires path {
  fill: none;
  stroke: rgba(122, 162, 227, 0.7);
  stroke-width: 1.5;
}

.cv2-flow__wires circle {
  fill: #7aa2e3;
}

.cv2-flow__hub {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  z-index: 2;
}

.cv2-flow__hub-ring {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  border-top-color: rgba(0, 123, 255, 0.35);
  border-right-color: rgba(40, 167, 69, 0.28);
  border-bottom-color: rgba(244, 180, 0, 0.3);
  animation: cv2HubOrbit 10s linear infinite;
}

.cv2-flow__hub-ring--soft {
  inset: -24px;
  border-color: rgba(20, 24, 31, 0.08);
  border-style: dashed;
  animation-direction: reverse;
  animation-duration: 18s;
}

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

.cv2-flow__hub-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #007bff;
  display: grid;
  place-items: center;
  box-shadow:
    0 14px 32px rgba(0, 123, 255, 0.28),
    0 0 0 9px rgba(0, 123, 255, 0.08);
}

.cv2-flow__hub-badge {
  width: 58%;
  height: 58%;
  border-radius: 50%;
  background: #fff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(20, 24, 31, 0.04);
}

.cv2-flow__hub-badge img {
  width: 64%;
  height: auto;
}

.cv2-flow__outputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(96px, 118px));
  gap: 8px;
  justify-content: start;
}

.cv2-flow-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(124, 51, 24, 0.08);
  border-radius: var(--radius-lg);
  padding: 8px 9px 7px;
  box-shadow: 0 8px 20px rgba(124, 51, 24, 0.06);
  min-height: 62px;
}

.cv2-flow-card__label {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5a6573;
  margin-bottom: 4px;
}

.cv2-flow-card svg {
  width: 100%;
  height: 34px;
  display: block;
}

.cv2-auth-panel {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 56px clamp(28px, 5vw, 72px);
}

.cv2-auth-card {
  width: 100%;
  max-width: 400px;
  margin-left: clamp(8px, 2vw, 40px);
  padding: 2rem 1.85rem 1.75rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--cv2-auth-border);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(124, 51, 24, 0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: cv2AuthRise 0.85s cubic-bezier(0.16, 1, 0.3, 1) 0.28s both;
}

.cv2-auth-card-logo {
  width: 40px;
  height: auto;
  display: block;
  margin-bottom: 1.1rem;
}

.cv2-auth-title {
  margin: 0;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--cv2-auth-text);
}

.cv2-auth-subtitle {
  margin: 0.45rem 0 1.45rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--cv2-auth-text2);
}

.cv2-auth-help {
  margin: 1.15rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--cv2-auth-text3);
}

/* Access request gate — clean horizontal card ---------------------------- */
#cv2-access-screen {
  --cv2-auth-bg: #f3f4f6;
  --cv2-auth-surface: #ffffff;
  --cv2-auth-text: #111827;
  --cv2-auth-muted: #6b7280;
  --cv2-auth-border: rgba(17, 24, 39, 0.1);
  --cv2-auth-soft: #f9fafb;
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  overflow: auto;
  background: var(--cv2-auth-bg);
  color: var(--cv2-auth-text);
  font-family: "DM Sans", system-ui, sans-serif;
}

.cv2-access-shell {
  width: min(920px, 100%);
  margin: auto;
  position: relative;
  z-index: 1;
}

.access-card {
  display: grid;
  grid-template-columns: minmax(240px, 292px) minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  min-height: 440px;
  padding: 0;
  border-radius: 16px;
  background: var(--cv2-auth-surface);
  border: 1px solid var(--cv2-auth-border);
  box-shadow: 0 10px 32px rgba(17, 24, 39, 0.06);
  overflow: visible;
}

.access-card--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  grid-template-columns: 1fr;
  color: var(--cv2-auth-muted);
  font-size: 0.95rem;
}

.access-card__aside {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  padding: 1.75rem 1.5rem;
  background: #fafbfc;
  border-right: 1px solid var(--cv2-auth-border);
  border-radius: 16px 0 0 16px;
}

.access-card__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: inherit;
  max-width: 100%;
  transition: opacity 0.15s ease;
}

.access-card__brand:hover,
.access-card__brand:focus {
  text-decoration: none;
  color: inherit;
  opacity: 0.82;
  outline: none;
}

.access-card__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.access-card__wordmark {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}

.access-card__product {
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--cv2-auth-text);
}

.access-card__byline {
  margin-top: 0.1rem;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--cv2-auth-muted);
}

.access-card__byline strong {
  font-weight: 650;
  color: var(--cv2-auth-muted);
}

.access-card__identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  margin-top: auto;
}

.access-card__avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #e5e7eb;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--cv2-auth-border);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--cv2-auth-text);
  overflow: hidden;
}

.access-card__avatar-wrap {
  position: relative;
  display: inline-flex;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  outline: none;
}

.access-card__avatar-wrap:hover .access-card__avatar,
.access-card__avatar-wrap:focus-within .access-card__avatar {
  box-shadow: 0 0 0 1px var(--cv2-auth-border), 0 0 0 4px rgba(234, 108, 0, 0.18);
}

.access-card__avatar-wrap.is-loading .access-card__avatar {
  opacity: 0.55;
  filter: grayscale(0.15);
}

.access-card__avatar-wrap.is-updating .access-card__avatar {
  animation: access-avatar-pop 0.42s ease;
}

@keyframes access-avatar-pop {
  0% { transform: scale(0.92); opacity: 0.7; }
  60% { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

.access-card__avatar-input,
.access-card__avatar-data {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.access-card__avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(17, 24, 39, 0.18);
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.access-card__avatar-wrap:hover .access-card__avatar-badge,
.access-card__avatar-wrap:focus-within .access-card__avatar-badge {
  background: #ea6c00;
  transform: scale(1.06);
}

.access-card__avatar-hint {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--cv2-auth-muted);
}

img.access-card__avatar {
  display: block;
  padding: 0;
}

.access-card__avatar--fallback {
  background: linear-gradient(145deg, #ffe8d6 0%, #ffd4b8 100%);
}

.access-card__who {
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.access-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--cv2-auth-text);
  word-break: break-word;
}

.access-card__email {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--cv2-auth-muted);
  word-break: break-all;
}

.access-card__title {
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--cv2-auth-border);
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cv2-auth-text);
  line-height: 1.25;
}

.access-card__lede {
  margin: 0.4rem 0 0;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--cv2-auth-muted);
}

.access-card__main {
  padding: 1.75rem 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: visible;
  border-radius: 0 16px 16px 0;
}

.access-form,
.access-form__row,
.access-field,
.access-field .form-group,
.access-field .shiny-input-container {
  overflow: visible;
}

.access-form {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  flex: 1;
}

.access-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.access-field {
  min-width: 0;
}

.access-website {
  width: 100%;
}

.access-website__control {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--cv2-auth-border);
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
}

.access-website__control:focus-within {
  border-color: #ea6c00;
  box-shadow: 0 0 0 3px rgba(234, 108, 0, 0.12);
}

.access-website.has-host .access-website__control {
  border-color: rgba(234, 108, 0, 0.4);
}

.access-website__mark {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--cv2-auth-muted);
  font-size: 0.9rem;
  pointer-events: none;
  z-index: 1;
}

.access-website__favicon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: none;
  border-radius: 3px;
}

.access-website__favicon.is-visible {
  display: block;
}

.access-website__fallback.is-hidden {
  display: none;
}

.access-website__input-wrap,
.access-website__input-wrap .form-group,
.access-website__input-wrap .shiny-input-container {
  margin-bottom: 0 !important;
  width: 100%;
}

#cv2-access-screen .access-website__control .form-control {
  height: 42px;
  min-height: 42px;
  padding-left: 42px;
  border: none !important;
  border-radius: 10px;
  box-shadow: none !important;
  background: transparent;
}

#cv2-access-screen .access-website__control .form-control:focus {
  border: none !important;
  box-shadow: none !important;
}

.access-field .form-group,
.access-field .shiny-input-container,
.access-form .form-group,
.access-form .shiny-input-container {
  margin-bottom: 0 !important;
  width: 100%;
}

.access-optional {
  margin-left: 0.25rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--cv2-auth-muted);
}

#cv2-access-screen label {
  display: block;
  margin: 0 0 0.35rem;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cv2-auth-muted);
}

#cv2-access-screen .form-control,
#cv2-access-screen select.form-control,
#cv2-access-screen textarea.form-control {
  height: 42px;
  min-height: 42px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--cv2-auth-border);
  border-radius: 10px;
  background: #fff;
  color: var(--cv2-auth-text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* pickerInput wraps itself as .form-control — kill the outer frame */
#cv2-access-screen .bootstrap-select.form-control,
#cv2-access-screen .bootstrap-select.btn-group {
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

#cv2-access-screen textarea.form-control {
  height: auto;
  min-height: 88px;
  resize: vertical;
  line-height: 1.45;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

#cv2-access-screen .form-control::placeholder,
#cv2-access-screen textarea.form-control::placeholder {
  color: #9ca3af;
  opacity: 1;
}

#cv2-access-screen .form-control:focus,
#cv2-access-screen select.form-control:focus,
#cv2-access-screen textarea.form-control:focus {
  border-color: rgba(244, 129, 58, 0.55);
  outline: none;
  box-shadow: 0 0 0 3px rgba(244, 129, 58, 0.12) !important;
}

#cv2-access-screen .bootstrap-select {
  width: 100% !important;
  position: relative;
  z-index: 2;
}

#cv2-access-screen .bootstrap-select.show {
  z-index: 10100;
}

#cv2-access-screen .bootstrap-select > .dropdown-toggle,
#cv2-access-screen .bootstrap-select .btn.access-picker-btn {
  height: 42px !important;
  min-height: 42px !important;
  padding: 0.5rem 2.25rem 0.5rem 0.85rem !important;
  border: 1px solid var(--cv2-auth-border) !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: var(--cv2-auth-text) !important;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: none !important;
  outline: none !important;
}

#cv2-access-screen .bootstrap-select > .dropdown-toggle.bs-placeholder,
#cv2-access-screen .bootstrap-select .btn.access-picker-btn.bs-placeholder {
  color: #9ca3af !important;
}

#cv2-access-screen .bootstrap-select > .dropdown-toggle:focus,
#cv2-access-screen .bootstrap-select.show > .dropdown-toggle,
#cv2-access-screen .bootstrap-select .btn.access-picker-btn:focus {
  border-color: rgba(244, 129, 58, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(244, 129, 58, 0.12) !important;
}

/* Menus: no cadran — soft shadow only; body-container for clip escape */
#cv2-access-screen .bootstrap-select .dropdown-menu,
body.cv2-access-gate .bootstrap-select .dropdown-menu {
  margin-top: 4px !important;
  border: none !important;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(17, 24, 39, 0.14);
  padding: 0.4rem;
  overflow: hidden;
  z-index: 10120 !important;
  background: #fff;
}

#cv2-access-screen .bootstrap-select .bs-searchbox,
body.cv2-access-gate .bootstrap-select .bs-searchbox {
  padding: 6px 6px 4px;
}

#cv2-access-screen .bootstrap-select .bs-searchbox input,
body.cv2-access-gate .bootstrap-select .bs-searchbox input {
  height: 36px;
  border-radius: 8px;
  border: none !important;
  background: #f3f4f6;
  font-size: 0.85rem;
  box-shadow: none !important;
}

#cv2-access-screen .bootstrap-select .dropdown-item,
body.cv2-access-gate .bootstrap-select .dropdown-item {
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.875rem;
  color: var(--cv2-auth-text, #111827);
}

#cv2-access-screen .bootstrap-select .dropdown-item:hover,
#cv2-access-screen .bootstrap-select .dropdown-item:focus,
body.cv2-access-gate .bootstrap-select .dropdown-item:hover,
body.cv2-access-gate .bootstrap-select .dropdown-item:focus {
  background: #f9fafb;
  color: #111827;
}

#cv2-access-screen .bootstrap-select .dropdown-item.active,
#cv2-access-screen .bootstrap-select .dropdown-item:active,
body.cv2-access-gate .bootstrap-select .dropdown-item.active,
body.cv2-access-gate .bootstrap-select .dropdown-item:active {
  background: rgba(244, 129, 58, 0.12);
  color: #111827;
}

.access-actions {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.access-actions__secondary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.access-actions .btn,
.access-home-link {
  width: 100%;
  min-height: 42px;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  box-shadow: none !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.access-primary-btn,
#cv2-access-screen .access-primary-btn {
  color: #fff !important;
  background: var(--accent) !important;
  border: 1px solid var(--accent) !important;
}

.access-primary-btn:hover,
#cv2-access-screen .access-primary-btn:hover {
  color: #fff !important;
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

.access-secondary-btn,
#cv2-access-screen .access-secondary-btn,
.access-home-link {
  color: var(--cv2-auth-text) !important;
  background: #fff !important;
  border: 1px solid var(--cv2-auth-border) !important;
}

.access-secondary-btn:hover,
#cv2-access-screen .access-secondary-btn:hover,
.access-home-link:hover {
  color: var(--cv2-auth-text) !important;
  background: var(--cv2-auth-soft) !important;
  border-color: rgba(17, 24, 39, 0.16) !important;
  text-decoration: none;
}

.access-status {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.65rem;
  padding: 1.25rem 0.5rem 0.5rem;
  min-height: 220px;
}

.access-status__icon,
.access-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0;
  border-radius: 999px;
  font-size: 1.55rem;
  line-height: 1;
  background: var(--cv2-auth-soft);
}

.access-status__icon.success,
.access-status-icon.success { color: #28a745; background: rgba(40, 167, 69, 0.1); }
.access-status__icon.pending,
.access-status-icon.pending { color: var(--accent); background: rgba(234, 108, 0, 0.1); }
.access-status__icon.error,
.access-status-icon.error { color: #b42318; background: rgba(180, 35, 24, 0.08); }

.access-status__label {
  margin: 0.15rem 0 0;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cv2-auth-text);
  line-height: 1.25;
}

.access-status__hint {
  margin: 0;
  max-width: 28ch;
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--cv2-auth-muted);
}

.access-status__company {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.15rem;
  padding: 0.35rem 0.7rem 0.35rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--cv2-auth-border);
  background: #fff;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--cv2-auth-text);
}

.access-status__company a {
  color: inherit;
  text-decoration: none;
}

.access-status__company a:hover {
  color: #ea6c00;
  text-decoration: underline;
}

.access-status__favicon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
}

@media (max-width: 760px) {
  .access-card {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .access-card__aside {
    border-right: none;
    border-bottom: 1px solid var(--cv2-auth-border);
    border-radius: 16px 16px 0 0;
    padding: 1.35rem 1.35rem 1.15rem;
    gap: 1rem;
  }

  .access-card__identity {
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    gap: 0.9rem;
  }

  .access-card__avatar {
    width: 52px;
    height: 52px;
  }

  .access-card__avatar-badge {
    width: 22px;
    height: 22px;
    font-size: 0.6rem;
  }

  .access-card__title {
    padding-top: 0;
    border-top: none;
    font-size: 1.1rem;
  }

  .access-card__lede {
    display: none;
  }

  .access-card__main {
    padding: 1.35rem;
    border-radius: 0 0 16px 16px;
  }

  .access-form__row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .access-actions__secondary {
    grid-template-columns: 1fr;
  }
}

/* Project brand modal — interactive chrome placeholder -------------------- */
.project-brand-dialog .modal-dialog {
  max-width: 700px;
}

.project-brand-dialog .modal-body {
  padding: 1.15rem 1.35rem 1.25rem !important;
}

.project-brand-modal {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.project-brand-modal__lede {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #6b7280;
}

.project-brand-website .form-group,
.project-brand-website .shiny-input-container {
  margin-bottom: 0.95rem !important;
}

.project-brand-modal .project-brand-actions,
.project-brand-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.15rem 0 0.35rem;
}

/* Brand preview — same card + footer actions pattern as project cards */
.brand-preview-card.dataset-card {
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 4px 18px rgba(17, 24, 39, 0.07);
}

.brand-preview-card .brand-shell {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.brand-preview-card__footer {
  gap: 0.45rem 0.65rem !important;
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-start;
  padding: 0.65rem 0.75rem !important;
  margin-top: 0 !important;
  border-top: 1px solid #eef0f3;
  border-radius: 0 0 14px 14px;
  background: #f8f9fb;
}

.brand-footer-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  min-width: 3.1rem;
}

.brand-preview-card__footer > .btn,
.brand-preview-card__footer > .brand-footer-swatch,
.brand-footer-item > .brand-footer-swatch {
  margin-right: 0 !important;
  position: relative;
  width: 2.4rem;
  height: 2.4rem;
  min-width: 2.4rem;
  min-height: 2.4rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.brand-footer-item > .brand-footer-swatch:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.12);
}

.brand-footer-swatch {
  margin-bottom: 0 !important;
  cursor: pointer;
  overflow: hidden;
  border-width: 2px !important;
  border-color: var(--brand-swatch, currentColor) !important;
  background: #fff !important;
}

.brand-footer-swatch::after {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
  background: var(--brand-swatch, currentColor);
  pointer-events: none;
}

.brand-footer-swatch .brand-shell__zone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.brand-footer-swatch-label {
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #6b7280;
  line-height: 1.1;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.brand-shell__logo-data {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.brand-preview-card .brand-shell__hint {
  margin-top: 0.55rem;
}

.project-brand-note {
  margin: 0;
  font-size: 0.78rem;
  color: #9a3412;
}

.project-brand-palette {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
}

.project-brand-palette__label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.project-brand-palette__hex {
  font-size: 0.8rem;
  color: #6b7280;
  font-variant-numeric: tabular-nums;
}

.project-brand-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}

.project-brand-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.project-brand-swatch.is-active {
  border-color: #111827;
  box-shadow: 0 0 0 1px #111827;
}

.project-brand-swatch--custom {
  background:
    linear-gradient(45deg, #ddd 25%, transparent 25%) 0 0 / 8px 8px,
    linear-gradient(-45deg, #ddd 25%, transparent 25%) 0 4px / 8px 8px,
    linear-gradient(45deg, transparent 75%, #ddd 75%) 4px -4px / 8px 8px,
    linear-gradient(-45deg, transparent 75%, #ddd 75%) -4px 0 / 8px 8px,
    #fff;
}

.project-brand-swatch--custom input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

/* Mini app shell — match mcube: logo in header, icon rail below */
.brand-shell {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-rows: 48px minmax(140px, auto);
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  background: #f3f4f6;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  margin-top: 0.35rem;
}

.brand-shell--chrome-only {
  grid-template-rows: 48px 148px;
}

.brand-shell--with-status {
  grid-template-rows: 48px minmax(148px, auto);
}

.brand-shell__top {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  align-items: stretch;
  min-height: 48px;
  background: var(--shell-navbar, #fff);
  border-bottom: 1px solid var(--shell-navbar-border, rgba(0, 0, 0, 0.08));
  color: var(--shell-navbar-fg, #111827);
}

.brand-shell__brand-block {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 56px;
  width: 56px;
  background: var(--shell-logo-bg, #fff);
}

.brand-shell__logo-upload {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.brand-shell__logo-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 3;
}

.brand-shell__logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 24, 39, 0.08);
  pointer-events: none;
  transition: transform 0.15s ease;
}

.brand-shell__logo-overlay {
  position: absolute;
  inset: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.55);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
  z-index: 2;
  font-size: 0.55rem;
  font-weight: 650;
  text-align: center;
  line-height: 1.1;
  padding: 0.15rem;
}

.brand-shell__logo-overlay .fa-camera,
.brand-shell__logo-overlay .fas.fa-camera {
  font-size: 0.72rem;
}

.brand-shell__logo-overlay-text {
  display: none;
}

.brand-shell__logo-upload:hover .brand-shell__logo-overlay,
.brand-shell__logo-upload.is-loading .brand-shell__logo-overlay,
.brand-shell__logo-upload.is-updating .brand-shell__logo-overlay {
  opacity: 1;
}

.brand-shell__logo-upload:hover .brand-shell__logo {
  transform: scale(0.96);
}

.brand-shell__logo-bg-chip,
.brand-shell__zone--brand-chip {
  position: absolute !important;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  min-width: 12px;
  min-height: 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.18), 0 1px 2px rgba(17, 24, 39, 0.12);
  background: var(--shell-logo-bg, #fff);
  z-index: 4;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.brand-shell__logo-bg-chip:hover,
.brand-shell__zone--brand-chip:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px rgba(17, 24, 39, 0.22), 0 2px 4px rgba(17, 24, 39, 0.14);
}

.brand-shell__logo-bg-chip .brand-shell__zone-input,
.brand-shell__zone--brand-chip .brand-shell__zone-input {
  z-index: 5;
}

.brand-shell__navbar {
  flex: 1 1 auto;
  min-width: 0;
}

.brand-shell__navbar-row {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 48px;
  padding-left: 0.85rem;
}

.brand-shell__wordmark {
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
  pointer-events: none;
  flex: 0 1 auto;
  color: inherit;
}

.brand-shell__wordmark--editable {
  pointer-events: auto;
  position: relative;
  z-index: 3;
  cursor: text;
  outline: none;
  border-radius: 4px;
  padding: 0.08rem 0.28rem;
  margin: -0.08rem -0.28rem;
  min-width: 2.5rem;
  max-width: 10rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-shell__wordmark--editable:hover {
  background: rgba(17, 24, 39, 0.06);
}

.brand-shell__wordmark--editable:focus {
  background: rgba(17, 24, 39, 0.08);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--shell-primary, #007bff) 35%, transparent);
}

.brand-shell__navbar-spacer {
  flex: 1 1 auto;
  min-width: 0.5rem;
  align-self: stretch;
  pointer-events: none;
}

.brand-shell__navbar-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  pointer-events: none;
}

.brand-shell__pill {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
}

.brand-shell__sidebar {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 0.35rem;
  background: var(--shell-sidebar, #ffffff);
  color: var(--shell-sidebar-fg, #6c757d);
  cursor: pointer;
}

.brand-shell__sidebar > .brand-shell__nav-item {
  position: relative;
  z-index: 1;
}

.brand-shell__sidebar > .brand-shell__nav-item:not(.brand-shell__zone) {
  pointer-events: none;
}

.brand-shell__sidebar > .brand-shell__zone--sidebar {
  z-index: 3;
}

.brand-shell__nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 0.25rem;
  opacity: 0.85;
  color: inherit;
}

.brand-shell__nav-item.is-active {
  background: var(--shell-sidebar-active, var(--shell-accent));
  color: var(--shell-sidebar-active-fg, #fff);
  opacity: 1;
}

.brand-shell__fa {
  font-size: 0.95rem;
  line-height: 1;
  pointer-events: none;
}

.brand-shell__content {
  grid-column: 2;
  grid-row: 2;
  padding: 0.85rem 1rem 1rem;
  background: #f8fafc;
}

.brand-shell__content--empty {
  display: flex;
  align-items: flex-start;
  padding: 1rem 1.1rem;
  min-height: 0;
  background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
}

.brand-shell__status-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.65rem 0.7rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.brand-shell__status-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b7280;
}

.brand-shell__status-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
}

.brand-shell__status-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 58px;
  padding: 0.4rem 0.25rem;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  cursor: pointer;
}

.brand-shell__status-swatch:hover {
  border-color: #d1d5db;
  background: #fff;
}

.brand-shell__status-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.12);
  pointer-events: none;
}

.brand-shell__zone--status-primary .brand-shell__status-dot {
  background: var(--shell-primary, var(--shell-accent, #007bff));
}

.brand-shell__zone--status-success .brand-shell__status-dot {
  background: var(--shell-success, #28a745);
}

.brand-shell__zone--status-info .brand-shell__status-dot {
  background: var(--shell-info, #17a2b8);
}

.brand-shell__zone--status-warning .brand-shell__status-dot {
  background: var(--shell-warning, #ffc107);
}

.brand-shell__zone--status-error .brand-shell__status-dot,
.brand-shell__zone--status-danger .brand-shell__status-dot {
  background: var(--shell-danger, #dc3545);
}

.brand-shell__status-label {
  font-size: 0.62rem;
  font-weight: 600;
  color: #4b5563;
  line-height: 1.1;
  text-align: center;
  pointer-events: none;
}

.brand-shell__accent-swatch,
.brand-shell__zone--accent-swatch {
  flex: 0 0 28px;
  width: 28px;
  align-self: center;
  margin-right: 0.75rem;
  height: 28px;
  border-radius: 6px;
  background: var(--shell-accent);
  border: 1px solid rgba(17, 24, 39, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.brand-shell__zone--accent-swatch:hover {
  filter: brightness(1.06);
}

.brand-shell__tabs {
  display: flex;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid #e5e7eb;
}

.brand-shell__tab {
  padding: 0.2rem 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #9ca3af;
}

.brand-shell__tab.is-active {
  color: #111827;
  border-bottom: 2px solid var(--shell-accent);
  margin-bottom: -1px;
}

.brand-shell__cards {
  display: grid;
  grid-template-columns: 1.35fr auto;
  gap: 0.75rem;
  align-items: end;
}

.brand-shell__card {
  min-height: 72px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  padding: 0.65rem;
}

.brand-shell__card--current {
  border-color: var(--shell-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--shell-accent) 35%, transparent);
}

.brand-shell__card-line {
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  margin-bottom: 0.4rem;
}

.brand-shell__card-line--short {
  width: 55%;
  margin-bottom: 0;
}

.brand-shell__zone {
  position: relative;
  margin: 0;
  cursor: pointer;
}

.brand-shell__zone-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: 0;
  padding: 0;
  z-index: 2;
}

/* Must beat .brand-shell__zone { position: relative } — otherwise rail has 0 height */
.brand-shell__zone.brand-shell__zone--rail {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: auto;
  height: auto;
  margin: 0;
}

.brand-shell__zone--navbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 48px;
  padding: 0.55rem 0.95rem 0.55rem 0.25rem;
  background: transparent;
  color: inherit;
  box-shadow: none;
  border: 0;
}

.brand-shell__zone--navbar:hover {
  background: rgba(17, 24, 39, 0.03);
  box-shadow: inset 0 0 0 1px rgba(17, 24, 39, 0.06);
}

.brand-shell__zone--sidebar:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--shell-sidebar-active, #007bff) 35%, transparent);
}

.brand-shell__zone.brand-shell__zone--rail:hover {
  box-shadow: inset 0 0 0 999px rgba(255, 255, 255, 0.06),
    inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.brand-shell__content-placeholder {
  width: 100%;
  max-width: 220px;
  padding: 0.85rem 0.9rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.brand-shell__content-placeholder .brand-shell__card-line:first-child {
  width: 42%;
  height: 6px;
  margin-bottom: 0.55rem;
}

.brand-shell__fake-btn,
.brand-shell__zone--accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
  min-height: 34px;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  background: var(--shell-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.12);
}

.brand-shell__zone--accent:hover {
  filter: brightness(1.06);
}

.brand-shell__hint {
  margin: 0.7rem 0 0;
  font-size: 0.72rem;
  color: #6b7280;
  line-height: 1.35;
}

@media (max-width: 520px) {
  .brand-shell {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .brand-shell__brand-block {
    flex-basis: 52px;
    width: 52px;
  }

  .brand-shell__cards {
    grid-template-columns: 1fr;
  }
}

/* Per-project bs4Dash chrome — match mcube: accent on active item + navbar edge */
body.cv2-branded .main-header.navbar {
  background-color: var(--brand-navbar-bg, #fff) !important;
  border-bottom: 1px solid var(--brand-navbar-border, rgba(0, 0, 0, 0.08)) !important;
  box-shadow: none !important;
  color: var(--brand-navbar-fg, #1f2d3d) !important;
}

body.cv2-branded .brand-link,
body.cv2-branded .main-sidebar .brand-link,
body.cv2-branded .main-header .brand-link {
  background-color: var(--brand-logo-bg, #fff) !important;
}

body.cv2-branded .brand-link .brand-text,
body.cv2-branded .main-header .brand-link .brand-text {
  color: var(--brand-navbar-fg, #1f2d3d) !important;
}

/* Keep AdminLTE collapse: hide wordmark when sidebar is collapsed (like default mcube) */
body.cv2-branded.sidebar-mini.sidebar-collapse .brand-link .brand-text,
body.cv2-branded.sidebar-mini.sidebar-collapse .main-header .brand-link .brand-text {
  display: none !important;
}

body.cv2-branded .main-sidebar,
body.cv2-branded .main-sidebar .sidebar {
  background-color: var(--brand-sidebar-bg, #ffffff) !important;
}

body.cv2-branded .nav-sidebar .nav-link {
  color: var(--brand-sidebar-fg, #6c757d) !important;
}

body.cv2-branded .nav-sidebar .nav-link .nav-icon {
  color: inherit !important;
}

body.cv2-branded .nav-sidebar .nav-link:hover {
  color: var(--brand-sidebar-hover, #343a40) !important;
  background-color: rgba(0, 0, 0, 0.04) !important;
}

body.cv2-branded .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active,
body.cv2-branded .sidebar-light-primary .nav-sidebar > .nav-item > .nav-link.active,
body.cv2-branded .main-sidebar .nav-sidebar > .nav-item > .nav-link.active,
body.cv2-branded .nav-sidebar .nav-link.active,
body.cv2-branded .nav-sidebar .nav-item > .nav-link.active {
  background-color: var(--brand-sidebar-active, var(--accent)) !important;
  color: var(--brand-sidebar-active-fg, #fff) !important;
}

body.cv2-branded .sidebar-dark-primary .nav-sidebar > .nav-item > .nav-link.active .nav-icon,
body.cv2-branded .main-sidebar .nav-sidebar > .nav-item > .nav-link.active .nav-icon,
body.cv2-branded .nav-sidebar .nav-link.active .nav-icon {
  color: var(--brand-sidebar-active-fg, #fff) !important;
}

body.cv2-branded .sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .nav-sidebar .nav-link.active,
body.cv2-branded.sidebar-mini.sidebar-collapse .main-sidebar:not(:hover) .nav-sidebar .nav-link.active {
  background-color: var(--brand-sidebar-active, var(--accent)) !important;
}

body.cv2-branded .btn-primary {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}

body.cv2-branded .btn-primary:hover,
body.cv2-branded .btn-primary:focus,
body.cv2-branded .btn-primary:active {
  background-color: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

/* Pill tabs (Model Results: Media Performance / ROI vs mROI / …) use brand primary */
body.cv2-branded .nav-pills .nav-link.active,
body.cv2-branded .nav-pills .show > .nav-link,
body.cv2-branded .nav-pills .nav-item.show .nav-link {
  background-color: var(--bs-primary, var(--primary, var(--accent))) !important;
  border-color: var(--bs-primary, var(--primary, var(--accent))) !important;
  color: #fff !important;
}

/* Card / page tabs (Registry, Builder, Results, …) — inactive labels were Bootstrap blue */
body.cv2-branded .nav-tabs .nav-link,
body.cv2-branded .nav-tabs .nav-link:hover,
body.cv2-branded .nav-tabs .nav-link:focus,
body.cv2-branded .card-outline-tabs .card-header a,
body.cv2-branded .card-outline-tabs .card-header a:hover,
body.cv2-branded .card-outline-tabs .card-header a:focus {
  color: var(--bs-primary, var(--primary, var(--accent))) !important;
}

body.cv2-branded .nav-tabs .nav-link.active,
body.cv2-branded .nav-tabs .nav-item.show .nav-link,
body.cv2-branded .card-outline-tabs .card-header a.active {
  color: var(--bs-primary, var(--primary, var(--accent))) !important;
  border-bottom-color: var(--bs-primary, var(--primary, var(--accent, var(--active-border-color)))) !important;
}

/* Native disconnect screen (sever-style) ---------------------------------- */
#shiny-disconnected-overlay,
#ss-connect-dialog,
body.cv2-sever-active #shiny-disconnected-overlay,
body.cv2-sever-active #ss-connect-dialog {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

#cv2-sever {
  position: fixed;
  inset: 0;
  z-index: 2000000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #fefaf7;
  font-family: "DM Sans", system-ui, sans-serif;
  color: #1a0f09;
}

.cv2-sever__blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(90px);
  z-index: 0;
}

.cv2-sever__blob-1 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #ffd4b8 0%, transparent 70%);
  top: -180px;
  right: -120px;
  opacity: 0.5;
}

.cv2-sever__blob-2 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, #fecbb0 0%, transparent 70%);
  bottom: -80px;
  left: -140px;
  opacity: 0.4;
}

.cv2-sever__card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.85rem 1.75rem;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(124, 51, 24, 0.1);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(124, 51, 24, 0.05);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.cv2-sever__logo {
  width: 40px;
  height: auto;
  display: block;
  margin-bottom: 1.1rem;
}

.cv2-sever__title {
  margin: 0 0 0.45rem;
  font-family: "Plus Jakarta Sans", "DM Sans", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #1a0f09;
}

.cv2-sever__body {
  margin: 0 0 1.35rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #6b4535;
}

.cv2-sever__btn {
  width: 100%;
  height: 42px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.cv2-sever__btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

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

@media (max-width: 992px) {
  .cv2-auth-shell {
    grid-template-columns: 1fr;
  }

  .cv2-auth-brand {
    padding: 40px 24px 8px;
  }

  .cv2-auth-brand-inner,
  .cv2-auth-card {
    margin: 0 auto;
    max-width: 520px;
  }

  .cv2-auth-flow {
    margin-top: 1.5rem;
    padding: 0;
  }

  .cv2-flow {
    grid-template-columns: 1fr;
    gap: 14px;
    justify-items: center;
  }

  .cv2-flow__sources {
    justify-content: center;
    grid-template-columns: repeat(4, minmax(44px, 56px));
  }

  .cv2-flow__outputs {
    justify-content: center;
    grid-template-columns: repeat(2, minmax(0, 128px));
    width: min(100%, 280px);
  }

  .cv2-flow__wires {
    display: none;
  }

  .cv2-flow__hub {
    width: 72px;
    height: 72px;
    margin: 2px auto;
  }

  .cv2-auth-panel {
    padding: 20px 24px 48px;
  }

  .cv2-auth-card {
    margin-left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cv2-auth-blob,
  .cv2-auth-eyebrow,
  .cv2-auth-eyebrow-dot,
  .cv2-auth-wordmark,
  .cv2-auth-byline,
  .cv2-auth-tagline,
  .cv2-auth-flow,
  .cv2-auth-card,
  .cv2-flow__hub-ring {
    animation: none !important;
  }
}

/* Firebase UI ------------------------------------------------------------ */
#fireblaze-signin-ui .firebaseui-container,
#firebaseui-auth-container .firebaseui-container {
  max-width: none !important;
  background: transparent !important;
  box-shadow: none !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
}

#fireblaze-signin-ui .firebaseui-card-content,
#firebaseui-auth-container .firebaseui-card-content {
  padding: 0 !important;
}

#fireblaze-signin-ui .firebaseui-idp-list,
#firebaseui-auth-container .firebaseui-idp-list {
  margin: 0 !important;
}

#fireblaze-signin-ui .firebaseui-list-item,
#firebaseui-auth-container .firebaseui-list-item {
  margin-bottom: 10px !important;
}

#fireblaze-signin-ui .firebaseui-idp-button,
#firebaseui-auth-container .firebaseui-idp-button {
  max-width: none !important;
  width: 100% !important;
  height: 44px !important;
  display: flex !important;
  align-items: center !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, background-color 0.15s ease !important;
}

#fireblaze-signin-ui .firebaseui-idp-button:hover,
#firebaseui-auth-container .firebaseui-idp-button:hover {
  transform: none;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-idp-google,
#firebaseui-auth-container .firebaseui-idp-google {
  background: var(--accent) !important;
  border: 1px solid var(--accent) !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-idp-google:hover,
#firebaseui-auth-container .firebaseui-idp-google:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
}

#fireblaze-signin-ui .firebaseui-idp-google .firebaseui-idp-text,
#firebaseui-auth-container .firebaseui-idp-google .firebaseui-idp-text {
  color: #fff !important;
}

#fireblaze-signin-ui .firebaseui-idp-password,
#firebaseui-auth-container .firebaseui-idp-password {
  background-color: #fff !important;
  border: 1px solid rgba(124, 51, 24, 0.14) !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-idp-password:hover,
#firebaseui-auth-container .firebaseui-idp-password:hover {
  background-color: #faf7f4 !important;
  border-color: rgba(124, 51, 24, 0.22) !important;
}

#fireblaze-signin-ui .firebaseui-idp-password .firebaseui-idp-text,
#fireblaze-signin-ui .firebaseui-idp-password .firebaseui-idp-text-long,
#fireblaze-signin-ui .firebaseui-idp-password .firebaseui-idp-text-short,
#firebaseui-auth-container .firebaseui-idp-password .firebaseui-idp-text,
#firebaseui-auth-container .firebaseui-idp-password .firebaseui-idp-text-long,
#firebaseui-auth-container .firebaseui-idp-password .firebaseui-idp-text-short {
  color: #1a0f09 !important;
}

#fireblaze-signin-ui .firebaseui-idp-text,
#firebaseui-auth-container .firebaseui-idp-text {
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  padding-left: 14px !important;
}

#fireblaze-signin-ui .firebaseui-idp-icon-wrapper,
#firebaseui-auth-container .firebaseui-idp-icon-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  margin-left: 10px !important;
  border-radius: var(--radius-sm) !important;
  flex-shrink: 0 !important;
}

#fireblaze-signin-ui .firebaseui-idp-icon,
#firebaseui-auth-container .firebaseui-idp-icon {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Google: white badge so the multicolor G stays readable on orange CTA */
#fireblaze-signin-ui .firebaseui-idp-google .firebaseui-idp-icon-wrapper,
#firebaseui-auth-container .firebaseui-idp-google .firebaseui-idp-icon-wrapper {
  background: #fff !important;
}

/* Email: Firebase ships a white envelope — invert it for the light button */
#fireblaze-signin-ui .firebaseui-idp-password .firebaseui-idp-icon-wrapper,
#firebaseui-auth-container .firebaseui-idp-password .firebaseui-idp-icon-wrapper {
  background: transparent !important;
}

#fireblaze-signin-ui .firebaseui-idp-password .firebaseui-idp-icon,
#firebaseui-auth-container .firebaseui-idp-password .firebaseui-idp-icon {
  filter: brightness(0) saturate(100%) !important;
  opacity: 0.72 !important;
}

#fireblaze-signin-ui .firebaseui-tos,
#firebaseui-auth-container .firebaseui-tos {
  margin-top: 18px !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
  color: #b8896e !important;
  text-align: left !important;
}

#fireblaze-signin-ui .firebaseui-tos a,
#firebaseui-auth-container .firebaseui-tos a {
  color: var(--accent) !important;
}

/* Firebase email/password steps ------------------------------------------ */
#fireblaze-signin-ui .firebaseui-page-provider-sign-in,
#fireblaze-signin-ui .firebaseui-page-password-sign-in,
#fireblaze-signin-ui .firebaseui-page-password-sign-up,
#firebaseui-auth-container .firebaseui-page-provider-sign-in,
#firebaseui-auth-container .firebaseui-page-password-sign-in,
#firebaseui-auth-container .firebaseui-page-password-sign-up {
  min-height: 0 !important;
}

#fireblaze-signin-ui .firebaseui-card-header,
#firebaseui-auth-container .firebaseui-card-header {
  padding: 0 0 1rem !important;
}

#fireblaze-signin-ui .firebaseui-title,
#firebaseui-auth-container .firebaseui-title {
  margin: 0 !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 0.95rem !important;
  line-height: 1.35 !important;
  font-weight: 600 !important;
  letter-spacing: -0.01em !important;
  color: var(--cv2-auth-text) !important;
  text-align: left !important;
}

#fireblaze-signin-ui .firebaseui-textfield,
#firebaseui-auth-container .firebaseui-textfield {
  width: 100% !important;
  margin: 0 0 0.75rem !important;
  padding: 1.35rem 0 0 !important;
}

#fireblaze-signin-ui .firebaseui-textfield .mdl-textfield__label,
#firebaseui-auth-container .firebaseui-textfield .mdl-textfield__label {
  top: 0 !important;
  color: var(--cv2-auth-text2) !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 0.75rem !important;
  line-height: 1.2 !important;
  font-weight: 500 !important;
  transform: none !important;
}

#fireblaze-signin-ui .firebaseui-textfield .mdl-textfield__label::after,
#firebaseui-auth-container .firebaseui-textfield .mdl-textfield__label::after {
  display: none !important;
}

#fireblaze-signin-ui .firebaseui-input,
#firebaseui-auth-container .firebaseui-input {
  width: 100% !important;
  height: 42px !important;
  padding: 0 0.75rem !important;
  border: 1px solid rgba(124, 51, 24, 0.16) !important;
  border-radius: var(--radius-md) !important;
  background: #fff !important;
  color: var(--cv2-auth-text) !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 0.875rem !important;
  caret-color: var(--cv2-auth-text) !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease !important;
}

#fireblaze-signin-ui .firebaseui-input:focus,
#firebaseui-auth-container .firebaseui-input:focus {
  outline: none !important;
  border-color: rgba(124, 51, 24, 0.4) !important;
  background: #fff !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-error-wrapper,
#firebaseui-auth-container .firebaseui-error-wrapper {
  min-height: 0 !important;
}

#fireblaze-signin-ui .firebaseui-error,
#firebaseui-auth-container .firebaseui-error {
  margin: -0.25rem 0 0.6rem !important;
  color: #b42318 !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 0.75rem !important;
  line-height: 1.4 !important;
}

#fireblaze-signin-ui .firebaseui-card-actions,
#firebaseui-auth-container .firebaseui-card-actions {
  padding: 0.25rem 0 0 !important;
}

#fireblaze-signin-ui .firebaseui-form-actions,
#firebaseui-auth-container .firebaseui-form-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 0.5rem !important;
}

#fireblaze-signin-ui .firebaseui-button,
#firebaseui-auth-container .firebaseui-button {
  min-width: 0 !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 0 1rem !important;
  border-radius: var(--radius-md) !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 0.8rem !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-id-secondary-link,
#firebaseui-auth-container .firebaseui-id-secondary-link {
  color: var(--cv2-auth-text2) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-id-secondary-link:hover,
#firebaseui-auth-container .firebaseui-id-secondary-link:hover {
  color: var(--cv2-auth-text) !important;
  background: transparent !important;
}

#fireblaze-signin-ui .firebaseui-id-submit,
#firebaseui-auth-container .firebaseui-id-submit {
  color: #fff !important;
  border: 1px solid var(--accent) !important;
  background: var(--accent) !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-id-submit:hover,
#firebaseui-auth-container .firebaseui-id-submit:hover {
  background: var(--accent-hover) !important;
  border-color: var(--accent-hover) !important;
  box-shadow: none !important;
}

#fireblaze-signin-ui .firebaseui-card-footer,
#firebaseui-auth-container .firebaseui-card-footer {
  padding: 0 !important;
}

#fireblaze-signin-ui .firebaseui-card-footer .firebaseui-tos,
#firebaseui-auth-container .firebaseui-card-footer .firebaseui-tos {
  margin: 1rem 0 0 !important;
  text-align: left !important;
}


/* Ajustements pour le contenu scrollable */
.card-body {
  /*padding: 0.7rem 3.7rem 0.7rem 3.7rem !important;*/
  overflow-y: auto;
  /*max-height: calc(100vh - 120px);*/
  height: 100vh;
}

#projects-tabdatasource {
  position: sticky;
  top: 0;
  z-index: 100;
  background: white;
}

.dark-mode #projects-tabdatasource {
  background: #343a40;
}

.dark-mode .dtfc-fixed-right {
  background: black !important;
}

div.dataTables_scrollBody {
  border-left: 0px solid #ddd !important;
}

label:not(.form-check-label):not(.custom-file-label) {
  font-weight: 500 !important;
}

.mdl-button--raised {
    box-shadow: 0px 0px 9px 5px rgb(171 171 171 / 50%)!important;
}

#fireblaze-signin-ui .mdl-button--raised:not(.firebaseui-id-submit),
#firebaseui-auth-container .mdl-button--raised:not(.firebaseui-id-submit) {
  box-shadow: none !important;
}

.progress-bar{
  border-radius: var(--radius-xs);
}

#shiny-notification-panel {
    position: fixed;
    right: 0;
    width: 384px;
}

.callout{
  border-left: none!important;
}


#tabcard_explore_mod_box > div.card-body{
   padding:0.3rem!important;
}

#explore-editor_ui > div > div > div > div.card-body.bslib-gap-spacing.html-fill-item.html-fill-container{
  padding: 0px!important;

}

/* Keep Model/Optimize/Projects/Explore tab headers fixed;
   only the card body scrolls. Overrides global .card-body { height: 100vh }. */
#model-tabcard_model_box,
#optimize-tabcard_scenario_box,
#tabcard_project_mod_box,
#explore-tabcard_explore_mod_box {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  max-height: calc(100vh - 70px);
  overflow: hidden;
}

#model-tabcard_model_box > .card-header,
#optimize-tabcard_scenario_box > .card-header,
#tabcard_project_mod_box > .card-header,
#explore-tabcard_explore_mod_box > .card-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1020;
  background-color: #fff;
}

.dark-mode #model-tabcard_model_box > .card-header,
.dark-mode #optimize-tabcard_scenario_box > .card-header,
.dark-mode #tabcard_project_mod_box > .card-header,
.dark-mode #explore-tabcard_explore_mod_box > .card-header {
  background-color: transparent;
}

#model-tabcard_model_box > div.card-body,
#optimize-tabcard_scenario_box > div.card-body {
  padding: 0rem !important;
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overflow-y: auto;
}

#tabcard_project_mod_box > div.card-body {
  padding: 0rem !important;
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Projects tabBox: let each pane own its scroll (Settings is tall with branding). */
#tabcard_project_mod_box > div.card-body > .tab-content {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#tabcard_project_mod_box > div.card-body > .tab-content > .tab-pane.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

/* Projects / Settings panes: each owns its own scroll region */
.workspace-projects {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem 1rem 1rem;
}

/* Workspace Settings: scrollable body + sticky save bar */
.workspace-settings {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 42%);
}

.workspace-settings__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 1.25rem 1.25rem 1rem;
}

.workspace-settings__inner {
  width: min(720px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 0.5rem;
}

.workspace-settings__section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.1rem 1.2rem 1.25rem;
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04);
}

.workspace-settings__title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
}

.workspace-settings__lede {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: #6b7280;
}

.workspace-settings__field {
  max-width: 100%;
}

.workspace-settings__field .bootstrap-select,
.workspace-settings__field .form-group,
.workspace-settings .project-brand-website .form-group,
.workspace-settings .project-brand-website .shiny-input-container {
  width: 100%;
  margin-bottom: 0.75rem;
}

.workspace-settings .brand-shell {
  margin-top: 0.85rem;
}

.workspace-settings__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  box-shadow: 0 -6px 16px rgba(17, 24, 39, 0.04);
}

.workspace-settings__footer .btn {
  min-width: 200px;
}

.dark-mode .workspace-settings {
  background: linear-gradient(180deg, #2b3035 0%, #343a40 42%);
}

.dark-mode .workspace-settings__section {
  background: #3a4046;
  border-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .workspace-settings__title {
  color: #f8f9fa;
}

.dark-mode .workspace-settings__lede {
  color: #adb5bd;
}

.dark-mode .workspace-settings__footer {
  background: rgba(52, 58, 64, 0.94);
  border-top-color: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .workspace-settings__scroll {
    padding: 1rem 0.85rem 0.85rem;
  }

  .workspace-settings__section {
    padding: 0.95rem 0.9rem 1.05rem;
    border-radius: 10px;
  }

  .workspace-settings__footer .btn {
    width: 100%;
    min-width: 0;
  }
}

#explore-tabcard_explore_mod_box > div.card-body {
  padding: 0rem !important;
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  overflow: hidden;
}

#explore-tabcard_explore_mod_box > div.card-body > .tab-content,
#explore-tabcard_explore_mod_box > div.card-body > .tab-content > .tab-pane.active {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#explore-tabcard_explore_mod_box > div.card-body > .tab-content > .tab-pane.active {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.ace-terminal-theme .ace_gutter {
    background: #343a40  !important;
}

#toast-container.toast-bottom-center>div, #toast-container.toast-top-center>div {
    width: 350px!important;
}


.jstree-proton .jstree-clicked {
    background: #007bff;
    color: #fff;
    box-shadow: inset 0 0 1px #007bff;
}


.custom-control-label::before {
     background-color: transparent!important; 
     box-shadow: none!important; 
}


.explore-container {
          display: flex; 
          width: 100%;
          height: 100%;
          max-height: calc(100vh - 130px);
          overflow: hidden; /* Empêche le débordement */
        }
        
        .collapsible-panel {
          transition: all 0.3s ease;
          background-color: transparent;
          border-right: 0px solid #dee2e6;
          padding: 0 4px 0 0;
          position: relative;
          width: 320px;
          display: flex;
          flex-direction: column;
          overflow-y: hidden;
          height: 100%; /* Prend toute la hauteur du parent */
        }
        
        .collapsible-panel.collapsed {
          width: 30px !important;
        }
        
        .collapsible-panel .panel-content {
          display: flex;
          flex-direction: column;
          width: 100%;
          height: 100%;
          overflow-y: hidden;
        }
        
        .collapsible-panel.collapsed .panel-content {
          display: none;
          overflow-y: hidden;
        }
        

        .tree-container {
          flex-grow: 1;
          overflow: hidden;
          padding-right: 2px;
          height: 100%;
          min-height: 0;
        }

        .tree-container > .shiny-html-output {
          height: 100%;
        }
        
        .collapse-toggle {
          position: absolute;
          top: 12px;
          right: 10px;
          cursor: pointer;
          z-index: 1000;
          color: var(--rt-muted-color, #6c757d);
          opacity: 0.7;
        }

        .collapse-toggle:hover {
          opacity: 1;
          color: var(--rt-color);
        }

/* ── Schema browser (Explore left panel) ─────────────────────────── */
.schema-browser {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 280px;
  border: 1px solid var(--rt-border-color);
  border-radius: 10px;
  background: var(--rt-bg-color, #fff);
  overflow: hidden;
}

.schema-browser-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--rt-border-color);
  background: var(--rt-header-bg, #f8f9fa);
  flex-shrink: 0;
  padding-right: 36px; /* room for collapse chevron */
}

.schema-source-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  object-fit: contain;
}

.schema-source-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.schema-source-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schema-source-count {
  font-size: 11px;
  color: var(--rt-muted-color, #6c757d);
  margin-top: 2px;
}

.schema-search-wrap {
  position: relative;
  padding: 10px 10px 8px;
  flex-shrink: 0;
}

.schema-search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--rt-muted-color, #6c757d);
  pointer-events: none;
}

.schema-browser-search {
  width: 100%;
  height: 34px;
  padding: 6px 10px 6px 32px !important;
  font-size: 12.5px !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--rt-border-color) !important;
  background: var(--rt-input-bg, #fff) !important;
  color: var(--rt-input-color, #000) !important;
  box-shadow: none !important;
}

.schema-browser-search:focus {
  border-color: #0d6efd !important;
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12) !important;
}

.schema-tree {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px 6px 10px;
  min-height: 0;
}

.schema-table {
  margin: 0 0 2px;
  border-radius: var(--radius-sm);
}

.schema-table[open] > .schema-table-summary .schema-chevron {
  transform: rotate(90deg);
}

.schema-table-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  user-select: none;
  color: var(--rt-color);
}

.schema-table-summary::-webkit-details-marker {
  display: none;
}

.schema-table-summary::marker {
  content: "";
}

.schema-table-summary:hover {
  background: var(--rt-hover-color, rgba(0, 0, 0, 0.05));
}

.schema-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  font-size: 11px;
  color: var(--rt-color, #495057);
  opacity: 0.7;
  transition: transform 0.15s ease, opacity 0.12s ease, color 0.12s ease;
  flex-shrink: 0;
}

.schema-chevron .fa,
.schema-chevron .fas,
.schema-chevron .fa-fw {
  width: 1em;
  text-align: center;
}

.schema-table-summary:hover .schema-chevron,
.schema-group-summary:hover .schema-chevron {
  opacity: 1;
  color: #0d6efd;
}

.dark-mode .schema-table-summary:hover .schema-chevron,
.dark-mode .schema-group-summary:hover .schema-chevron {
  color: #6ea8fe;
}

.schema-table-icon {
  font-size: 12px;
  color: #0d6efd;
  opacity: 0.85;
  flex-shrink: 0;
}

.dark-mode .schema-table-icon {
  color: #6ea8fe;
}

.schema-table-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schema-badge {
  flex-shrink: 0;
  min-width: 20px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  border-radius: var(--radius-pill);
  color: var(--rt-muted-color, #6c757d);
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.12));
}

.schema-cols {
  list-style: none;
  margin: 0 0 4px;
  padding: 0 0 2px 28px;
  border-left: 1px solid var(--rt-border-color);
  margin-left: 16px;
}

.schema-col {
  margin: 0;
}

.schema-col-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--rt-color);
  cursor: pointer;
}

.schema-col-btn:hover {
  background: var(--rt-hover-color, rgba(0, 0, 0, 0.05));
  color: #0d6efd;
}

.dark-mode .schema-col-btn:hover {
  color: #6ea8fe;
}

.schema-col-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--rt-muted-color, #adb5bd);
  flex-shrink: 0;
}

.schema-col-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
}

/* Shared empty state, emitted by empty_state_ui() in R/utils.R.
   Centring lives here rather than inline so shinyjs::show()/hide(), which
   clears the inline display property, cannot break the layout. */
.empty-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.schema-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 16px;
  color: var(--rt-muted-color, #6c757d);
  gap: 10px;
}

.schema-empty-icon {
  font-size: 22px;
  opacity: 0.55;
}

.schema-empty-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  max-width: 220px;
}

.schema-no-results {
  padding: 18px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--rt-muted-color, #6c757d);
}

.schema-browser--empty-source {
  justify-content: center;
}

/* Grouped sources (Flat Files + Google Ads + …) */
.schema-group {
  margin: 0 0 6px;
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-md);
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.04));
  overflow: hidden;
}

.schema-group[open] > .schema-group-summary .schema-group-chevron {
  transform: rotate(90deg);
}

.schema-group-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  user-select: none;
  color: var(--rt-color);
  background: var(--rt-header-bg, #f8f9fa);
}

.schema-group-summary::-webkit-details-marker {
  display: none;
}

.schema-group-summary::marker {
  content: "";
}

.schema-group-summary:hover {
  background: var(--rt-hover-color, rgba(0, 0, 0, 0.05));
}

.schema-group-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex-shrink: 0;
}

.schema-group-label {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.schema-group-badge {
  font-weight: 500;
  text-transform: none;
}

.schema-group-body {
  padding: 4px 4px 6px;
  background: var(--rt-bg-color, #fff);
}

.schema-preview-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--rt-muted-color, #6c757d);
  font-size: 11px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.schema-table-summary:hover .schema-preview-btn,
.schema-preview-btn:focus {
  opacity: 1;
}

.schema-preview-btn:hover {
  background: rgba(13, 110, 253, 0.12);
  color: #0d6efd;
}

.dark-mode .schema-preview-btn:hover {
  background: rgba(110, 168, 254, 0.18);
  color: #6ea8fe;
}
        
        .editor-content {
          margin-left:5px;
          flex: 1;
          transition: all 0.3s ease;
          min-width: 0;
          display: flex;
          flex-direction: column;
          height: 100%; /* Prend toute la hauteur */
          overflow: hidden; /* Empêche le débordement */
        }
        
        .content-container {
          width: 100%;
          height: 100%; /* Prend toute la hauteur disponible */
          display: flex;
          flex-direction: column;
          overflow: hidden; /* Empêche le débordement */
        }
        
        /* Style spécifique pour la zone du tableau */
        .tableau-container {
          flex-grow: 1;
          overflow: auto; /* Permet le défilement dans la zone du tableau uniquement */
          height: 100%;
        }
        
        #tableau_ui {
          width: 100%;
          height: auto;
        }
        
        .collapsible-panel.collapsed + .editor-content {
          width: 100%;
          flex-grow: 1;
        }
        
        .collapse-toggle .chevron-icon {
          transition: transform 0.3s ease;
        }
        
        .collapsible-panel.collapsed .chevron-icon {
          transform: rotate(180deg);
        }

        /* Empêche le défilement de la page principale */
        body {
          overflow: hidden;
        }
        
.alert-warning {
    color: #1f2d3d;
    background-color: #ffc10761;
    border-color: #edb100;
}
        
/* Reactable base styles */
.ReactTable {
  color: var(--rt-color) !important;
  background-color: var(--rt-bg-color) !important;
  border: 1px solid var(--rt-border-color) !important;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075) !important;
}

/* Reactable header styles */
.ReactTable .rt-thead.-header {
  background-color: var(--rt-header-bg) !important;
  color: var(--rt-color) !important;
  border-bottom: 1px solid var(--rt-border-color) !important;
}

/* Reactable search input styles */
.rt-search-input {
  background-color: var(--rt-input-bg) !important;
  color: var(--rt-input-color) !important;
  border: 1px solid var(--rt-border-color) !important;
  width: 100% !important;
  margin: 0 0px 0 0 !important;
}

/* Reactable row styles */
.ReactTable .rt-tr-group {
  border-bottom: 1px solid var(--rt-border-color) !important;
}

.ReactTable .rt-tr.-odd {
  background-color: var(--rt-striped-color) !important;
}

.ReactTable .rt-tr:hover {
  background-color: var(--rt-hover-color) !important;
}

.ReactTable .rt-tr.selected {
  box-shadow: inset 2px 0 0 0 var(--rt-selection-color) !important;
}

/* Reactable pagination button styles */
.ReactTable .-pagination .-btn {
  background-color: var(--rt-bg-color) !important;
  color: var(--rt-color) !important;
}

.ReactTable .-pagination .-btn:hover {
  background-color: var(--rt-button-hover-bg) !important;
}

.ReactTable .-pagination .-btn:active {
  background-color: var(--rt-button-active-bg) !important;
}

/* Reactable borders */
.ReactTable {
  border: none !important;
  border: 1px solid var(--rt-border-color) !important;
}

.ReactTable .rt-td {
  border-right: none !important;
  border-bottom: 1px solid var(--rt-border-color) !important;
}

.ReactTable .rt-tbody .rt-tr-group:last-child .rt-td {
    border-bottom: 0;
}

/* Reactable compact mode */
.ReactTable.-compact .rt-td,
.ReactTable.-compact .rt-th {
  padding: 4px 8px !important;
}

/* Channel Mapping Styles */


.channel-mapping-item {
  transition: all 0.2s ease;
  background-color: var(--rt-bg-color);
}

.channel-mapping-item:hover {
  background-color: var(--rt-hover-color);
}

.channel-mapping-item input {
  background-color: var(--rt-input-bg);
  color: var(--rt-input-color);
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  width: 100%;
}

.channel-mapping-item input:focus {
  border-color: var(--active-border-color);
  box-shadow: 0 0 0 2px var(--accent-ring);
  outline: none;
}

.channel-mapping-item small {
  color: var(--rt-color);
  opacity: 0.7;
}

/* Dark mode adjustments */
.dark-mode .channel-mapping-container {
  background-color: var(--rt-bg-color);
}

.dark-mode .channel-mapping-item {
  background-color: var(--rt-bg-color);
}

.dark-mode .channel-mapping-item:hover {
  background-color: var(--rt-hover-color);
}

/* Step Progress UI Styles */
.step-circle {
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer !important;
}

.step-circle:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.step-circle.active {
  background-color: #007bff !important;
  color: #fff !important;
}

body.cv2-branded .step-circle.active {
  background-color: var(--bs-primary, var(--primary, var(--accent))) !important;
  color: #fff !important;
}

.step-circle.completed {
  background-color: #28a745 !important;
  color: #fff !important;
}

body.cv2-branded .step-circle.completed {
  background-color: var(--brand-success, var(--bs-success, #28a745)) !important;
  color: #fff !important;
}

/* Builder step 4 — remove channel follows brand danger/error */
body.cv2-branded button.channel-remove-btn,
body.cv2-branded .channel-remove-btn.btn-danger,
body.cv2-branded .channel-remove-btn.btn.btn-danger {
  background: var(--brand-danger, var(--danger, var(--bs-danger, #dc3545))) !important;
  background-color: var(--brand-danger, var(--danger, var(--bs-danger, #dc3545))) !important;
  background-image: none !important;
  border-color: var(--brand-danger, var(--danger, var(--bs-danger, #dc3545))) !important;
  color: #fff !important;
}

body.cv2-branded .btn-danger {
  background: var(--brand-danger, var(--danger, var(--bs-danger, #dc3545))) !important;
  background-color: var(--brand-danger, var(--danger, var(--bs-danger, #dc3545))) !important;
  background-image: none !important;
  border-color: var(--brand-danger, var(--danger, var(--bs-danger, #dc3545))) !important;
}

.step-progress-line {
  background: linear-gradient(
    90deg,
    var(--brand-success, var(--bs-success, #28a745)) var(--progress-percent, 0%),
    #e9ecef var(--progress-percent, 0%)
  );
  transition: background 0.3s ease;
}

/* Sticky Headers */
#steps_navigation {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

.step-header {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rt-border-color);
}

/* Smoother transitions */
#step_content_1, #step_content_2, #step_content_3, #step_content_4, #step_content_5 {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Content fade effect */
.step-content-fade-in {
  animation: stepFadeIn 0.3s forwards;
}

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

/* Fixed Navigation Footer */
#model-step_navigation_footer {
  position: fixed !important;
  bottom: 0 !important;
  right: 0 !important;
  padding: 15px 30px !important;
  border-top: 1px solid var(--rt-border-color) !important;
  background-color: var(--rt-input-bg) !important;
  opacity: 1 !important;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05) !important;
  z-index: 9999 !important;
  width: 71% !important;
}

/* Footer navigation container styles */
#footer_nav_1, #footer_nav_2, #footer_nav_3, #footer_nav_4, #footer_nav_5 {
  display: flex !important;
  justify-content: space-between !important;
  width: 100% !important;
  align-items: center !important;
}

#footer_nav_1 {
  justify-content: flex-end !important;
}

/* Adjust content for the fixed footer */
#step_content {
  margin-bottom: 80px !important;
  padding-bottom: 20px !important;
  border: 1px solid var(--rt-border-color) !important;
  border-radius: 5px !important;
  background-color: var(--rt-bg-color) !important;
  flex-grow: 1;
  overflow-y: auto;
}

/* Ensure footer spans full width on all screen sizes */
@media (min-width: 768px) {
  #step_navigation_footer {
    width: 100% !important;
  }
}

.dark-mode #step_navigation_footer {
  background-color: var(--dark-bg) !important;
  opacity: 1 !important;
  border-top: 1px solid var(--rt-border-color) !important;
}

/* Button hover effects */
#step_navigation_footer .btn {
  transition: all 0.2s ease;
  min-width: 120px;
}

#step_navigation_footer .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Marketplace styles */
.marketplace-header {
  border-bottom: 0;
}

.marketplace-header h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 0;
  color: #333;
}

.dark-mode .marketplace-header h2 {
  color: #eee;
}

/* Search container */
.search-container {
  max-width: 100%;
}

.search-container .input-group {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* Pill search bar of the Workspace: the input and the submit button are welded
   into a single rounded shape, so these radii are intentionally asymmetric.
   Previously inline in projects_module.R — same values, kept as CSS so the
   stylesheet stays the single source of truth. */
.search-container .input-group.projects-search {
  border-radius: 20px;
}

.search-container .projects-search input {
  border-radius: 20px 0 0 20px;
}

.search-container .projects-search .projects-search__submit {
  border-radius: 0 20px 20px 0;
  padding: 0.5rem 1.2rem;
  font-weight: 600;
  box-shadow: none;
  background-color: #fff !important;
  border-color: #eaeaea !important;
  color: #343a40 !important;
}

.search-container .projects-search .projects-search__submit:hover,
.search-container .projects-search .projects-search__submit:focus,
.search-container .projects-search .projects-search__submit:active,
body.cv2-branded .search-container .projects-search .projects-search__submit,
body.cv2-branded .search-container .projects-search .projects-search__submit:hover,
body.cv2-branded .search-container .projects-search .projects-search__submit:focus,
body.cv2-branded .search-container .projects-search .projects-search__submit:active {
  background-color: #fff !important;
  border-color: #eaeaea !important;
  color: #343a40 !important;
  box-shadow: none !important;
}

.search-container .projects-search .projects-search__submit .fa-plus-circle,
.search-container .projects-search .projects-search__submit .fas.fa-plus-circle,
body.cv2-branded .search-container .projects-search .projects-search__submit .fa-plus-circle,
body.cv2-branded .search-container .projects-search .projects-search__submit .fas.fa-plus-circle {
  color: #007bff !important;
}

.search-container input {
  border: 1px solid #eaeaea;
  border-right: none;
  padding: 10px 16px;
  background-color: #fff;
}

.dark-mode .search-container input {
  background-color: #1e1e1e;
  border-color: #333;
  color: #eee;
}

.search-container .input-group-append button {
  border: 1px solid #eaeaea;
  border-left: none;
  background-color: #fff;
  color: #666;
}

.dark-mode .search-container .input-group-append button {
  background-color: #1e1e1e;
  border-color: #333;
  color: #aaa;
}

/* Filters */
.filters-container {
  margin-bottom: 20px;
}

/* Toggle buttons like Gmail */
.price-toggle-container {
  margin-right: 12px;
}

.filter-toggle {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #eaeaea;
}

.btn-toggle {
  background-color: #fff;
  color: #555;
  border: none;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-toggle:hover {
  background-color: #f5f5f5;
}

.btn-toggle.active {
  background-color: #f0f0f0;
  color: #333;
  font-weight: 600;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.dark-mode .filter-toggle {
  border-color: #333;
}

.dark-mode .btn-toggle {
  background-color: #1e1e1e;
  color: #ccc;
}

.dark-mode .btn-toggle:hover {
  background-color: #2a2a2a;
}

.dark-mode .btn-toggle.active {
  background-color: #333;
  color: #fff;
}

/* Category Filter Styles */
.category-filter-container {
  margin-right: 12px;
}

/* Bootstrap-select styling */
.bootstrap-select .dropdown-toggle {
  background-color: #fff;
  border: 1px solid #ced4da;
  color: #495057;
  font-size: 1rem;
  font-weight: 400;
  border-radius: var(--radius-xs);
  padding: 0.375rem 0.75rem;
  box-shadow: none;
  width: 100%;
  height: calc(1.5em + 0.75rem + 2px);
}

.bootstrap-select .dropdown-toggle:hover,
.bootstrap-select .dropdown-toggle:focus {
  background-color: #fff;
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.bootstrap-select .dropdown-menu {
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid #eaeaea;
  padding: 8px;
}

.bootstrap-select .dropdown-item {
  padding: 8px 12px;
  border-radius: var(--radius-xs);
  margin-bottom: 2px;
  font-size: 13px;
}

.bootstrap-select .dropdown-item:hover {
  background-color: #f5f5f5;
}

.bootstrap-select .dropdown-item.active, 
.bootstrap-select .dropdown-item:active {
  background-color: #e6f0ff;
  color: #0057d9;
}

.bootstrap-select .bs-actionsbox {
  padding: 8px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid #eaeaea;
}

.bootstrap-select .bs-actionsbox .btn-group button {
  background-color: #fff;
  border: 1px solid #ddd;
  color: #555;
  font-size: 12px;
}

.bootstrap-select .bs-searchbox input {
  border-radius: var(--radius-xs);
  border: 1px solid #eaeaea;
  padding: 8px 12px;
  box-shadow: none;
}

/* Dark Mode Bootstrap-select */
.dark-mode .bootstrap-select .dropdown-toggle {
  background-color: #1e1e1e;
  border-color: #6c757d;
  color: #ced4da;
  border-width: 1px;
}

.dark-mode .bootstrap-select .dropdown-toggle:hover,
.dark-mode .bootstrap-select .dropdown-toggle:focus {
  background-color: #1e1e1e;
  border-color: #80bdff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.dark-mode .bootstrap-select.show .dropdown-toggle {
  border-color: #333;
  background-color: #1e1e1e;
  box-shadow: none;
}

.dark-mode .bootstrap-select .dropdown-item.active {
  background-color: #333;
  color: #fff;
}

.dark-mode .bootstrap-select .bs-actionsbox {
  border-bottom: 1px solid #333;
}

.dark-mode .bootstrap-select .bs-actionsbox .btn-group button {
  background-color: #1e1e1e;
  border-color: #333;
  color: #ccc;
}

.dark-mode .bootstrap-select .bs-searchbox input {
  background-color: #1e1e1e;
  border-color: #333;
  color: #ccc;
}

/* Fix double border in dark mode */
.dark-mode .bootstrap-select .inner {
  border: none;
}

.dark-mode .bootstrap-select .dropdown-menu.inner {
  border: none;
}

.dark-mode .bootstrap-select>.dropdown-toggle {
  outline: none !important;
  box-shadow: none !important;
}

/* Fix dropdown placeholder in dark mode */
.dark-mode .bootstrap-select>.dropdown-toggle.bs-placeholder {
  color: #adb5bd;
  background-color: #1e1e1e;
  border-color: #6c757d;
  border-width: 1px;
}

/* Fix dropdown menu highlighting */
.dark-mode .bootstrap-select .dropdown-menu .selected .check-mark {
  color: #fff;
}

.dark-mode .bootstrap-select .dropdown-menu li a span.text {
  color: #ccc;
}

.dark-mode .bootstrap-select .dropdown-menu li.selected a span.text {
  color: #fff;
}

/* Dataset cards - more compact and modern */
.dataset-card {
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
  height: 100%;
  width: 100%;
  border: 2px solid #eaeaea;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* User avatar styling */
.publisher-avatar-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  flex: 0 0 auto;
}

.publisher-avatar-wrap .publisher-avatar,
.publisher-avatar-wrap .publisher-avatar-placeholder {
  margin-right: 0;
}

.publisher-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 8px;
  display: block;
}

.publisher-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: #5c6ac4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-right: 8px;
}

/* Active project: YouTube-live style green ring around creator avatar */
.publisher-avatar-wrap--live {
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, #22c55e, #16a34a, #4ade80, #22c55e);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.18);
}

.publisher-avatar-wrap--live::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid rgba(34, 197, 94, 0.45);
  animation: publisher-avatar-live-pulse 1.8s ease-out infinite;
  pointer-events: none;
}

.publisher-avatar-wrap--live .publisher-avatar,
.publisher-avatar-wrap--live .publisher-avatar-placeholder {
  box-shadow: 0 0 0 2px #fff;
}

@keyframes publisher-avatar-live-pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  70% {
    transform: scale(1.25);
    opacity: 0;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .publisher-avatar-wrap--live::after {
    animation: none;
    opacity: 0;
  }
}

.dark-mode .publisher-avatar-wrap--live .publisher-avatar,
.dark-mode .publisher-avatar-wrap--live .publisher-avatar-placeholder,
[data-bs-theme="dark"] .publisher-avatar-wrap--live .publisher-avatar,
[data-bs-theme="dark"] .publisher-avatar-wrap--live .publisher-avatar-placeholder {
  box-shadow: 0 0 0 2px #1f2937;
}

.publisher-info {
  flex: 1;
}

.publisher-name {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: #555;
}

.publication-date {
  margin: 0;
  font-size: 12px;
  color: #999;
}


.dataset-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
  text-align: left!important;
}

.dataset-description {
  font-size: 13px;
  text-align: left;
  line-height: 1.4;
  color: #666;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dark-mode .dataset-description {
  color: #ccc;
}

/* Tags styling */
.dataset-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.dataset-tag {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.category-tag {
  background-color: #edf2ff;
  color: #3b5bdb;
}

.size-tag {
  background-color: #f1f3f5;
  color: #555;
}

.tag-icon {
  margin-right: 4px;
  font-size: 10px;
}

/* Price tag */
.price-tag {
  display: inline-block;
  font-weight: 600;
  font-size: 14px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
}

.free-tag {
  background-color: #e3faec;
  color: #2b8a3e;
}

.paid-tag {
  background-color: #e7f5ff;
  color: #1971c2;
}

/* View button */
.view-btn {
  font-size: 12px;
  padding: 3px 12px;
  border-radius: var(--radius-xs);
}

/* Dark mode styles */
.dark-mode .dataset-card {
  background-color: #1a1a1a;
  border-color: #333;
}

.dark-mode .dataset-title {
  color: #eee;
}

.dark-mode .dataset-description {
  color: #bbb;
}

.dark-mode .publisher-name {
  color: #ddd;
}

.dark-mode .publication-date {
  color: #888;
}

.dark-mode .category-tag {
  background-color: #1c2a5e;
  color: #91a7ff;
}

.dark-mode .size-tag {
  background-color: #2a2a2a;
  color: #ccc;
}

.dark-mode .free-tag {
  background-color: #0c2a1c;
  color: #6ce0a2;
}

.dark-mode .paid-tag {
  background-color: #0b2b47;
  color: #5caff7;
}

/* Modal styling */
.modal-publisher-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 12px;
}

.modal-publisher-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #5c6ac4;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  margin: 0 auto 12px;
}

.publisher-card {
  background-color: #f9f9fb;
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
}

.dark-mode .publisher-card {
  background-color: #1e1e1e;
}

.publisher-header {
  margin-bottom: 12px;
}

.modal-publisher-name {
  color: #555;
  margin-bottom: 16px;
}

.dark-mode .modal-publisher-name {
  color: #ddd;
}

.price-container {
  margin-top: 12px;
}

.modal-price {
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-price.free {
  color: #2b8a3e;
}

.modal-price.paid {
  color: #1971c2;
}

/* Category tags in modal */
.modal-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-tag {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  font-size: 13px;
}

.dark-mode .modal-tag {
  background-color: #273c75;
  color: #a5b4fc;
}

/* Dark mode dropdown menu styles */
.dark-mode .bootstrap-select .dropdown-menu {
  background-color: #1e1e1e;
  border-color: #6c757d;
  border-width: 1px;
}

.dark-mode .bootstrap-select .dropdown-item {
  color: #ccc;
}

.dark-mode .bootstrap-select .dropdown-item:hover,
.dark-mode .bootstrap-select .dropdown-item:focus {
  background-color: #2a2a2a;
}

/* Fix double border in dark mode */
.dark-mode .bootstrap-select .inner {
  border: none;
}

.dark-mode .bootstrap-select .dropdown-menu.inner {
  border: none;
}

.dark-mode .bootstrap-select>.dropdown-toggle {
  outline: none !important;
  box-shadow: none !important;
}

.category-filter-container .form-control, #model-step_content .form-control{
  border-radius: var(--radius-xs) !important;
}

/* Description editing styles */
.description-container .fa-edit {
  opacity: 0.5;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  color: var(--edit-icon-color);
}

.description-container:hover .fa-edit {
  opacity: 1;
  color: var(--edit-icon-hover-color);
}

.description-edit-box {
  width: 100%;
  min-height: 60px;
  padding: 6px;
  border: 1px solid var(--edit-box-border);
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  resize: vertical;
  background-color: var(--edit-box-bg);
  color: var(--edit-box-color);
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.description-edit-box:focus {
  border-color: var(--active-border-color);
  outline: 0;
  box-shadow: 0 0 0 0.2rem var(--accent-ring);
}

.description-edit-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.description-edit-actions .btn {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: var(--radius-xs);
  transition: all 0.2s ease;
}

.description-edit-actions .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.dark-mode .description-edit-actions .btn:hover {
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Status tag styling */
.dataset-tag.active {
  background-color: #e8f5e9 !important;
  color: #2e7d32 !important;
}

.dataset-tag.inactive,
.dataset-tag.archived {
  background-color: #f5f5f5 !important;
  color: #757575 !important;
}

.dark-mode .dataset-tag.active {
  background-color: #1b3a24 !important;
  color: #81c784 !important;
}

.dark-mode .dataset-tag.inactive,
.dark-mode .dataset-tag.archived {
  background-color: #333333 !important;
  color: #bdbdbd !important;
}

/* Original category-filter-container rule preserved at the end of the file */

/* Card footer and button spacing */
.card-footer .btn {
  margin-right: 8px;
}

/* Project card action buttons spacing - overriding all existing styles */
.dataset-card .card-footer {
  gap: 0.1rem !important;
  display: flex !important;
}

/* Apply spacing to buttons in both light and dark mode */
[data-bs-theme="light"] .dataset-card .card-footer,
[data-bs-theme="dark"] .dataset-card .card-footer,
.dataset-card .card-footer {
  gap: 0.1rem !important;
}

/* Ensure buttons don't have conflicting margins */
.dataset-card .card-footer .btn,
.dataset-card .tag-btn, 
.dataset-card .datasource-btn, 
.dataset-card .share-btn, 
.dataset-card .delete-btn {
  margin-right: 0 !important;
}

/* Adding custom spacing class to reinforce the gap-4 utility */
.gap-4,
.d-flex.gap-4 {
  gap: 1.5rem !important;
}

/* Modal Enhancement Styles */
.modal-header .d-flex.align-items-center {
  font-weight: 500;
}

.modal-header .text-muted {
  font-weight: 400;
  font-style: italic;
}

/* Tooltip styling for info icons */
.fa-info-circle {
  transition: color 0.2s ease;
}

.fa-info-circle:hover {
  color: var(--active-border-color) !important;
}

/* Enhanced section styling */
.mb-4.p-3 {
  transition: box-shadow 0.2s ease;
}

.mb-4.p-3:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Dark mode tooltip support */
.dark-mode .tooltip-inner {
  background-color: #343a40;
  color: #f8f9fa;
}

.dark-mode .tooltip.bs-tooltip-top .arrow::before {
  border-top-color: #343a40;
}

.dark-mode .tooltip.bs-tooltip-bottom .arrow::before {
  border-bottom-color: #343a40;
}

.dark-mode .tooltip.bs-tooltip-start .arrow::before {
  border-left-color: #343a40;
}

.dark-mode .tooltip.bs-tooltip-end .arrow::before {
  border-right-color: #343a40;
}

/* Form label improvements */
.form-label.mb-0 {
  font-weight: 500;
  font-size: 0.9rem;
}

/* Button hover effects in modal footer */
.modal-footer .btn {
  transition: all 0.2s ease;
  min-width: 100px;
}

.modal-footer .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive project cards grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.projects-grid__item {
  min-width: 0;
  height: 100%;
  content-visibility: auto;
  contain-intrinsic-size: 280px;
}

.projects-grid__item > .shiny-html-output,
.projects-grid__item > .shiny-html-output > .dataset-card {
  height: 100%;
}

@media (max-width: 575.98px) {
  .projects-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* Current project: original multicolour border animation (one card only). */
.current-project-card,
[data-bs-theme="light"] .current-project-card,
[data-bs-theme="dark"] .current-project-card {
  border-color: #ff5c8a !important;
  position: relative !important;
  animation: project-current-spectrum 6s linear infinite;
}

.current-project-card--paused {
  animation-play-state: paused;
}

@keyframes project-current-spectrum {
  0%   { border-color: #ff5c8a; }
  15%  { border-color: #ff9f43; }
  30%  { border-color: #f5c542; }
  45%  { border-color: #55b86a; }
  60%  { border-color: #28b8c7; }
  75%  { border-color: #4d8df7; }
  90%  { border-color: #9b72e8; }
  100% { border-color: #ff5c8a; }
}

@media (prefers-reduced-motion: reduce) {
  .current-project-card,
  [data-bs-theme="light"] .current-project-card,
  [data-bs-theme="dark"] .current-project-card {
    animation: none;
    border-color: #ff9f43 !important;
  }
}

/* Enter / exit for project cards */
.projects-grid__item--enter {
  animation: projects-card-enter 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.projects-grid__item--exit {
  animation: projects-card-exit 0.26s ease-in both;
  pointer-events: none;
}

@keyframes projects-card-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes projects-card-exit {
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .projects-grid__item--enter,
  .projects-grid__item--exit {
    animation: none;
  }
}

/* Project progress styles */
.project-progress {
        margin-bottom: 10px;
        border-radius: var(--radius-md);
        background-color: var(--active-bg-light);
}

.dark-mode .project-progress {
  background-color: var(--active-bg-dark);
}

.progress-circle-container {
  margin-right: 15px;
}

/* Add these progress circle styles from the first file */
.progress-circle {
  transition: stroke-dasharray 0.6s ease;
}

.progress-text {
  fill: #28a745; /* Green color for light mode */
  font-weight: 700;
}

.progress-status-text {
  flex: 1;
}

[data-bs-theme="dark"] .progress-circle-container circle {
  stroke: #495057; /* Darker background for dark mode */
}

[data-bs-theme="dark"] .progress-text {
  fill: #81c784; /* Lighter green for dark mode text */
}

[data-bs-theme="dark"] .progress-circle {
  stroke: #81c784; /* Lighter green for dark mode arc */
}

.progress-heading {
  font-weight: 600;
  font-size: 1rem;
}

.progress-percentage {
  font-weight: 600;
  font-size: 1rem;
}

/* Add hover effect for project button */
#projects-addNewProject:hover {
  transform: translateY(-1px);
  transition: all 0.2s ease;
}

#projects-addNewProject {
  transition: all 0.2s ease;
}

/* Scrollable projects container - not in second file */
.projects-container {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  padding-right: 5px;
  padding-top: 20px;
}

/* Custom scrollbar styling - not in second file */
.projects-container::-webkit-scrollbar {
  width: 8px;
}

.projects-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: var(--radius-xs);
}

.projects-container::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: var(--radius-xs);
}

.projects-container::-webkit-scrollbar-thumb:hover {
  background: #555;
}

[data-bs-theme="dark"] .projects-container::-webkit-scrollbar-track {
  background: #2b3035;
}

[data-bs-theme="dark"] .projects-container::-webkit-scrollbar-thumb {
  background: #555;
}

[data-bs-theme="dark"] .projects-container::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Ensure cards don't get cut off when scrolling */
.projects-container .row {
  margin-bottom: 15px !important;
  padding-bottom: 10px !important;
}

/* Steps text color for dark mode - not in second file */
[data-bs-theme="dark"] .steps-text {
  color: #dee2e6 !important;
}

/* Project progress styles - seems unique to file 1 */
.project-progress {
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background-color: var(--active-bg-light);
}

.dark-mode .project-progress {
  background-color: var(--active-bg-dark);
}

.progress-circle-container {
  margin-right: 15px;
}

/* Add flex-grow to card body content */
.card-body-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

/* Project content - description */
.dataset-content {
  margin-bottom: auto;
}

.tag-dataset {
  background-color: #edf2ff;
  color: #3b5bdb;
  display: inline-flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  margin-left: 8px;
}

.dark-mode .tag-dataset {
  background-color: #1c2a5e;
  color: #a5b4fc;
}

/* Model Results UI adjustments */
.model-training-info {
  margin-bottom: 20px !important;
  padding: 10px 15px;
  background-color: var(--active-bg-light);
  border: 1px solid var(--rt-border-color);
  border-radius: 5px;
}

.dark-mode .model-training-info {
  background-color: var(--active-bg-dark);
}

#model-model_results_tabs .tab-content {
  padding-top: 15px;
}

#model-model_results_tabs .card-body {
  padding: 0px !important;
}

#model-model_results_tabs .tab-pane > div {
  padding: 15px;
}

#model-model_results_tabs h5 {
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--rt-color);
  padding-bottom: 5px;
  border-bottom: 1px solid var(--rt-border-color);
}

/* Ensure apex charts have space */
.apexcharts-canvas {
    margin-bottom: 15px;
}

/* Fix for model results placeholder */
#model-model_results_placeholder {
  border: 1px dashed var(--rt-border-color);
  padding: 30px;
  text-align: center;
  color: var(--rt-color);
  height: auto;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  background-color: var(--active-bg-light);
  margin: 15px;
}

.dark-mode #model-model_results_placeholder {
  background-color: var(--active-bg-dark);
}

.bar-cell {
  display: flex;
  align-items: center;
}

.number {
  font-family: "Fira Mono", Consolas, Monaco, monospace;
  font-size: 0.84375rem;
  white-space: pre;
}

.bar-chart {
  flex-grow: 1;
  margin-left: 0.375rem;
  height: 0.5rem;
}

.bar {
  height: 100%;
}


.metric-item { margin-bottom: 10px; }
.scenario-summary-container { display: flex; gap: 20px; margin-bottom: 20px; }
.scenario-summary-container > div { flex: 1; min-width: 250px; }
.channel-allocation-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.channel-allocation-header h4 { margin: 0; }
.channel-allocation-header .btn-group { margin-left: auto; }

#model-model_results_tabs{
  position:fixed;
  width: auto;
}
.card .nav.flex-column>li {
  border-bottom: none!important;
  margin: 0;
}

/* Channel constraints dropdown styling */
.bootstrap-select.show .dropdown-menu {
  z-index: 9999 !important;
}

.channel-constraints-container .bootstrap-select {
  position: static !important;
}

.channel-constraints-container .dropdown-menu {
  max-height: 300px !important;
}

/* Ensure dropdowns are above other elements */
.bootstrap-select>.dropdown-toggle.bs-placeholder {
  z-index: 1;
}

.bootstrap-select .dropdown-menu.show {
  z-index: 9999;
}

/* Improve dropdown search input styling */
.bootstrap-select .bs-searchbox input {
  padding: 8px;
  border-radius: var(--radius-xs);
  border: 1px solid #ced4da;
}

/* Dark mode support for dropdowns */
[data-bs-theme="dark"] .bootstrap-select .dropdown-menu {
  background-color: #343a40;
  border-color: #495057;
}

[data-bs-theme="dark"] .bootstrap-select .dropdown-item {
  color: #e9ecef;
}

[data-bs-theme="dark"] .bootstrap-select .dropdown-item:hover,
[data-bs-theme="dark"] .bootstrap-select .dropdown-item:focus {
  background-color: #495057;
  color: #fff;
}

[data-bs-theme="dark"] .bootstrap-select .bs-searchbox input {
  background-color: #2b3035;
  border-color: #495057;
  color: #e9ecef;
}


/* ============================================================
   FLOATING CHAT WIDGET - v2 (sober ChatGPT-style)
   ============================================================ */

:root {
  --cv2-primary: var(--accent);
  --cv2-primary-hover: var(--accent-hover);
  --cv2-primary-soft: #fffbeb;
  --cv2-bg: #ffffff;
  --cv2-bg-soft: #f9fafb;
  --cv2-border: #e5e7eb;
  --cv2-border-soft: #f3f4f6;
  --cv2-text: #1f2937;
  --cv2-text-muted: #6b7280;
  --cv2-text-light: #9ca3af;
  /* Solid chrome (launcher, primary buttons) — inverted in dark mode */
  --cv2-solid: #1f2937;
  --cv2-solid-fg: #ffffff;
  --cv2-shadow-sm: none;
  --cv2-shadow-md: none;
  --cv2-shadow-lg: none;
  --cv2-radius: 14px;
  --cv2-radius-sm: var(--radius-md);
}

.dark-mode {
  --cv2-bg: #1f2024;
  --cv2-bg-soft: #2a2b31;
  --cv2-border: #3a3b42;
  --cv2-border-soft: #2f3036;
  --cv2-text: #ececf1;
  --cv2-text-muted: #a4a6b0;
  --cv2-text-light: #7a7c85;
  --cv2-primary-soft: rgba(234, 108, 0, 0.18);
  --cv2-solid: #f3f4f6;
  --cv2-solid-fg: #111827;
  --cv2-shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* ---------- Launcher (edge-docked, vertically draggable) ---------- */
.cv2-launcher {
  position: fixed;
  top: 42%;
  right: 0;
  bottom: auto;
  width: 44px;
  min-width: 44px;
  height: 52px;
  margin: 0;
  padding: 0 8px 0 6px;
  border: none;
  border-radius: 12px 0 0 12px;
  /* Follow project brand primary (accent); fallback = Bootstrap primary */
  background: var(--bs-primary, var(--primary, #007bff));
  color: #fff;
  cursor: pointer;
  box-shadow: -2px 2px 10px rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  z-index: 99990;
  user-select: none;
  touch-action: none;
  -webkit-user-drag: none;
  z-index: 100000;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.cv2-launcher:hover,
.cv2-launcher:focus-visible {
  background: var(--accent-hover, var(--bs-primary, #0069d9));
  outline: none;
  box-shadow: -3px 3px 14px rgba(15, 23, 42, 0.22);
}

.cv2-launcher:focus-visible {
  box-shadow: -3px 3px 14px rgba(15, 23, 42, 0.22), 0 0 0 3px var(--accent-ring, rgba(0, 123, 255, 0.35));
}

.cv2-launcher.cv2-launcher-dragging {
  cursor: grabbing;
  background: var(--accent-hover, var(--bs-primary, #0062cc));
  transition: none;
}

.cv2-launcher-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 100%;
  cursor: grab;
  flex-shrink: 0;
}

.cv2-launcher.cv2-launcher-dragging .cv2-launcher-handle {
  cursor: grabbing;
}

.cv2-launcher-grip {
  width: 8px;
  height: 16px;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.95) 1.15px, transparent 1.25px);
  background-size: 4px 5px;
  background-position: 0 0;
  opacity: 0.95;
}

.cv2-launcher-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.cv2-launcher-icon svg,
.cv2-launcher-icon i {
  font-size: 0.95rem;
  color: #fff;
  line-height: 1;
}

.cv2-launcher-label {
  display: none;
}

.cv2-launcher-tooltip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.cv2-launcher-tooltip::after {
  content: "";
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-left-color: #fff;
}

.cv2-launcher:hover .cv2-launcher-tooltip,
.cv2-launcher:focus-visible .cv2-launcher-tooltip {
  opacity: 1;
}

.cv2-launcher.cv2-launcher-dragging .cv2-launcher-tooltip {
  opacity: 0;
}

.cv2-launcher.cv2-launcher-active {
  opacity: 0;
  pointer-events: none;
}

.cv2-launcher-dot {
  display: none;
  position: absolute;
  top: 6px;
  left: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  border: 2px solid var(--bs-primary, var(--primary, #007bff));
}

.dark-mode .cv2-launcher {
  background: var(--bs-primary, var(--primary, #007bff));
  color: #fff;
  box-shadow: -2px 2px 12px rgba(0, 0, 0, 0.35);
}

.dark-mode .cv2-launcher:hover,
.dark-mode .cv2-launcher:focus-visible {
  background: var(--accent-hover, var(--bs-primary, #0069d9));
}

.dark-mode .cv2-launcher-tooltip {
  background: #1f2024;
  color: #ececf1;
  border-color: #3a3b42;
}

.dark-mode .cv2-launcher-tooltip::after {
  border-left-color: #1f2024;
}

/* ---------- Container ---------- */
.cv2-container {
  position: fixed;
  top: 16px;
  bottom: 16px;
  right: 56px;
  width: 480px;
  height: auto;
  max-height: none;
  background: var(--cv2-bg);
  border: 1px solid color-mix(in srgb, var(--cv2-border) 82%, transparent);
  border-radius: var(--cv2-radius);
  box-shadow: var(--cv2-shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 99991;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.16s ease, transform 0.16s ease, width 0.2s ease, height 0.2s ease, bottom 0.2s ease, right 0.2s ease, top 0.2s ease;
  color: var(--cv2-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.cv2-container.cv2-open {
  opacity: 1;
  transform: translateY(0);
}

/* Fullscreen mode */
.cv2-container.cv2-fullscreen {
  width: min(900px, calc(100vw - 48px));
  height: auto;
  top: 16px !important;
  bottom: 16px !important;
  right: 24px;
  max-height: none;
}

/* ---------- Header ---------- */
.cv2-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--cv2-border-soft);
  background: var(--cv2-bg);
  flex-shrink: 0;
}
.cv2-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cv2-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--cv2-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cv2-header-text { min-width: 0; }
.cv2-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cv2-text);
  line-height: 1.2;
}
.cv2-subtitle {
  font-size: 0.72rem;
  color: var(--cv2-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv2-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}
.cv2-project-sep { color: var(--cv2-text-light); }
.cv2-project-name { color: var(--cv2-text-muted); font-weight: 500; }

.cv2-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.cv2-icon-btn {
  background: transparent;
  border: none;
  color: var(--cv2-text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--cv2-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  padding: 0;
  font-size: 0.85rem;
}
.cv2-new-chat-btn.btn {
  margin: 0;
  line-height: 1;
}
.cv2-icon-btn:hover {
  background: var(--cv2-bg-soft);
  color: var(--cv2-text);
}
.cv2-icon-btn:focus-visible,
.cv2-launcher:focus-visible,
.cv2-prompt-chip:focus-visible,
.chat-hist-action-btn:focus-visible,
.cv2-btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--cv2-primary) 32%, transparent);
  outline-offset: 2px;
}

/* ---------- Kebab menu ---------- */
.cv2-menu-wrapper { position: relative; }
.cv2-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 200px;
  background: var(--cv2-bg);
  border: 1px solid var(--cv2-border);
  border-radius: var(--cv2-radius-sm);
  box-shadow: var(--cv2-shadow-md);
  padding: 6px;
  display: none;
  z-index: 10;
}
.cv2-menu.cv2-menu-open { display: block; }
.cv2-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--cv2-text);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.cv2-menu-item:hover { background: var(--cv2-bg-soft); }
.cv2-menu-item i, .cv2-menu-item svg { color: var(--cv2-text-muted); width: 16px; text-align: center; }
.cv2-menu-action-wrapper { padding: 0 !important; }
.cv2-menu-action-wrapper .cv2-menu-link,
.cv2-menu-action-wrapper .action-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--cv2-text) !important;
  background: transparent !important;
  border: none !important;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
}
.cv2-menu-action-wrapper:hover { background: var(--cv2-bg-soft); }

/* ---------- Body (chat messages) ---------- */
.cv2-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--cv2-bg);
}
.cv2-body shiny-chat-container,
.cv2-body .shiny-chat-container {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  width: 100% !important;
  padding: 0 !important;
  background: var(--cv2-bg) !important;
  --shiny-chat-user-message-bg: var(--cv2-bg-soft);
  --shiny-chat-border: var(--cv2-border-soft);
}
.cv2-body shiny-chat-messages,
.cv2-body .shiny-chat-messages {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  margin: 0 !important;
  padding: 22px 22px 16px !important;
  scroll-behavior: smooth;
}
/* Outer wrapper around shiny-chat-input: adds top border + generous bottom padding
   so the input doesn't feel crushed against the widget edge */
.cv2-body shiny-chat-container > shiny-chat-input,
.cv2-body .shiny-chat-container > shiny-chat-input {
  position: relative !important;
  z-index: 3;
  display: block !important;
  flex: 0 0 auto !important;
  width: 100% !important;
  padding: 12px 16px 16px !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  background: var(--cv2-bg) !important;
  border-top: 1px solid var(--cv2-border-soft);
}

/* Stable composer footer: shinychat uses this element as a direct grid child. */
.cv2-body shiny-chat-input {
  position: relative !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border: none !important;
  border-radius: 0 !important;
  background: var(--cv2-bg) !important;
  box-shadow: none !important;
}
.cv2-body shiny-chat-input:focus-within {
  outline: none;
  box-shadow: none !important;
}

/* User message bubble (override shinychat) */
.cv2-body .shiny-chat-user-message {
  background: var(--cv2-primary-soft) !important;
  color: var(--cv2-text) !important;
  border: 1px solid color-mix(in srgb, var(--cv2-primary) 12%, transparent);
  border-radius: 16px 16px 4px 16px !important;
  padding: 10px 14px !important;
  font-size: 0.9rem !important;
  line-height: 1.5;
}
/* Assistant messages get markdown styling */
.cv2-body .shiny-chat-message-content {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--cv2-text);
}
.cv2-body .shiny-chat-message-content p { margin: 0 0 8px; }
.cv2-body .shiny-chat-message-content p:last-child { margin-bottom: 0; }
.cv2-body .shiny-chat-message-content pre {
  background: var(--cv2-bg-soft);
  border: 1px solid var(--cv2-border-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.8rem;
  overflow-x: auto;
}
.cv2-body .shiny-chat-message-content code {
  background: var(--cv2-bg-soft);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.85em;
}

/* Never expose tool request body / arguments (code, SQL, raw payloads) to users */
.cv2-body shiny-tool-request .shiny-tool-request__arguments,
.cv2-body .shiny-tool-request__arguments,
.cv2-body shiny-tool-result .shiny-tool-result__request,
.cv2-body .shiny-tool-result__request {
  display: none !important;
}

/* Composer: clean field with light elevation; text never sits under the send button */
.cv2-body shiny-chat-input textarea,
.cv2-body shiny-chat-input .form-control {
  display: block !important;
  width: 100% !important;
  border: 1px solid rgba(26, 15, 9, 0.1) !important;
  border-radius: 14px !important;
  background: var(--cv2-bg) !important;
  resize: none !important;
  outline: none !important;
  box-shadow: 0 1px 2px rgba(26, 15, 9, 0.04) !important;
  margin: 0 !important;
  padding: 12px 56px 12px 16px !important;
  min-height: 48px !important;
  /* Claude-like composer: grow upward first, then scroll only for very long prompts */
  max-height: min(260px, 38vh) !important;
  overflow-y: auto !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
  box-sizing: border-box !important;
  font-family: "DM Sans", system-ui, sans-serif !important;
  font-size: 0.9rem !important;
  color: var(--cv2-text) !important;
  line-height: 1.5 !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

/* Defensive: hide any leftover composer upload control */
.cv2-chat-upload-control,
.cv2-chat-file-input {
  display: none !important;
}
.cv2-body shiny-chat-input textarea:focus,
.cv2-body shiny-chat-input .form-control:focus {
  border-color: rgba(234, 108, 0, 0.45) !important;
  box-shadow: 0 1px 2px rgba(26, 15, 9, 0.04), 0 0 0 3px rgba(234, 108, 0, 0.08) !important;
  outline: none !important;
}
.cv2-body shiny-chat-input textarea::placeholder {
  color: var(--cv2-text-light) !important;
}

/* Send button: circular, inside the field on the right */
.cv2-body shiny-chat-input button.shiny-chat-btn-send,
.cv2-body shiny-chat-input button[type="button"],
.cv2-body shiny-chat-input button[type="submit"] {
  position: absolute !important;
  right: 24px !important;
  bottom: 24px !important;
  flex-shrink: 0 !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  border-radius: 50% !important;
  border: none !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--cv2-primary) !important;
  color: #fff !important;
  cursor: pointer;
  margin: 0 !important;
  box-shadow: none !important;
  transition: background 0.15s ease !important;
}
.cv2-body shiny-chat-input button.shiny-chat-btn-send:hover:not(:disabled),
.cv2-body shiny-chat-input button[type="button"]:hover:not(:disabled) {
  background: var(--cv2-primary-hover) !important;
}
.cv2-body shiny-chat-input button.shiny-chat-btn-send:disabled,
.cv2-body shiny-chat-input button[type="button"]:disabled {
  background: var(--cv2-border) !important;
  color: var(--cv2-text-light) !important;
  cursor: not-allowed;
  opacity: 1 !important;
}
.cv2-body shiny-chat-input button svg {
  width: 16px !important;
  height: 16px !important;
  fill: currentColor !important;
}

.dark-mode .cv2-body shiny-chat-input textarea,
.dark-mode .cv2-body shiny-chat-input .form-control {
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}
.dark-mode .cv2-body shiny-chat-input textarea:focus,
.dark-mode .cv2-body shiny-chat-input .form-control:focus {
  border-color: rgba(234, 108, 0, 0.5) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 3px var(--accent-soft) !important;
}

@media (max-width: 768px) {
  .cv2-body shiny-chat-input textarea,
  .cv2-body shiny-chat-input .form-control {
    max-height: min(220px, 34vh) !important;
  }
}

/* ---------- Welcome screen (absolute overlay over messages area, keeps input usable) ---------- */
.cv2-welcome {
  position: absolute;
  top: 69px;      /* below header */
  left: 0;
  right: 0;
  bottom: 90px;   /* above input area */
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding: 28px 22px 20px;
  overflow-y: auto;
  background: var(--cv2-bg);
}
.cv2-container.cv2-has-messages .cv2-welcome { display: none; }
.cv2-container.cv2-show-history .cv2-welcome { display: none; }
.cv2-container.cv2-show-history .cv2-body { visibility: hidden; }

.cv2-welcome-hero {
  text-align: left;
  padding: 4px 0 22px;
}
.cv2-welcome-mark {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: var(--radius-lg);
  color: var(--cv2-primary-hover);
  background: transparent;
  border: 1px solid var(--cv2-border);
  font-size: 1rem;
}
.cv2-welcome-eyebrow {
  margin-bottom: 5px;
  color: var(--cv2-primary-hover);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}
.cv2-welcome-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--cv2-text);
  margin: 0 0 6px;
}
.cv2-welcome-subtitle {
  max-width: 390px;
  font-size: 0.87rem;
  color: var(--cv2-text-muted);
  margin: 0;
  line-height: 1.5;
}
.cv2-prompts-label {
  margin-bottom: 9px;
  color: var(--cv2-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cv2-prompts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 0;
}
.cv2-prompt-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  min-height: 48px;
  padding: 11px 12px;
  background: var(--cv2-bg);
  border: 1px solid var(--cv2-border);
  border-radius: var(--radius-lg);
  font-size: 0.8rem;
  color: var(--cv2-text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  line-height: 1.3;
}
.cv2-prompt-chip:hover {
  border-color: color-mix(in srgb, var(--cv2-primary) 55%, var(--cv2-border));
  background: var(--cv2-primary-soft);
  box-shadow: none;
}
.cv2-prompt-icon {
  color: var(--cv2-primary);
  font-size: 0.9rem;
  flex-shrink: 0;
}
.cv2-prompt-label {
  flex: 1;
  min-width: 0;
}
.cv2-prompt-arrow {
  color: var(--cv2-text-light);
  font-size: 0.68rem;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.15s, transform 0.15s;
}
.cv2-prompt-chip:hover .cv2-prompt-arrow,
.cv2-prompt-chip:focus-visible .cv2-prompt-arrow {
  color: var(--cv2-primary-hover);
  opacity: 1;
  transform: translateX(0);
}
.cv2-welcome-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 0;
  color: var(--cv2-text-light);
  font-size: 0.69rem;
  line-height: 1.35;
}

/* ---------- History overlay (full height below header) ---------- */
.cv2-history {
  position: absolute;
  top: 65px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  background: var(--cv2-bg);
  overflow: hidden;
}
.cv2-container.cv2-show-history .cv2-history { display: flex; }

.cv2-history-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--cv2-border-soft);
  flex-shrink: 0;
}
.cv2-history-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--cv2-text);
}
.cv2-history-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

/* Individual conversation row */
.chat-history-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.chat-history-item:hover { background: var(--cv2-bg-soft); }
.chat-history-item.active {
  background: var(--cv2-bg-soft);
  border-left-color: var(--cv2-primary);
}
.chat-history-item-main { flex: 1; min-width: 0; overflow: hidden; }
.chat-history-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--cv2-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-history-item-meta {
  font-size: 0.72rem;
  color: var(--cv2-text-light);
  margin-top: 2px;
}
.chat-history-item-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
}
.chat-history-item:hover .chat-history-item-actions { opacity: 1; }
.chat-history-item:focus-within .chat-history-item-actions { opacity: 1; }
.chat-hist-action-btn {
  background: transparent;
  border: none;
  color: var(--cv2-text-muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  transition: all 0.15s;
}
.chat-hist-action-btn:hover {
  background: var(--cv2-bg);
  color: var(--cv2-text);
}
.chat-hist-delete-btn:hover { color: #ef4444; }

/* ---------- Rename modal ---------- */
.cv2-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cv2-modal {
  background: var(--cv2-bg);
  border-radius: var(--cv2-radius);
  padding: 20px 22px;
  width: 380px;
  max-width: 100%;
  border: 1px solid var(--cv2-border);
  box-shadow: none;
  color: var(--cv2-text);
}
.cv2-modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.cv2-modal input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--cv2-border);
  border-radius: var(--radius-md);
  background: var(--cv2-bg-soft);
  color: var(--cv2-text);
  font-size: 0.9rem;
}
.cv2-modal input[type="text"]:focus {
  outline: 2px solid color-mix(in srgb, var(--cv2-primary) 20%, transparent);
  outline-offset: 0;
  border-color: var(--cv2-primary);
  box-shadow: none;
}
.cv2-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.cv2-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.cv2-btn-ghost {
  background: transparent;
  color: var(--cv2-text-muted);
}
.cv2-btn-ghost:hover { background: var(--cv2-bg-soft); color: var(--cv2-text); }
.cv2-btn-primary {
  background: var(--cv2-solid);
  color: var(--cv2-solid-fg);
}
.cv2-btn-primary:hover { background: var(--cv2-primary); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .cv2-container {
    width: calc(100vw - 24px);
    height: auto;
    max-height: none;
    top: 12px;
    bottom: 12px;
    right: 12px;
    left: 12px;
    border-radius: var(--radius-lg);
  }
  .cv2-container.cv2-fullscreen {
    width: 100vw;
    height: auto;
    top: 0 !important;
    bottom: 0 !important;
    right: 0;
    left: 0;
    border-radius: 0;
  }
  .cv2-launcher {
    top: auto !important;
    bottom: 16px;
    right: 0;
    width: 48px;
    min-width: 48px;
    height: 48px;
    padding: 0 8px 0 6px;
  }
  .cv2-launcher-label { display: none; }
  .cv2-launcher-tooltip { display: none; }
  .cv2-prompts-grid {
    grid-template-columns: 1fr;
  }
  .cv2-welcome {
    top: 69px;
    padding: 22px 18px 16px;
  }
  .cv2-welcome-title { font-size: 1.3rem; }
  .cv2-body shiny-chat-container > shiny-chat-input,
  .cv2-body .shiny-chat-container > shiny-chat-input {
    padding: 10px 12px 12px !important;
  }
  .cv2-body shiny-chat-input button.shiny-chat-btn-send,
  .cv2-body shiny-chat-input button[type="button"],
  .cv2-body shiny-chat-input button[type="submit"] {
    right: 20px !important;
    bottom: 20px !important;
  }
}

/* Smooth slide-up animation on mobile */
@media (max-width: 768px) {
  .cv2-container {
    transform: translateY(100%);
  }
  .cv2-container.cv2-open {
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cv2-container,
  .cv2-launcher,
  .cv2-prompt-chip,
  .cv2-prompt-arrow,
  .chat-history-item,
  .cv2-icon-btn {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Scrollbar polish */
.cv2-body ::-webkit-scrollbar,
.cv2-welcome::-webkit-scrollbar,
.cv2-history-list::-webkit-scrollbar { width: 6px; height: 6px; }
.cv2-body ::-webkit-scrollbar-thumb,
.cv2-welcome::-webkit-scrollbar-thumb,
.cv2-history-list::-webkit-scrollbar-thumb {
  background: var(--cv2-border);
  border-radius: 3px;
}
.cv2-body ::-webkit-scrollbar-thumb:hover,
.cv2-welcome::-webkit-scrollbar-thumb:hover,
.cv2-history-list::-webkit-scrollbar-thumb:hover {
  background: var(--cv2-text-light);
}

/* ============================================================
   END FLOATING CHAT WIDGET v2
   ============================================================ */


.container-drag-source, .box-dad {
   border-radius: var(--radius-sm) !important; 
}


#explore-esquisse-geomaes-aes_1-dragvars-source-container {
  background-color:transparent!important;
}

.box-dad .xyvar.dragula-target{
  background-color:transparent!important;
}

/* =========================================================
   Usage dropdown in navbar header
   ========================================================= */

.usage-total-badge {
  font-size: 0.7rem;
}
.usage-dropdown-header {
  padding: 10px 14px;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--accent);
  border-bottom: 1px solid #eee;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dark-mode .usage-dropdown-header {
  border-bottom-color: #3a3a3a;
}
.usage-dropdown-body {
  padding: 8px 0;
}
.usage-dropdown-row {
  display: flex;
  align-items: center;
  padding: 7px 14px;
  gap: 10px;
  font-size: 0.82rem;
}
.usage-dropdown-row:hover {
  background: #f8f9fa;
}
.dark-mode .usage-dropdown-row:hover {
  background: #2d2d2d;
}
.usage-dropdown-icon {
  width: 20px;
  text-align: center;
  color: var(--accent);
  font-size: 0.85rem;
}
.usage-dropdown-label {
  flex: 1;
  color: #555;
}
.dark-mode .usage-dropdown-label {
  color: #bbb;
}
.usage-dropdown-count {
  font-weight: 700;
  color: #333;
  background: #f0f0f0;
  padding: 2px 10px;
  border-radius: var(--radius-lg);
  font-size: 0.78rem;
  min-width: 28px;
  text-align: center;
}
.dark-mode .usage-dropdown-count {
  color: #e0e0e0;
  background: #3a3a3a;
}

/* ---------- Per-chart fullscreen button ---------- */
.meetrik-fs-btn {
  border: 1px solid var(--rt-border-color, #e0e0e0);
  background: transparent;
  color: var(--rt-color, #555);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.meetrik-fs-btn:hover {
  background: var(--rt-bg-hover-color, rgba(0, 0, 0, 0.06));
  color: var(--rt-color, #222);
}

/* Card when displayed fullscreen via the Fullscreen API */
.meetrik-chart-card:fullscreen {
  background-color: var(--rt-bg-color, #ffffff);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.meetrik-chart-card:fullscreen .plotly,
.meetrik-chart-card:fullscreen .js-plotly-plot {
  flex: 1 1 auto;
  height: 100% !important;
  min-height: 0;
}
.meetrik-chart-card:-webkit-full-screen {
  background-color: var(--rt-bg-color, #ffffff);
  padding: 24px;
}

.channel-prior-details {
  margin-bottom: 15px;
  border-top: 1px dashed var(--rt-border-color);
  padding-top: 8px;
}

.channel-prior-details > .channel-prior-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rt-border-color);
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.06));
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.channel-prior-details > .channel-prior-summary::-webkit-details-marker {
  display: none;
}

.channel-prior-details > .channel-prior-summary::marker {
  content: "";
}

.channel-prior-details > .channel-prior-summary:hover {
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.12));
  border-color: rgba(108, 117, 125, 0.35);
}

.channel-prior-chevron {
  color: #6c757d;
  transition: transform 0.2s ease;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.channel-prior-details[open] > .channel-prior-summary .channel-prior-chevron {
  transform: rotate(90deg);
}

.channel-prior-details > .channel-prior-summary .channel-prior-title {
  flex: 0 1 auto;
  min-width: 0;
}

.channel-prior-details > .channel-prior-summary .channel-prior-hint {
  margin-left: auto;
  font-size: 11px;
  white-space: nowrap;
}

.channel-prior-body {
  padding-top: 4px;
}

.channel-prior-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr);
  gap: 12px;
  align-items: stretch;
}

.channel-prior-controls,
.channel-prior-preview {
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rt-border-color);
  min-width: 0;
}

.channel-prior-controls {
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.06));
}

.channel-prior-preview {
  background: transparent;
}

.channel-prior-field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 6px 0;
}

.channel-prior-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 14px 0 6px 0;
}

.channel-prior-label-row .channel-prior-field-label {
  margin-bottom: 0;
}

.channel-prior-field {
  margin-top: 12px;
}

.channel-prior-help-text {
  display: block;
  line-height: 1.35;
  margin-top: 6px;
}

.channel-prior-beta-params {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.channel-prior-beta-input {
  flex: 1;
  min-width: 0;
}

.channel-prior-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.channel-prior-preview-header small {
  font-size: 10px;
  text-align: right;
}

.channel-prior-band-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: rgba(33, 113, 181, 0.12);
  border: 1px solid rgba(33, 113, 181, 0.28);
  color: #0b3d66;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.channel-prior-band-swatch {
  flex: 0 0 auto;
  width: 14px;
  height: 10px;
  border-radius: 2px;
  background: rgba(33, 113, 181, 0.45);
  border: 1px solid rgba(8, 81, 156, 0.55);
}

.channel-prior-plot {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.channel-prior-controls .btn-group,
.channel-prior-controls .radiobtn,
.channel-prior-controls .btn-group-container-sw {
  width: 100%;
}

.channel-prior-controls .btn-group,
.channel-prior-controls .btn-group-container-sw {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.channel-prior-controls .btn-group > .btn,
.channel-prior-controls .btn-group-toggle > .btn,
.channel-prior-controls .btn-group-container-sw .btn {
  flex: 1 1 auto;
  white-space: normal;
  line-height: 1.25;
  font-size: 12px;
  padding: 7px 8px;
  min-width: 0;
}

.channel-fields-row > div {
  flex: 1 1 220px;
  min-width: 0;
}

@media (max-width: 992px) {
  .channel-prior-layout {
    grid-template-columns: 1fr;
  }

  .channel-prior-preview-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .channel-prior-preview-header small,
  .channel-prior-band-badge {
    text-align: left;
  }
}

@media (max-width: 768px) {
  .channel-container {
    padding: 12px !important;
  }

  .channel-prior-details > .channel-prior-summary {
    flex-wrap: wrap;
    padding: 10px;
    gap: 6px;
  }

  .channel-prior-details > .channel-prior-summary .channel-prior-hint {
    width: 100%;
    margin-left: 22px;
    white-space: normal;
  }

  .channel-prior-controls,
  .channel-prior-preview {
    padding: 12px;
  }

  .channel-prior-controls .btn-group > .btn,
  .channel-prior-controls .btn-group-toggle > .btn,
  .channel-prior-controls .btn-group-container-sw .btn {
    flex: 1 1 calc(50% - 6px);
    font-size: 11px;
    padding: 8px 6px;
  }

  .channel-prior-beta-params {
    flex-direction: column;
    gap: 0;
  }

  .channel-prior-plot,
  .channel-prior-plot .plotly,
  .channel-prior-plot .js-plotly-plot {
    max-height: 240px;
  }

  .channel-fields-row {
    gap: 10px !important;
  }

  .channel-fields-row > div {
    flex: 1 1 100%;
  }
}

@media (max-width: 480px) {
  .channel-prior-controls .btn-group > .btn,
  .channel-prior-controls .btn-group-toggle > .btn,
  .channel-prior-controls .btn-group-container-sw .btn {
    flex: 1 1 100%;
  }

  .channel-prior-plot,
  .channel-prior-plot .plotly,
  .channel-prior-plot .js-plotly-plot {
    max-height: 210px;
  }
}

/* Minimal builder banners (read-only run config + info callouts) */
.builder-readonly-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 10px 16px;
  padding: 10px 14px;
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-sm);
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.04));
  color: var(--rt-color);
}

.builder-readonly-banner__text {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.builder-readonly-banner__icon {
  color: var(--rt-muted-color, #6c757d);
  flex-shrink: 0;
}

.builder-readonly-banner__title {
  font-weight: 600;
}

.builder-readonly-banner__meta {
  color: var(--rt-muted-color, #6c757d);
  font-size: 12px;
}

.builder-readonly-banner__action {
  flex-shrink: 0;
  white-space: nowrap;
}

.builder-info-callout {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 20px;
  padding: 10px 12px;
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-sm);
  background: var(--rt-bg-secondary, rgba(108, 117, 125, 0.04));
  color: var(--rt-muted-color, #6c757d);
  font-size: 13px;
  line-height: 1.45;
}

.builder-info-callout__icon {
  margin-top: 2px;
  flex-shrink: 0;
  opacity: 0.8;
}

.dark-mode .builder-readonly-banner,
.dark-mode .builder-info-callout {
  background: rgba(255, 255, 255, 0.03);
}

/* Reference allocation — registry summary + builder */
.ref-alloc-summary {
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  background-color: var(--rt-bg-color);
}

.ref-alloc-summary__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ref-alloc-summary__title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--rt-color);
}

.ref-alloc-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.ref-alloc-badge--custom {
  background: rgba(0, 123, 255, 0.12);
  color: #007bff;
}

.ref-alloc-badge--historical {
  background: rgba(40, 167, 69, 0.12);
  color: #28a745;
}

.ref-alloc-badge--locked {
  background: rgba(108, 117, 125, 0.14);
  color: #495057;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ref-alloc-builder-row__name .ref-alloc-badge--locked {
  margin-left: 6px;
  vertical-align: middle;
}

.ref-alloc-summary__note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6c757d;
}

.ref-alloc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px 16px;
}

.ref-alloc-row {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) minmax(80px, 120px) 44px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--rt-color);
}

.ref-alloc-row__name,
.ref-alloc-builder-row__name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.ref-alloc-row__swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ref-alloc-row__track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.ref-alloc-row__track--muted {
  height: 6px;
  margin-top: 4px;
}

.ref-alloc-row__track--input {
  height: 6px;
  margin-bottom: 4px;
}

.ref-alloc-row__bar {
  height: 100%;
  border-radius: var(--radius-pill);
  background: #4e79a7;
  min-width: 2px;
  transition: width 0.15s ease;
}

.ref-alloc-row__bar--muted {
  background: rgba(108, 117, 125, 0.45);
}

.ref-alloc-row__bar--soft {
  opacity: 0.55;
}

.ref-alloc-row__pct {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ref-alloc-builder {
  margin-top: 0;
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background-color: var(--rt-bg-color);
}

.ref-alloc-builder__header,
.ref-alloc-builder-row {
  display: grid;
  grid-template-columns: minmax(90px, 1.15fr) minmax(64px, 0.7fr) minmax(72px, 0.85fr) minmax(72px, 0.8fr) 78px 78px;
  gap: 10px;
  align-items: end;
}

.ref-alloc-builder-row__name {
  color: var(--rt-color);
  align-self: end;
  height: 32px;
  display: inline-flex;
  align-items: center;
}

.ref-alloc-builder--with-bounds .ref-alloc-builder__header > span:nth-child(2),
.ref-alloc-builder--with-bounds .ref-alloc-builder__header > span:nth-child(3),
.ref-alloc-builder--with-bounds .ref-alloc-builder__header > span:nth-child(4) {
  text-align: right;
}

.ref-alloc-builder--with-bounds .ref-alloc-builder__header > span:nth-child(5),
.ref-alloc-builder--with-bounds .ref-alloc-builder__header > span:nth-child(6) {
  text-align: center;
}

/* Constraint columns: sober separator, same input language as the rest */
.ref-alloc-builder--with-bounds .ref-alloc-builder__header > span:nth-child(5),
.ref-alloc-builder--with-bounds .ref-alloc-builder-row > .ref-alloc-builder-row__bound--start {
  margin-left: 2px;
  padding-left: 10px;
  border-left: 1px solid var(--rt-border-color);
}

.ref-alloc-builder__bound-head {
  display: block;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #6c757d;
}

.ref-alloc-builder-row__bound .form-group {
  margin-bottom: 0;
}

.ref-alloc-builder-row__bound input[type="number"] {
  text-align: center;
  font-weight: 500;
  padding: 4px 4px;
  height: 32px;
  width: 100%;
  border-radius: var(--radius-sm);
  font-size: 12px;
  border: 1px solid var(--rt-border-color);
  background: var(--rt-bg-color);
  color: var(--rt-color);
}

.opt-builder-bounds-defaults__suffix {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  margin-right: 2px;
}

.ref-alloc-builder__header {
  font-size: 11px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rt-border-color);
}

.ref-alloc-builder__header > span:nth-child(2),
.ref-alloc-builder__header > span:nth-child(3),
.ref-alloc-builder__header > span:nth-child(4) {
  text-align: right;
}

.ref-alloc-builder__body {
  max-height: 320px;
  overflow-y: auto;
}

.ref-alloc-builder-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--rt-border-color);
  font-size: 13px;
}

.ref-alloc-builder-row:last-child {
  border-bottom: none;
}

.ref-alloc-builder-row__metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.ref-alloc-builder-row__metric .ref-alloc-row__track--hairline {
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.ref-alloc-builder-row__metric .ref-alloc-row__track--hairline .ref-alloc-row__bar {
  height: 100%;
  min-width: 0;
  border-radius: var(--radius-pill);
  opacity: 0.9;
  transition: width 0.15s ease;
}

.ref-alloc-builder-row__metric .ref-alloc-row__bar--soft {
  opacity: 0.45;
}

.ref-alloc-builder-row__hist-value {
  display: block;
  font-size: 13px;
  color: #6c757d;
  text-align: right;
  font-variant-numeric: tabular-nums;
  line-height: 32px;
  height: 32px;
}

.ref-alloc-builder-row__metric--input .form-group {
  margin-bottom: 0;
  width: 100%;
}

.ref-alloc-builder-row__metric--input input[type="number"] {
  text-align: right;
  font-weight: 600;
  padding: 4px 8px;
  height: 32px;
  width: 100%;
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-sm);
  background: var(--rt-bg-color);
}

.dark-mode .ref-alloc-builder-row__metric .ref-alloc-row__track--hairline {
  background: rgba(255, 255, 255, 0.08);
}

.ref-alloc-builder-row__spend-value {
  display: block;
  font-weight: 600;
  color: var(--rt-color);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ref-alloc-builder-row__name {
  color: var(--rt-color);
  align-self: end;
  height: 32px;
}

.ref-alloc-builder-row__spend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 32px;
}

.ref-alloc-builder__footnote {
  display: block;
  margin-top: 10px;
  color: #999;
  font-size: 12px;
}

.ref-alloc-builder__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ref-alloc-builder__total {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ref-alloc-builder__total--valid {
  color: #28a745;
}

.ref-alloc-builder__total--invalid {
  color: #dc3545;
}

.ref-alloc-builder__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ref-alloc-builder__action-btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
  border-radius: var(--radius-sm) !important;
  background: transparent !important;
  border: 1px solid var(--rt-border-color) !important;
  color: var(--rt-color) !important;
}

.ref-alloc-builder__error {
  display: block;
  color: #dc3545;
  margin-top: 6px;
}

.dark-mode .ref-alloc-row__track {
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .ref-alloc-grid {
    grid-template-columns: 1fr;
  }

  .ref-alloc-builder__header {
    display: none;
  }

  .ref-alloc-builder-row,
  .ref-alloc-builder--with-bounds .ref-alloc-builder-row {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px 0;
  }

  .ref-alloc-builder-row__name {
    grid-column: 1 / -1;
  }

  .ref-alloc-builder-row__hist-value,
  .ref-alloc-builder-row__spend-value {
    text-align: left;
  }

  .ref-alloc-builder-row__spend {
    align-self: start;
    height: auto;
    justify-content: flex-start;
  }
}


/* ===== In-app Help ===== */
/* Parent .tab-content uses overflow:hidden + fixed height — help must own its scroll. */
.help-page {
  height: calc(100vh - 4.5rem);
  max-height: calc(100vh - 4.5rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 12px;
  box-sizing: border-box;
}

.help-layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
  overflow: hidden;
}

.help-toc {
  position: static;
  align-self: start;
  max-height: 100%;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--rt-border-color, #e5e7eb);
  border-radius: 10px;
  background: var(--rt-bg-color, #fff);
}

.help-toc__title {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--rt-color, #1f2937);
}

.help-toc__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.help-toc__link {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--rt-color, #374151) !important;
  text-decoration: none !important;
  font-size: 0.9rem;
  line-height: 1.3;
}

.help-toc__link:hover {
  background: rgba(16, 163, 127, 0.08);
}

.help-toc__link--active {
  background: rgba(16, 163, 127, 0.14);
  color: #0f766e !important;
  font-weight: 600;
}

.help-content-wrap {
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 12px 32px 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
}

.help-content-wrap::-webkit-scrollbar {
  width: 8px;
}

.help-content-wrap::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-xs);
}

.dark-mode .help-content-wrap::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
}

.help-content__heading {
  margin: 0 0 16px;
  font-size: 1.35rem;
  font-weight: 700;
}

.help-article {
  color: var(--rt-color, #1f2937);
  line-height: 1.55;
  font-size: 0.95rem;
  max-width: 56rem;
}

.help-flow {
  margin: 1rem 0 1.4rem;
  padding: 14px 16px;
  border: 1px solid var(--rt-border-color, #e5e7eb);
  border-radius: 10px;
  background: color-mix(in srgb, var(--rt-bg-color, #fff) 88%, #ecfdf5);
}

.help-flow__steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 6px;
  margin: 0;
  padding: 0;
}

.help-flow__step {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: #fff;
  border: 1px solid color-mix(in srgb, #10a37f 28%, #e5e7eb);
  color: #0f766e;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.2;
}

.help-flow__arrow {
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 600;
}

.help-flow__loop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px dashed color-mix(in srgb, var(--rt-border-color, #e5e7eb) 90%, transparent);
  font-size: 0.86rem;
  line-height: 1.35;
  color: #64748b;
}

.help-flow__loop-label {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: #f1f5f9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.help-flow__loop-path {
  font-weight: 600;
  color: #334155;
}

.dark-mode .help-flow {
  background: color-mix(in srgb, var(--rt-bg-color, #1f2937) 90%, #0f766e);
}

.dark-mode .help-flow__step {
  background: #1f2937;
  border-color: #334155;
  color: #5eead4;
}

.dark-mode .help-flow__loop-label {
  background: #334155;
  color: #cbd5e1;
}

.dark-mode .help-flow__loop-path {
  color: #e2e8f0;
}

.help-article h1 {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.help-article h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.6rem 0 0.7rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--rt-border-color, #e5e7eb);
}

.help-article h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.help-article h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.2rem 0 0.5rem;
}

.help-article p,
.help-article ul,
.help-article ol,
.help-article blockquote,
.help-article pre,
.help-article table {
  margin: 0 0 0.9rem;
}

.help-article ul,
.help-article ol {
  padding-left: 1.35rem;
}

.help-article li {
  margin-bottom: 0.25rem;
}

.help-article blockquote {
  margin-left: 0;
  padding: 10px 14px;
  border-left: 3px solid #10a37f;
  background: rgba(16, 163, 127, 0.08);
  border-radius: 0 8px 8px 0;
}

.help-article code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
  background: rgba(0, 0, 0, 0.06);
}

.help-article pre {
  padding: 12px 14px;
  overflow-x: auto;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.05);
}

.help-article pre code {
  padding: 0;
  background: transparent;
}

.help-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.help-article th,
.help-article td {
  border: 1px solid var(--rt-border-color, #e5e7eb);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.help-article th {
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
}

.help-article img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0.75rem 0 1.1rem;
  border: 1px solid var(--rt-border-color, #e5e7eb);
  border-radius: var(--radius-md);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.help-missing {
  padding: 16px;
  border-radius: var(--radius-md);
  background: #fff3cd;
  color: #856404;
}

.dark-mode .help-toc,
.dark-mode .help-article th {
  background: rgba(255, 255, 255, 0.04);
}

.dark-mode .help-article code,
.dark-mode .help-article pre {
  background: rgba(255, 255, 255, 0.08);
}

.dark-mode .help-article blockquote {
  background: rgba(16, 163, 127, 0.16);
}

.dark-mode .help-toc__link--active {
  color: #5eead4 !important;
}

@media (max-width: 900px) {
  .help-page {
    height: calc(100vh - 3.5rem);
    max-height: calc(100vh - 3.5rem);
  }

  .help-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .help-toc {
    max-height: none;
    overflow: visible;
  }

  .help-content-wrap {
    height: auto;
    overflow: visible;
  }

  .help-toc .shiny-options-group,
  .help-toc__nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.help-toc .shiny-options-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.help-toc .radio {
  margin: 0;
}

.help-toc .radio label {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.3;
  cursor: pointer;
}

.help-toc .radio label:hover {
  background: rgba(16, 163, 127, 0.08);
}

.help-toc .radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.help-toc .radio input[type="radio"]:checked + span,
.help-toc .radio label:has(input[type="radio"]:checked) {
  background: rgba(16, 163, 127, 0.14);
  color: #0f766e;
  font-weight: 600;
}

.dark-mode .help-toc .radio label:has(input[type="radio"]:checked) {
  color: #5eead4;
}

/* --- Optimize: reallocation flow narrative viz --- */
/* --- Where the money moves: transfer story (no arc spaghetti) --- */
.realloc-flow {
  --realloc-ink: var(--rt-color, #1f2937);
  --realloc-muted: #6b7280;
  --realloc-line: var(--rt-border-color, #e5e7eb);
  --realloc-up: #0f766e;
  --realloc-down: #b42318;
  --realloc-surface: color-mix(in srgb, var(--rt-bg-color, #fff) 92%, #e8edf3);
  color: var(--realloc-ink);
  font-size: 13px;
}

.realloc-flow__hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--realloc-line);
}

.realloc-flow__hero-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.realloc-flow--anim:not(.is-inview) .realloc-flow__hero-item {
  opacity: 0;
  transform: translateY(6px);
}

.realloc-flow__hero-item:last-child,
.realloc-flow__hero-item--unlocked {
  text-align: right;
}

.realloc-flow__hero-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--realloc-muted);
  font-weight: 600;
}

.realloc-flow__hero-value {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--realloc-ink);
  font-variant-numeric: tabular-nums;
}

.realloc-flow__hero-item.is-up .realloc-flow__hero-value { color: var(--realloc-up); }
.realloc-flow__hero-item.is-down .realloc-flow__hero-value { color: var(--realloc-down); }

.realloc-flow__hero-arrow {
  position: relative;
  width: 48px;
  height: 1px;
  background: var(--realloc-line);
  opacity: 0.55;
  overflow: hidden;
}

.realloc-flow--anim:not(.is-inview) .realloc-flow__hero-arrow {
  opacity: 0;
}

.realloc-flow__hero-arrow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--realloc-up) 55%, transparent),
    transparent
  );
  transform: translateX(-100%);
}

.realloc-flow__hero-arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1px solid var(--realloc-muted);
  border-top: 1px solid var(--realloc-muted);
  transform: translate(0, -50%) rotate(45deg);
}

.realloc-flow__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(132px, 168px) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 280px;
  position: relative;
  overflow: visible;
}

.realloc-flow__wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
}

.realloc-flow__wire-base {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.realloc-flow__wire-base.is-visible {
  opacity: 0.12;
}

.realloc-flow__wire {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.realloc-flow__wire.is-static,
.realloc-flow__wire.is-flowing {
  opacity: 0.82;
}

.realloc-flow__wire.is-flowing {
  /* Fallback if RAF is blocked; JS also marches dashoffset. */
  animation: realloc-dash-march 0.95s linear infinite;
}

@keyframes realloc-dash-march {
  to {
    stroke-dashoffset: -22;
  }
}

.realloc-flow__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  z-index: 3;
}

.realloc-flow__col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--realloc-line);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--realloc-muted);
}

.realloc-flow--anim:not(.is-inview) .realloc-flow__col-head {
  opacity: 0;
  transform: translateY(4px);
}

.realloc-flow__col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.25rem;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  letter-spacing: 0;
  font-weight: 700;
  color: var(--realloc-ink);
  background: color-mix(in srgb, var(--realloc-line) 55%, transparent);
}

.realloc-flow__col-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: min(440px, 52vh);
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.realloc-flow__row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition:
    opacity 0.35s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.realloc-flow--anim:not(.is-complete) .realloc-flow__row--cut:not(.is-revealed),
.realloc-flow--anim:not(.is-complete) .realloc-flow__row--boost:not(.is-revealed) {
  opacity: 0;
  pointer-events: none;
}

.realloc-flow--anim .realloc-flow__row--cut:not(.is-revealed) {
  transform: translateX(10px);
}

.realloc-flow--anim .realloc-flow__row--boost:not(.is-revealed) {
  transform: translateX(-10px);
}

.realloc-flow--anim .realloc-flow__row.is-revealed {
  opacity: 1;
  transform: none;
}

.realloc-flow__track {
  height: 3px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--realloc-line) 70%, transparent);
  overflow: hidden;
}

.realloc-flow__fill {
  height: 100%;
  width: var(--w);
  border-radius: inherit;
  background: var(--ch);
  transform-origin: left center;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.realloc-flow__row--cut .realloc-flow__fill {
  margin-left: auto;
  transform-origin: right center;
}

.realloc-flow--anim:not(.is-complete) .realloc-flow__row:not(.is-revealed) .realloc-flow__fill {
  width: 0 !important;
}

.realloc-flow--anim .realloc-flow__row.is-revealed .realloc-flow__fill {
  width: var(--w);
}

.realloc-flow__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.realloc-flow__col--cuts .realloc-flow__meta {
  flex-direction: row-reverse;
}

.realloc-flow__name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.realloc-flow__col--cuts .realloc-flow__name {
  flex-direction: row-reverse;
}

.realloc-flow__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ch);
  flex-shrink: 0;
  transition: box-shadow 0.35s ease;
}

.realloc-flow__row--boost.is-landed .realloc-flow__dot {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ch) 22%, transparent);
}

.realloc-flow__channel {
  font-weight: 600;
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.realloc-flow__figures {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.realloc-flow__col--cuts .realloc-flow__figures {
  align-items: flex-start;
}

.realloc-flow__spend {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: -0.01em;
}

.realloc-flow__row--cut .realloc-flow__spend { color: var(--realloc-down); }
.realloc-flow__row--boost .realloc-flow__spend { color: var(--realloc-up); }

.realloc-flow__rev {
  font-size: 0.72rem;
  color: var(--realloc-muted);
}

.realloc-flow__rev.is-up { color: color-mix(in srgb, var(--realloc-up) 78%, var(--realloc-muted)); }
.realloc-flow__rev.is-down { color: color-mix(in srgb, var(--realloc-down) 78%, var(--realloc-muted)); }

.realloc-flow__none {
  margin: 8px 0 0;
  color: var(--realloc-muted);
  font-size: 0.85rem;
}

/* Transfer hub — bank card + composition rails */
.realloc-flow__bridge {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 3;
  padding: 4px 0;
  overflow: visible;
  align-self: center;
}

.realloc-flow__bridge::before {
  content: "";
  position: absolute;
  top: 8%;
  bottom: 8%;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    transparent,
    color-mix(in srgb, var(--realloc-down) 28%, var(--realloc-line)) 18%,
    color-mix(in srgb, var(--realloc-up) 32%, var(--realloc-line)) 82%,
    transparent
  );
  z-index: 0;
}

.realloc-flow__pool.realloc-flow__wallet {
  /* Brushed aluminum — very light, soft edge */
  --card-face: #e8ebf0;
  --card-face-hi: #fbfcfd;
  --card-face-lo: #d0d5de;
  --card-edge: #c5CAD3;
  --card-rim: #ffffff;
  --card-chip: #dce0e6;
  --card-mute: #7b8494;
  --card-ink: #374151;
  --pool-accent: #0f766e;
  --card-max-h: 110px;
  --rail-extra: 24px;
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 10px;
  gap: 7px;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  align-self: center;
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.realloc-flow__rail {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* Just a bit taller than the CB, centered with it */
  height: calc(var(--card-max-h) + var(--rail-extra));
  min-height: calc(var(--card-max-h) + var(--rail-extra));
  max-height: calc(var(--card-max-h) + var(--rail-extra));
  align-self: center;
  border-radius: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--realloc-line) 40%, transparent);
  z-index: 1;
}

.realloc-flow__seg {
  display: block;
  flex: calc(var(--f, 1) * 100) 1 0;
  min-height: 4px;
  background: var(--ch);
  opacity: 0.95;
  transform-origin: center center;
  transition:
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.35s ease;
}

.realloc-flow--anim .realloc-flow__rail--in .realloc-flow__seg {
  transform: scaleY(0.15);
  opacity: 0.25;
}

.realloc-flow--anim .realloc-flow__rail--out .realloc-flow__seg {
  transform: scaleY(0.15);
  opacity: 0.2;
}

.realloc-flow--anim[data-stage="pool"] .realloc-flow__rail--in .realloc-flow__seg,
.realloc-flow--anim[data-stage="boosts"] .realloc-flow__rail--in .realloc-flow__seg,
.realloc-flow--anim[data-stage="done"] .realloc-flow__rail--in .realloc-flow__seg,
.realloc-flow--anim.is-complete .realloc-flow__rail--in .realloc-flow__seg {
  transform: scaleY(1);
  opacity: 0.95;
  transition-delay: calc(var(--i, 0) * 45ms);
}

.realloc-flow--anim[data-stage="boosts"] .realloc-flow__rail--out .realloc-flow__seg,
.realloc-flow--anim[data-stage="done"] .realloc-flow__rail--out .realloc-flow__seg,
.realloc-flow--anim.is-complete .realloc-flow__rail--out .realloc-flow__seg {
  transform: scaleY(1);
  opacity: 0.95;
  transition-delay: calc(var(--i, 0) * 40ms);
}

.realloc-flow__wallet-body {
  position: relative;
  z-index: 2;
  align-self: center;
  justify-self: center;
  width: 100%;
  padding: 14px 11px 12px;
  border-radius: 10px;
  background:
    linear-gradient(
      145deg,
      var(--card-face-hi) 0%,
      var(--card-face) 48%,
      var(--card-face-lo) 100%
    );
  border: 1px solid color-mix(in srgb, var(--card-edge) 45%, #fff);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 80%, transparent),
    0 1px 2px color-mix(in srgb, #0f172a 5%, transparent);
  overflow: hidden;
  aspect-ratio: 1.58 / 1;
  min-height: 78px;
  max-height: var(--card-max-h);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.realloc-flow__wallet-sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    transparent 0%,
    color-mix(in srgb, #fff 50%, transparent) 36%,
    transparent 58%,
    transparent 100%
  );
  opacity: 0.75;
}

.realloc-flow__wallet-chip {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 20px;
  height: 15px;
  border-radius: 3px;
  background:
    linear-gradient(
      90deg,
      transparent 22%,
      color-mix(in srgb, #000 16%, transparent) 22% 26%,
      transparent 26% 48%,
      color-mix(in srgb, #000 16%, transparent) 48% 52%,
      transparent 52% 74%,
      color-mix(in srgb, #000 16%, transparent) 74% 78%,
      transparent 78%
    ),
    linear-gradient(
      180deg,
      transparent 28%,
      color-mix(in srgb, #000 16%, transparent) 28% 34%,
      transparent 34% 62%,
      color-mix(in srgb, #000 16%, transparent) 62% 68%,
      transparent 68%
    ),
    linear-gradient(
      145deg,
      #f2f4f7 0%,
      var(--card-chip) 40%,
      #8b93a0 72%,
      #dfe3e8 100%
    );
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 55%, transparent),
    0 1px 1px color-mix(in srgb, #000 22%, transparent);
}

.realloc-flow__wallet-stripe {
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  height: 18px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, #4b5563 32%, transparent),
    color-mix(in srgb, #6b7280 40%, transparent) 42%,
    color-mix(in srgb, #4b5563 28%, transparent)
  );
  opacity: 0.4;
}

.realloc-flow__wallet-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.realloc-flow__wallet .realloc-flow__pool-label {
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--card-mute);
}

.realloc-flow__wallet .realloc-flow__pool-value {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  background: linear-gradient(180deg, #4b5563 0%, var(--card-ink) 55%, #111827 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.realloc-flow--anim .realloc-flow__pool:not(.is-revealed) {
  opacity: 0.35;
  transform: scale(0.96);
}

.realloc-flow__pool.is-revealed {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.4s ease,
    transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.realloc-flow__pool.is-pulse .realloc-flow__wallet-body,
.realloc-flow__pool.is-charged .realloc-flow__wallet-body {
  border-color: color-mix(in srgb, var(--pool-accent) 18%, var(--card-edge));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 80%, transparent),
    0 1px 3px color-mix(in srgb, #0f172a 6%, transparent);
}

.realloc-flow--anim[data-stage="cuts"] .realloc-flow__col--boosts {
  opacity: 0.28;
}

.realloc-flow--anim[data-stage="pool"] .realloc-flow__col--boosts {
  opacity: 0.4;
}

.realloc-flow--anim[data-stage="boosts"] .realloc-flow__col--cuts,
.realloc-flow--anim[data-stage="done"] .realloc-flow__col--cuts,
.realloc-flow--anim[data-stage="boosts"] .realloc-flow__col--boosts,
.realloc-flow--anim[data-stage="done"] .realloc-flow__col--boosts {
  opacity: 1;
  transition: opacity 0.45s ease;
}

@keyframes realloc-fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes realloc-arrow-in {
  to { opacity: 0.55; }
}

@keyframes realloc-arrow-sweep {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(120%); }
}

.realloc-flow--anim.is-inview .realloc-flow__hero-item--moved {
  animation: realloc-fade-up 0.4s ease 0.05s both;
}

.realloc-flow--anim.is-inview .realloc-flow__hero-arrow {
  animation: realloc-arrow-in 0.35s ease 0.12s both;
}

.realloc-flow--anim.is-inview .realloc-flow__hero-arrow::before {
  animation: realloc-arrow-sweep 1.35s ease-in-out 0.4s 2;
}

.realloc-flow--anim.is-inview .realloc-flow__hero-item--unlocked {
  opacity: 0.35;
  transform: none;
}

.realloc-flow--anim[data-stage="boosts"] .realloc-flow__hero-item--unlocked,
.realloc-flow--anim[data-stage="done"] .realloc-flow__hero-item--unlocked,
.realloc-flow--anim.is-complete .realloc-flow__hero-item--unlocked {
  animation: realloc-fade-up 0.45s ease both;
  opacity: 1;
}

.realloc-flow--anim.is-inview .realloc-flow__col--cuts .realloc-flow__col-head {
  animation: realloc-fade-up 0.35s ease 0.12s both;
}

.realloc-flow--anim[data-stage="cuts"] .realloc-flow__col--boosts .realloc-flow__col-head,
.realloc-flow--anim[data-stage="pool"] .realloc-flow__col--boosts .realloc-flow__col-head {
  opacity: 0.45;
}

.realloc-flow--anim[data-stage="boosts"] .realloc-flow__col--boosts .realloc-flow__col-head,
.realloc-flow--anim[data-stage="done"] .realloc-flow__col--boosts .realloc-flow__col-head {
  animation: realloc-fade-up 0.4s ease both;
  opacity: 1;
}

@media (max-width: 992px) {
  .realloc-flow__body {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .realloc-flow__wires,
  .realloc-flow__bridge::before {
    display: none;
  }
  .realloc-flow__pool.realloc-flow__wallet {
    min-height: 0;
    height: auto;
    max-height: none;
  }
  .realloc-flow__wallet-body {
    max-height: var(--card-max-h, 110px);
  }
  .realloc-flow__rail {
    height: calc(var(--card-max-h, 110px) + var(--rail-extra, 24px));
  }
  .realloc-flow__col-list {
    max-height: none;
  }
  .realloc-flow__hero {
    grid-template-columns: 1fr;
  }
  .realloc-flow__hero-arrow {
    width: 1px;
    height: 22px;
    margin: 0 auto;
  }
  .realloc-flow__hero-arrow::after {
    right: 50%;
    top: auto;
    bottom: 0;
    width: 5px;
    height: 5px;
    border-right: 1px solid var(--realloc-muted);
    border-top: 1px solid var(--realloc-muted);
    transform: translate(50%, 0) rotate(135deg);
  }
  .realloc-flow__hero-item:last-child,
  .realloc-flow__hero-item--unlocked {
    text-align: left;
  }
  .realloc-flow__col--cuts .realloc-flow__meta,
  .realloc-flow__col--cuts .realloc-flow__name {
    flex-direction: row;
  }
  .realloc-flow__col--cuts .realloc-flow__figures {
    text-align: right;
    align-items: flex-end;
  }
  .realloc-flow--anim .realloc-flow__row--cut:not(.is-revealed),
  .realloc-flow--anim .realloc-flow__row--boost:not(.is-revealed) {
    transform: translateY(8px);
  }
  .realloc-flow__row--cut .realloc-flow__fill {
    margin-left: 0;
    transform-origin: left center;
  }
  .realloc-flow--anim[data-stage="cuts"] .realloc-flow__col--boosts,
  .realloc-flow--anim[data-stage="pool"] .realloc-flow__col--boosts {
    opacity: 1;
  }
}

.dark-mode .realloc-flow {
  --realloc-ink: var(--rt-color, #e5e7eb);
  --realloc-muted: #9ca3af;
  --realloc-line: var(--rt-border-color, #374151);
  --realloc-surface: color-mix(in srgb, var(--rt-bg-color, #111827) 88%, #1f2937);
}

.dark-mode .realloc-flow__track {
  background: rgba(255, 255, 255, 0.1);
}

.dark-mode .realloc-flow__pool.realloc-flow__wallet {
  --card-face: #dce1e8;
  --card-face-hi: #f8f9fb;
  --card-face-lo: #c4CAD3;
  --card-edge: #a8b0bc;
  --card-rim: #ffffff;
  --card-chip: #d8dde5;
  --card-mute: #6b7280;
  --card-ink: #1f2937;
  --pool-accent: #2dd4bf;
}

.dark-mode .realloc-flow__wallet-body {
  border-color: color-mix(in srgb, var(--card-edge) 40%, #fff);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 70%, transparent),
    0 1px 2px color-mix(in srgb, #000 12%, transparent);
}

.dark-mode .realloc-flow__pool.is-charged .realloc-flow__wallet-body,
.dark-mode .realloc-flow__pool.is-pulse .realloc-flow__wallet-body {
  border-color: color-mix(in srgb, var(--pool-accent) 22%, var(--card-edge));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 70%, transparent),
    0 1px 3px color-mix(in srgb, #000 14%, transparent);
}

.dark-mode .realloc-flow__wire-base.is-visible {
  opacity: 0.22;
}

.dark-mode .realloc-flow__wire {
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.35));
}

.dark-mode .realloc-flow__hero-value {
  color: var(--realloc-ink);
}

.dark-mode .realloc-flow__col-head {
  border-bottom-color: color-mix(in srgb, var(--realloc-line) 70%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .realloc-flow .realloc-flow__hero-item,
  .realloc-flow .realloc-flow__hero-arrow,
  .realloc-flow .realloc-flow__hero-arrow::before,
  .realloc-flow .realloc-flow__col-head,
  .realloc-flow .realloc-flow__row,
  .realloc-flow .realloc-flow__fill,
  .realloc-flow .realloc-flow__dot,
  .realloc-flow .realloc-flow__pool,
  .realloc-flow .realloc-flow__seg {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .realloc-flow .realloc-flow__wire.is-flowing {
    animation: none !important;
  }
  .realloc-flow .realloc-flow__fill {
    width: var(--w) !important;
  }
  .realloc-flow--anim[data-stage] .realloc-flow__col--boosts,
  .realloc-flow--anim[data-stage] .realloc-flow__col--cuts {
    opacity: 1 !important;
  }
}


/* --- Optimize Results: compact KPI banner --- */
.opt-results-banner {
  margin: 8px 0 14px;
  padding: 12px 16px;
  background: var(--rt-bg-color);
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-sm);
}

.opt-results-banner__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--rt-border-color) 85%, transparent);
}

.opt-results-banner__period {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--rt-color);
  font-weight: 600;
}

.opt-results-banner__period-label {
  color: #6b7280;
  font-weight: 500;
}

.opt-results-banner__period-value {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--rt-color, #171717) 8%, transparent);
  color: var(--rt-color, #171717);
  font-weight: 600;
  font-size: 0.82rem;
}

.opt-results-banner__baseline {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.8rem;
  color: #6b7280;
}

.opt-results-banner__legend {
  color: #9ca3af;
}

.opt-results-banner__kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 20px;
}

.opt-results-kpi {
  min-width: 0;
  padding: 0 8px;
}

.opt-results-kpi + .opt-results-kpi {
  border-left: 1px solid color-mix(in srgb, var(--rt-border-color) 85%, transparent);
}

.opt-results-kpi__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 4px;
}

.opt-results-kpi__compare {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.opt-results-kpi__ref {
  font-size: 0.95rem;
  font-weight: 600;
  color: #6b7280;
}

.opt-results-kpi__arrow {
  color: #9ca3af;
  font-size: 0.9rem;
}

.opt-results-kpi__opt {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--rt-color);
}

.opt-results-kpi__delta {
  margin-top: 3px;
  font-size: 0.84rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.opt-results-kpi__delta.is-up { color: #0f766e; }
.opt-results-kpi__delta.is-down { color: #b42318; }

@media (max-width: 900px) {
  .opt-results-banner__kpis {
    grid-template-columns: 1fr;
  }
  .opt-results-kpi + .opt-results-kpi {
    border-left: 0;
    border-top: 1px solid color-mix(in srgb, var(--rt-border-color) 85%, transparent);
    padding-top: 10px;
    margin-top: 4px;
  }
}

/* --- Optimize Builder --- */
.opt-builder-bounds-defaults {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 12px;
  padding: 0 0 10px 0;
  border: none;
  border-bottom: 1px solid var(--rt-border-color);
  border-radius: 0;
  background: transparent;
}

.opt-builder-bounds-defaults__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--rt-color);
  margin-right: 4px;
}

.opt-builder-bounds-defaults__field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.opt-builder-bounds-defaults__field .form-group {
  margin-bottom: 0 !important;
}

.opt-builder-bounds-defaults__field input[type="number"] {
  height: 30px;
  padding: 2px 6px;
  font-size: 13px;
  text-align: center;
  width: 72px !important;
}

.opt-builder-bounds-defaults__prefix {
  font-weight: 700;
  color: #6b7280;
  min-width: 12px;
  text-align: center;
}

.opt-builder-bounds-defaults__help {
  margin: 0;
  flex: 1 1 160px;
}

.opt-builder-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.opt-builder-row > .opt-builder-field {
  flex: 1;
  min-width: 220px;
}

.opt-builder-row--constraints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.opt-builder-field {
  margin-bottom: 0;
}

.opt-builder-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--rt-color, #1f2937);
  margin: 0 0 6px 0;
}

.opt-builder-label-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px 0;
}

.opt-builder-label-row .opt-builder-label {
  margin: 0;
}

.opt-help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.opt-help-tip__icon {
  color: #6c757d;
  cursor: help;
  font-size: 0.95rem;
  line-height: 1;
}

.opt-help-tip__bubble {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  transform: none;
  z-index: 1200;
  width: min(380px, 70vw);
  padding: 10px 12px;
  border: 1px solid #d8dee6;
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
  color: #334155;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
}

.opt-help-tip__bubble::before {
  content: "";
  position: absolute;
  left: 10px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-left: 1px solid #d8dee6;
  border-top: 1px solid #d8dee6;
  border-bottom: 0;
  background: #fff;
  transform: rotate(45deg);
}

.opt-help-tip:hover .opt-help-tip__bubble,
.opt-help-tip:focus-within .opt-help-tip__bubble {
  display: block;
}

.opt-help-tip__bubble p {
  margin: 0 0 8px;
}

.opt-help-tip__bubble ul {
  margin: 0;
  padding-left: 1.1rem;
}

.opt-help-tip__bubble li + li {
  margin-top: 6px;
}

.dark-mode .opt-help-tip__bubble,
[data-bs-theme="dark"] .opt-help-tip__bubble {
  background: #1f2937;
  border-color: #4b5563;
  color: #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.dark-mode .opt-help-tip__bubble::before,
[data-bs-theme="dark"] .opt-help-tip__bubble::before {
  background: #1f2937;
  border-left-color: #4b5563;
  border-top-color: #4b5563;
}

.opt-builder-help {
  display: block;
  margin-top: 4px;
  color: #999;
  font-size: 11px;
  line-height: 1.3;
}

.opt-builder-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--rt-border-color, #e5e7eb) 80%, transparent);
}

.opt-builder-section--last {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.opt-builder-section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 12px;
}

.opt-builder-section__kicker {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--rt-color, #1f2937);
}

.opt-builder-section__hint {
  font-size: 0.8rem;
  color: #6b7280;
}

.opt-builder-exceptions {
  margin-top: 4px;
}

.opt-builder-exceptions__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.opt-builder-add-btn {
  padding: 4px 10px !important;
  font-size: 12px !important;
  border-radius: var(--radius-sm) !important;
  background: transparent !important;
  border: 1px solid var(--rt-border-color) !important;
  color: var(--rt-color) !important;
}

.opt-builder-exceptions__body {
  max-height: none;
  overflow: visible;
}

.opt-builder-exceptions__empty {
  padding: 6px 0 2px;
  color: #6b7280;
  font-size: 0.82rem;
  font-style: italic;
}

.opt-builder-exceptions-table {
  border: 1px solid var(--rt-border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.opt-builder-exceptions-table__head,
.opt-builder-exception-row {
  display: grid;
  grid-template-columns: minmax(120px, 1.6fr) 72px 72px 36px;
  gap: 8px;
  align-items: center;
}

.opt-builder-exceptions-table__head {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #6c757d;
  background: color-mix(in srgb, var(--rt-border-color) 35%, transparent);
  border-bottom: 1px solid var(--rt-border-color);
}

.opt-builder-exceptions-table__head > span:nth-child(2),
.opt-builder-exceptions-table__head > span:nth-child(3) {
  text-align: center;
}

.opt-builder-exceptions-table__body {
  max-height: 168px; /* ~4 compact rows */
  overflow-y: auto;
}

.opt-builder-exception-row {
  padding: 4px 10px;
  border-bottom: 1px solid var(--rt-border-color);
  margin: 0;
  background: transparent;
}

.opt-builder-exception-row:last-child {
  border-bottom: none;
}

.opt-builder-exception-row .form-group {
  margin-bottom: 0 !important;
}

.opt-builder-exception-row .form-control,
.opt-builder-exception-row select {
  height: 30px;
  padding: 2px 6px;
  font-size: 13px;
}

.opt-builder-exception-row input[type="number"] {
  text-align: center;
}

.opt-builder-exception-row__remove {
  width: 30px;
  height: 30px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm) !important;
}

/* Optimization type: only .active is filled */
.opt-builder-type-toggle .btn-group-container-sw,
.opt-builder-type-toggle .btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.opt-builder-type-toggle .radiobtn {
  border-radius: var(--radius-sm) !important;
  margin: 0 !important;
  padding: 7px 14px !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  background: transparent !important;
  border: 1px solid var(--rt-border-color) !important;
  color: var(--rt-color) !important;
  box-shadow: none !important;
}

.opt-builder-type-toggle .radiobtn:hover {
  border-color: #007bff !important;
  color: #007bff !important;
}

.opt-builder-type-toggle .radiobtn.active {
  background: #007bff !important;
  border-color: #007bff !important;
  color: #fff !important;
}

.ref-alloc-builder__action-btn--active {
  background: rgba(0, 123, 255, 0.1) !important;
  border-color: #007bff !important;
  color: #007bff !important;
  font-weight: 600 !important;
}

@media (max-width: 900px) {
  .opt-builder-row--constraints {
    grid-template-columns: 1fr;
  }

  .opt-builder-exceptions-table__head,
  .opt-builder-exception-row {
    grid-template-columns: 1fr 64px 64px 36px;
  }
}

/* Equal-height Results panels: money-flow (left, wider) + table (right) */
.realloc-split {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 0.78fr);
  gap: 15px;
  align-items: stretch;
  margin-top: 15px;
  margin-bottom: 20px;
}

.realloc-split__panel {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: 15px;
  background-color: var(--rt-bg-color);
  border: 1px solid var(--rt-border-color);
  border-radius: 5px;
}

.realloc-split__subtitle {
  color: #666;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.realloc-split__body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.realloc-split__body > .reactable,
.realloc-split__body > .shiny-html-output,
.realloc-split__body > .realloc-flow {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.realloc-split__body .reactable {
  height: 100% !important;
}

.realloc-split__body .realloc-flow {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: visible;
}

.realloc-split__body .realloc-flow__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
}

.realloc-split__body > .shiny-html-output {
  overflow: visible;
}

@media (max-width: 992px) {
  .realloc-split {
    grid-template-columns: 1fr;
  }
  .realloc-split__panel {
    min-height: 0;
  }
}

/* ---------------------------------------------------------------------------
   Fivetran connector picker (project datasources modal)
--------------------------------------------------------------------------- */
.fivetran-connect {
  max-width: 720px;
  margin: 0 auto;
}

.fivetran-connect__lede {
  margin: 0 0 14px;
  color: #6c757d;
  font-size: 13px;
  line-height: 1.45;
}

.fivetran-connect__label {
  font-weight: 600 !important;
  margin-bottom: 6px;
}

.fivetran-connect__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.fivetran-connect__fields--file {
  grid-template-columns: 1fr 1fr;
}

.fivetran-connect__field--full {
  grid-column: 1 / -1;
}

.fivetran-connect__field .form-group,
.fivetran-connect__field .shiny-input-container {
  margin-bottom: 0;
}

.fivetran-connect__field .form-group.shiny-input-container:has(input[type="file"]) {
  margin-bottom: 0;
}

.fivetran-connect__actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.fivetran-connect__hint {
  font-size: 12px;
}

.fivetran-auth-step {
  margin-top: 4px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.fivetran-auth-step__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.fivetran-auth-step__icon {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.fivetran-auth-step__eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
  line-height: 1.2;
}

.fivetran-auth-step__title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
}

.fivetran-auth-step__heading {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
}

.fivetran-auth-step__actions {
  margin-top: 16px;
}

.dark-mode .fivetran-auth-step {
  background: #2b3035;
  border-color: #495057;
}

.dark-mode .fivetran-auth-step__eyebrow {
  color: #adb5bd;
}

.dark-mode .fivetran-auth-step__title,
.dark-mode .fivetran-auth-step__heading {
  color: #f8f9fa;
}

.datasource-delete-confirm {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid #f0c36d;
  border-radius: var(--radius-sm);
  background: #fffbeb;
  flex-wrap: wrap;
}

.datasource-delete-confirm__copy {
  min-width: 0;
  flex: 1 1 240px;
}

.datasource-delete-confirm__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #78350f;
}

.datasource-delete-confirm__text strong {
  font-weight: 600;
  color: #7c2d12;
}

.datasource-delete-confirm__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.datasource-delete-confirm__actions .btn-danger {
  background: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.datasource-delete-confirm__actions .btn-danger:hover,
.datasource-delete-confirm__actions .btn-danger:focus {
  background: #c82333;
  border-color: #bd2130;
  color: #fff;
}

.dark-mode .datasource-delete-confirm {
  background: rgba(240, 195, 109, 0.12);
  border-color: #92680a;
}

.dark-mode .datasource-delete-confirm__text {
  color: #fde68a;
}

.dark-mode .datasource-delete-confirm__text strong {
  color: #fef3c7;
}

.datasource-update-panel {
  margin: 0 0 16px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.datasource-update-panel__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #eef2f7;
}

.datasource-update-panel__head-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  background: #fff7ed;
  color: var(--accent);
  font-size: 15px;
}

.datasource-update-panel__head-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.datasource-update-panel__head-copy strong {
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.datasource-update-panel__head-copy span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.datasource-update-panel__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.datasource-update-panel__field--full {
  grid-column: 1 / -1;
}

.datasource-update-panel__field .control-label {
  display: block;
  color: #334155;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 6px;
}

.datasource-update-panel__field .form-group,
.datasource-update-panel__field .shiny-input-container {
  width: 100%;
  margin-bottom: 0;
}

.datasource-update-panel__field .bootstrap-select,
.datasource-update-panel__field .bootstrap-select > .dropdown-toggle {
  width: 100% !important;
}

.datasource-update-panel__hint {
  display: block;
  margin-top: 5px;
  color: #8491a3;
  font-size: 11px;
  line-height: 1.35;
}

.datasource-update-panel__summary {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 18px 16px;
  padding: 11px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.45;
}

.datasource-update-panel__summary--ok {
  background: #eff6ff;
  border-color: #dbeafe;
  color: #1e40af;
}

.datasource-update-panel__summary--warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

.datasource-update-panel__summary--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.datasource-update-panel__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 13px 18px;
  border-top: 1px solid #eef2f7;
  background: #fbfcfd;
}

.dark-mode .datasource-update-panel {
  border-color: #3f4852;
  background: #252a2f;
  box-shadow: none;
}

.dark-mode .datasource-update-panel__head,
.dark-mode .datasource-update-panel__actions {
  border-color: #3f4852;
}

.dark-mode .datasource-update-panel__actions {
  background: #22272b;
}

.dark-mode .datasource-update-panel__head-icon {
  border-color: rgba(251, 146, 60, 0.28);
  background: var(--accent-soft);
  color: var(--accent-on-dark);
}

.dark-mode .datasource-update-panel__head-copy strong,
.dark-mode .datasource-update-panel__field .control-label {
  color: #f1f5f9;
}

.dark-mode .datasource-update-panel__head-copy span,
.dark-mode .datasource-update-panel__hint {
  color: #94a3b8;
}

.dark-mode .datasource-update-panel__summary--ok {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.26);
  color: #bfdbfe;
}

.dark-mode .datasource-update-panel__summary--warn {
  background: rgba(240, 195, 109, 0.12);
  border-color: rgba(253, 230, 138, 0.24);
  color: #fde68a;
}

.dark-mode .datasource-update-panel__summary--error {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(252, 165, 165, 0.24);
  color: #fecaca;
}

@media (max-width: 768px) {
  .datasource-update-panel__grid {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .datasource-update-panel__field--full {
    grid-column: auto;
  }

  .datasource-update-panel__summary {
    margin-right: 16px;
    margin-left: 16px;
  }
}

.connector-picker {
  margin: 0 0 4px;
}

.connector-picker__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.connector-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.connector-filter {
  appearance: none;
  border: 1px solid #d8dee6;
  background: #fff;
  color: #495057;
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
}

.connector-filter:hover {
  border-color: #93c5fd;
  color: #1e40af;
}

.connector-filter.is-active {
  background: #1e3a5f;
  border-color: #1e3a5f;
  color: #fff;
}

.connector-search {
  margin: 0;
  min-width: 160px;
  flex: 0 1 200px;
}

.connector-search__input {
  border-radius: var(--radius-md);
}

.connector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 2px;
}

.connector-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 76px;
  padding: 10px 6px;
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  background: #fff;
  color: #1f2937;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
  text-align: center;
}

.connector-tile:hover {
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.connector-tile.is-selected {
  border-color: #1e3a5f;
  background: #f1f5f9;
  box-shadow: 0 0 0 1px #1e3a5f inset;
}

.connector-tile__logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connector-tile__logo img {
  max-width: 28px;
  max-height: 28px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.connector-tile__label {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  color: inherit;
}

.connector-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border-top: 1px solid #e9ecef;
}

.connector-selected__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.connector-selected__eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6c757d;
  line-height: 1.2;
}

.connector-selected__name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dark-mode .fivetran-connect__lede,
.dark-mode .connector-selected__eyebrow {
  color: #adb5bd;
}

.dark-mode .connector-filter {
  background: #2b3035;
  border-color: #495057;
  color: #ced4da;
}

.dark-mode .connector-filter.is-active {
  background: #93c5fd;
  border-color: #93c5fd;
  color: #0b1220;
}

.dark-mode .connector-tile {
  background: #2b3035;
  border-color: #495057;
  color: #e9ecef;
}

.dark-mode .connector-tile.is-selected {
  background: rgba(147, 197, 253, 0.12);
  border-color: #93c5fd;
  box-shadow: 0 0 0 1px #93c5fd inset;
}

.dark-mode .connector-selected {
  border-top-color: #495057;
}

.dark-mode .connector-selected__name {
  color: #f8f9fa;
}

.connector-empty {
  padding: 18px 4px;
  text-align: center;
  font-size: 13px;
  color: #6c757d;
}

@media (max-width: 640px) {
  .fivetran-connect__fields {
    grid-template-columns: 1fr;
  }

  .connector-grid {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    max-height: 240px;
  }
}

/* ---------------------------------------------------------------------------
   Project data sources modal
--------------------------------------------------------------------------- */
.ds-modal {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 12px 16px 8px;
}

.ds-modal .fivetran-connect {
  max-width: none;
}

.ds-modal__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.ds-modal__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.ds-modal__project {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  overflow: hidden;
}

.ds-modal__project > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-modal__project .fa,
.ds-modal__project svg {
  font-size: 11px;
  opacity: 0.7;
}

.ds-modal__panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ds-modal__panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.ds-modal__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: #eef2f7;
  color: #475569;
  font-size: 11px;
  font-weight: 600;
}

/* Views ------------------------------------------------------------------ */
.ds-view__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.ds-back {
  margin: 0 0 10px !important;
}

.ds-view__footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ds-view__footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.ds-view__freshness {
  font-size: 12px;
  color: #6c757d;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dark-mode .ds-view__freshness {
  color: #adb5bd;
}

.ds-view--list .Reactable {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.ds-view--add .connector-grid {
  max-height: 220px;
}

.ds-view--add .fivetran-connect__fields {
  margin-top: 14px;
}

/* Status badges ---------------------------------------------------------- */
.ds-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}

.ds-badge--on {
  background: #dcfce7;
  color: #166534;
}

.ds-badge--off {
  background: #f1f5f9;
  color: #64748b;
}

.ds-badge--ready {
  background: #e0f2fe;
  color: #075985;
}

/* Row actions ------------------------------------------------------------ */
.ds-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.ds-actions .btn:disabled {
  opacity: 1;
}

/* Dark mode -------------------------------------------------------------- */
.dark-mode .ds-modal__header,
.dark-mode .ds-view__footer {
  border-color: #495057;
}

.dark-mode .ds-modal__title,
.dark-mode .ds-modal__panel-title,
.dark-mode .ds-view__title {
  color: #f8f9fa;
}

.dark-mode .ds-modal__project {
  background: #2b3035;
  border-color: #495057;
  color: #ced4da;
}

.dark-mode .ds-modal__subtitle,
.dark-mode .connector-empty {
  color: #adb5bd;
}

.dark-mode .ds-modal__count {
  background: #2b3035;
  color: #ced4da;
}

.dark-mode .ds-view--list .Reactable {
  border-color: #495057;
}

.dark-mode .ds-badge--on {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.dark-mode .ds-badge--off {
  background: #2b3035;
  color: #adb5bd;
}

.dark-mode .ds-badge--ready {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

/* Share project modal (aligned with ds-modal) */
.share-invite {
  margin-bottom: 14px;
}

.share-invite-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px 12px;
  align-items: start;
}

.share-field label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

.share-field .form-control,
.share-field .bootstrap-select > .dropdown-toggle {
  border-color: #e2e8f0;
  box-shadow: none;
  border-radius: var(--radius-md);
  min-height: 38px;
}

.share-field .form-control:focus,
.share-field .bootstrap-select > .dropdown-toggle:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.25);
}

.share-user-status,
.share-role-hint {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: #6c757d;
}

.share-user-status.is-found {
  color: #334155;
}

.share-user-status.is-missing {
  color: #b91c1c;
}

.share-invite-footer {
  margin-top: 10px;
  padding-top: 10px;
}

.share-modal .share-members-table {
  width: 100% !important;
}

.share-modal .dataTables_wrapper {
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.share-modal .share-members-table thead th {
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb !important;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 8px 12px !important;
}

.share-modal .share-members-table tbody td {
  border-top: 1px solid #f1f5f9 !important;
  padding: 10px 12px !important;
  font-size: 13px;
  color: #111827;
  vertical-align: middle;
}

.share-member-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.share-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid #e2e8f0;
}

.share-member-avatar--letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: none;
}

.share-member-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.share-member-name {
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-member-email {
  font-size: 11px;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-modal .share-revoke-btn {
  color: #b91c1c;
  font-weight: 500;
  padding: 0;
  text-decoration: none;
}

.share-modal .share-revoke-btn:hover:not(:disabled) {
  color: #991b1b;
  text-decoration: underline;
}

.share-modal .share-revoke-btn:disabled {
  color: #94a3b8;
  opacity: 1;
  text-decoration: none;
  cursor: default;
}

@media (max-width: 900px) {
  .share-invite-row {
    grid-template-columns: 1fr;
  }
}

.dark-mode .share-field label,
.dark-mode .share-role-hint,
.dark-mode .share-user-status,
.dark-mode .share-member-email {
  color: #adb5bd;
}

.dark-mode .share-user-status.is-found,
.dark-mode .share-member-name {
  color: #e9ecef;
}

.dark-mode .share-modal .dataTables_wrapper {
  border-color: #495057;
}

.dark-mode .share-modal .share-members-table thead th {
  background: #2b3035;
  border-bottom-color: #495057 !important;
  color: #adb5bd;
}

.dark-mode .share-modal .share-members-table tbody td {
  border-top-color: #495057 !important;
  color: #e9ecef;
}

.dark-mode .share-member-avatar {
  border-color: #495057;
}

.dark-mode .share-invite-footer {
  border-top-color: #495057;
}

/* Optimize scenario registry — compact, readable table */
.opt-scenario-registry {
  font-size: 0.875rem;
  border: 1px solid var(--rt-border-color, #e9ecef) !important;
  border-radius: 10px;
  overflow: visible;
  width: 100%;
}

.opt-scenario-registry .rt-table-wrapper,
.opt-scenario-registry .rt-table,
.opt-scenario-registry .Reactable {
  width: 100% !important;
  border-radius: 10px;
}

.opt-scenario-registry .rt-thead {
  position: sticky;
  top: 0;
  z-index: 5;
}

.opt-scenario-registry .rt-th {
  white-space: nowrap;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

.opt-scenario-registry .rt-td {
  vertical-align: middle !important;
  padding-left: 8px !important;
  padding-right: 8px !important;
}

.opt-scenario-registry .rt-tbody .rt-tr:hover .rt-td {
  background: #f5f8fc;
}

.opt-reg-empty {
  color: #adb5bd;
}

.opt-reg-name-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  max-width: 100%;
}

.opt-reg-name {
  font-weight: 600;
  color: var(--rt-color, #212529);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  line-height: 1.2;
}

.opt-reg-name__meta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  line-height: 1.2;
}

.opt-reg-name__by,
.opt-reg-name__date {
  font-size: 0.75rem;
  font-weight: 500;
  color: #6c757d;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-reg-name__sep {
  color: #adb5bd;
  font-size: 0.75rem;
  flex: 0 0 auto;
}

.opt-reg-avatar--sm {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  font-size: 0.58rem;
}

/* Status: colored dots (compact / responsive) */
.opt-reg-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
}

.opt-reg-status__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 10px;
}

.opt-reg-status__label {
  text-transform: capitalize;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-reg-type {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.opt-reg-type__badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 1px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #eef2f7;
  color: #495057;
}

.opt-reg-type__value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opt-reg-period {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: #495057;
  font-size: 0.78rem;
}

.opt-reg-period__start,
.opt-reg-period__end {
  white-space: nowrap;
}

.opt-reg-period__end {
  color: #6c757d;
}

.opt-reg-date {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: #495057;
  font-size: 0.82rem;
}

.opt-reg-metric {
  line-height: 1.15;
  text-align: right;
}

.opt-reg-metric__value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.opt-reg-metric__delta {
  font-size: 0.7rem;
  color: #6c757d;
  font-variant-numeric: tabular-nums;
}

.opt-reg-metric__delta--up {
  color: #198754;
}

.opt-reg-metric__delta--down {
  color: #dc3545;
}

.opt-reg-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.opt-reg-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 22px;
}

.opt-reg-avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #6c757d;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
}

.opt-reg-person__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.82rem;
  color: #343a40;
}

.opt-reg-actions-cell {
  background: var(--rt-bg-color, #fff) !important;
  box-shadow: -8px 0 12px -12px rgba(0, 0, 0, 0.22);
}

.opt-scenario-registry .rt-td.opt-reg-actions-cell {
  position: sticky !important;
  right: 0 !important;
  z-index: 3 !important;
}

.opt-scenario-registry .rt-th.opt-reg-actions-cell {
  position: sticky !important;
  top: 0 !important;
  right: 0 !important;
  z-index: 7 !important;
  background: #f8f9fa !important;
}

.opt-reg-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.opt-reg-action {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--rt-border-color, #dee2e6);
  border-radius: var(--radius-md);
  background: transparent;
  color: #495057;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.opt-reg-action:hover:not(.is-disabled):not(:disabled) {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #212529;
}

.opt-reg-action--danger:hover:not(.is-disabled):not(:disabled) {
  background: #fff5f5;
  border-color: #f1aeb5;
  color: #b02a37;
}

.opt-reg-action.is-disabled,
.opt-reg-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .opt-scenario-registry .rt-table {
    min-width: 860px;
  }

  .model-runs-registry .rt-table {
    min-width: 0 !important;
  }
}

[data-bs-theme="dark"] .opt-scenario-registry,
.dark-mode .opt-scenario-registry {
  border-color: #343a40 !important;
}

[data-bs-theme="dark"] .opt-reg-name,
.dark-mode .opt-reg-name {
  color: #f8f9fa;
}

[data-bs-theme="dark"] .opt-reg-name__by,
[data-bs-theme="dark"] .opt-reg-name__date,
.dark-mode .opt-reg-name__by,
.dark-mode .opt-reg-name__date {
  color: #adb5bd;
}

[data-bs-theme="dark"] .opt-reg-type__badge,
.dark-mode .opt-reg-type__badge {
  background: #343a40;
  color: #ced4da;
}

[data-bs-theme="dark"] .opt-reg-period,
[data-bs-theme="dark"] .opt-reg-date,
[data-bs-theme="dark"] .opt-reg-person__name,
.dark-mode .opt-reg-period,
.dark-mode .opt-reg-date,
.dark-mode .opt-reg-person__name {
  color: #ced4da;
}

[data-bs-theme="dark"] .opt-reg-action,
.dark-mode .opt-reg-action {
  border-color: #495057;
  color: #adb5bd;
}

[data-bs-theme="dark"] .opt-reg-action:hover:not(.is-disabled):not(:disabled),
.dark-mode .opt-reg-action:hover:not(.is-disabled):not(:disabled) {
  background: #343a40;
  color: #f8f9fa;
}

[data-bs-theme="dark"] .opt-scenario-registry .rt-sticky,
[data-bs-theme="dark"] .opt-scenario-registry .opt-reg-actions-cell,
.dark-mode .opt-scenario-registry .rt-sticky,
.dark-mode .opt-scenario-registry .opt-reg-actions-cell {
  background-color: #000 !important;
}

[data-bs-theme="dark"] .opt-scenario-registry .rt-th.rt-sticky,
[data-bs-theme="dark"] .opt-scenario-registry .rt-th.opt-reg-actions-cell,
.dark-mode .opt-scenario-registry .rt-th.rt-sticky,
.dark-mode .opt-scenario-registry .rt-th.opt-reg-actions-cell {
  background-color: #1a1a1a !important;
}

[data-bs-theme="dark"] .opt-scenario-registry .rt-tbody .rt-tr:hover .rt-td,
[data-bs-theme="dark"] .opt-scenario-registry .rt-tbody .rt-tr:hover .rt-td.opt-reg-actions-cell,
.dark-mode .opt-scenario-registry .rt-tbody .rt-tr:hover .rt-td,
.dark-mode .opt-scenario-registry .rt-tbody .rt-tr:hover .rt-td.opt-reg-actions-cell {
  background-color: #141414 !important;
}

[data-bs-theme="dark"] .opt-reg-actions-cell,
.dark-mode .opt-reg-actions-cell {
  background: #000 !important;
  box-shadow: -8px 0 12px -12px rgba(0, 0, 0, 0.6);
}

/* Model runs nested panel (same registry language as Optimize) */
.model-runs-panel {
  padding: 4px 16px 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.model-runs-panel__title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6c757d;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.model-runs-registry,
.model-runs-registry.Reactable,
.model-runs-registry .rt-table,
.model-runs-registry .rt-table-wrapper {
  width: 100% !important;
  max-width: 100% !important;
}

/* Nested details row: use full parent width, no phantom side gutter */
.opt-scenario-registry .rt-tr-details > td,
.opt-scenario-registry .rt-details {
  width: 100%;
}

.model-runs-registry .rt-th,
.model-runs-registry .rt-td {
  box-sizing: border-box;
}

/* Don't leave a dead zone after Actions in the nested runs table */
.model-runs-registry .opt-reg-actions-cell {
  position: static !important;
  right: auto !important;
  box-shadow: none !important;
}

/* Model builder mapping fields — responsive equal columns */
.model-builder-card {
  margin-bottom: 25px;
  padding: 20px;
  border: 1px solid var(--rt-border-color, #dee2e6);
  border-radius: 5px;
  background-color: var(--rt-bg-color, #fff);
}

.model-builder-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  width: 100%;
}

.model-builder-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
  width: 100%;
}

.model-builder-field__head {
  display: block;
  margin: 0 0 8px;
  min-height: 3.6rem;
  font-weight: 500;
  color: var(--rt-color, #212529);
}

.model-builder-field__help {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  line-height: 1.35;
  font-weight: 400;
}

.model-builder-field__control {
  margin-top: auto;
  width: 100%;
}

.model-builder-field .form-group,
.model-builder-field .shiny-input-container {
  width: 100% !important;
  margin-bottom: 0;
}

.model-builder-field .bootstrap-select,
.model-builder-field .bootstrap-select > .dropdown-toggle,
.model-builder-field .btn-group-toggle,
.model-builder-field .btn-group {
  width: 100% !important;
  max-width: 100%;
}

.model-builder-field .btn-group > .btn {
  flex: 1 1 auto;
}

.channel-fields-row {
  margin-bottom: 15px;
}

@media (max-width: 1100px) {
  .model-builder-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .model-builder-card {
    padding: 14px;
  }

  .model-builder-fields {
    grid-template-columns: 1fr;
  }

  .model-builder-field__head {
    min-height: 0;
  }

  #model-step_content,
  [id$="-step_content"] {
    height: auto !important;
    max-height: 70vh;
  }
}

/* Lazy Model / Optimize registry skeleton -------------------------------- */
.cv2-lazy-module-host {
  position: relative;
  min-height: 480px;
}

.cv2-lazy-module-host.is-ready > .cv2-registry-skeleton {
  display: none;
}

.cv2-registry-skeleton {
  margin: 8px 10% 24px;
  padding: 8px 0 16px;
  background: transparent;
}

.cv2-skel-primary-action {
  margin: 8px 0 18px;
}

.cv2-skel-pill--primary {
  width: 128px;
  height: 34px;
  border-radius: var(--radius-sm);
}

.cv2-skel-table {
  border: 1px solid var(--rt-border-color, #e8ebf0);
  border-radius: var(--radius-md);
  background: var(--rt-bg-color, #fff);
  overflow: hidden;
}

.cv2-skel-table-head,
.cv2-skel-parent-row {
  display: grid;
  grid-template-columns: 28px minmax(140px, 1.4fr) minmax(120px, 1.2fr) 48px minmax(110px, 1fr) 100px 120px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.cv2-skel-table-head {
  border-bottom: 1px solid var(--rt-border-color, #eef1f5);
  background: rgba(148, 163, 184, 0.06);
}

.cv2-skel-model-block + .cv2-skel-model-block {
  border-top: 1px solid var(--rt-border-color, #eef1f5);
}

.cv2-skel-parent-row {
  min-height: 52px;
}

.cv2-skel-runs {
  margin: 0 12px 14px 28px;
  padding: 10px 12px 12px;
  border: 1px solid var(--rt-border-color, #eef1f5);
  border-radius: var(--radius-md);
  background: rgba(148, 163, 184, 0.04);
}

.cv2-skel-runs-title {
  margin-bottom: 10px;
}

.cv2-skel-runs-head,
.cv2-skel-run-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(90px, 0.8fr) 100px 90px minmax(160px, 1.4fr) 150px;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
}

.cv2-skel-runs-head {
  opacity: 0.85;
  border-bottom: 1px solid var(--rt-border-color, #e8ebf0);
  margin-bottom: 2px;
}

.cv2-skel-run-row + .cv2-skel-run-row {
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.cv2-skel-status,
.cv2-skel-quality,
.cv2-skel-actions,
.cv2-skel-stars {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cv2-skel-quality {
  flex-wrap: wrap;
}

.cv2-skel-actions {
  justify-content: flex-end;
  gap: 6px;
}

.cv2-skel-block {
  display: inline-block;
  flex: 0 0 auto;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.16) 0%,
    rgba(148, 163, 184, 0.30) 50%,
    rgba(148, 163, 184, 0.16) 100%
  );
  background-size: 200% 100%;
  animation: cv2-skel-shimmer 1.25s ease-in-out infinite;
}

.cv2-skel-pill {
  height: 11px;
  border-radius: var(--radius-pill);
}

.cv2-skel-pill--section { width: 92px; height: 9px; }
.cv2-skel-pill--col { width: 72px; height: 9px; }
.cv2-skel-pill--col-sm { width: 48px; height: 9px; }
.cv2-skel-pill--id { width: min(100%, 210px); height: 12px; }
.cv2-skel-pill--table { width: min(100%, 160px); height: 12px; }
.cv2-skel-pill--status { width: 78px; height: 11px; }
.cv2-skel-pill--date { width: 84px; height: 11px; }
.cv2-skel-pill--exec { width: 52px; height: 11px; }
.cv2-skel-pill--time { width: 48px; height: 11px; }
.cv2-skel-pill--metric { width: 78px; height: 9px; }
.cv2-skel-pill--metric-sm { width: 64px; height: 9px; }
.cv2-skel-pill--r2 { width: 56px; height: 9px; }

.cv2-skel-chevron {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.cv2-skel-chevron--ghost {
  opacity: 0;
}

.cv2-skel-compute {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  justify-self: start;
}

.cv2-skel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.cv2-skel-star {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.cv2-skel-action {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-sizing: border-box;
}

.cv2-skel-action--lg {
  width: 30px;
  height: 30px;
}

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

.dark-mode .cv2-skel-table,
[data-bs-theme="dark"] .cv2-skel-table {
  background: var(--rt-bg-color, #1f2937);
  border-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .cv2-skel-table-head,
[data-bs-theme="dark"] .cv2-skel-table-head {
  background: rgba(255, 255, 255, 0.03);
}

.dark-mode .cv2-skel-runs,
[data-bs-theme="dark"] .cv2-skel-runs {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.dark-mode .cv2-skel-block,
[data-bs-theme="dark"] .cv2-skel-block {
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.12) 0%,
    rgba(148, 163, 184, 0.24) 50%,
    rgba(148, 163, 184, 0.12) 100%
  );
  background-size: 200% 100%;
}

@media (max-width: 1100px) {
  .cv2-registry-skeleton {
    margin-left: 16px;
    margin-right: 16px;
  }

  .cv2-skel-table-head,
  .cv2-skel-parent-row {
    grid-template-columns: 24px 1.4fr 1.1fr 40px 1fr 90px;
  }

  .cv2-skel-table-head > :nth-child(7),
  .cv2-skel-parent-row > :nth-child(7) {
    display: none;
  }

  .cv2-skel-runs-head,
  .cv2-skel-run-row {
    grid-template-columns: 0.9fr 0.7fr 0.8fr 1.2fr;
  }

  .cv2-skel-runs-head > :nth-child(n+5),
  .cv2-skel-run-row > :nth-child(n+5) {
    display: none;
  }
}

