:root {
    --brand-900: var(--cds-text-primary);
    --brand-800: var(--cds-link-primary-hover);
    --brand-700: var(--cds-link-primary);
    --brand-600: var(--cds-button-primary-hover);
    --brand-500: var(--cds-support-info);
    --brand-100: var(--cds-highlight);
    --brand-50: var(--cds-layer-accent-01);
    --blue-600: var(--cds-link-primary);
    --blue-50: color-mix(in srgb, var(--cds-support-info) 12%, var(--cds-layer-01));
    --green-700: var(--cds-support-success);
    --green-50: color-mix(in srgb, var(--cds-support-success) 12%, var(--cds-layer-01));
    --amber-700: var(--cds-support-warning);
    --amber-50: color-mix(in srgb, var(--cds-support-warning) 12%, var(--cds-layer-01));
    --red-700: var(--cds-support-error);
    --red-50: color-mix(in srgb, var(--cds-support-error) 12%, var(--cds-layer-01));
    --ink-950: var(--cds-text-primary);
    --ink-900: var(--cds-text-primary);
    --ink-800: var(--cds-text-primary);
    --ink-700: var(--cds-text-secondary);
    --ink-600: var(--cds-text-secondary);
    --ink-500: var(--cds-text-helper);
    --ink-400: var(--cds-text-placeholder);
    --line: var(--cds-border-subtle-01);
    --line-soft: var(--cds-border-subtle-00);
    --surface: var(--cds-layer-01);
    --surface-muted: var(--cds-layer-02);
    --surface-hover: var(--cds-layer-hover-01);
    --surface-tint: var(--cds-layer-accent-01);
    --canvas: var(--cds-background);
    /* Carbon's theme classes ship no button tokens (those come from the SCSS button
       component the clinic app compiles in), so the portal defines them from the
       theme's interactive colour or every primary button renders with no fill. */
    --cds-button-primary: var(--cds-interactive, #0f62fe);
    --cds-button-primary-hover: #0353e9;
    --button-primary: var(--cds-button-primary);
    --button-primary-hover: var(--cds-button-primary-hover);
    --button-primary-text: var(--cds-text-on-color);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --bg-canvas: var(--canvas);
    --bg-surface: var(--surface);
    --bg-raised: var(--surface);
    --bg-muted: var(--surface-muted);
    --bg-overlay: rgba(15, 23, 42, 0.48);
    --text-primary: var(--ink-950);
    --text-secondary: var(--ink-700);
    --text-muted: var(--ink-500);
    --text-placeholder: var(--ink-400);
    --text-on-brand: var(--cds-text-on-color);
    --border: var(--line);
    --border-muted: var(--line-soft);
    --sh-xs: var(--shadow-sm);
    --sh-sm: var(--shadow-sm);
    --sh-md: var(--shadow-md);
    --r-xs: 0.375rem;
    --r-sm: var(--radius-sm);
    --r-md: var(--radius-md);
    --r-lg: var(--radius-lg);
    --r-xl: 1.5rem;
    --r-pill: 999px;
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 1rem;
    --text-md: 1.125rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 2rem;
    --touch-target: 2.75rem;
    --motion-fast: 140ms;
    --motion-standard: 220ms;
}

html.theme-g90,
html.theme-g100 {
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.28);
}

html,
body {
    background: var(--canvas);
    color: var(--ink-950);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    margin: 0;
    min-height: 100%;
    text-rendering: optimizeLegibility;
    transition: background-color 160ms ease, color 160ms ease;
}

html[data-host="maui"][data-platform="android"] {
    --touch-target: 3rem;
}

html[data-host="maui"] body {
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    overscroll-behavior-y: none;
}

* {
    box-sizing: border-box;
}

button,
input,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: var(--brand-700);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(8, 166, 200, 0.25);
    outline-offset: 2px;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.62;
    transform: none;
}

.my-health-page .file-input {
    background: var(--surface-muted);
    border: 1px dashed var(--ink-400);
    border-radius: 10px;
    color: var(--ink-600);
    cursor: pointer;
    min-height: 64px;
    padding: 0.65rem;
    width: 100%;
}

