/* Global layout rules of the staff app (design 02 §3.1): the page never scrolls; only ScrollRegion (lists, tables, trees) scrolls.
   Colours come from the MudBlazor theme (design 02 §2). */
html, body { height: 100%; margin: 0; overflow: clip; background: #F7F9FC; }

#app-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100dvh;
    font-family: Roboto, "Segoe UI", sans-serif; color: #52606D; gap: 12px; }
#app-loading .app-loading-bar { width: 240px; height: 4px; border-radius: 2px;
    background: linear-gradient(90deg, #1565c0 0%, #90caf9 50%, #1565c0 100%); background-size: 200% 100%;
    animation: app-loading-move 1.2s linear infinite; }
@keyframes app-loading-move { from { background-position: 0 0; } to { background-position: -200% 0; } }
body:has(.mud-layout) #app-loading { display: none; }
.blazor-error-boundary { padding: 1rem; color: #b71c1c; }

/* Shell: app bar 48 px; the main area is exactly the rest of the viewport and clips. */
.mindos-activity, .mindos-layout { height: 100dvh; overflow: clip; }
.mindos-main-content { height: 100dvh; overflow: clip; display: flex; flex-direction: column; }
.mindos-main { flex: 1 1 auto; min-height: 0; overflow: clip; display: flex; flex-direction: column; padding: 8px 12px; box-sizing: border-box; }
.mindos-drawer .mud-navmenu .mud-nav-link { padding-top: 6px; padding-bottom: 6px; }

/* Page frame (PageShell): fixed header, body fills the rest, optional fixed footer. */
.mindos-page { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.mindos-page-header { flex: 0 0 auto; }
/* Right end of the title row (patient header + help, design 03 §2.4): takes what the title leaves, wraps to the right. */
.mindos-page-header-end { flex: 0 1 auto; min-width: 0; justify-content: flex-end; }
.mindos-page-header-end .mindos-patient-header { justify-content: flex-end; row-gap: 2px; }
.mindos-page-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: clip; }
.mindos-page-footer { flex: 0 0 auto; display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; border-top: 1px solid var(--mud-palette-divider); }

/* The only scrolling element: lists, tables, trees. */
.mindos-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; }
.mindos-min0 { min-height: 0; min-width: 0; }
.mindos-fill-grid { flex: 1 1 auto; min-height: 0; }
.mindos-fill-grid > .mud-grid-item { max-height: 100%; }

/* Tables: 13 px (design 02 §2.3), sticky header inside ScrollRegion. */
.mud-table-dense .mud-table-cell, .mud-simple-table.mud-table-dense td, .mud-simple-table.mud-table-dense th { font-size: 0.8125rem; }
.mindos-scroll .mud-simple-table thead th { position: sticky; top: 0; background: var(--mud-palette-surface); z-index: 1; }

/* Sign-in page. */
.mindos-login { height: 100dvh; display: flex; align-items: center; justify-content: center; }
.mindos-login-card { width: 380px; max-width: calc(100vw - 32px); }

/* Utilities. */
.mindos-mono { font-family: "Roboto Mono", Consolas, monospace; letter-spacing: 0.05em; }
.mindos-num { text-align: right; font-variant-numeric: tabular-nums; }
.mindos-ellipsis { display: inline-block; max-width: 32ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.mindos-clickable { cursor: pointer; }
.mindos-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 12px; } .mindos-dot.on { background: #A5D6A7; } .mindos-dot.off { background: #B0BEC5; }
.mindos-fill-row { flex: 1 1 auto; min-height: 0; } .mindos-row-selected td { background: #E3F2FD; }
.mindos-scroll:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: -2px; }
/* MudTabs that fill the page body: the tab bar stays, the active panel takes the rest (design 02 §3.1). */
/* A disabled tab (e.g. the regimen before a primary diagnosis) stays readable: MudBlazor's faded text fails WCAG AA contrast. */
.mud-tab.mud-disabled { color: #5f6368; }
/* A chosen answer in a toggle group is filled, so it is clearly picked (suggested questions, design 03 §2.4). */
.mud-toggle-item.mindos-toggle-selected { background-color: var(--mud-palette-primary) !important; color: var(--mud-palette-primary-text) !important; }
.mindos-tabs-fill { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mindos-tabs-fill .mindos-tabs-panels { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.mindos-tabs-fill .mindos-tabs-panels > div { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding-top: 8px; }
/* Read-only fields (design 02 §4): page background, no input border. Locked data (R11) adds a lock after the label (dense wrappers, Locked). */
.mindos-readonly .mud-input.mud-input-outlined, .mindos-readonly.mud-input.mud-input-outlined { background-color: var(--mud-palette-background); }
.mindos-readonly .mud-input-outlined-border { border-color: transparent !important; }
.mindos-locked .mud-input-label::after { content: ""; display: inline-block; width: .9em; height: .9em; margin-left: 4px; vertical-align: -0.1em;
  background-color: currentColor; -webkit-mask: var(--mindos-lock-icon) center / contain no-repeat; mask: var(--mindos-lock-icon) center / contain no-repeat; }
:root { --mindos-lock-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z'/%3E%3C/svg%3E"); }
/* Forms (design 30 §5): "Cần bổ sung" links, spinner of a busy button, action with its missing conditions. */
.mindos-summary-link { min-width: 0; padding: 0 4px; text-transform: none; text-decoration: underline; }
.mindos-busy-spinner { width: 14px !important; height: 14px !important; margin-right: 6px; }
.mindos-action { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.mindos-action-popover { max-width: 420px; }
/* Inputs never stretch vertically inside flex columns (only ScrollRegion grows). */
.mindos-page-body .mud-input-control { flex-grow: 0; }
/* Inline editors inside table cells: compact height so rows stay ~32 px (design 02 §3.1 density). */
.mud-simple-table td { padding-top: 2px; padding-bottom: 2px; }
.mud-simple-table td .mud-input-control { margin: 0; }
.mud-simple-table td .mud-input.mud-input-outlined input,
.mud-simple-table td .mud-input.mud-input-outlined .mud-select-input { padding-top: 5px; padding-bottom: 5px; font-size: .8125rem; }
.mud-simple-table td .mud-switch { margin: 0; }
/* Role × permission matrix: first column and header stay visible while scrolling. */
.mindos-matrix thead th { position: sticky; top: 0; z-index: 2; background: var(--mud-palette-surface); vertical-align: bottom; }
.mindos-matrix .mindos-matrix-first { position: sticky; left: 0; z-index: 1; background: var(--mud-palette-surface); min-width: 300px; max-width: 360px; }
.mindos-matrix thead th.mindos-matrix-first { z-index: 3; }
.mindos-matrix .mindos-matrix-col { min-width: 92px; text-align: center; font-size: .75rem; }
.mindos-matrix .mindos-matrix-group { background: var(--mud-palette-background); font-weight: 500; position: sticky; left: 0; }
h1:focus { outline: none; }
.mindos-unread { background: #E3F2FD; }


/* Work schedule grid (US-07.01): three compact shift buttons per day cell. */
.mindos-ws-grid table { table-layout: fixed; }
.mindos-ws-grid td { vertical-align: top; }
.mindos-ws-chip { overflow: hidden; text-overflow: ellipsis; }
.mindos-ws-chip { display: block; width: 100%; margin: 1px 0; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--mud-palette-lines-default);
  background: transparent; color: var(--mud-palette-text-primary); font: inherit; font-size: .75rem; text-align: left; cursor: pointer; white-space: nowrap; }
.mindos-ws-chip.empty { color: var(--mud-palette-text-secondary); border-style: dashed; }
.mindos-ws-chip.working { background: color-mix(in srgb, var(--mud-palette-success) 12%, transparent); border-color: var(--mud-palette-success); }
.mindos-ws-chip.off { background: var(--mud-palette-action-disabled-background); }
.mindos-ws-chip.selected { outline: 2px solid var(--mud-palette-primary); }
.mindos-ws-chip:focus-visible { outline: 2px solid var(--mud-palette-primary); }

/* Visit timeline (docs/10 §3 item 2). */
/* Visit timeline: one line (owner 2026-11-26). Steps shrink (name ends in "…", full name in the tooltip) except the current and the selected one. */
.mindos-timeline { gap: 2px; flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow: hidden; }
.mindos-step { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border-radius: 12px; border: 1px solid var(--mud-palette-lines-default);
  background: transparent; color: var(--mud-palette-text-primary); font: inherit; font-size: .8125rem; cursor: pointer; white-space: nowrap;
  flex: 0 1 auto; min-width: 3.25em; overflow: hidden; }
.mindos-step.current, .mindos-step.selected { flex-shrink: 0; }
.mindos-step-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mindos-step-icon { flex-shrink: 0; }
.mindos-step small { color: var(--mud-palette-text-secondary); font-size: .75rem; flex-shrink: 0; }
/* Narrow screens: a finished step's time is in its tooltip, so the line keeps the names. */
@media (max-width: 1599px) { .mindos-step.done:not(.selected) small { display: none; } }
.mindos-step.done .mindos-step-icon { color: var(--mud-palette-success); }
.mindos-step.current { border-color: var(--mud-palette-primary); font-weight: 600; }
.mindos-step.cancelled { border-color: var(--mud-palette-error); }
.mindos-step.upcoming { color: var(--mud-palette-text-secondary); cursor: default; border-style: dashed; }
.mindos-step.selected { background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); }
.mindos-step-sep { color: var(--mud-palette-text-secondary); flex-shrink: 0; }
.mindos-vitals-form .mud-input-control { max-width: 110px; }

/* Answer options of an assessment (US-11.04): compact radio buttons. */
.mindos-opt { padding: 2px 8px; border-radius: 12px; border: 1px solid var(--mud-palette-lines-default); background: transparent; font: inherit; font-size: .8125rem;
  color: var(--mud-palette-text-primary); cursor: pointer; text-align: left; }
.mindos-opt.chosen { background: var(--mud-palette-primary); border-color: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.mindos-opt:focus-visible { outline: 2px solid var(--mud-palette-primary); outline-offset: 1px; }
.mindos-dialog-scroll { max-height: 70vh; overflow: auto; }

/* Kiosk tablet (design 03 §3): large type, one question per screen. */
.mindos-kiosk { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--mud-palette-background); }
.mindos-kiosk-card { width: min(760px, 100%); }
.mindos-kiosk-input input { font-size: 2rem; letter-spacing: .4em; text-align: center; }
.mindos-kiosk-opt { padding: 16px 20px; border-radius: 8px; border: 2px solid var(--mud-palette-lines-default); background: transparent; font: inherit; font-size: 1.25rem;
  color: var(--mud-palette-text-primary); text-align: left; cursor: pointer; }
.mindos-kiosk-opt.chosen { border-color: var(--mud-palette-primary); background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent); }
.mindos-kiosk-opt:focus-visible { outline: 3px solid var(--mud-palette-primary); outline-offset: 2px; }

/* Exam step (Đợt 3): record rows coloured by label (display only, Q-RS27); narrative in two columns. */
.mindos-sev-warning td:first-child { box-shadow: inset 4px 0 0 var(--mud-palette-warning); }
.mindos-sev-danger td:first-child { box-shadow: inset 4px 0 0 var(--mud-palette-error); }
.mindos-narrative-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; align-content: start; }
.mindos-help-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 1px solid var(--mud-palette-lines-default); border-radius: 4px; background: #fff; }
/* Inventory (Đợt 4): two-column side forms, inactive rows, document line editor. */
.mindos-form-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.mindos-muted td { opacity: .55; }
.mindos-line-table td { vertical-align: top; }
/* Prescription lines (design 04 PrescriptionEditor, 2026-10-30): fixed widths for numbers, the drug column takes the rest; the full drug name wraps. */
.mindos-rx-lines table { table-layout: fixed; width: 100%; }
.mindos-rx-lines td, .mindos-rx-lines th { padding-left: 4px; padding-right: 4px; }
.mindos-rx-drug-full { white-space: normal; overflow-wrap: anywhere; font-size: .8125rem; line-height: 1.3; margin-top: 2px; }
.mindos-rx-drug-meta { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: .75rem; color: var(--mud-palette-text-secondary); }
.mindos-rx-lines .mindos-num input { text-align: right; padding-left: 6px; padding-right: 8px; }
.mindos-assist-rail { flex: 0 0 auto; writing-mode: vertical-rl; }
.mindos-tag { display: inline-block; border: 1px solid currentColor; border-radius: 10px; padding: 0 6px; font-size: .75rem; line-height: 1.4; margin-right: 2px; white-space: nowrap; }
.mindos-nowrap td, .mindos-nowrap th { white-space: nowrap; }
.mindos-scroll .mud-table-container { overflow: visible; }
/* Prescribing safety alerts (SafetyAlertList). */
.mindos-alert { border-left: 4px solid var(--mud-palette-info); background: var(--mud-palette-background-gray); padding: 4px 8px; border-radius: 4px; font-size: .8125rem; }
.mindos-alert-warning { border-left-color: var(--mud-palette-warning); }
.mindos-alert-critical { border-left-color: var(--mud-palette-error); }
.mindos-form-4col { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 12px; align-items: end; }
/* Exam sheet of form 07/BV1 (design 29 §6): columns instead of page scroll (design 02 §3.1). */
.mindos-sheet-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; align-content: start; min-height: 0; }
/* A sheet grid that fills its tab panel: one row as tall as the panel, each column scrolls on its own if it must. */
.mindos-sheet-fill { flex: 1 1 auto; grid-template-rows: minmax(0, 1fr); align-content: stretch; }
.mindos-sheet-fill > div { min-height: 0; overflow-y: auto; }
/* Organ fields of the exam sheet: 2 columns × 3 rows sharing the free height of the tab (each row at least 3 lines). */
.mindos-organ-grid { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, minmax(96px, 1fr)); gap: 8px 12px; }
/* A multiline field that shares the free height of its flex column with its siblings (equal parts, at least 3 lines). */
/* Doubled class: MudBlazor's .mud-input-control rules set flex-grow 0 with the same specificity. */
.mud-input-control.mindos-fill-text { flex: 1 1 0; min-height: 96px; display: flex; flex-direction: column; }
.mud-input-control.mindos-fill-text .mud-input-control-input-container, .mud-input-control.mindos-fill-text .mud-input { flex: 1 1 auto; min-height: 0; display: flex; align-items: stretch; }
.mud-input-control.mindos-fill-text textarea { flex: 1 1 auto; height: auto !important; min-height: 0; resize: none; }
.mindos-sheet-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 12px; align-content: start; min-height: 0; }
.mindos-sheet-neuro-mental { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 12px; align-content: start; min-height: 0; }
