/* Shared Bayes Pharma.ai / Generics module shell.
   This intentionally leaves page-specific tools in place while adding a
   consistent product frame, evidence controls, and softer legacy styling. */

body.bayespk-module-shell {
  --bp-shell-ink: #10233d;
  --bp-shell-muted: #60738e;
  --bp-shell-line: rgba(220, 231, 244, 0.9);
  --bp-shell-surface: rgba(255, 255, 255, 0.92);
  --bp-shell-soft: #f4f8fd;
  --bp-shell-brand: #1268e8;
  --bp-shell-brand-2: #6246d9;
  --bp-shell-aqua: #0cb8a5;
  --bp-shell-shadow: 0 20px 60px rgba(16, 54, 97, 0.16);
  background-attachment: fixed;
}

body.bayespk-module-shell .bp-module-shell {
  position: sticky;
  top: 0;
  z-index: 2147482500;
  font-family: Inter, Arial, sans-serif;
  color: var(--bp-shell-ink);
  border-bottom: 1px solid var(--bp-shell-line);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 32px rgba(16, 54, 97, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body.bayespk-module-shell.bp-module-dark .bp-module-shell {
  color: #e8f0fb;
  border-bottom-color: rgba(115, 142, 177, 0.22);
  background: rgba(6, 20, 38, 0.9);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
}

/* This page already has its own sticky top bar (see hasOwnStickyHeader() in
   module-shell.js). Keep our shell in normal document flow instead of also
   pinning it, so scrolling doesn't stack two sticky headers. */
body.bayespk-module-shell.bp-shell-inline .bp-module-shell {
  position: static;
}

.bp-module-shell * {
  box-sizing: border-box;
}

.bp-module-shell a {
  color: inherit;
  text-decoration: none;
}

.bp-shell-inner {
  width: min(1480px, calc(100% - 28px));
  min-height: 70px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.bp-shell-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.bp-shell-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  font-weight: 950;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--bp-shell-brand), var(--bp-shell-brand-2));
  box-shadow: 0 14px 30px rgba(18, 104, 232, 0.24);
}

.bp-shell-title {
  min-width: 0;
}

.bp-shell-title strong,
.bp-shell-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bp-shell-title strong {
  font-size: 0.95rem;
  font-weight: 950;
}

.bp-shell-title span {
  margin-top: 2px;
  color: var(--bp-shell-muted);
  font-size: 0.74rem;
  font-weight: 800;
}

body.bayespk-module-shell.bp-module-dark .bp-shell-title span {
  color: #9eb0c8;
}

.bp-shell-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.bp-shell-chip,
.bp-shell-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--bp-shell-line);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--bp-shell-muted);
  font-size: 0.75rem;
  font-weight: 900;
  white-space: nowrap;
}

body.bayespk-module-shell.bp-module-dark .bp-shell-chip,
body.bayespk-module-shell.bp-module-dark .bp-shell-button {
  border-color: rgba(115, 142, 177, 0.24);
  background: rgba(15, 32, 53, 0.82);
  color: #b6c6dc;
}

.bp-shell-chip b {
  color: var(--bp-shell-brand);
  font-weight: 950;
}

.bp-shell-button {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.bp-shell-button:hover {
  transform: translateY(-1px);
  border-color: rgba(18, 104, 232, 0.42);
  color: var(--bp-shell-brand);
  box-shadow: 0 12px 26px rgba(18, 104, 232, 0.12);
}

.bp-shell-button.primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--bp-shell-brand), var(--bp-shell-brand-2));
  box-shadow: 0 12px 28px rgba(18, 104, 232, 0.22);
}

.bp-shell-button.primary:hover {
  color: #fff;
}

.bp-shell-button:focus-visible,
.bp-shell-chip:focus-visible {
  outline: 2px solid var(--bp-shell-brand);
  outline-offset: 2px;
}

.bp-legacy-notice {
  width: min(1480px, calc(100% - 28px));
  margin: 12px auto 0;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.38);
  background: rgba(245, 158, 11, 0.12);
  color: var(--bp-shell-ink);
  font-family: Inter, Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
}

body.bayespk-module-shell.bp-module-dark .bp-legacy-notice {
  color: #f8fafc;
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.14);
}

.bp-legacy-notice a {
  color: var(--bp-shell-brand);
  text-decoration: underline;
  font-weight: 900;
}

.bp-module-lens {
  width: min(1480px, calc(100% - 28px));
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 12px;
  font-family: Inter, Arial, sans-serif;
}

.bp-module-lens-card {
  border: 1px solid var(--bp-shell-line);
  border-radius: 22px;
  padding: 15px;
  color: var(--bp-shell-ink);
  background: var(--bp-shell-surface);
  box-shadow: var(--bp-shell-shadow);
  backdrop-filter: blur(18px);
}

