/* ================================ */
/* MolMin — Main App       */
/* Requires: base.css               */
/* ================================ */

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 60px;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-icon {
  width: 32px;
  height: 32px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 3rem 0 1.5rem;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.hero-sub {
  color: var(--text-secondary);
  font-size: 1.25rem;
  margin-bottom: 2rem;
  padding: 0 2rem;
}

/* The search-container's left edge aligns with the main content area below
   (.search-layout > .content). That alignment is achieved by matching
   .search-layout's 1600px wrapper and then padding-left the width of the
   sidebar (260px) plus .content's own left padding (1.5rem).
   box-sizing: border-box is set explicitly because the sheet doesn't set it
   globally — without it the padding would push past the 1600px max-width. */
.search-container {
  display: flex;
  gap: 0.75rem;
  max-width: 1600px;
  margin: 0 auto;
  padding-left: calc(260px + 1.5rem);
  padding-right: 1.5rem;
  box-sizing: border-box;
}

/* Search bar stays anchored in its original position regardless of whether
   the filter sidebar is open or collapsed — it does not extend leftward
   when the sidebar closes. */

.search-box {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 1.25rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-box input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 1.05rem 0.75rem;
}

.search-box input::placeholder {
  color: var(--text-muted);
  font-family: var(--font);
}

.search-clear {
  display: none;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}

.search-clear.visible {
  display: block;
}

.search-clear:hover {
  color: var(--text-primary);
}

.btn-filter {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  padding: 0 0.9rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-filter:hover,
.btn-filter.active {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-structure {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  padding: 0 1.2rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-structure:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Inline "Structure" pill — sits inside the search-box, next to the clear × */
.search-box .btn-structure {
  padding: 0.35rem 0.75rem;
  margin-left: 0.25rem;
  font-size: 0.85rem;
  border-radius: 999px;                  /* pill */
  background: var(--bg-secondary);       /* subtle contrast against search-box bg */
  border: 1px solid var(--border);
  color: var(--text-secondary);
  gap: 0.35rem;
  flex-shrink: 0;                        /* don't let the input squeeze it away */
}

.search-box .btn-structure:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-tertiary);
}

.search-box .btn-structure svg {
  width: 14px;
  height: 14px;
}

/* Search button */
.btn-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: #fff;
  padding: 0 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  position: relative;
}

.btn-search:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 0 16px rgba(99,102,241,0.3);
}

.btn-search:active {
  transform: scale(0.97);
}

.btn-search:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-search-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-search.searching .btn-search-icon {
  display: none;
}

.btn-search.searching .btn-search-spinner {
  display: block;
}

.btn-search.searching span {
  display: none;
}

.btn-search.searching::after {
  content: 'Searching...';
  font-size: 0.85rem;
  font-weight: 500;
}

/* ======================== */
/* Search Layout: Sidebar + Content */
/* ======================== */
.search-layout {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  padding: 0;
  min-height: 60vh;
}

/* ── Filter Sidebar (SciFinder-style) ── */
.filter-sidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.25s ease, min-width 0.25s ease, opacity 0.25s ease;
  z-index: 10;
}

.filter-sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  border-right: none;
  opacity: 0;
}

.filter-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.2rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.filter-sidebar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.filter-sidebar-collapse {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.filter-sidebar-collapse:hover {
  color: var(--text-primary);
}

.filter-sidebar-body {
  padding: 0;
}

/* ── Filter Accordion (SciFinder-style) ── */
.filter-accordion {
  border-bottom: 1px solid var(--border);
}

.filter-accordion-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0.85rem 1.2rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.filter-accordion-toggle:hover {
  background: var(--bg-tertiary);
}

.filter-accordion-chevron {
  flex-shrink: 0;
  transition: transform 0.25s ease;
  color: var(--text-muted);
}

/* Collapsed: chevron points right */
.filter-accordion:not(.open) .filter-accordion-chevron {
  transform: rotate(-90deg);
}

/* Open: chevron points down (default SVG direction) */
.filter-accordion.open .filter-accordion-chevron {
  transform: rotate(0deg);
}

.filter-accordion-body {
  display: none;
  padding: 0 1.2rem;
}

.filter-accordion.open .filter-accordion-body {
  display: block;
  padding: 0 1.2rem 0.85rem;
}

/* ── Dual-range slider ── */
.dual-range {
  position: relative;
  height: 24px;
  margin-top: 0.5rem;
}

.dual-range input[type="range"] {
  position: absolute;
  width: 100%;
  height: 0;
  top: 10px;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  background: none;
  outline: none;
  margin: 0;
  padding: 0;
}

.dual-range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
  pointer-events: all;
  position: relative;
  z-index: 2;
  transition: transform 0.15s, box-shadow 0.15s;
}

.dual-range input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.dual-range input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.25);
  cursor: pointer;
  pointer-events: all;
  position: relative;
  z-index: 2;
}

.dual-range-track {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.dual-range-fill {
  position: absolute;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.5;
}

.filter-accordion-body .range-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.filter-accordion-body .range-sep {
  color: var(--text-muted);
}

.filter-accordion-body .range-inputs input,
.filter-accordion-body select {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.5rem 0.6rem;
  font-size: 0.85rem;
  font-family: var(--mono);
  outline: none;
  transition: border-color 0.2s;
}

.filter-accordion-body .range-inputs input:focus,
.filter-accordion-body select:focus {
  border-color: var(--border-focus);
}

/* Hide native spinner arrows on number inputs inside the filter sidebar.
   Applies to MW, Boiling, Melting, HOMO, LUMO, Rings — any <input type="number">
   inside .filter-accordion-body. Chromium/WebKit uses the pseudo-elements;
   Firefox and the standard spec use `appearance: textfield`. */
.filter-accordion-body input[type="number"]::-webkit-inner-spin-button,
.filter-accordion-body input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.filter-accordion-body input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.filter-accordion-body select {
  font-family: var(--font);
  cursor: pointer;
}

/* Elements filter — grid of toggleable element chips */
.filter-element-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.filter-element-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}

.filter-element-chip input {
  /* checkbox is semantic-only; visual state driven by :has() on the label */
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.filter-element-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-element-chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
}

.filter-sidebar-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
}

.filter-sidebar-actions .btn-apply {
  flex: 1;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
}

.filter-sidebar-actions .btn-apply:hover {
  background: var(--accent-hover);
}

