/*
 * The practice's own bench, configured.
 *
 * The colours live here rather than as Tailwind text utilities for the reason the bench records:
 * `index.css` wins at (1,0,1) against a bare class on a `p`, so a `text-` utility silently does
 * nothing.
 */

.diagnostics-note {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.diagnostics-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diagnostics-catalogue,
.diagnostics-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.diagnostics-choice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.diagnostics-setup {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.diagnostics-setup .diagnostics-choice {
    gap: 9px;
    margin: 12px 0;
}

.diagnostics-setup__lede {
    margin: 5px 0 12px;
}

.diagnostics-setup__inset {
    padding-left: 24px;
}

.diagnostics-setup__inset-head {
    margin: 18px 0;
}

.diagnostics-setup__inset-note {
    margin: 5px 0 12px;
}

.diagnostics-setup__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 18px;
}

.diagnostics-setup__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 0;
    flex-wrap: wrap;
}

.diagnostics-list {
    display: flex;
    flex-direction: column;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

/* One line of a panel's list, as the deck's laboratory and catalogue boards: what it is on the left,
   its actions on the right, a rule under each. */
.diagnostics-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 16px;
    row-gap: 4px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line-soft);
}

.diagnostics-row > :not(.diagnostics-row-actions) {
    grid-column: 1;
}

.diagnostics-row-lead {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* The practice's own short code, which is what its staff say out loud. */
.diagnostics-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 600;
    color: var(--foreground);
}

.diagnostics-name {
    font-weight: 500;
    color: var(--foreground);
}

.diagnostics-row-detail {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.diagnostics-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.diagnostics-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* A caption over a pair of buttons or a repeating group, so it is not a `label` for one control. */
.diagnostics-field-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.diagnostics-kind-choice {
    display: flex;
    gap: 0.5rem;
}

/* Name, unit, low, high, remove. The two bounds are narrow because a range is rarely long. */
.diagnostics-analyte {
    display: grid;
    grid-template-columns: 2fr 1fr 0.7fr 0.7fr auto;
    gap: 0.5rem;
    align-items: center;
}

.diagnostics-editor {
    max-width: 44rem;
}

/* A laboratory the practice has stopped using. Still listed, and legibly not in use. */
.diagnostics-row-off .diagnostics-name {
    color: var(--muted-foreground);
}

.diagnostics-row-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* A laboratory carries four actions; beside its address they squeeze it into a sliver, so they take their own line. */
.diagnostics-row--stacked {
    grid-template-columns: minmax(0, 1fr);
}

.diagnostics-row--stacked .diagnostics-row-actions {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
}

@media (max-width: 640px) {
    .diagnostics-row {
        grid-template-columns: minmax(0, 1fr);
    }

    .diagnostics-row-actions {
        grid-column: 1;
        grid-row: auto;
        justify-content: flex-start;
    }
}

/* The transport, its name, and the note under it. The note starts under the name, not the radio. */
.diagnostics-transport {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: start;
    column-gap: 0.5rem;
    font-size: 0.875rem;
}

.diagnostics-transport-note {
    grid-column-start: 2;
    display: block;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* One field a laboratory expects: where it goes, what goes in it, and how it is written. */
.lab-profile-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--ak-card-radius);
}

/* A native select rather than a listbox component: the options are a short fixed list, and the
   platform control is the one a keyboard and a screen reader already know. */
.lab-profile-select {
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    background: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
}

.diagnostics-retry {
    margin-top: 0.5rem;
}

/* Pairing a laboratory's order codes: one row per test, scrolling sideways on a phone. */
.diagnostics-pairings-scroll {
    overflow-x: auto;
}

.diagnostics-pairings {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.diagnostics-pairings th {
    text-align: left;
    font-weight: 500;
    color: var(--muted-foreground);
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--line);
}

.diagnostics-pairings td {
    padding: 0.375rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.diagnostics-pairings td:last-child {
    min-width: 9rem;
}

.diagnostics-pairings th,
.diagnostics-pairings td {
    overflow-wrap: normal;
    word-break: normal;
}

.diagnostics-pairing-standard {
    white-space: nowrap;
}

/* On a phone the code sits under the test name rather than in a column of its own. */
.diagnostics-pairing-code {
    display: none;
}

@media (max-width: 480px) {
    .diagnostics-pairing-standard {
        display: none;
    }

    .diagnostics-pairing-code {
        display: block;
        color: var(--muted-foreground);
        white-space: nowrap;
    }

    .diagnostics-pairings td:last-child {
        min-width: 7rem;
    }
}
.diagnostics-unused {
    margin: 0.25rem 0 0;
    padding-left: 1.25rem;
    list-style: disc;
    font-size: 0.875rem;
}
