/* =====================================================================
   IVR Hospital shared theme layer.
   Colours, radius and font come from FitnessAdvisor (app.css tokens).
   MudBlazor draws the components; this file only adds:
   - CSS variables (keep in sync with Theme/HsThemes.cs)
   - data-theme / data-font / data-nav / data-view hooks set by hs-ui.js
   - brand header, bottom nav, page header, stat cards, boot splash, print rules
   ===================================================================== */

:root, html[data-theme="green"] {
    --hs-primary: #1E8E4F;
    --hs-primary-dark: #15693b;
    --hs-primary-soft: rgba(30, 142, 79, 0.12);
    --hs-error: #E5484D;
    --hs-warning: #F59E0B;
    --hs-bg: #F6F8F7;
    --hs-card: #FFFFFF;
    --hs-text: #1F2937;
    --hs-muted: #6B7280;
    --hs-line: #E5E7EB;
    --hs-shadow: 0 10px 22px rgba(16, 24, 40, 0.08);
    --hs-radius: 12px;
}

html[data-theme="blue"] {
    --hs-primary: #2563EB;
    --hs-primary-dark: #1E40AF;
    --hs-primary-soft: rgba(37, 99, 235, 0.12);
    --hs-bg: #F5F7FB;
    --hs-text: #0F172A;
    --hs-muted: #64748B;
    --hs-line: #E2E8F0;
    --hs-shadow: 0 10px 22px rgba(37, 99, 235, 0.08);
}

html[data-theme="purple"] {
    --hs-primary: #7C3AED;
    --hs-primary-dark: #5B21B6;
    --hs-primary-soft: rgba(124, 58, 237, 0.12);
    --hs-bg: #F8F6FC;
    --hs-text: #1F1B2E;
    --hs-muted: #6B6481;
    --hs-line: #E8E4F2;
    --hs-shadow: 0 10px 22px rgba(124, 58, 237, 0.08);
}

html[data-theme="dark"] {
    --hs-primary: #34D399;
    --hs-primary-dark: #10B981;
    --hs-primary-soft: rgba(52, 211, 153, 0.14);
    --hs-error: #F87171;
    --hs-warning: #FBBF24;
    --hs-bg: #0F172A;
    --hs-card: #1E293B;
    --hs-text: #F1F5F9;
    --hs-muted: #94A3B8;
    --hs-line: #334155;
    --hs-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

/* Text size: everything is rem-based, so changing the root size scales the app. */
html { font-size: 16px; }
html[data-font="small"] { font-size: 14px; }
html[data-font="large"] { font-size: 18px; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--hs-bg);
    color: var(--hs-text);
    font-family: Inter, "Noto Sans Tamil", "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Tamil text needs a little more line height. */
html[lang="ta"] body { line-height: 1.6; }

/* ---------- App bar / brand (FA .top-header + .brand-badge) ---------- */
.hs-appbar {
    border-bottom: 1px solid var(--hs-line);
}

.hs-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
    min-width: 0;
}

.hs-brand-badge {
    width: 2.6rem;
    height: 2.6rem;
    flex-shrink: 0;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    background: var(--hs-primary);
    color: #FFFFFF;
    font-weight: 800;
    letter-spacing: 0.02em;
    box-shadow: var(--hs-shadow);
}

html[data-theme="dark"] .hs-brand-badge { color: #0F172A; }

/* Company logo in place of the letter badge (Company page → App name and logo). White tile so dark logos read in dark mode too. */
.hs-brand-logo-wrap { display: contents; }

.hs-brand-logo {
    height: 2.6rem;
    max-width: 7rem;
    flex-shrink: 0;
    object-fit: contain;
    border-radius: 0.6rem;
    background: #FFFFFF;
    padding: 0.15rem;
    box-shadow: var(--hs-shadow);
}

.hs-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}

