:root {
  --bg-base: #07080b;
  --bg-card: rgba(16, 18, 27, 0.75);
  --bg-card-hover: rgba(22, 26, 40, 0.9);
  --border-gold: rgba(212, 175, 55, 0.25);
  --border-gold-glow: rgba(212, 175, 55, 0.6);
  --gold-primary: #d4af37;
  --gold-light: #f6e05e;
  --gold-dark: #977b21;
  --emerald-primary: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.2);
  --indigo-primary: #6366f1;
  --crimson-primary: #e11d48;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --font-serif: 'Cinzel', serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-gold: 0 0 25px rgba(212, 175, 55, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Atmospheric Glow Background */
.stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at top, #141724 0%, #07080b 80%);
  z-index: -3;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: -2;
  opacity: 0.15;
}

.glow-gold {
  top: -100px;
  right: -50px;
  width: 600px;
  height: 600px;
  background: var(--gold-primary);
}

.glow-emerald {
  bottom: -150px;
  left: -100px;
  width: 700px;
  height: 700px;
  background: var(--emerald-primary);
}

/* Master Header */
.master-header {
  background: rgba(11, 13, 19, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-gold);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.alchemical-seal {
  width: 50px;
  height: 50px;
  color: var(--gold-primary);
  filter: drop-shadow(0 0 10px rgba(212, 175, 55, 0.4));
  animation: rotateSeal 120s linear infinite;
}

@keyframes rotateSeal {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #fff 0%, var(--gold-primary) 70%, #fef3c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.header-meta {
  display: flex;
  gap: 0.5rem;
}

.badge {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-gold {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
}

.badge-cyan {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Nav Tabs */
.nav-tabs {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.nav-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn:hover {
  color: var(--gold-light);
}

.nav-btn.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
  background: linear-gradient(180deg, transparent 70%, rgba(212, 175, 55, 0.08) 100%);
  font-weight: 600;
}

/* Main Layout */
.main-content {
  max-width: 1440px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-pane.active {
  display: block;
}

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

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.pane-title-group h2 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: #fff;
  letter-spacing: 0.5px;
  margin-bottom: 0.4rem;
}

.pane-title-group p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 800px;
}

/* Buttons */
.btn {
  padding: 0.6rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  border: none;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-dark) 100%);
  color: #07080b;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-gold:hover {
  filter: brightness(1.15);
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.5);
  transform: translateY(-1px);
}

/* Section Card */
.section-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

.counter-badge {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  color: var(--text-muted);
}

.counter-match {
  background: var(--emerald-glow);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Material Selector Grid */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.material-card {
  background: rgba(22, 26, 38, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.material-card:hover {
  border-color: var(--border-gold);
  background: rgba(30, 35, 50, 0.8);
  transform: translateY(-2px);
}

.material-card.selected {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.1);
  box-shadow: inset 0 0 0 1px var(--gold-primary), 0 4px 15px rgba(212, 175, 55, 0.15);
}

.material-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.material-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}

.material-card.selected .material-name {
  color: var(--gold-light);
}

.material-check {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: transparent;
  transition: all 0.2s ease;
}

.material-card.selected .material-check {
  background: var(--gold-primary);
  border-color: var(--gold-primary);
  color: #000;
  font-weight: bold;
}

.material-alch {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  color: var(--gold-light);
  font-style: italic;
  margin-bottom: 0.25rem;
}

.material-formula {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #38bdf8;
  margin-bottom: 0.5rem;
}

.material-role {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Synthesis Results */
.synthesis-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.25rem;
}

.reaction-card {
  background: rgba(20, 24, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.reaction-card.can-synthesize {
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.12);
}

.reaction-card.cannot-synthesize {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.reaction-card.cannot-synthesize:hover {
  opacity: 0.9;
  filter: grayscale(0);
}

.reaction-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.status-ready {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-missing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.reaction-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.4rem;
}

.reaction-summary {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.ingredients-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.req-pill {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.req-have {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.req-lack {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.reaction-steps {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}

.reaction-steps h5 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--gold-primary);
  margin-bottom: 0.5rem;
  letter-spacing: 0.5px;
}

.reaction-steps ol {
  padding-left: 1.25rem;
  font-size: 0.825rem;
  color: var(--text-main);
}

.reaction-steps li {
  margin-bottom: 0.35rem;
}

.field-utility-box {
  margin-top: 0.75rem;
  background: rgba(212, 175, 55, 0.06);
  border-left: 3px solid var(--gold-primary);
  padding: 0.5rem 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8rem;
  color: #fef3c7;
}

/* Recipes Tab */
.search-filter-bar {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 280px;
  padding: 0.7rem 1.25rem;
  background: rgba(20, 24, 36, 0.8);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.9rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--gold-light);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.filter-select {
  padding: 0.7rem 1.25rem;
  background: rgba(20, 24, 36, 0.8);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  color: var(--gold-light);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold-light);
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.5rem;
}

.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all 0.25s ease;
}

.recipe-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold-glow);
  box-shadow: var(--shadow-gold);
}

.recipe-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.recipe-header h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: #fff;
  line-height: 1.3;
}