.filter-sidebar-actions .btn-reset {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-sidebar-actions .btn-reset:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ── Main Content Area ── */
.content {
  flex: 1;
  min-width: 0;
  padding: 1.2rem 1.5rem 3rem;
}

.results-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.results-bar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sort-control label {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.sort-control select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* View toggle (card / table) */
.view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 0.55rem;
  cursor: pointer;
  transition: all 0.2s;
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--border);
}

.per-page-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.per-page-select select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* ======================== */
/* Molecule Card Grid       */
/* SciFinder-style layout   */
/* ======================== */
.mol-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.mol-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.mol-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .mol-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .mol-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* ── Card header row: checkbox + number + three-dot menu ── */
.mol-card-header {
  display: flex;
  align-items: center;
  padding: 0.4rem 0.65rem 0;
  gap: 0.4rem;
}

.mol-card-num {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  flex: 1;
}

/* ── CAS row: CAS number + substance/save icon ── */
.mol-card-cas-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.1rem 0.65rem 0.05rem;
}

.mol-card-cas {
  font-family: var(--font);
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a3c6e;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

[data-theme="dark"] .mol-card-cas {
  color: #7aa2f7;
}

.mol-card-cas-empty {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.88rem;
  font-style: italic;
}

.mol-card-substance-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  color: var(--text-muted);
  transition: color 0.15s, transform 0.15s;
  flex-shrink: 0;
  opacity: 0;
}

.mol-card:hover .mol-card-substance-icon {
  opacity: 0.5;
}

.mol-card:hover .mol-card-substance-icon:hover {
  opacity: 1;
  color: var(--amber);
}

.mol-card-substance-icon.active {
  opacity: 1 !important;
  color: var(--amber);
}

.mol-card-substance-icon.active svg {
  fill: var(--amber);
  stroke: var(--amber);
}

[data-theme="light"] .mol-card-substance-icon.active {
  color: #ff9500;
}

[data-theme="light"] .mol-card-substance-icon.active svg {
  fill: #ff9500;
  stroke: #ff9500;
}

/* ── Three-dot "Add to Project" menu ── */
.mol-card-menu-wrap {
  position: relative;
  flex-shrink: 0;
}

.mol-card-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  color: var(--text-muted);
  border-radius: 4px;
  transition: color 0.15s, background 0.15s, opacity 0.15s;
  opacity: 0;
}

.mol-card:hover .mol-card-menu-btn {
  opacity: 0.5;
}

.mol-card:hover .mol-card-menu-btn:hover,
.mol-card-menu-btn.active {
  opacity: 1;
  color: var(--text);
  background: var(--bg-input);
}

.mol-card-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 60;
  min-width: 148px;
  max-width: 185px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.10);
  overflow: hidden;
  animation: cardMenuIn 0.15s ease;
}

[data-theme="light"] .mol-card-menu-dropdown {
  box-shadow: 0 8px 24px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
}

.mol-card-menu-dropdown.open {
  display: block;
}

@keyframes cardMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.mol-card-menu-header {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.55rem 0.75rem 0.3rem;
  border-bottom: 1px solid var(--border);
  user-select: none;
}

.mol-card-menu-body {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.3rem 0;
  scrollbar-width: thin;
}

.mol-card-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 0.84rem;
  font-family: inherit;
  text-align: left;
  transition: background 0.12s;
}

.mol-card-menu-item:hover {
  background: var(--bg-input);
}

.mol-card-menu-item svg:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
}

