/* Variables, secure passwords and segments: their dialogs and the step editor's variable picker. */
.project-form label[hidden], .project-form [hidden] { display: none; }
.reusable-dialog h3 { margin: 20px 0 6px; font-size: 14px; }
.reusable-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; max-height: 220px; overflow: auto; }
/* The segments dialog is mostly its list: the list uses the dialog's height, which scrolls, instead of a small box of its own. */
.reusable-list.segment-list { max-height: none; overflow: visible; }
.reusable-list > li { padding: 8px 10px; font-size: 12px; }
.reusable-list > li + li { border-top: 1px solid var(--border-subtle); }
.reusable-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.reusable-copy { display: flex; flex-direction: column; gap: 2px; flex: 1 1 180px; min-width: 0; }
.reusable-copy code, .reusable-copy strong { font-size: 13px; overflow-wrap: anywhere; }
.reusable-value { overflow-wrap: anywhere; }
.reusable-actions { display: flex; gap: 6px; flex-shrink: 0; }
.reusable-actions .danger-text { color: var(--fail); }
/* Reads as unavailable, but stays operable: pressing it explains why. Quiet text and a dashed edge say so, and its words still read at 4.5:1. */
.reusable-actions .btn[data-blocked="true"] { color: var(--muted); border-style: dashed; }
.reusable-hint { margin: 4px 0 0; }
/* The form's heading says whether it adds or changes, with the way back to adding beside it. */
.reusable-form-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin: 20px 0 10px; }
.reusable-dialog .reusable-form-head h3 { margin: 0; }
/* What to add is chosen before its details: a variable, a secure password or an authenticator secret. */
.reusable-kinds { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.reusable-kinds legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.project-form .reusable-kind { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: 13px; cursor: pointer; }
.project-form .reusable-kind:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.project-form .reusable-kind:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.project-form .reusable-kind input[type=radio] { margin: 0; width: auto; padding: 0; border: 0; accent-color: var(--accent); }
/* A secret's name starts with its kind's prefix, which the form writes: it sits in front of the field the tester types the rest in. */
.reusable-name { display: flex; align-items: stretch; min-width: 0; }
.reusable-prefix { display: inline-flex; align-items: center; padding: 0 8px; border: 1px solid var(--border-strong); border-right: 0; border-radius: 7px 0 0 7px; background: var(--surface-sunken); color: var(--text); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.reusable-prefix[hidden] { display: none; }
.reusable-prefix:not([hidden]) + input { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.reusable-name input { flex: 1 1 auto; min-width: 0; }
/* What renaming a saved variable or secret changes, and what keeps the old name, read before the second Save. */
.rename-review { margin: 14px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 12px; }
.rename-review h4 { margin: 0 0 6px; font-size: 13px; }
.rename-review h4:focus { outline: none; }
.rename-review h4:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.rename-review p { margin: 6px 0 2px; }
.rename-review ul { margin: 0; padding-left: 18px; overflow-wrap: anywhere; }
.rename-review .rename-warning { color: var(--warn-ink); font-weight: 600; }
.reusable-confirm { margin: 0; flex: 1 1 200px; font-size: 12px; }
.reusable-range { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.variable-input { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.variable-input input { flex: 1 1 auto; min-width: 0; }
.field .variable-input select.variable-picker { width: auto; flex: 0 0 auto; font-family: var(--mono); font-size: 12px; }
/* The step editor sizes every input and select to 100% with an ID rule; inside a field with a picker the input keeps the row and the picker stays compact. */
#workspace .step-body .variable-input > input { flex: 1 1 auto; width: auto; min-width: 0; }
#workspace .step-body .variable-input > select.variable-picker { flex: 0 0 auto; width: auto; min-width: 0; max-width: min(40%, 11rem); padding-inline: 6px; text-overflow: ellipsis; }
/* Random values: the link beside a field's label, the dialog that builds a token, and the values a run typed. */
.field-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 2px 10px; min-width: 0; margin-bottom: 2px; }
.field-head > label { margin-bottom: 0; min-width: 0; }
#workspace .step-body .field-head { margin-bottom: 6px; }
#workspace .step-body .field-head > label { margin-bottom: 0; }
.field-head .random-insert { font-size: 11px; }
.random-dialog .random-about { margin: 0; }
.random-dialog .random-arg { margin: 16px 0; }
.random-dialog .random-arg > label { margin: 0 0 4px; }
.random-dialog .random-hint { display: block; font-size: 12px; line-height: 1.5; }
.random-dialog .random-charsets { margin: 16px 0; padding: 6px 12px 8px; border: 1px solid var(--border); border-radius: 8px; }
.random-dialog .random-charsets legend { padding: 0 4px; font-size: 13px; }
.random-dialog .random-charsets .checkbox-row { margin: 8px 0; }
.random-dialog .random-letters { margin: 0 0 12px; font-size: 12px; }
.random-dialog .random-letters summary { cursor: pointer; width: fit-content; }
.random-dialog .random-letters ul { margin: 6px 0 0; padding-left: 18px; columns: 2 12rem; }
.random-preview { display: grid; gap: 6px; margin: 16px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 12px; }
/* In the dialog, what the form makes stays in view just above its buttons (--dialog-actions is their bar's height). */
.random-dialog .random-preview { position: sticky; bottom: var(--dialog-actions, 0px); z-index: 1; }
/* Presets under a field: each puts its value in the field, the one the field holds is marked, and the field stays a text box. */
.value-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; margin: 6px 0 4px; }
.value-presets-label { font-size: 12px; color: var(--muted); }
.value-preset { min-height: 26px; padding: 2px 10px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: 12px/1.4 var(--mono); cursor: pointer; }
.value-preset:hover { background: var(--surface-hover); border-color: var(--accent-border); }
.value-preset[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-ink); font-weight: 600; }
.value-preset:disabled { cursor: not-allowed; opacity: .6; }
.random-preview code { font-family: var(--mono); overflow-wrap: anywhere; }
/* The tinted box needs a darker grey than the page's muted text to stay readable. */
.random-preview .muted { color: var(--muted); }
.random-preview .random-problem { margin: 0; color: var(--fail); }
.generated-values { margin: 0 0 12px; font-size: 12px; }
.generated-values ul { margin: 4px 0 0; padding-left: 18px; }
.generated-values code { font-family: var(--mono); overflow-wrap: anywhere; }
/* The text a Save text step saved, above anything the step typed. */
.generated-values .saved-text { margin: 0 0 4px; }
.viewer > .generated-values { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface); }
/* Steps inserted from a reusable segment. */
.step-title .step-segment { margin-left: 6px; padding: 1px 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 10px; font-weight: 600; vertical-align: middle; }
.step-segment-note { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; color: var(--muted); }
.reusable-usage { margin-top: 4px; font-size: 12px; }
.reusable-usage > summary { cursor: pointer; width: fit-content; }
.reusable-usage ul { margin: 4px 0 0; padding-left: 18px; }
.reusable-result { margin: 8px 0 0; font-size: 12px; white-space: pre-line; }
/* Importing takes a file or pasted JSON; the paste box is a field of the dialog like the rest, which style only inputs and selects. */
.project-form textarea.segment-json { box-sizing: border-box; width: 100%; min-width: 0; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface); color: var(--text); padding: 11px 12px; font: inherit; font-family: var(--mono); font-size: 12px; resize: vertical; }
/* Why a segment cannot be deleted yet: the tests holding copies, and who detaches each. */
.segment-in-use ul { margin: 8px 0; padding-left: 20px; font-size: 13px; }
.segment-in-use li + li { margin-top: 4px; }
/* The workspace Segments view shows the same rows on the page, so they sit in the surface instead of a scroll box of their own. */
#segments-panel .reusable-list { border: 0; border-radius: 0; max-height: none; overflow: visible; }
#segments-panel .reusable-list > li { padding: 14px 18px; font-size: 13px; }
/* A row grows with its list of tests, so its actions stay beside the name rather than drifting down the middle. */
#segments-panel .reusable-row { align-items: flex-start; }
#segments-panel .reusable-list > li + li { border-top: 1px solid var(--border); }
#segments-panel .reusable-copy strong { font-size: 14px; }
#segments-panel .reusable-result { margin: 0 0 16px; font-size: 13px; }
@media (max-width: 480px) {
  /* A phone-height dialog has no room for scroll boxes inside it: the dialog scrolls instead. */
  .reusable-list { max-height: none; overflow: visible; }
  .reusable-range { grid-template-columns: minmax(0, 1fr); }
  .reusable-actions { width: 100%; justify-content: flex-end; }
}