.recipe-badge {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  white-space: nowrap;
}

.recipe-meta-row {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.recipe-tria-prima {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.tria-line strong {
  color: var(--gold-light);
}

.recipe-steps-list {
  padding-left: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Codex Tab */
.codex-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.codex-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.codex-card.full-width {
  grid-column: span 2;
}

.codex-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--gold-primary);
  margin-bottom: 0.5rem;
}

.codex-card h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 1rem;
}

.opus-timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.opus-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.step-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.step-nigredo .step-marker { background: #262626; color: #fff; border: 1px solid #525252; }
.step-albedo .step-marker { background: #e5e7eb; color: #111; border: 1px solid #fff; }
.step-citrinitas .step-marker { background: #ca8a04; color: #fff; }
.step-rubedo .step-marker { background: #be123c; color: #fff; box-shadow: 0 0 10px rgba(190, 18, 60, 0.5); }

.opus-step h4 {
  font-size: 0.95rem;
  color: #fff;
  margin-bottom: 0.2rem;
}

.opus-step p {
  font-size: 0.825rem;
  color: var(--text-muted);
}

.tria-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
}

.tria-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.tria-symbol {
  font-size: 2rem;
  color: var(--gold-primary);
  margin-bottom: 0.5rem;
}

.tria-item h4 {
  font-size: 0.85rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.tria-item p {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.era-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.era-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: all 0.2s ease;
}

.era-box:hover {
  border-color: var(--gold-primary);
  transform: translateY(-2px);
}

.era-year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold-primary);
  font-weight: 700;
}

.era-box h4 {
  font-size: 0.95rem;
  color: #fff;
  margin: 0.25rem 0 0.4rem;
}

.era-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* GEM Prompt Tab */
.gem-workbench {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.5rem;
}

.gem-specs-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.spec-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.spec-card h4 {
  font-size: 0.9rem;
  color: var(--gold-light);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spec-list {
  list-style: none;
  font-size: 0.825rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.spec-list strong {
  color: #fff;
}

.layer-pill {
  font-size: 0.75rem;
  padding: 0.35rem 0.6rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.small-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.gem-code-viewer {
  background: #0d1117;
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.viewer-header {
  background: #161b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #fff;
}

.lang-tag {
  font-size: 0.7rem;
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.prompt-code-block {
  padding: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #e6edf3;
  overflow-y: auto;
  max-height: 650px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Library Tab */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.5rem;
}

.archive-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s ease;
}

.archive-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold-glow);
  box-shadow: var(--shadow-gold);
}

.archive-category {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gold-primary);
  letter-spacing: 0.5px;
}

.archive-card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: #fff;
}

.archive-meta {
  font-size: 0.8rem;
  color: #38bdf8;
}

.archive-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}

.archive-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--gold-light);
  text-decoration: none;
  margin-top: 0.5rem;
}