.mol-card-menu-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mol-card-menu-item-check {
  opacity: 0;
  color: var(--green, #22c55e);
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.mol-card-menu-item.added .mol-card-menu-item-check {
  opacity: 1;
}

.mol-card-menu-item.added {
  color: var(--text-muted);
  pointer-events: none;
}

.mol-card-menu-item.added svg:first-child {
  color: var(--green, #22c55e);
}

.mol-card-menu-item.adding {
  opacity: 0.5;
  pointer-events: none;
}

/* Loading & empty states */
.mol-card-menu-loading,
.mol-card-menu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.mol-card-menu-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent, #6366f1);
  border-radius: 50%;
  animation: menuSpin 0.6s linear infinite;
}

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

.mol-card-menu-create {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent, #6366f1);
  text-decoration: none;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--accent, #6366f1);
  border-radius: 5px;
  transition: background 0.15s, color 0.15s;
}

.mol-card-menu-create:hover {
  background: var(--accent, #6366f1);
  color: #fff;
}

/* ── 2D structure canvas ── */
.mol-card-structure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 0.1rem 0.65rem;
  flex: 1;
}

.mol-card-structure canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* In light mode, invert the dark-theme drawing so bonds appear black */
[data-theme="light"] .mol-card-structure canvas,
[data-theme="light"] .detail-structure canvas,
[data-theme="light"] .cmp-card-canvas,
[data-theme="light"] .cmp-structure-canvas {
  filter: invert(1) hue-rotate(180deg);
}

.mol-card-structure-error {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* ── Formula + group name ── */
.mol-card-info {
  padding: 0.05rem 0.65rem 0.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.mol-card-formula {
  font-family: var(--font);
  font-size: 1.05rem;
  color: var(--text-primary);
  font-weight: 700;
  line-height: 1.4;
}

.mol-card-formula sub {
  font-size: 0.75em;
}

.mol-card-group {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.3;
  font-style: italic;
}

/* ── Property detail rows (basic info text) ── */
.mol-card-detail-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0 0.65rem;
  margin-bottom: 0.05rem;
}

.mol-card-detail-row:last-child {
  margin-bottom: 0;
  padding-bottom: 0.45rem;
}

.mol-card-detail {
  font-size: 0.84rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-family: var(--font);
}

.mol-card-detail-label {
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.2rem;
  font-size: 0.82rem;
}

/* Allow text selection on card data */
.mol-card-cas,
.mol-card-formula,
.mol-card-detail {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

/* Card appear animation */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.mol-card {
  animation: cardIn 0.25s ease backwards;
}

.mol-card:nth-child(1)  { animation-delay: 0.02s; }
.mol-card:nth-child(2)  { animation-delay: 0.04s; }
.mol-card:nth-child(3)  { animation-delay: 0.06s; }
.mol-card:nth-child(4)  { animation-delay: 0.08s; }
.mol-card:nth-child(5)  { animation-delay: 0.10s; }
.mol-card:nth-child(6)  { animation-delay: 0.12s; }
.mol-card:nth-child(7)  { animation-delay: 0.14s; }
.mol-card:nth-child(8)  { animation-delay: 0.16s; }
.mol-card:nth-child(9)  { animation-delay: 0.18s; }


/* ======================== */
/* Table (legacy view)      */
/* ======================== */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
}

.mol-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.mol-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.mol-table th {
  background: var(--bg-tertiary);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.mol-table th.num {
  text-align: right;
}

.mol-table th.sortable {
  cursor: pointer;
  transition: color 0.2s;
}

.mol-table th.sortable:hover {
  color: var(--accent);
}

.mol-table th.sorted-asc::after {
  content: ' ▲';
  font-size: 0.7rem;
  color: var(--accent);
}

.mol-table th.sorted-desc::after {
  content: ' ▼';
  font-size: 0.7rem;
  color: var(--accent);
}

.mol-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.mol-table tbody tr {
  transition: background 0.15s;
  cursor: pointer;
}

.mol-table tbody tr:hover {
  background: var(--surface);
}

.mol-table tbody tr:last-child td {
  border-bottom: none;
}

td.num {
  text-align: right;
  font-family: var(--mono);
  font-size: 0.85rem;
}

td.smiles-cell {
  font-family: var(--mono);
  font-size: 0.85rem;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
}

td.formula-cell {
  font-family: var(--mono);
  font-size: 0.88rem;
}

td.cas-cell {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.group-badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.15rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state p {
  margin-top: 1rem;
  font-size: 1.05rem;
}

/* Loading */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

/* @keyframes spin — see base.css */

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.pagination button {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: default;
}

.pagination .page-ellipsis {
  color: var(--text-muted);
  padding: 0 0.3rem;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--modal-overlay);
  backdrop-filter: blur(4px);
  justify-content: center;
  align-items: center;
}

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

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  position: relative;
  box-shadow: var(--shadow);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 0.8rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body h2 {
  font-size: 1.3rem;
  margin-bottom: 1.2rem;
  color: var(--text-primary);
}

/* Change Password modal */
.modal-pw {
  max-width: 420px;
}

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

.pw-field-row {
  display: flex;
  gap: 0.75rem;
}

.pw-field-row .pw-field {
  flex: 1;
  min-width: 0;
}

.pw-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.pw-field input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 0.92rem;
  padding: 0.7rem 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pw-field input::placeholder {
  color: var(--text-muted);
}

.pw-field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pw-msg {
  font-size: 0.85rem;
  min-height: 1.2em;
  text-align: center;
}

.pw-msg.error { color: var(--red); }
.pw-msg.success { color: var(--green); }

.pw-submit {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.5rem;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.pw-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.pw-submit:active {
  transform: translateY(0);
}

.pw-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Request Molecule modal */
.req-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.25rem 0 1rem;
  line-height: 1.5;
}

.req-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.25rem 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.req-divider::before,
.req-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.detail-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}

.detail-item.wide {
  grid-column: span 2;
}

.detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.detail-value {
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-primary);
}

.detail-value.mono {
  font-family: var(--mono);
  font-size: 0.95rem;
  word-break: break-all;
  color: var(--accent);
}

.detail-structure-wrap {
  margin-bottom: 1rem;
}

.detail-structure {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.detail-structure canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.detail-structure-error {
  color: var(--red);
  font-size: 0.9rem;
  margin: 0;
}

/* Structure editor modal */
.modal-structure {
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.modal-structure .modal-close {
  top: 0.5rem;
  right: 0.5rem;
}

.structure-modal-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.structure-modal-header h2 {
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

.structure-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.structure-load {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}

.structure-input {
  flex: 1;
  min-width: 180px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.88rem;
  outline: none;
}

.structure-input:focus {
  border-color: var(--border-focus);
}

.structure-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-structure-action {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-structure-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-structure-action.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-structure-action.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.structure-current-smiles {
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  word-break: break-all;
}

.structure-current-smiles.error {
  color: var(--red);
}

.structure-iframe-wrap {
  flex: 1;
  min-height: 400px;
  padding: 1rem 1.5rem;
  overflow: hidden;
}

.structure-iframe-wrap iframe {
  width: 100%;
  height: 100%;
  min-height: 450px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
}

/* ======================== */
/* Intro Section            */
/* ======================== */
.intro {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 2rem 4rem;
  gap: 2rem;
}

.intro-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

/* Molecular Universe canvas animation (injected by intro-animation.js) */
.intro-mol-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none; /* let mouse events pass through to .intro for tracking */
}

/* The .intro section captures mouse for the canvas repulsion effect */
.intro {
  cursor: default;
}

.intro-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black 30%, transparent 100%);
}

.intro-particle {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.2;
  animation: introFloat 12s ease-in-out infinite alternate;
}

.intro-particle.p1 {
  width: 300px; height: 300px;
  background: rgba(99,102,241,0.15);
  top: 10%; left: 15%;
  animation-delay: 0s;
}

.intro-particle.p2 {
  width: 250px; height: 250px;
  background: rgba(139,92,246,0.12);
  top: 50%; right: 10%;
  animation-delay: -3s;
}

.intro-particle.p3 {
  width: 200px; height: 200px;
  background: rgba(167,139,250,0.1);
  bottom: 15%; left: 30%;
  animation-delay: -6s;
}

.intro-particle.p4 {
  width: 150px; height: 150px;
  background: rgba(99,102,241,0.1);
  top: 20%; right: 30%;
  animation-delay: -2s;
}

.intro-particle.p5 {
  width: 180px; height: 180px;
  background: rgba(139,92,246,0.08);
  bottom: 30%; right: 25%;
  animation-delay: -8s;
}

@keyframes introFloat {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.1); }
}

.intro-content {
  position: relative;
  z-index: 2;
  max-width: 580px;
  animation: introFadeUp 1s ease both;
}

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

.intro-title {
  font-size: 3.8rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.intro-title .intro-line {
  display: block;
}

/* .intro-title .accent — see base.css */

.intro-stats-row {
  display: flex;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.intro-stat {
  display: flex;
  flex-direction: column;
}

.intro-stat-val {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--mono);
}

.intro-stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 0.15rem;
}

.intro-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.85rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 24px rgba(99,102,241,0.25);
}

.intro-cta:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 36px rgba(99,102,241,0.4);
  transform: translateY(-2px);
}

.intro-cta svg {
  animation: ctaBounce 2s ease-in-out infinite;
}

@keyframes ctaBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* Molecule visualization */
.intro-molecule-viz {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  animation: introFadeUp 1s ease 0.3s both;
}

.intro-mol-svg {
  width: 340px;
  height: 340px;
}

.mol-atom {
  fill: var(--accent);
  filter: drop-shadow(0 0 6px rgba(99,102,241,0.5));
}

