/* SCHEU portal "Leicht" design tokens and shared sd- primitives.
   Reference: .impeccable/prototype-leicht (version 3, body.soft). Usage guide: .impeccable/prototype-leicht/ui-kit.md.
   Rule of thumb: separate content with soft tints and space, not with frames. Red is for the primary action and
   real errors only. */

/* ---------- Tokens ---------- */

:root {
    /* Brand */
    --sd-navy: #22384e;
    --sd-red: #e30613;
    --sd-cherry: #b8193f;
    --sd-cherry-2: #9d1235;

    /* Text */
    --sd-ink: #22384e;
    --sd-muted: #55687a;
    --sd-subtle: #7d8ea0;

    /* Surfaces */
    --sd-bg: #ffffff;
    --sd-fill: #f5f7fa;
    --sd-fill-2: #eef2f7;
    --sd-ice: #f7f8fb;
    --sd-zebra: #f6f8fb;
    --sd-row-hover: #eaf2fc;

    /* Lines */
    --sd-line: #e4e8ee;
    --sd-line-2: #c9d1da;
    --sd-line-soft: rgba(34, 56, 78, 0.07);
    --sd-line-sky: #9cbbe3;

    /* Tones: information, success, attention, error, decoration */
    --sd-sky: #eaf2fc;
    --sd-sky-ink: #2f5f9e;
    --sd-mint: #e5f5ef;
    --sd-mint-ink: #2c7a62;
    --sd-amber: #fff4e0;
    --sd-amber-ink: #8a5300;
    --sd-amber-edge: #e9b25c;
    --sd-rose: #fdecee;
    --sd-rose-ink: #b42331;
    --sd-lilac: #f1eefb;
    --sd-lilac-ink: #5a47a3;
    --sd-peach: #fff1e6;
    --sd-peach-ink: #a05a16;

    /* Spacing scale (4 px base) */
    --sd-space-1: 4px;
    --sd-space-2: 8px;
    --sd-space-3: 12px;
    --sd-space-4: 16px;
    --sd-space-5: 24px;
    --sd-space-6: 32px;
    --sd-space-7: 44px;
    --sd-space-8: 64px;
    --sd-gutter: 32px;
    --sd-page-max: 1440px;
    --sd-header-height: 64px;

    /* Radii */
    --sd-r-sm: 6px;
    --sd-r-md: 10px;
    --sd-r-card: 12px;
    --sd-r-lg: 16px;
    --sd-r-xl: 20px;
    --sd-r-dialog: 20px;
    --sd-r-pill: 999px;

    /* Shadows */
    --sd-shadow-sm: 0 1px 2px rgba(34, 56, 78, 0.04), 0 4px 14px rgba(34, 56, 78, 0.04);
    --sd-shadow-md: 0 10px 26px rgba(34, 56, 78, 0.1);
    --sd-shadow-lg: 0 30px 80px rgba(22, 36, 52, 0.28);
    --sd-shadow-primary: 0 4px 12px rgba(184, 25, 63, 0.22);
    --sd-focus-ring: 0 0 0 2px #2f5f9e, 0 0 0 6px rgba(47, 95, 158, 0.12);

    /* Type scale (Sora). Body text is 14 px. */
    --sd-fs-xs: 0.75rem;
    --sd-fs-sm: 0.8125rem;
    --sd-fs-base: 0.875rem;
    --sd-fs-md: 0.9375rem;
    --sd-fs-lg: 1.0625rem;
    --sd-fs-h3: 1.0625rem;
    --sd-fs-h2: 1.25rem;
    --sd-fs-h1: 1.75rem;
    --sd-fs-display: 2.375rem;

    /* Motion */
    --sd-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    --sd-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (max-width: 575.98px) {
    :root {
        --sd-gutter: 16px;
        --sd-fs-h1: 1.5rem;
    }
}

/* ---------- Page ---------- */

/* Vertical rhythm of a routed page. */
.sd-page {
    display: grid;
    gap: var(--sd-space-5);
    min-width: 0;
}

.sd-page > * {
    min-width: 0;
}

/* Two columns: content and a 320 px side column (patient list, case page). */
.sd-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--sd-space-7);
    align-items: start;
}

@media (max-width: 1199.98px) {
    .sd-split {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--sd-space-5);
    }
}

/* ---------- Page header (SdPageHeader) ---------- */

.sd-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-4) var(--sd-space-5);
    min-width: 0;
}

.sd-page-header__crumbs {
    flex: 1 0 100%;
    margin-bottom: calc(var(--sd-space-1) * -1);
}

.sd-page-header__leading {
    flex: 0 0 auto;
}

.sd-page-header__copy {
    flex: 1 1 18rem;
    min-width: 0;
}

.sd-page-header__kicker {
    margin: 0 0 var(--sd-space-1);
    color: var(--sd-muted);
    font-size: var(--sd-fs-sm);
}

.sd-page-header h1 {
    margin: 0;
    color: var(--sd-ink);
    font-size: var(--sd-fs-h1);
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.sd-page-header__description {
    margin: 6px 0 0;
    color: var(--sd-muted);
    font-size: var(--sd-fs-base);
}

.sd-page-header__meta {
    margin-top: var(--sd-space-2);
}

.sd-page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sd-space-3);
    margin-left: auto;
}

/* Legacy hero variant: the image header is gone; the class renders like the plain header. */
.sd-page-header--image {
    background: none;
}

@media (max-width: 767.98px) {
    .sd-page-header__actions {
        flex: 1 0 100%;
        justify-content: flex-start;
        margin-left: 0;
    }
}

/* ---------- Breadcrumbs (SdBreadcrumbs) ---------- */

.sd-breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--sd-muted);
    font-size: var(--sd-fs-sm);
}

.sd-breadcrumbs li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.sd-breadcrumbs li + li::before {
    flex: none;
    width: 6px;
    height: 6px;
    margin-right: 4px;
    content: "";
    border-top: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.sd-breadcrumbs a {
    color: var(--sd-navy);
    text-decoration: none;
}

.sd-breadcrumbs a:hover {
    color: var(--sd-sky-ink);
    text-decoration: underline;
}

/* ---------- Section header (SdSectionHeader) ---------- */

.sd-section-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--sd-space-3) var(--sd-space-4);
    margin-bottom: var(--sd-space-3);
}

.sd-section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: var(--sd-fs-lg);
    font-weight: 500;
}

.sd-section-header__kicker {
    margin: 0 0 2px;
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
}

.sd-section-header p.sd-section-header__description {
    margin: 4px 0 0;
    color: var(--sd-muted);
}

.sd-section-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-2);
}

/* ---------- Tabs with counters ---------- */

/* Route or button tabs. Mark the current tab with aria-current="page" (links) or aria-selected="true" (buttons). */
.sd-tabs {
    display: flex;
    gap: 18px;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    border-bottom: 1px solid var(--sd-line);
    list-style: none;
    scrollbar-width: none;
}