.archive-link-btn:hover {
  text-decoration: underline;
  color: #fff;
}

/* Master Footer */
.master-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2.5rem 2rem 2rem;
  text-align: center;
  margin-top: 4rem;
  background: #06070a;
}

.footer-container {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.footer-disclaimer-banner {
  background: rgba(245, 158, 11, 0.07);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 1rem 1.5rem;
  max-width: 820px;
  width: 100%;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.disclaimer-badge-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.disclaimer-icon {
  font-size: 1.05rem;
}

.disclaimer-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fbbf24;
}

.disclaimer-content {
  font-size: 0.85rem !important;
  color: #e2e8f0 !important;
  line-height: 1.55;
  margin: 0 !important;
}

.master-footer p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.master-footer strong {
  color: var(--gold-light);
}

.sub-credit {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

/* Universal Search Engine Styles */
.header-search {
  position: relative;
  min-width: 260px;
}

.header-search-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.2rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-gold);
  border-radius: 9999px;
  color: #fff;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  transition: all 0.25s ease;
}

.header-search-input:focus {
  outline: none;
  background: rgba(22, 26, 38, 0.9);
  border-color: var(--gold-light);
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.25);
}

.header-search-icon {
  position: absolute;
  left: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-primary);
  font-size: 0.85rem;
  pointer-events: none;
}

/* Search Hero */
.search-hero {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.08) 0%, rgba(16, 18, 27, 0.8) 100%);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.search-hero-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  color: #fff;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff 0%, var(--gold-light) 60%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-hero-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  max-width: 700px;
  margin: 0 auto 1.75rem;
}

.search-input-wrapper {
  position: relative;
  max-width: 820px;
  margin: 0 auto 1.25rem;
}

.main-search-input {
  width: 100%;
  padding: 1rem 1.5rem 1rem 3.25rem;
  font-size: 1.1rem;
  background: rgba(11, 13, 20, 0.95);
  border: 2px solid var(--border-gold);
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-sans);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.4);
  transition: all 0.25s ease;
}

.main-search-input:focus {
  outline: none;
  border-color: var(--gold-light);
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.35);
}

.main-search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.3rem;
  color: var(--gold-primary);
  pointer-events: none;
}

/* Category Filter Chips */
.search-filter-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.filter-chip {
  padding: 0.45rem 1rem;
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  border-color: var(--border-gold);
  color: var(--gold-light);
}

.filter-chip.active {
  background: rgba(212, 175, 55, 0.18);
  border-color: var(--gold-primary);
  color: var(--gold-light);
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.2);
}

/* Suggested Tag Chips */
.suggested-tags-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.tag-chip {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-chip:hover {
  background: rgba(212, 175, 55, 0.1);
  border-color: var(--gold-primary);
  color: var(--gold-light);
}

/* Search Results Area */
.search-results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.search-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 1.5rem;
}

.search-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.25s ease;
  cursor: pointer;
}

.search-result-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold-glow);
  box-shadow: var(--shadow-gold);
  background: var(--bg-card-hover);
}

.search-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.search-card-type {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.type-book { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; border: 1px solid rgba(99, 102, 241, 0.4); }
.type-recipe { background: rgba(212, 175, 55, 0.2); color: var(--gold-light); border: 1px solid var(--border-gold); }
.type-field { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.4); }
.type-concept { background: rgba(236, 72, 153, 0.2); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.4); }
.type-science { background: rgba(14, 165, 233, 0.2); color: #38bdf8; border: 1px solid rgba(14, 165, 233, 0.4); }

.search-card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: #fff;
  line-height: 1.3;
}

.search-card-author {
  font-size: 0.8rem;
  color: var(--gold-light);
  font-style: italic;
}

.search-card-snippet {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
}

