/* =========================================================================
   App — Landing + Workspace styles
   ========================================================================= */

/* Variables (mirrors colors_and_type.css plus app-specific extras) */
:root {
  --rail-w: 72px;
  --ribbon-h: 148px;
  --ribbon-h-compact: 112px;
  --params-w: 360px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg-1); overflow: hidden; }
body { font-family: var(--font-sans); color: var(--mps-ink); }
button { font-family: inherit; }

/* Hide bslib's default page padding when app screens are active */
body.app-fullbleed > .container-fluid,
body.app-fullbleed > div > .container-fluid { padding: 0 !important; }

/* ============ LANDING SCREEN ============ */
.app-landing {
  position: fixed; inset: 0;
  background: #2a7a82;
  color: #fff;
  display: flex; flex-direction: column;
  overflow-y: auto;            /* fallback so the stats bar is always reachable */
  z-index: 100;
}
.landing-traces {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 78% 88%, rgba(95,210,225,0.35) 0%, rgba(95,210,225,0) 45%),
    radial-gradient(ellipse at 18% 22%, rgba(120,200,210,0.18) 0%, rgba(120,200,210,0) 55%),
    radial-gradient(ellipse at 70% 40%, #5faeb7 0%, #3e8b94 55%, #1f4e56 100%);
  pointer-events: none;
}
.landing-pixels {
  position: absolute; right: 0; bottom: 0;
  width: 56%; height: 70%;
  pointer-events: none; z-index: 1;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(170,235,245,0.55) 0.9px, transparent 1.2px);
  background-size: 7px 7px;
  background-position: 0 0;
  -webkit-mask-image: radial-gradient(ellipse at 78% 88%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.85) 25%, rgba(0,0,0,0.35) 55%, rgba(0,0,0,0) 75%);
          mask-image: radial-gradient(ellipse at 78% 88%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.85) 25%, rgba(0,0,0,0.35) 55%, rgba(0,0,0,0) 75%);
  mix-blend-mode: screen;
  opacity: 0.9;
}
.landing-pixels::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 1.5px 1.5px, rgba(180,245,255,0.9) 1.4px, transparent 1.8px);
  background-size: 14px 14px;
  background-position: 3px 3px;
  -webkit-mask-image: radial-gradient(ellipse at 70% 95%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 60%);
          mask-image: radial-gradient(ellipse at 70% 95%, rgba(0,0,0,1) 0%, rgba(0,0,0,0.6) 30%, rgba(0,0,0,0) 60%);
  mix-blend-mode: screen;
}
.landing-scan {
  position: absolute; right: 0; bottom: 0;
  width: 56%; height: 70%; pointer-events: none; z-index: 1;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 4px);
  -webkit-mask-image: radial-gradient(ellipse at 80% 90%, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 65%);
          mask-image: radial-gradient(ellipse at 80% 90%, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0) 65%);
}

.landing-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 28px 48px;
}
.brand-mark { display: flex; align-items: center; gap: 14px; }
.brand-mark img { height: 56px; width: auto; display: block; filter: drop-shadow(0 2px 8px rgba(0,0,0,.18)); }
.brand-wordmark {
  font-size: 24px; color: #fff; letter-spacing: -0.01em; line-height: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.brand-wordmark b    { font-weight: var(--fw-bold); }
.brand-wordmark span { font-weight: var(--fw-light); opacity: 0.92; }
.landing-eyebrow {
  font-size: 12px; color: rgba(255,255,255,0.78);
  letter-spacing: 0.08em; text-transform: uppercase;
}

.landing-main {
  position: relative; z-index: 2;
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  padding: 0 72px 48px;
  gap: 48px;
}
.landing-eyebrow-2 {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.72); margin-bottom: 14px;
}
.landing-atlas {
  font-size: 92px; font-weight: var(--fw-bold);
  letter-spacing: -0.03em; line-height: 0.95;
  color: #fff; margin: 0 0 12px;
  text-shadow: 0 3px 14px rgba(0,0,0,.20);
}
.landing-title {
  font-size: 42px; font-weight: var(--fw-light);
  letter-spacing: -0.015em; line-height: 1.1;
  color: rgba(255,255,255,0.95); margin: 0 0 20px;
}
.landing-subtitle {
  font-size: 20px; line-height: 1.5; color: rgba(255,255,255,0.92);
  max-width: 460px; margin: 0 0 16px; font-weight: var(--fw-regular);
}
.landing-pillars {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 0 0 36px; font-size: 15px; font-weight: var(--fw-semibold);
  color: #fff; letter-spacing: 0.01em; text-transform: uppercase;
}
.landing-pillars .sep { color: #90C982; font-weight: var(--fw-bold); }

.btn-new-study {
  display: inline-flex; align-items: center; gap: 12px;
  background: #fff; color: var(--mps-teal-700);
  border: 0; padding: 18px 36px;
  border-radius: 14px; font-size: 17px; font-weight: var(--fw-semibold);
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(14,40,65,0.18);
  transition: transform var(--dur-std) var(--ease-std), box-shadow var(--dur-std);
  text-decoration: none;
}
.btn-new-study:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(14,40,65,0.24); }
.btn-new-study .arrow { transition: transform var(--dur-std); display: inline-block; }
.btn-new-study:hover .arrow { transform: translateX(4px); }

