/* ============================================================================
   Rise Up UI kit - shared building blocks for the clinic pages.

   Built only on the admin.css design tokens (--admin-brand, --admin-brand-soft, --admin-radius...), which
   Site Settings > Appearance overrides at runtime - so everything here follows the chosen brand colour, in
   light and dark mode, without a single hard-coded brand hex.
============================================================================ */

:root {
    /* Brand for text and icons. In dark mode the brand colour is mixed toward white so it keeps 4.5:1 on dark
       surfaces - the runtime theme applies one brand colour to both modes, and a mid-blue that reads well on
       white is too dark on navy. Fills (buttons, bars, active tab underline) keep the true brand colour. */
    --ru-ink: var(--admin-brand);
    --ru-gap: 1rem;
    --ru-chip-sm: 2rem;
    --ru-chip-md: 2.5rem;
    --ru-chip-lg: 3.5rem;
    --ru-muted: var(--bs-secondary-color);
    --ru-hairline: color-mix(in srgb, var(--admin-sidebar-border) 70%, transparent);

    /* Soft semantic tints for chips and bars (text colours meet 4.5:1 on their tint). */
    --ru-success: #1c7c3a;
    --ru-success-soft: rgba(28, 124, 58, .12);
    --ru-warning: #9a5b00;
    --ru-warning-soft: rgba(229, 145, 0, .15);
    --ru-danger: #b42318;
    --ru-danger-soft: rgba(180, 35, 24, .1);
    --ru-info: #00658f;
    --ru-info-soft: rgba(0, 150, 199, .12);
    --ru-neutral: #475467;
    --ru-neutral-soft: rgba(71, 84, 103, .1);
}

[data-bs-theme="dark"] {
    --ru-ink: color-mix(in srgb, var(--admin-brand) 55%, #ffffff);
    --ru-success: #6fd08c;
    --ru-success-soft: rgba(111, 208, 140, .14);
    --ru-warning: #f5b74e;
    --ru-warning-soft: rgba(245, 183, 78, .14);
    --ru-danger: #ff8f84;
    --ru-danger-soft: rgba(255, 143, 132, .14);
    --ru-info: #7cd4f7;
    --ru-info-soft: rgba(124, 212, 247, .14);
    --ru-neutral: #c3c9d6;
    --ru-neutral-soft: rgba(195, 201, 214, .1);
}

/* ----------------------------------------------------------------------------
   Brand everywhere Bootstrap would otherwise use its own fixed blue
---------------------------------------------------------------------------- */
.text-primary { color: var(--ru-ink) !important; }
.bg-primary { background-color: var(--admin-brand) !important; }
.border-primary { border-color: var(--admin-brand) !important; }
.progress-bar { background-color: var(--admin-brand); }
.form-check-input:checked { background-color: var(--admin-brand); border-color: var(--admin-brand); }
.form-switch .form-check-input:focus { box-shadow: 0 0 0 .2rem var(--admin-brand-soft); }

.admin-main a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.admin-nav-link):not(.card):not(.ru-list-row) {
    color: var(--ru-ink);
    text-decoration: none;
}

