.lab-page { min-width: 0; }
.lab-view-nav { gap: 22px; margin-bottom: 22px; }
.lab-view-nav .nav-item { font-size: var(--text-control); }
.lab-view-panel { min-width: 0; }
.lab-view-panel > [hidden] { display: none; }

.parsers-page { min-width: 0; }
.parsers-page .equipment-head > div:first-child { display: flex; align-items: center; gap: 14px; }

.parser-list { min-height: 420px; border: 1px solid var(--line); background: var(--paper-raised); box-shadow: 0 9px 28px rgba(34, 31, 25, .045); }
.parser-list-head,
.parser-row { grid-template-columns: 28px minmax(200px, 1.3fr) minmax(100px, .7fr) minmax(100px, .7fr) 80px 120px; align-items: center; gap: 14px; padding: 0 14px; }
.parser-list-head { min-height: 39px; display: grid; border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--text-meta); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.parser-row { display: grid; min-height: 48px; border-bottom: 1px solid var(--line); cursor: pointer; }
.parser-row:last-child { border-bottom: 0; }
.parser-row:hover, .parser-row:focus-visible { background: rgba(24, 79, 209, .04); outline: none; }
.parser-row-icon .icon-button { width: var(--tap-dense, 28px); height: var(--tap-dense, 28px); color: var(--muted-line); }
.parser-row-icon .icon-button:hover { color: var(--blue); }
.parser-row-icon .icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[data-parser-edit-code] svg { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.parser-name { color: var(--ink); }
.parser-pending-badge { display: inline-block; padding: 2px 8px; border: 1px solid rgba(200, 140, 20, .4); border-radius: 3px; color: #b8790f; font-size: var(--text-meta); white-space: nowrap; }

.parser-field-list { min-height: 200px; border: 1px solid var(--line); background: var(--paper-raised); box-shadow: 0 9px 28px rgba(34, 31, 25, .045); }
.parser-field-list-head,
.parser-field-row { grid-template-columns: minmax(140px, .9fr) minmax(160px, 1.1fr) minmax(90px, .6fr) 110px 90px 76px; align-items: center; gap: 14px; padding: 0 14px; }
.parser-field-list-head { min-height: 39px; display: grid; border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--text-meta); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.parser-field-row { display: grid; min-height: 46px; border-bottom: 1px solid var(--line); }
.parser-field-row:last-child { border-bottom: 0; }
.parser-field-key { font-family: var(--sans); color: var(--muted); font-size: var(--text-body); }
.parser-field-status { display: inline-block; padding: 2px 8px; border: 1px solid var(--line); border-radius: 3px; font-size: var(--text-meta); }
.parser-field-status.is-default { color: var(--muted); }
.parser-field-status.is-custom { border-color: rgba(24, 79, 209, .4); color: var(--blue); }
.parser-field-status.is-archived { border-color: rgba(181, 59, 47, .4); color: var(--red); }

.equipment-page { min-width: 0; }
.equipment-head { min-height: 49px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.equipment-head-tools { display: flex; align-items: center; gap: 14px; }
.equipment-head-tools > span { color: var(--muted); font-size: var(--text-control); }
.equipment-list { min-height: 420px; border: 1px solid var(--line); background: var(--paper-raised); box-shadow: 0 9px 28px rgba(34, 31, 25, .045); }
.equipment-list-head,
.equipment-row { grid-template-columns: minmax(200px, 1.1fr) minmax(120px, .8fr) minmax(120px, .8fr) minmax(100px, .7fr) 180px 140px; align-items: center; gap: 14px; padding: 0 14px; }
.equipment-list-head { min-height: 39px; display: grid; border-bottom: 1px solid var(--line); color: var(--muted); font-size: var(--text-meta); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.equipment-list-body { min-height: 380px; }
.equipment-row { display: grid; min-height: 48px; border-bottom: 1px solid var(--line); }
.equipment-row:last-child { border-bottom: 0; }
.equipment-name a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.equipment-name a:hover { text-decoration-color: var(--ink); }
.equipment-status { display: inline-block; padding: 3px 9px; border: 1px solid var(--line); border-radius: 3px; font-size: var(--text-meta); white-space: normal; line-height: 1.4; }
.equipment-status.is-available { border-color: rgba(60, 130, 70, .4); color: #3c8246; }
.equipment-status.is-in_use { border-color: rgba(24, 79, 209, .4); color: var(--blue); }
.equipment-status.is-maintenance { border-color: rgba(200, 140, 20, .4); color: #b8790f; }
.equipment-status.is-out_of_service,
.equipment-status.is-retired { border-color: rgba(181, 59, 47, .4); color: var(--red); }
.equipment-actions { display: flex; align-items: center; gap: 2px; }
.equipment-actions .icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.equipment-actions .icon-button { color: var(--muted-line); }
.equipment-actions .icon-button:hover { color: var(--blue); }
.equipment-empty { padding: 18px 14px; color: var(--muted); }

.equipment-dialog { width: min(var(--dialog-md), calc(100% - 24px)); }
.equipment-dialog.is-booking { width: min(880px, calc(100% - 24px)); }
.equipment-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.equipment-form-card .dialog-head { margin-bottom: 22px; }
.booking-hint { margin: 0 0 10px; color: var(--muted); font-size: var(--text-control); }
/* The stock FullCalendar toolbar is the "monarch" theme's own atomic CSS
   (hashed classes, unreachable from here) — this is our own instead, sized
   to fit a modal rather than the full Calendar tab's page-width bar. */
.booking-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.booking-nav-buttons { display: flex; align-items: center; gap: 2px; }
.booking-nav-buttons .button { min-height: 26px; padding: 0 10px; font-size: var(--text-meta); }
.booking-nav-title { font-size: var(--text-control); font-weight: 600; }
/* FullCalendar draws its own frame inside here — no border/box of our own on
   top of it, or the calendar sits inside a redundant second box. */
.booking-calendar { margin-bottom: 18px; font-size: 10px; }
/* classNames handed to FullCalendar itself (see equipment.js) — the only
   reliable way to size its text, since the theme's own markup is unreachable.
   The weekday and date share one cell the theme renders with its own nested,
   separately-classed elements, so the size has to be forced onto everything
   inside rather than the cell itself. */
.booking-mini-day-header,
.booking-mini-day-header * { font-size: 9px !important; line-height: 1.2 !important; padding: 2px !important; }
.booking-mini-slot-label,
.booking-mini-slot-label * { font-size: 9px !important; line-height: 1.2 !important; }
.booking-mini-event { display: flex; flex-direction: column; gap: 0; padding: 1px 3px; line-height: 1.25; overflow: hidden; }
.booking-mini-event-time { font-size: 8px; opacity: .85; }
.booking-mini-event-title { font-size: 9px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.equipment-form-error { min-height: 18px; margin: 10px 0 0; color: var(--red); font-size: var(--text-control); }
/* A more defined field than the bare underline `.field` default elsewhere —
   the boxed style calendar.css uses for its event form. */
.equipment-form-card .field input,
.equipment-form-card .field select,
.equipment-form-card .field textarea {
  min-height: 38px;
  padding: 9px 12px;
  border: 1px solid #bfb9ab;
  border-radius: 3px;
  background: #fffdf7;
  font: 400 var(--text-reading)/1.4 var(--sans);
  transition: border-color .12s, box-shadow .12s;
}
.equipment-form-card .field textarea { min-height: 76px; resize: vertical; }
.equipment-form-card .field input::placeholder,
.equipment-form-card .field textarea::placeholder { color: #a8a294; }
.equipment-form-card .field input:hover,
.equipment-form-card .field select:hover,
.equipment-form-card .field textarea:hover { border-color: #8f8879; }
.equipment-form-card .field input:focus,
.equipment-form-card .field select:focus,
.equipment-form-card .field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(24, 79, 209, .16);
}

@media (max-width: 560px) {
  .equipment-form { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  /* Name, status and actions; type, location and team are the ones worth losing. */
  .equipment-list-head,
  .equipment-row { grid-template-columns: minmax(0, 1fr) 120px 130px; }
  .equipment-list-head > :nth-child(2),
  .equipment-list-head > :nth-child(3),
  .equipment-list-head > :nth-child(4),
  .equipment-row > :nth-child(2),
  .equipment-row > :nth-child(3),
  .equipment-row > :nth-child(4) { display: none; }
}

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

/* Equipment trace dialog — mirrors .samples-dialog-card's sample trace exactly. */
.equipment-trace-card { position: relative; display: grid; gap: 21px; padding: 28px; }
.equipment-trace-close { position: absolute; top: 12px; right: 12px; }
.equipment-trace-card header { padding-right: 28px; }
.equipment-trace-card h2 { margin: 0; font: 400 29px/1.05 var(--serif); letter-spacing: -.015em; }
.equipment-trace-card header p { margin: 8px 0 0; color: var(--muted); font-size: var(--text-body); }
.equipment-trace-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.equipment-trace-stats span { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); color: var(--muted); font-size: var(--text-label); }
.equipment-trace-stats b { color: var(--ink); font: 400 22px/1 var(--serif); }
.equipment-trace-projects { display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.equipment-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; }
.equipment-trace-projects button:hover { border-color: var(--blue); }
.equipment-trace-projects small { color: var(--muted); }

@media (max-width: 560px) {
  .equipment-trace-card { gap: 16px; padding: 22px 18px; }
  .equipment-trace-card h2 { font-size: 22px; }
  .equipment-trace-stats { grid-template-columns: 1fr 1fr; }
}

/* ── custom parser editor ─────────────────────────────────────────── */
/* Reuses .pres-composer (presentations.css) for the full-screen chrome, its
   CodeMirror/`.pres-code-bar`/`.pres-splitter` rules for both editors, and
   its splitter-drag mechanics (see draggable() in parser-editor.js, ported
   from the deck composer's own — same behavior, not shared code). Only the
   body layout itself — two panes, each with its own code/toolbar/log or
   code/toolbar/preview/log stack — is new. */
.parser-composer-body {
  min-height: 0; display: grid;
  --parser-left-width: 620px;
  grid-template-columns: var(--parser-left-width) 5px minmax(280px, 1fr);
}
.parser-pane {
  min-height: 0; display: grid; background: var(--paper);
  --parser-log-height: 200px;
  grid-template-rows: auto minmax(0, 1fr) auto 5px var(--parser-log-height);
}
.parser-pane .pres-code-wrap { min-height: 0; overflow: hidden; }
.parser-pane-plot {
  --plot-code-height: 260px; --plot-log-height: 140px;
  grid-template-rows: auto var(--plot-code-height) auto 5px minmax(80px, 1fr) 5px var(--plot-log-height);
}

/* The masthead each half needs to read as its own step, not a stray code box:
   a numbered badge plus what it's for. */
.parser-pane-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px;
  border-bottom: 1px solid var(--line); background: var(--paper-raised);
  color: var(--muted); font-size: var(--text-meta); font-weight: 700;
  letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.parser-pane-head-num {
  display: inline-flex; flex: none; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-size: 10px; font-weight: 700;
}
.parser-pane-head-note { margin-left: auto; color: var(--muted-line); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* The one divider that separates the two halves, not just a resize handle
   within one of them — a stronger color says so at a glance. */
.parser-pane-divider { background: var(--ink); }

/* The parser pane's own controls — name, extensions, the sample file, Test —
   live right under its code, the same position Run holds for the plot pane,
   so both editors read as "code, then how you run it" rather than a strip
   of unrelated controls floating above the whole screen. */
.parser-toolbar { flex-wrap: wrap; row-gap: 6px; }
.parser-toolbar-field { display: flex; flex-direction: row; align-items: center; gap: 6px; }
.parser-toolbar-field span { color: var(--muted); font-size: var(--text-meta); }
.parser-toolbar-field input,
.parser-toolbar-field select { width: 180px; min-height: 26px; padding: 0 8px; border: 1px solid var(--line); background: var(--paper); font-size: var(--text-control); }
.parser-toolbar-field select { width: 140px; }
.parser-sample-name { color: var(--muted); font-size: var(--text-control); }

.parser-log { min-height: 0; overflow: auto; padding: 10px 12px; border-top: 1px solid var(--line); background: white; font-size: var(--text-control); }
.parser-log-out { margin: 0 0 8px; white-space: pre-wrap; color: var(--muted); font: 11px/1.5 var(--mono); }
.parser-log-ok { margin: 0; color: var(--green); }
.parser-result-placeholder { margin: 0; color: var(--muted); }
.parser-result-kind { margin: 0 0 8px; color: var(--muted); font-size: var(--text-meta); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.parser-result-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.parser-result-error { margin: 0; white-space: pre-wrap; color: var(--red); font: 11px/1.5 var(--mono); }

.parser-plot-preview { min-height: 0; display: grid; place-items: center; overflow: auto; padding: 10px; background: white; }
.parser-plot-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }

@media (max-width: 900px) {
  .parser-composer-body { grid-template-columns: 1fr !important; grid-auto-rows: minmax(360px, 1fr); overflow-y: auto; }
  .parser-composer-body [data-splitter-panes] { display: none; }
}
