/* ===========================================================================
   Physical therapy screens — shared design system.

   Transcribed from the PT client prototype so the PT module reads as one thing.
   The prototype is flat and dense on purpose: 5px radii, 1px keylines, almost no
   shadow, teal as the single accent. It is a clinical tool, not a dashboard.

   Why this is global rather than per component. Blazor scopes a component
   stylesheet to that component's own markup, so sharing a look across the PT
   screens meant restating the same rules in every file — the tokens had already
   drifted into three different palettes. This is the one place they live.

   Everything is namespaced `pt-`, and the tokens are defined on `.pt-scope`
   rather than `:root`, so nothing here can reach the rest of the application.
   PTPageHeader renders that wrapper, so every PT screen inherits it.
   ======================================================================== */

.pt-scope {
    /* The application's own teal family, read out of wwwroot/css/CompMedical.css
       rather than chosen here, so the PT screens match what the rest of the
       product already uses:

         #008080  the teal on status badges, PendingPTProvider among them
         #83b8bd  the teal border on submenu hover
         #e1f7f6  the teal wash behind it
         #f4f9f9  the lighter wash on checkbox hover
         #a9c9c9  the teal border on form controls
         #deebeb  the wash paired with #008080 on badges
         #eff2f3  the application background

       Changing the accent is this block, not a sweep through the file. */
    --pt-ink: #100f0d;          /* the app's --font-color */
    --pt-muted: #6b7a7a;        /* derived: no neutral token exists in the app */
    /* Darkened from the app's #008080, same hue, for a heavier accent.
       White on it measures 10.2:1 against 4.8:1 for #008080 — both pass AA at
       normal size, this one reaches AAA. */
    --pt-accent: #00494a;
    --pt-accent-dark: #003334;  /* pressed/hover step down, 13.8:1 */
    --pt-accent-soft: #83b8bd;
    --pt-wash: #e1f7f6;
    --pt-wash-soft: #f4f9f9;
    --pt-line: #deebeb;
    --pt-bg: #eff2f3;           /* the app's --background-color */
    --pt-white: #fff;
    --pt-amber: #91611e;
    --pt-amber-bg: #fff3da;
    --pt-amber-line: #eddfbf;
    --pt-red: #bb2324;          /* the app's --primary-color, used here for errors */
    --pt-red-bg: #fff1ef;
    --pt-red-line: #eecac5;
    --pt-field-line: #a9c9c9;
    --pt-focus: #83b8bd;

    font: 14px/1.5 'Segoe UI', Arial, sans-serif;
    color: var(--pt-ink);
}

    .pt-scope *,
    .pt-scope *::before,
    .pt-scope *::after {
        box-sizing: border-box;
    }

    .pt-scope h3,
    .pt-scope h4 {
        margin-top: 0;
        font-weight: 650;
    }

/* ------------------------------------------------------------------ type */

.pt-block {
    padding: 0 0 24px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--pt-line);
}

    .pt-block:last-of-type {
        margin-bottom: 0;
        border-bottom: 0;
    }

    /* A block dropped into one of the treatment cards supplies no spacing of its
       own — the card already has padding, and both together leave a gap at the
       bottom that reads as a rendering fault. */
    .pt-treatment-card > .pt-block {
        padding-bottom: 0;
        margin-bottom: 0;
        border-bottom: 0;
    }

.pt-block-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    color: var(--pt-muted);
    margin: 0 0 12px;
}

.pt-flow-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pt-muted);
    margin: 20px 0 8px;
}

.pt-hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--pt-muted);
    margin: 0 0 12px;
}

    .pt-hint strong {
        color: var(--pt-ink);
        font-weight: 600;
    }

    .pt-hint em {
        font-style: normal;
        font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
        font-size: 11.5px;
        color: var(--pt-ink);
    }

.pt-placeholder {
    font-size: 12px;
    color: var(--pt-muted);
}

.pt-tiny {
    font-size: 12px;
}

/* ----------------------------------------------------------------- facts */

/* The prototype's stat strip: one bordered band, keylines between cells. */
.pt-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    border: 1px solid var(--pt-line);
    background: var(--pt-white);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 24px;
}

.pt-fact {
    padding: 16px 20px;
    border-right: 1px solid var(--pt-line);
}

    .pt-fact:last-child {
        border-right: 0;
    }

.pt-fact-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pt-muted);
}

.pt-fact-value {
    display: block;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    margin: 6px 0 2px;
}

    /* Absent rather than empty: a blank cell reads as "nothing wrong". */
    .pt-fact-value.muted {
        font-weight: 400;
        color: var(--pt-muted);
    }

.pt-fact-note {
    display: block;
    font-size: 11px;
    color: var(--pt-muted);
}

/* ------------------------------------------------------------------ tags */

.pt-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 7px;
    border-radius: 4px;
    background: #eef3f3;
    color: var(--pt-muted);
}

.pt-tag-green {
    color: var(--pt-accent);
    background: var(--pt-wash);
}

.pt-tag-amber {
    color: var(--pt-amber);
    background: var(--pt-amber-bg);
}

.pt-tag-red {
    color: var(--pt-red);
    background: var(--pt-red-bg);
}

/* --------------------------------------------------------------- banners */

/* One banner shape, four meanings. The prototype's wash is the neutral one. */
.pt-assign,
.pt-notice,
.pt-intake-carried,
.pt-intake-warn {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px 15px;
    border: 1px solid #bfdede;
    border-radius: 5px;
    background: var(--pt-wash);
    margin: 0 0 18px;
    font-size: 13px;
    line-height: 1.5;
}