.admin-main a:not(.btn):not(.nav-link):not(.dropdown-item):not(.list-group-item):not(.admin-nav-link):not(.card):not(.ru-list-row):hover {
    color: var(--admin-btn-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.badge-phoenix-primary,
[data-bs-theme="dark"] .badge-phoenix-primary {
    color: var(--ru-ink);
    background: var(--admin-brand-soft);
    border-color: color-mix(in srgb, var(--admin-brand) 30%, transparent);
}

.breadcrumb-item.active { color: var(--ru-ink); font-weight: 600; }
.breadcrumb-item a { color: var(--ru-muted) !important; }
.breadcrumb-item a:hover { color: var(--ru-ink) !important; }

.list-group-item.active {
    background: var(--admin-brand-soft);
    border-color: color-mix(in srgb, var(--admin-brand) 30%, transparent);
    color: var(--ru-ink);
}

.tabular { font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------------------
   Icon chips: a tinted square holding an icon. Brand by default.
---------------------------------------------------------------------------- */
.ru-chip {
    width: var(--ru-chip-md);
    height: var(--ru-chip-md);
    border-radius: var(--admin-radius);
    background: var(--admin-brand-soft);
    color: var(--ru-ink);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.ru-chip-sm { width: var(--ru-chip-sm); height: var(--ru-chip-sm); font-size: .8125rem; border-radius: var(--admin-radius-sm); }
.ru-chip-lg { width: var(--ru-chip-lg); height: var(--ru-chip-lg); font-size: 1.375rem; border-radius: var(--admin-radius-lg); }
.ru-chip-success { background: var(--ru-success-soft); color: var(--ru-success); }
.ru-chip-warning { background: var(--ru-warning-soft); color: var(--ru-warning); }
.ru-chip-danger { background: var(--ru-danger-soft); color: var(--ru-danger); }
.ru-chip-info { background: var(--ru-info-soft); color: var(--ru-info); }
.ru-chip-neutral { background: var(--ru-neutral-soft); color: var(--ru-neutral); }

/* ----------------------------------------------------------------------------
   Page header: breadcrumb, icon, title, one-line purpose, actions
---------------------------------------------------------------------------- */
.ru-page-header {
    display: flex;
    align-items: center;
    gap: var(--ru-gap);
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.ru-page-header .ru-chip { width: 3rem; height: 3rem; font-size: 1.125rem; border-radius: var(--admin-radius-lg); }

.ru-page-title {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.ru-page-subtitle {
    color: var(--ru-muted);
    font-size: .875rem;
    margin: .125rem 0 0;
}

.ru-page-actions {
    margin-left: auto;
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

@media (max-width: 575.98px) {
    .ru-page-actions { margin-left: 0; width: 100%; }
    .ru-page-actions > * { flex: 1 1 auto; }
}

/* ----------------------------------------------------------------------------
   Section card: title row with a brand icon, optional actions on the right
---------------------------------------------------------------------------- */
.ru-card-header {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .875rem 1.25rem;
    border-bottom: 1px solid var(--ru-hairline);
}

.ru-card-header .ru-card-title {
    font-size: .9375rem;
    font-weight: 700;
    margin: 0;
}

.ru-card-header .ru-card-subtitle {
    font-size: .75rem;
    color: var(--ru-muted);
    margin: 0;
}

.ru-card-header .ru-card-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.ru-card-body { padding: 1rem 1.25rem; }

/* ----------------------------------------------------------------------------
   Stat cards (KPIs)
---------------------------------------------------------------------------- */
.ru-stat {
    height: 100%;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: .375rem;
}

.ru-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}

.ru-stat-label {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ru-muted);
}

.ru-stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.ru-stat-meta {
    font-size: .8125rem;
    color: var(--ru-muted);
}

/* ----------------------------------------------------------------------------
   Breakdown list: label, count, amount and a share bar (e.g. takings by method)
---------------------------------------------------------------------------- */
.ru-breakdown { list-style: none; margin: 0; padding: 0; }

.ru-breakdown-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "icon label amount" "icon bar bar";
    column-gap: .875rem;
    row-gap: .375rem;
    align-items: center;
    padding: .875rem 1.25rem;
}

.ru-breakdown-item + .ru-breakdown-item { border-top: 1px solid var(--ru-hairline); }
.ru-breakdown-item .ru-chip { grid-area: icon; }

.ru-breakdown-label { grid-area: label; min-width: 0; }
.ru-breakdown-label strong { display: block; font-size: .875rem; font-weight: 600; }
.ru-breakdown-label span { font-size: .75rem; color: var(--ru-muted); }

.ru-breakdown-amount {
    grid-area: amount;
    font-weight: 700;
    font-size: .9375rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.ru-breakdown-amount small { display: block; font-weight: 500; font-size: .75rem; color: var(--ru-muted); }

.ru-bar {
    grid-area: bar;
    height: 6px;
    border-radius: 3px;
    background: var(--admin-brand-soft);
    overflow: hidden;
}

.ru-bar > span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--admin-brand);
    transition: width .3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .ru-bar > span { transition: none; }
}

/* ----------------------------------------------------------------------------
   Tabs: underlined, brand when active (matches Settings)
---------------------------------------------------------------------------- */
.ru-tabs {
    display: flex;
    gap: 1.5rem;
    border-bottom: 1px solid var(--ru-hairline);
    margin-bottom: 1.25rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.ru-tabs::-webkit-scrollbar { display: none; }

.ru-tab {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 0;
    background: transparent;
    padding: .75rem 0;
    min-height: 44px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: var(--ru-muted);
    font-weight: 600;
    font-size: .875rem;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s ease-out, border-color .15s ease-out;
}

.ru-tab:hover { color: var(--ru-ink); }
.ru-tab:focus-visible { outline: 2px solid var(--admin-brand); outline-offset: 2px; border-radius: 4px; }

.ru-tab.active {
    color: var(--ru-ink);
    border-bottom-color: var(--admin-brand);
}

.ru-tab-count {
    font-size: .6875rem;
    font-weight: 700;
    padding: .125rem .5rem;
    border-radius: 2rem;
    background: var(--ru-neutral-soft);
    color: var(--ru-neutral);
    font-variant-numeric: tabular-nums;
}

.ru-tab.active .ru-tab-count { background: var(--admin-brand-soft); color: var(--ru-ink); }

/* ----------------------------------------------------------------------------
   Empty states
---------------------------------------------------------------------------- */
.ru-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
}

.ru-empty .ru-chip { margin-bottom: .5rem; }
.ru-empty-title { font-weight: 700; font-size: 1rem; margin: 0; }
.ru-empty-text { color: var(--ru-muted); font-size: .875rem; max-width: 34rem; margin: 0; }
.ru-empty-actions { margin-top: .75rem; display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }

/* ----------------------------------------------------------------------------
   Filter bar, tables, detail lists
---------------------------------------------------------------------------- */
.ru-filterbar { padding: .875rem 1.25rem; }
.ru-filterbar .form-label { font-size: .75rem; color: var(--ru-muted); margin-bottom: .25rem; }

.ru-table { margin: 0; }
.ru-table tbody tr[role="button"] { cursor: pointer; }
.ru-table tbody tr[role="button"]:hover > * { background: var(--admin-brand-soft); }
.ru-table td { vertical-align: middle; }
.ru-table .ru-sub { display: block; font-size: .75rem; color: var(--ru-muted); }

.ru-dl { display: grid; grid-template-columns: minmax(7rem, 35%) 1fr; gap: .5rem 1rem; margin: 0; font-size: .875rem; }
.ru-dl dt { color: var(--ru-muted); font-weight: 500; }
.ru-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Section label inside forms and panels */
.ru-section-label {
    font-size: .6875rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ru-ink);
    margin: 1.25rem 0 .5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.ru-section-label::after { content: ""; flex: 1; height: 1px; background: var(--ru-hairline); }

/* Status dot for live states (waiting, connected) */
.ru-dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    display: inline-block;
    background: currentColor;
    flex-shrink: 0;
}

.ru-dot-pulse { animation: ru-pulse 1.6s ease-out infinite; }

@keyframes ru-pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 45%, transparent); }
    100% { box-shadow: 0 0 0 .5rem transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .ru-dot-pulse { animation: none; }
}

/* ----------------------------------------------------------------------------
   Same dark-mode legibility for the shell's own brand text (sidebar active item, group heading, settings tabs).
---------------------------------------------------------------------------- */
[data-bs-theme="dark"] .admin-nav-link.active,
[data-bs-theme="dark"] .admin-nav-group-toggle.is-active,
[data-bs-theme="dark"] .admin-nav-link:hover,
[data-bs-theme="dark"] .settings-tabs .nav-link.active,
[data-bs-theme="dark"] .settings-tabs .nav-link:hover {
    color: var(--admin-sidebar-active-fg, var(--ru-ink));
}

[data-bs-theme="dark"] .btn-outline-primary,
[data-bs-theme="dark"] .btn-link {
    --bs-btn-color: var(--ru-ink);
    --bs-btn-hover-color: var(--ru-ink);
    --bs-btn-active-color: var(--ru-ink);
}

/* Square icon-only button (prev/next day etc.): 38px, brand on hover. */
.ru-icon-btn {
    width: 2.375rem; height: 2.375rem; padding: 0;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--bs-border-color); border-radius: var(--admin-radius-sm, .375rem);
    background: var(--bs-body-bg); color: var(--bs-body-color);
}
.ru-icon-btn:hover, .ru-icon-btn:focus-visible { color: var(--ru-ink); border-color: var(--admin-brand); background: var(--admin-brand-soft); }

/* Text buttons ("Today") read as actions, not inline links: no underline until hover. */
.admin-main .btn-link { text-decoration: none; font-weight: 600; color: var(--ru-ink); }
.admin-main .btn-link:hover { text-decoration: underline; }