.mol-atom.a1 { fill: #6366f1; animation: atomPulse 3s ease-in-out infinite; }
.mol-atom.a2 { fill: #7c3aed; animation: atomPulse 3s ease-in-out 0.5s infinite; }
.mol-atom.a3 { fill: #8b5cf6; animation: atomPulse 3s ease-in-out 1s infinite; }
.mol-atom.a4 { fill: #a78bfa; animation: atomPulse 3s ease-in-out 1.5s infinite; }
.mol-atom.a5 { fill: #6366f1; animation: atomPulse 3s ease-in-out 2s infinite; }
.mol-atom.a6 { fill: #8b5cf6; animation: atomPulse 3s ease-in-out 2.5s infinite; }

@keyframes atomPulse {
  0%, 100% { r: 10; opacity: 1; }
  50% { r: 13; opacity: 0.85; }
}

.mol-glow {
  fill: none;
  stroke: rgba(99,102,241,0.2);
  stroke-width: 1;
  animation: glowPulse 4s ease-in-out infinite;
}

.mol-glow.g2 { animation-delay: -2s; }

@keyframes glowPulse {
  0%, 100% { r: 22; stroke-opacity: 0.2; }
  50% { r: 30; stroke-opacity: 0.5; }
}

.mol-bond {
  animation: bondPulse 4s ease-in-out infinite;
}

.mol-bond.b1 { animation-delay: 0s; }
.mol-bond.b2 { animation-delay: 0.3s; }
.mol-bond.b3 { animation-delay: 0.6s; }
.mol-bond.b4 { animation-delay: 0.9s; }
.mol-bond.b5 { animation-delay: 1.2s; }
.mol-bond.b6 { animation-delay: 1.5s; }
.mol-bond.b7 { animation-delay: 1.8s; }
.mol-bond.b8 { animation-delay: 2.1s; }

@keyframes bondPulse {
  0%, 100% { stroke-opacity: 0.3; }
  50% { stroke-opacity: 0.7; }
}

/* ======================== */
/* Nav links                */
/* ======================== */
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--accent);
}

/* Navbar dropdown (Features & Account) */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.6;
  padding: 0;
  cursor: pointer;
  transition: color 0.2s;
  position: relative;
}

.nav-dropdown-btn:hover,
.nav-dropdown.open .nav-dropdown-btn {
  color: var(--accent);
}

.nav-dropdown-caret {
  transition: transform 0.2s;
}

.nav-dropdown.open .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 210px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--dropdown-shadow);
  z-index: 150;
  overflow: hidden;
  animation: dropdownIn 0.15s ease;
}

#navFeatures .nav-dropdown-menu {
  min-width: 160px;
  right: -40px;
}

/* Invisible bridge to cover gap between button and menu */
.nav-dropdown-menu::before {
  content: "";
  position: absolute;
  top: -0.6rem;
  left: 0;
  right: 0;
  height: 0.6rem;
}

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

.nav-dropdown.open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  transition: all 0.15s;
}

.nav-dropdown-menu a:hover {
  background: var(--surface);
  color: var(--text-primary);
}

.nav-dropdown-menu a.nav-menu-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

.nav-menu-soon {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

/* Account info header (Account dropdown only) */
.nav-account-info {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.nav-account-info .account-greeting {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.92rem;
}

.nav-account-info .account-email {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.nav-menu-signout {
  border-top: 1px solid var(--border);
  margin-top: 0.2rem;
}

.nav-menu-signout:hover {
  color: var(--red) !important;
}

/* ========== Notification Bell (standalone dropdown) ========== */
.nav-notif-dropdown {
  position: relative;
}

.nav-notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.nav-notif-btn:hover {
  color: var(--text-primary);
}

.nav-notif-badge {
  position: absolute;
  top: 0;
  right: -2px;
  background: var(--red);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  min-width: 15px;
  height: 15px;
  line-height: 15px;
  text-align: center;
  border-radius: 8px;
  padding: 0 3px;
  font-family: var(--mono);
  pointer-events: none;
}

.nav-notif-panel {
  min-width: 300px;
  max-height: 420px;
  flex-direction: column;
  right: -70px;
  padding: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}

.nav-notif-dropdown.open .nav-notif-panel {
  display: flex;
}

/* Header */
.nav-notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.4rem;
}

.nav-notif-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.nav-notif-header-actions {
  display: flex;
  gap: 0.3rem;
}

.nav-notif-mark-all,
.nav-notif-clear-all {
  background: var(--surface);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.nav-notif-mark-all:hover {
  color: var(--accent);
  background: var(--accent-glow);
}

.nav-notif-clear-all:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

/* Item delete button */
.nav-notif-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
  margin-top: 10px;
}

.nav-notif-item:hover .nav-notif-delete {
  opacity: 1;
}

.nav-notif-delete:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

/* Tabs */
.nav-notif-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem 1rem 0.55rem;
}

.nav-notif-tab {
  background: var(--surface);
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
}

.nav-notif-tab:hover {
  background: var(--border);
  color: var(--text-primary);
}

.nav-notif-tab.active {
  background: var(--accent);
  color: #fff;
}

/* List */
.nav-notif-list {
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Item */
.nav-notif-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  position: relative;
  border-radius: var(--radius-sm);
  margin: 0 0.35rem;
}

.nav-notif-item:hover {
  background: var(--surface);
}

/* Icon */
.nav-notif-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.nav-notif-icon.project-shared {
  background: none;
}

.nav-notif-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-notif-icon.request-processed {
  background: rgba(34, 197, 94, 0.12);
  color: var(--green);
}

.nav-notif-icon.info {
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
}

.nav-notif-icon-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}

.nav-notif-icon-badge.project-shared {
  background: var(--accent);
  color: #fff;
}

.nav-notif-icon-badge.request-processed {
  background: var(--green);
  color: #fff;
}

.nav-notif-icon-badge.info {
  background: var(--amber);
  color: #fff;
}

/* Content */
.nav-notif-content {
  flex: 1;
  min-width: 0;
}

.nav-notif-text {
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nav-notif-text strong {
  font-weight: 700;
  color: var(--text-primary);
}

.nav-notif-item.unread .nav-notif-text {
  color: var(--text-primary);
}

.nav-notif-body {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-style: italic;
}

.nav-notif-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.nav-notif-item.unread .nav-notif-time {
  color: var(--accent);
  font-weight: 600;
}

/* Unread dot */
.nav-notif-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 14px;
  opacity: 0;
}

.nav-notif-item.unread .nav-notif-dot {
  opacity: 1;
}