.feature-cards-wrap { display: flex; justify-content: flex-start; }
.feature-cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 16px; max-width: 720px; margin-top: 44px;
  align-items: stretch;
}
.feature-card {
  background: rgba(255,255,255,0.96); color: var(--mps-ink);
  border-radius: 14px; padding: 22px 18px 20px;
  box-shadow: 0 10px 28px rgba(14,40,65,0.18);
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 12px;
  min-height: 188px;
}
.feature-card .fc-thumb {
  width: 84px; height: 84px; border-radius: 14px;
  background: linear-gradient(135deg, #eef5f6, #d8e7ea);
  display: flex; align-items: center; justify-content: center;
  color: var(--mps-teal-700);
}
.feature-card .fc-thumb svg { display: block; }
.feature-card h4 { margin: 4px 0 0; font-size: 15px; font-weight: var(--fw-semibold); color: var(--mps-ink); }
.feature-card .fc-meta { font-size: 12px; color: var(--mps-ink-3); margin: 0; }

.landing-figure {
  position: relative; display: flex; align-items: center; justify-content: center;
}
.landing-figure img {
  height: clamp(360px, calc(100vh - 250px), 880px);
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.35)) drop-shadow(0 0 40px rgba(144,201,130,0.2));
}

/* ============ LANDING STATS BAR (bottom) ============ */
.landing-stats-bar {
  position: relative; z-index: 2;
  margin: 0 32px 26px;
  display: flex; align-items: stretch; justify-content: space-around;
  background: rgba(14, 40, 65, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 16px;
  padding: 18px 8px;
  backdrop-filter: blur(4px);
  box-shadow: 0 8px 28px rgba(14, 40, 65, 0.22);
}
.landing-stat {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 4px 14px; text-align: center;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
.landing-stat:last-child { border-right: 0; }
.landing-stat-value {
  font-size: 34px; font-weight: var(--fw-light); line-height: 1;
  color: #fff; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.landing-stat-label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(95, 210, 225, 0.92); font-weight: var(--fw-semibold);
  line-height: 1.3;
}

/* ============ BODY WITH LABELED ORGAN PINS ============ */
/* Composite component: body x-ray + orange dots over key organs +
   labels with dashed connector lines. Used on the landing page and
   (smaller) inside the workspace.                                       */
.body-pins-wrap {
  position: relative;
  display: inline-block;
}
.body-pins-wrap > img {
  display: block;
  /* Bigger + fluid, but sized to the space left between the header and the
     bottom stats bar (~250px reserved) so the stats stay on screen. */
  height: clamp(360px, calc(100vh - 250px), 880px);
  max-width: 44vw;
  width: auto;
  filter: drop-shadow(0 20px 60px rgba(0,0,0,0.35))
          drop-shadow(0 0 40px rgba(144,201,130,0.2));
}
.body-pins-wrap.compact > img {
  height: 60vh; max-height: 540px;
}

.body-pin {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #E6837F;        /* coral */
  border: 2px solid #fff;
  box-shadow: 0 0 0 4px rgba(230,131,127,0.30),
              0 0 12px rgba(230,131,127,0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
}
.body-pin.active {
  background: #90C982;        /* green for the live organ */
  box-shadow: 0 0 0 4px rgba(144,201,130,0.35),
              0 0 14px rgba(144,201,130,0.55);
}

.body-pin-line {
  position: absolute;
  height: 0; pointer-events: none;
  border-top: 1px dashed rgba(255,255,255,0.55);
  z-index: 2;
}

.body-pin-label {
  position: absolute;
  color: rgba(255,255,255,0.95);
  font-family: var(--font-sans);
  font-size: 17px;
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  white-space: nowrap;
  pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
  z-index: 3;
  line-height: 1;
}
.body-pin-label.left  { text-align: right; }
.body-pin-label.right { text-align: left;  }
/* Dark variant for use over light backgrounds (workspace) */
.body-pins-wrap.on-light .body-pin-label {
  color: var(--mps-ink); text-shadow: none;
}
.body-pins-wrap.on-light .body-pin-line {
  border-top-color: rgba(14,40,65,0.35);
}

/* ============ APP SHELL ============ */
.app-shell { height: 100vh; display: flex; flex-direction: column; position: relative; }

/* Top app bar */
.appbar {
  height: 66px; background: #fff;
  border-bottom: 1px solid var(--border-1);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 5;
}
.appbar-left { display: flex; align-items: center; gap: 20px; }
.appbar .crumbs {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--mps-ink-3);
}
.appbar .crumbs .active { color: var(--mps-ink); font-weight: var(--fw-semibold); }
.appbar .crumbs .sep { opacity: 0.5; }
.appbar-right { display: flex; align-items: center; gap: 10px; }
.appbar-right .study-pill {
  background: var(--mps-teal-50); color: var(--mps-teal-700);
  border: 1px solid var(--mps-teal-100);
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: var(--fw-semibold);
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: transparent; border: 0; cursor: pointer;
  color: var(--mps-ink-2);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast);
}
.icon-btn:hover { background: var(--bg-2); }
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: linear-gradient(135deg, var(--mps-teal), var(--mps-teal-700));
  color: #fff; font-size: 12px; font-weight: var(--fw-bold);
  display: flex; align-items: center; justify-content: center;
}