.my-health-page .file-input::file-selector-button {
    background: var(--button-primary);
    border: 1px solid var(--button-primary);
    border-radius: 8px;
    color: var(--button-primary-text);
    cursor: pointer;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    margin-inline-end: 0.85rem;
    min-height: 40px;
    padding: 0.55rem 0.85rem;
    transition: background-color 140ms ease, border-color 140ms ease;
}

.my-health-page .file-input:hover::file-selector-button {
    background: var(--button-primary-hover);
    border-color: var(--button-primary-hover);
}

.my-health-page .file-input:focus-visible {
    border-color: var(--brand-600);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.app-icon {
    display: block;
    flex: 0 0 auto;
    height: 1.25rem;
    width: 1.25rem;
}

.page {
    margin: 0 auto;
    max-width: 1280px;
    width: 100%;
}

.page-header {
    align-items: flex-end;
    display: flex;
    gap: 1.5rem;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.page-eyebrow {
    color: var(--brand-700);
    font-size: 0.875rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    margin: 0 0 0.4rem;
    text-transform: uppercase;
}

.page-title {
    color: var(--ink-950);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 720;
    letter-spacing: -0.035em;
    line-height: 1.15;
    margin: 0;
}

.page-subtitle {
    color: var(--ink-500);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0.45rem 0 0;
}

.surface-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.section-heading {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.section-heading h2 {
    color: var(--ink-950);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 0;
}

.section-heading a {
    font-size: 0.85rem;
    font-weight: 650;
    text-decoration: none;
}

.button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 700;
    gap: 0.55rem;
    justify-content: center;
    min-height: 44px;
    padding: 0.65rem 1rem;
    text-decoration: none;
    transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .button:hover {
        transform: translateY(-1px);
    }
}

.button:active {
    transform: scale(0.985);
}

.button-primary {
    background: var(--button-primary);
    box-shadow: 0 4px 10px rgba(7, 107, 134, 0.18);
    color: var(--button-primary-text);
}

.button-primary:hover {
    background: var(--button-primary-hover);
}

.button-secondary {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink-700);
}

.button-secondary:hover {
    background: var(--canvas);
    border-color: var(--ink-400);
}

.button-danger {
    background: var(--surface);
    border-color: #fecaca;
    color: var(--red-700);
}

.button-compact {
    min-height: 40px;
    padding: 0.45rem 0.75rem;
}

.segmented-control {
    align-items: center;
    background: var(--surface-tint);
    border-radius: 10px;
    display: flex;
    gap: 0.2rem;
    overflow-x: auto;
    padding: 0.25rem;
    width: fit-content;
}

.segmented-control button {
    background: transparent;
    border: 0;
    border-radius: 7px;
    color: var(--ink-600);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 650;
    min-height: 40px;
    padding: 0.45rem 0.8rem;
    white-space: nowrap;
}

.segmented-control button:hover {
    color: var(--ink-950);
}

.segmented-control button.active {
    background: var(--surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
    color: var(--brand-800);
}

.status-pill {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.875rem;
    font-weight: 750;
    gap: 0.35rem;
    line-height: 1;
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
}

.status-scheduled {
    background: var(--blue-50);
    color: var(--blue-600);
}

.status-completed,
.status-secure {
    background: var(--green-50);
    color: var(--green-700);
}

.status-cancelled {
    background: var(--red-50);
    color: var(--red-700);
}

.empty-state {
    color: var(--ink-500);
    padding: 3rem 1.5rem;
    text-align: center;
}

.field-label {
    color: var(--ink-700);
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.field-input {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-950);
    min-height: 44px;
    padding: 0.7rem 0.8rem;
    transition: border-color 140ms ease, box-shadow 140ms ease;
    width: 100%;
}

.field-input:focus {
    border-color: var(--brand-600);
    box-shadow: 0 0 0 3px rgba(8, 166, 200, 0.12);
    outline: none;
}

.field-input:disabled {
    background: var(--surface-tint);
    color: var(--ink-500);
}

.sr-only {
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.auth-flow-page {
    align-items: flex-start;
    background:
        radial-gradient(circle at 15% 0%, var(--brand-50), transparent 30%),
        var(--canvas);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 6.5rem 1rem 3rem;
    position: relative;
}

.auth-flow-brand {
    align-items: center;
    color: var(--ink-950);
    display: flex;
    font-size: 1.05rem;
    font-weight: 800;
    gap: 0.6rem;
    inset-inline-start: clamp(1rem, 4vw, 4rem);
    position: absolute;
    text-decoration: none;
    top: 1.5rem;
}

.auth-flow-brand > span:last-child span {
    color: var(--brand-600);
}

.auth-flow-brand-mark {
    align-items: center;
    background: linear-gradient(145deg, #22d3ee, #0891b2);
    border-radius: 10px;
    color: #fff;
    display: inline-flex;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.auth-flow-card {
    max-width: 620px;
    padding: clamp(1.25rem, 4vw, 2rem);
    width: 100%;
}

.auth-flow-card .secure-label {
    align-items: center;
    color: var(--green-700);
    display: flex;
    font-size: 0.72rem;
    font-weight: 750;
    gap: 0.45rem;
    letter-spacing: 0.04em;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.auth-flow-card h1 {
    color: var(--ink-950);
    font-size: clamp(1.65rem, 4vw, 2.1rem);
    letter-spacing: -0.035em;
    margin-bottom: 0.5rem;
}

.auth-flow-subtitle {
    color: var(--ink-600);
    line-height: 1.55;
    margin-bottom: 1.5rem;
}

.auth-flow-form {
    display: grid;
    gap: 1rem;
}

.auth-provider-grid {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.auth-provider-grid button {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--ink-700);
    cursor: pointer;
    display: flex;
    font-size: 0.75rem;
    font-weight: 700;
    gap: 0.4rem;
    justify-content: center;
    min-height: 44px;
}

.auth-provider-grid button:hover {
    background: var(--surface-muted);
    border-color: var(--ink-400);
}

.auth-provider-grid button > span {
    align-items: center;
    background: var(--surface-tint);
    border-radius: 50%;
    display: inline-flex;
    font-size: 0.68rem;
    height: 22px;
    justify-content: center;
    width: 22px;
}

.auth-flow-divider {
    align-items: center;
    color: var(--ink-500);
    display: flex;
    font-size: 0.7rem;
    gap: 0.7rem;
    margin: 1.25rem 0;
}

.auth-flow-divider::before,
.auth-flow-divider::after {
    background: var(--line);
    content: "";
    flex: 1;
    height: 1px;
}

.auth-flow-divider span {
    white-space: nowrap;
}

.auth-flow-form .form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.auth-flow-form .form-group {
    display: grid;
}

.auth-flow-form .form-group small,
.password-guidance {
    color: var(--ink-500);
    font-size: 0.75rem;
    line-height: 1.4;
    margin-top: 0.35rem;
}

.auth-checkbox {
    align-items: flex-start;
    color: var(--ink-700);
    display: flex;
    font-size: 0.82rem;
    gap: 0.6rem;
    line-height: 1.45;
}

.auth-checkbox input {
    height: 18px;
    margin-top: 0.1rem;
    width: 18px;
}

.auth-flow-status {
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.45;
    padding: 0.7rem 0.8rem;
}

.auth-flow-status.error {
    background: var(--red-50);
    color: var(--red-700);
}

.auth-flow-status.success {
    background: var(--green-50);
    color: var(--green-700);
}

.auth-flow-submit {
    width: 100%;
}

.auth-flow-footer {
    color: var(--ink-600);
    font-size: 0.82rem;
    margin: 1.25rem 0 0;
    text-align: center;
}

.auth-flow-footer a {
    font-weight: 750;
    text-decoration: none;
}

.auth-text-action {
    background: transparent;
    border: 0;
    color: var(--brand-700);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    justify-self: center;
}

.auth-success-panel {
    align-items: center;
    display: flex;
    flex-direction: column;
    padding: 1rem 0;
    text-align: center;
}

.auth-success-panel > span {
    align-items: center;
    background: var(--green-50);
    border-radius: 50%;
    color: var(--green-700);
    display: inline-flex;
    height: 54px;
    justify-content: center;
    width: 54px;
}

.auth-success-panel h2 {
    margin: 1rem 0 0.35rem;
}

.auth-success-panel p {
    color: var(--ink-600);
    margin-bottom: 1.25rem;
}

@media (max-width: 600px) {
    .auth-flow-page {
        padding-top: 5.5rem;
    }

    .auth-flow-card {
        padding: 1.25rem;
    }

    .auth-flow-form .form-grid {
        grid-template-columns: 1fr;
    }

    .auth-provider-grid {
        grid-template-columns: 1fr;
    }
}

.valid.modified:not([type=checkbox]) {
    border-color: var(--green-700);
}

.invalid {
    border-color: var(--red-700);
}

.validation-message {
    color: var(--red-700);
    font-size: 0.875rem;
}

.page-state {
    align-items: center;
    color: var(--ink-600);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    justify-content: center;
    min-height: 260px;
    padding: 2rem;
    text-align: center;
}

.page-state h2 {
    color: var(--ink-950);
    font-size: 1.125rem;
    margin: 0;
}

.page-state p {
    line-height: 1.5;
    margin: 0;
    max-width: 34rem;
}

.loading-indicator {
    animation: spin 0.8s linear infinite;
    border: 3px solid var(--brand-100);
    border-radius: 50%;
    border-top-color: var(--brand-700);
    height: 2rem;
    width: 2rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

html[dir="rtl"] .icon-chevron {
    transform: rotate(180deg);
}

html.theme-g90 .login-page,
html.theme-g90 .login-panel,
html.theme-g100 .login-page,
html.theme-g100 .login-panel {
    background: var(--canvas);
}

html.theme-g90 .appointment-summary,
html.theme-g100 .appointment-summary {
    background: linear-gradient(110deg, var(--surface) 55%, var(--brand-50));
}

html.theme-g90 .record-list-header,
html.theme-g90 .form-footer,
html.theme-g100 .record-list-header,
html.theme-g100 .form-footer {
    background: var(--surface-muted);
}

html.theme-g90 .record-row:hover,
html.theme-g90 .message-row:hover,
html.theme-g100 .record-row:hover,
html.theme-g100 .message-row:hover {
    background: var(--surface-hover);
}

html.theme-g90 .message-row.unread,
html.theme-g100 .message-row.unread {
    background: linear-gradient(90deg, var(--brand-50), var(--surface) 50%);
}

html[dir="rtl"] .message-row.unread {
    background: linear-gradient(270deg, var(--brand-50), var(--surface) 45%);
}

html[dir="rtl"].theme-g90 .message-row.unread,
html[dir="rtl"].theme-g100 .message-row.unread {
    background: linear-gradient(270deg, var(--brand-50), var(--surface) 50%);
}

html.theme-g90 .notification-dot,
html.theme-g100 .notification-dot {
    border-color: var(--surface);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

html.theme-g90 .date-tile,
html.theme-g90 .appointment-date,
html.theme-g100 .date-tile,
html.theme-g100 .appointment-date {
    border-color: var(--cds-border-strong-01);
}

@media (max-width: 700px) {
    .page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
    }

    .page-header > .button {
        width: 100%;
    }
}

@media (max-width: 600px) {
    body.keyboard-open .sidebar {
        display: none;
    }

    body.keyboard-open .content {
        padding-block-end: var(--sp-6);
    }
}

:where(
    button,
    .button,
    [role="button"],
    input:not([type="checkbox"]):not([type="radio"]),
    select,
    textarea) {
    min-height: var(--touch-target);
}

:where(button, .button, [role="button"]) {
    touch-action: manipulation;
}

:where(small, .metadata, .page-eyebrow, .field-hint) {
    font-size: var(--text-sm);
}

@media (hover: none) and (pointer: coarse) {
    :where(a, button, .button, [role="button"]):active {
        filter: brightness(0.96);
    }
}

/* ── Shared component kit ──────────────────────────────────────────────── */

.app-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.app-empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 3rem;
    block-size: 3rem;
    border-radius: var(--radius-lg);
    background: var(--surface-muted);
    color: var(--brand-600);
}

.app-empty-state h3 {
    margin: 0;
    color: var(--text-strong);
}

.app-empty-state p {
    margin: 0;
    max-inline-size: 42ch;
}

/* Skeletons keep the page's shape while data loads. */
.app-skeleton {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.app-skeleton-shape {
    display: block;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg,
            var(--surface-muted) 25%,
            var(--line-soft) 37%,
            var(--surface-muted) 63%);
    background-size: 400% 100%;
    animation: app-skeleton-sheen 1.4s ease infinite;
}

.app-skeleton-text .app-skeleton-shape { block-size: 0.9rem; }
.app-skeleton-text .app-skeleton-shape:last-child { inline-size: 60%; }
.app-skeleton-row .app-skeleton-shape { block-size: 3.25rem; border-radius: var(--radius-md); }
.app-skeleton-card .app-skeleton-shape { block-size: 9rem; border-radius: var(--radius-lg); }

@keyframes app-skeleton-sheen {
    from { background-position: 100% 50%; }
    to { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .app-skeleton-shape {
        animation: none;
        background: var(--surface-muted);
    }
}

/* Toasts confirm a completed action; they never carry information the patient must act on. */
.app-toast-host {
    position: fixed;
    inset-block-end: calc(var(--nav-bar-height, 0px) + 1rem);
    inset-inline: 1rem;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.app-toast {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-inline: auto;
    inline-size: min(30rem, 100%);
    padding: 0.75rem 1rem;
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    pointer-events: auto;
}

.app-toast span { flex: 1; }
.app-toast-success { border-inline-start: 3px solid var(--success, #24a148); }
.app-toast-warning { border-inline-start: 3px solid var(--warning, #f1c21b); }
.app-toast-error { border-inline-start: 3px solid var(--danger, #da1e28); }

.app-toast-dismiss {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

/* Modal for flows needing content and a choice; plain confirms use the native dialog. */
.app-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgb(0 0 0 / 45%);
}

.app-modal {
    display: flex;
    flex-direction: column;
    inline-size: min(34rem, 100%);
    max-block-size: min(85vh, 44rem);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.app-modal-header,
.app-modal-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
}

.app-modal-header { border-block-end: 1px solid var(--line-soft); }
.app-modal-header h2 { flex: 1; margin: 0; font-size: 1.125rem; }
.app-modal-footer { justify-content: flex-end; border-block-start: 1px solid var(--line-soft); }

.app-modal-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transform: rotate(90deg);
}

.app-modal-body {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
}

.app-form-field .field-required { color: var(--danger, #da1e28); margin-inline-start: 0.125rem; }
.app-form-field .field-hint { display: block; margin-block-start: 0.25rem; color: var(--text-muted); }
.app-form-field .field-error { margin-block-start: 0.25rem; }
.app-form-field .validation-message { color: var(--danger, #da1e28); font-size: var(--text-sm); }
.app-form-field .field-input.invalid { border-color: var(--danger, #da1e28); }

/* ── Arabic typography and direction ───────────────────────────────────── */

/* Arabic script needs a face with proper letterforms and joining; Inter has none.
   The stack falls back to whatever the platform ships, so no font is downloaded. */
html[lang="ar"],
html[lang="ar"] body {
    font-family: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI",
        "Geeza Pro", "Droid Arabic Naskh", Tahoma, sans-serif;
    /* Arabic glyphs sit taller than Latin at the same size, so the line box grows. */
    line-height: 1.7;
}

/* Numerals stay Western so clinical values, tokens, and doses read the same in
   both languages and match printed clinic documents. */
html[lang="ar"] :where(time, .metadata, .status-pill, .nav-badge, .queue-token, .field-input) {
    font-variant-numeric: lining-nums tabular-nums;
}

/* Glyphs that point along the reading direction must follow it. */
html[dir="rtl"] :where(.icon-chevron, .icon-download) {
    transform: scaleX(-1);
}

html[dir="rtl"] .app-toast-dismiss,
html[dir="rtl"] .app-modal-close {
    transform: rotate(-90deg);
}

.stale-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--line-soft);
    border-inline-start: 3px solid var(--warning, #f1c21b);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-muted);
    font-size: var(--text-sm);
}