/* ----------------------------------------------------------------------------
   Vital signs: one tile per measure. Flagged tiles take the warning or danger
   tone AND carry the flag in words, so colour is never the only signal.
---------------------------------------------------------------------------- */
.ru-vitals {
    display: grid;
    /* Nine measures: three by three, so every row is full and BP always sits top-left. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
}

.ru-vital {
    border: 1px solid var(--ru-hairline);
    border-radius: var(--admin-radius-sm, .5rem);
    padding: .75rem .875rem;
    background: var(--bs-body-bg);
    min-width: 0;
}

.ru-vital-label {
    display: flex;
    align-items: center;
    gap: .375rem;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ru-muted);
}

.ru-vital-label i { color: var(--ru-ink); font-size: .75rem; }

.ru-vital-value {
    margin-top: .375rem;
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.ru-vital-unit { margin-left: .25rem; font-size: .75rem; font-weight: 500; color: var(--ru-muted); }
.ru-vital.is-empty .ru-vital-value { color: var(--ru-muted); font-weight: 500; }

.ru-vital-flag {
    display: flex;
    align-items: center;
    gap: .3rem;
    margin-top: .375rem;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1.25;
}

.ru-vital.is-low, .ru-vital.is-high { border-color: color-mix(in srgb, var(--ru-warning) 45%, transparent); background: var(--ru-warning-soft); }
.ru-vital.is-low .ru-vital-flag, .ru-vital.is-high .ru-vital-flag { color: var(--ru-warning); }
.ru-vital.is-critical { border-color: color-mix(in srgb, var(--ru-danger) 55%, transparent); background: var(--ru-danger-soft); }
.ru-vital.is-critical .ru-vital-flag { color: var(--ru-danger); }

/* A small level marker for lists (dot + word). */
.ru-level { display: inline-flex; align-items: center; gap: .375rem; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.ru-level::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; }
.ru-level-normal { color: var(--ru-success); }
.ru-level-low, .ru-level-high { color: var(--ru-warning); }
.ru-level-critical { color: var(--ru-danger); }
.ru-level-none { color: var(--ru-muted); }
.ru-level-none::before { background: transparent; border: 1.5px solid currentColor; }

/* ----------------------------------------------------------------------------
   SOAP notes: a letter chip per section, the text keeps the clinician's line breaks.
---------------------------------------------------------------------------- */
.ru-note { padding: 1rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-note:last-child { border-bottom: 0; }
.ru-note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .75rem; font-size: .8125rem; color: var(--ru-muted); }
.ru-note-meta strong { color: var(--bs-body-color); }
.ru-note.is-amendment { border-left: 3px solid var(--admin-brand); }

.ru-soap { display: grid; gap: .625rem; margin: 0; }
.ru-soap-row { display: grid; grid-template-columns: 1.75rem minmax(0, 1fr); gap: .75rem; align-items: start; }
.ru-soap-key {
    width: 1.75rem; height: 1.75rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: .375rem;
    background: var(--admin-brand-soft);
    color: var(--ru-ink);
    font-weight: 800;
    font-size: .8125rem;
}
.ru-soap-label { font-size: .75rem; font-weight: 700; color: var(--ru-muted); margin-bottom: .125rem; }
.ru-soap-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; }
.ru-soap-text.is-empty { color: var(--ru-muted); font-style: italic; }

