/* ==========================================================================
   R&D LAB - the Inks tab: ink cards, the product form and channel sections.
   Theme tokens only; the shared .pill, .dtable and .field classes do the rest.
   ========================================================================== */

.rdi-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.rdi-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 479px) { .rdi-2col { grid-template-columns: 1fr; } }
.rdi-spacer { flex: 1; }
.rdi-none { margin: 4px 0 8px; font-size: 13px; }

/* --- the list ------------------------------------------------------------------ */
.rdi-filters .select { width: auto; flex: 0 1 auto; min-width: 0; }
.rdi-filters .search-wrap { flex: 1 1 220px; min-width: 0; }
@media (max-width: 699px) { .rdi-filters .select { flex: 1 1 calc(50% - 9px); } }
.rdi-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rdi-card {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink);
  text-align: left; font: inherit; cursor: pointer; box-shadow: var(--shadow-card);
}
.rdi-card:hover { border-color: var(--line2); }
.rdi-card:focus-visible { outline: 2px solid var(--brand-quiet); outline-offset: 2px; }
.rdi-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.rdi-card-name { font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.rdi-card-line { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink2); }
.rdi-card-counts b { color: var(--ink); }

/* --- the detail page ------------------------------------------------------------- */
.rdi-top { margin-bottom: 10px; }
.rdi-back-ic { transform: rotate(90deg); }
.rdi-panel { margin-bottom: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.rdi-panel h4 { margin: 12px 0 4px; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rdi-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rdi-panel-head h2, .rdi-panel-head h3 { margin: 0; font-size: 16px; }
.rdi-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 10px; }
.rdi-section-head h2 { margin: 0; font-size: 17px; }
.rdi-channels-pick { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.rdi-channels-pick .check { margin: 0; min-height: 32px; font-size: 14px; }
.rdi-form-actions { display: flex; justify-content: flex-end; }
.rdi-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin: 0; }
.rdi-facts dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.rdi-facts dd { margin: 0; overflow-wrap: anywhere; }

.rdi-channel.has-warning { border-color: var(--warn); }
.rdi-warning { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--warn-soft); color: var(--warn-text); font-size: 13px; font-weight: 600; }
.rdi-warning svg { width: 16px; height: 16px; flex: none; }

.rdi-revs { list-style: none; margin: 0; padding: 0; }
.rdi-rev { padding: 8px 0; border-top: 1px solid var(--line); }
.rdi-rev:first-child { border-top: 0; }
.rdi-rev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rdi-parent, .rdi-arrow { color: var(--muted); }

.rdi-parent-row { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 8px; margin-bottom: 6px; }
.rdi-parent-row label { font-size: 13px; color: var(--ink2); }
.rdi-parent-row.hidden { display: none; }
@media (max-width: 479px) { .rdi-parent-row { grid-template-columns: 1fr; gap: 2px; } }

/* --- the Reference data tab ---------------------------------------------------------- */
.rdr-tabs { margin-bottom: 14px; }
@media (max-width: 699px) { .rdr-tabs { display: flex; overflow-x: auto; flex-wrap: nowrap; } .rdr-tabs .seg-opt span { white-space: nowrap; } }
.rdr-printer { max-width: 320px; }
.rdr-sub { margin: 14px 0 8px; font-size: 14px; }
.rdr-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rdr-chip { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); color: var(--ink2); font-size: 12.5px; overflow-wrap: anywhere; }
.rdr-desc { margin: 0 0 8px; color: var(--ink2); overflow-wrap: anywhere; }
.rdr-layers { margin: 0 0 8px; padding-left: 20px; }
.rdr-layers li { margin: 4px 0; }
.rdr-patch-head { margin: 12px 0 4px; }
.rdr-patch-head h4 { margin: 0; }
.rdr-confirm { font-style: italic; }