.hs-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--hs-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hs-brand-name {
    font-size: 1.05rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Content width (FA mobile shell 430px / desktop full width) ---------- */
.hs-content {
    margin: 0 auto;
    padding: 1rem 1.25rem 2rem;
    max-width: none; /* desktop: use the whole width (no empty strips with the ribbon or a hidden side menu) */
}

html[data-view="mobile"] .hs-content { max-width: 520px; }

/* Wide tables (voucher lines, reports) scroll inside their card, never the whole page. */
.hs-scroll-x { overflow-x: auto; max-width: 100%; }
.hs-scroll-x > .mud-table, .hs-scroll-x > .mud-simple-table { min-width: 720px; }

/* Leave room for the fixed bottom nav. */
html[data-nav="bottom"] .hs-content { padding-bottom: 6.5rem; }

/* ---------- Bottom nav (FA .bottom-nav) ---------- */
.hs-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    display: flex;
    justify-content: center;
    padding: 0.4rem 0.75rem calc(0.4rem + env(safe-area-inset-bottom));
    background: var(--hs-card);
    border-top: 1px solid var(--hs-line);
    box-shadow: 0 -6px 18px rgba(16, 24, 40, 0.06);
}

.hs-bottom-nav-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: 100%;
    max-width: 520px;
    gap: 0.25rem;
}

.hs-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-height: 3.2rem;            /* touch target >= 44px */
    border-radius: 0.8rem;
    color: var(--hs-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    line-height: 1.1;
}

.hs-bottom-nav a.active {
    color: var(--hs-primary);
    background: var(--hs-primary-soft);
}

/* ---------- Page header (FA .page-header + .section-label) ---------- */
.hs-page-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hs-page-header-text { flex: 1; min-width: 0; }

.hs-page-header h1 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.2;
}

.hs-section-label {
    margin: 0 0 0.15rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--hs-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

html[data-theme="dark"] .hs-section-label { color: var(--hs-primary); }

/* Fields in a wrapping row keep a usable width and move to the next line instead of being squeezed.
   Date pickers need extra room for the calendar and clear icons. */
/* Each field gets an equal share of the row (at least 200px, so labels never run into the
   spin / calendar icons); fixed narrow widths set on single pages are overridden. */
.d-flex.flex-wrap > .mud-input-control,
.d-flex.flex-wrap > .mud-select,
.d-flex.flex-wrap > .mud-picker,
.d-flex.flex-wrap > .mud-autocomplete {
    flex: 1 1 200px;
    min-width: 200px;
    max-width: 100% !important;
}
/* MudBlazor puts a field's Style on the inner .mud-input box, so lift the cap there too. */
.d-flex.flex-wrap > .mud-input-control .mud-input,
.d-flex.flex-wrap > .mud-select .mud-input,
.d-flex.flex-wrap > .mud-select .mud-input-control,
.d-flex.flex-wrap > .mud-autocomplete .mud-input-control,
.d-flex.flex-wrap > .mud-picker .mud-input-control,
.d-flex.flex-wrap > .mud-picker .mud-input,
.d-flex.flex-wrap > .mud-autocomplete .mud-input { max-width: 100% !important; }
/* Any date field (also outside wrapping rows, e.g. the dashboards): always room for "dd-MM-yyyy" plus the calendar icon,
   whatever narrower width a page sets (min-width wins over max-width). */
.mud-picker .mud-input-control,
.mud-picker .mud-input { min-width: 180px; }
/* MudBlazor also copies a date picker's Style onto its calendar popup; never let a field width cut the calendar. */
.mud-picker-popover-paper { max-width: none !important; }
@media (max-width: 599.98px) {
    .d-flex.flex-wrap > .mud-input-control,
    .d-flex.flex-wrap > .mud-select,
    .d-flex.flex-wrap > .mud-picker,
    .d-flex.flex-wrap > .mud-autocomplete { flex-basis: 100%; min-width: 0; }
}

.hs-page-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- Cards (FA .content-card / .summary-card) ---------- */
.hs-card {
    border-radius: var(--hs-radius) !important;
    box-shadow: var(--hs-shadow) !important;
}

.hs-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

html[data-view="desktop"] .hs-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.hs-stat-card {
    padding: 0.9rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
    border-left: 4px solid var(--hs-stat-accent, var(--hs-primary));
}

.hs-stat-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--hs-muted);
}

.hs-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.hs-stat-hint { font-size: 0.75rem; color: var(--hs-muted); }