.pt-assign-info {
    color: var(--pt-ink);
    background: var(--pt-wash);
    border-color: #bfdede;
}

.pt-assign-warn,
.pt-notice-amber,
.pt-intake-carried {
    color: #7f571a;
    background: var(--pt-amber-bg);
    border-color: var(--pt-amber-line);
}

.pt-intake-warn {
    color: var(--pt-red);
    background: var(--pt-red-bg);
    border-color: var(--pt-red-line);
}

.pt-intake-done {
    font-size: 12px;
    color: var(--pt-accent);
    margin: 10px 0 0;
}

.pt-progress-error,
.pt-error {
    color: var(--pt-red);
    background: var(--pt-red-bg);
    border: 1px solid var(--pt-red-line);
    border-radius: 5px;
    padding: 11px 13px;
    font-size: 12px;
}

/* --------------------------------------------------------------- controls */

.pt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 37px;
    padding: 8px 12px;
    border: 1px solid var(--pt-field-line);
    border-radius: 5px;
    background: var(--pt-white);
    color: var(--pt-ink);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

    .pt-btn:hover:not(:disabled) {
        border-color: var(--pt-accent);
        background: var(--pt-wash-soft);
    }

    .pt-btn:disabled {
        cursor: not-allowed;
        opacity: 0.45;
    }

.pt-btn-primary {
    background: var(--pt-accent);
    border-color: var(--pt-accent);
    color: var(--pt-white);
}

    .pt-btn-primary:hover:not(:disabled) {
        background: var(--pt-accent-dark);
        border-color: var(--pt-accent-dark);
    }

.pt-btn-small {
    min-height: 29px;
    padding: 5px 8px;
    font-size: 11px;
}

.pt-btn-wide {
    width: 100%;
    justify-content: center;
}

.pt-link {
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    color: var(--pt-accent);
    cursor: pointer;
}

    .pt-link:hover {
        text-decoration: underline;
    }

.pt-input,
.pt-scope select,
.pt-scope textarea {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--pt-field-line);
    border-radius: 5px;
    padding: 9px 11px;
    font: inherit;
    font-size: 13px;
    color: var(--pt-ink);
    background: var(--pt-white);
}

.pt-scope textarea {
    resize: vertical;
    min-height: 84px;
}

.pt-input:focus,
.pt-scope select:focus,
.pt-scope textarea:focus,
.pt-scope button:focus-visible {
    outline: 3px solid var(--pt-focus);
    outline-offset: 2px;
}

.pt-mono {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12.5px;
}

.pt-entry-row {
    display: flex;
    gap: 9px;
    align-items: center;
    flex-wrap: wrap;
}

.pt-field {
    display: grid;
    gap: 6px;
    font-size: 12px;
    max-width: 520px;
}

    .pt-field > span {
        font-weight: 600;
    }

.pt-field-narrow {
    max-width: 220px;
}

/* ---------------------------------------------------------------- checks */

/* Drawn rather than native, to match the marks used on the flowsheet. */
.pt-check {
    position: relative;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    border: 1px solid var(--pt-field-line);
    border-radius: 4px;
    background: var(--pt-white);
}

    .pt-check.on {
        background: var(--pt-accent);
        border-color: var(--pt-accent);
    }

        .pt-check.on::after {
            content: "";
            position: absolute;
            left: 5px;
            top: 2px;
            width: 5px;
            height: 9px;
            border: solid var(--pt-white);
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }

/* --------------------------------------------------------------- regions */

/* Three across, as the prototype has it — eleven regions in three columns reads
   as a chooser; one per row reads as a list to scroll. */
.pt-region-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 1000px) {
    .pt-region-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .pt-region-grid {
        grid-template-columns: 1fr;
    }
}

.pt-region {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--pt-line);
    border-radius: 5px;
    background: var(--pt-white);
    padding: 10px;
    font-size: 12px;
}

    .pt-region.tracked {
        border-color: var(--pt-accent-soft);
        background: var(--pt-wash-soft);
    }

.pt-region-check {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    border: 0;
    background: none;
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--pt-ink);
    text-align: left;
    cursor: pointer;
}

/* The region names itself, and the instrument it routes to sits under it as a
   caption — the choice is the region; the instrument is the consequence. */
.pt-region-label {
    display: block;
    min-width: 0;
    font-size: 12px;
    line-height: 1.3;
}

.pt-region-instrument {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    font-weight: 400;
    color: var(--pt-muted);
}

.pt-region.tracked .pt-region-label {
    font-weight: 600;
}

.pt-reassign {
    margin-top: 16px;
    padding: 15px;
    border: 1px solid var(--pt-line);
    border-radius: 5px;
    background: #f7fbfb;
}

/* ------------------------------------------------------------------- log */

.pt-log {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

    .pt-log li {
        display: flex;
        gap: 12px;
        align-items: baseline;
        font-size: 12px;
        color: var(--pt-ink);
        padding: 12px 0;
        border-bottom: 1px solid var(--pt-line);
    }

        .pt-log li:last-child {
            border-bottom: 0;
        }

.pt-log-date {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--pt-muted);
    font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------- diagnosis */

.pt-dx {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--pt-line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--pt-white);
}