/* Empty */
.nav-notif-empty {
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ======================== */
/* Contact Page             */
/* ======================== */
.contact-page {
  min-height: calc(100vh - 60px - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

.nav-link-active {
  color: var(--accent) !important;
}

.contact-container {
  max-width: 1100px;
  margin: 0 auto;
}

.contact-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.contact-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 1rem;
}

.contact-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.2rem;
  letter-spacing: -0.01em;
}

/* .contact-title .accent — see base.css */

.contact-subtitle {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.contact-body {
  max-width: 640px;
  margin: 0 auto;
}

.contact-form-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

.contact-form-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--card-glow-1), var(--card-glow-2), var(--card-glow-3));
  border: 1px solid var(--card-glow-border);
  border-radius: var(--radius);
  pointer-events: none;
}

.contact-form {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  padding: 2rem 2rem 2.2rem;
}

.contact-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.contact-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.4rem;
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.7rem 0.9rem;
  font-family: var(--font);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: var(--text-muted);
}

.contact-field input:focus,
.contact-field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.contact-field textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.contact-field label .required {
  color: var(--red);
  margin-left: 0.1rem;
}

.contact-form-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.contact-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  align-self: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.8rem 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 0 20px rgba(99,102,241,0.2);
  margin-top: 0.3rem;
}

.contact-submit:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 30px rgba(99,102,241,0.35);
  transform: translateY(-2px);
}

.contact-submit:active {
  transform: translateY(0);
}

.contact-submit.sent {
  background: var(--green);
  box-shadow: 0 0 20px rgba(34,197,94,0.2);
  pointer-events: none;
}

/* File upload */
.file-upload-area {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.file-upload-area.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-upload-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.4rem 1rem;
  color: var(--text-muted);
  pointer-events: none;
}

.file-upload-prompt svg {
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.file-upload-prompt span {
  font-size: 0.88rem;
}

.file-upload-hint {
  font-size: 0.75rem !important;
  color: var(--text-muted);
  opacity: 0.7;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0;
}

.file-list:not(:empty) {
  padding: 0.6rem 0.8rem 0.7rem;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  position: relative;
  z-index: 3;
}

.file-item-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #fff;
}

.file-item-icon.ext-pdf  { background: #ef4444; }
.file-item-icon.ext-doc  { background: #3b82f6; }
.file-item-icon.ext-xls  { background: #22c55e; }
.file-item-icon.ext-csv  { background: #22c55e; }
.file-item-icon.ext-txt  { background: #9ca3b8; }
.file-item-icon.ext-img  { background: #f59e0b; }
.file-item-icon.ext-other { background: var(--text-muted); }

.file-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-size {
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.file-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem;
  line-height: 1;
  font-size: 1.1rem;
  transition: color 0.15s;
  flex-shrink: 0;
}

.file-item-remove:hover {
  color: var(--red);
}

/* Footer — see base.css for site-footer */

/* Visitor badge & footer-sep — see base.css */

/* ======================== */
/* Favorites / Saved        */
/* ======================== */

/* Navbar account badge (on the Account button) */
.nav-fav-badge {
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59e0b;
  color: #000;
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: 9px;
  padding: 0 4px;
  line-height: 1;
  font-family: var(--mono);
  pointer-events: none;
  animation: favBadgePop 0.3s ease;
  margin-left: 0.1rem;
}

@keyframes favBadgePop {
  0% { transform: scale(0); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Saved Molecules menu item in account dropdown */
.nav-menu-saved {
  position: relative;
}

.nav-menu-saved svg {
  color: #f59e0b;
}

.nav-menu-saved:hover svg {
  color: #fbbf24;
}

.nav-menu-fav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 10px;
  padding: 0 6px;
  line-height: 1;
  font-family: var(--mono);
}

/* Slide-out panel overlay */
.fav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  backdrop-filter: blur(2px);
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fav-overlay.open {
  display: block;
  opacity: 1;
}

/* Slide-out panel */
.fav-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  z-index: 310;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.fav-panel.open {
  transform: translateX(0);
}

.fav-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

.fav-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-primary);
}

.fav-panel-title svg {
  color: #f59e0b;
  flex-shrink: 0;
}

.fav-panel-title h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.fav-panel-count {
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-family: var(--mono);
}

.fav-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: color 0.15s;
}

.fav-panel-close:hover {
  color: var(--text-primary);
}

.fav-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Empty state */
.fav-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
  gap: 0.6rem;
}

.fav-empty svg {
  opacity: 0.25;
  margin-bottom: 0.3rem;
}

.fav-empty p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

.fav-empty span {
  font-size: 0.82rem;
  max-width: 260px;
  line-height: 1.5;
}

/* Favorites list */
.fav-list {
  display: flex;
  flex-direction: column;
}

/* Actions bar (Clear All) */
.fav-panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.fav-clear-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}

.fav-clear-all-btn:hover {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.06);
}

.fav-clear-all-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-muted);
  border-color: var(--border);
  background: none;
}

.fav-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
}

.fav-item:hover {
  background: var(--surface);
}

.fav-item:last-child {
  border-bottom: none;
}

.fav-item-info {
  flex: 1;
  min-width: 0;
}

.fav-item-id {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}

.fav-item-smiles {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 0.3rem;
}

.fav-item-props {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.fav-item-prop {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.fav-item-prop strong {
  color: var(--text-secondary);
  font-weight: 500;
}

.fav-item-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 4px;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

.fav-item-remove:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.1);
}

/* Star button in detail modal */
.detail-star-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
  transition: all 0.25s ease;
  white-space: nowrap;
}

.detail-star-btn:hover {
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.06);
}