.search-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.search-highlight {
  background: rgba(212, 175, 55, 0.35);
  color: #fff;
  padding: 0.1rem 0.25rem;
  border-radius: 2px;
  font-weight: 600;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: #0f111a;
  border: 1px solid var(--border-gold-glow);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(212, 175, 55, 0.2);
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-close-btn {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
  color: #f87171;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 0.35rem;
}

.modal-meta {
  font-size: 0.85rem;
  color: var(--gold-light);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.modal-body {
  font-size: 0.95rem;
  color: #e5e7eb;
  line-height: 1.7;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  white-space: pre-wrap;
}

.modal-citation {
  font-size: 0.8rem;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1rem;
}

/* =========================================================================
   LOCAL ALCHEMICAL LIBRARY & BOOK READER MODAL
   ========================================================================= */

.library-stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.lib-stat-chip {
  background: rgba(15, 19, 34, 0.85);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.lib-stat-icon {
  font-size: 2rem;
  line-height: 1;
}

.lib-stat-val {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-light);
}

.lib-stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.library-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.library-section-title h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: #fff;
}

.local-books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.local-book-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.local-book-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-gold-glow);
  box-shadow: var(--shadow-gold);
}

.local-book-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold-primary);
}

.local-book-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.local-book-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.local-book-author {
  font-size: 0.85rem;
  color: var(--gold-light);
  margin-top: 0.25rem;
}

.local-book-meta {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.local-book-summary {
  font-size: 0.88rem;
  color: #cbd5e1;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.local-book-chapters-preview {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.85rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

.local-book-chapters-preview strong {
  color: var(--gold-light);
}

.local-book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-read-book {
  flex: 1.2;
  min-width: 130px;
  background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-read-book:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.btn-open-file {
  flex: 1;
  min-width: 105px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 0.82rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-open-file:hover {
  background: rgba(212, 175, 55, 0.15);
  color: #fff;
  border-color: var(--gold-light);
}

/* In-App Full Book Reader Modal */
.reader-modal-content {
  background: #090c14;
  border: 1px solid var(--border-gold-glow);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(212, 175, 55, 0.25);
  width: 95vw;
  max-width: 1200px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.reader-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(15, 19, 32, 0.95);
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
}

.reader-book-title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: #fff;
  margin: 0.2rem 0;
  line-height: 1.25;
}

.reader-meta-line {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--text-dim);
}

.reader-stat-pill {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  padding: 0.15rem 0.5rem;
  border-radius: 12px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  font-size: 0.75rem;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: rgba(20, 25, 42, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.reader-tool-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.reader-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.reader-select {
  background: #0d111e;
  border: 1px solid var(--border-gold);
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  max-width: 260px;
  cursor: pointer;
}

.reader-search-box {
  background: #0d111e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  width: 100%;
}

.reader-search-box:focus {
  outline: none;
  border-color: var(--gold-light);
}

.reader-match-pill {
  font-size: 0.75rem;
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  white-space: nowrap;
}

.reader-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.reader-btn:hover {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--gold-light);
}

.reader-btn-action {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.reader-btn-action:hover {
  background: var(--gold-primary);
  color: #000;
}

.reader-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 3.5rem;
  background: #090c14;
  scroll-behavior: smooth;
}

.reader-typography {
  max-width: 860px;
  margin: 0 auto;
  color: #e2e8f0;
  line-height: 1.8;
  font-size: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Georgia, Cambria, "Times New Roman", Times, serif;
}

.reader-typography h1,
.reader-typography h2,
.reader-typography h3 {
  font-family: var(--font-serif);
  color: var(--gold-light);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 0.35rem;
}

.reader-highlight-match {
  background: #f59e0b;
  color: #000;
  font-weight: 700;
  padding: 0.1rem 0.25rem;
  border-radius: 2px;
}

.reader-footer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 2rem;
  background: rgba(15, 19, 32, 0.95);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.reader-file-path {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: #38bdf8;
}

/* Responsive */
@media (max-width: 1024px) {
  .codex-grid { grid-template-columns: 1fr; }
  .codex-card.full-width { grid-column: span 1; }
  .gem-workbench { grid-template-columns: 1fr; }
  .tria-grid { grid-template-columns: 1fr; }
  .search-results-grid { grid-template-columns: 1fr; }
  .local-books-grid { grid-template-columns: 1fr; }
  .reader-scroll-body { padding: 1.5rem; }
  .lab-workbench-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .header-container { flex-direction: column; align-items: flex-start; }
  .nav-tabs { padding: 0 1rem; }
  .main-content { padding: 0 1rem; }
  .material-grid, .recipes-grid, .synthesis-results, .library-grid, .search-results-grid, .local-books-grid {
    grid-template-columns: 1fr;
  }
  .reader-toolbar { flex-direction: column; align-items: stretch; }
  .reader-select { max-width: 100%; }
  .lab-operations-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   TEST LAB (ALCHEMICAL & CHEMICAL EXPERIMENTAL BENCH) STYLES
   ========================================================================= */
.lab-workbench-grid {
  display: grid;
  grid-template-columns: 1.15fr 1.25fr 1.1fr;
  gap: 1.25rem;
  align-items: start;
  margin-top: 1rem;
}

.lab-col {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-card);
}

.lab-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lab-card-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Column 1: Inventory & Catalog */
.lab-search-wrapper {
  margin-bottom: 0.5rem;
}

.lab-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.lab-category-chips .filter-chip {
  font-size: 0.72rem;
  padding: 0.25rem 0.6rem;
}

.lab-substances-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 720px;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.lab-substance-card {
  background: rgba(15, 19, 32, 0.85);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.lab-substance-card:hover {
  border-color: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.lab-sub-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.lab-sub-color-indicator {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.2);
}

.lab-sub-name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.lab-sub-name {
  font-size: 0.92rem;
  color: #fff;
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lab-sub-formula {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--gold-light);
}

.lab-sub-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.lab-sub-desc {
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.35;
  margin: 0;
}

.lab-sub-add-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.lab-amount-select {
  flex: 1;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
}

.btn-add-to-vessel {
  flex: 1.5;
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  white-space: nowrap;
}

.lab-hazard-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 700;
}
.hazard-3 { background: rgba(239, 68, 68, 0.25); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.5); }
.hazard-2 { background: rgba(245, 158, 11, 0.25); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.5); }
.hazard-1 { background: rgba(59, 130, 246, 0.25); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.5); }