.pt-dx-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 4px 14px;
    padding: 13px 14px;
    border-top: 1px solid var(--pt-line);
}

    .pt-dx-row:first-child {
        border-top: 0;
    }

.pt-dx-code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 12px;
    font-weight: 700;
}

.pt-dx-text {
    font-size: 12px;
    line-height: 1.45;
}

.pt-dx-side {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pt-amber);
}

.pt-dx-tags {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.pt-dx-note {
    grid-column: 1 / -1;
    font-style: normal;
    font-size: 11px;
    color: var(--pt-muted);
}

/* ------------------------------------------------------------ intake review */

.pt-intake-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

    .pt-intake-head .pt-block-title {
        margin: 0;
    }

.pt-intake-parts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pt-intake-part {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pt-ink);
    background: var(--pt-white);
    border: 1px solid var(--pt-line);
    border-radius: 5px;
    padding: 6px 9px;
}

    .pt-intake-part em {
        font-style: normal;
        font-weight: 400;
        font-size: 11px;
        color: var(--pt-muted);
    }

.pt-intake-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    line-height: 1.7;
}

.pt-intake-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pt-intake-adl {
    border: 1px solid var(--pt-line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--pt-white);
}

.pt-intake-adlrow {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 4px 14px;
    padding: 11px 14px;
    font-size: 12px;
    border-top: 1px solid var(--pt-line);
}

    .pt-intake-adlrow:first-child {
        border-top: 0;
    }

    /* A "yes" is the patient reporting difficulty, so it is the row that is marked. */
    .pt-intake-adlrow.difficulty {
        background: var(--pt-amber-bg);
        font-weight: 600;
    }

    .pt-intake-adlrow em {
        grid-column: 1 / -1;
        font-style: normal;
        font-size: 11px;
        font-weight: 400;
        color: var(--pt-muted);
    }

.pt-intake-adlanswer {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--pt-muted);
}

.pt-intake-adlrow.difficulty .pt-intake-adlanswer {
    color: var(--pt-amber);
}

.pt-intake-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.pt-draft {
    margin: 0 0 12px;
    padding: 15px;
    border: 1px solid var(--pt-line);
    border-radius: 5px;
    background: var(--pt-white);
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ------------------------------------------------------------------ tabs */

.pt-tabs {
    display: flex;
    gap: 23px;
    border-bottom: 1px solid var(--pt-line);
    margin-bottom: 22px;
    overflow: auto;
}

.pt-tab {
    border: 0;
    background: transparent;
    color: var(--pt-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 0 0 11px;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

    .pt-tab.active {
        color: var(--pt-accent);
        border-bottom-color: var(--pt-accent);
    }

/* ------------------------------------------------- questionnaire and score */

/* The run of questions. Had no rule of its own before — the wrapper was in the
   markup with nothing behind it, so the first question sat flush against the
   region tabs. */
.pt-questions {
    margin-top: 4px;
}

.pt-question {
    padding: 18px 0;
    border-bottom: 1px solid var(--pt-line);
    scroll-margin: 20px;
}

.pt-question-prompt {
    font-size: 14px;
    font-weight: 650;
    margin: 0 0 10px;
}

.pt-options {
    display: grid;
    gap: 5px;
}

.pt-option {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--pt-white);
    border: 1px solid var(--pt-line);
    padding: 9px 12px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    font: inherit;
    color: var(--pt-ink);
}

    .pt-option.selected {
        background: var(--pt-wash-soft);
        border-color: var(--pt-accent-soft);
    }

.pt-score-card {
    border: 1px solid var(--pt-line);
    border-radius: 6px;
    background: var(--pt-white);
    padding: 20px;
    margin-bottom: 18px;
}

.pt-score-big {
    font-size: 42px;
    font-weight: 600;
    line-height: 1.2;
    margin: 12px 0 6px;
    color: var(--pt-accent);
}

    .pt-score-big small {
        font-size: 15px;
        font-weight: 400;
        color: var(--pt-muted);
    }

.pt-progress {
    height: 5px;
    border-radius: 5px;
    background: var(--pt-line);
    overflow: hidden;
    margin: 12px 0;
}

    .pt-progress > div {
        height: 100%;
        background: var(--pt-accent);
    }

/* The questionnaire beside its running score. */
.pt-measure {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1100px) {
    .pt-measure {
        grid-template-columns: minmax(0, 1fr) 280px;
        align-items: start;
    }

    .pt-score-side {
        position: sticky;
        top: 16px;
    }
}

.pt-activity {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 110px auto;
    gap: 9px;
    align-items: center;
    margin-bottom: 8px;
}

/* ----------------------------------------------------------- narrow screens */

@media (max-width: 760px) {
    .pt-fact {
        border-right: 0;
        border-bottom: 1px solid var(--pt-line);
    }

        .pt-fact:last-child {
            border-bottom: 0;
        }

    .pt-dx-row,
    .pt-intake-adlrow {
        grid-template-columns: 1fr;
    }

    .pt-activity {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pt-scope * {
        transition: none !important;
    }
}

/* ===========================================================================
   Layout — the shapes that make these screens read as a clinical workspace
   rather than a stack of panels. Taken from the prototype's own structure:
   a large page heading, a readiness strip, and a working column beside a
   sticky reference column.
   ======================================================================== */

/* ------------------------------------------------------------- page heading */

.pt-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

    .pt-heading h1 {
        font-size: 27px;
        line-height: 1.25;
        font-weight: 650;
        margin: 0 0 6px;
        color: var(--pt-ink);
    }

    .pt-heading p {
        margin: 0;
        font-size: 13px;
        color: var(--pt-muted);
    }

.pt-heading-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ----------------------------------------------- working column + reference */

.pt-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 26px;
    align-items: start;
}

.pt-side {
    position: sticky;
    top: 16px;
    align-self: start;
}

.pt-side-section {
    border-top: 1px solid var(--pt-line);
    padding: 18px 0;
}

    .pt-side-section:first-child {
        border-top: 0;
        padding-top: 0;
    }

    .pt-side-section h3 {
        font-size: 14px;
        font-weight: 650;
        margin: 0 0 12px;
    }

/* A label on the left, its value right-aligned — the sidebar's workhorse row. */
.pt-keyline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    font-size: 12px;
}

    .pt-keyline span {
        color: var(--pt-muted);
    }

/* ------------------------------------------------------------- form fields */

.pt-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}

    .pt-form-grid .pt-field {
        max-width: none;
    }