.hs-accent-primary { --hs-stat-accent: var(--hs-primary); }
.hs-accent-success { --hs-stat-accent: #1E8E4F; }
.hs-accent-warning { --hs-stat-accent: var(--hs-warning); }
.hs-accent-error   { --hs-stat-accent: var(--hs-error); }
.hs-accent-info    { --hs-stat-accent: #2563EB; }

/* ---------- Empty / loading / note ---------- */
.hs-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    padding: 2rem 1rem;
    color: var(--hs-muted);
}

.hs-empty-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    display: grid;
    place-items: center;
    background: var(--hs-primary-soft);
    color: var(--hs-primary);
    margin-bottom: 0.25rem;
}

.hs-empty strong { color: var(--hs-text); font-size: 1rem; }

.hs-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
    color: var(--hs-muted);
}

.hs-note {
    font-size: 0.78rem;
    color: var(--hs-muted);
    margin: 0.25rem 0 1rem;
}

/* ---------- Money ---------- */
.hs-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.hs-money-negative { color: var(--hs-error); }

/* ---------- Settings list (FA .settings-row) ---------- */
.hs-settings-title {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--hs-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.hs-settings-list {
    background: var(--hs-card);
    border-radius: var(--hs-radius);
    box-shadow: var(--hs-shadow);
    overflow: hidden;
}

.hs-settings-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    min-height: 3.5rem;
    padding: 0.7rem 1rem;
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--hs-line);
}

.hs-settings-row:last-child { border-bottom: 0; }
.hs-settings-row:hover { background: var(--hs-primary-soft); }

.hs-settings-icon {
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: 0.7rem;
    display: grid;
    place-items: center;
    background: var(--hs-primary-soft);
    color: var(--hs-primary);
}

.hs-settings-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.hs-settings-meta strong { font-weight: 600; }
.hs-settings-meta small { color: var(--hs-muted); }

/* ---------- Appearance page (FA .pref-group + .swatch) ---------- */
.hs-pref-group { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1.4rem; }
.hs-pref-group:last-child { margin-bottom: 0; }
.hs-pref-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--hs-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.hs-pref-hint { font-size: 0.8rem; color: var(--hs-muted); line-height: 1.4; }

.hs-swatch-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
}

.hs-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.6rem 0.25rem;
    border: 2px solid var(--hs-line);
    border-radius: var(--hs-radius);
    background: var(--hs-card);
    color: var(--hs-text);
    cursor: pointer;
    font: inherit;
}

