/* Styles scoped to the Create Experiment silo. Reuses design tokens
   (colors, buttons, inputs) defined in styles.css but owns its own layout
   and table/toast/flag rules so it stays independent of the main app view.
   The dark Projects sidebar classes (.projects-sidebar, .project-row, etc.)
   are shared verbatim from styles.css — no duplicate dark-theme rules live
   here. */

/* --- Workspace body row: dark projects sidebar (left) + center log stream,
   mounted under the shared .app-header (styles.css). The right detail
   drawer is a fixed-position overlay (see below), not a third column here,
   so opening it never reflows or clips this row. */

.workspace-columns {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* Width comes from --sidebar-w, the same custom property layout.js
   (js/layout.js) sets on the SI Writer route's .app-shell grid — mounted
   here too (see js/experiment/main.js) so the sidebar's resized/collapsed
   width stays pixel-identical and persists across the two routes. */
.projects-sidebar {
  width: var(--sidebar-w, 248px);
  flex-shrink: 0;
}

.log-stream-panel {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 20px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--paper);
}

@media (max-width: 1080px) {
  .workspace-columns {
    flex-direction: column;
    overflow: visible;
  }

  .projects-sidebar {
    width: 100%;
  }

  #sidebarResizeHandle {
    display: none;
  }

  .log-stream-panel {
    overflow-y: visible;
  }
}

/* --- Lab-sheet dropzone: permanent header card at the top of the center
   panel. Reused (with the .log-dropzone modifier) for the "start blank
   experiment" affordance underneath it. */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  flex-shrink: 0;
  min-height: 108px;
  padding: 20px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}

.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropzone.dropzone-drag-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
}

.dropzone-icon {
  font-size: 1.6rem;
  color: var(--muted);
  line-height: 1;
  margin-bottom: 4px;
}

.dropzone-title {
  margin: 0;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.92rem;
}

.dropzone-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.log-dropzone-blank-btn {
  margin-top: 10px;
  min-height: 28px;
  padding: 0 12px;
  font-size: 0.75rem;
}

/* --- Workflow C: "Use General Procedure" picker inside the dropzone. Sits
   between the hint text and the blank-experiment button; clicks on it are
   excluded from the dropzone's click-to-browse handler (see log-stream.js). */

.log-dropzone-procedure-label {
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.log-dropzone-procedure-select {
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.8rem;
  max-width: 280px;
}

/* --- General Procedures: its own persistent right-hand column (a peer of
   .log-stream-panel, not a tab hidden inside it) — resizable the same way
   as the sidebar/detail panes, via --procedures-w (js/layout.js). */

.procedures-column {
  width: var(--procedures-w, 320px);
  flex-shrink: 0;
  overflow-y: auto;
  padding: 20px 20px 48px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.procedures-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.procedures-column-title {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--ink);
}

.procedures-column-list {
  flex: 1;
}

@media (max-width: 1080px) {
  .procedures-column {
    width: 100%;
  }

  #proceduresResizeHandle {
    display: none;
  }
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent);
  animation: spinner-rotate 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* --- Labbook toolbar: search + procedure filter + sort + group-by (day/week
   or General Procedure), above the bucketed card stream. Wraps because the
   panel is resizable down to fairly narrow widths (see sidebarResizeHandle/
   proceduresResizeHandle in layout.js). */

.log-stream-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  flex-shrink: 0;
}

.log-toolbar-select {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.8rem;
  max-width: 200px;
}

.log-view-toggle[hidden] {
  display: none;
}

.log-search-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 0.85rem;
}

.log-search-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.log-toolbar-btn {
  flex-shrink: 0;
  min-height: 34px;
  padding: 0 12px;
  font-size: 0.8rem;
  white-space: nowrap;
}

.log-view-toggle {
  display: flex;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.log-view-btn {
  min-height: 34px;
  padding: 0 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--panel);
  border: none;
  cursor: pointer;
}

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