/* Ribbon */
.ribbon {
  background: #fff; border-bottom: 1px solid var(--border-1);
  flex-shrink: 0; display: flex; flex-direction: column;
}
.ribbon-tabs {
  display: flex; align-items: end; gap: 0; padding: 0 16px;
  border-bottom: 1px solid var(--border-2);
  height: 36px;
}
.ribbon-tab {
  padding: 8px 16px; font-size: 13px; font-weight: var(--fw-semibold);
  color: var(--mps-ink-3); background: transparent; border: 0;
  cursor: pointer; position: relative;
  border-radius: 8px 8px 0 0;
  transition: color var(--dur-fast);
}
.ribbon-tab:hover { color: var(--mps-ink); }
.ribbon-tab.active { color: var(--mps-teal-700); }
.ribbon-tab.active::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: -1px;
  height: 2px; background: var(--mps-teal); border-radius: 2px 2px 0 0;
}
.ribbon-body {
  display: flex; align-items: stretch;
  padding: 10px 16px; gap: 14px;
  height: var(--ribbon-h);
}
.ribbon-group {
  display: flex; flex-direction: column;
  padding: 0 14px 4px 0;
  border-right: 1px solid var(--border-2);
  min-width: 0;
}
.ribbon-group:last-child { border-right: 0; }
.ribbon-group-label {
  order: 2; margin-top: 6px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--mps-ink-3); font-weight: var(--fw-semibold);
}
.ribbon-group-content {
  order: 1; display: flex; align-items: center; gap: 8px;
  flex: 1;
}

/* Organ tiles */
.organ-tile {
  width: 108px; height: 92px;
  border: 1px solid var(--border-1); border-radius: 12px;
  background: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; user-select: none;
  transition: transform var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast);
  padding: 8px 6px;
  position: relative;
}
.organ-tile:hover {
  transform: translateY(-2px); box-shadow: var(--sh-2);
  border-color: var(--mps-teal-100);
  background: var(--mps-teal-50);
}
.organ-tile.dragging { opacity: 0.4; }
.organ-tile.selected {
  border-color: var(--mps-teal); background: var(--mps-teal-50);
  box-shadow: 0 0 0 2px rgba(79,158,168,0.2);
}
.organ-tile.unavailable { opacity: 0.35; cursor: not-allowed; }
.organ-tile img {
  width: 44px; height: 44px; object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}
.organ-tile .tile-label {
  font-size: 12px; font-weight: var(--fw-semibold); color: var(--mps-ink);
}
.organ-tile .dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--mps-green);
}
.organ-tile.unavailable .dot { background: var(--mps-mute); }