/* Column 2: Reaction Vessel */
.lab-vessel-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.vessel-status-bar {
  display: flex;
  gap: 0.75rem;
}

.vessel-badge {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-sm);
}

.lab-vessel-contents {
  min-height: 120px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.vessel-empty-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 2rem 1rem;
}

.lab-vessel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
}

.lab-vessel-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lab-vessel-item-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lab-vessel-amount-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}

.btn-remove-vessel-item {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.2rem;
}

/* Parameters */
.lab-params-section {
  background: rgba(15, 19, 32, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lab-param-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #fff;
}

.lab-param-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lab-param-inputs input[type="range"] {
  flex: 1;
  accent-color: var(--gold-primary);
}

.lab-param-inputs input[type="number"] {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.5rem;
  font-family: var(--font-mono);
  text-align: center;
}

.temp-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.temp-preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.temp-preset-btn:hover {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border-color: var(--gold-light);
}

/* Operations Grid */
.lab-operations-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.lab-op-btn {
  background: rgba(15, 19, 32, 0.9);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-align: left;
  transition: all 0.2s ease;
}

.lab-op-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.15);
}

.lab-op-btn .op-icon {
  font-size: 1.4rem;
}

.lab-op-btn strong {
  display: block;
  font-size: 0.85rem;
  line-height: 1.2;
}