.log-view-btn.active {
  color: var(--paper);
  background: var(--accent);
}

/* --- Bulk-select toolbar: "select all" + selected count + Export All /
   Delete All, sitting below the search/sort toolbar. Export/Delete stay
   disabled until at least one card checkbox (see .experiment-card-select
   below) is checked. */

.log-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.log-select-all-field {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
}

.log-selected-count {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

.log-toolbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.log-toolbar-btn.log-toolbar-btn-danger {
  margin-left: auto;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, transparent);
}

.log-toolbar-btn.log-toolbar-btn-danger:not(:disabled):hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

/* --- Experiment log stream: vertical list of time buckets, each a
   collapsible header over its cards. Filtered/sorted/grouped by
   log-stream-filters.js, rendered by log-stream.js. */

.experiment-log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.log-bucket {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.log-bucket-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 2px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.log-bucket-chevron {
  color: var(--muted);
  font-size: 0.75rem;
  width: 1em;
}

.log-bucket-label {
  font-weight: 800;
  font-size: 0.88rem;
}

.log-bucket-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.log-bucket-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.experiment-log-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  background: var(--panel);
}

.experiment-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.experiment-card:hover,
.experiment-card:focus-visible {
  border-color: var(--accent);
}

.experiment-card-scheme {
  width: 60px;
  height: 60px;
  flex-shrink: 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  color: var(--muted);
}