.hs-swatch.active { border-color: var(--hs-primary); }
.hs-swatch-dot { width: 1.8rem; height: 1.8rem; border-radius: 50%; }
.hs-swatch-green  { background: #1E8E4F; }
.hs-swatch-blue   { background: #2563EB; }
.hs-swatch-purple { background: #7C3AED; }
.hs-swatch-dark   { background: linear-gradient(135deg, #0F172A 50%, #34D399 50%); }
.hs-swatch-label  { font-size: 0.75rem; font-weight: 600; }

/* ---------- Sign-in / setup (FA .auth-panel) ---------- */
.hs-auth {
    min-height: calc(100vh - 2rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.hs-auth-panel {
    width: 100%;
    max-width: 440px;
    padding: 1.75rem 1.5rem;
}

.hs-auth-title {
    margin: 0 0 0.25rem;
    font-size: 1.6rem;
    font-weight: 800;
}

.hs-auth-api {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 1.25rem 0 0;
    font-size: 0.75rem;
    color: var(--hs-muted);
    word-break: break-all;
}

.hs-avatar-button {
    margin-left: 0.25rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
    min-width: 44px;               /* touch target */
    min-height: 44px;
    display: inline-grid;
    place-items: center;
}

/* ---------- Offline banner (AgentApp) ---------- */
.hs-offline-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    background: #FEF3C7;
    color: #92400E;
    border-bottom: 1px solid #FCD34D;
}

.hs-offline-banner.hs-online { background: var(--hs-primary-soft); color: var(--hs-primary-dark); border-color: var(--hs-line); }

/* ---------- Boot splash (shown before Blazor loads; FA .boot-splash) ---------- */
.hs-boot {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    background: var(--hs-bg);
    color: var(--hs-text);
}

.hs-boot-badge {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1.4rem;
    display: grid;
    place-items: center;
    background: var(--hs-primary);
    color: #FFFFFF;
    font-size: 1.6rem;
    font-weight: 800;
    box-shadow: var(--hs-shadow);
    animation: hs-pulse 1.4s ease-in-out infinite;
}

.hs-boot-name { margin: 0.4rem 0 0; font-size: 1.3rem; font-weight: 800; }
.hs-boot-tagline { margin: 0; font-size: 0.85rem; color: var(--hs-muted); }

.hs-boot-bar {
    width: 9rem;
    height: 4px;
    margin-top: 0.8rem;
    border-radius: 999px;
    background: var(--hs-line);
    overflow: hidden;
}

.hs-boot-bar::after {
    content: "";
    display: block;
    height: 100%;
    width: var(--blazor-load-percentage, 10%);
    background: var(--hs-primary);
    transition: width 0.1s ease-in-out;
}

@keyframes hs-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* ---------- Blazor error UI ---------- */
#blazor-error-ui {
    color-scheme: light only;
    background: #FEF3C7;
    color: #92400E;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    box-sizing: border-box;
}

#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- Printable documents stay light in dark mode (FA rule) ---------- */
html[data-theme="dark"] .hs-document,
html[data-theme="dark"] .hs-document * {
    color-scheme: light;
    color: #1F2937;
}

html[data-theme="dark"] .hs-document { background: #FFFFFF; }

@media print {
    .hs-appbar, .hs-bottom-nav, .mud-drawer, .hs-no-print { display: none !important; }
    .mud-main-content { padding: 0 !important; margin: 0 !important; }
    .hs-content { max-width: none; padding: 0; }
    body { background: #FFFFFF; color: #000000; }
}

/* ---------- Printed receipts / vouchers (task 2.8) ---------- */
.hs-print-page { background: #FFFFFF; min-height: 100vh; color: #000000; }
.hs-print { margin: 0 auto 2rem; padding: 6mm; color: #000000; background: #FFFFFF; font-family: 'Noto Sans Tamil', Inter, Arial, sans-serif; }
.hs-print table { width: 100%; border-collapse: collapse; }
.hs-print td { padding: 1px 0; vertical-align: top; }
.hs-print-head { text-align: center; border-bottom: 1px solid #000; padding-bottom: 2mm; margin-bottom: 2mm; }
.hs-print-headrow { display: flex; align-items: center; gap: 3mm; }
.hs-print-headrow > .hs-print-head { flex: 1; }
.hs-print-logo { max-height: 18mm; max-width: 30mm; object-fit: contain; }
.hs-print-photo { width: 20mm; height: 24mm; object-fit: cover; border: 1px solid #999; }
.hs-paper-58 .hs-print-photo, .hs-paper-80 .hs-print-photo { display: none; }
.hs-paper-58 .hs-print-logo, .hs-paper-80 .hs-print-logo { max-height: 12mm; max-width: 20mm; }
.hs-print-company { font-size: 1.25em; font-weight: 700; }
.hs-print-title { text-align: center; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 1mm 0 2mm; }
.hs-print-cancelled { text-align: center; font-weight: 800; font-size: 1.4em; border: 2px solid #000; margin: 2mm 0; }
.hs-print-meta td:first-child { width: 35%; color: #333; }
.hs-print-lines { margin-top: 2mm; border-top: 1px dashed #000; }
.hs-print-amt { text-align: right; white-space: nowrap; }
.hs-print-part td { font-size: .9em; color: #333; }
.hs-print-total td { border-top: 1px solid #000; font-weight: 700; padding-top: 1mm; }
.hs-print-words { margin-top: 2mm; font-style: italic; }
.hs-print-foot { margin-top: 4mm; }
.hs-print-sign { margin-top: 10mm; text-align: right; }
.hs-print-sign span { border-top: 1px solid #000; padding-top: 1mm; }
.hs-print-thanks { text-align: center; margin-top: 3mm; }

/* Paper sizes: named pages so each layout prints on its own paper. */
@page hs-a5 { size: A5; margin: 8mm; }
@page hs-a4 { size: A4; margin: 12mm; }
@page hs-80 { size: 80mm auto; margin: 2mm; }
@page hs-58 { size: 58mm auto; margin: 1mm; }
.hs-paper-a5 { page: hs-a5; width: 132mm; font-size: 12px; }
.hs-paper-a4 { page: hs-a4; width: 186mm; font-size: 13px; }
.hs-paper-80 { page: hs-80; width: 72mm; font-size: 11px; padding: 2mm; }
.hs-paper-58 { page: hs-58; width: 48mm; font-size: 9.5px; padding: 1mm; }

@media print {
    .hs-print-page .hs-no-print { display: none !important; }
    .hs-print { margin: 0; }
}

/* ---------- Catalogue reports (task 7.1) ---------- */
.hs-print-only { display: none; }
.hs-report-table td, .hs-report-table th { white-space: nowrap; }
@media print {
    .hs-print-only { display: block; }
    .hs-report .hs-card { box-shadow: none !important; border: 0 !important; }
    .hs-report-table { font-size: 10px; }
    .hs-report-table td, .hs-report-table th { padding: 2px 4px !important; }
}

/* ---- Office-style ribbon (Appearance → Navigation → Ribbon) ---- */

/* ---- HsGrid: list grid with user layout (drag columns, show / hide, sort, filter) ---- */
.hs-grid { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.hs-grid th { text-align: left; font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--mud-palette-lines-default); cursor: pointer; user-select: none; white-space: nowrap; }
.hs-grid th.text-right, .hs-grid td.text-right { text-align: right; }
.hs-grid th:hover { background: var(--mud-palette-action-default-hover); }
.hs-grid th.hs-grid-dropzone { box-shadow: inset 3px 0 0 var(--mud-palette-primary); }
.hs-grid td { padding: 6px 8px; border-bottom: 1px solid var(--mud-palette-lines-default); vertical-align: top; }
.hs-grid tbody tr:nth-child(even) { background: var(--mud-palette-background-gray); }
.hs-grid tbody tr.hs-grid-click { cursor: pointer; }
.hs-grid tbody tr:hover { background: var(--mud-palette-action-default-hover); }
.hs-grid-filter { width: 100%; min-width: 60px; padding: 3px 6px; font: inherit; font-size: 0.8rem; border: 1px solid var(--mud-palette-lines-inputs); border-radius: 4px; background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); }

/* Print template editor: drag sections inside the preview. */
.hs-print-mark { font-weight: 700; border: 1px solid #333; padding: 0 2mm; white-space: nowrap; }
.hs-arrange { position: relative; outline: 1px dashed transparent; outline-offset: 1mm; cursor: grab; }
.hs-arrange:hover { outline-color: #1976d2; }
.hs-arrange-over { box-shadow: inset 0 3px 0 #1976d2; outline-color: #1976d2; }
.hs-arrange-dragging { opacity: .35; }
.hs-arrange-tag { display: none; position: absolute; top: -2.2mm; left: 0; z-index: 2; font: 600 10px/1.4 sans-serif; background: #1976d2; color: #fff; padding: 0 5px; border-radius: 3px; pointer-events: none; }
.hs-arrange:hover .hs-arrange-tag, .hs-arrange-over .hs-arrange-tag { display: inline-block; }
.hs-print-placeholder { border: 1px dashed #999; color: #777; font: 10px/1.2 sans-serif; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1mm; flex-shrink: 0; }

/* ===== Menu (7 Nov 2026): side menu with folding headings, Office-style ribbon with groups, Customize menu editor ===== */
.hs-drawer .mud-drawer-content { background: var(--mud-palette-surface); }
.hs-sidenav { padding: 0.5rem 0.5rem 1rem; display: flex; flex-direction: column; gap: 2px; }
.hs-sidenav-head { width: 100%; display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.65rem; border: 0; border-radius: 10px; background: none; cursor: pointer; font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--mud-palette-text-primary); text-align: left; transition: background .15s; }
.hs-sidenav-head:hover { background: var(--mud-palette-action-default-hover); }
.hs-sidenav-head-icon { color: var(--mud-palette-text-secondary); }
.hs-sidenav-tab.has-active > .hs-sidenav-head, .hs-sidenav-tab.has-active > .hs-sidenav-head .hs-sidenav-head-icon { color: var(--mud-palette-primary); }
.hs-sidenav-head-text { flex: 1; }
.hs-sidenav-chevron { color: var(--mud-palette-text-secondary); transition: transform .2s; transform: rotate(-90deg); }
.hs-sidenav-chevron.open { transform: rotate(0deg); }
.hs-sidenav-body { margin: 0 0 0.4rem 1.05rem; padding-left: 0.55rem; border-left: 1px solid var(--mud-palette-lines-default); }
.hs-sidenav-section { font-size: 0.66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mud-palette-text-secondary); padding: 0.55rem 0.6rem 0.2rem; }
.hs-sidenav-link { display: flex; align-items: center; gap: 0.55rem; padding: 0.38rem 0.6rem; border-radius: 8px; color: var(--mud-palette-text-primary); text-decoration: none; font-size: 0.84rem; transition: background .15s, color .15s; }
.hs-sidenav-link .mud-icon-root { color: var(--mud-palette-text-secondary); font-size: 1.15rem; }
.hs-sidenav-link:hover { background: var(--mud-palette-action-default-hover); }
.hs-sidenav-link.active { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,.12); }
.hs-sidenav-link.active .mud-icon-root { color: var(--mud-palette-primary-text); }
.hs-sidenav-customize { margin-top: 0.75rem; display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.65rem; border: 1px dashed var(--mud-palette-lines-default); border-radius: 10px; background: none; color: var(--mud-palette-text-secondary); font: inherit; font-size: 0.8rem; cursor: pointer; }
.hs-sidenav-customize:hover { color: var(--mud-palette-primary); border-color: var(--mud-palette-primary); }

.hs-ribbon { position: sticky; top: var(--mud-appbar-height); z-index: 5; background: var(--mud-palette-surface); border-bottom: 1px solid var(--mud-palette-lines-default); margin: -0.5rem -0.5rem 0.75rem; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.hs-ribbon-tabs { display: flex; align-items: center; gap: 2px; padding: 0.25rem 0.5rem 0; overflow-x: auto; border-bottom: 1px solid var(--mud-palette-lines-default); }
.hs-ribbon-tab { display: inline-flex; align-items: center; gap: 0.35rem; background: none; border: 0; border-radius: 8px 8px 0 0; padding: 0.45rem 0.9rem; font: inherit; font-size: 0.84rem; color: var(--mud-palette-text-secondary); cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; transition: background .15s, color .15s; }
.hs-ribbon-tab:hover { color: var(--mud-palette-text-primary); background: var(--mud-palette-action-default-hover); }
.hs-ribbon-tab.active { color: var(--mud-palette-primary); border-bottom-color: var(--mud-palette-primary); font-weight: 600; background: var(--mud-palette-background-gray, transparent); }
.hs-ribbon-tool { background: none; border: 0; border-radius: 8px; padding: 0.35rem; color: var(--mud-palette-text-secondary); cursor: pointer; display: inline-flex; }
.hs-ribbon-tool:hover { color: var(--mud-palette-primary); background: var(--mud-palette-action-default-hover); }
.hs-ribbon-body { display: flex; align-items: stretch; padding: 0.35rem 0.5rem 0.25rem; overflow-x: auto; }
.hs-ribbon-group { display: flex; flex-direction: column; padding: 0 0.6rem; border-right: 1px solid var(--mud-palette-lines-default); }
.hs-ribbon-group:last-child { border-right: 0; }
.hs-ribbon-group-buttons { display: flex; gap: 2px; flex: 1; }
.hs-ribbon-group-title { text-align: center; font-size: 0.66rem; letter-spacing: .05em; text-transform: uppercase; color: var(--mud-palette-text-secondary); padding: 0.2rem 0 0.1rem; white-space: nowrap; }
.hs-ribbon-button { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; min-width: 72px; max-width: 92px; padding: 0.4rem 0.35rem; border-radius: 10px; text-decoration: none; color: var(--mud-palette-text-primary); font-size: 0.72rem; line-height: 1.15; text-align: center; transition: background .15s; }
.hs-ribbon-button .mud-icon-root { font-size: 1.65rem; color: var(--mud-palette-primary); }
.hs-ribbon-button:hover { background: var(--mud-palette-action-default-hover); }
.hs-ribbon-button.active { background: var(--mud-palette-primary-hover); box-shadow: inset 0 0 0 1px var(--mud-palette-primary-lighten); font-weight: 600; }

.hs-mc-board { display: flex; gap: 0.75rem; overflow-x: auto; padding-bottom: 0.5rem; align-items: flex-start; }
.hs-mc-tab { flex: 0 0 230px; background: var(--mud-palette-background-gray, rgba(0,0,0,.03)); border: 1px solid var(--mud-palette-lines-default); border-radius: 12px; padding: 0.5rem; transition: box-shadow .15s, border-color .15s; }
.hs-mc-tab-head { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.4rem 0.5rem; cursor: grab; }
.hs-mc-section { background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-default); border-radius: 10px; margin-bottom: 0.5rem; padding: 0.3rem; transition: box-shadow .15s, border-color .15s; }
.hs-mc-section-head { display: flex; align-items: center; gap: 0.3rem; font-size: 0.7rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--mud-palette-text-secondary); padding: 0.2rem 0.25rem 0.35rem; cursor: grab; }
.hs-mc-item { display: flex; align-items: center; gap: 0.45rem; padding: 0.32rem 0.4rem; border-radius: 8px; font-size: 0.8rem; cursor: grab; transition: background .12s; }
.hs-mc-item:hover { background: var(--mud-palette-action-default-hover); }
.hs-mc-item .mud-icon-root { color: var(--mud-palette-primary); }
.hs-mc-item.hidden-item { opacity: .45; text-decoration: line-through; }
.hs-mc-grip { color: var(--mud-palette-text-disabled); }
.hs-mc-eye { background: none; border: 0; padding: 2px; border-radius: 6px; cursor: pointer; color: var(--mud-palette-text-secondary); display: inline-flex; }
.hs-mc-eye:hover { color: var(--mud-palette-primary); }
.hs-mc-empty { font-size: 0.74rem; color: var(--mud-palette-text-disabled); text-align: center; padding: 0.5rem; border: 1px dashed var(--mud-palette-lines-default); border-radius: 8px; }
.hs-mc-add { width: 100%; display: flex; align-items: center; justify-content: center; gap: 0.3rem; background: none; border: 1px dashed var(--mud-palette-lines-default); border-radius: 8px; padding: 0.35rem; font: inherit; font-size: 0.76rem; color: var(--mud-palette-text-secondary); cursor: pointer; }
.hs-mc-add:hover { color: var(--mud-palette-primary); border-color: var(--mud-palette-primary); }
.hs-mc-over { border-color: var(--mud-palette-primary) !important; box-shadow: 0 0 0 2px var(--mud-palette-primary-lighten); }
.hs-mc-item.hs-mc-over { box-shadow: inset 0 3px 0 var(--mud-palette-primary); }

/* ---------- Prescription pages (paper size, shrunk to fit small screens) ---------- */
.hs-fit { width: 100%; overflow: hidden; }
.hs-fit-inner { width: max-content; margin: 0 auto; transform-origin: 0 0; }
.hs-fit-shadow > .hs-fit-inner { box-shadow: 0 1px 6px rgba(0,0,0,.25); }
@media print {
    .hs-fit { height: auto !important; overflow: visible !important; }
    .hs-fit-inner { transform: none !important; box-shadow: none !important; }
}
.hs-rx-print-gap { margin-bottom: 6mm; }
@media print { .hs-rx-print-gap { margin: 0; } }

/* ---------- Bed board (Phase 3) ---------- */
.hs-bed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.hs-bed { border-radius: 8px; padding: 8px 10px; cursor: pointer; border: 1px solid transparent; min-height: 78px; font-size: 13px; line-height: 1.35; }
.hs-bed:hover { filter: brightness(.97); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.hs-bed-type { font-size: 11.5px; opacity: .8; }
.hs-bed-patient { font-weight: 600; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hs-bed-available { background: #e8f5e9; border-color: #81c784; color: #1b5e20; }
.hs-bed-occupied { background: #ffebee; border-color: #e57373; color: #b71c1c; }
.hs-bed-reserved { background: #e3f2fd; border-color: #64b5f6; color: #0d47a1; }
.hs-bed-cleaning { background: #fff8e1; border-color: #ffb74d; color: #e65100; }
.hs-bed-maintenance { background: #eceff1; border-color: #90a4ae; color: #37474f; }