.lab-op-btn small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.op-mix { border-color: rgba(56, 189, 248, 0.5); background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(15, 19, 32, 0.9)); }
.op-heat { border-color: rgba(245, 158, 11, 0.5); background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(15, 19, 32, 0.9)); }
.op-distill { border-color: rgba(168, 85, 247, 0.5); background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(15, 19, 32, 0.9)); }
.op-calcine { border-color: rgba(239, 68, 68, 0.5); background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(15, 19, 32, 0.9)); }
.op-filter { border-color: rgba(16, 185, 129, 0.5); background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(15, 19, 32, 0.9)); }
.op-ferment { border-color: rgba(234, 179, 8, 0.5); background: linear-gradient(135deg, rgba(234, 179, 8, 0.15), rgba(15, 19, 32, 0.9)); }
.op-spagyric { border-color: rgba(212, 175, 55, 0.7); background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(15, 19, 32, 0.9)); grid-column: span 2; }

/* Column 3: Results & History */
.lab-result-card {
  background: rgba(15, 19, 32, 0.95);
  border: 1px solid var(--border-gold-glow);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  box-shadow: 0 0 25px rgba(212, 175, 55, 0.15);
}

.lab-result-desc {
  font-size: 0.85rem;
  color: #fff;
  line-height: 1.45;
  margin: 0.75rem 0;
}

.lab-result-section {
  margin-top: 0.75rem;
}

.lab-result-section h5 {
  font-size: 0.82rem;
  color: var(--gold-light);
  margin: 0 0 0.4rem 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lab-products-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.lab-product-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
}

.lab-gases-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.lab-gas-pill {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 12px;
  font-family: var(--font-mono);
}

.lab-safety-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

.lab-alchemical-box {
  background: rgba(212, 175, 55, 0.06);
  border-left: 3px solid var(--gold-primary);
  padding: 0.6rem 0.8rem;
  margin-top: 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.lab-alchemical-box strong {
  font-size: 0.78rem;
  color: var(--gold-light);
  display: block;
  margin-bottom: 0.2rem;
}

.lab-alchemical-box p {
  font-size: 0.8rem;
  color: var(--text-dim);
  font-style: italic;
  margin: 0;
  line-height: 1.35;
}

/* Suggestions & History */
.lab-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 250px;
  overflow-y: auto;
}

.lab-suggestion-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  transition: all 0.2s ease;
}

.lab-suggestion-card:hover {
  border-color: var(--gold-light);
  background: rgba(212, 175, 55, 0.05);
}

.lab-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 200px;
  overflow-y: auto;
}

.lab-history-item {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
}

/* Custom Modal & Formulation Builder */
.custom-modal-card {
  background: #090c14;
  border: 1px solid var(--border-gold-glow);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(212, 175, 55, 0.25);
  width: 90vw;
  max-width: 860px;
  overflow: hidden;
  position: relative;
}

.custom-ingredient-row {
  display: grid;
  grid-template-columns: 2fr 110px 110px 120px 36px;
  gap: 0.5rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.6rem;
  transition: all 0.2s ease;
}

.custom-ingredient-row:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(212, 175, 55, 0.3);
}

