/* Workspace refinement: shared reading scale, controls and bidirectional layout. */
.health-alerts-page .health-summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.health-alerts-page .health-summary-grid .metric-card { min-width: 0; min-height: 96px; padding: 14px; border-radius: 15px; }
.health-alerts-page .health-summary-grid .metric-label { color: #52617a; font-size: .8125rem; line-height: 1.5; }
.health-alerts-page .health-summary-grid .metric-value { font-variant-numeric: tabular-nums; }
.health-alerts-page .health-alert-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr) auto; gap: 14px; align-items: end; padding: 16px; }
.health-alerts-page .health-alert-filters .form-label { display: block; margin-bottom: 6px; font-weight: 600; }
.health-alerts-page .health-alert-filter-actions { display: flex; gap: 8px; }
.health-alerts-page .health-alert-filter-actions .btn { min-height: 44px; }
.health-alerts-page .health-alert-table { scrollbar-width: auto; scrollbar-color: #87978f #f1f5f3; }
.health-alerts-page .health-alert-empty { text-align: center; }
.health-alerts-page .health-alert-empty > i { color: var(--ui-primary, #6554c0); font-size: 2rem; }
.health-alerts-page .health-alert-empty h2 { margin-top: 12px; font-size: 1.1rem; }
.health-alerts-page .health-alert-empty p { color: #52617a; }
.health-alerts-page .health-symptoms-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.health-alerts-page .health-symptoms-fieldset legend { float: none; width: auto; }
.health-alerts-page .health-alert-details dt { margin-bottom: 4px; color: #52617a; font-size: .8125rem; font-weight: 600; }
.health-alerts-page .health-alert-details dd { margin: 0; font-size: .9rem; }
.health-alerts-page .health-alert-user-copy { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1199.98px) {
    .health-alerts-page .health-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .health-alerts-page .health-alert-filters { grid-template-columns: minmax(0, 1fr) minmax(180px, .65fr); }
    .health-alerts-page .health-alert-filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 767.98px) {
    .health-alerts-page .health-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .health-alerts-page .health-summary-grid > :last-child { grid-column: 1 / -1; }
    .health-alerts-page .health-alert-filters { grid-template-columns: minmax(0, 1fr); }
    .health-alerts-page .health-alert-filter-actions { grid-column: auto; }
    .health-alerts-page .health-alert-filter-actions > .btn:first-child { flex: 1; }
}
@media (max-width: 575.98px) {
    .health-alerts-page .health-alert-filter-actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .health-alerts-page .health-alert-filter-actions .btn:last-child { min-width: 112px; }
    .health-alerts-page .form-section { padding: 15px; }
    .health-alerts-page .form-section-head { gap: 10px; }
}
@media screen {
    .app-shell {
        --ui-muted: #52617a;
        --bs-secondary-color: #52617a;
    }
    .app-shell ::selection { background: #dce8fc; color: #102a56; }
    .app-shell :is(a, button, input, select, textarea, [tabindex]):focus-visible,
    .sanad-assistant :is(button, a, input, textarea):focus-visible {
        outline: 3px solid var(--ui-primary, #6554c0);
        outline-offset: 3px;
    }
    .app-shell .content { line-height: 1.7; }
    .app-shell :is(.page-hero, .data-card-header) { flex-wrap: wrap; }
    .app-shell .page-hero > div { min-width: 0; }
    .app-shell .page-hero h1 { line-height: 1.45; overflow-wrap: anywhere; }
    .app-shell .page-hero p { font-size: .875rem; line-height: 1.8; max-width: 72ch; }
    .app-shell :is(.page-hero-actions, .quick-actions) { flex-wrap: wrap; gap: .5rem; }
    .app-shell :is(.form-control, .form-select) { min-height: 44px; font-size: .875rem; }
    .app-shell :is(.form-control, textarea)::placeholder { color: #606e68; opacity: 1; }
    .app-shell :is(.form-label, .form-text) { font-size: .8125rem; line-height: 1.7; }
    .app-shell :is(.btn, .icon-action-btn) { min-height: 40px; }
    .app-shell .icon-action-btn { min-width: 40px; }
    .app-shell :is(.summary-tile, .class-card, .workspace-card) { min-width: 0; }
    .app-shell .summary-tile > div { min-width: 0; }
    .app-shell .summary-tile strong { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
    .app-shell :is(.summary-tile small, .data-card-header p, .guardian-cell small,
        .student-cell > small, .readonly-label, .metric-note) { font-size: .75rem; color: var(--ui-muted); }
    .app-shell .data-card-header h2 { font-size: 1rem; }
    .app-shell .modern-table thead th { font-size: .75rem; color: var(--ui-muted); }
    .app-shell .modern-table tbody td { font-size: .8125rem; line-height: 1.7; }
    .app-shell .guardian-cell strong { font-size: .8125rem; }
    .app-shell :is(.status-pill, .class-chip, .results-chip) { font-size: .75rem; }
    .app-shell .status-pill.inactive { color: #53635d; }
    .app-shell .table-responsive { scrollbar-width: auto; scrollbar-color: #87978f #f1f5f3; }
    .app-shell :is(.empty-state, .student-empty-state) { padding: 2rem 1rem; }
    .app-shell :is(.empty-state, .student-empty-state) p { font-size: .875rem; line-height: 1.8; }
    .app-shell .alert { overflow-wrap: anywhere; line-height: 1.8; }
    .app-shell :is(.filter-search, .search-input-wrap) > i { right: auto; left: auto; inset-inline-start: 13px; }
    .app-shell :is(.filter-search, .search-input-wrap) .form-control { padding-inline-start: 37px; padding-inline-end: 12px; }
    .app-shell :is(.finance-toolbar-wrap p, .collection-card-head p, .invoice-description small) { font-size: .75rem; }
    .app-shell :is(.finance-status-tab, .invoice-description strong, .date-cell) { font-size: .8125rem; }
    .app-shell .finance-actions-menu button.dropdown-item { text-align: start; }
    .app-shell .student-cell > small { margin-right: 0; margin-inline-start: 47px; }
    .app-shell .guardian-cell small { text-align: start; }
    .sanad-assistant-close { min-width: 44px; min-height: 44px; }
    .sanad-assistant-suggestions button { min-height: 40px; font-size: .8125rem; }
    .sanad-assistant-header small { font-size: .75rem; color: #53617a; }
    .sanad-assistant :is(input, textarea) { font-size: 1rem; }
    @media (max-width: 1199.98px) {
        .app-shell .student-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .app-shell .student-filters .filter-search { grid-column: 1 / -1; }
    }
    @media (max-width: 575.98px) {
        .app-shell .page-hero { padding: 18px 16px; gap: 16px; }
        .app-shell :is(.form-control, .form-select) { font-size: 1rem; }
        .app-shell .page-hero-actions { width: 100%; display: flex; }
        .app-shell .page-hero-actions > .btn { flex: 1 1 140px; white-space: normal; }
        .app-shell :is(.btn, .icon-action-btn, .page-link) { min-height: 44px; }
        .app-shell .icon-action-btn { min-width: 44px; }
        .app-shell .student-filters { grid-template-columns: minmax(0, 1fr); }
        .app-shell .summary-tile { padding: 12px; gap: 8px; }
        .app-shell .summary-tile-icon { width: 32px; height: 32px; flex-basis: 32px; }
        .app-shell .summary-tile strong { font-size: 1.125rem; }
        .app-shell .finance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .app-shell .finance-summary-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .app-shell .finance-summary-grid-3 > :last-child:nth-child(odd) { grid-column: 1 / -1; }
        .app-shell .finance-summary-grid .summary-tile { align-items: flex-start; flex-direction: column; min-height: 126px; }
        .app-shell .finance-summary-grid .summary-tile strong { font-size: 1rem; }
        .app-shell .finance-summary-grid .summary-tile-arrow { inset-inline-end: 12px; inset-inline-start: auto; }
        .app-shell .data-card-header { padding: 14px; }
        .app-shell .modal-footer { gap: .5rem; }
        .app-shell .modal-footer > .btn { margin: 0; }
        .app-shell .finance-modal-dialog { margin: .5rem; min-height: calc(100% - 1rem); }
        .app-shell .finance-modal { max-height: calc(100dvh - 1rem); overflow: hidden; }
        .app-shell .finance-modal form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 1rem); }
        .app-shell .finance-modal form .modal-header,
        .app-shell .finance-modal form .modal-footer { flex: 0 0 auto; }
        .app-shell .finance-modal form .modal-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
    }
    @media (prefers-reduced-motion: reduce) {
        .app-shell .btn-pulse-attention { animation: none; outline: 2px solid #198754; }
        .sanad-assistant-toggle { transition: none; }
        .sanad-assistant-toggle:hover { transform: none; }
    }

    .app-shell .expenses-page .metric-strip { margin-bottom: 16px; }
    .app-shell .expenses-page .expense-empty-state {
        display: grid;
        justify-items: center;
        gap: 10px;
        padding: clamp(24px, 4vw, 44px) 20px;
        text-align: center;
    }
    .app-shell .expenses-page .expense-empty-state > i { color: var(--brand-primary, #4657e8); font-size: 1.75rem; }
    .app-shell .expenses-page .expense-empty-state h2 { margin: 0; font-size: 1.125rem; }
    .app-shell .expenses-page .expense-empty-state p { max-width: 58ch; margin: 0 0 4px; color: var(--text-muted, #5d687b); }
    .app-shell .expenses-page .expense-page-actions { gap: 8px; }
    .app-shell .exchange-rate-empty {
        display: grid;
        justify-items: center;
        gap: 8px;
        padding: clamp(28px, 4vw, 48px) 20px;
        text-align: center;
    }
    .app-shell .exchange-rate-empty > i { color: var(--ui-primary, #6554c0); font-size: 1.75rem; }
    .app-shell .exchange-rate-empty h3 { margin: 0; font-size: 1.05rem; }
    .app-shell .exchange-rate-empty p { max-width: 52ch; margin: 0; color: var(--ui-muted, #52617a); }
    .app-shell .exchange-rate-table { scrollbar-width: auto; scrollbar-color: #87978f #f1f5f3; }
    .app-shell .cash-flow-empty {
        display: grid;
        justify-items: center;
        gap: 8px;
        min-height: 190px;
        padding: 24px 18px;
        text-align: center;
    }
    .app-shell .cash-flow-empty > i { color: var(--ui-primary, #6554c0); font-size: 1.75rem; }
    .app-shell .cash-flow-empty h3 { margin: 0; color: var(--sanad-navy, #18263b); font-size: 1rem; }
    .app-shell .cash-flow-empty p { max-width: 54ch; margin: 0 0 4px; color: var(--ui-muted, #52617a); }
    .app-shell .cash-flow-empty .btn { min-height: 40px; }
    .app-shell .account-create-title { scroll-margin-block-start: 90px; }
    @media (max-width: 767.98px) {
        .app-shell .expenses-page .expense-page-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
        .app-shell .expenses-page .expense-page-actions > .btn { min-height: 44px; }
        .app-shell .expenses-page .metric-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
        .app-shell .expenses-page .metric-strip .metric-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
        .app-shell .expense-form .form-actions-sticky { padding-inline-end: 62px; }
        .app-shell .exchange-rate-form > .btn { width: calc(100% - 62px) !important; margin-inline-end: 62px; }
        .app-shell .account-empty-state > .btn { margin-inline-end: 62px; }
    }
}
