.samples-shell { min-width: 0; }
.samples-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.samples-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.samples-selection { min-width: 68px; color: var(--muted); font-size: var(--text-label); text-align: right; }
.samples-search { position: relative; }
.samples-search > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.samples-search input {
  width: 220px;
  height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: 0;
  background: var(--paper-raised);
  color: var(--ink);
  font-size: var(--text-control);
}
.samples-search input:focus { border-color: var(--blue); }

.samples-workspace { display: grid; grid-template-columns: minmax(212px, 14%) minmax(0, 1fr); align-items: start; gap: var(--panel-gap); }
.samples-folders {
  position: sticky;
  top: 18px;
  display: grid;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  box-shadow: 0 9px 28px rgba(34, 31, 25, .045);
}
.samples-folders header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.samples-folders h3 { margin: 0; font: var(--font-panel-title); letter-spacing: -.02em; }
.samples-folders header button {
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--text-control);
}
/* Rows use the shared .tree-row-line component (core/base.css) — see
   /style#folder-trees. .sample-folder carries only the "···" edit-menu
   trigger, revealed on hover like Presentations' rename/delete pair. */
.tree-row-line.sample-folder { position: relative; }
.sample-folder-more { position: absolute; right: 4px; top: 50%; z-index: 1; transform: translateY(-50%); opacity: 0; background: var(--paper-raised); }
.tree-row-line.sample-folder:hover .sample-folder-more { opacity: 1; }
.tree-row-line.sample-folder:hover .tree-row-count { visibility: hidden; }
.sample-folder-more button { padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.sample-folder-more button:hover { color: var(--ink); }

.samples-table-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  box-shadow: 0 9px 28px rgba(34, 31, 25, .045);
}
.samples-table-scroll { max-width: 100%; overflow-x: auto; }
.samples-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.samples-table th {
  height: 34px;
  padding: 0 7px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 600;
  letter-spacing: .08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.samples-table th button { padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.samples-table td { height: 39px; padding: 3px 7px; border-bottom: 1px solid var(--line); color: var(--ink); }
.samples-table tbody tr:last-child td { border-bottom: 0; }
.samples-table tbody tr.is-selected { background: rgba(24, 79, 209, .055); }
.samples-table tbody tr:hover { background: var(--paper); }
.samples-table .sample-select { width: 34px; padding-inline: 5px; text-align: center; }
.samples-table .is-compact { width: 54px; text-align: center; }
.sample-cell-name { width: 22%; min-width: 180px; }
.sample-cell-specimen_code { width: 11%; min-width: 100px; }
.sample-cell-batch_id { width: 14%; min-width: 125px; }
.sample-cell-material,
.sample-cell-parent_specimen_id,
.sample-cell-handling,
.sample-cell-notes { width: 54px; text-align: center; }
.sample-cell-storage_location { width: 13%; min-width: 115px; }
.sample-cell-prepared_at { width: 164px; }
.sample-inline {
  width: 100%;
  min-width: 0;
  height: 29px;
  padding: 3px 5px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 2px;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-control);
  text-overflow: ellipsis;
}
.samples-table tr:hover .sample-inline { border-color: var(--line); background: var(--paper-raised); }
.sample-inline:focus { border-color: var(--blue); background: var(--paper-raised); }
.sample-name-editor { min-width: 0; display: grid; grid-template-columns: 17px minmax(0, 1fr); align-items: center; gap: 5px; }
.sample-status-dot { position: relative; width: 17px; height: 29px; display: grid; place-items: center; cursor: pointer; }
.sample-status-dot > span { width: 8px; height: 8px; border: 1px solid rgba(23, 23, 19, .2); border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 2px var(--paper-raised); }
.sample-status-dot.is-active > span { background: var(--green); }
.sample-status-dot.is-consumed > span { background: #c58a22; }
.sample-status-dot.is-archived > span { background: #8d8981; }
.sample-status-dot.is-lost > span { background: var(--red); }
.sample-status-dot.is-contaminated > span { background: #7d425a; }
.sample-status-dot select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.sample-status-dot:focus-within > span { outline: 2px solid var(--blue); outline-offset: 2px; }
.sample-meta-button,
.sample-action-button { width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 2px; background: transparent; color: var(--muted-line); cursor: pointer; }
.sample-meta-button:hover,
.sample-action-button:hover { background: rgba(23, 23, 19, .055); color: var(--blue); }
.sample-meta-button:focus-visible,
.sample-action-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.sample-meta-button.has-value { color: var(--blue); }
.sample-meta-button svg,
.sample-action-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.sample-actions { width: 66px; white-space: nowrap; text-align: right; }
.sample-action-button.is-danger:hover { color: var(--red); }
.samples-empty { margin: 0; padding: 58px 12px; color: var(--muted); font-size: var(--text-body); text-align: center; }

.samples-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: min(780px, calc(100dvh - 28px));
}
.samples-dialog::backdrop { background: rgba(23, 23, 19, .46); }
.samples-dialog-card { position: relative; display: grid; gap: 21px; max-height: min(1040px, calc(100dvh - 16px)); overflow-y: auto; padding: 28px 28px 0; }
.samples-dialog-close { position: absolute; top: 12px; right: 12px; }
.samples-dialog-card header { padding-right: 28px; }
.samples-dialog-card h2 { margin: 0; font: 400 29px/1.05 var(--serif); letter-spacing: -.015em; }
.samples-dialog-card header p { margin: 8px 0 0; color: var(--muted); font-size: var(--text-body); }
.samples-dialog-field { display: grid; gap: 7px; }
.samples-dialog-field > span { color: var(--muted); font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.samples-dialog-field input, .samples-dialog-field textarea {
  width: 100%;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid var(--muted-line);
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-reading);
  resize: vertical;
}
.samples-dialog-field select { width: 100%; padding: 8px 2px; border: 0; border-bottom: 1px solid var(--muted-line); outline: 0; background: transparent; color: var(--ink); font-size: var(--text-reading); }
.samples-dialog-field input:focus, .samples-dialog-field textarea:focus { border-color: var(--blue); }
.samples-dialog-field select:focus { border-color: var(--blue); }
.samples-dialog-fields { display: grid; gap: 18px; }
.samples-dialog-label { margin: 0 0 7px; color: var(--muted); font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.samples-series-fields { display: grid; grid-template-columns: minmax(0, 1fr) 92px 92px; gap: 13px; }
.samples-series-check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: var(--text-control); }
.samples-series-check input { accent-color: var(--blue); }
.samples-series-preview { min-height: 43px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 8px; border: 1px solid var(--line); background: var(--paper); }
.samples-series-preview span { padding: 3px 6px; border: 1px solid #becbeb; border-radius: 2px; background: var(--blue-soft); color: var(--blue); font: 10px/1.2 var(--mono); }
.samples-series-preview small { color: var(--muted); font-size: var(--text-meta); }
.samples-dialog-error { min-height: 14px; margin: -10px 0 0; color: var(--red); font-size: var(--text-label); }
.samples-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  position: sticky;
  bottom: 0;
  margin: 20px -28px 0;
  padding: 14px 28px;
  background: var(--paper-raised);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 22px rgba(34, 31, 25, .045);
}
.samples-dialog-actions .is-danger { border-color: var(--red); background: var(--red); }
.samples-dialog-actions [data-dialog-alternate] { margin-right: auto; background: transparent; color: var(--red); }
.sample-trace-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sample-trace-stats span { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); color: var(--muted); font-size: var(--text-label); }
.sample-trace-stats b { color: var(--ink); font: 400 22px/1 var(--serif); }
.sample-trace-projects { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.sample-trace-projects button { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; text-align: left; }
.sample-trace-projects button:hover { border-color: var(--blue); }
.sample-trace-projects small { color: var(--muted); }

@media (max-width: 900px) {
  .samples-toolbar { align-items: stretch; flex-direction: column; }
  .samples-tools { justify-content: flex-start; }
  .samples-selection { min-width: 0; }
  .samples-workspace { grid-template-columns: 1fr; }
  .samples-folders { position: static; }
}

/* A 980px table inside a horizontal scroller inside the page's vertical
   scroller is the worst thing to touch. Below the phone breakpoint the table
   keeps the checkbox, the name and the row actions; every other column goes,
   and the name gives up its 180px floor so the row fits a 320px screen. The
   full record is one tap away in the editor. Header and body cells share the
   sample-cell-* class, so one rule hides both. */
@media (max-width: 700px) {
  .samples-table { min-width: 0; }
  .samples-table .sample-cell-specimen_code,
  .samples-table .sample-cell-batch_id,
  .samples-table .sample-cell-material,
  .samples-table .sample-cell-parent_specimen_id,
  .samples-table .sample-cell-storage_location,
  .samples-table .sample-cell-handling,
  .samples-table .sample-cell-notes,
  .samples-table .sample-cell-prepared_at { display: none; }
  .samples-table .sample-cell-name { width: auto; min-width: 0; }
  .samples-table th, .samples-table td { padding-inline: 4px; }
  .samples-table .sample-select { width: 30px; }
  .samples-table .sample-actions { width: 62px; }
  .samples-table-box { padding: 8px; }
  /* Nothing left to scroll past, and the scroller was trapping vertical
     swipes that started inside the table. */
  .samples-table-scroll { overflow-x: visible; }


  /* Seven controls of seven different widths in a wrapping flex row land
     wherever they land. Two even columns instead, with the search and the
     primary action taking the full measure. */
  .samples-tools {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .samples-tools .button {
    width: 100%;
    min-height: 34px;
    padding-inline: 8px;
    font-size: var(--text-control);
  }
  .samples-search { order: -2; grid-column: 1 / -1; }
  .samples-search input { width: 100%; }
  .samples-selection { order: -1; grid-column: 1 / -1; text-align: left; }
  .samples-selection:empty { display: none; }
  .samples-tools [data-add-sample] { order: 1; grid-column: 1 / -1; }

  .samples-dialog-card { gap: 16px; padding: 22px 18px; }
  .samples-dialog-card h2 { font-size: 22px; }
  .sample-trace-stats { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .samples-series-fields { grid-template-columns: 1fr 1fr; }
  .samples-series-fields > :first-child { grid-column: 1 / -1; }
}

/* Landed on from a notebook mention — a brief flash, not a lasting state. */
tr[data-sample-row].is-highlighted { animation: sample-row-highlight 2.4s ease-out; }
@keyframes sample-row-highlight {
  0% { background: var(--blue-soft); }
  100% { background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  tr[data-sample-row].is-highlighted { animation: none; background: var(--blue-soft); }
}