.pt-field-full {
    grid-column: 1 / -1;
}

/* Actions belong at the end of the work, against a rule, not floating. */
.pt-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    flex-wrap: wrap;
    border-top: 1px solid var(--pt-line);
    padding-top: 18px;
    margin-top: 20px;
}

@media (max-width: 1100px) {
    .pt-layout {
        grid-template-columns: 1fr;
    }

    .pt-side {
        position: static;
    }
}

@media (max-width: 760px) {
    .pt-form-grid {
        grid-template-columns: 1fr;
    }

    .pt-heading h1 {
        font-size: 22px;
    }
}

/* ---------------------------------------------- choosing what to work on */

/* "Measure for [ ... ]" — a select row rather than a strip of tabs. Eleven
   regions would not fit as tabs, and the prototype picks with a select. */
.pt-select-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--pt-muted);
}

    .pt-select-row select {
        width: auto;
        min-width: 240px;
    }

    .pt-select-row .pt-spacer {
        margin-left: auto;
    }

/* --------------------------------------------------- questionnaire paging */

/* The instrument is walked a couple of questions at a time. The pills say how
   far through it is, and let the clinician jump back to fix one answer. */
.pt-pager {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin: 14px 0 6px;
}

.pt-pager-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--pt-line);
    border-radius: 999px;
    background: var(--pt-white);
    padding: 5px 12px;
    font: inherit;
    font-size: 11px;
    color: var(--pt-muted);
    cursor: pointer;
}

    .pt-pager-pill b {
        color: var(--pt-ink);
    }

    .pt-pager-pill.active {
        border-color: var(--pt-accent);
        color: var(--pt-accent);
    }

        .pt-pager-pill.active b {
            color: var(--pt-accent);
        }

    .pt-pager-pill.done {
        background: var(--pt-wash);
        border-color: var(--pt-wash);
    }

.pt-pager-count {
    font-size: 11px;
    color: var(--pt-muted);
    margin: 0 0 10px;
}

/* A plain check row: the box, then the label. No card around it. */



/* --------------------------------------------------------- score sidebar */

.pt-score-kind {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pt-muted);
}

.pt-score-answered {
    font-size: 11px;
    color: var(--pt-muted);
    margin: 10px 0 12px;
}

.pt-prev-measure {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid var(--pt-line);
    font-size: 12px;
}

    .pt-prev-measure:first-of-type {
        border-top: 0;
    }

    .pt-prev-measure span {
        color: var(--pt-muted);
    }

/* ===========================================================================
   The visit rail.

   Four things decide what a therapist does on a PT visit: which visit of the
   course this is, what the schedule expects at it, what is still outstanding,
   and whether the patient is actually improving. They were spread across a
   facts grid, a cadence banner and a readiness strip, so none of them was true
   anywhere but the tab you happened to be on.

   The rail states all four, once, above the tabs — so it holds on every screen
   in the module rather than on one of them.
   ======================================================================== */

.pt-rail {
    display: grid;
    /* The outcome cell is the widest thing in the strip once a case is authorised
       for more than one region -- a name, a trend and an instrument per line -- so it
       is given half again the width of the others rather than truncating the region
       names it exists to show. */
    grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.5fr);
    border: 1px solid var(--pt-line);
    border-radius: 6px;
    background: var(--pt-white);
    overflow: hidden;
    margin-bottom: 20px;
}

.pt-rail-cell {
    padding: 13px 16px;
    border-right: 1px solid var(--pt-line);
    min-width: 0;
}

    .pt-rail-cell:last-child {
        border-right: 0;
    }

    /* The cell carrying something the clinician has to act on. */
    .pt-rail-cell.due {
        background: var(--pt-amber-bg);
    }

.pt-rail-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pt-muted);
    margin-bottom: 5px;
}

.pt-rail-value {
    display: block;
    font-size: 16px;
    font-weight: 650;
    line-height: 1.25;
    color: var(--pt-ink);
}

    .pt-rail-value.muted {
        font-weight: 400;
        color: var(--pt-muted);
    }

.pt-rail-cell.due .pt-rail-value {
    color: #7f571a;
}

.pt-rail-note {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--pt-muted);
}

/* Readiness as segments inside its rail cell: five things, not a percentage. */
.pt-rail-meter {
    display: flex;
    gap: 3px;
    margin-top: 7px;
}

    .pt-rail-meter span {
        height: 3px;
        border-radius: 2px;
        background: #dae4df;
        flex: 1;
    }

        .pt-rail-meter span.done {
            background: var(--pt-accent);
        }