.ingredient-computed-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--gold-light);
  background: rgba(0, 0, 0, 0.4);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  text-align: center;
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.btn-remove-ingredient {
  background: transparent;
  border: none;
  color: #f87171;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.2rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-remove-ingredient:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* Residue Transfer Button */
.btn-transfer-residue {
  background: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.2rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1rem;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
  transition: all 0.2s ease;
}

.btn-transfer-residue:hover {
  background: linear-gradient(135deg, #fcd34d 0%, #d4af37 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

/* Load More Button in Catalog */
.lab-load-more-container {
  grid-column: 1 / -1;
  text-align: center;
  padding: 1rem 0;
}

.lab-load-more-btn {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid var(--gold-main);
  color: var(--gold-light);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lab-load-more-btn:hover {
  background: var(--gold-main);
  color: #000;
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}

/* ========================================================================= */
/* SEPARATION PROTOCOL & PURIFICATION SYNTHESIS UI                           */
/* ========================================================================= */
.vessel-separation-banner {
  width: 100%;
}

.btn-separation-recipe {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(212, 175, 55, 0.15) 100%);
  border: 1px solid rgba(20, 184, 166, 0.5);
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-separation-recipe:hover {
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.28) 0%, rgba(212, 175, 55, 0.28) 100%);
  border-color: var(--teal-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}

.separation-btn-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-align: left;
}

.separation-icon {
  font-size: 1.35rem;
  filter: drop-shadow(0 0 4px rgba(45, 212, 191, 0.6));
}

.separation-btn-content strong {
  display: block;
  font-size: 0.86rem;
  color: #38bdf8;
  letter-spacing: 0.02em;
}

.separation-btn-content small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.separation-badge-flash {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(45, 212, 191, 0.2);
  border: 1px solid #2dd4bf;
  color: #2dd4bf;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Modal Separation Card */
.separation-modal-card {
  border-color: rgba(45, 212, 191, 0.4) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(20, 184, 166, 0.2) !important;
}

.separation-overview-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-gold-subtle);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
}

.thermo-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.thermo-table th {
  background: rgba(0, 0, 0, 0.5);
  color: var(--gold-light);
  padding: 0.45rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(212, 175, 55, 0.3);
  font-weight: 600;
  font-family: var(--font-serif);
}

.thermo-table td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-light);
}

.thermo-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.separation-route-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-sm);
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: all 0.2s ease;
}

.separation-route-card:hover {
  border-color: rgba(212, 175, 55, 0.6);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.separation-route-card.primary-route {
  border-color: #2dd4bf;
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.08) 0%, rgba(15, 23, 42, 0.95) 100%);
}

.separation-method-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.separation-method-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: #fff;
  margin: 0 0 0.2rem 0;
}

.separation-delta-box {
  background: rgba(0, 0, 0, 0.45);
  border-left: 3px solid #2dd4bf;
  padding: 0.5rem 0.75rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.82rem;
  color: #93c5fd;
}

.separation-procedure-list {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.84rem;
  color: var(--text-light);
  line-height: 1.55;
}

.separation-procedure-list li {
  margin-bottom: 0.35rem;
}

.separation-procedure-list strong {
  color: #fde047;
}

.fraction-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.fraction-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.fraction-card-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.fraction-card-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
}

.fraction-card-meta {
  font-size: 0.78rem;
  color: var(--teal-light);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

.separation-alchemical-box {
  font-style: italic;
  font-size: 0.78rem;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.08);
  border: 1px dashed rgba(212, 175, 55, 0.3);
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-apply-separation {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1.25rem;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px rgba(13, 148, 136, 0.35);
}

.btn-apply-separation:hover {
  background: linear-gradient(135deg, #14b8a6 0%, #2dd4bf 100%);
  color: #042f2e;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.5);
}

/* ========================================================================= */
/* CHEMINFORMATICS & MOLECULAR COMPUTATION UI                                 */
/* ========================================================================= */
.pressure-preset-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-muted);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pressure-preset-btn:hover {
  border-color: #38bdf8;
  color: #fff;
}

.pressure-preset-btn.active {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

.cheminfo-modal-card {
  border-color: rgba(56, 189, 248, 0.4) !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 35px rgba(56, 189, 248, 0.25) !important;
}

.cheminfo-tabs-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border-gold-subtle);
  overflow-x: auto;
  padding: 0 0.5rem;
}

.cheminfo-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.cheminfo-tab-btn:hover {
  color: #fff;
}

.cheminfo-tab-btn.active {
  color: #38bdf8;
  border-bottom-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

/* QSPR Lipinski Grid */
.qspr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.65rem;
}

.qspr-stat-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
  text-align: center;
}

.qspr-stat-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: #38bdf8;
  font-family: var(--font-mono);
}