.sd-tabs::-webkit-scrollbar {
    display: none;
}

.sd-tab {
    position: relative;
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 8px;
    padding: 10px 2px;
    border: 0;
    background: none;
    color: var(--sd-muted);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease;
}

.sd-tab::after {
    position: absolute;
    right: 50%;
    bottom: 0;
    left: 50%;
    height: 2px;
    content: "";
    background: var(--sd-line-2);
    transition: left 0.25s var(--sd-ease), right 0.25s var(--sd-ease);
}

.sd-tab:hover {
    color: var(--sd-ink);
}

.sd-tab:hover::after {
    right: 0;
    left: 0;
}

.sd-tab[aria-current="page"],
.sd-tab[aria-selected="true"],
.sd-tab.active {
    color: var(--sd-ink);
    box-shadow: inset 0 -2px 0 var(--sd-sky-ink);
}

.sd-tab[aria-current="page"]::after,
.sd-tab[aria-selected="true"]::after,
.sd-tab.active::after {
    display: none;
}

.sd-tab:focus-visible {
    outline: 2px solid var(--sd-sky-ink);
    outline-offset: -2px;
}

.sd-tab:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Phones and small tablets: the tabs wrap to a second line. No tab is hidden past the edge. */
@media (max-width: 767.98px) {
    .sd-tabs {
        flex-wrap: wrap;
        row-gap: 0;
        overflow-x: visible;
    }
}

@media (pointer: coarse) {
    .sd-tab {
        min-height: 44px;
    }
}

/* Counter pill. Also works inside HxTab titles and section headings. */
.sd-count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 20px;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--sd-fill-2);
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
    font-weight: 500;
    line-height: 1;
}

.sd-tab[aria-current="page"] .sd-count,
.sd-tab[aria-selected="true"] .sd-count,
.sd-tab.active .sd-count,
.nav-link.active .sd-count {
    background: var(--sd-sky);
    color: var(--sd-navy);
}

/* ---------- Toolbar and search field ---------- */

.sd-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-3) var(--sd-space-4);
}

.sd-toolbar__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-3);
    margin-left: auto;
}

/* Search input with a leading icon. Wrap a plain <input> or an HxInputText (CssClass is not needed). */
.sd-search {
    display: flex;
    flex: 1 1 260px;
    align-items: center;
    gap: 10px;
    max-width: 460px;
    min-height: 42px;
    padding: 0 14px;
    border-radius: var(--sd-r-card);
    background: var(--sd-fill);
    color: var(--sd-muted);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.sd-search > .nf,
.sd-search > .hx-icon {
    flex: none;
    font-size: 1.1875rem;
}

.sd-search:focus-within {
    background: #fff;
    box-shadow: var(--sd-focus-ring);
}

.sd-search input,
.sd-search .form-control {
    flex: 1;
    min-width: 0;
    min-height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--sd-ink);
    font: inherit;
    outline: none;
    box-shadow: none;
}

.sd-search .form-control:focus,
.sd-search .form-control:hover {
    background: none;
    box-shadow: none;
}

.sd-search .hx-form-group,
.sd-search .mb-3 {
    flex: 1;
    margin: 0 !important;
}

/* Quiet sort or filter hint next to the search field. */
.sd-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--sd-muted);
    font-size: var(--sd-fs-sm);
}

/* ---------- Data table ---------- */

/* Use together with Bootstrap: <table class="table sd-table">. Zebra rows come from the global table style. */
.sd-table-wrap {
    /* Containing block for absolutely positioned cell content such as sd-sr-only text. Without it, that content
       escapes the scroll area and widens the page on narrow screens. */
    position: relative;
    min-width: 0;
    overflow-x: auto;
}

.sd-table td,
.sd-table th {
    white-space: nowrap;
}

.sd-table td.sd-wrap,
.sd-table th.sd-wrap {
    white-space: normal;
}

.sd-table .sd-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.sd-table tbody tr.sd-row-link {
    cursor: pointer;
}

.sd-table tbody tr > td:first-child {
    position: relative;
}

/* A short sky bar marks the hovered row. */
.sd-table tbody tr > td:first-child::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 3px;
    height: 0;
    content: "";
    border-radius: 2px;
    background: var(--sd-sky-ink);
    transition: height 0.25s var(--sd-ease), top 0.25s var(--sd-ease);
}

.sd-table tbody tr:hover > td:first-child::before,
.sd-table tbody tr:focus-within > td:first-child::before {
    top: 18%;
    height: 64%;
}

.sd-table a {
    color: inherit;
    text-decoration: none;
}

.sd-table a:hover {
    text-decoration: underline;
}

/* Two-line cell: a title and a small second line. */
.sd-cell {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.45;
}

.sd-cell__title {
    font-weight: 500;
}

.sd-cell__sub {
    color: var(--sd-muted);
    font-size: var(--sd-fs-sm);
}

/* Avatar cell: avatar plus a two-line cell. */
.sd-who {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* Inside a tinted panel the zebra alternates between white and transparent. */
.sd-panel .table > tbody > tr:nth-of-type(odd) > * {
    --bs-table-bg-type: rgba(255, 255, 255, 0.7);
}

.sd-panel .table > tbody > tr:nth-of-type(even) > * {
    --bs-table-bg-type: transparent;
}

.sd-panel .table > thead > tr > * {
    border-bottom-color: rgba(34, 56, 78, 0.25);
}

/* Footer row under a list: count and "load more". */
.sd-table-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--sd-space-4);
    padding: 18px 0 4px;
    color: var(--sd-muted);
}

/* ---------- Stacked table rows (opt-in) ----------
   Turns each body row into one stacked block when the table area is narrow, so that no column is hidden past the
   edge. Tables without the modifier do not change.
   Contract:
   - Markup: <div class="sd-table-wrap"><table class="table sd-table sd-table--stack">. The table must be a direct
     child of .sd-table-wrap. The wrap then becomes the size container "sd-table"; do not put the wrap in a box that
     takes its width from its content (inline-block, flex row item with auto width, auto grid column).
   - Breakpoint: the rows stack when the wrap is narrower than 704 px. That is every phone (also landscape) and a
     narrow column on a tablet. A full-width table on a 768 px tablet keeps the table layout.
   - <td class="sd-stack__main">: the identity cell (name, number). First line, left, without a label.
   - <td class="sd-stack__actions">: row actions (row menu, buttons). First line, right, always visible.
   - <td data-label="Column title">: a secondary value. A small muted label (one line) shows left of the value.
     Use the same localized text as the column header.
   - <td class="sd-stack__hide">: a low-value cell that is not shown in the stacked layout.
   - Other cells show full width without a label.
   - The header row stays available to screen readers and is visually hidden. Long values wrap.
   - The zebra tint moves from the cells to the row; the hover marker of the first cell is off.
   - Other sizes: write @container sd-table (max-width: ...) rules in the page CSS. */