/* The trend, inline: where the instrument started, where it is, where it is
   going. Direction is stated rather than coloured, because improvement is
   downward for the indices and upward for LEFS and PSFS. */
.pt-trend {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    font-variant-numeric: tabular-nums;
}

.pt-trend-arrow {
    font-size: 13px;
    color: var(--pt-accent);
}

    .pt-trend-arrow.away {
        color: var(--pt-red);
    }

.pt-rail-goal {
    font-size: 11px;
    font-weight: 400;
    color: var(--pt-muted);
}

@media (max-width: 1000px) {
    .pt-rail {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pt-rail-cell:nth-child(2n) {
        border-right: 0;
    }

    .pt-rail-cell:nth-child(-n+2) {
        border-bottom: 1px solid var(--pt-line);
    }
}

@media (max-width: 560px) {
    .pt-rail {
        grid-template-columns: 1fr;
    }

    .pt-rail-cell {
        border-right: 0;
        border-bottom: 1px solid var(--pt-line);
    }

        .pt-rail-cell:last-child {
            border-bottom: 0;
        }
}

/* ------------------------------------------------- unsaved-state reminder */

/* Was a full-width amber banner on every screen. It is a standing condition of
   this build, not news, so it reads as a quiet chip beside the heading. */
.pt-draft-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--pt-amber-line);
    border-radius: 999px;
    background: var(--pt-amber-bg);
    color: var(--pt-amber);
    padding: 4px 11px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ------------------------------------------------------------ dense lists */

/* Rows of things with marks against them — exercises, tests, measurements.
   A table's density without a table's rigidity. */
.pt-rows {
    border: 1px solid var(--pt-line);
    border-radius: 6px;
    overflow: hidden;
    background: var(--pt-white);
}

.pt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 13px;
    border-top: 1px solid var(--pt-line);
    font-size: 12px;
}

    .pt-row:first-child {
        border-top: 0;
    }

    .pt-row:hover {
        background: #fafcfb;
    }

.pt-row-name {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.pt-row-marks {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

/* A mark the clinician sets on a row: off by default, filled when set. */
.pt-mark {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--pt-line);
    border-radius: 999px;
    background: var(--pt-white);
    padding: 3px 9px;
    font: inherit;
    font-size: 10px;
    font-weight: 600;
    color: var(--pt-muted);
    cursor: pointer;
    white-space: nowrap;
}

    .pt-mark:hover:not(:disabled) {
        border-color: var(--pt-accent);
        color: var(--pt-accent);
    }

    .pt-mark:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .pt-mark.on {
        background: var(--pt-wash);
        border-color: var(--pt-accent-soft);
        color: var(--pt-accent);
    }

    /* Pain is the one mark that is not good news, so it does not read as teal. */
    .pt-mark.on.warn {
        background: var(--pt-amber-bg);
        border-color: var(--pt-amber-line);
        color: var(--pt-amber);
    }

/* A group heading inside a rows list. */
.pt-rows-group {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 13px;
    background: #f6f9f8;
    border-top: 1px solid var(--pt-line);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--pt-muted);
}

    .pt-rows-group:first-child {
        border-top: 0;
    }

/* The result select inside a flowsheet row. Global rather than scoped, because
   it has to beat the global .pt-input width:100% — scoped to the component, it
   lost that fight and the select swallowed the row, squeezing the exercise name
   to one character per line. */
.pt-scope select.pt-row-result {
    width: auto;
    flex: 0 0 auto;
    min-width: 132px;
    font-size: 11px;
    padding: 5px 8px;
}

/* A field's caption: what the shorthand looks like, under its label. */
.pt-field > small {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--pt-muted);
}

/* ------------------------------------------------- a block with an action in its head */

/* The title keeps its own margin when it stands alone, so the row takes it off and
   carries the spacing itself; otherwise the button sits 12px above the rule. */
.pt-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

    .pt-block-head .pt-block-title {
        margin: 0;
    }

/* -------------------------------------------------------------- the ICD-10 picker */

/* Rebuilt after looking at the first version rendered with real codes. A search for
   "sprain ankle" returns rows reading "Sprain of other ligament of left ankle, initial
   encounter" eleven times over, and the first build printed the encounter twice per row
   (once in the text, once as a tag beside it) and the side twice (once in the text,
   once as an uppercase chip). Three copies of what every row shared, which left the one
   word that told the rows apart as unremarkable grey text in the middle of a wall —
   beside a column of twelve saturated buttons that drew the eye to the least
   informative part of the dialog.

   So: one fact per column, the shared words plain and the distinguishing words bold,
   the encounter as a filter rather than as repetition, and an action that stays quiet
   until the row is under the cursor. */

.pt-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(16, 15, 13, .44);
    z-index: 70;
    border: 0;
    padding: 0;
}

/* Fixed, not absolute: the evaluation scrolls, and a dialog anchored to the document
   would scroll away from the button that opened it. */
.pt-modal {
    --pt-dim: #566666;      /* see the note on contrast below */

    position: fixed;
    z-index: 71;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(920px, calc(100vw - 32px));
    /* Tall enough that a short result sits whole. The first build capped at 720, which
       made an eleven-row result scroll and clipped the last row mid-height for no
       reason; a full twenty-row page still scrolls, which is correct. */
    max-height: min(860px, calc(100vh - 48px));
    display: flex;
    flex-direction: column;
    background: var(--pt-white);
    border: 1px solid var(--pt-line);
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(16, 15, 13, .22);
    overflow: hidden;
}