.ru-soap-editor .form-label { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.ru-soap-editor .form-text { margin-top: .25rem; }

/* A one-line status banner under the page header (e.g. "This visit is closed"). */
.ru-banner {
    display: flex; align-items: center; gap: .625rem;
    padding: .625rem 1rem;
    border: 1px solid var(--ru-hairline);
    border-left: 3px solid var(--ru-neutral);
    border-radius: var(--admin-radius-sm, .5rem);
    background: var(--ru-neutral-soft);
    font-size: .8125rem;
}
.ru-banner > i { color: var(--ru-neutral); }

@media (max-width: 575.98px) {
    .ru-vitals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* A money total in a card footer. */
.ru-total { font-size: 1.25rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------------------
   Education content: list thumbnails, the cover box, and the app preview.
---------------------------------------------------------------------------- */
.ru-thumb {
    width: 4.5rem; height: 3rem; flex-shrink: 0;
    border-radius: .5rem;
    background: var(--admin-brand-soft) center / cover no-repeat;
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--ru-ink);
    font-size: 1rem;
    overflow: hidden;
}

.ru-cover {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--admin-radius-sm, .5rem);
    border: 1px dashed var(--ru-hairline);
    background: var(--admin-brand-soft) center / cover no-repeat;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .375rem;
    color: var(--ru-ink);
    text-align: center;
    overflow: hidden;
}
.ru-cover.has-image { border-style: solid; }
.ru-cover-hint { font-size: .75rem; color: var(--ru-muted); padding: 0 1rem; }

.ru-title-input { font-size: 1.375rem; font-weight: 700; border-width: 0 0 1px; border-radius: 0; padding-left: 0; padding-right: 0; }
.ru-title-input:focus { box-shadow: none; border-color: var(--admin-brand); }
.ru-char-count { font-size: .75rem; color: var(--ru-muted); font-variant-numeric: tabular-nums; }

.ru-editor .ql-toolbar.ql-snow { border-radius: var(--admin-radius-sm, .5rem) var(--admin-radius-sm, .5rem) 0 0; border-color: var(--bs-border-color); }
.ru-editor .ql-container.ql-snow { border-radius: 0 0 var(--admin-radius-sm, .5rem) var(--admin-radius-sm, .5rem); border-color: var(--bs-border-color); min-height: 22rem; font-size: 1rem; }
.ru-editor .ql-editor { min-height: 22rem; line-height: 1.65; }
[data-bs-theme="dark"] .ru-editor .ql-snow .ql-stroke { stroke: var(--bs-body-color); }
[data-bs-theme="dark"] .ru-editor .ql-snow .ql-fill { fill: var(--bs-body-color); }
[data-bs-theme="dark"] .ru-editor .ql-snow .ql-picker { color: var(--bs-body-color); }
[data-bs-theme="dark"] .ru-editor .ql-editor.ql-blank::before { color: var(--ru-muted); }

/* How an article reads in the app: a phone-width column with the app's type. */
.ru-phone {
    width: 100%; max-width: 24rem; margin: 0 auto;
    border: 10px solid #1d2939; border-radius: 2rem;
    background: #fff; color: #1d2939;
    overflow: hidden;
    box-shadow: 0 1rem 2.5rem rgba(16, 24, 40, .18);
}
.ru-phone-screen { max-height: 70vh; overflow-y: auto; }
.ru-phone-cover { aspect-ratio: 16 / 9; background: #e7eef6 center / cover no-repeat; }
.ru-phone-body { padding: 1rem 1.125rem 1.5rem; }
.ru-phone-cat { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--admin-brand); }
.ru-phone-title { font-size: 1.375rem; font-weight: 800; line-height: 1.25; margin: .375rem 0 .5rem; color: #101828; }
.ru-phone-meta { font-size: .75rem; color: #667085; margin-bottom: 1rem; }
.ru-phone-video { display: flex; align-items: center; gap: .5rem; padding: .625rem .75rem; border-radius: .75rem; background: #f2f4f7; font-size: .8125rem; font-weight: 600; margin-bottom: 1rem; color: #101828; }

.ru-article-body { font-size: .9375rem; line-height: 1.7; overflow-wrap: anywhere; }
.ru-article-body h2 { font-size: 1.1875rem; font-weight: 800; margin: 1.25rem 0 .5rem; }
.ru-article-body h3 { font-size: 1.0625rem; font-weight: 700; margin: 1rem 0 .5rem; }
.ru-article-body p { margin: 0 0 .75rem; }
.ru-article-body blockquote { margin: 0 0 .75rem; padding: .5rem .875rem; border-left: 3px solid var(--admin-brand); background: rgba(13, 118, 186, .06); border-radius: 0 .5rem .5rem 0; }
.ru-article-body a { color: var(--admin-brand); }
.ru-article-body .ql-align-center { text-align: center; }
.ru-article-body .ql-align-right { text-align: right; }

/* One line of secondary text that ends in an ellipsis at whatever width the cell has. */
.ru-clamp, .ru-table .ru-clamp { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }

/* ----------------------------------------------------------------------------
   Programmes: cards with a cover, a place bar, and the detail page's session rows.
---------------------------------------------------------------------------- */
.ru-prog-card { display: flex; flex-direction: column; height: 100%; overflow: hidden; cursor: pointer; transition: transform .15s ease-out, box-shadow .15s ease-out; color: inherit; text-decoration: none; }
.ru-prog-card:hover, .ru-prog-card:focus-visible { transform: translateY(-2px); box-shadow: 0 .75rem 1.5rem rgba(16, 24, 40, .1); color: inherit; }
@media (prefers-reduced-motion: reduce) { .ru-prog-card, .ru-prog-card:hover { transition: none; transform: none; } }
.ru-prog-cover { position: relative; aspect-ratio: 16 / 7; background: var(--admin-brand-soft) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--ru-ink); font-size: 2rem; }
.ru-prog-badges { position: absolute; top: .75rem; left: .75rem; display: flex; gap: .375rem; flex-wrap: wrap; }
.ru-prog-badges .badge { box-shadow: 0 1px 2px rgba(16, 24, 40, .15); }
.ru-prog-body { padding: 1rem 1.25rem 1.25rem; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.ru-prog-title { font-size: 1.0625rem; font-weight: 700; margin: 0; line-height: 1.3; }
.ru-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ru-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8125rem; color: var(--ru-muted); }
.ru-meta i { color: var(--ru-ink); margin-right: .25rem; width: 1rem; text-align: center; }
.ru-places { margin-top: auto; padding-top: .5rem; }
.ru-places-row { display: flex; justify-content: space-between; font-size: .75rem; color: var(--ru-muted); margin-bottom: .25rem; }

.ru-session { display: flex; gap: 1rem; align-items: center; padding: .875rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-session:last-child { border-bottom: 0; }
.ru-session.is-past { opacity: .6; }
.ru-date-chip { width: 3.25rem; flex-shrink: 0; text-align: center; border-radius: .625rem; background: var(--admin-brand-soft); color: var(--ru-ink); padding: .375rem 0; line-height: 1.1; }
.ru-date-chip .d { font-size: 1.125rem; font-weight: 800; }
.ru-date-chip .m { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* Video stage for online consultations and programme sessions (tiles are created by consult.js). */
.consult-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .5rem; min-height: 360px; }
.consult-tile { position: relative; background: #111; border-radius: .5rem; overflow: hidden; min-height: 200px; }
.consult-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.consult-tile-self { max-height: 240px; }
.consult-tile-label { position: absolute; left: .5rem; bottom: .5rem; color: #fff; background: rgba(0,0,0,.55); padding: .1rem .5rem; border-radius: .25rem; font-size: .75rem; z-index: 1; }
.consult-placeholder { min-height: 360px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 1rem; }
.consult-stage.is-group { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

/* ----------------------------------------------------------------------------
   Dashboard: CSS column charts (no chart library - themeable, and nothing extra
   to load on the clinic server). Each column carries its own aria-label.
---------------------------------------------------------------------------- */
.ru-chart { display: flex; align-items: flex-end; gap: .375rem; height: 11rem; padding-top: .5rem; }
.ru-chart-col { flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; }
.ru-chart-seg { display: block; border-radius: .25rem .25rem 0 0; background: var(--admin-brand); min-height: 0; transition: height .3s ease-out; }
.ru-chart-seg + .ru-chart-seg { border-radius: 0; }
.ru-chart-seg.is-alt { background: color-mix(in srgb, var(--admin-brand) 38%, transparent); }
.ru-chart-col.is-today .ru-chart-seg { box-shadow: 0 0 0 2px color-mix(in srgb, var(--admin-brand) 30%, transparent); }
.ru-chart-empty { height: 2px; background: var(--ru-hairline); border-radius: 1px; }
.ru-chart-axis { display: flex; gap: .375rem; margin-top: .375rem; }
.ru-chart-axis span { flex: 1 1 0; min-width: 0; text-align: center; font-size: .6875rem; color: var(--ru-muted); font-variant-numeric: tabular-nums; }
.ru-chart-axis span.is-today { color: var(--ru-ink); font-weight: 700; }
.ru-legend { display: flex; gap: 1rem; font-size: .75rem; color: var(--ru-muted); }
.ru-legend i { display: inline-block; width: .625rem; height: .625rem; border-radius: 2px; background: var(--admin-brand); margin-right: .375rem; vertical-align: -.05rem; }
.ru-legend i.is-alt { background: color-mix(in srgb, var(--admin-brand) 38%, transparent); }
@media (prefers-reduced-motion: reduce) { .ru-chart-seg { transition: none; } }

/* Line chart (LineChart.razor): a smooth brand line over a fading fill, dots and value chips on the points. */
.ru-line { --ru-line-c: var(--admin-brand); --ru-line-gutter: 3rem; position: relative; padding-top: 1.5rem; }
.ru-line-peak { position: absolute; top: 0; right: 0; font-size: .75rem; color: var(--ru-muted); }
.ru-line-peak strong { color: var(--ru-ink); font-variant-numeric: tabular-nums; }
.ru-line-plot { position: relative; height: var(--ru-line-h, 12rem); margin: 0 1.25rem 0 var(--ru-line-gutter); }
.ru-line-grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--ru-hairline); }
.ru-line-grid:first-child { border-top-style: solid; }
.ru-line-grid span { position: absolute; right: calc(100% + .5rem); top: 0; transform: translateY(-50%); font-size: .6875rem; color: var(--ru-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ru-line-area { position: absolute; inset: 0; }
.ru-line-area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ru-line-stop-top { stop-color: var(--ru-line-c); stop-opacity: .28; }
.ru-line-stop-bottom { stop-color: var(--ru-line-c); stop-opacity: 0; }
.ru-line-stroke { fill: none; stroke: var(--ru-line-c); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.ru-line-dot { position: absolute; width: .625rem; height: .625rem; margin: 0 0 -.3125rem -.3125rem; border-radius: 50%; background: var(--bs-body-bg, #fff); border: 2px solid var(--ru-line-c); transition: transform .15s ease-out; cursor: default; }
.ru-line-dot:hover { transform: scale(1.35); }
.ru-line-dot.is-peak { width: .875rem; height: .875rem; margin: 0 0 -.4375rem -.4375rem; background: var(--ru-line-c); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ru-line-c) 22%, transparent); }
.ru-line-dot.is-current:not(.is-peak) { background: var(--ru-line-c); }
.ru-line-chip { position: absolute; transform: translate(-50%, -.75rem); margin-bottom: .375rem; padding: .0625rem .375rem; border-radius: .3125rem; font-size: .6875rem; font-weight: 600; line-height: 1.4; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ru-ink); background: var(--bs-body-bg, #fff); border: 1px solid var(--ru-hairline); box-shadow: 0 1px 2px rgba(16, 24, 40, .06); pointer-events: none; }
.ru-line-chip.is-peak { color: #fff; background: var(--ru-line-c); border-color: var(--ru-line-c); }
.ru-line-axis { position: relative; height: 1.5rem; margin: .5rem 1.25rem 0 var(--ru-line-gutter); }
.ru-line-axis span { position: absolute; top: 0; transform: translateX(-50%); font-size: .6875rem; color: var(--ru-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ru-line-axis span.is-current { color: var(--ru-ink); font-weight: 700; }
@media (max-width: 767.98px) {
    .ru-line-axis span.is-minor { display: none; }
    .ru-line-chip:not(.is-peak) { display: none; }
}
[data-bs-theme="dark"] .ru-line { --ru-line-c: var(--ru-ink); }
[data-bs-theme="dark"] .ru-line-chip.is-peak { color: var(--bs-body-bg); }
@media (prefers-reduced-motion: reduce) { .ru-line-dot { transition: none; } }

.ru-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 1rem; }
.ru-kpi-value { font-size: 1.375rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.ru-kpi-label { font-size: .75rem; color: var(--ru-muted); }
.ru-list-row { display: flex; align-items: center; gap: .75rem; padding: .625rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); color: inherit; text-decoration: none; }
.ru-list-row:last-child { border-bottom: 0; }
a.ru-list-row:hover { background: var(--admin-brand-soft); }
.ru-time { width: 3.25rem; flex-shrink: 0; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Whole-block links (cards, list rows) read as content, not as link text - see the :not(.card) in the link rule. */
a.ru-prog-card, a.ru-prog-card:hover, a.ru-list-row, a.ru-list-row:hover { color: var(--bs-body-color); text-decoration: none; }
a.ru-prog-card p { color: var(--ru-muted); }

/* Dark mode: the lighter brand ink keeps both chart series visible on dark cards. */
[data-bs-theme="dark"] .ru-chart-seg, [data-bs-theme="dark"] .ru-legend i { background: var(--ru-ink); }
[data-bs-theme="dark"] .ru-chart-seg.is-alt, [data-bs-theme="dark"] .ru-legend i.is-alt { background: color-mix(in srgb, var(--ru-ink) 42%, transparent); }

/* In-call chat. */
.ru-chat { height: 16rem; overflow-y: auto; padding: .75rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.ru-chat-empty { margin: auto; color: var(--ru-muted); font-size: .8125rem; }
.ru-chat-msg { max-width: 85%; padding: .375rem .625rem; border-radius: .75rem .75rem .75rem .25rem; background: var(--ru-neutral-soft); align-self: flex-start; }
.ru-chat-msg.is-mine { align-self: flex-end; background: var(--admin-brand-soft); border-radius: .75rem .75rem .25rem .75rem; }
.ru-chat-meta { font-size: .6875rem; color: var(--ru-muted); }
.ru-chat-text { font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Appointment board, week view: seven day columns of appointment chips. */
.ru-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; }
@media (max-width: 991.98px) { .ru-week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ru-week-day { background: var(--bs-body-bg); border: 1px solid var(--ru-hairline); border-radius: var(--admin-radius-sm, .5rem); min-height: 12rem; display: flex; flex-direction: column; overflow: hidden; }
.ru-week-day.is-today { border-color: var(--admin-brand); box-shadow: 0 0 0 1px var(--admin-brand); }
.ru-week-head { display: flex; align-items: baseline; gap: .375rem; padding: .5rem .625rem; border: 0; border-bottom: 1px solid var(--ru-hairline); background: transparent; color: inherit; text-align: left; }
.ru-week-head:hover { background: var(--admin-brand-soft); }
.ru-week-dow { font-size: .6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ru-muted); }
.ru-week-date { font-size: 1.125rem; font-weight: 800; }
.ru-week-day.is-today .ru-week-date, .ru-week-day.is-today .ru-week-dow { color: var(--ru-ink); }
.ru-week-count { margin-left: auto; font-size: .75rem; color: var(--ru-muted); font-variant-numeric: tabular-nums; }
.ru-week-list { display: flex; flex-direction: column; gap: .375rem; padding: .5rem; }
.ru-week-chip { display: flex; flex-direction: column; align-items: flex-start; gap: .0625rem; width: 100%; padding: .375rem .5rem; border: 1px solid var(--ru-hairline); border-left: 3px solid var(--admin-brand); border-radius: .375rem; background: var(--bs-body-bg); color: inherit; text-align: left; font-size: .75rem; line-height: 1.3; }
.ru-week-chip:hover { background: var(--admin-brand-soft); }
.ru-week-chip.is-muted { opacity: .55; border-left-color: var(--ru-neutral); }
.ru-week-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ru-ink); }
.ru-week-name { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ru-week-sub { color: var(--ru-muted); display: inline-flex; align-items: center; }

/* ----------------------------------------------------------------------------
   Health record: entry rows, severity markers, the diagnosis picker, and the
   allergy alert shown on every visit.
---------------------------------------------------------------------------- */
.ru-entry { display: flex; align-items: center; gap: .75rem; padding: .625rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-entry:last-child { border-bottom: 0; }
.ru-entry.is-inactive { opacity: .6; }
.ru-sev { width: .625rem; height: 2rem; border-radius: .25rem; flex-shrink: 0; background: var(--ru-neutral); }
.ru-sev-mild { background: var(--ru-info); }
.ru-sev-moderate { background: var(--ru-warning); }
.ru-sev-severe, .ru-sev-lifethreatening { background: var(--ru-danger); }
.ru-sev-lifethreatening { box-shadow: 0 0 0 2px var(--ru-danger-soft); }
.ru-code { min-width: 3.75rem; flex-shrink: 0; font-weight: 700; font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--ru-ink); }

.ru-picker { position: relative; }
.ru-picker-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: .25rem 0 0; padding: .25rem; list-style: none;
    max-height: 18rem; overflow-y: auto; background: var(--bs-body-bg); border: 1px solid var(--bs-border-color); border-radius: var(--admin-radius-sm, .5rem);
    box-shadow: 0 .75rem 1.5rem rgba(16, 24, 40, .12); }
.ru-picker-item { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .4375rem .5rem; border: 0; border-radius: .375rem; background: transparent;
    color: inherit; text-align: left; font-size: .8125rem; }
.ru-picker-item:hover, .ru-picker-item:focus-visible { background: var(--admin-brand-soft); }
.ru-picker-item.is-free { color: var(--ru-ink); font-weight: 600; }
.ru-picker-code { min-width: 3.5rem; font-weight: 700; color: var(--ru-ink); font-variant-numeric: tabular-nums; }
.ru-picker-empty { padding: .5rem; font-size: .8125rem; color: var(--ru-muted); }

.ru-alert-allergy { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; padding: .625rem 1rem; margin-bottom: 1rem;
    border: 1px solid color-mix(in srgb, var(--ru-danger) 45%, transparent); border-left: 4px solid var(--ru-danger);
    border-radius: var(--admin-radius-sm, .5rem); background: var(--ru-danger-soft); font-size: .8125rem; }
.ru-alert-allergy > strong { color: var(--ru-danger); }
.ru-alert-allergy .ru-allergy-chip { display: inline-flex; align-items: center; gap: .25rem; padding: .125rem .5rem; border-radius: 999px;
    background: var(--bs-body-bg); border: 1px solid color-mix(in srgb, var(--ru-danger) 35%, transparent); font-weight: 600; }
.ru-alert-allergy.is-none { border-color: var(--ru-hairline); border-left-color: var(--ru-success); background: var(--ru-success-soft); }
.ru-alert-allergy.is-unknown { border-color: var(--ru-hairline); border-left-color: var(--ru-warning); background: var(--ru-warning-soft); }
.ru-template-card { border: 1px solid var(--ru-hairline); color: inherit; transition: box-shadow .15s ease-out; }
.ru-template-card:hover, .ru-template-card:focus-visible { box-shadow: 0 .5rem 1.25rem rgba(16, 24, 40, .1); border-color: var(--admin-brand); }

/* Prescriptions (ClinicalDocumentsPanel, PrescriptionDialog). */
.ru-rx { padding: 1rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-rx:last-child { border-bottom: 0; }
.ru-rx.is-draft { background: color-mix(in srgb, var(--ru-warning-soft) 45%, transparent); }
.ru-rx.is-cancelled .ru-rx-items { opacity: .55; text-decoration: line-through; }
.ru-rx-head { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .5rem; }
.ru-rx-ref { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ru-ink); }
.ru-rx-meta { font-size: .75rem; color: var(--ru-muted); margin-top: .125rem; }
.ru-rx-items { list-style: none; counter-reset: rx; margin: 0; padding: 0; }
.ru-rx-items > li { counter-increment: rx; position: relative; display: flex; align-items: flex-start; gap: .75rem; padding: .5rem 0 .5rem 2rem; }
.ru-rx-items > li + li { border-top: 1px dashed var(--ru-hairline); }
.ru-rx-items > li::before { content: counter(rx); position: absolute; left: 0; top: .5rem; width: 1.375rem; height: 1.375rem; border-radius: 50%;
    display: grid; place-items: center; font-size: .6875rem; font-weight: 700; background: var(--admin-brand-soft); color: var(--ru-ink); }
.ru-rx-title { font-weight: 600; }
.ru-rx-directions { font-size: .8125rem; color: var(--ru-muted); }
.ru-rx-qty { margin-left: auto; flex-shrink: 0; padding: .125rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600;
    background: var(--ru-neutral-soft); white-space: nowrap; }
.ru-rx-note { margin: .5rem 0 0; font-size: .8125rem; color: var(--ru-muted); }
.ru-rx-note i { color: var(--ru-ink); }
.ru-rx-cancelled { margin: .5rem 0 0; font-size: .8125rem; color: var(--ru-danger); }

.ru-rx-editor { counter-reset: rxe; }
.ru-rx-card { padding: .875rem 1rem 1rem; border: 1px solid var(--ru-hairline); border-radius: var(--admin-radius, .75rem); background: var(--bs-body-bg); }
.ru-rx-card + .ru-rx-card { margin-top: .75rem; }
.ru-rx-card:focus-within { border-color: color-mix(in srgb, var(--admin-brand) 55%, transparent); box-shadow: 0 0 0 3px var(--admin-brand-soft); }
.ru-rx-card.has-clash { border-color: color-mix(in srgb, var(--ru-danger) 55%, transparent); }
.ru-rx-card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; min-height: 1.75rem; }
.ru-rx-num { width: 1.5rem; height: 1.5rem; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
    font-size: .75rem; font-weight: 700; background: var(--admin-brand); color: #fff; }
.ru-rx-clash { display: flex; gap: .5rem; align-items: flex-start; margin-top: .75rem; padding: .5rem .75rem; border-radius: var(--admin-radius-sm, .5rem);
    background: var(--ru-danger-soft); color: var(--ru-danger); font-size: .8125rem; }
.ru-rx-clash i { margin-top: .15rem; }

/* Letters and files. */
.ru-doc-row { display: flex; align-items: center; gap: .75rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-doc-row:last-child { border-bottom: 0; }
.ru-doc-row.is-inactive { opacity: .6; }
.ru-doc-title { display: flex; align-items: center; flex-wrap: wrap; gap: .375rem; font-weight: 600; min-width: 0; }
.ru-doc-sub { font-size: .75rem; color: var(--ru-muted); overflow-wrap: anywhere; }
.ru-in-app { display: inline-flex; align-items: center; gap: .25rem; padding: .0625rem .5rem; border-radius: 999px; font-size: .6875rem; font-weight: 600;
    background: var(--admin-brand-soft); color: var(--ru-ink); }
.ru-file-picked { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; border-radius: var(--admin-radius-sm, .5rem);
    background: var(--admin-brand-soft); font-size: .8125rem; min-width: 0; }
.ru-file-picked i { color: var(--ru-ink); }
.ru-letter-body { font-family: var(--bs-body-font-family); line-height: 1.55; }
[data-bs-theme="dark"] .ru-rx-num { background: var(--ru-ink); color: var(--bs-body-bg); }

/* An icon inside the left of a search box (use with ps-5 on the input). */
.ru-input-icon { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--ru-muted); pointer-events: none; }

/* Laboratory: ordering (LabOrderDialog). */
.ru-test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: .5rem; }
.ru-test-pick { display: flex; align-items: center; gap: .625rem; width: 100%; padding: .625rem .75rem; font-size: .8125rem; color: inherit;
    background: var(--bs-body-bg); border: 1px solid var(--ru-hairline); border-radius: var(--admin-radius-sm, .625rem);
    transition: border-color .15s ease-out, background-color .15s ease-out; }
.ru-test-pick:hover { border-color: color-mix(in srgb, var(--admin-brand) 45%, transparent); }
.ru-test-pick:focus-visible { outline: 2px solid var(--admin-brand); outline-offset: 2px; }
.ru-test-pick.is-picked { border-color: var(--admin-brand); background: var(--admin-brand-soft); }
.ru-test-check { width: 1.125rem; height: 1.125rem; flex-shrink: 0; display: grid; place-items: center; border-radius: .3rem;
    border: 1.5px solid var(--ru-hairline); font-size: .625rem; color: transparent; }
.ru-test-pick.is-picked .ru-test-check { background: var(--admin-brand); border-color: var(--admin-brand); color: #fff; }

/* Laboratory: orders on a visit (LabOrdersCard). */
.ru-lab-order { padding: 1rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-lab-order:last-child { border-bottom: 0; }
.ru-lab-item { padding: .625rem 0 .625rem .875rem; border-left: 2px solid var(--ru-hairline); margin-left: .125rem; }
.ru-lab-item + .ru-lab-item { margin-top: .25rem; }
.ru-lab-item.is-inactive { opacity: .6; }
.ru-lab-item-head { display: flex; align-items: flex-start; gap: .75rem; }
.ru-lab-results { width: 100%; margin-top: .5rem; font-size: .8125rem; border-collapse: collapse; table-layout: fixed; }
.ru-lab-results td:nth-child(2) { width: 30%; }
.ru-lab-results td:nth-child(3) { width: 20%; }
.ru-lab-results td:nth-child(4) { width: 16%; }
.ru-lab-results th, .ru-lab-results td { padding: .3rem .5rem .3rem 0; border-top: 1px dashed var(--ru-hairline); vertical-align: baseline; }
.ru-lab-results th { font-weight: 500; overflow-wrap: anywhere; }
.ru-lab-results .ru-lab-value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ru-lab-results .ru-lab-range { color: var(--ru-muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.ru-lab-results tr.is-flagged .ru-lab-value { color: var(--ru-warning); }
.ru-lab-results tr.is-flagged:has(.ru-level-critical) .ru-lab-value { color: var(--ru-danger); }

/* Laboratory: entering results (LabResultsDialog). */
.ru-result-grid { display: flex; flex-direction: column; border: 1px solid var(--ru-hairline); border-radius: var(--admin-radius, .75rem); overflow: hidden; }
.ru-result-row { display: grid; grid-template-columns: minmax(9rem, 1.3fr) minmax(8rem, 1.6fr) minmax(5rem, .8fr) 6.5rem; gap: .75rem; align-items: center;
    padding: .625rem .875rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-result-row:last-child { border-bottom: 0; }
.ru-result-row.is-abnormal { background: color-mix(in srgb, var(--ru-warning-soft) 60%, transparent); }
.ru-result-row.is-critical { background: var(--ru-danger-soft); }
.ru-result-name { margin: 0; font-size: .8125rem; }
.ru-result-range { font-size: .75rem; color: var(--ru-muted); font-variant-numeric: tabular-nums; }
.ru-result-flag { text-align: right; }
.ru-choice { display: flex; flex-wrap: wrap; gap: .375rem; }
.ru-choice-opt { padding: .25rem .625rem; font-size: .75rem; font-weight: 600; border-radius: 999px; color: var(--ru-ink);
    background: transparent; border: 1px solid color-mix(in srgb, var(--admin-brand) 40%, transparent); }
.ru-choice-opt:hover { background: var(--admin-brand-soft); }
.ru-choice-opt.is-on { background: var(--admin-brand); border-color: var(--admin-brand); color: #fff; }
[data-bs-theme="dark"] .ru-choice-opt.is-on { background: var(--ru-ink); border-color: var(--ru-ink); color: var(--bs-body-bg); }
@media (max-width: 767.98px) {
    .ru-result-row { grid-template-columns: 1fr auto; }
    .ru-result-input { grid-column: 1 / -1; }
}

/* Laboratory worklist: urgent rows get a red edge. */
.ru-table tr.ru-row-urgent > td:first-child { box-shadow: inset 3px 0 0 var(--ru-danger); }

/* Restricted records (RestrictedRecordPanel) and the break-glass banner. */
.ru-restricted-form { max-width: 34rem; }
.ru-banner.ru-banner-danger { border-color: color-mix(in srgb, var(--ru-danger) 35%, transparent); background: var(--ru-danger-soft); }
.ru-banner.ru-banner-danger > i { color: var(--ru-danger); }

/* Consents (ClientConsentsCard, Consents page). */
.ru-consent { padding: .625rem 1.25rem; border-bottom: 1px solid var(--ru-hairline); }
.ru-consent:last-child { border-bottom: 0; }
.ru-consent-row { display: flex; align-items: center; gap: .75rem; }
.ru-consent-status { width: 1.75rem; height: 1.75rem; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .75rem; }
.ru-consent-status.is-agreed { background: var(--ru-success-soft); color: var(--ru-success); }
.ru-consent-status.is-older { background: var(--ru-warning-soft); color: var(--ru-warning); }
.ru-consent-status.is-withdrawn { background: var(--ru-danger-soft); color: var(--ru-danger); }
.ru-consent-status.is-none { background: var(--ru-neutral-soft); color: var(--ru-muted); }
.ru-consent-history { margin: .5rem 0 0 2.5rem; padding: 0 0 0 .875rem; border-left: 2px solid var(--ru-hairline); list-style: none; font-size: .75rem; }
.ru-consent-history li + li { margin-top: .375rem; }
.ru-split-bar { display: flex; height: .5rem; border-radius: 999px; overflow: hidden; background: var(--ru-neutral-soft); }
.ru-split-bar > span { display: block; height: 100%; }
.ru-split-bar .is-current, .ru-legend .ru-dot-current { background: var(--ru-success); }
.ru-split-bar .is-older, .ru-legend .ru-dot-older { background: var(--ru-warning); }
.ru-split-bar .is-withdrawn, .ru-legend .ru-dot-withdrawn { background: var(--ru-danger); }

/* ----------------------------------------------------------------------------
   Inventory: a muted second line under a table cell's main text, a tighter
   definition list for dialogs, and the delivery / order line editor.
   ------------------------------------------------------------------------- */
.ru-sub { display: block; font-size: .75rem; color: var(--ru-muted); font-weight: 400; overflow-wrap: anywhere; }
.ru-dl-compact { grid-template-columns: minmax(5.5rem, 28%) 1fr; gap: .25rem 1rem; }
.text-pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Line editor (receive a delivery, purchase orders): one row per line, wrapping to two rows on narrow screens. */
.ru-lines { display: flex; flex-direction: column; }
.ru-lines-row {
    display: grid; gap: .5rem .75rem; align-items: end; padding: .875rem 1.25rem;
    grid-template-columns: minmax(12rem, 2.2fr) minmax(6.5rem, 1fr) minmax(8.5rem, 1fr) minmax(4.5rem, .6fr) minmax(6rem, .8fr) minmax(5.5rem, .8fr) auto;
    border-bottom: 1px solid var(--ru-hairline);
}
.ru-lines-row.is-empty { background: var(--ru-neutral-soft); }
.ru-lines-row.is-compact { grid-template-columns: minmax(12rem, 2.4fr) minmax(4.5rem, .6fr) minmax(6rem, .8fr) minmax(5.5rem, .8fr) auto; }
.ru-lines-total { text-align: right; padding-bottom: .3rem; white-space: nowrap; }
.ru-lines-remove { padding-bottom: .1rem; }
.ru-lines-foot { display: flex; align-items: baseline; gap: .75rem; padding: 1rem 1.25rem; }
@media (max-width: 991.98px) {
    .ru-lines-row, .ru-lines-row.is-compact { grid-template-columns: 1fr 1fr 1fr auto; }
    .ru-lines-item { grid-column: 1 / -1; }
    .ru-lines-total { text-align: left; }
}

/* Expandable table rows: the opened detail sits on a quiet background; a just-saved row is tinted brand. */
.ru-table tr.ru-table-detail > td { background: var(--ru-neutral-soft); border-top: 0; padding-top: .25rem; }
.ru-table tr.ru-table-detail .table { --bs-table-bg: transparent; }
.ru-table tr.is-highlight > td { background: color-mix(in srgb, var(--admin-brand) 8%, transparent); }

/* A card that is itself a button (stock locations). */
.ru-tile { padding: 0; color: inherit; background: var(--bs-card-bg, var(--bs-body-bg)); border: 1px solid var(--ru-hairline);
    transition: border-color .15s ease-out, box-shadow .15s ease-out; }
.ru-tile:hover, .ru-tile:focus-visible { border-color: color-mix(in srgb, var(--admin-brand) 45%, transparent); box-shadow: 0 .25rem 1rem rgba(16, 24, 40, .06); }

/* Programme curriculum: a block per week with its materials */
.ru-curriculum-week { border-bottom: 1px solid var(--ru-hairline); }
.ru-curriculum-week:last-child { border-bottom: 0; }
.ru-curriculum-head { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; background: var(--admin-brand-soft); }

/* Public certificate check (/verify) */
.ru-verify { width: 100%; max-width: 34rem; margin: 0 auto; }
.ru-verify-icon { font-size: 2.75rem; line-height: 1; }
.ru-verify-card.is-valid { border-color: var(--bs-success); }
.ru-verify-card.is-valid .ru-verify-icon { color: var(--bs-success); }
.ru-verify-card.is-revoked { border-color: var(--bs-danger); }
.ru-verify-card.is-revoked .ru-verify-icon { color: var(--bs-danger); }

/* ---------- Picture cards (Administration → Public site) ---------- */
.ru-pic-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ru-pic-card { border: 1px solid var(--bs-border-color); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; background: var(--bs-body-bg); }
.ru-pic-card.is-hidden .ru-pic-thumb img { opacity: .45; filter: grayscale(1); }
.ru-pic-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--bs-tertiary-bg); display: grid; place-items: center; overflow: hidden; }
.ru-pic-thumb.is-large { aspect-ratio: 4 / 3; border-radius: 14px; }
.ru-pic-thumb.is-light { background: #fff; }
.ru-pic-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ru-pic-empty { color: var(--bs-secondary-color); font-size: .85rem; display: flex; gap: .4rem; align-items: center; }
.ru-pic-order { position: absolute; top: 8px; left: 8px; min-width: 26px; height: 26px; border-radius: 13px; background: rgba(0, 0, 0, .6); color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.ru-pic-body { padding: .75rem .9rem .25rem; min-width: 0; }
.ru-pic-actions { display: flex; align-items: center; gap: .35rem; padding: .5rem .9rem .8rem; margin-top: auto; }
.ru-sticky-save { position: sticky; bottom: 0; z-index: 5; padding: .9rem 0; background: linear-gradient(0deg, var(--bs-body-bg) 70%, transparent); }