.sd-table-wrap:has(> .sd-table--stack) {
    container: sd-table / inline-size;
}

@container sd-table (max-width: 703.98px) {
    .sd-table.sd-table--stack,
    .sd-table.sd-table--stack > tbody {
        display: block;
        width: 100%;
    }

    .sd-table.sd-table--stack > thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .sd-table.sd-table--stack > tbody > tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: 4px var(--sd-space-3);
        padding: 12px;
        border-bottom: 1px solid var(--sd-line);
    }

    .sd-table.sd-table--stack > tbody > tr:nth-of-type(even) {
        background: var(--sd-zebra);
    }

    .sd-table.sd-table--stack > tbody > tr > * {
        grid-column: 1 / -1;
        width: auto;
        min-width: 0;
        padding: 0;
        border: 0;
        background: transparent;
        box-shadow: none;
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .sd-table.sd-table--stack > tbody > tr > .sd-stack__main {
        grid-row: 1;
        grid-column: 1;
    }

    .sd-table.sd-table--stack > tbody > tr > .sd-stack__actions {
        display: flex;
        grid-row: 1;
        grid-column: 2;
        align-items: center;
        justify-content: flex-end;
        gap: var(--sd-space-1);
    }

    .sd-table.sd-table--stack > tbody > tr > .sd-stack__hide {
        display: none;
    }

    .sd-table.sd-table--stack > tbody > tr > td[data-label] {
        position: relative;
        min-height: 1.25rem;
        padding-left: calc(38% + var(--sd-space-3));
    }

    .sd-table.sd-table--stack > tbody > tr > td[data-label]::before {
        position: absolute;
        top: 0.15em;
        left: 0;
        width: 38%;
        height: auto;
        overflow: hidden;
        content: attr(data-label);
        border-radius: 0;
        background: none;
        color: var(--sd-muted);
        font-size: var(--sd-fs-xs);
        font-weight: 400;
        line-height: 1.55;
        text-overflow: ellipsis;
        white-space: nowrap;
        transition: none;
    }

    .sd-table.sd-table--stack > tbody > tr > td:first-child:not([data-label])::before {
        content: none;
    }
}

/* ---------- Avatar (SdAvatar) ---------- */

.sd-avatar {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--sd-sky);
    color: var(--sd-sky-ink);
    font-size: var(--sd-fs-xs);
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
    transition: transform 0.3s var(--sd-spring), box-shadow 0.3s ease;
}

.sd-avatar--sm {
    width: 28px;
    height: 28px;
    font-size: 0.6875rem;
}

.sd-avatar--lg {
    width: 64px;
    height: 64px;
    font-size: 1.125rem;
}

.sd-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sd-avatar--image {
    background: var(--sd-fill-2);
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--sd-line);
}

.sd-avatar--sky { background: var(--sd-sky); color: var(--sd-sky-ink); }
.sd-avatar--mint { background: var(--sd-mint); color: var(--sd-mint-ink); }
.sd-avatar--peach { background: var(--sd-peach); color: var(--sd-peach-ink); }
.sd-avatar--lilac { background: var(--sd-lilac); color: var(--sd-lilac-ink); }
.sd-avatar--rose { background: var(--sd-rose); color: var(--sd-rose-ink); }

/* Only with a real hover: on touch screens a tapped row would keep the grown avatar. */
@media (hover: hover) {
    tr:hover .sd-avatar,
    .sd-side-list li:hover .sd-avatar {
        transform: scale(1.08);
        box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--sd-sky-ink);
    }
}

/* ---------- Panels and cards ---------- */

/* Tinted surface without a frame: side boxes, case boxes, summaries. */
.sd-panel {
    min-width: 0;
    padding: var(--sd-space-4) 20px;
    border-radius: var(--sd-r-card);
    background: var(--sd-fill);
}

.sd-panel--flush {
    padding: 0;
    overflow: hidden;
}

.sd-panel__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-2) var(--sd-space-4);
    margin-bottom: var(--sd-space-3);
}

.sd-panel--flush > .sd-panel__header {
    margin: 0;
    padding: var(--sd-space-4) 18px var(--sd-space-2);
}

.sd-panel__header h2,
.sd-panel__header h3 {
    margin: 0;
    font-size: var(--sd-fs-lg);
    font-weight: 500;
}

.sd-panel__meta {
    margin-left: auto;
    color: var(--sd-muted);
    font-size: var(--sd-fs-sm);
}

/* White card with a quiet frame for clickable or selectable content. */
.sd-card {
    min-width: 0;
    padding: 18px 20px;
    border: 1px solid var(--sd-line);
    border-radius: var(--sd-r-card);
    background: #fff;
    box-shadow: var(--sd-shadow-sm);
    transition: border-color 0.2s ease, box-shadow 0.25s ease, transform 0.25s var(--sd-spring);
}

a.sd-card,
button.sd-card {
    display: block;
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

a.sd-card:hover,
button.sd-card:hover {
    border-color: #c6d6ea;
    box-shadow: var(--sd-shadow-md);
    transform: translateY(-2px);
}

.sd-card.is-selected,
.sd-card[aria-pressed="true"] {
    border-color: transparent;
    background: var(--sd-sky);
    box-shadow: 0 0 0 2px var(--sd-sky-ink), 0 12px 28px rgba(47, 95, 158, 0.16);
}

/* Side list: avatar or icon plus two lines, soft separators. */
.sd-side-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.sd-side-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 -10px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--sd-line-soft);
    border-radius: var(--sd-r-md);
    font-size: var(--sd-fs-sm);
    transition: background-color 0.35s ease, transform 0.3s var(--sd-spring);
}

.sd-side-list li:last-child {
    border-bottom: 0;
}

@media (hover: hover) {
    .sd-side-list li:hover {
        background: rgba(255, 255, 255, 0.85);
        transform: translateX(3px);
    }
}

.sd-side-list a {
    color: inherit;
    text-decoration: none;
}

/* Collapsible group (closed cases, optional documents). Use <details class="sd-disclosure">. */
.sd-disclosure {
    border-radius: var(--sd-r-lg);
    background: var(--sd-fill);
}

.sd-disclosure > summary {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--sd-r-lg);
    cursor: pointer;
    list-style: none;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.sd-disclosure > summary::-webkit-details-marker {
    display: none;
}

.sd-disclosure > summary::after {
    width: 8px;
    height: 8px;
    margin-left: auto;
    content: "";
    border-right: 1.5px solid var(--sd-muted);
    border-bottom: 1.5px solid var(--sd-muted);
    transform: rotate(45deg);
    transition: transform 0.3s var(--sd-spring);
}

.sd-disclosure[open] > summary::after {
    transform: rotate(-135deg);
}

.sd-disclosure > summary:hover {
    background: rgba(234, 242, 252, 0.7);
}