.rdr-rev { margin: 0 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.rdr-rev:first-of-type { border-top: 0; padding-top: 0; }
.rdr-rev > h4 { margin: 0 0 4px; }
.rdr-rev summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.rdr-rev-meta { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.rdr-rev-note { margin-bottom: 6px; font-size: 13.5px; font-weight: 600; }
.rdr-proc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.rdr-proc-edit { min-height: 200px; }

.rdr-layer { margin-bottom: 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel2); }
.rdr-layer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rdr-layer-head .select { width: auto; min-width: 0; flex: 0 1 140px; }
.rdr-grades input { min-width: 0; }
@media (min-width: 700px) { .rdr-grades td { padding: 4px 6px; } }

/* --- the Test projects tab ------------------------------------------------------------ */
.rdp-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.rdp-state { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.rdp-state.is-saved { color: var(--ok-text); }
.rdp-state.is-held { color: var(--muted); font-style: italic; }
.rdp-state.is-error { color: var(--dmg-text); font-weight: 600; }
.rdp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.rdp-grid .rdp-wide { grid-column: 1 / -1; }
@media (max-width: 599px) { .rdp-grid { grid-template-columns: 1fr; } }

.rdp-products { display: flex; flex-direction: column; gap: 10px; }
.rdp-product { display: grid; grid-template-columns: 1.4fr 1fr 1.4fr auto; gap: 0 10px; align-items: end; padding: 10px 10px 0; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel2); }
.rdp-product-end { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; min-height: 40px; }
@media (max-width: 799px) { .rdp-product { grid-template-columns: 1fr 1fr; } .rdp-product .field:first-child, .rdp-product .field:nth-child(3) { grid-column: 1 / -1; } }
@media (max-width: 479px) { .rdp-product { grid-template-columns: 1fr; } }

.rdp-vals { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.rdp-val { display: inline-flex; align-items: center; gap: 6px; }
.rdp-val .input { width: 110px; min-width: 0; }
.rdp-pos { font-size: 12.5px; color: var(--muted); min-width: 34px; }
.rdp-unit { font-size: 13px; color: var(--ink2); }

.rdp-runs .rdi-rev { padding: 0; }
.rdp-run { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 4px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.rdp-run:hover { background: var(--panel2); }
.rdp-run:focus-visible { outline: 2px solid var(--brand-quiet); outline-offset: -2px; }
.rdp-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.rdp-file:focus-visible + .btn { outline: 2px solid var(--brand-quiet); outline-offset: 2px; }

/* --- the run editor ------------------------------------------------------------------ */
.rde-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.rde-steps { min-width: 0; }
.rde-strip { position: sticky; top: 12px; }
.rde-strip ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rde-strip-step {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--touch); padding: 8px 10px;
  border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-xs); background: var(--panel);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.rde-strip-step:hover { background: var(--panel2); }
.rde-strip-step:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rde-strip-step.is-done { border-left-color: var(--ok); }
.rde-strip-step.is-missing { border-left-color: var(--caution); }
.rde-strip-text { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.rde-strip-text span { color: var(--muted); }
.rde-strip-step.is-done .rde-strip-text span { color: var(--ok-text); }
.rde-strip-step.is-missing .rde-strip-text span { color: var(--caution-text); }
.rde-num {
  display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px;
  border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink2);
}
.rde-step h2:focus, .rde-cfg h3:focus { outline: none; }
.rde-step h2:focus-visible, .rde-cfg h3:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rde-step, .rde-cfg { scroll-margin-top: 12px; }

.rde-banner { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; padding: 8px 10px; border-radius: var(--radius-xs); background: var(--ok-soft); color: var(--ok-text); font-size: 14px; font-weight: 600; }
.rde-banner.is-returned { background: var(--caution-soft); color: var(--caution-text); }
.rde-banner svg { width: 16px; height: 16px; flex: none; }

.rde-cfg { padding: 10px 0 4px; border-top: 1px solid var(--line); }
.rde-cfg:first-of-type { border-top: 0; }
.rde-cfg-head h3, .rde-cfg-head h4 { margin: 0; font-size: 15px; }
.rde-cfg-head h4 { font-size: 12px; }
.rde-cfgs { list-style: none; margin: 0; padding: 0; }
.rde-cfgs .rde-cfg:first-child { border-top: 0; }
.rde-notes { margin: 0 0 8px; padding-left: 20px; font-size: 13.5px; color: var(--ink2); }
.rde-add { display: flex; align-items: flex-end; gap: 8px; margin-top: 10px; }
.rde-add .field { flex: 1 1 260px; min-width: 0; margin-bottom: 0; }
.rde-add-info { margin-top: 8px; }

.rde-inks { display: flex; flex-direction: column; gap: 8px; }
.rde-ink { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 0 10px; align-items: end; padding: 10px 10px 0; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel2); }
.rde-ink-what { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 14px; min-height: 40px; }
.rde-ink-note { grid-column: 2 / -1; }
.rde-nolots { grid-column: 2 / -1; margin: -6px 0 10px; }

.rde-settings .rdp-val .input { width: 90px; }
.rde-param { white-space: nowrap; }
.rde-perink { margin-top: 6px; }
.rde-perink-head { margin: 8px 0 0; font-size: 14px; }
.rde-ambient .input { min-width: 0; }
.rde-ambient .rdp-val .input { width: 90px; }

.rde-tests { list-style: none; margin: 0; padding: 0; }
.rde-test { padding: 8px 0; border-top: 1px solid var(--line); }
.rde-test:first-child { border-top: 0; }
.rde-test-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.rde-test .seg-opt span { padding: 5px 11px; font-size: 13px; }
.rde-test .seg-opt input:disabled + span { opacity: 0.6; cursor: not-allowed; }
.rde-reason { margin: 8px 0 0; }
.rde-proc { margin-top: 6px; }
.rde-proc summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--brand-quiet); min-height: 32px; display: flex; align-items: center; gap: 6px; }
.rde-proc .rdr-proc { margin-top: 6px; padding: 10px; border-radius: var(--radius-xs); background: var(--panel2); }