.ribbon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border: 1px solid var(--border-1);
  background: #fff; border-radius: 8px;
  font-size: 12px; color: var(--mps-ink);
  cursor: pointer; transition: all var(--dur-fast);
  font-weight: var(--fw-semibold);
}
.ribbon-btn:hover { background: var(--mps-teal-50); border-color: var(--mps-teal-100); }
.ribbon-btn.primary { background: var(--mps-teal); color: #fff; border-color: var(--mps-teal); }
.ribbon-btn.primary:hover { background: var(--mps-teal-600); border-color: var(--mps-teal-600); }
.ribbon-btn.lg {
  flex-direction: column; padding: 8px 10px; min-width: 64px; height: 78px;
  justify-content: center; gap: 6px;
}
.ribbon-btn.lg .lbl { font-size: 11px; font-weight: var(--fw-semibold); }

/* Main content */
.main {
  flex: 1; display: flex; min-height: 0;
  background: var(--bg-1);
}

/* Left rail */
.rail {
  width: var(--rail-w); background: #fff; border-right: 1px solid var(--border-1);
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0; gap: 4px; flex-shrink: 0;
}
.rail-item {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; color: var(--mps-ink-3);
  font-size: 9px; font-weight: var(--fw-semibold); text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: all var(--dur-fast);
  position: relative;
}
.rail-item:hover { background: var(--bg-2); color: var(--mps-ink); }
.rail-item.active { background: var(--mps-teal-50); color: var(--mps-teal-700); }
.rail-item.active::before {
  content: ''; position: absolute; left: 0; width: 3px; height: 24px;
  background: var(--mps-teal); border-radius: 0 2px 2px 0;
}

/* Workspace */
.workspace {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.workspace-bg-traces {
  position: absolute; inset: 0;
  background-image: url('circuit-traces.svg');
  background-size: 800px; background-repeat: repeat;
  opacity: 0.06; pointer-events: none;
}
.workspace-header {
  position: absolute; top: 20px; left: 24px; right: 24px;
  display: flex; align-items: flex-start; justify-content: space-between;
  pointer-events: none;
  z-index: 4;
}
.workspace-title h2 {
  margin: 0; font-size: 22px; font-weight: var(--fw-light); color: var(--mps-ink);
  letter-spacing: -0.01em;
}
.workspace-title p { margin: 2px 0 0; font-size: 13px; color: var(--mps-ink-3); }

.selection-chips {
  pointer-events: auto;
  display: flex; flex-wrap: wrap; gap: 6px;
  max-width: 380px; justify-content: flex-end;
}
.selection-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px 5px 8px;
  background: #fff; border: 1px solid var(--mps-teal-100);
  border-radius: 999px; font-size: 12px; color: var(--mps-ink);
  box-shadow: var(--sh-1);
}
.selection-chip img { width: 18px; height: 18px; object-fit: contain; }
.selection-chip .x {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-2); color: var(--mps-ink-3);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px; border: 0;
}
.selection-chip .x:hover { background: var(--mps-coral); color: #fff; }

/* Turntable */
.turntable {
  position: relative;
  width: 480px; height: 640px;
  perspective: 1400px;
  transition: transform var(--dur-slow) var(--ease-std);
}
.turntable.dropzone-active { transform: scale(1.02); }
.figure-3d {
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transform: rotateY(var(--rotY, 0deg));
  transition: transform 800ms var(--ease-std);
}
.figure-face {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  backface-visibility: hidden;
}
.figure-face img {
  max-height: 100%; max-width: 100%;
  filter: drop-shadow(0 12px 40px rgba(47,109,118,0.25));
}
.figure-face.front { transform: rotateY(0deg); }
.figure-face.back  { transform: rotateY(180deg); }
.figure-face.back img {
  transform: scaleX(-1);
  filter: drop-shadow(0 12px 40px rgba(47,109,118,0.25)) hue-rotate(-10deg) brightness(0.85);
}

.floor-disc {
  position: absolute; bottom: 4%; left: 50%;
  transform: translateX(-50%) rotateX(75deg);
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79,158,168,0.22) 0%, rgba(79,158,168,0.04) 60%, transparent 75%);
  pointer-events: none;
}
.floor-ring {
  position: absolute; bottom: 4%; left: 50%;
  transform: translateX(-50%) rotateX(75deg);
  width: 360px; height: 360px; border-radius: 50%;
  border: 1px dashed rgba(79,158,168,0.35);
  pointer-events: none;
}
.turntable.dropzone-active .floor-ring {
  border-color: var(--mps-teal);
  border-style: solid;
  box-shadow: 0 0 40px rgba(79,158,168,0.4);
  animation: pulseRing 1.2s ease-in-out infinite;
}
@keyframes pulseRing { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Pins */
.organ-pins { position: absolute; inset: 0; pointer-events: none; }
.organ-pin {
  position: absolute; pointer-events: auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.95);
  border: 2px solid var(--mps-teal);
  box-shadow: 0 4px 14px rgba(47,109,118,0.3);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transform: translate(-50%,-50%);
  transition: all var(--dur-std) var(--ease-std);
}
.organ-pin .pin-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--mps-teal);
}
.organ-pin.active {
  background: var(--mps-teal);
  border-color: #fff;
  width: 44px; height: 44px;
  box-shadow: 0 0 0 4px rgba(79,158,168,0.25), 0 6px 20px rgba(47,109,118,0.4);
  animation: pinPulse 2s ease-in-out infinite;
}
.organ-pin.active .pin-dot { background: #fff; width: 14px; height: 14px; }
@keyframes pinPulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(79,158,168,0.25), 0 6px 20px rgba(47,109,118,0.4); }
  50%     { box-shadow: 0 0 0 10px rgba(79,158,168,0.08), 0 6px 20px rgba(47,109,118,0.4); }
}
.organ-pin:hover:not(.active) { transform: translate(-50%,-50%) scale(1.15); }
.organ-pin .pin-label {
  position: absolute; left: 50%; top: calc(100% + 6px); transform: translateX(-50%);
  background: var(--mps-ink); color: #fff;
  padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: var(--fw-semibold); white-space: nowrap;
  opacity: 0; transition: opacity var(--dur-fast);
  pointer-events: none;
}
.organ-pin:hover .pin-label, .organ-pin.active .pin-label { opacity: 1; }

.organ-glow {
  position: absolute; pointer-events: none;
  border-radius: 50%;
  filter: blur(18px);
  opacity: 0; transition: opacity var(--dur-std);
  mix-blend-mode: screen;
}
.organ-glow.active { opacity: 0.75; }