.sd-disclosure > summary .sd-count {
    background: #fff;
}

.sd-disclosure__body {
    padding: 0 12px 12px;
}

/* ---------- Tags, chips, status ---------- */

/* Small status tag. Tones: neutral (default), sky = information or current, mint = done,
   amber = to-do or warning, rose = real error only. */
.sd-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: var(--sd-r-sm);
    background: var(--sd-fill-2);
    color: var(--sd-navy);
    font-size: var(--sd-fs-xs);
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
}

.sd-tag .nf,
.sd-tag .hx-icon,
.sd-tag .sd-jaw {
    font-size: 0.875rem;
}

.sd-tag--sky { background: var(--sd-sky); color: var(--sd-sky-ink); }
.sd-tag--mint { background: var(--sd-mint); color: var(--sd-mint-ink); }
.sd-tag--amber { background: var(--sd-amber); color: var(--sd-amber-ink); }
.sd-tag--rose { background: var(--sd-rose); color: var(--sd-rose-ink); }
.sd-tag--lilac { background: var(--sd-lilac); color: var(--sd-lilac-ink); }

/* Status as coloured text with an icon (tables): "Freigeschaltet", "erhöht". */
.sd-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.sd-status--mint { color: var(--sd-mint-ink); }
.sd-status--sky { color: var(--sd-sky-ink); }
.sd-status--amber { color: var(--sd-amber-ink); }
.sd-status--rose { color: var(--sd-rose-ink); }
.sd-status--muted { color: var(--sd-muted); }

/* Filter chip (pill button). Mark the active chip with aria-pressed="true". */
.sd-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 7px 12px;
    border: 0;
    border-radius: var(--sd-r-pill);
    background: transparent;
    color: var(--sd-muted);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sd-chip:hover {
    background: #f1f5fa;
    color: var(--sd-navy);
}

.sd-chip[aria-pressed="true"],
.sd-chip.is-active {
    background: var(--sd-sky);
    color: var(--sd-sky-ink);
}

.sd-chip .sd-count {
    height: 18px;
    background: var(--sd-fill-2);
}

.sd-chip[aria-pressed="true"] .sd-count,
.sd-chip.is-active .sd-count {
    background: #fff;
    color: var(--sd-sky-ink);
}

/* ---------- Step bar (case flow) ---------- */

/* Five slanted tiles. States: is-done, is-current (with aria-current="step"), none = open.
   Default look: light (new case wizard). Add sd-steps--strong for the case page (mint done, blue current).
   Narrow widths (see "Step bar on narrow widths" below): the tiles shrink and never scroll sideways. */
.sd-steps {
    --sd-slant: 14px;
    container: sd-steps / inline-size;
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 6px;
    margin: 0;
    padding: 0;
    overflow-x: auto;
    list-style: none;
    scrollbar-width: thin;
}

.sd-step {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 60px;
    padding: 10px 26px 10px 32px;
    background: var(--sd-fill);
    color: var(--sd-ink);
    clip-path: polygon(var(--sd-slant) 0, 100% 0, calc(100% - var(--sd-slant)) 100%, 0 100%);
}

.sd-step:first-child {
    padding-left: 18px;
    clip-path: polygon(0 0, 100% 0, calc(100% - var(--sd-slant)) 100%, 0 100%);
}

a.sd-step,
button.sd-step {
    border: 0;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.25s var(--sd-spring);
}

a.sd-step:hover,
button.sd-step:hover {
    transform: translateY(-2px);
}

.sd-step__n {
    flex: none;
    width: 20px;
    color: var(--sd-muted);
    font-size: var(--sd-fs-lg);
    font-weight: 600;
    text-align: center;
}

.sd-step__n .nf,
.sd-step__n .hx-icon {
    font-size: 1.25rem;
}