.rde-checks { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--caution); border-radius: var(--radius-xs); background: var(--caution-soft); }
.rde-checks p { margin: 0 0 4px; color: var(--caution-text); }
.rde-checks ul { margin: 0; padding-left: 18px; }
.rde-link { padding: 4px 0; min-height: 32px; border: 0; background: transparent; color: var(--brand-quiet); font: inherit; font-size: 14px; text-align: left; text-decoration: underline; cursor: pointer; }
.rde-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rde-ready { color: var(--ok-text); font-weight: 600; }

@media (max-width: 899px) {
  .rde-layout { grid-template-columns: minmax(0, 1fr); }
  .rde-strip { position: static; }
  .rde-strip ol { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 699px) {
  .rde-ink { grid-template-columns: 1fr; }
  .rde-ink-note, .rde-nolots { grid-column: 1; }
  .rde-ink-what { margin-bottom: 4px; min-height: 0; }
  .rde-add { flex-direction: column; align-items: stretch; }
  /* The settings table becomes one card per parameter, its kinds side by side and wrapping; a lone kind takes the full width. */
  .dtable.rde-settings { border: 0; background: transparent; }
  .dtable.rde-settings tbody { display: flex; flex-direction: column; gap: 8px; }
  .dtable.rde-settings tr { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--panel); }
  .dtable.rde-settings tr:last-child { border-bottom: 1px solid var(--line); }
  .dtable.rde-settings td { display: block; flex: 1 1 140px; min-width: 0; padding: 0; }
  .dtable.rde-settings td:empty { display: none; }
  .dtable.rde-settings td::before { display: block; margin-bottom: 4px; }
  .dtable.rde-settings td.rde-param { flex-basis: 100%; white-space: normal; }
  .dtable.rde-settings td.rde-param::before { display: none; }
  .dtable.rde-settings .rdp-vals { flex-direction: column; gap: 6px; }
  .dtable.rde-settings .rdp-val .input, .rde-ambient .rdp-val .input { width: 100%; flex: 1; }
  .rde-test .seg { display: flex; width: 100%; }
  .rde-test .seg-opt { flex: 1; }
  .rde-test .seg-opt span { justify-content: center; text-align: center; }
  .rde-strip ol { grid-template-columns: 1fr 1fr; }
}