/* Edit the steps of a segment: one card per step, its fields from the action catalog. */
.segment-steps-dialog { width: min(920px, calc(100vw - 32px)); }
.segment-step-list { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; }
.segment-step { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--surface); display: grid; gap: 8px; }
.segment-step-head { display: flex; align-items: center; gap: 8px; }
.segment-step-action, .segment-step-head > .picker-row { flex: 1; min-width: 0; }
.segment-step .step-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.segment-preview { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.segment-preview:focus { outline: none; }
.segment-changes { padding-left: 20px; font-size: 13px; line-height: 1.6; }
.segment-change span { display: block; overflow-wrap: anywhere; }
.segment-change del { color: var(--fail-ink); }
.segment-change ins { color: var(--pass-ink); text-decoration: none; }
.segment-warning { background: var(--warn-soft); color: var(--warn-ink); border-radius: 6px; padding: 8px 10px; font-size: 13px; }
@media (max-width: 600px) { .segment-step-head { flex-wrap: wrap; } .segment-step .step-fields { grid-template-columns: 1fr; } }
.segment-step .field > label, .segment-step .field-head > label { display: block; }
/* Folders on the Segments page (segmentsView in app.js): a tinted heading with a folder icon and what it holds, then
   its segments, indented under it; a segment is dragged onto a heading, or onto Not in a folder. */
#segments-panel .reusable-list > li.segment-folder { padding: 0; }
.segment-folder-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 18px; background: var(--surface-muted); }
.segment-folder-head.is-drop-target, .segment-loose-label.is-drop-target { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft); }
.segment-folder-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 4px 0 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.segment-folder-chevron { width: 12px; color: var(--muted); }
.segment-folder-icon { flex: none; width: 18px; height: 18px; color: var(--brand-orange); }
.segment-folder-name { font-size: 14px; overflow-wrap: anywhere; }
.segment-folder-count { padding: 1px 8px; border: 1px solid var(--border); border-radius: var(--radius-pill); background: var(--panel); font-size: 11px; color: var(--muted); white-space: nowrap; }
.segment-folder-actions { display: flex; gap: 6px; }
.segment-folder-items { list-style: none; margin: 0 0 0 26px; padding: 0; border-left: 3px solid var(--border-strong); }
.segment-folder-items[hidden] { display: none; }
.segment-folder-items > li { padding: 12px 18px; font-size: 13px; }
.segment-folder-items > li + li { border-top: 1px solid var(--border); }
.segment-folder-empty { font-size: 12px; }
#segments-panel .reusable-list > li.segment-loose-label { padding: 8px 18px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); background: var(--surface-muted); }
.reusable-row[draggable="true"] { cursor: grab; }
.reusable-row.is-dragging { opacity: .5; }