/* --pt-muted measures 4.2:1 on the wash and 4.5:1 on white, which is at or under AA at
   these sizes. Fine for a hint; not fine for the match count, the active filter or a
   laterality of "unspecified", which are facts the PT reads. Local to the dialog, so
   nothing outside it shifts. */
.pt-modal-sub,
.pt-modal-meta,
.pt-modal-dim,
.pt-foot-count,
.pt-page-at,
.pt-filter-label,
.pt-dxside,
.pt-chip {
    color: var(--pt-dim);
}

/* ------------------------------------------------------------------- the head */

.pt-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--pt-line);
}

.pt-modal-title {
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -.01em;
    margin: 0;
}

.pt-modal-sub {
    font-size: 12.5px;
    margin: 3px 0 0;
}

.pt-modal-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 1;
    color: var(--pt-dim);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
}

    .pt-modal-close:hover {
        background: var(--pt-wash-soft);
        border-color: var(--pt-line);
        color: var(--pt-ink);
    }

/* --------------------------------------------------------------- search + filter */

.pt-modal-search {
    padding: 0 24px 16px;
    border-bottom: 1px solid var(--pt-line);
    background: var(--pt-white);
}

/* The icon sits inside the field rather than beside it, so the field reads as one
   control and the placeholder starts clear of the glass. */
.pt-search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.pt-search-icon {
    position: absolute;
    left: 13px;
    width: 16px;
    height: 16px;
    color: var(--pt-dim);
    pointer-events: none;
}

.pt-search-input {
    width: 100%;
    height: 44px;
    padding: 0 38px;
    font: inherit;
    font-size: 15px;
    color: var(--pt-ink);
    background: var(--pt-white);
    border: 1px solid var(--pt-field-line);
    border-radius: 8px;
    outline: none;
}

    .pt-search-input::placeholder {
        color: var(--pt-dim);
    }

    .pt-search-input:focus {
        border-color: var(--pt-accent);
        box-shadow: 0 0 0 3px var(--pt-wash);
    }

    /* The engines disagree about what a search field draws for itself; the field
       supplies its own clear button so the control looks the same everywhere. */
    .pt-search-input::-webkit-search-decoration,
    .pt-search-input::-webkit-search-cancel-button {
        -webkit-appearance: none;
        appearance: none;
    }

.pt-search-clear {
    position: absolute;
    right: 8px;
    width: 26px;
    height: 26px;
    font-size: 17px;
    line-height: 1;
    color: var(--pt-dim);
    background: transparent;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
}

    .pt-search-clear:hover {
        background: var(--pt-wash);
        color: var(--pt-ink);
    }

.pt-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.pt-filter-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.pt-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* An injury code exists four times over, once per encounter, so an unfiltered search
   shows what is really eleven codes as forty-five near-identical rows. */
.pt-chip {
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    background: var(--pt-white);
    border: 1px solid var(--pt-line);
    border-radius: 999px;
    cursor: pointer;
}

    .pt-chip:hover {
        border-color: var(--pt-accent-soft);
        color: var(--pt-ink);
    }

    .pt-chip.on {
        color: var(--pt-white);
        background: var(--pt-accent);
        border-color: var(--pt-accent);
    }

/* ----------------------------------------------------------------- result count */

.pt-modal-meta {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 24px;
    font-size: 12px;
    background: var(--pt-wash-soft);
    border-bottom: 1px solid var(--pt-line);
}

    .pt-modal-meta strong {
        color: var(--pt-ink);
        font-variant-numeric: tabular-nums;
    }

/* ------------------------------------------------------------------- the rows */

/* The one scrolling region. The head, the search bar and the footer stay put, so the
   term being searched and the paging controls are never scrolled out of reach. */
.pt-modal-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0;
}

.pt-modal-empty {
    padding: 28px 24px;
    margin: 0;
}

.pt-dxlist {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Four columns, each carrying one fact once. */
.pt-dxrow {
    display: grid;
    grid-template-columns: 110px 1fr 94px 74px;
    align-items: center;
    gap: 14px;
    padding: 0 24px;
    min-height: 46px;
    border-bottom: 1px solid var(--pt-line);
}

    .pt-dxrow:last-child {
        border-bottom: 0;
    }

    .pt-dxrow:hover {
        background: var(--pt-wash-soft);
    }

.pt-dxcode {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--pt-accent);
}

.pt-dxname {
    font-size: 13.5px;
    line-height: 1.35;
}

    /* What this row has that its neighbours do not — computed per page by
       Icd10Display, not guessed at. */
    .pt-dxname b {
        font-weight: 700;
    }

/* Side gets a column of its own instead of an uppercase chip repeating a word the
   description already contained. */
.pt-dxside {
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

    .pt-dxside.left,
    .pt-dxside.right {
        color: var(--pt-ink);
    }

/* Quiet until the row is under the cursor: a column of saturated buttons drew the eye
   to the least informative part of the dialog. */
.pt-dxadd {
    justify-self: end;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 16px;
    color: var(--pt-accent);
    background: var(--pt-white);
    border: 1px solid var(--pt-accent-soft);
    border-radius: 6px;
    cursor: pointer;
}

.pt-dxrow:hover .pt-dxadd,
.pt-dxadd:focus-visible {
    color: var(--pt-white);
    background: var(--pt-accent);
    border-color: var(--pt-accent);
}

.pt-dxrow.is-added {
    background: var(--pt-wash);
}

.pt-dxdone {
    justify-self: end;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 600;
    color: var(--pt-accent);
}

    .pt-dxdone svg {
        width: 13px;
        height: 13px;
    }

/* ----------------------------------------------------------------- the footer */

.pt-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    border-top: 1px solid var(--pt-line);
    background: var(--pt-white);
}