.sd-step__t {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sd-step__t b,
.sd-step__title {
    overflow: hidden;
    font-size: var(--sd-fs-base);
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-step__t span,
.sd-step__detail {
    overflow: hidden;
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sd-step.is-done .sd-step__n {
    color: var(--sd-mint-ink);
}

.sd-step.is-current {
    background: var(--sd-sky);
    box-shadow: inset 0 -3px 0 var(--sd-sky-ink);
}

.sd-step.is-current .sd-step__n {
    color: var(--sd-sky-ink);
}

.sd-step.is-current .sd-step__t b,
.sd-step.is-current .sd-step__title {
    font-weight: 600;
}

.sd-step:not(.is-done):not(.is-current) .sd-step__t b {
    color: var(--sd-muted);
}

.sd-steps--strong .sd-step.is-done {
    background: var(--sd-mint);
}

.sd-steps--strong .sd-step.is-current {
    background: linear-gradient(100deg, #2f5f9e, #3d74b8);
    color: #fff;
    box-shadow: 0 10px 24px rgba(47, 95, 158, 0.28);
}

.sd-steps--strong .sd-step.is-current .sd-step__n,
.sd-steps--strong .sd-step.is-current .sd-step__t b {
    color: #fff;
}

.sd-steps--strong .sd-step.is-current .sd-step__t span {
    color: #dbe7f7;
}

/* Step bar on narrow widths. The markup does not change.
   Below 780 px of bar width (tablet, side column): compact tiles, the number sits above the title.
   Phones (viewport below 576 px): the current step is a wide tile with number, title and detail. The other steps
   are narrow tiles that show only the number or the check mark, so the five tiles read as a progress bar.
   Their titles stay in the DOM for screen readers. Without a current step all five tiles are narrow. */
@container sd-steps (max-width: 779.98px) {
    .sd-step {
        --sd-slant: 10px;
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 2px;
        min-height: 60px;
        padding: 8px 14px 8px 20px;
    }

    .sd-step:first-child {
        padding-left: 12px;
    }

    .sd-step__n {
        width: auto;
        font-size: var(--sd-fs-md);
        line-height: 1.2;
    }

    .sd-step__n .nf,
    .sd-step__n .hx-icon {
        font-size: 1.125rem;
    }

    .sd-step__t {
        align-self: stretch;
    }

    .sd-step__t b,
    .sd-step__title {
        font-size: var(--sd-fs-sm);
    }
}

@media (max-width: 575.98px) {
    .sd-steps {
        display: flex;
        gap: 4px;
    }

    /* Narrow tiles have a fixed width; the current tile takes the rest of the row. */
    .sd-step {
        flex: 0 0 30px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        min-width: 0;
        min-height: 52px;
        padding: 8px 2px;
    }

    .sd-step:first-child {
        padding-left: 2px;
    }

    .sd-step:not(.is-current) .sd-step__n .nf,
    .sd-step:not(.is-current) .sd-step__n .hx-icon {
        font-size: 1rem;
    }

    /* No current step (all done): the five tiles share the row. */
    .sd-steps:not(:has(> .is-current)) > .sd-step {
        flex: 1 1 0;
    }

    .sd-step:not(.is-current) .sd-step__t {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .sd-step.is-current {
        flex: 1 1 auto;
        justify-content: flex-start;
        gap: 8px;
        padding-inline: 16px 12px;
    }

    .sd-step.is-current:first-child {
        padding-left: 10px;
    }

    .sd-step.is-current .sd-step__t {
        align-self: center;
    }

    .sd-step.is-current .sd-step__t b,
    .sd-step.is-current .sd-step__title {
        font-size: var(--sd-fs-base);
    }
}

/* Mini step marker for tables: five small slanted bars. */
.sd-mini-steps {
    display: inline-grid;
    grid-template-columns: repeat(5, 18px);
    gap: 2px;
    vertical-align: middle;
}

.sd-mini-steps i {
    height: 10px;
    background: #e2e7ed;
    clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
    transition: transform 0.25s var(--sd-spring);
}

/* Inside an element with a product class the bars take the product color. */
.sd-mini-steps i.is-done { background: var(--sd-product-soft, #9fbbe0); }
.sd-mini-steps i.is-current { background: var(--sd-product-ink, var(--sd-sky-ink)); }
.sd-mini-steps--closed i { background: #6fbfa3; }

/* Row hover: the bars lift one after the other, a small wave from left to right (prototype .mini-rail).
   Only with a real hover: on touch screens a tapped row would keep the lifted bars. */
@media (hover: hover) {
    tr:hover .sd-mini-steps i {
        transform: translateY(-2px);
    }

    tr:hover .sd-mini-steps i:nth-child(2) { transition-delay: 0.03s; }
    tr:hover .sd-mini-steps i:nth-child(3) { transition-delay: 0.06s; }
    tr:hover .sd-mini-steps i:nth-child(4) { transition-delay: 0.09s; }
    tr:hover .sd-mini-steps i:nth-child(5) { transition-delay: 0.12s; }
}

/* Numbered guidance marker (document steps): blue, green when done. */
.sd-step-badge {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--sd-sky-ink);
    color: #fff;
    font-size: var(--sd-fs-md);
    font-weight: 600;
    box-shadow: 0 6px 14px rgba(47, 95, 158, 0.25);
}

.sd-step-badge.is-done {
    background: var(--sd-mint-ink);
    box-shadow: 0 6px 14px rgba(44, 122, 98, 0.25);
}

.sd-step-badge.is-soft {
    background: var(--sd-sky);
    color: var(--sd-sky-ink);
    box-shadow: none;
}

/* Thin progress bar (production, groups). */
.sd-progress {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--sd-fill-2);
}

.sd-progress > i {
    display: block;
    width: var(--sd-progress, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--sd-sky-ink);
    transition: width 0.6s var(--sd-ease);
}

.sd-progress--mint > i {
    background: linear-gradient(90deg, #6fbfa3, var(--sd-mint-ink));
}

/* ---------- Empty state (SdEmptyState) ---------- */

.sd-empty-state {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--sd-space-3) var(--sd-space-5);
    align-items: start;
    padding: var(--sd-space-6);
    border-radius: var(--sd-r-card);
    background: var(--sd-sky);
}

.sd-empty-state--icon {
    grid-template-columns: 60px minmax(0, 1fr);
}

.sd-empty-state__icon {
    color: var(--sd-sky-ink);
    font-size: 2.875rem;
    line-height: 1;
}

.sd-empty-state h2 {
    margin: 0;
    font-size: var(--sd-fs-lg);
    font-weight: 500;
}

.sd-empty-state p {
    max-width: 70ch;
    margin: 6px 0 0;
    color: var(--sd-muted);
}

.sd-empty-state__actions {
    display: flex;
    flex-wrap: wrap;
    grid-column: 1 / -1;
    justify-content: flex-end;
    gap: var(--sd-space-2);
}

@media (max-width: 575.98px) {
    .sd-empty-state {
        padding: var(--sd-space-5) 20px;
    }

    .sd-empty-state--icon {
        grid-template-columns: minmax(0, 1fr);
    }

    .sd-empty-state__actions {
        justify-content: flex-start;
    }
}

/* ---------- Notice (inline message with icon) ---------- */

/* Tones: sky (information, default), amber (attention), mint (success), rose (error). */
.sd-notice {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--sd-r-card);
    background: var(--sd-sky);
    color: var(--sd-ink);
}

.sd-notice > .nf,
.sd-notice > .hx-icon {
    color: var(--sd-sky-ink);
    font-size: 1.375rem;
    line-height: 1.1;
}

.sd-notice b,
.sd-notice__title {
    display: block;
    margin-bottom: 4px;
    font-weight: 500;
}

.sd-notice p {
    margin: 0;
}

.sd-notice--amber { background: var(--sd-amber); }
.sd-notice--amber > .nf, .sd-notice--amber > .hx-icon { color: var(--sd-amber-ink); }
.sd-notice--mint { background: var(--sd-mint); }
.sd-notice--mint > .nf, .sd-notice--mint > .hx-icon { color: var(--sd-mint-ink); }
.sd-notice--rose { background: var(--sd-rose); }
.sd-notice--rose > .nf, .sd-notice--rose > .hx-icon { color: var(--sd-rose-ink); }

/* ---------- Key and value ---------- */

/* Facts in a row (patient header): small label above the value. */
.sd-facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sd-space-2) var(--sd-space-6);
    margin: 0;
}

.sd-facts > div {
    min-width: 0;
}

.sd-facts dt {
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
    font-weight: 400;
}

.sd-facts dd {
    margin: 2px 0 0;
    font-weight: 500;
}

/* Summary rows: label left, value right (checkout box, invoice totals). */
.sd-kv {
    display: grid;
    gap: 10px;
    margin: 0;
}

.sd-kv > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sd-space-4);
}

.sd-kv dt {
    color: var(--sd-muted);
    font-weight: 400;
}

.sd-kv dd {
    margin: 0;
    font-weight: 500;
    text-align: right;
}

.sd-kv__total {
    padding-top: var(--sd-space-4);
    border-top: 1px solid rgba(34, 56, 78, 0.1);
}

/* Definition grid: label column and value column (patient master data, payment details). */
.sd-summary {
    display: grid;
    grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
    gap: var(--sd-space-2) var(--sd-space-4);
    margin: 0;
}

.sd-summary dt {
    color: var(--sd-muted);
    font-weight: 400;
}

.sd-summary dd {
    margin: 0;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.sd-summary--panel {
    padding: var(--sd-space-4) 18px;
    border-radius: var(--sd-r-card);
    background: var(--sd-fill);
}

@media (max-width: 575.98px) {
    .sd-summary {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .sd-summary dd {
        margin-bottom: var(--sd-space-2);
    }
}

/* ---------- Forms ---------- */

/* Two-column form. Wrap HxInput* components; add sd-form-grid__wide for full width. */
.sd-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px var(--sd-space-4);
}

.sd-form-grid > * {
    min-width: 0;
}

.sd-form-grid .hx-form-group,
.sd-form-grid .mb-3 {
    margin-bottom: 0 !important;
}

.sd-form-grid__wide {
    grid-column: 1 / -1;
}

.sd-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sd-space-3);
    margin-top: var(--sd-space-5);
}