.detail-star-btn.active {
  border-color: rgba(245, 158, 11, 0.5);
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

.detail-star-btn .star-icon-outline,
.detail-star-btn .star-icon-filled {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.detail-star-btn .star-icon-filled {
  display: none;
  fill: #f59e0b;
  stroke: #f59e0b;
}

.detail-star-btn.active .star-icon-outline {
  display: none;
}

.detail-star-btn.active .star-icon-filled {
  display: block;
}

/* Star pop animation */
@keyframes starPop {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.detail-star-btn.pop {
  animation: starPop 0.35s ease;
}

/* Table star button */
.fav-col { width: 20px; text-align: center; padding: 0.3rem !important; }
.table-star-btn, .table-star-btn:hover, .table-star-btn.active {
  background: none; border: none; box-shadow: none; padding: 0.3rem;
}
.table-star-btn span { display: none; }
.table-star-btn:not(.active) { opacity: 0; transition: opacity 0.15s; }
tr:hover .table-star-btn:not(.active) { opacity: 0.5; }
tr:hover .table-star-btn:not(.active):hover { opacity: 1; }

/* ======================== */
/* Compare Molecules        */
/* ======================== */

/* Modal override */
.modal-compare {
  max-width: 1200px;
  width: 95%;
  max-height: 88vh;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.modal-compare .modal-close {
  z-index: 5;
}

.cmp-step {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#cmpStepResult {
  display: block;
  flex: none;
  min-height: auto;
}

#cmpStepResult.hidden {
  display: none;
}

.cmp-step.hidden {
  display: none;
}

/* Header */
.cmp-header {
  padding: 0 0 0.75rem;
  flex-shrink: 0;
}

.cmp-header h2 {
  font-size: 1.2rem;
  margin-bottom: 0.25rem;
}

.cmp-subtitle {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

/* Selection bar */
.cmp-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.cmp-selected-count {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  font-family: var(--mono);
}

.cmp-compare-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
}

.cmp-compare-btn:hover:not(:disabled) {
  background: var(--accent-hover);
}

.cmp-compare-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Picker card grid */
.cmp-pick-list {
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  padding: 0.25rem 0.25rem 0.5rem;
  max-height: 430px;
}

/* Molecule card */
.cmp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-tertiary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  overflow: hidden;
}

.cmp-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.cmp-card.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 4px 16px rgba(0, 0, 0, 0.1);
}

.cmp-card.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Card header: checkbox + order badge */
.cmp-card-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.7rem 0;
}

.cmp-card-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
  background: transparent;
}

.cmp-card-checkbox svg {
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
  color: #fff;
}

.cmp-card-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.cmp-card-checkbox.checked svg {
  opacity: 1;
  transform: scale(1);
}

.cmp-card-order {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
  font-family: var(--mono);
  animation: cmpOrderPop 0.25s ease;
}

@keyframes cmpOrderPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* Structure preview */
.cmp-card-structure {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  min-height: 100px;
}

.cmp-card-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Card details */
.cmp-card-details {
  padding: 0 0.7rem 0.6rem;
}

.cmp-card-id {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 0.15rem;
}

.cmp-card-formula {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.3rem;
}

.cmp-card-props {
  display: flex;
  gap: 0.6rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cmp-card-props strong {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Picker empty state */
.cmp-pick-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 2rem;
  color: var(--text-muted);
  gap: 0.5rem;
}

.cmp-pick-empty svg {
  opacity: 0.2;
}

.cmp-pick-empty p {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 0;
}

.cmp-pick-empty span {
  font-size: 0.82rem;
  max-width: 260px;
  line-height: 1.5;
}

/* Back button */
.cmp-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 0.5rem;
}

.cmp-back-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Comparison table */
.cmp-table-wrap {
  overflow: visible;
}

.cmp-table {
  border-collapse: collapse;
  font-size: 0.95rem;
  width: 100%;
}


.cmp-prop-header {
  background: var(--bg-tertiary);
  padding: 0.6rem 0.85rem;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  width: 1%;
}