.pt-foot-count {
    font-size: 12.5px;
}

    .pt-foot-count strong {
        color: var(--pt-ink);
        font-variant-numeric: tabular-nums;
    }

.pt-foot-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pt-pager {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pt-page-btn {
    width: 28px;
    height: 28px;
    font: inherit;
    font-size: 16px;
    line-height: 1;
    color: var(--pt-ink);
    background: var(--pt-white);
    border: 1px solid var(--pt-line);
    border-radius: 6px;
    cursor: pointer;
}

    .pt-page-btn:hover:not(:disabled) {
        border-color: var(--pt-accent-soft);
        background: var(--pt-wash-soft);
    }

    .pt-page-btn:disabled {
        color: #c3cfcf;
        cursor: default;
    }

.pt-page-at {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    padding: 0 4px;
}

/* --------------------------------------------------------- narrow and phone width */

/* Four columns need about 620px. Below that the description was squeezed to 73px while
   the code column kept its full 110, so the one thing worth reading had no room. Stack
   instead: code and side on a line of their own, the description under it, the action
   kept to the right where the thumb is. */
@media (max-width: 620px) {
    .pt-modal {
        width: calc(100vw - 16px);
        max-height: calc(100vh - 24px);
    }

    .pt-modal-head,
    .pt-modal-search,
    .pt-modal-meta,
    .pt-modal-foot {
        padding-left: 16px;
        padding-right: 16px;
    }

    .pt-dxrow {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "ident  action"
            "name   action";
        gap: 2px 12px;
        padding: 10px 16px;
    }

    .pt-dxcode {
        grid-area: ident;
        /* Shrink to the code itself, so the side sits beside it rather than over a box
           stretched across the whole cell. */
        justify-self: start;
    }

    .pt-dxname {
        grid-area: name;
    }

    .pt-dxside {
        grid-area: ident;
        justify-self: start;
        margin-left: 120px;
        text-align: left;
    }

    .pt-dxadd,
    .pt-dxdone {
        grid-area: action;
        align-self: center;
    }

    .pt-modal-meta {
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
    }

    .pt-modal-foot {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* ------------------------------------------------------- the region picker */

/* Plan of care and the treatment flowsheet show one authorised region at a time and
   switch with this. They used to stack every region down the page, primary first,
   which implied a ranking neither screen has — the primary region decides which
   instrument leads the trend line, not whose treatment matters more — and left the
   third region of a three-region case below two full flowsheets. */
.pt-regionpick {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 12px 16px;
    margin-bottom: 18px;
    background: var(--pt-wash-soft);
    border: 1px solid var(--pt-line);
    border-radius: 8px;
}

    .pt-regionpick > label {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: var(--pt-muted);
    }

    /* The shared control rule sets width:100%, which made this stretch the whole row
       and push the note onto a line of its own; and a fixed height fought the inherited
       padding and clipped the text. So: sized by its content, between a floor that fits
       the longest region name with its count and a ceiling that keeps it from running
       the width of the page. */
    .pt-regionpick > select {
        flex: 0 1 auto;
        width: auto;
        min-width: 290px;
        max-width: 460px;
        padding: 8px 11px;
        font-size: 13px;
        font-weight: 600;
    }

.pt-regionpick-note {
    font-size: 11px;
    color: var(--pt-muted);
    margin-left: auto;
}

@media (max-width: 620px) {
    .pt-regionpick > select {
        min-width: 0;
        flex: 1 1 100%;
    }

    .pt-regionpick-note {
        margin-left: 0;
    }
}

/* ------------------------------------------------------------- next visit */

/* Rebuilt after looking at it. The first version put six controls of different
   heights on one centred row, and the hour, minute and meridiem selects — three
   full-width controls inside a grid cell — stacked into a column a hundred pixels
   tall, which pulled every other label out of line with it. The button then floated
   in the middle of that row, attached to nothing.

   Now: labels above controls on one grid so every label starts on the same line,
   the time drawn as the single value it is, and the action sitting with the
   sentence that says what it will do. */

.pt-nv {
    border: 1px solid var(--pt-line);
    border-radius: 8px;
    background: var(--pt-white);
    overflow: hidden;
}

.pt-nv-head {
    padding: 16px 20px 0;
}

    .pt-nv-head p {
        margin: 6px 0 0;
        font-size: 12.5px;
        color: var(--pt-dim, #566666);
        max-width: 96ch;
    }

.pt-nv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 14px 16px;
    padding: 16px 20px 18px;
}

.pt-nv-field {
    display: grid;
    gap: 6px;
    align-content: start;
}

    .pt-nv-field > span {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .03em;
        color: #566666;
    }

    .pt-nv-field > input,
    .pt-nv-field > select {
        height: 38px;
        font-size: 13px;
    }

/* Hour, minute and meridiem are one value, so they are drawn as one control. */
.pt-nv-time {
    display: flex;
    align-items: stretch;
    height: 38px;
    border: 1px solid var(--pt-field-line);
    border-radius: 5px;
    background: var(--pt-white);
    overflow: hidden;
}

    .pt-nv-time select {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
        height: 100%;
        border: 0;
        border-radius: 0;
        padding: 0 2px 0 8px;
        font-size: 13px;
        background: transparent;
    }

        .pt-nv-time select + select {
            border-left: 1px solid var(--pt-line);
        }

        .pt-nv-time select:focus {
            outline-offset: -3px;
        }

/* The action belongs to the sentence describing what it will do. */
.pt-nv-confirm {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 20px;
    background: var(--pt-wash-soft);
    border-top: 1px solid var(--pt-line);
}

.pt-nv-when {
    font-size: 14px;
    font-weight: 650;
}

.pt-nv-sub {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: #566666;
    margin-top: 2px;
}

.pt-nv-blocked {
    font-size: 12.5px;
    color: #566666;
}

/* The booked summary reuses the facts strip, squared off inside the card. */
.pt-nv-booked {
    margin: 0;
    border: 0;
    border-top: 1px solid var(--pt-line);
    border-radius: 0;
}

@media (max-width: 620px) {
    .pt-nv-confirm > .pt-btn {
        width: 100%;
    }
}

/* ------------------------------------------------------ undoing the booking

   A destructive action in a confirmed card, so it is drawn as a quiet secondary
   row under the facts and only commits on a second press. The red is the app's
   own --primary-color, which pt.css already carries as --pt-red for errors --
   the one place a destructive button earns it. */

.pt-nv-undo {
    background: var(--pt-white);
}

.pt-nv-undo-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pt-btn-danger {
    background: var(--pt-red);
    border-color: var(--pt-red);
    color: var(--pt-white);
}

    .pt-btn-danger:hover:not(:disabled) {
        background: #9c1d1e;
        border-color: #9c1d1e;
    }

/* Shown in place of the booking facts once the visit has been taken back, so the
   form coming back is explained rather than just appearing. */
.pt-nv-undone {
    margin: 0;
    padding: 10px 20px 0;
    font-size: 12px;
    color: var(--pt-amber);
}

@media (max-width: 760px) {
    .pt-nv-undo-actions {
        width: 100%;
    }

        .pt-nv-undo-actions > .pt-btn {
            flex: 1;
            justify-content: center;
        }
}

/* ------------------------------------- the rail's outcome cell, several regions */

/* One authorised region keeps the single big number it always had. Several get a
   line each, because section 3.4 gives every secondary its own baseline and its own
   trend — the rail used to show the primary and quietly drop the rest.

   The cell grows rather than scrolls: a case is authorised for a handful of regions,
   not a hundred, and a scrollbar inside a header strip is worse than a taller strip. */
.pt-rail-cell.many {
    padding-top: 11px;
    padding-bottom: 11px;
}

.pt-rail-trends {
    list-style: none;
    margin: 2px 0 0;
    padding: 0;
    display: grid;
    gap: 3px;
}

.pt-rail-trend {
    display: grid;
    /* Fixed tracks for the two right-hand columns, not auto. Each row is its own
       grid -- they are separate list items -- so auto columns size per row and the
       numbers stopped lining up down the cell, which for a column of scores is the
       one thing it has to do. */
    grid-template-columns: minmax(0, 1fr) 92px 46px;
    align-items: baseline;
    gap: 8px;
    padding: 2px 0;
    font-size: 12px;
    line-height: 1.3;

    /* Staggered by row, so adding a region reads as the list growing rather than the
       whole cell redrawing. --pt-row is set per row in the markup. */
    animation: pt-rail-row-in 240ms ease-out backwards;
    animation-delay: calc(var(--pt-row, 0) * 45ms);
}

    .pt-rail-trend + .pt-rail-trend {
        border-top: 1px dashed var(--pt-line);
        padding-top: 4px;
    }

@keyframes pt-rail-row-in {
    from {
        opacity: 0;
        transform: translateY(-3px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

/* Motion here is decoration: the list is correct without it. */
@media (prefers-reduced-motion: reduce) {
    .pt-rail-trend {
        animation: none;
    }
}

.pt-rail-trend-region {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
    color: var(--pt-muted);
}

/* Only the name gives way when the cell narrows. */
.pt-rail-trend-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pt-rail-trend.primary .pt-rail-trend-region {
    color: var(--pt-ink);
    font-weight: 600;
}

/* Which one leads the note's Special Tests block, said rather than implied by order. */
.pt-rail-primary {
    flex: 0 0 auto;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--pt-accent);
}

.pt-rail-trend-score {
    justify-content: flex-end;
    text-align: right;
    font-size: 13px;
    font-weight: 650;
    color: var(--pt-ink);
    font-variant-numeric: tabular-nums;
}

    .pt-rail-trend-score.muted {
        font-size: 12px;
        font-weight: 400;
        color: var(--pt-muted);
    }

/* The instrument differs per region, so each line carries its own. */
.pt-rail-trend-code {
    text-align: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--pt-muted);
    background: var(--pt-wash-soft);
    border: 1px solid var(--pt-line);
    border-radius: 3px;
    padding: 1px 4px;
}

@media (max-width: 1000px) {
    /* The region name is the first thing to give way when the cell narrows. */
    .pt-rail-trend {
        grid-template-columns: minmax(0, 1fr) 80px 44px;
        gap: 6px;
    }
}