@media (max-width: 575.98px) {
    .sd-form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .sd-form-actions {
        justify-content: stretch;
    }

    .sd-form-actions > .btn {
        flex: 1 1 auto;
    }
}

/* Side navigation for settings pages (account). Mark the current link with aria-current="page". */
.sd-subnav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sd-subnav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 8px;
    color: var(--sd-navy);
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.3s ease, transform 0.25s var(--sd-spring);
}

.sd-subnav a .nf,
.sd-subnav a .hx-icon {
    font-size: 1.125rem;
}

.sd-subnav a:hover {
    background: var(--sd-ice);
    transform: translateX(3px);
}

.sd-subnav a[aria-current="page"],
.sd-subnav a.active {
    background: var(--sd-sky);
    color: var(--sd-sky-ink);
    box-shadow: inset 3px 0 0 var(--sd-sky-ink);
}

/* ---------- Actions ---------- */

/* Round icon action without a frame. Put it on a <button> or <a>; give it an aria-label. */
.sd-icon-btn {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--sd-navy);
    font-size: 1.1875rem;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, transform 0.25s var(--sd-spring);
}

.sd-icon-btn:hover {
    background: var(--sd-sky);
    color: var(--sd-sky-ink);
    transform: scale(1.08);
}

.sd-icon-btn:disabled {
    opacity: 0.45;
    cursor: default;
    transform: none;
}

/* Text link with a growing underline. */
.sd-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 1px;
    border: 0;
    background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
    color: var(--sd-navy);
    font: inherit;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-size 0.25s var(--sd-ease), color 0.15s ease;
}

.sd-link:hover {
    background-size: 100% 1px;
    color: var(--sd-sky-ink);
}

/* Large entry action (Neuer Patient, Neuer Fall, Weiter zur Zahlung). Add to an HxButton with Color Primary. */
/* Filled red action: every primary or danger button looks like "Coins kaufen". A cherry gradient with a soft
   shadow, Scheu red under the pointer, and the shine band (see Shine below). Disabled buttons stay flat and grey. */
:root {
    --sd-action-bg: linear-gradient(100deg, #b8193f 0%, #c8173d 45%, #9d1235 100%);
    --sd-action-bg-hover: linear-gradient(100deg, #e30613 0%, #d40a19 45%, #b70b18 100%);
    --sd-action-shadow: 0 6px 18px rgba(184, 25, 63, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.25);
    --sd-action-shadow-hover: 0 10px 24px rgba(227, 6, 19, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn.btn-primary:not(:disabled):not(.disabled),
.btn.btn-danger:not(:disabled):not(.disabled),
.btn.sd-hero-action {
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    border-color: transparent;
    background: var(--sd-action-bg);
    box-shadow: var(--sd-action-shadow);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.btn.btn-primary:not(:disabled):not(.disabled):hover,
.btn.btn-danger:not(:disabled):not(.disabled):hover,
.btn.sd-hero-action:hover {
    background: var(--sd-action-bg-hover);
    box-shadow: var(--sd-action-shadow-hover);
    transform: translateY(-1px);
}

.btn.sd-hero-action {
    --bs-btn-padding-x: 1.5rem;
    --bs-btn-border-radius: var(--sd-r-md);
    justify-content: flex-start;
    gap: 10px;
    min-width: 210px;
    min-height: 48px;
    border: 0;
    font-size: var(--sd-fs-md);
    font-weight: 600;
}

.btn.sd-hero-action .nf,
.btn.sd-hero-action .hx-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-size: 1.125rem;
}

/* Sticky action bar at the end of a form or wizard. */
.sd-actionbar {
    position: sticky;
    bottom: var(--sd-space-4);
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-3) var(--sd-space-4);
    padding: 18px 22px;
    border-radius: var(--sd-r-lg);
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    box-shadow: 0 0 0 1px var(--sd-line), 0 16px 40px rgba(34, 56, 78, 0.12);
}

.sd-actionbar__end {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sd-space-3);
    margin-left: auto;
}

/* Phones: the bar keeps clear of the home indicator; its buttons share the full width. */
@media (max-width: 575.98px) {
    .sd-actionbar {
        bottom: max(var(--sd-space-3), env(safe-area-inset-bottom));
        padding: 12px 14px;
    }

    .sd-actionbar__end {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .sd-actionbar__end > .btn {
        flex: 1 1 auto;
    }
}

/* ---------- Metric (SdMetric) ---------- */

.sd-metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--sd-space-3);
}

.sd-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 18px 20px;
    border-radius: var(--sd-r-card);
    background: var(--sd-fill);
    color: var(--sd-ink);
}

.sd-metric__label {
    order: -1;
    color: var(--sd-muted);
    font-size: var(--sd-fs-sm);
}