.experiment-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.experiment-card-id {
  font-weight: 800;
  color: var(--ink);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.experiment-card-date {
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- Clickable log cards: buildCard() splits the card into an .experiment-
   card-open click target (opens the drawer) plus a sibling kebab menu
   button, since a <button> can't contain another interactive button. Mirrors
   .experiment-card-review-open below. */

.experiment-card-clickable {
  padding: 0;
}

/* Selection checkbox: a sibling of .experiment-card-open (not nested inside
   it) so clicking it can stopPropagation() without also fighting the open
   area's own click handler. */
.experiment-card-select {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-left: 16px;
  cursor: pointer;
}

.experiment-card-select input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

.experiment-card-open {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  cursor: pointer;
}

.experiment-card-menu-btn {
  /* Always hit-testable (no pointer-events toggling) — only opacity fades
     for the "reveal on hover" look, same rationale as .project-menu-btn. */
  flex-shrink: 0;
  align-self: center;
  margin-right: 12px;
  opacity: 0;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  min-width: 26px;
  min-height: 28px;
  padding: 0 6px;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  border-radius: 5px;
  transition: opacity 0.1s ease;
}

.experiment-card-clickable:hover .experiment-card-menu-btn,
.experiment-card-clickable:focus-within .experiment-card-menu-btn,
.experiment-card-menu-btn[aria-expanded="true"] {
  opacity: 1;
}

.experiment-card-menu-btn:hover,
.experiment-card-menu-btn:focus-visible {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

/* Portal dropdown: appended directly to <body> (see log-stream.js) rather
   than nested in the card, so it floats over the workspace instead of being
   clipped by .log-bucket-cards' overflow. */
.experiment-card-menu-dropdown {
  position: fixed;
  z-index: 2000;
  min-width: 176px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.experiment-card-menu-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border: none;
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 5px;
}

.experiment-card-menu-item:hover,
.experiment-card-menu-item:focus-visible {
  background: var(--paper);
}

.experiment-card-menu-item-danger {
  color: var(--danger);
}

.experiment-card-menu-item-danger:hover,
.experiment-card-menu-item-danger:focus-visible {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}

/* "Tag with General Procedure" picker step (see renderProcedureTagMenu() in
   log-stream.js): checkmarked item for the currently-linked procedure, and
   the empty-state message when the project has no procedures yet. */
.experiment-card-menu-item-active {
  color: var(--accent-strong);
}

.experiment-card-menu-empty {
  margin: 0;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

/* --- Pending-upload cards: one per lab-sheet image still being processed
   (or that failed) by the AI extraction pipeline, rendered above the normal
   log-stream cards while upload-queue.js has entries for the active project.
   Reuses .experiment-card's box/spacing but as a non-clickable <div> instead
   of a <button>, since an errored entry needs its own nested Retry/Dismiss
   buttons. */

.experiment-card-pending {
  cursor: default;
}

.experiment-card-pending-icon {
  border-style: solid;
}

.experiment-card-pending-status {
  font-weight: 700;
  color: var(--accent-strong);
}

.experiment-card-pending-error {
  border-color: var(--danger);
}

.experiment-card-pending-error .experiment-card-pending-icon {
  border-color: var(--danger);
}

.experiment-card-pending-error .experiment-card-pending-status {
  color: var(--danger);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-card-error-icon {
  color: var(--danger);
  font-size: 1.3rem;
  line-height: 1;
}

.pending-card-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  margin-left: auto;
}

.pending-card-retry-btn,
.pending-card-dismiss-btn {
  min-height: 30px;
  padding: 0 12px;
  font-size: 0.78rem;
}

/* --- Needs Review section: AI-extracted records held out of the main log
   (and its date buckets) until a human confirms or edits them — see
   records-store.js's `needsReview` flag. Rendered above the toolbar/buckets
   so a bad AI-guessed date can never bury one. */

.log-review-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}

.log-review-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 2px;
  color: var(--warning);
}

.log-review-title {
  font-weight: 800;
  font-size: 0.88rem;
}

.review-approve-all-btn {
  margin-left: auto;
  min-height: 30px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.log-review-hint {
  margin: -4px 2px 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.experiment-card-review {
  cursor: default;
  border-color: var(--warning);
  padding: 0;
}

.experiment-card-review-open {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  cursor: pointer;
}

.review-card-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--warning);
}

/* Names the General Procedure a card's experiment was derived from — see
   procedureTagHtml() in log-stream.js. Pill styling mirrors styles.css's
   .series-status-tag (characterisation workspace) but keyed to --accent
   since this is informational, not a warning/error state. */
.procedure-card-badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-card-approve-btn {
  min-height: 30px;
  padding: 0 12px;
  font-size: 0.78rem;
  margin-right: 16px;
}

/* --- Right detail drawer: fixed-position overlay so opening/closing it
   never shifts or clips the center log stream — it slides over the page
   rather than participating in the .workspace-columns flex layout. */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 12, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 40;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(720px, 94vw);
  background: var(--paper);
  box-shadow: -18px 0 40px rgba(24, 32, 29, 0.18);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 50;
}

.detail-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.drawer-close-btn {
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 0;
}

.drawer-close-btn:hover {
  color: var(--ink);
}

.drawer-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- The form itself (metadata, narrative, stoichiometry tables) — same
   rules as before, now laid out inside .drawer-body instead of the page
   directly. */

.metadata-panel {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.narrative-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.narrative-panel textarea {
  min-height: 140px;
}

/* Read-only General Procedure reference shown above an experiment's own
   Raw Narrative / Method field (see refreshGeneralProcedurePanel() in
   render.js). Collapsed by default; the toggle button drops down the
   procedure's immutable narrative text when the chemist needs to check it. */
.general-procedure-panel {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 10px;
  overflow: hidden;
  /* Without this, the panel's non-visible overflow zeroes out its flexbox
     auto-min-size, so drawer-body's flex-shrink (needed since its other
     panels overflow into scroll) crushes this one down to ~0px instead of
     shrinking the panels that actually have room to give. */
  flex-shrink: 0;
}

.general-procedure-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
}

.general-procedure-toggle-icon {
  color: var(--accent-strong);
  font-size: 0.75rem;
  width: 1em;
  transition: transform 0.15s ease;
}

.general-procedure-toggle.expanded .general-procedure-toggle-icon {
  transform: rotate(90deg);
}

.general-procedure-toggle-label {
  font-size: 0.9rem;
}

.general-procedure-body {
  padding: 0 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Author-origin `display` always wins over the UA stylesheet's `[hidden] {
   display: none }`, regardless of selector specificity -- without this
   override, setting `.general-procedure-body { display: flex }` above
   would make the `hidden` attribute a no-op on this element. */
.general-procedure-body[hidden] {
  display: none;
}

.general-procedure-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
}

.general-procedure-text {
  white-space: pre-wrap;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  user-select: text;
}

.stoich-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stoich-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stoich-panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.stoich-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-scroll {
  overflow-x: auto;
}

.calc-hint {
  margin: -4px 2px 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.stoich-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
}

.stoich-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.stoich-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.stoich-table input[type="text"],
.stoich-table input[type="number"] {
  min-height: 34px;
  width: 100%;
}

.stoich-table input[type="number"] {
  min-width: 90px;
}

.stoich-table tr.row-flagged td {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
}

.stoich-table tr.row-flagged input[type="number"] {
  border-color: var(--danger);
}

.mass-flag-icon {
  display: none;
  color: var(--danger);
  margin-left: 6px;
  font-size: 0.9rem;
}

.stoich-table tr.row-flagged .mass-flag-icon {
  display: inline;
}

.row-remove-btn {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.75rem;
}

/* Compact "Link"/"Change"/"Unlink" cell tying a stoich-table row to a
   Compound Registry entry -- see linkCompoundCell() in render.js /
   procedure-render.js. Condensed version of the SI Writer card's roomier
   .linked-compound-row (see styles.css) to fit a table cell. */
.row-link-compound {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 90px;
}

.row-link-compound-name {
  font-size: 0.76rem;
  color: var(--ink);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-link-btn {
  min-height: 26px;
  padding: 0 8px;
  font-size: 0.72rem;
}

/* Two-up Temperature/Time inputs in the Reaction Conditions panel (see
   reaction-scheme.js). */
.condition-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.condition-row .field {
  flex: 1 1 160px;
}

/* Reaction/structure image panel label + "Generate Reaction Scheme" button
   (see reaction-scheme-modal.js) sharing one row, so the button that opens
   the scheme preview sits right next to the image it can fill in. */
.image-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.image-row-header label {
  flex: 1 1 320px;
}

/* "Generate Reaction Scheme" preview modal (see reaction-scheme-modal.js).
   Portal appended directly to <body>; styling follows the same
   overlay/modal shell as ../styles.css's .compound-picker-overlay. */
.reaction-scheme-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 14, 12, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.reaction-scheme-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.reaction-scheme-modal {
  width: min(92vw, 620px);
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reaction-scheme-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.reaction-scheme-modal-header h3 {
  margin: 0;
}

.reaction-scheme-modal-close {
  border: 0;
  background: transparent;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.reaction-scheme-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reaction-scheme-modal-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.reaction-scheme-modal-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1 1 200px;
}

.reaction-scheme-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.86rem;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.reaction-scheme-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}

.reaction-scheme-preview-canvas {
  max-width: 100%;
  height: auto;
}

.reaction-scheme-preview-hint {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.reaction-scheme-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.purity-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  min-width: 220px;
}

.purity-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--ink);
  font-weight: 600;
  text-transform: none;
  white-space: nowrap;
}

.purity-option input {
  min-height: auto;
  width: auto;
}

.experiment-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.experiment-footer-delete {
  margin-right: auto;
}

button.danger {
  background: var(--danger);
  color: #fff;
}

button.danger:hover {
  background: color-mix(in srgb, var(--danger) 85%, black);
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  background: var(--ok);
}

.toast-error {
  background: var(--danger);
}

.toast-info {
  background: var(--accent);
}

@media (max-width: 720px) {
  .metadata-panel {
    grid-template-columns: 1fr;
  }
}