body.bayespk-module-shell.bp-module-dark .bp-module-lens-card {
  color: #e8f0fb;
  border-color: rgba(115, 142, 177, 0.22);
  background: rgba(15, 32, 53, 0.86);
}

.bp-module-lens .bp-lens-kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--bp-shell-brand);
  font-size: 0.68rem;
  font-weight: 950;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.bp-module-lens h2 {
  margin: 7px 0 5px;
  color: inherit;
  font-size: clamp(1.35rem, 2vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.bp-module-lens p {
  margin: 0;
  max-width: 72ch;
  color: var(--bp-shell-muted);
  font-size: 0.88rem;
  line-height: 1.62;
}

body.bayespk-module-shell.bp-module-dark .bp-module-lens p {
  color: #aebed3;
}

.bp-lens-flow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.bp-lens-flow span {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 3px;
  border: 1px solid var(--bp-shell-line);
  border-radius: 15px;
  padding: 9px;
  background: var(--bp-shell-soft);
  color: var(--bp-shell-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

body.bayespk-module-shell.bp-module-dark .bp-lens-flow span {
  border-color: rgba(115, 142, 177, 0.22);
  background: rgba(255, 255, 255, 0.055);
  color: #b6c6dc;
}

.bp-lens-flow b {
  color: var(--bp-shell-ink);
  font-size: 0.76rem;
}

body.bayespk-module-shell.bp-module-dark .bp-lens-flow b {
  color: #f2f7ff;
}

.bp-lens-actions {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.bp-lens-actions .bp-shell-button {
  min-height: 38px;
}

body.bayespk-module-shell .bp-modern-note {
  margin-top: 10px;
  color: var(--bp-shell-muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

/* Gentle legacy modernization. These selectors intentionally target common
   older tool containers without forcing a full redesign. */
body.bayespk-module-shell > .container:first-of-type,
body.bayespk-module-shell > main:first-of-type,
body.bayespk-module-shell main > .container:first-child {
  padding-top: clamp(18px, 2vw, 28px);
}

body.bayespk-module-shell .container,
body.bayespk-module-shell .dashboard-container,
body.bayespk-module-shell .main-container {
  max-width: min(1440px, calc(100% - 24px));
}

body.bayespk-module-shell .header,
body.bayespk-module-shell .hero-section,
body.bayespk-module-shell .page-header {
  border-color: rgba(96, 165, 250, 0.28) !important;
  box-shadow: 0 18px 48px rgba(15, 49, 87, 0.16);
}

body.bayespk-module-shell .card,
body.bayespk-module-shell .metric-card,
body.bayespk-module-shell .dashboard-card,
body.bayespk-module-shell .panel,
body.bayespk-module-shell .result-card,
body.bayespk-module-shell .form-card {
  border-color: rgba(96, 165, 250, 0.24) !important;
  box-shadow: 0 16px 42px rgba(15, 49, 87, 0.13);
}

body.bayespk-module-shell input,
body.bayespk-module-shell select,
body.bayespk-module-shell textarea {
  min-height: 40px;
  border-radius: 12px !important;
}

body.bayespk-module-shell input:focus,
body.bayespk-module-shell select:focus,
body.bayespk-module-shell textarea:focus {
  outline: 0;
  border-color: rgba(18, 104, 232, 0.7) !important;
  box-shadow: 0 0 0 4px rgba(18, 104, 232, 0.16) !important;
}

body.bayespk-module-shell button,
body.bayespk-module-shell .btn,
body.bayespk-module-shell .action,
body.bayespk-module-shell .primary,
body.bayespk-module-shell .secondary {
  border-radius: 12px;
}

body.bayespk-module-shell .result-box,
body.bayespk-module-shell .result-area,
body.bayespk-module-shell .result-container,
body.bayespk-module-shell pre {
  border: 1px solid rgba(96, 165, 250, 0.24);
  border-radius: 14px;
}

@media (max-width: 980px) {
  .bp-shell-inner,
  .bp-module-lens {
    grid-template-columns: 1fr;
  }

  .bp-shell-actions {
    justify-content: flex-start;
  }

  .bp-module-lens {
    margin-top: 10px;
  }
}

@media (max-width: 620px) {
  .bp-shell-inner,
  .bp-module-lens {
    width: min(100% - 18px, 1480px);
  }

  .bp-shell-inner {
    min-height: 64px;
    gap: 9px;
    padding: 8px 0;
  }

  .bp-shell-title strong {
    font-size: 0.86rem;
  }

  .bp-shell-title span {
    font-size: 0.68rem;
  }

  .bp-shell-chip {
    display: none;
  }

  .bp-shell-actions {
    gap: 6px;
  }

  .bp-shell-button {
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.68rem;
  }

  .bp-module-lens-card {
    padding: 12px;
    border-radius: 18px;
  }

  .bp-lens-flow {
    grid-template-columns: 1fr;
  }
}