.qspr-stat-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.druglike-meter {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.druglike-meter-fill {
  height: 100%;
  transition: width 0.4s ease;
}

/* Hansen Sphere Card */
.hansen-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.hansen-pair-row {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* DDI Cards */
.ddi-alert-card {
  background: rgba(15, 23, 42, 0.9);
  border-left: 4px solid #38bdf8;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 0.85rem 1rem;
}

.ddi-alert-card.severity-fatal {
  border-left-color: #ef4444;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.15) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.ddi-alert-card.severity-critical {
  border-left-color: #f97316;
  background: linear-gradient(90deg, rgba(249, 115, 22, 0.12) 0%, rgba(15, 23, 42, 0.9) 100%);
}

.ddi-alert-card.severity-synergistic {
  border-left-color: #10b981;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12) 0%, rgba(15, 23, 42, 0.9) 100%);
}

/* Chemfiles Export Grid */
.chemfiles-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.85rem;
}

.chemfiles-format-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chemfiles-code-box {
  background: #020617;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #c084fc;
  max-height: 120px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-chemfiles-download {
  background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-chemfiles-download:hover {
  background: linear-gradient(135deg, #9333ea 0%, #c084fc 100%);
  transform: translateY(-1px);
}

/* DB Registry Grid */
.db-registry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.db-registry-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* Guided Wizard & Dictionary Styles */
.wizard-modal-card, .dict-modal-card {
  box-shadow: 0 10px 50px rgba(0, 0, 0, 0.9), 0 0 35px rgba(20, 184, 166, 0.2);
}

.wizard-step-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.wizard-input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.wizard-result-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(20, 184, 166, 0.3);
  border-radius: var(--radius-sm);
  padding: 1rem;
}

.wizard-result-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.wizard-stat-chip {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
}

.wizard-stat-chip .stat-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--teal-light);
  display: block;
}

.wizard-stat-chip .stat-lbl {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.btn-wizard-apply {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: #000;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn-wizard-apply:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.dict-card-item {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transition: all 0.2s ease;
}

.dict-card-item:hover {
  border-color: rgba(192, 132, 252, 0.4);
  background: rgba(20, 25, 45, 0.9);
}

/* =========================================================================
   TEST LAB 1000 & NLM RXNORM EXPLORER STYLES
   ========================================================================= */
.rxnorm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem;
  margin-top: 1rem;
}

.rxnorm-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
}

.rxnorm-card:hover {
  transform: translateY(-2px);
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(56, 189, 248, 0.15);
  background: rgba(17, 27, 49, 0.95);
}

.rxnorm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.rxnorm-rxcui-badge {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.rxnorm-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rxnorm-badge.atc-badge {
  background: rgba(168, 85, 247, 0.15);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #c084fc;
}

.rxnorm-badge.tty-in {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.rxnorm-badge.tty-pin {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
}

.rxnorm-card-title {
  color: #f8fafc;
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.2rem 0;
  line-height: 1.3;
}

.rxnorm-card-latin {
  color: #94a3b8;
  font-size: 0.82rem;
  font-style: italic;
  font-family: serif;
}

.rxnorm-card-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  gap: 0.5rem;
}

.btn-rxnorm-action {
  flex: 1;
  padding: 0.45rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-align: center;
}

.btn-rxnorm-action.btn-add-vessel {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.3));
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
}

.btn-rxnorm-action.btn-add-vessel:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35), rgba(5, 150, 105, 0.5));
  border-color: #10b981;
  color: #fff;
  transform: translateY(-1px);
}

.btn-rxnorm-action.btn-show-details {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

.btn-rxnorm-action.btn-show-details:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.rxnorm-filter-chip {
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.rxnorm-filter-chip:hover {
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  border-color: rgba(56, 189, 248, 0.3);
}

.rxnorm-filter-chip.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.25), rgba(14, 165, 233, 0.35));
  border-color: #38bdf8;
  color: #e0f2fe;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.2);
}