.sd-metric__value {
    color: var(--sd-ink);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.sd-metric--mint .sd-metric__value { color: var(--sd-mint-ink); }

/* ---------- Kicker (legacy) ---------- */

/* Small muted label above a heading. The logo bars of the old kicker are gone. */
.sd-kicker {
    margin: 0 0 4px;
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
    font-weight: 500;
}

/* ---------- Jaw arch icon (SdJawIcon) ---------- */

/* Dental arch icon (SdJawIcon): filled teeth along a horseshoe in the current text colour. */
.sd-jaw {
    display: inline-block;
    flex: none;
    width: 1.15em;
    height: 1.15em;
    fill: currentColor;
    stroke: none;
    vertical-align: -0.2em;
}

/* ---------- Image action menu (SdMoreMenu) ---------- */

/* Round "more" button at the bottom right of an image frame. The parent frame must be positioned and must not clip
   the menu. Destructive items use sd-more-menu__danger; a quiet note line uses sd-more-menu__note. */
.sd-more-menu {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 3;
    pointer-events: auto;
}

.sd-more-menu__toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: var(--sd-navy);
    font-size: 1.125rem;
    box-shadow: 0 1px 4px rgba(34, 56, 78, 0.24);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sd-more-menu__toggle[aria-expanded="true"] {
    background: var(--sd-navy);
    color: #fff;
}

.sd-more-menu__toggle:focus-visible {
    outline: 3px solid var(--sd-sky-ink);
    outline-offset: 2px;
}

/* An open menu rises above the buttons of the neighbouring images. */
.sd-more-menu:has(.dropdown-menu.show) {
    z-index: 1000;
}

.sd-more-menu--small {
    right: 4px;
    bottom: 4px;
}

.sd-more-menu--small .sd-more-menu__toggle {
    position: relative;
    width: 28px;
    height: 28px;
    font-size: 1rem;
}

/* The small button keeps a 44 px touch target. */
.sd-more-menu--small .sd-more-menu__toggle::after {
    position: absolute;
    inset: -8px;
    content: "";
}

.sd-more-menu__menu {
    min-width: 13.5rem;
}

.sd-more-menu__menu .dropdown-item.sd-more-menu__danger,
.sd-more-menu__menu .sd-more-menu__danger .dropdown-item {
    color: var(--sd-cherry);
}

.sd-more-menu__menu .dropdown-item.sd-more-menu__danger .hx-icon,
.sd-more-menu__menu .dropdown-item.sd-more-menu__danger .nf {
    color: inherit;
}

.sd-more-menu__note {
    padding: 4px 16px 8px;
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
}

@media (hover: hover) {
    .sd-more-menu__toggle:hover {
        background: #fff;
        color: var(--sd-sky-ink);
    }
}

@media (pointer: coarse) {
    .sd-more-menu__toggle {
        width: 44px;
        height: 44px;
    }

    .sd-more-menu--small .sd-more-menu__toggle {
        width: 30px;
        height: 30px;
    }
}

/* ---------- Flag (SdFlag) ---------- */

/* National flag of a language choice: a small rounded rectangle with a hairline edge for white stripes. */
.sd-flag {
    display: inline-block;
    flex: none;
    width: 20px;
    height: 14px;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(34, 56, 78, 0.16);
    vertical-align: -0.15em;
}

/* ---------- Visually hidden text for screen readers ---------- */

.sd-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ---------- Touch screens ----------
   On a coarse pointer every shared control is at least 44 x 44 px. Breadcrumb links get the larger hit area with
   negative margins, so the crumb line keeps its height. */
@media (pointer: coarse) {
    .sd-icon-btn {
        width: 44px;
        height: 44px;
    }

    .btn.sd-reveal {
        min-width: 44px;
        height: 44px;
    }

    .sd-chip,
    .sd-search {
        min-height: 44px;
    }

    .sd-menu .dropdown-item {
        min-height: 44px;
    }

    .sd-breadcrumbs a {
        display: inline-flex;
        align-items: center;
        min-height: 44px;
        margin-block: -12px;
    }

    /* Confirmation check: app.css makes the row a 44 px flex row with a 22 px box. The tinted field keeps only its
       side padding, so the row does not get taller than 44 px. */
    .sd-confirm__check.form-check:not(.form-switch):not(.form-check-inline):not(.form-check-reverse) {
        padding: 0 14px;
    }
}

/* Without hover (touch), a tapped element keeps its hover state until the next tap. It must not stay lifted. */
@media (hover: none) {
    .sd-subnav a:hover,
    .sd-icon-btn:hover,
    a.sd-card:hover,
    button.sd-card:hover,
    a.sd-step:hover,
    button.sd-step:hover,
    .btn.btn-primary:not(:disabled):not(.disabled):hover,
    .btn.btn-danger:not(:disabled):not(.disabled):hover,
    .btn.sd-hero-action:hover {
        transform: none;
    }
}

/* Reduced motion: app.css keeps colour fades and removes movement transitions and animations.
   Hover states here only stop moving. */
@media (prefers-reduced-motion: reduce) {
    tr:hover .sd-avatar,
    .sd-side-list li:hover,
    .sd-subnav a:hover,
    .sd-icon-btn:hover,
    a.sd-card:hover,
    button.sd-card:hover,
    a.sd-step:hover,
    button.sd-step:hover,
    tr:hover .sd-mini-steps i,
    .btn.btn-primary:hover,
    .btn.btn-danger:hover,
    .btn.sd-hero-action:hover {
        transform: none;
    }
}

/* ---------- Icon button that reveals its label ----------
   A round icon button; on hover or keyboard focus it grows into a pill and the label slides out.
   Markup: <HxButton Icon=".." CssClass="sd-reveal"><span class="sd-reveal__label">Text</span></HxButton>.
   The label stays in the DOM, so the accessible name does not change. */

.btn.sd-reveal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 40px;
    height: 40px;
    padding: 0 10px;
    border-radius: 999px;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, padding 0.35s var(--sd-ease, ease);
}

.btn.sd-reveal .hx-icon,
.btn.sd-reveal .nf {
    margin: 0;
    font-size: 1.25rem;
}

.sd-reveal__label {
    display: inline-block;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width 0.35s var(--sd-ease, ease), margin 0.35s var(--sd-ease, ease), opacity 0.2s ease;
}

.btn.sd-reveal:hover:not(:disabled),
.btn.sd-reveal:focus-visible {
    padding: 0 16px 0 12px;
    background: var(--sd-sky);
}

.btn.sd-reveal:hover:not(:disabled) .sd-reveal__label,
.btn.sd-reveal:focus-visible .sd-reveal__label {
    max-width: 16rem;
    margin-left: 8px;
    opacity: 1;
}

.btn.sd-reveal.sh-case__delete:hover:not(:disabled),
.btn.sd-reveal.sh-case__delete:focus-visible {
    background: var(--sd-rose);
}

/* Open variant: the main action of a tool row shows its label at all times and keeps its own button colors. */
.btn.sd-reveal.sd-reveal--open {
    padding: 0 18px 0 14px;
}

.btn.sd-reveal.sd-reveal--open .sd-reveal__label {
    max-width: 20rem;
    margin-left: 8px;
    opacity: 1;
}

.btn.sd-reveal.sd-reveal--open:hover:not(:disabled),
.btn.sd-reveal.sd-reveal--open:focus-visible {
    padding: 0 18px 0 14px;
}

.btn.sd-reveal.sd-reveal--open.btn-primary:hover:not(:disabled) {
    background: var(--sd-action-bg-hover);
}

@media (prefers-reduced-motion: reduce) {
    .btn.sd-reveal,
    .sd-reveal__label {
        transition: background-color 0.2s ease, opacity 0.2s ease;
    }
}

/* ---------- Action menu ----------
   A dropdown menu whose items carry a second, quieter line that says what the action does or why it is off.
   Markup: <HxDropdownMenu CssClass="sd-menu"> with <span class="sd-menu__text"><span>Action</span><small>Hint</small></span>.
   The danger item turns cherry only on hover or focus; at rest it reads like the other items. */

.dropdown-menu.sd-menu {
    min-width: 17rem;
    max-width: 21rem;
    padding: 6px;
}

.sd-menu .dropdown-item {
    align-items: flex-start;
    padding: 9px 10px;
    border-radius: var(--sd-r-sm);
    white-space: normal;
}

.sd-menu .dropdown-item .nf,
.sd-menu .dropdown-item .hx-icon {
    margin-top: 1px;
}