/* Rotation controls */
.rotate-controls {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--border-1);
  border-radius: 999px; padding: 6px 10px;
  box-shadow: var(--sh-1);
  z-index: 3;
}
.rotate-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: var(--bg-2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--mps-ink-2);
  transition: all var(--dur-fast);
}
.rotate-btn:hover { background: var(--mps-teal); color: #fff; }
.rotate-label {
  font-size: 11px; font-weight: var(--fw-semibold);
  color: var(--mps-ink-3); min-width: 44px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.rotate-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: var(--fw-semibold); color: var(--mps-ink-2);
  cursor: pointer; user-select: none;
  padding-left: 8px; border-left: 1px solid var(--border-2);
}
.rotate-toggle input { accent-color: var(--mps-teal); }

.empty-hint {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.95);
  border: 1px dashed var(--mps-teal);
  border-radius: 14px; padding: 16px 22px;
  color: var(--mps-teal-700); font-size: 13px; font-weight: var(--fw-semibold);
  text-align: center; max-width: 260px; line-height: 1.5;
  box-shadow: var(--sh-1);
  pointer-events: none;
  transition: opacity var(--dur-std);
  z-index: 2;
}
.empty-hint.hide { opacity: 0; }
.empty-hint .k { color: var(--mps-ink-3); font-weight: var(--fw-regular); font-size: 11px; margin-top: 4px; display: block; }

/* Drop ghost */
.drop-ghost {
  position: absolute; pointer-events: none;
  z-index: 50;
  background: #fff; border-radius: 12px; padding: 6px 10px;
  display: flex; align-items: center; gap: 6px;
  box-shadow: var(--sh-2); border: 1px solid var(--mps-teal-100);
  font-size: 12px; font-weight: var(--fw-semibold);
  transform: translate(-50%, -50%);
}
.drop-ghost img { width: 20px; height: 20px; }

/* ============ PARAMS PANEL ============ */
.params-panel {
  width: var(--params-w); background: #fff;
  border-left: 1px solid var(--border-1);
  display: flex; flex-direction: column;
  flex-shrink: 0; overflow: hidden;
  transition: margin-right var(--dur-std) var(--ease-std);
}
.params-panel.hidden { margin-right: calc(-1 * var(--params-w)); }

.params-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border-2);
}
.params-header .eyebrow {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--mps-teal); font-weight: var(--fw-semibold);
}
.params-header h3 { margin: 2px 0 0; font-size: 18px; font-weight: var(--fw-semibold); display: flex; align-items: center; gap: 10px; }
.params-header h3 img { width: 26px; height: 26px; object-fit: contain; }
.params-header .subh { margin: 4px 0 0; font-size: 12px; color: var(--mps-ink-3); }

.params-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }

/* Grouped parameter cards (Chip / Drug) in the params panel */
.param-card {
  background: var(--bg-1, #f8f9fa);
  border: 1px solid var(--border-1, #d7dce1);
  border-radius: 12px;
  padding: 14px 14px 4px;
  margin-bottom: 16px;
}
.param-card-title {
  font-size: 11px; font-weight: var(--fw-bold);
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--mps-teal-700, #2f6d76);
  margin-bottom: 10px;
}
/* Make the Drug dropdown visibly a dropdown: chevron on the right */
.drug-select select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 32px !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232f6d76' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 11px; font-weight: var(--fw-semibold);
  color: var(--mps-ink-2); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.field .ctrl,
.params-body .form-control,
.params-body .form-select,
.params-body select.shiny-input-select,
.params-body input[type="text"],
.params-body input[type="number"],
.params-body textarea {
  width: 100% !important; padding: 9px 12px !important;
  border: 1px solid var(--border-1) !important; border-radius: 8px !important;
  background: #fff; font-size: 13px; color: var(--mps-ink) !important;
  font-family: inherit;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  box-shadow: none !important;
}
.field .ctrl:focus,
.params-body .form-control:focus,
.params-body .form-select:focus,
.params-body input:focus,
.params-body textarea:focus {
  outline: none !important; border-color: var(--mps-teal) !important;
  box-shadow: 0 0 0 3px rgba(79,158,168,0.15) !important;
}
.field-row { display: grid; grid-template-columns: 1fr 72px; gap: 8px; }

/* Shiny labels inside the params panel — match app style */
.params-body .control-label,
.params-body label.shiny-input-container {
  font-size: 11px !important; font-weight: var(--fw-semibold) !important;
  color: var(--mps-ink-2) !important; margin-bottom: 5px !important;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.params-body .form-group,
.params-body .shiny-input-container {
  margin-bottom: 14px !important;
  width: 100% !important;
  max-width: none !important;
}

/* Evaporation pill group */
.radio-group { display: flex; gap: 6px; }
.radio-chip {
  flex: 1; text-align: center;
  padding: 7px 8px; border: 1px solid var(--border-1);
  border-radius: 8px; font-size: 12px; cursor: pointer;
  background: #fff; color: var(--mps-ink-2); font-weight: var(--fw-semibold);
  transition: all var(--dur-fast);
}
.radio-chip:hover { border-color: var(--mps-teal-100); }
.radio-chip.active { background: var(--mps-teal); color: #fff; border-color: var(--mps-teal); }

/* Evaporation is display-only — greyed, non-interactive */
.app-evap-disabled { opacity: 0.5; }
.app-evap-disabled .control-label { color: var(--mps-ink-3); }
.app-evap-disabled .radio-chip { cursor: not-allowed; pointer-events: none; }
.app-evap-disabled .radio-chip.active {
  background: var(--mps-mute, #9aa4ae); border-color: var(--mps-mute, #9aa4ae);
}

.params-footer {
  padding: 12px 20px; border-top: 1px solid var(--border-2);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--bg-1);
}
.btn-app {
  padding: 9px 16px; border-radius: 8px;
  font-size: 13px; font-weight: var(--fw-semibold);
  cursor: pointer; border: 1px solid transparent;
  transition: all var(--dur-fast);
}
.btn-app.ghost   { background: transparent; color: var(--mps-ink-2); border-color: var(--border-1); }
.btn-app.ghost:hover { background: var(--bg-2); }
.btn-app.primary { background: var(--mps-teal); color: #fff; border-color: var(--mps-teal); }
.btn-app.primary:hover { background: var(--mps-teal-600); }
.btn-app.navy    { background: #1E2761; color: #fff; border-color: #1E2761; }
.btn-app.navy:hover { background: #2C3574; border-color: #2C3574; }
.btn-app.success { background: var(--mps-green); color: #fff; border-color: var(--mps-green); }

/* Heads-up callout */
.heads-up {
  margin-top: 20px; padding: 12px;
  background: var(--mps-teal-50);
  border-radius: 10px; border: 1px solid var(--mps-teal-100);
  font-size: 12px; color: var(--mps-ink-2); line-height: 1.55;
}
.heads-up b { color: var(--mps-teal-700); }

/* ============ SIMULATION PROGRESS OVERLAY ============ */
.app-progress-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(14, 40, 65, 0.55);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity var(--dur-std) var(--ease-std);
}
.app-progress-overlay.show { display: flex; opacity: 1; }
.app-progress-card {
  background: #fff; border-radius: 16px; padding: 26px 30px;
  box-shadow: var(--sh-3); min-width: 380px; max-width: 460px;
}
.app-progress-card h4 {
  margin: 0 0 6px; font-size: 16px; font-weight: var(--fw-semibold);
  color: var(--mps-ink);
}
.app-progress-card p.app-progress-msg {
  margin: 0 0 16px; font-size: 13px; color: var(--mps-ink-3);
  line-height: 1.5;
}
.app-progress-bar {
  height: 8px; background: var(--bg-2); border-radius: 999px; overflow: hidden;
}
.app-progress-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--mps-teal), var(--mps-teal-700));
  transition: width 250ms ease-out;
  border-radius: 999px;
}
.app-progress-meta {
  display: flex; justify-content: space-between; margin-top: 10px;
  font-size: 11px; color: var(--mps-ink-3); font-variant-numeric: tabular-nums;
  text-transform: uppercase; letter-spacing: 0.04em;
}

/* Disabled state for ribbon tabs / rail items / topbar icons / ribbon buttons */
.ribbon-tab.disabled,
.rail-item.disabled,
.icon-btn.disabled,
.ribbon-btn.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.ribbon-btn.disabled:hover { background: #fff; border-color: var(--border-1); }
.ribbon-tab.disabled:hover { color: var(--mps-ink-3); }
.ribbon-tab.disabled.active::after { display: none; }
.rail-item.disabled:hover { background: transparent; color: var(--mps-ink-3); }
.icon-btn.disabled:hover  { background: transparent; }

/* Result clearance cards (in result panel) */
.result-card {
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  color: #0E2841;
}
.result-card h5 {
  margin: 0 0 4px; font-size: 12px; font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.06em; color: rgba(14,40,65,0.85);
}
.result-card p.big {
  margin: 2px 0 4px; font-size: 22px; font-weight: var(--fw-bold);
  letter-spacing: -0.01em; line-height: 1.1;
}
.result-card small { font-size: 11px; opacity: 0.85; }

/* ============ CHIP MODAL ============ */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(14,40,65,0.35);
  backdrop-filter: blur(4px);
  z-index: 60; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-std);
  display: flex; align-items: center; justify-content: center;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 720px; max-width: 92vw; max-height: 82vh;
  background: #fff; border-radius: 18px;
  box-shadow: var(--sh-3);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(12px); opacity: 0;
  transition: transform var(--dur-std) var(--ease-std), opacity var(--dur-std);
}
.modal-scrim.open .modal { transform: none; opacity: 1; }
.modal-head {
  padding: 18px 24px; border-bottom: 1px solid var(--border-2);
  display: flex; align-items: center; gap: 14px;
}
.modal-head img { width: 32px; height: 32px; object-fit: contain; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: var(--fw-semibold); }
.modal-head p { margin: 2px 0 0; font-size: 12px; color: var(--mps-ink-3); }
.modal-head .close {
  margin-left: auto; background: transparent; border: 0; cursor: pointer;
  width: 32px; height: 32px; border-radius: 8px; color: var(--mps-ink-3);
}
.modal-head .close:hover { background: var(--bg-2); color: var(--mps-ink); }

.modal-search {
  padding: 12px 24px; border-bottom: 1px solid var(--border-2);
}
.modal-search input {
  width: 100%; padding: 9px 12px 9px 34px;
  border: 1px solid var(--border-1); border-radius: 8px;
  font-size: 13px; font-family: inherit;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7783' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 10px center;
}
.chip-grid {
  padding: 16px 24px 24px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.chip-card {
  border: 1px solid var(--border-1); border-radius: 14px;
  padding: 14px; cursor: pointer; background: #fff;
  display: flex; gap: 12px;
  transition: all var(--dur-fast);
  position: relative;
}
.chip-card:hover { border-color: var(--mps-teal-100); box-shadow: var(--sh-1); background: var(--mps-teal-50); }
.chip-card.selected {
  border-color: var(--mps-teal); background: var(--mps-teal-50);
  box-shadow: 0 0 0 2px rgba(79,158,168,0.15);
}
.chip-card .thumb {
  width: 64px; height: 64px; border-radius: 10px;
  background: linear-gradient(135deg, #e7eff1, #d4e4e8);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.chip-card .thumb img { width: 44px; height: 44px; object-fit: contain; }
.chip-card .thumb-num {
  font-size: 26px; font-weight: var(--fw-bold);
  color: var(--mps-teal-700, #2f6d76);
  font-variant-numeric: tabular-nums;
}
.chip-card h4 { margin: 0 0 3px; font-size: 14px; font-weight: var(--fw-semibold); }
.chip-card .meta { font-size: 11px; color: var(--mps-ink-3); line-height: 1.5; }
.chip-card .meta b { color: var(--mps-ink); font-weight: var(--fw-semibold); }
.chip-card .check {
  position: absolute; top: 10px; right: 10px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--mps-teal); color: #fff;
  display: none; align-items: center; justify-content: center;
}
.chip-card.selected .check { display: flex; }
.modal-foot {
  padding: 12px 24px; border-top: 1px solid var(--border-2);
  display: flex; gap: 8px; justify-content: flex-end;
  background: var(--bg-1);
}

/* ============ TOAST ============ */
.toast-wrap {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200; pointer-events: none;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--mps-ink); color: #fff;
  padding: 10px 16px; border-radius: 10px;
  font-size: 13px; font-weight: var(--fw-semibold);
  box-shadow: var(--sh-2);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 220ms var(--ease-std);
}
.toast img { width: 20px; height: 20px; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* Utility icons */
.ico    { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ── Top-level product navigation ─────────────────────────────────────── */
.product-nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: 18px; padding-left: 18px;
  border-left: 1px solid var(--border-1);
}
.product-tab {
  padding: 7px 14px; font-size: 14px; font-weight: var(--fw-semibold);
  color: var(--mps-ink-3); background: transparent; border: 0;
  border-radius: 8px; cursor: pointer; white-space: nowrap;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.product-tab:hover { color: var(--mps-ink); background: var(--bg-2); }
.product-tab.active {
  color: var(--mps-teal-700); background: var(--mps-teal-50);
}
.product-tab.disabled {
  opacity: 0.4; cursor: default;
}
.product-tab.disabled:hover { color: var(--mps-ink-3); background: transparent; }

/* ── Leaderboard view ─────────────────────────────────────────────────── */
/* The leaderboard content (gallery/cards/views) is owned by the
   MPSLeaderboardApp package, which injects its own styles. Atlas only provides
   the outer scroll container. */
.leaderboard-body {
  flex: 1; overflow: auto; padding: 40px 48px 64px;
  background: #FAFBFC;
}

/* DILI page */
.dili-page { max-width: 1200px; margin: 0 auto; }
.dili-workflow {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; text-align: center;
  background: #F5F7F9; border: 1.5px dashed #C9D2DA; border-radius: 14px;
  padding: 26px; margin-bottom: 22px; color: #5A6470;
}
.dili-workflow .dwp-icon { color: #9AA4AE; }
.dili-workflow .dwp-title { font-size: 16px; font-weight: 700; color: #0E2841; }
.dili-workflow .dwp-sub { font-size: 13px; color: #5A6470; }
.dili-iframe {
  width: 100%; height: 1180px; border: 1px solid #E6E8EB;
  border-radius: 14px; background: #fff;
}
.dili-plot-card {
  background: #fff; border: 1px solid #E6E8EB; border-radius: 14px;
  padding: 18px 20px; margin-bottom: 18px;
}

/* Shared gallery/card styles (also used by the DILI module locally) */
.bm-dash { font-family: 'Nunito', system-ui, sans-serif; max-width: 1180px; margin: 0 auto; }
.bm-eyebrow { font-size: 11.5px; font-weight: 700; color: #2F6D76; text-transform: uppercase;
  letter-spacing: 0.14em; margin: 0 0 8px; }
.bm-dash h1 { font-weight: 300; font-size: 32px; letter-spacing: -0.01em; margin: 0 0 8px;
  line-height: 1.15; color: #0E2841; }
.bm-subhead { font-size: 15px; color: #5A6470; margin: 0 0 24px; max-width: 840px; line-height: 1.55; }
.bench-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
a.bench-card { display: block; text-decoration: none; color: #0E2841; background: #fff;
  border: 1px solid #E6E8EB; border-radius: 14px; padding: 22px 24px;
  transition: border-color 150ms, transform 150ms, box-shadow 150ms; }
a.bench-card:hover { border-color: #4F9EA8; transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14,40,65,0.06); }
.bench-kind { font-size: 11.5px; font-weight: 700; color: #4F9EA8; text-transform: uppercase;
  letter-spacing: 0.08em; margin-bottom: 8px; }
a.bench-card h2 { font-size: 19px; font-weight: 600; margin: 0 0 6px; }
a.bench-card p { font-size: 13.5px; color: #5A6470; margin: 0; line-height: 1.5; }
.bench-glyph { margin-top: 14px; width: 100%; height: 64px; background: #F5F7F9; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: #9AA4AE; font-size: 26px; letter-spacing: 5px; }
.bm-view-bar { margin-bottom: 12px; }
.bm-back { display: inline-flex; align-items: center; padding: 7px 14px; font-size: 13px;
  border: 1px solid #D7DCE1; border-radius: 8px; background: #fff; color: #5A6470; cursor: pointer; }
.bm-back:hover { background: #F5F7F9; }
.bm-row { display: grid; grid-template-columns: 1fr 280px; gap: 22px; align-items: start; }
.bm-plots { display: flex; flex-direction: column; gap: 18px; }
.bm-card { background: #fff; border: 1px solid #E6E8EB; border-radius: 14px; padding: 18px 20px; }
.bm-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: #0E2841; }
.bm-side { position: sticky; top: 12px; }
.bm-side .bm-card { display: flex; flex-direction: column; gap: 12px; }
.bm-side label { font-weight: 700; font-size: 13px; color: #0E2841; }
.bm-hint { font-size: 12.5px; color: #5A6470; line-height: 1.5; }
.bm-tested { font-size: 12.5px; color: #0E2841; }
.bm-tested .ttl { font-weight: 700; margin-bottom: 4px; }
.bm-chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  font-weight: 700; margin: 0 6px 6px 0; color: #fff; }

/* ── Module-selector hub ──────────────────────────────────────────────── */
.hub-page {
  min-height: 100vh; background: #FAFBFC;
  padding: 32px clamp(24px, 5vw, 72px) 64px;
  font-family: 'Nunito', system-ui, sans-serif; color: #0E2841;
}
.hub-header { display: flex; align-items: center; justify-content: space-between; }
.hub-header .brand-mark { display: flex; align-items: center; gap: 12px; }
.hub-brand { font-weight: 300; font-size: 22px; color: #0E2841; }
.hub-intro { margin: 48px 0 28px; text-align: center; }
.hub-eyebrow {
  font-size: 12px; font-weight: 700; color: #2F6D76;
  text-transform: uppercase; letter-spacing: 0.14em; margin-bottom: 8px;
}
.hub-intro h1 {
  font-weight: 300; font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.015em;
  margin: 0 0 8px; color: #0E2841;
}
.hub-intro p { font-size: 16px; color: #5A6470; margin: 0; }
.hub-grid {
  display: grid; gap: 20px; max-width: 1080px; margin: 0 auto;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.hub-tile {
  position: relative; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 14px;
  background: #fff; border: 1px solid #E6E8EB; border-radius: 16px;
  padding: 26px 24px; color: #0E2841; font-family: inherit;
  transition: border-color 150ms, transform 150ms, box-shadow 150ms;
}
.hub-tile:hover {
  border-color: #4F9EA8; transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(14,40,65,0.08);
}
.hub-icon {
  width: 56px; height: 56px; color: #2F6D76;
  background: #EEF6F7; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}
.hub-icon svg { width: 30px; height: 30px; }
.hub-tile-body h3 {
  margin: 0 0 6px; font-size: 20px; font-weight: 700;
  display: flex; align-items: baseline; gap: 8px;
}
.hub-sub {
  font-size: 11.5px; font-weight: 700; color: #4F9EA8;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.hub-tile-body p { margin: 0; font-size: 13.5px; color: #5A6470; line-height: 1.5; }
.hub-tile.disabled { cursor: default; opacity: 0.62; }
.hub-tile.disabled:hover { border-color: #E6E8EB; transform: none; box-shadow: none; }
.hub-soon {
  position: absolute; top: 16px; right: 16px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: #9AA4AE;
  background: #F2F4F6; border-radius: 999px; padding: 3px 10px;
}