.cmp-mol-header {
  background: var(--bg-tertiary);
  padding: 0.6rem 0.85rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.cmp-mol-id {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cmp-mol-formula {
  display: block;
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-top: 0.1rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmp-prop-label {
  padding: 0.55rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  white-space: nowrap;
  width: 1%;
}

.cmp-val {
  padding: 0.55rem 0.85rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: break-word;
}

.cmp-val.num {
  font-family: var(--mono);
  font-size: 0.95rem;
}

/* Value tier highlighting */
.cmp-val.val-best {
  background: var(--cmp-best-bg);
  color: var(--cmp-best-color);
  font-weight: 700;
}

.cmp-val.val-good {
  background: var(--cmp-good-bg);
  color: var(--cmp-good-color);
}

.cmp-val.val-mid {
  color: var(--text-primary);
}

.cmp-val.val-poor {
  background: var(--cmp-poor-bg);
  color: var(--cmp-poor-color);
}

.cmp-val.val-worst {
  background: var(--cmp-worst-bg);
  color: var(--cmp-worst-color);
}

/* Star marker for best value */
.cmp-star {
  color: #facc15;
  margin-right: 0.3rem;
  font-size: 1rem;
}

/* Property hint text */
.cmp-hint {
  display: block;
  font-size: 0.73rem;
  font-weight: 400;
  color: var(--text-muted);
  opacity: 0.7;
  margin-top: 0.1rem;
  letter-spacing: 0;
  text-transform: none;
  font-style: italic;
}

/* Legend bar */
.cmp-legend {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  margin-top: 0.5rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.cmp-legend-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cmp-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.cmp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.cmp-legend-dot.dot-best {
  background: rgba(34, 197, 94, 0.45);
  border: 1px solid rgba(34, 197, 94, 0.6);
}

.cmp-legend-dot.dot-good {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.cmp-legend-dot.dot-poor {
  background: rgba(245, 158, 11, 0.2);
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.cmp-legend-dot.dot-worst {
  background: rgba(239, 68, 68, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.cmp-legend-star {
  color: #facc15;
  font-size: 0.9rem;
}

.cmp-legend-sep {
  color: var(--border);
  font-size: 0.8rem;
}

.cmp-legend-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Structure cells in comparison table */
.cmp-structure-cell {
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}

.cmp-structure-canvas {
  display: block;
  margin: 0 auto;
  border-radius: 4px;
  max-width: 100%;
  height: auto;
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 4.5rem;
  right: 1.5rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  max-width: 340px;
}

.toast.toast-warn {
  border-color: rgba(245, 158, 11, 0.4);
}

.toast-icon {
  flex-shrink: 0;
  color: #fbbf24;
}

.toast-msg {
  flex: 1;
  line-height: 1.4;
}

.toast.toast-out {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* ========== Daily Limit Banner ========== */
.weekly-limit-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  transform: translateY(-100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.weekly-limit-banner.visible {
  transform: translateY(0);
}

.weekly-limit-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 2rem;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(239, 68, 68, 0.12) 100%);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  backdrop-filter: blur(16px);
  flex-wrap: wrap;
}

.weekly-limit-icon {
  color: var(--amber);
  flex-shrink: 0;
}

.weekly-limit-msg {
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 500;
  flex: 1;
  min-width: 200px;
}

.weekly-limit-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 1rem;
  background: var(--amber);
  color: #000;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.15s ease;
}

.weekly-limit-link:hover {
  background: #fbbf24;
  transform: translateY(-1px);
}

.weekly-limit-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.weekly-limit-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
  .intro {
    flex-direction: column;
    padding: 5rem 1.5rem 3rem;
    min-height: auto;
  }
  .intro-title { font-size: 2.4rem; }
  .intro-molecule-viz { display: none; }
  .intro-stats-row { gap: 1.2rem; }
  .nav-links { gap: 1rem; }
  .contact-title { font-size: 2rem; }
  .contact-form-row { grid-template-columns: 1fr; }
  .search-container {
    flex-direction: column;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.wide { grid-column: span 1; }
  .content { padding: 1rem; }
  .navbar { padding: 0 1rem; }
  .modal-compare { max-width: 98vw; width: 98%; max-height: 92vh; padding: 1.25rem; }
  .cmp-pick-list { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  .weekly-limit-content { padding: 0.75rem 1rem; }
  .weekly-limit-msg { font-size: 0.82rem; min-width: 150px; }
  .mol-card-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .results-bar { flex-direction: column; align-items: flex-start; }
  .results-bar-controls { width: 100%; justify-content: space-between; }
  /* Sidebar collapses on mobile */
  .filter-sidebar {
    position: fixed;
    top: var(--nav-h);
    left: 0;
    height: calc(100vh - var(--nav-h));
    z-index: 150;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    transform: translateX(0);
    transition: transform 0.3s ease;
  }
  .filter-sidebar.collapsed {
    transform: translateX(-100%);
    width: 260px;
    min-width: 260px;
    opacity: 1;
  }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .intro-title { font-size: 2rem; }
  .intro-stats-row { flex-direction: column; gap: 0.8rem; }
  .contact-title { font-size: 1.6rem; }
  .contact-form { padding: 1.25rem; }
  .nav-links { display: none; }
  .fav-panel { width: 100vw; max-width: 100vw; }
  .modal-compare { padding: 1rem; }
  .cmp-pick-list { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .cmp-card-props { flex-direction: column; gap: 0.15rem; }
  .weekly-limit-content { flex-direction: column; align-items: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; }
  .weekly-limit-close { position: absolute; top: 0.5rem; right: 0.75rem; }
  .mol-card-grid { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
  .mol-card-structure { min-height: 110px; }
  .mol-card-detail { font-size: 0.76rem; }
  .mol-card-formula { font-size: 0.92rem; }
  .mol-card-cas { font-size: 0.92rem; }
  .results-bar-controls { flex-wrap: wrap; }
}

/* ========== Light Mode — Apple Design Language ========== */
[data-theme="light"] .navbar {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .hero {
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f7 100%);
}

[data-theme="light"] .toast {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .fav-panel {
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .intro-particle {
  opacity: 0.06;
}

[data-theme="light"] .intro-particle.p1 { background: rgba(0, 122, 255, 0.06); }
[data-theme="light"] .intro-particle.p2 { background: rgba(88, 86, 214, 0.05); }
[data-theme="light"] .intro-particle.p3 { background: rgba(175, 82, 222, 0.04); }
[data-theme="light"] .intro-particle.p4 { background: rgba(0, 122, 255, 0.04); }
[data-theme="light"] .intro-particle.p5 { background: rgba(88, 86, 214, 0.03); }

[data-theme="light"] .mol-atom {
  filter: drop-shadow(0 0 3px rgba(0, 122, 255, 0.25));
}

[data-theme="light"] .mol-atom.a1 { fill: #007aff; }
[data-theme="light"] .mol-atom.a2 { fill: #5856d6; }
[data-theme="light"] .mol-atom.a3 { fill: #af52de; }
[data-theme="light"] .mol-atom.a4 { fill: #5ac8fa; }
[data-theme="light"] .mol-atom.a5 { fill: #007aff; }
[data-theme="light"] .mol-atom.a6 { fill: #af52de; }

[data-theme="light"] .mol-bond { stroke: rgba(0, 122, 255, 0.15) !important; }
[data-theme="light"] .mol-glow { stroke: rgba(0, 122, 255, 0.1); }

[data-theme="light"] .weekly-limit-content {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.05) 0%, rgba(255, 59, 48, 0.03) 100%);
  border-bottom: 1px solid rgba(255, 149, 0, 0.12);
}

[data-theme="light"] .weekly-limit-close:hover {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .intro-cta {
  box-shadow: 0 2px 12px rgba(0, 122, 255, 0.15);
}

[data-theme="light"] .intro-cta:hover {
  box-shadow: 0 4px 20px rgba(0, 122, 255, 0.22);
}

[data-theme="light"] .contact-submit {
  box-shadow: 0 2px 12px rgba(0, 122, 255, 0.12);
}

[data-theme="light"] .contact-submit:hover {
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.18);
}

[data-theme="light"] .contact-submit.sent {
  box-shadow: 0 2px 12px rgba(52, 199, 89, 0.15);
}

[data-theme="light"] .btn-search:hover {
  box-shadow: 0 2px 12px rgba(0, 122, 255, 0.18);
}

[data-theme="light"] .nav-menu-soon {
  background: rgba(0, 122, 255, 0.06);
  color: #007aff;
}

[data-theme="light"] .nav-menu-fav-count {
  background: rgba(255, 149, 0, 0.08);
  color: #c77c00;
}

[data-theme="light"] .nav-fav-badge {
  background: #ff9500;
  color: #fff;
}

[data-theme="light"] .nav-menu-saved svg {
  color: #ff9500;
}

[data-theme="light"] .fav-panel-title svg {
  color: #ff9500;
}

[data-theme="light"] .file-upload-area.dragover {
  background: rgba(0, 122, 255, 0.03);
  border-color: #007aff;
}

[data-theme="light"] td.smiles-cell {
  color: #007aff;
}

[data-theme="light"] .detail-value.mono {
  color: #007aff;
}

[data-theme="light"] .contact-label {
  color: var(--accent);
}

[data-theme="light"] .cmp-star {
  color: #ff9500;
}

[data-theme="light"] .cmp-legend-star {
  color: #ff9500;
}


/* Comparison panel light mode */
[data-theme="light"] .cmp-card.selected {
  border-color: var(--accent);
  background: rgba(0, 122, 255, 0.03);
  box-shadow: 0 0 0 3px var(--accent-glow), 0 2px 8px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .cmp-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .modal-compare {
  box-shadow: var(--shadow);
}

[data-theme="light"] .cmp-legend-dot.dot-best {
  background: rgba(52, 199, 89, 0.25);
  border: 1px solid rgba(52, 199, 89, 0.45);
}

[data-theme="light"] .cmp-legend-dot.dot-good {
  background: rgba(52, 199, 89, 0.1);
  border: 1px solid rgba(52, 199, 89, 0.2);
}

[data-theme="light"] .cmp-legend-dot.dot-poor {
  background: rgba(255, 149, 0, 0.12);
  border: 1px solid rgba(255, 149, 0, 0.25);
}

[data-theme="light"] .cmp-legend-dot.dot-worst {
  background: rgba(255, 59, 48, 0.12);
  border: 1px solid rgba(255, 59, 48, 0.25);
}

[data-theme="light"] .cmp-pick-empty svg {
  color: var(--border);
}

/* Detail modal star button */
[data-theme="light"] .detail-star-btn:hover {
  border-color: rgba(255, 149, 0, 0.35);
  color: #ff9500;
  background: rgba(255, 149, 0, 0.05);
}

[data-theme="light"] .detail-star-btn.active {
  border-color: rgba(255, 149, 0, 0.45);
  color: #ff9500;
  background: rgba(255, 149, 0, 0.07);
}

[data-theme="light"] .detail-star-btn .star-icon-filled {
  fill: #ff9500;
  stroke: #ff9500;
}

[data-theme="light"] .table-star-btn,
[data-theme="light"] .table-star-btn:hover,
[data-theme="light"] .table-star-btn.active {
  background: none; border: none; box-shadow: none;
}

/* Favorites panel */
[data-theme="light"] .fav-clear-all-btn:hover {
  color: var(--red);
  border-color: rgba(255, 59, 48, 0.25);
  background: rgba(255, 59, 48, 0.04);
}

[data-theme="light"] .fav-item-remove:hover {
  color: var(--red);
  background: rgba(255, 59, 48, 0.05);
}

[data-theme="light"] .nav-menu-saved:hover svg {
  color: #e68600;
}

/* File upload icons */
[data-theme="light"] .file-item-icon.ext-xls { background: #34c759; }
[data-theme="light"] .file-item-icon.ext-csv { background: #34c759; }
[data-theme="light"] .file-item-icon.ext-txt { background: #aeaeb2; }
[data-theme="light"] .file-item-icon.ext-img { background: #ff9500; }
[data-theme="light"] .file-item-icon.ext-pdf { background: #ff3b30; }
[data-theme="light"] .file-item-icon.ext-doc { background: #007aff; }

/* Toast notification */
[data-theme="light"] .toast-icon {
  color: #ff9500;
}

[data-theme="light"] .toast.toast-warn {
  border-color: rgba(255, 149, 0, 0.25);
}

/* Daily limit banner */
[data-theme="light"] .weekly-limit-link:hover {
  background: #e68600;
}

/* Modal overlay */
[data-theme="light"] .modal {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

/* Notification panel */
[data-theme="light"] .nav-notif-badge {
  background: var(--red);
}

[data-theme="light"] .nav-notif-panel {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .nav-notif-icon-badge {
  border-color: var(--bg-secondary);
}

[data-theme="light"] .nav-notif-icon.project-shared {
  background: none;
}

[data-theme="light"] .nav-notif-icon.request-processed {
  background: rgba(52, 199, 89, 0.08);
  color: var(--green);
}

[data-theme="light"] .nav-notif-icon.info {
  background: rgba(255, 149, 0, 0.08);
  color: var(--amber);
}

[data-theme="light"] .nav-notif-icon-badge.project-shared {
  background: var(--accent);
}

[data-theme="light"] .nav-notif-icon-badge.request-processed {
  background: var(--green);
}

[data-theme="light"] .nav-notif-icon-badge.info {
  background: var(--amber);
}

/* Tutorials */
[data-theme="light"] .tutorials-nav-link.active {
  background: rgba(0, 122, 255, 0.06);
}
.modal-tutorials {
  max-width: 900px;
  width: 95%;
  max-height: 85vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-tutorials .modal-close {
  top: 0.75rem;
  right: 0.85rem;
  z-index: 5;
}

.tutorials-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Sidebar nav */
.tutorials-nav {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.tutorials-nav-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.tutorials-nav-title svg {
  color: var(--accent);
  flex-shrink: 0;
}

.tutorials-nav-link {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.15s;
  border-left: 2px solid transparent;
}

.tutorials-nav-link:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.tutorials-nav-link.active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

[data-theme="light"] .tutorials-nav-link.active {
  background: rgba(176, 153, 111, 0.06);
}

/* Content area */
.tutorials-content {
  flex: 1;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  min-height: 0;
}

.tutorials-section {
  display: none;
}

.tutorials-section.active {
  display: block;
  animation: tutFadeIn 0.25s ease;
}

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

.tutorials-section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.tutorials-section h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.5rem 0 0.5rem;
}

.tutorials-section p {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.tutorials-section code {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  color: var(--accent);
}

.tutorials-section kbd {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  color: var(--text-primary);
  font-weight: 600;
}

.tutorials-section strong {
  color: var(--text-primary);
  font-weight: 600;
}

/* Highlight box */
.tut-highlight {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin: 1rem 0;
}

.tut-highlight strong {
  color: var(--accent);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.tut-highlight p {
  margin: 0.3rem 0 0;
}

/* Example box */
.tut-example {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 0.75rem 0;
  font-size: 0.88rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.tut-example-label {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--surface);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.4rem;
}

/* Mini table rows */
.tut-table {
  margin: 0.75rem 0;
}

.tut-table-row {
  display: flex;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.tut-table-row:last-child {
  border-bottom: none;
}

.tut-table-label {
  font-weight: 600;
  color: var(--text-primary);
  min-width: 140px;
  flex-shrink: 0;
  font-size: 0.85rem;
}

/* Tutorial inline links */
.tut-goto,
.tut-action {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed var(--accent);
  transition: opacity 0.15s;
  cursor: pointer;
}

.tut-goto:hover,
.tut-action:hover {
  opacity: 0.75;
}

/* Group cards grid */
.tut-groups-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tut-group-card {
  display: flex;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s;
}

.tut-group-card:hover {
  border-color: var(--accent);
}

.tut-group-id {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  background: var(--surface);
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  margin-top: 0.1rem;
}

.tut-group-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.tut-group-card p {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-tutorials {
    max-width: 98vw;
    max-height: 92vh;
  }
  .tutorials-layout {
    flex-direction: column;
  }
  .tutorials-nav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem;
    gap: 0.25rem;
    flex-shrink: 0;
  }
  .tutorials-nav-title {
    display: none;
  }
  .tutorials-nav-link {
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    border-radius: var(--radius-sm);
  }
  .tutorials-nav-link.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }
  .tutorials-content {
    padding: 1.25rem 1rem;
  }
}