.sd-menu__text {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.sd-menu__text small {
    color: var(--sd-muted);
    font-size: var(--sd-fs-xs);
    font-weight: 400;
    line-height: 1.35;
}

.sd-menu .dropdown-divider {
    margin: 6px 4px;
}

.sd-menu .dropdown-item.sd-menu__item--danger:hover,
.sd-menu .dropdown-item.sd-menu__item--danger:focus-visible {
    background: var(--sd-rose);
    color: var(--sd-rose-ink);
}

.sd-menu .dropdown-item.sd-menu__item--danger:hover .nf,
.sd-menu .dropdown-item.sd-menu__item--danger:hover .hx-icon,
.sd-menu .dropdown-item.sd-menu__item--danger:focus-visible .nf,
.sd-menu .dropdown-item.sd-menu__item--danger:focus-visible .hx-icon {
    color: var(--sd-rose-ink);
}

/* An item that is off keeps its hint readable: the hint is the reason. */
.sd-menu .dropdown-item.disabled,
.sd-menu .dropdown-item:disabled {
    opacity: 1;
    color: rgb(var(--sd-muted-rgb));
}

.sd-menu .dropdown-item.disabled .nf,
.sd-menu .dropdown-item.disabled .hx-icon,
.sd-menu .dropdown-item:disabled .nf,
.sd-menu .dropdown-item:disabled .hx-icon {
    opacity: 0.55;
}

/* ---------- Confirmation dialog ----------
   For actions that cannot be undone. Markup inside HxModal (CssClass="sd-confirm"): a lead that says what goes,
   an optional quiet note with an icon (what stays), an optional amber refusal, and a checkbox on a quiet field
   that enables the red button. */

.sd-confirm__lead {
    margin-bottom: var(--sd-space-3);
    color: var(--sd-ink);
    font-size: var(--sd-fs-md);
    line-height: 1.5;
}

.sd-confirm__note,
.sd-confirm__refusal {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: var(--sd-space-4);
    font-size: var(--sd-fs-base);
    line-height: 1.45;
}

.sd-confirm__note {
    color: var(--sd-muted);
}

/* A refusal is a rule, not a failure: amber, like every other warning. */
.sd-confirm__refusal {
    padding: 10px 12px;
    border-radius: var(--sd-r-sm);
    background: var(--sd-amber);
    color: var(--sd-amber-ink);
}

.sd-confirm__note .nf,
.sd-confirm__note .hx-icon,
.sd-confirm__refusal .nf,
.sd-confirm__refusal .hx-icon {
    flex: none;
    margin-top: 1px;
    font-size: 1.125rem;
}

.sd-confirm__check {
    margin: 0;
    padding: 12px 14px 12px 40px;
    border-radius: var(--sd-r-sm);
    background: var(--sd-fill-2);
}

.sd-confirm__check .form-check-input {
    margin-left: -26px;
}

.sd-confirm__check .form-check-label {
    color: var(--sd-ink);
    font-weight: 500;
}

/* ---------- Products ----------
   One color pair and one icon per product, the same in every view. Set the class on the element that belongs to
   the product (case box, list row, chip); children read --sd-product, --sd-product-ink and --sd-product-soft.
   The icons live in ProductStyle.cs. Two pairs are reserved for later products; amber and rose stay with
   warnings and errors. */

.sd-product--aligner { --sd-product: var(--sd-sky); --sd-product-ink: var(--sd-sky-ink); --sd-product-soft: #9fbbe0; }
.sd-product--splint { --sd-product: var(--sd-mint); --sd-product-ink: var(--sd-mint-ink); --sd-product-soft: #96cdb8; }
.sd-product--other { --sd-product: var(--sd-fill-2); --sd-product-ink: var(--sd-navy); --sd-product-soft: #b9c4d0; }
/* Reserved: lilac #f0ecfa / #5d4a9c / #c2b6e3 and petrol #e3f2f4 / #1f6b75 / #9ccdd3. */

/* The product icon on a tile in the product color. */
.sd-product-mark {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--sd-product);
    color: var(--sd-product-ink);
    font-size: 1.25rem;
}

.sd-product-mark--sm {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* A product filter chip: the icon carries the product color, the active chip takes the product tint. */
.sd-chip[class*="sd-product--"] .nf,
.sd-chip[class*="sd-product--"] .hx-icon {
    color: var(--sd-product-ink);
    font-size: 1.05rem;
}

.sd-chip[class*="sd-product--"][aria-pressed="true"] {
    background: var(--sd-product);
    color: var(--sd-product-ink);
}

.sd-chip[class*="sd-product--"][aria-pressed="true"] .sd-count {
    color: var(--sd-product-ink);
}


/* ---------- Shine ----------
   A band of light sweeps across a hero action or a tile when the pointer enters (prototype: entry buttons and
   product cards). .btn.sd-hero-action has it built in; tiles add .sd-shine to a positioned, clipped element.
   The band sits in the element's own layer (z-index -1 in an isolated context), above its background and photo,
   below its text. Reduced motion: the band does not travel; it fades in at the middle. */

.btn.btn-primary,
.btn.btn-danger,
.btn.sd-hero-action,
.sd-shine {
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn.btn-primary::after,
.btn.btn-danger::after,
.btn.sd-hero-action::after,
.sd-shine::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(115deg, transparent 35%, rgb(255 255 255 / 0.38) 47%, transparent 58%);
    background-position: 120% 0;
    background-repeat: no-repeat;
    background-size: 260% 100%;
    transition: background-position 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Tiles are light, so their band is a little stronger to stay visible on the photo and the tint. */
.sd-shine::after {
    background-image: linear-gradient(115deg, transparent 36%, rgb(255 255 255 / 0.55) 48%, transparent 60%);
}

.btn.btn-primary:not(:disabled):hover::after,
.btn.btn-primary:focus-visible::after,
.btn.btn-danger:not(:disabled):hover::after,
.btn.btn-danger:focus-visible::after,
.btn.sd-hero-action:hover::after,
.btn.sd-hero-action:focus-visible::after,
.sd-shine:hover::after,
.sd-shine:focus-visible::after {
    background-position: -20% 0;
}

@media (prefers-reduced-motion: reduce) {
    .btn.btn-primary::after,
    .btn.btn-danger::after,
    .btn.sd-hero-action::after,
    .sd-shine::after {
        opacity: 0;
        background-position: 50% 0;
        transition: opacity 0.35s ease !important;
    }

    .btn.btn-primary:not(:disabled):hover::after,
    .btn.btn-primary:focus-visible::after,
    .btn.btn-danger:not(:disabled):hover::after,
    .btn.btn-danger:focus-visible::after,
    .btn.sd-hero-action:hover::after,
    .btn.sd-hero-action:focus-visible::after,
    .sd-shine:hover::after,
    .sd-shine:focus-visible::after {
        opacity: 1;
        background-position: 50% 0;
    }
}
