:root {
    /* PSH semantic design tokens */
    --psh-section-contact-bg: #e9edf4;
    --psh-section-caregiver-bg: #dddddd;
    --psh-header-dark-bg: #2b2b2b;
    --psh-header-dark-text: #ffffff;
    --psh-header-avatar-bg: #4a4a4a;
    --psh-card-bg: #ffffff;
    --psh-space-1: 4px;
    --psh-space-2: 8px;
    --psh-space-3: 16px;
    --psh-space-4: 20px;
    --psh-error-slot-height: 52px;
    --psh-record-cell-block: 8px;
    --psh-record-cell-inline: 16px;

    /* Compatibility aliases for feature styles that still use the old names. */
    --section-contact-bg: var(--psh-section-contact-bg);
    --section-caregiver-bg: var(--psh-section-caregiver-bg);
    --header-dark-bg: var(--psh-header-dark-bg);
    --header-dark-text: var(--psh-header-dark-text);
    --header-avatar-bg: var(--psh-header-avatar-bg);
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

/* PSH shared UI primitives */
.psh-field-label {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    margin-bottom: var(--psh-space-1);
}

.psh-cream-button {
    background-color: var(--mud-palette-tertiary) !important;
    border-color: var(--mud-palette-lines-default) !important;
    color: var(--mud-palette-primary) !important;
    font-weight: 600;
    text-transform: none;
}

/* 按鈕不強制大寫（顯示原始大小寫，如 "Revoke deletion" / "View Info"） */
.psh-normalcase {
    text-transform: none;
}

.psh-error-slot {
    min-height: var(--psh-error-slot-height);
}

.psh-section-header-actions {
    align-items: center;
    display: flex;
}

.psh-section-header-title {
    flex: 1 1 auto;
    font-size: 1.5rem;
    line-height: 1.3;
    min-width: 0;
}

.psh-section-header-action-button {
    flex: 0 0 auto;
    font-size: 0.875rem;
    height: 36px;
    padding-left: 16px;
    padding-right: 16px;
    white-space: nowrap;
}

.psh-section-header-action-button .mud-icon-root {
    font-size: 1.125rem;
}

/* 8-section 內的新增紀錄按鈕，以 Medications 的呈現為共同基準。 */
.psh-section-add-record-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

.psh-section-add-record-button .mud-button-label {
    white-space: nowrap;
}

.psh-action-tile {
    align-items: center;
    background-color: var(--mud-palette-tertiary);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius, 8px);
    color: var(--mud-palette-primary);
    cursor: pointer;
    display: flex;
    font-weight: 600;
    justify-content: space-between;
    padding: var(--psh-space-3);
}

.psh-action-tile:hover {
    filter: brightness(0.97);
}

.psh-summary-row {
    align-items: baseline;
    display: flex;
    gap: var(--psh-space-2);
    margin-bottom: var(--psh-space-1);
}

.psh-summary-label {
    color: var(--mud-palette-info);
    flex-shrink: 0;
    font-weight: 400;
    min-width: 110px;
}

.psh-summary-value {
    color: var(--mud-palette-text-primary);
}

.psh-record-table-scroll {
    overflow-x: auto;
}

.psh-record-table {
    border-collapse: collapse;
    white-space: nowrap;
}

.psh-record-table th,
.psh-record-table td {
    border: 1px solid var(--mud-palette-lines-default);
    padding: var(--psh-record-cell-block) var(--psh-record-cell-inline);
    text-align: center;
}

.psh-record-table thead th {
    background-color: #efefef;
    color: var(--mud-palette-text-primary);
}

.psh-record-label {
    background-color: #efefef;
    font-weight: 600;
    left: 0;
    position: sticky;
    text-align: left !important;
    z-index: 1;
}

/* 最新一筆紀錄（最右欄）整欄以 #efefef 底色、粗體標示 */
.psh-record-table thead th.psh-record-newest,
.psh-record-table td.psh-record-newest {
    background-color: #efefef;
    font-weight: 700;
}

.psh-record-subtext {
    color: var(--mud-palette-text-secondary);
    font-size: 0.7rem;
    font-weight: 400;
}

.psh-medication-record-actions {
    align-items: center;
    display: flex;
    gap: 4px;
}

.psh-medication-edit-mobile {
    display: none !important;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-section-header-title {
        font-size: 1.125rem;
    }

    .psh-section-header-action-button {
        font-size: 0.72rem;
        height: 30px;
        padding-left: 9px;
        padding-right: 9px;
    }

    .psh-section-header-action-button .mud-icon-root {
        font-size: 1rem;
    }

    .psh-medication-edit-desktop {
        display: none !important;
    }

    .psh-medication-edit-mobile {
        display: inline-flex !important;
    }

    .psh-medication-record-card {
        font-size: 78%;
        padding: 14px !important;
    }

    .psh-medication-record-card .mud-typography-subtitle1 {
        font-size: 0.78rem;
    }

    .psh-medication-record-card .mud-typography-body2 {
        font-size: 0.68rem;
    }

    .psh-medication-record-card .psh-record-table {
        font-size: 0.76rem;
    }

    .psh-medication-record-card .psh-record-table th,
    .psh-medication-record-card .psh-record-table td {
        padding: 5px 10px;
    }

    .psh-medication-record-card .mud-expand-panel-header {
        font-size: 0.72rem;
        min-height: 38px;
        padding-bottom: 10px;
        padding-top: 10px;
    }

    .psh-medication-record-card .mud-expand-panel-content {
        padding-bottom: 10px;
    }

    /* Add New Vital Signs Record：保留標題尺寸，只縮小欄位提示文字。 */
    .psh-vital-signs-add-dialog-fields .psh-meta-field .mud-input-label,
    .psh-vital-signs-add-dialog-fields .psh-meta-field .mud-input-label-inputcontrol {
        font-size: 0.9rem !important;
    }

    .psh-vital-signs-add-dialog-fields .psh-meta-field .mud-input-helper-text {
        font-size: 0.64rem !important;
    }

    .psh-lab-results-table .psh-record-table {
        font-size: 0.76rem;
    }

    .psh-lab-results-table .psh-record-table th,
    .psh-lab-results-table .psh-record-table td {
        padding: 5px 10px;
    }

    .psh-lab-results-table .psh-record-subtext {
        font-size: 0.6rem;
    }

    .psh-case-summary-grid-collapsed.mud-grid-spacing-xs-2 {
        box-sizing: border-box;
        column-gap: 0;
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-evenly !important;
        margin-left: 0;
        max-width: 100%;
        width: 100%;
    }

    .psh-case-summary-grid-collapsed.mud-grid-spacing-xs-2 > .mud-grid-item {
        flex-basis: auto !important;
        flex-grow: 0 !important;
        flex-shrink: 0 !important;
        max-width: none !important;
        min-width: 0;
        padding-left: 0;
        text-align: left;
        width: auto !important;
    }

    .psh-case-summary-grid-collapsed .mud-typography-caption {
        font-size: clamp(0.62rem, 2.8vw, 0.75rem);
        white-space: nowrap;
    }

    .psh-case-summary-grid-collapsed .mud-typography-body2 {
        font-size: clamp(0.68rem, 3vw, 0.875rem);
        white-space: nowrap;
    }
}

/* Shared signed-in application header */
.psh-app-bar {
    background-color: #30302f !important;
    color: #ffffff !important;
}

.psh-app-bar .mud-toolbar {
    min-height: 56px;
}

.psh-app-brand,
.psh-app-user {
    align-items: center;
    display: flex;
}

.psh-app-brand {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font: inherit;
    gap: 7px;
    margin: 0;
    padding: 4px 6px;
    border-radius: 4px;
}

.psh-app-brand:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.psh-app-brand:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.psh-app-logo {
    background-color: #ffffff;
    border-radius: 50%;
    height: 25px;
    object-fit: cover;
    width: 25px;
}

.psh-app-name {
    color: #ffffff;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.psh-app-user {
    color: #f4f4f4;
    display: flex;
    flex: 0 1 auto;
    font-size: 0.65rem;
    gap: 12px;
    margin-left: auto;
    min-width: 0;
    white-space: nowrap;
}

.psh-app-user-item,
.psh-app-actions {
    align-items: center;
    display: flex;
}

.psh-app-user-item {
    gap: 5px;
    min-width: 0;
}

.psh-app-user-copy {
    align-items: center;
    display: flex;
    gap: 5px;
    min-width: 0;
}

.psh-app-actions {
    flex: 0 0 auto;
}

.psh-app-user-status {
    background-color: #3da34b;
    border-radius: 50%;
    flex: 0 0 7px;
    height: 7px;
    width: 7px;
}

.psh-app-user-label {
    color: #b8b8b8;
    font-weight: 400;
}

.psh-app-user-role {
    font-weight: 600;
}

.psh-app-username {
    min-width: 0;
}

.psh-app-session-time {
    font-variant-numeric: tabular-nums;
    min-width: 38px;
}

/* Keep the entire header on one row; only each user-info item's copy stacks. */
@media (max-width: 767.98px) {
    .psh-app-bar .mud-toolbar {
        flex-wrap: nowrap;
        gap: 0;
        padding-left: 8px;
        padding-right: 4px;
    }

    .psh-app-user {
        align-items: start;
        display: grid;
        flex: 1 1 0;
        gap: 4px;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        margin-left: 4px;
        overflow: hidden;
    }

    .psh-app-user-item {
        align-items: flex-start;
        gap: 3px;
        justify-content: center;
        overflow: hidden;
    }

    .psh-app-user-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 0;
        line-height: 1.25;
    }

    .psh-app-user-status {
        margin-top: 3px;
    }

    .psh-app-user-identity {
        overflow: hidden;
    }

    .psh-app-user-identity .psh-app-user-copy {
        overflow: hidden;
    }

    .psh-app-username {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

}

/* Organization workspace */
.psh-workspace-page {
    background-color: #3f3f3f;
    box-shadow: 0 2px 10px rgba(34, 34, 34, 0.22);
    margin: 0 auto;
    max-width: 440px;
    min-height: calc(100vh - 96px);
    overflow: hidden;
}

.psh-workspace-section {
    border-radius: 0 !important;
    color: #292929 !important;
    margin: 0 !important;
    padding: 24px 20px;
}

.psh-workspace-search {
    background-color: #fffbf5 !important;
    border-bottom: 1px solid #cfc7bb;
}

.psh-workspace-heading {
    align-items: center;
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.psh-workspace-heading .mud-typography {
    font-weight: 600;
}

.psh-workspace-search-row {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto auto;
    margin-bottom: 14px;
}

.psh-workspace-search-field {
    min-width: 0;
}

/* 只作用於 grid 直接子層的 Search/Clear 按鈕；
   避免波及欄位內 Clearable 的 X（MudIconButton 也帶 .mud-button-root，
   被 min-width 撐成橢圓＝變形來源）。 */
.psh-workspace-search-row > .mud-button-root {
    min-width: 68px;
}

.results-scroll {
    max-height: 260px;
    min-height: 48px;
    overflow-y: auto;
    padding: 8px 4px 0 0;
}

/* Search / Add Case：手機版縮小搜尋結果資訊，桌面版維持原尺寸。 */
@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-workspace-search-heading .mud-typography {
        font-size: 1.25rem;
        white-space: nowrap;
    }
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-workspace-search .results-scroll .case-card .psh-summary-label,
    .psh-workspace-search .results-scroll .case-card .psh-summary-value {
        font-size: clamp(0.54rem, 2.6vw, 0.64rem);
    }

    .psh-workspace-search .results-scroll .case-card .mud-chip {
        font-size: clamp(0.5rem, 2.35vw, 0.58rem);
    }

    .psh-workspace-search .psh-registry-number-chip {
        height: 20px;
        margin: 0;
        max-width: none;
        min-height: 20px;
        padding: 0 6px;
        white-space: nowrap;
        width: max-content;
    }

    .psh-workspace-search .psh-registry-number-chip .mud-chip-content {
        line-height: 1.2;
        overflow-wrap: normal;
        padding: 0;
        white-space: nowrap;
        word-break: normal;
    }

    .psh-workspace-search .results-scroll {
        overflow-x: hidden;
    }

    .psh-workspace-search .case-card {
        box-sizing: border-box;
        max-width: 100%;
        min-width: 0;
        width: 100%;
    }

    .psh-workspace-search .case-card .mud-card-content {
        min-width: 0;
        padding: 12px;
    }

    .psh-case-result-row {
        max-width: 100%;
        min-width: 100%;
        width: 100%;
    }

    .psh-case-result-details {
        flex: 1 1 auto;
        min-width: 0;
    }

    .psh-workspace-search .case-card .psh-summary-label {
        min-width: 82px;
    }

    .psh-workspace-search .case-card .psh-summary-value {
        min-width: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .psh-case-result-open {
        flex: 0 0 auto;
        margin-left: 4px;
    }
}

.psh-workspace-divider {
    margin: 12px 0 !important;
}

.psh-workspace-dashboard {
    background-color: #eaeaea !important;
    border-bottom: 1px solid #bdbdbd;
}

.psh-workspace-dashboard-heading {
    border-bottom: 1px solid #b9b2a8;
    margin-bottom: 14px;
    padding-bottom: 12px;
}

.psh-workspace-dashboard-updated {
    color: #625d59;
    font-size: 0.55rem;
    margin-left: auto;
    white-space: nowrap;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-workspace-dashboard-heading {
        flex-wrap: wrap;
        row-gap: 5px;
    }

    .psh-workspace-dashboard-heading .mud-typography {
        white-space: nowrap;
    }

    .psh-workspace-dashboard-updated {
        flex: 0 0 100%;
        margin-left: 0;
        order: -1;
        text-align: right;
    }
}

.psh-workspace-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psh-workspace-stats > div {
    align-items: baseline;
    display: flex;
    justify-content: space-between;
}

.psh-workspace-actions {
    background-color: #3f3f3f;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 245px;
    padding: 18px 12px 0;
}

.psh-workspace-actions .psh-action-tile {
    background-color: #eef1f6;
    border: 1px solid #c7ccd3;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
    color: #303030;
    min-height: 46px;
    padding: 10px 12px;
}

.psh-workspace-actions .psh-action-tile:hover {
    background-color: #f7f8fa;
    filter: none;
}

.psh-workspace-footer {
    color: #ffffff;
    display: flex;
    flex-direction: column;
    font-size: 0.56rem;
    line-height: 1.45;
    margin-top: auto;
    padding: 24px 12px 20px;
    text-align: center;
}

/* ===== Admin workspace ===== */
.psh-admin-welcome {
    align-items: center;
    background-color: #3f3f3f;
    color: #d9d9d9;
    display: flex;
    min-height: 56px;
    padding: 0 20px;
}

.psh-admin-welcome-text {
    color: #e8e8e8;
    font-weight: 400;
    white-space: nowrap;
}

.psh-admin-welcome-text b {
    color: #ffffff;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-admin-welcome-text {
        font-size: clamp(0.68rem, 3.7vw, 1rem);
    }
}

/* 卡片標題列：左標題 + 右側 See all / chevron */
.psh-workspace-cardtitle-row {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.psh-workspace-cardtitle.psh-workspace-heading {
    margin-bottom: 0;
}

.psh-admin-seeall {
    align-items: center;
    color: #2f6df6;
    cursor: pointer;
    display: flex;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 2px;
}

.psh-admin-seeall:hover {
    text-decoration: underline;
}

/* 內層白卡（Total Patients / User Distribution） */
.psh-admin-innercard {
    background-color: #ffffff;
    border: 1px solid #e2ddd3;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    padding: 16px 18px;
}

.psh-admin-innercard-title {
    color: #3a3a3a;
    font-weight: 600;
    margin-bottom: 12px;
}

.psh-total-patients-title {
    align-items: baseline;
    display: flex;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
}

.psh-total-patients-label {
    flex: 0 0 auto;
}

.psh-total-patients-scope {
    min-width: 0;
}

.psh-admin-accent {
    color: #e05a2b;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-total-patients-title {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }

    .psh-total-patients-scope {
        font-size: clamp(0.55rem, 3.5vw, 1rem);
        max-width: 100%;
        white-space: nowrap;
    }
}

@media (max-width: 767.98px) and (orientation: portrait) {
    .psh-workspace-search-row.psh-case-search-row {
        grid-template-columns: auto auto;
    }

    .psh-workspace-clear-button {
        display: none !important;
    }
}

/* 大數字統計列（三欄） */
.psh-admin-bigstats {
    align-items: baseline;
    display: flex;
    gap: 18px;
    margin-bottom: 14px;
}

.psh-admin-stat {
    display: flex;
    flex-direction: column;
}

.psh-admin-stat-big {
    color: #1f1f1f;
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
}

.psh-admin-stat-num {
    color: #1f1f1f;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.15;
}

.psh-hypertension-summary-grid {
    display: grid;
    column-gap: 6px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    min-width: 0;
    row-gap: 12px;
}

.psh-hypertension-summary-item {
    min-width: 0;
    padding: 2px 0;
}

.psh-hypertension-summary-item > span {
    color: #665d56;
    display: block;
    font-size: 0.6rem;
    line-height: 1.2;
    margin-bottom: 3px;
}

.psh-hypertension-summary-item > div {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.psh-hypertension-summary-item strong {
    color: #52301e;
    font-size: 1rem;
    line-height: 1;
}

.psh-hypertension-summary-item small {
    color: #8a7d73;
    font-size: 0.5rem;
    white-space: nowrap;
}

.psh-dashboard-summary-layout {
    align-items: stretch;
    border-bottom: 1px solid #e2d5ca;
    display: grid;
    gap: 2px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 10px 0 12px;
    padding-bottom: 10px;
}

.psh-dashboard-summary-layout .psh-admin-bigstats,
.psh-dashboard-summary-layout .psh-dashboard-total-stats {
    align-items: center;
    border: 0;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.psh-dashboard-summary-layout .psh-admin-stat,
.psh-dashboard-summary-layout .psh-dashboard-total-stats > strong {
    text-align: center;
}

.psh-dashboard-summary-layout .psh-admin-stat-big,
.psh-dashboard-summary-layout .psh-dashboard-total-stats > strong {
    font-size: 2.65rem;
    line-height: 1;
}

.psh-admin-stat-label {
    color: #8a8a8a;
    font-size: 0.68rem;
    font-weight: 500;
}

/* User Distribution：label 在上、數字在下，數字放大並於各標題下方置中 */
.psh-admin-dist {
    justify-content: space-around;
}

.psh-admin-dist .psh-admin-stat {
    align-items: center;
    flex: 1;
    text-align: center;
}

.psh-admin-dist .psh-admin-stat-label {
    margin-bottom: 2px;
}

.psh-admin-dist .psh-admin-stat-num {
    font-size: 1.9rem;
    line-height: 1.1;
}

.psh-system-management-summary {
    background-color: #f2eee8 !important;
}

.psh-system-audit-intro {
    align-items: center;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.psh-system-audit-refresh {
    flex-shrink: 0;
    white-space: nowrap;
}

.psh-system-audit-filters,
.psh-system-audit-table,
.psh-system-audit-summary-card {
    border: 1px solid #dedede;
}

.psh-system-audit-summary-card {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 92px;
}

.psh-system-audit-summary-card strong {
    color: #252525;
    font-size: 1.5rem;
    line-height: 1.15;
}

.psh-system-audit-summary-card span {
    color: #777;
    font-size: .75rem;
}

.psh-system-audit-table .psh-system-audit-row-sensitive {
    background-color: #f4f4f4;
}

.psh-system-audit-table .psh-system-audit-row-sensitive:hover {
    background-color: #ececec !important;
}

/* Long audit actions and targets wrap inside their own cells. The table row
   keeps its natural height so all wrapped lines remain visible. */
.psh-system-audit-table .psh-system-audit-message-cell {
    height: 80px;
    min-width: 0;
    white-space: normal;
}

@media (min-width: 960px) {
    .psh-system-audit-table .psh-system-audit-equal-col {
        width: 12%;
    }

    .psh-system-audit-table .psh-system-audit-target-col {
        padding-left: 8px;
        padding-right: 8px;
        width: 17%;
    }

    .psh-system-audit-table th.psh-system-audit-target-col {
        white-space: nowrap;
    }

    .psh-system-audit-table .psh-system-audit-result-col,
    .psh-system-audit-table .psh-system-audit-sensitivity-col {
        padding-left: 8px;
        padding-right: 8px;
        width: 9%;
    }

    .psh-system-audit-table .psh-system-audit-details-col {
        padding-left: 4px;
        padding-right: 4px;
        width: 5%;
    }
}

.psh-system-audit-table .psh-system-audit-message-cell > span {
    display: block;
    line-height: 1.35;
    max-width: 240px;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

.psh-system-audit-table tbody tr,
.psh-system-audit-table tbody .mud-table-cell {
    height: 80px;
}

.psh-system-audit-mobile-list {
    display: none;
}

@media (max-width: 959.98px) {
    .psh-system-audit-desktop-table {
        display: none;
    }

    .psh-system-audit-mobile-list {
        display: block;
    }

    .psh-system-audit-mobile-card {
        border-bottom: 1px solid #dedede;
        padding: 10px 8px;
    }

    .psh-system-audit-mobile-card:last-child {
        border-bottom: 0;
    }

    .psh-system-audit-mobile-row {
        align-items: center;
        display: grid;
        gap: 8px;
        min-width: 0;
    }

    .psh-system-audit-mobile-row-primary {
        grid-template-columns: 1.35fr 1fr .75fr;
        margin-bottom: 9px;
    }

    .psh-system-audit-mobile-row-secondary {
        gap: 4px;
        grid-template-columns: minmax(54px, 1.4fr) auto auto 28px 28px;
    }

    .psh-system-audit-mobile-field,
    .psh-system-audit-mobile-chip-field {
        min-width: 0;
    }

    .psh-system-audit-mobile-field > span,
    .psh-system-audit-mobile-chip-field > span {
        color: #777;
        display: block;
        font-size: .62rem;
        font-weight: 600;
        line-height: 1.2;
        margin-bottom: 3px;
    }

    .psh-system-audit-mobile-field > strong {
        display: block;
        font-size: .72rem;
        font-weight: 500;
        line-height: 1.3;
        overflow-wrap: anywhere;
    }

    .psh-system-audit-mobile-chip-field .mud-chip {
        font-size: .62rem;
        height: 24px;
    }

    .psh-system-audit-mobile-row-secondary .mud-icon-button {
        height: 28px;
        padding: 3px;
        width: 28px;
    }

    .psh-system-audit-mobile-action {
        align-self: stretch;
    }

    .psh-system-audit-mobile-expanded {
        background-color: rgba(0, 0, 0, .025);
        border-radius: 4px;
        display: grid;
        gap: 10px;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 10px;
        padding: 9px;
    }

    .psh-system-audit-mobile-expanded-wide {
        grid-column: 1 / -1;
    }
}

.psh-system-audit-pagination {
    align-items: center;
    border-top: 1px solid #ececec;
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
}

.psh-system-audit-details {
    display: grid;
    grid-template-columns: minmax(115px, .35fr) minmax(0, 1fr);
    margin: 0;
}

.psh-system-audit-details dt,
.psh-system-audit-details dd {
    border-bottom: 1px solid #ececec;
    margin: 0;
    padding: 8px 4px;
}

.psh-system-audit-details dt {
    color: #777;
    font-size: .75rem;
    font-weight: 600;
}

.psh-system-audit-mono {
    font-family: Consolas, "Courier New", monospace;
    overflow-wrap: anywhere;
}

.psh-system-audit-wrap {
    overflow-wrap: anywhere;
}

.psh-system-audit-json {
    max-height: 20rem;
    margin: 0;
    padding: 0.9rem;
    overflow: auto;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: 0.78rem/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (max-width: 599px) {
    .psh-system-audit-intro {
        align-items: stretch;
        flex-direction: column;
    }

    .psh-system-audit-details {
        grid-template-columns: 1fr;
    }

    .psh-system-audit-details dt {
        border-bottom: 0;
        padding-bottom: 0;
    }
}

/* 指標明細列（label：value） */
.psh-admin-metric-row {
    color: #555;
    display: flex;
    font-size: 0.68rem;
    gap: 6px;
    margin-top: 4px;
}

.psh-admin-metric-row b {
    color: #2f2f2f;
}

/* 所有 API 尚未提供的 Not available 統一使用紅色。 */
.psh-unavailable,
.psh-admin-metric-row .psh-unavailable,
.psh-admin-stat-num.psh-unavailable,
.psh-clinic-unavailable {
    color: #c62828 !important;
}

/* ===== User Management page ===== */
.psh-usermgmt-page {
    background-color: #efefef;
}

.psh-usermgmt-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 16px 20px 14px;
}

.psh-usermgmt-back {
    align-items: center;
    color: #555;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.82rem;
    gap: 2px;
    margin-bottom: 8px;
}

.psh-usermgmt-back:hover {
    color: #222;
}

.psh-usermgmt-title.psh-workspace-heading {
    margin-bottom: 0;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-request-history-page-title {
        min-width: 0;
    }

    .psh-request-history-page-title .mud-typography {
        font-size: clamp(0.78rem, 4vw, 1.25rem);
        white-space: nowrap;
    }
}

.psh-usermgmt-section {
    background-color: #ffffff;
    border-bottom: 1px solid #e6e6e6;
    padding: 18px 20px;
}

/* Institution / Admin：固定雙欄切換，不使用 MudTabs 的可捲動 header。 */
.psh-usermgmt-tab-switcher {
    border-bottom: 1px solid #e2e2e2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 4px;
    min-height: 40px;
    width: 100%;
}

.psh-usermgmt-tab-button {
    background-color: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    color: #9a9a9a;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    min-width: 0;
    padding: 6px 16px;
    text-align: center;
    text-transform: none;
    width: 100%;
}

.psh-usermgmt-tab-button:hover {
    color: #2f2f2f;
}

.psh-usermgmt-tab-button.is-active {
    border-bottom-color: #2f2f2f;
    color: #2f2f2f;
}

.psh-usermgmt-tab-button:focus-visible {
    outline: 2px solid var(--mud-palette-info);
    outline-offset: -2px;
}

.psh-usermgmt-tab-panels,
.psh-usermgmt-tab-panels .mud-tabs-panels {
    background-color: transparent !important;
}

.psh-usermgmt-tab-panels .mud-tabs-tabbar {
    display: none !important;
}

.psh-usermgmt-toggle .psh-toggle-btn {
    font-size: 0.78rem;
}

/* User Management 的兩個 MudSelect：輸入框、浮出選單與選項皆使用奶油色。 */
.psh-usermgmt-cream-select .mud-input-outlined {
    background-color: var(--mud-palette-tertiary) !important;
    background-clip: padding-box;
    border-radius: var(--mud-default-borderradius);
}

/* 兩個 MudSelect 共用提示／目前值色彩：關閉時黑色，只有展開時變灰色。 */
.psh-usermgmt-cream-select .mud-input,
.psh-usermgmt-cream-select .mud-select-input,
.psh-usermgmt-cream-select input.mud-input-root,
.psh-usermgmt-cream-select div.mud-input-slot {
    color: #222222 !important;
    transition: color 140ms ease;
}

.psh-usermgmt-cream-select input.mud-input-root::placeholder,
.psh-usermgmt-cream-select div.mud-input-slot::placeholder {
    color: #222222 !important;
    opacity: 1;
}

.psh-usermgmt-cream-select:has([aria-expanded="true"]) .mud-input,
.psh-usermgmt-cream-select:has([aria-expanded="true"]) .mud-select-input,
.psh-usermgmt-cream-select [aria-expanded="true"],
.psh-usermgmt-cream-select [aria-expanded="true"] input.mud-input-root,
.psh-usermgmt-cream-select [aria-expanded="true"] div.mud-input-slot {
    color: #8a8a8a !important;
}

.psh-usermgmt-cream-select:has([aria-expanded="true"]) input.mud-input-root::placeholder,
.psh-usermgmt-cream-select:has([aria-expanded="true"]) div.mud-input-slot::placeholder,
.psh-usermgmt-cream-select [aria-expanded="true"] input.mud-input-root::placeholder,
.psh-usermgmt-cream-select [aria-expanded="true"] div.mud-input-slot::placeholder {
    color: #8a8a8a !important;
    opacity: 1;
}

.psh-usermgmt-cream-select-popover,
.psh-usermgmt-cream-select-popover .mud-paper,
.psh-usermgmt-cream-select-list,
.psh-usermgmt-cream-select-list .mud-list-item {
    background-color: var(--mud-palette-tertiary) !important;
}

/* 兩段式切換（Search by Name / Chapter） */
.psh-usermgmt-toggle {
    background-color: #eef0f3;
    border: 1px solid #dfe3e8;
    border-radius: 22px;
    display: grid;
    gap: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-block: 12px;
    min-width: 0;
    padding: 3px;
}

.psh-toggle-btn {
    background-color: transparent !important;
    border-radius: 18px !important;
    color: #555 !important;
    font-weight: 600;
    min-width: 0;
    text-transform: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.psh-toggle-btn .mud-button-label {
    white-space: nowrap;
}

.psh-toggle-btn--on {
    background-color: #2f6df6 !important;
    color: #ffffff !important;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-usermgmt-toggle .psh-toggle-btn {
        font-size: 0.72rem;
        padding-left: 6px;
        padding-right: 6px;
    }
}

.psh-usermgmt-results-head {
    color: #444;
    font-size: 0.82rem;
    margin: 14px 0 8px;
}

.psh-usermgmt-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}

.psh-inst-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.psh-inst-group + .psh-inst-group {
    margin-top: 8px;
}

.psh-inst-group-title {
    border-bottom: 1px solid #dedede;
    color: #555;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 2px 4px 6px;
}

.psh-inst-group-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Institution 清單項目 */
.psh-inst-item {
    align-items: center;
    background-color: #ffffff;
    border: 1px solid #d7d7d7;
    border-radius: 4px;
    color: #333;
    cursor: pointer;
    display: flex;
    font-size: 0.85rem;
    gap: 8px;
    justify-content: space-between;
    padding: 12px 14px;
}

.psh-inst-item:hover {
    background-color: #f5f7fa;
}

.psh-inst-item-content {
    align-items: center;
    display: flex;
    flex: 1;
    gap: 8px;
    min-width: 0;
}

.psh-inst-item-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psh-user-verification-pill {
    align-items: center;
    background: #f1f1f1;
    border-radius: 999px;
    color: #333333;
    display: inline-flex;
    font-size: 0.68rem;
    font-weight: 700;
    gap: 4px;
    line-height: 1;
    padding: 5px 8px;
    flex-shrink: 0;
    white-space: nowrap;
}

.psh-binary-check {
    align-items: center;
    border: 1.5px solid #a3a3a3;
    border-radius: 3px;
    box-sizing: border-box;
    display: inline-flex;
    flex: 0 0 15px;
    height: 15px;
    justify-content: center;
    width: 15px;
}

.psh-binary-check--checked {
    background: #3f3f3f;
    border-color: #3f3f3f;
    color: #ffffff;
}

.psh-binary-check--checked::after {
    content: "✓";
    font-size: 0.66rem;
    font-weight: 800;
    line-height: 1;
}

.psh-binary-check--unchecked {
    background: #ffffff;
    border-color: #aaaaaa;
}

/* Admin 使用者卡片 */
.psh-admin-usercard {
    align-items: center;
    background-color: #fafafa;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
    padding: 12px 14px;
}

.psh-admin-usercard-row {
    color: #666;
    font-size: 0.78rem;
    line-height: 1.5;
}

.psh-admin-usercard-row span {
    color: #999;
}

.psh-admin-usercard-action {
    flex-shrink: 0;
}

.psh-admin-usercard-revoked {
    color: #d64545;
    font-size: 0.78rem;
    font-weight: 600;
}

/* Shared responsive user list: horizontal summaries, two-column expanded details. */
.psh-user-table {
    --psh-user-summary-columns: minmax(175px, 1.55fr) minmax(95px, 0.8fr) minmax(100px, 0.75fr) minmax(118px, 0.7fr) 32px;
    color: #444;
    width: 100%;
}

.psh-user-table--contact {
    --psh-user-summary-columns: minmax(165px, 1.45fr) minmax(88px, 0.7fr) minmax(96px, 0.72fr) minmax(118px, 0.72fr) minmax(90px, 0.75fr) 32px;
}

.psh-user-table-row {
    align-items: start;
    display: grid;
    gap: 12px 20px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.psh-user-table-row {
    background: #fff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 5%);
    font-size: 0.77rem;
    margin-bottom: 8px;
    min-height: 70px;
    padding: 11px 14px;
    padding-right: 48px;
    position: relative;
}

.psh-user-table-row--busy {
    border-color: #aeb2ff;
}

.psh-user-table-row--collapsed {
    align-items: center;
    gap: 12px;
    grid-template-columns: var(--psh-user-summary-columns);
    min-height: 56px;
    padding-right: 14px;
}

.psh-user-table-row--collapsed .psh-user-table-last-sign-in,
.psh-user-table-row--collapsed .psh-user-table-action {
    display: none;
}

.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-user,
.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-action {
    grid-column: 1 / -1;
}

.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-user {
    border-bottom: 1px solid #ededed;
    padding-bottom: 9px;
}

.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-cell,
.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-action {
    display: grid;
    gap: 8px;
    grid-template-columns: 118px minmax(0, 1fr);
    justify-self: stretch;
    text-align: left;
}

.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-cell::before,
.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-table-action::before {
    color: #888;
    content: attr(data-label);
}

.psh-user-table-row:not(.psh-user-table-row--collapsed) .psh-user-row-toggle-cell {
    position: absolute;
    right: 8px;
    top: 8px;
}

.psh-user-table-user {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-width: 0;
}

.psh-user-table-user-main {
    min-width: 0;
}

.psh-user-table-user-main strong,
.psh-user-table-user-main > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psh-user-table-user-main strong {
    color: #2f2f2f;
    font-size: 0.82rem;
    font-weight: 700;
}

.psh-user-table-user-main > span {
    color: #7a7a7a;
    font-size: 0.72rem;
    margin-top: 2px;
}

.psh-user-table-verification {
    align-items: center;
    display: flex;
    min-height: 22px;
}

.psh-user-verification-pill {
    box-sizing: border-box;
    font-size: 0.62rem;
    flex-shrink: 0;
    gap: 3px;
    height: 22px;
    justify-content: center;
    min-width: 64px;
    padding: 4px;
    width: 64px;
}

.psh-user-verification-pill .psh-binary-check {
    flex-basis: 11px;
    height: 11px;
    width: 11px;
}

.psh-user-verification-pill .psh-binary-check--checked::after {
    font-size: 0.52rem;
}

.psh-user-row-toggle {
    color: #555 !important;
}

.psh-user-row-toggle-cell {
    align-items: center;
    display: flex;
    justify-content: center;
}

.psh-user-table-cell {
    min-width: 0;
    overflow-wrap: anywhere;
}

.psh-user-status-pill {
    align-items: center;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    min-height: 22px;
    min-width: 64px;
    padding: 5px 9px;
    text-align: center;
    white-space: nowrap;
}

.psh-user-table-status .psh-user-status-pill {
    justify-self: start;
    width: fit-content;
}

.psh-user-status-pill--active {
    background: #e3f3e8;
    color: #236b3a;
}

.psh-user-status-pill--suspended {
    background: #fff0d7;
    color: #895400;
}

.psh-user-status-pill--terminated {
    background: #f5e4e4;
    color: #8f3030;
}

.psh-user-status-pill--unknown {
    background: #ececec;
    color: #666;
}

.psh-user-table-action,
.psh-user-table-action-head {
    justify-self: end;
    text-align: right;
}

.psh-user-status-action,
.psh-user-primary-contact-action,
.psh-user-account-action {
    box-sizing: border-box;
    min-width: 124px;
    text-transform: none !important;
    width: 124px;
}

.psh-user-action-stack {
    align-items: flex-start;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
}

.psh-user-table-contact-content {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.psh-user-contact-pill {
    align-items: center;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1;
    min-height: 22px;
    min-width: 64px;
    padding: 5px 9px;
    text-align: center;
    white-space: nowrap;
}

.psh-user-contact-pill--primary {
    background: #e7e9ff;
    color: #333dff;
}

.psh-user-contact-pill--secondary {
    background: #eee9e2;
    color: #665d56;
}

.psh-user-primary-contact-action {
    white-space: nowrap;
}

.psh-user-collapsed-badges {
    display: none;
}

.psh-user-action-unavailable {
    color: #888;
    font-size: 0.7rem;
    white-space: nowrap;
}

.psh-user-dialog-summary {
    display: grid;
    font-size: 0.8rem;
    gap: 5px 12px;
    grid-template-columns: 105px 1fr;
    margin-bottom: 16px;
}

.psh-user-dialog-summary span {
    color: #888;
}

.psh-user-dialog-summary strong:not(.psh-user-status-pill) {
    color: #333;
    font-weight: 600;
}

.psh-user-dialog-summary .psh-user-status-pill {
    justify-self: start;
}

@media (min-width: 900px) {
    .psh-usermgmt-page,
    .psh-clinic-page {
        max-width: 1100px;
    }
}

@media (max-width: 899px) {
    .psh-user-table-row {
        display: grid;
        gap: 7px;
        grid-template-columns: 1fr;
        padding: 13px 14px;
        padding-right: 48px;
        position: relative;
    }

    .psh-user-table-user {
        border-bottom: 1px solid #ededed;
        margin-bottom: 2px;
        padding-bottom: 9px;
    }

    .psh-user-table-cell,
    .psh-user-table-action {
        display: grid;
        gap: 8px;
        grid-template-columns: 105px minmax(0, 1fr);
        justify-self: stretch;
        text-align: left;
    }

    .psh-user-table-cell::before,
    .psh-user-table-action::before {
        color: #888;
        content: attr(data-label);
    }

    .psh-user-table-action > * {
        justify-self: start;
    }

    .psh-user-action-stack {
        flex-direction: column;
    }

    .psh-user-table-row--collapsed .psh-user-table-role,
    .psh-user-table-row--collapsed .psh-user-table-status,
    .psh-user-table-row--collapsed .psh-user-table-last-sign-in,
    .psh-user-table-row--collapsed .psh-user-table-verification,
    .psh-user-table-row--collapsed .psh-user-table-contact,
    .psh-user-table-row--collapsed .psh-user-table-action {
        display: none;
    }

    .psh-user-table-row--collapsed .psh-user-table-user {
        display: grid;
        gap: 8px;
        grid-column: 1;
        grid-template-columns: 105px minmax(0, 1fr);
        grid-row: 1;
    }

    .psh-user-table-row--collapsed .psh-user-collapsed-badges {
        align-items: center;
        display: flex;
        flex-shrink: 0;
        flex-wrap: wrap;
        gap: 6px;
        grid-column: 2;
        justify-self: start;
    }

    .psh-user-row-toggle-cell {
        position: absolute;
        right: 8px;
        top: 8px;
    }
}

/* ===== Clinic Info page ===== */
.psh-clinic-page {
    background-color: #efefef;
}

.psh-clinic-header,
.psh-clinic-section {
    background-color: #ffffff;
    border-bottom: 1px solid #dedede;
    padding: 16px 20px;
}

.psh-clinic-back {
    align-items: center;
    background: transparent;
    border: 0;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.82rem;
    gap: 2px;
    padding: 0;
}

.psh-clinic-back:hover {
    color: #222;
}

.psh-clinic-summary h1 {
    color: #2f2f2f;
    font-size: 1.1rem;
    margin: 3px 0 12px;
}

.psh-clinic-code {
    color: #888;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
}

.psh-clinic-facts {
    display: grid;
    gap: 7px;
    margin: 0 0 16px;
}

.psh-clinic-facts > div {
    display: grid;
    font-size: 0.8rem;
    gap: 8px;
    grid-template-columns: minmax(130px, auto) 1fr;
}

.psh-clinic-facts dt {
    color: #888;
}

.psh-clinic-facts dd {
    color: #333;
    margin: 0;
}

.psh-clinic-unavailable {
    color: #c62828 !important;
    font-weight: 500 !important;
}

.psh-clinic-cream-button,
.psh-clinic-cream-button:hover,
.psh-clinic-cream-button:disabled {
    background-color: var(--mud-palette-tertiary) !important;
    width: 100%;
    text-transform: none !important;
}

.psh-clinic-section-title {
    color: #444;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.psh-clinic-users {
    background-color: #efefef;
}

.psh-clinic-user-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    max-height: 360px;
    overflow-y: auto;
    padding: 2px 4px 2px 0;
}

.psh-clinic-user-card {
    background-color: #ffffff;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 7%);
    padding: 11px 13px;
}

.psh-clinic-user-card > div {
    display: grid;
    font-size: 0.75rem;
    gap: 8px;
    grid-template-columns: 115px 1fr;
    line-height: 1.55;
}

.psh-clinic-user-card span {
    color: #999;
}

.psh-clinic-user-card b {
    color: #444;
    font-weight: 500;
}

/* 帳號狀態列：徽章與操作對齊在值欄，徽章文字白色、去除 MudChip 預設邊距 */
.psh-user-status {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.psh-user-status .mud-chip {
    height: 20px;
    margin: 0;
}

.psh-user-status .mud-chip.mud-chip-filled {
    color: #ffffff;
    font-weight: 600;
}

.psh-clinic-user-actions {
    margin-top: 2px;
}

@media (max-width: 480px) {
    .psh-clinic-facts > div,
    .psh-clinic-user-card > div {
        grid-template-columns: 1fr;
        gap: 1px;
    }
}

/* Welcome and sign-in experience */
.psh-auth-page {
    align-items: center;
    background-color: var(--mud-palette-background);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.psh-auth-shell {
    background-color: var(--psh-card-bg);
    box-shadow: 0 3px 14px rgba(58, 46, 31, 0.22);
    display: flex;
    flex-direction: column;
    min-height: min(820px, calc(100vh - 48px));
    overflow: hidden;
    width: min(100%, 420px);
}

.psh-brand-header {
    align-items: center;
    background-color: #ffffff;
    display: flex;
    min-height: 72px;
    padding: 14px 8px;
}

.psh-brand-logo {
    display: block;
    height: auto;
    max-height: 48px;
    max-width: 100%;
    object-fit: contain;
    width: min(300px, 100%);
}

.psh-welcome-hero {
    flex: 1 1 480px;
    min-height: 430px;
    overflow: hidden;
    position: relative;
}

.psh-welcome-hero::after {
    background: linear-gradient(180deg, rgba(20, 18, 14, 0.04), rgba(20, 18, 14, 0.2));
    content: "";
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.psh-welcome-hero img {
    height: 100%;
    object-fit: cover;
    object-position: 50% 50%;
    width: 100%;
}

.psh-welcome-content {
    padding: 26px 28px 20px;
    text-align: center;
}

.psh-welcome-title {
    font-weight: 700;
}

.psh-welcome-subtitle {
    margin: 4px 0 18px !important;
}

.psh-welcome-title,
.psh-welcome-subtitle {
    white-space: nowrap;
}

@media (max-width: 767.98px) {
    .psh-welcome-title {
        font-size: clamp(0.85rem, 4vw, 1.25rem);
    }

    .psh-welcome-subtitle {
        font-size: clamp(0.62rem, 2.8vw, 0.875rem);
    }
}

.psh-welcome-login {
    box-shadow: 0 2px 6px rgba(58, 46, 31, 0.28);
}

.psh-auth-footer {
    color: var(--mud-palette-text-secondary);
    display: flex;
    flex-direction: column;
    font-size: 0.6rem;
    line-height: 1.45;
    padding: 18px 20px 24px;
    text-align: center;
}

.psh-login-shell {
    background-color: #eeeeee;
}

.psh-login-hero {
    background-image: url("../assets/brand/LoginPage_BG.png");
    background-position: 50% 42%;
    background-size: cover;
    border-radius: 8px 8px 0 0;
    height: 180px;
    margin: 28px 28px 0;
}

.psh-login-panel {
    background-color: rgba(255, 255, 255, 0.97) !important;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 0 0 8px 8px !important;
    margin: 0 28px;
    padding: 18px 16px 28px;
}

.psh-login-title {
    font-weight: 700;
}

.psh-login-rule {
    background-color: #dfc5a6;
    height: 2px;
    margin: 10px 0 24px;
}

.psh-login-error-slot {
    margin-bottom: 8px;
    min-height: 8px;
}

.psh-login-forget-password {
    margin: 14px 28px 0;
    text-align: center;
}

.psh-login-shell .psh-auth-footer {
    margin-top: auto;
}

/* Platform administration: organizations */
.psh-organizations-page {
    margin: 0 auto;
    max-width: 980px;
}

.psh-organizations-header {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.psh-organizations-title {
    font-weight: 700;
}

.psh-add-organization-button {
    flex-shrink: 0;
}

.psh-organizations-list {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
}

.psh-organizations-state {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    min-height: 220px;
    padding: 32px;
}

.psh-organization-name {
    align-items: center;
    display: flex;
    gap: 12px;
}

.psh-organization-dialog-title {
    align-items: center;
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.psh-organization-dialog-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 8px 2px 4px;
}

.psh-organization-dialog-actions {
    border-top: 1px solid var(--mud-palette-lines-default);
    display: flex;
    justify-content: center;
    margin: 0 -24px -8px;
    padding: 22px 24px 8px;
    width: calc(100% + 48px);
}

.psh-organization-submit {
    border-radius: 24px !important;
    min-width: 145px;
}

/* External organization: two-step case deletion request */
.psh-deletion-dialog-title {
    font-weight: 700;
    line-height: 1.3;
}

.psh-deletion-dialog-content {
    padding: 2px 0 6px;
}

.psh-deletion-summary-row {
    align-items: baseline;
    display: grid;
    font-size: 0.82rem;
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr);
    margin-bottom: 12px;
}

.psh-deletion-dialog-actions {
    border-top: 1px solid var(--mud-palette-lines-default);
    display: grid;
    gap: 18px;
    grid-template-columns: 1fr 1.35fr;
    margin: 0 -24px -8px;
    padding: 22px 20px 8px;
    width: calc(100% + 48px);
}

.psh-deletion-dialog-actions .mud-button-root {
    min-height: 40px;
}

.psh-deletion-dialog-actions .mud-button-filled {
    background-color: #fff4dc !important;
    color: var(--mud-palette-text-primary) !important;
}

/* Case PDF request dialog */
.psh-print-dialog-title {
    font-weight: 700;
}

.psh-print-dialog-content {
    padding: 2px 0 16px;
}

.psh-print-summary-row {
    align-items: baseline;
    display: grid;
    font-size: 0.82rem;
    gap: 8px;
    grid-template-columns: auto minmax(0, 1fr);
    margin-bottom: 12px;
}

.psh-print-dialog-actions {
    border-top: 1px solid var(--mud-palette-lines-default);
    display: grid;
    gap: 22px;
    grid-template-columns: 1fr 1.45fr;
    margin: 0 -24px -8px;
    padding: 22px 20px 8px;
    width: calc(100% + 48px);
}

.psh-print-dialog-actions .mud-button-root {
    min-height: 40px;
}

.psh-print-dialog-actions .mud-button-filled {
    background-color: #fff4dc !important;
    color: var(--mud-palette-text-primary) !important;
}

/* ===== Case Deletion Requests ===== */
.psh-deletion-page {
    background-color: #efefef;
}

.psh-deletion-section {
    background-color: #ffffff;
    border-bottom: 1px solid #dddddd;
    padding: 18px 20px;
}

.psh-deletion-section > h2 {
    color: #292929;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 12px;
}

.psh-deletion-section-header {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.psh-deletion-section-header > h2 {
    color: #292929;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.psh-deletion-section-toggle {
    flex: 0 0 auto;
}

.psh-deletion-section:not(.psh-deletion-summary-section) {
    padding: 10px 14px;
}

.psh-deletion-section:not(.psh-deletion-summary-section) .psh-deletion-section-header {
    margin-bottom: 6px;
}

.psh-deletion-section:not(.psh-deletion-summary-section) .psh-deletion-section-header > h2 {
    font-size: 0.82rem;
    line-height: 1.2;
}

.psh-deletion-section:not(.psh-deletion-summary-section) .psh-deletion-section-toggle {
    height: 28px;
    padding: 2px;
    width: 28px;
}

.psh-deletion-section:not(.psh-deletion-summary-section) .psh-deletion-section-toggle .mud-icon-root {
    font-size: 1.25rem;
}

.psh-deletion-summary-section {
    background-color: #efefef;
}

.psh-deletion-summary-card {
    border-color: #d5d5d5;
}

.psh-deletion-summary-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.psh-deletion-summary-grid > div {
    align-items: center;
    display: flex;
    flex-direction: column;
    min-width: 0;
    text-align: center;
}

.psh-deletion-summary-grid b {
    color: #9b511f;
    font-size: 1.35rem;
    line-height: 1.15;
}

.psh-deletion-summary-grid span {
    color: #777777;
    font-size: 0.62rem;
    line-height: 1.2;
    margin-top: 3px;
}

.psh-deletion-reasons-title {
    color: #555555;
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.psh-deletion-reason-row {
    align-items: center;
    display: grid;
    font-size: 0.66rem;
    gap: 8px;
    grid-template-columns: minmax(90px, 1fr) 1.4fr 34px;
    margin-top: 6px;
}

.psh-deletion-reason-row > span {
    color: #555555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psh-deletion-reason-row > b {
    color: #9b511f;
    text-align: right;
}

.psh-deletion-reason-track {
    background-color: #f1eadf;
    height: 7px;
    overflow: hidden;
}

.psh-deletion-reason-track > span {
    background-color: #e6bd7b;
    display: block;
    height: 100%;
}

.psh-pdf-export-summary-card .psh-deletion-reason-row {
    grid-template-columns: minmax(0, 1fr) minmax(52px, 80px) 34px;
}

.psh-pdf-export-summary-card .psh-deletion-reason-row > span {
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
}

/* ===== CSV Export & History ===== */
.psh-csv-page,
.psh-csv-history-page {
    background-color: #efefef;
}

.psh-csv-form-section {
    background-color: #ffffff;
    border-bottom: 1px solid #d8d8d8;
    padding: 18px 16px;
}

.psh-csv-intro-section {
    padding-top: 22px;
}

.psh-csv-range-section {
    background-color: #f3f3f3;
}

.psh-csv-geo-section {
    background-color: #edf2f8;
}

.psh-csv-section-title {
    font-weight: 700 !important;
    margin-bottom: 12px !important;
}

.psh-csv-page .mud-select .mud-input-label-inputcontrol,
.psh-csv-page .mud-select .mud-select-input {
    font-size: 0.82rem !important;
}

.psh-csv-date-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.psh-csv-province-box {
    background-color: rgba(255, 255, 255, 0.72);
    border: 1px solid #cfd5dc;
    border-radius: 4px;
    display: grid;
    gap: 2px;
    max-height: 190px;
    overflow-y: auto;
    padding: 10px 12px;
}

.psh-csv-fields-section {
    background-color: #ffffff;
}

.psh-csv-fields-heading {
    border-bottom: 1px solid #d8d8d8;
    display: grid;
    gap: 3px;
    padding: 18px 16px 12px;
}

.psh-csv-fields-heading .mud-typography:first-child {
    font-weight: 700;
}

.psh-csv-field-group {
    background-color: #eeeeee;
    border-bottom: 1px solid #bdbdbd;
}

.psh-csv-field-group > summary {
    align-items: center;
    background-color: #fff5e6;
    cursor: pointer;
    display: grid;
    gap: 6px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    list-style: none;
    min-height: 44px;
    padding: 6px 12px;
}

.psh-csv-field-group > summary::-webkit-details-marker {
    display: none;
}

.psh-csv-field-group > summary > span {
    font-size: 0.76rem;
    font-weight: 600;
}

.psh-csv-field-group[open] > summary > .mud-icon-root:last-child {
    transform: rotate(180deg);
}

/* Case section stepper: blue through the current step, then grey. */
.psh-section-step {
    position: relative;
}

.psh-section-step:not(.psh-section-step-last)::after {
    bottom: -8px;
    content: "";
    left: 27px;
    position: absolute;
    top: 32px;
    width: 2px;
    z-index: 0;
}

.psh-section-step-before::after {
    background-color: #333dff;
}

.psh-section-nav-current::after,
.psh-section-step-after::after {
    background-color: #bdbdbd;
}

.psh-section-step .mud-nav-link-icon {
    background-color: var(--mud-palette-drawer-background);
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

/* Completed keeps the full-size blue circle; only its centre check is smaller. */
.psh-section-step-completed:not(.psh-section-nav-current)::before {
    align-items: center;
    color: #ffffff;
    content: "\2713";
    display: flex;
    font-size: 0.58rem;
    font-weight: 700;
    height: 24px;
    justify-content: center;
    left: 16px;
    line-height: 1;
    pointer-events: none;
    position: absolute;
    top: 8px;
    width: 24px;
    z-index: 2;
}

/* Current step: blue outline, #f4f4f4 centre, and a small blue dot. */
.psh-section-nav-current .mud-nav-link-icon {
    background-color: #f4f4f4;
}

.psh-csv-field-grid {
    display: grid;
    column-gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 14px 14px;
    row-gap: 6px;
}

.psh-csv-field-option {
    align-items: flex-start;
    display: flex;
    min-width: 0;
}

.psh-csv-field-option .mud-checkbox {
    align-items: flex-start;
    min-width: 0;
}

.psh-csv-field-option .mud-checkbox > .mud-icon-button {
    align-self: flex-start;
    transform: translateY(-4px);
}

.psh-csv-page .psh-csv-field-option .mud-typography,
.psh-csv-page .psh-csv-field-option .mud-checkbox label,
.psh-csv-page .psh-csv-field-option .mud-input-label {
    font-size: 0.76rem !important;
    white-space: normal;
}

.psh-csv-page .psh-csv-field-option .mud-checkbox > .mud-typography {
    padding-top: 3px;
}

.psh-csv-submit-section {
    background-color: #ffffff;
    padding: 24px 16px 30px;
    text-align: center;
}

.psh-csv-submit-section .mud-button-root {
    border-radius: 22px;
    min-width: 150px;
}

.psh-csv-brand-button.mud-button-filled {
    background-color: #333dff !important;
    color: #ffffff !important;
}

.psh-logout-confirm-button.mud-button-filled {
    background-color: #333dff !important;
    color: #ffffff !important;
}

.psh-primary-contact-confirm-button.mud-button-filled {
    background-color: #333dff !important;
    color: #ffffff !important;
}

.psh-csv-dialog-actions .mud-button-root {
    text-transform: none;
}

.psh-csv-export-button.mud-button-outlined {
    background-color: #fff5e2;
    border-color: #5c554c;
    color: #292929;
}

.psh-csv-request-card .psh-deletion-case-ref b {
    font-size: 0.81rem;
}

.psh-csv-history-page .psh-pdf-hash,
.psh-csv-history-page .psh-deletion-info-grid b {
    overflow-wrap: anywhere;
}

.psh-deletion-info-grid > div > .psh-csv-status-pill {
    align-items: center;
    align-self: center;
    border-radius: 999px;
    color: #ffffff !important;
    display: inline-flex !important;
    font-size: 0.7rem !important;
    font-weight: 600;
    justify-content: center;
    justify-self: start !important;
    line-height: 1;
    min-height: 24px;
    padding: 5px 10px;
    white-space: nowrap;
    width: max-content !important;
}

.psh-csv-status-in-progress {
    background-color: #b26a00 !important;
}

.psh-csv-status-completed {
    background-color: #2e7d32 !important;
}

.psh-csv-status-failed {
    background-color: #d32f2f !important;
}

.psh-csv-status-default {
    background-color: #616161 !important;
}

.psh-csv-selected-fields-row {
    align-items: start !important;
}

.psh-csv-selected-fields {
    min-width: 0;
}

.psh-csv-selected-fields details {
    margin-top: 5px;
}

.psh-csv-selected-fields summary {
    color: #333dff;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
}

.psh-csv-selected-field-group {
    border-top: 1px solid #e2e2e2;
    display: grid;
    gap: 3px;
    padding: 7px 0;
}

.psh-csv-selected-field-group:first-of-type {
    margin-top: 6px;
}

.psh-csv-selected-field-group strong {
    color: #353535;
    font-size: 0.7rem;
}

.psh-csv-selected-field-group span {
    color: #777777;
    font-size: 0.66rem;
    overflow-wrap: anywhere;
}

.psh-deletion-history-section {
    background-color: #f7f7f7;
}

.psh-deletion-issue-section {
    background-color: #fff8ed;
}

.psh-deletion-request-card {
    background-color: #ffffff;
    border: 1px solid #d9d9d9;
    border-radius: 7px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    margin-top: 8px;
    padding: 10px 10px 8px;
}

.psh-deletion-request-head {
    align-items: flex-start;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.psh-deletion-case-ref {
    display: grid;
    gap: 2px;
    overflow-wrap: anywhere;
}

.psh-deletion-case-ref span {
    color: #8a8a8a;
    font-size: 0.56rem;
}

.psh-deletion-case-ref b {
    color: #292929;
    font-size: 0.76rem;
    font-weight: 700;
}

.psh-deletion-request-meta {
    border-bottom: 1px solid #e0e0e0;
    display: grid;
    gap: 4px;
    margin-top: 8px;
    padding-bottom: 7px;
}

.psh-deletion-request-meta > div,
.psh-deletion-info-grid > div {
    align-items: baseline;
    display: grid;
    gap: 8px;
    grid-template-columns: 92px minmax(0, 1fr);
}

.psh-deletion-request-meta span {
    color: #777777;
    font-size: 0.59rem;
}

.psh-deletion-request-meta b {
    color: #353535;
    font-size: 0.65rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.psh-deletion-info-grid span {
    color: #777777;
    font-size: 0.66rem;
}

.psh-deletion-info-grid b {
    color: #353535;
    font-size: 0.72rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.psh-deletion-grace-row b {
    color: #b26a00;
}

.psh-deletion-request-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    padding-top: 6px;
}

.psh-deletion-request-card .mud-chip {
    font-size: 0.68rem;
    height: 24px;
}

.psh-deletion-request-actions .mud-button-root {
    font-size: 0.75rem;
}

.psh-deletion-request-actions .mud-button-root:first-child {
    margin-right: auto;
}

.psh-deletion-card-action {
    min-height: 28px !important;
    min-width: 76px;
    padding-inline: 12px !important;
    width: auto;
}

.psh-deletion-section:not(.psh-deletion-summary-section) > .mud-typography-body2 {
    font-size: 0.75rem;
}

.psh-deletion-info-grid {
    display: grid;
    gap: 9px;
}

.psh-deletion-info-panel {
    border: 1px solid #d3d3d3;
    border-radius: 10px;
    overflow: hidden;
}

.psh-deletion-info-section {
    padding: 16px 14px;
}

.psh-deletion-info-section + .psh-deletion-info-section {
    border-top: 1px solid #d7d7d7;
}

.psh-deletion-info-grid > div {
    grid-template-columns: 112px minmax(0, 1fr);
}

.psh-deletion-info-failure {
    color: var(--mud-palette-error) !important;
}

.psh-pdf-hash-row {
    grid-column: 1 / -1;
}

.psh-pdf-hash {
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
}

.psh-deletion-info-grid .psh-deletion-info-status-chip {
    color: #ffffff !important;
    justify-self: start;
    width: fit-content !important;
}

.psh-deletion-info-status-chip .mud-chip-content {
    color: #ffffff !important;
}

.psh-deletion-dialog-close.mud-button-outlined {
    border-color: #222222 !important;
    color: #222222 !important;
}

.psh-deletion-dialog-confirm.mud-button-filled {
    background-color: #333dff !important;
    color: #ffffff !important;
}

/* Shared dialog actions: keep primary and secondary actions aligned across dialogs. */
.mud-dialog-actions .mud-button-root {
    border-radius: 20px !important;
    font-size: 0.875rem;
    font-weight: 600;
    min-height: 40px;
    min-width: 120px;
    padding-inline: 20px;
    text-transform: none;
}

/* Submit / Confirm / Save actions. */
.mud-dialog-actions .mud-button-filled:not(:disabled) {
    background-color: #333dff !important;
    color: #ffffff !important;
}

/* Cancel / Back / Close actions, including existing text-button markup. */
.mud-dialog-actions .mud-button-root:not(.mud-button-filled) {
    background-color: #ffffff !important;
    border: 1px solid #333333 !important;
}

.mud-dialog-actions .mud-button-root:not(.mud-button-filled):not(:disabled) {
    color: #222222 !important;
}

/* ===== 8-section dialogs =====
   保留各表單 layout 差異，統一相同資訊層級的字體與操作尺寸。 */
.psh-section-dialog .mud-dialog-title .mud-typography-h6 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.3;
}

.psh-section-dialog .mud-typography-subtitle2 {
    font-size: 1.06rem;
    font-weight: 600;
}

.psh-section-dialog .mud-typography-body2 {
    font-size: 0.84rem;
}

.psh-section-dialog .mud-typography-caption {
    font-size: 0.75rem;
}

.psh-section-dialog .mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
    font-size: 1rem;
}

.psh-section-dialog .mud-input,
.psh-section-dialog .mud-input-root,
.psh-section-dialog .mud-select-input {
    font-size: 1.06rem;
}

.psh-section-dialog .mud-input-helper-text,
.psh-section-dialog .mud-input-error {
    font-size: 0.7rem;
}

.psh-section-dialog .mud-radio-content,
.psh-section-dialog .mud-checkbox .mud-typography {
    font-size: 0.82rem;
}

.psh-section-dialog .mud-alert-message {
    font-size: 0.78rem;
}

.psh-section-dialog .mud-dialog-actions .mud-button-root {
    border-radius: 20px !important;
    font-size: 0.94rem;
    min-height: 40px;
    min-width: 120px;
    padding-inline: 20px;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-section-dialog .mud-dialog-title .mud-typography-h6 {
        font-size: 1rem;
    }

    .psh-section-dialog .mud-typography-subtitle2 {
        font-size: 0.96rem;
    }

    .psh-section-dialog .mud-typography-body2,
    .psh-section-dialog .mud-typography-caption {
        font-size: 0.72rem;
    }

    .psh-section-dialog .mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
        font-size: 0.9rem;
    }

    .psh-section-dialog .mud-input,
    .psh-section-dialog .mud-input-root,
    .psh-section-dialog .mud-select-input {
        font-size: 0.96rem;
    }

    .psh-section-dialog .mud-input-helper-text,
    .psh-section-dialog .mud-input-error {
        font-size: 0.64rem;
    }

    .psh-section-dialog .mud-radio-content,
    .psh-section-dialog .mud-checkbox .mud-typography {
        font-size: 0.74rem;
    }

    .psh-section-dialog .mud-alert-message {
        font-size: 0.7rem;
    }

    .psh-section-dialog .mud-dialog-actions .mud-button-root {
        border-radius: 18px !important;
        font-size: 0.84rem;
        min-height: 36px;
        min-width: 100px;
        padding-inline: 16px;
    }

    /* Sign out：手機版比照 section dialog 的字體與操作尺寸。 */
    .psh-logout-dialog .mud-dialog-title .mud-typography-h6 {
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .psh-logout-dialog .mud-dialog-content .mud-typography-body1 {
        font-size: 0.84rem;
    }

    .psh-logout-dialog .mud-dialog-actions .mud-button-root {
        border-radius: 18px !important;
        font-size: 0.84rem;
        min-height: 36px;
        min-width: 100px;
        padding-inline: 16px;
    }

    /* Create New User / Add Institution / Session Expiring：手機版使用相同的資訊層級。 */
    .psh-create-user-dialog .mud-dialog-title .mud-typography-h6,
    .psh-add-institution-dialog .mud-dialog-title .mud-typography-h6,
    .psh-renew-session-dialog .mud-dialog-title .mud-typography-h6 {
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.3;
    }

    .psh-create-user-dialog .mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol,
    .psh-add-institution-dialog .mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol,
    .psh-renew-session-dialog .mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
        font-size: 0.9rem;
    }

    .psh-create-user-dialog .mud-input,
    .psh-create-user-dialog .mud-input-root,
    .psh-create-user-dialog .mud-select-input,
    .psh-add-institution-dialog .mud-input,
    .psh-add-institution-dialog .mud-input-root,
    .psh-add-institution-dialog .mud-select-input,
    .psh-renew-session-dialog .mud-input,
    .psh-renew-session-dialog .mud-input-root,
    .psh-renew-session-dialog .mud-select-input {
        font-size: 0.96rem;
    }

    /* Add New Case / Add Institution：iOS 不一定繼承 input 字級，
       因此直接指定手機 placeholder，且不改變已輸入的內容字級。 */
    .psh-create-case input.mud-input-root::placeholder,
    .psh-create-case textarea.mud-input-root::placeholder,
    .psh-add-institution-dialog input.mud-input-root::placeholder,
    .psh-add-institution-dialog textarea.mud-input-root::placeholder,
    .psh-create-case input.mud-input-root::-webkit-input-placeholder,
    .psh-create-case textarea.mud-input-root::-webkit-input-placeholder,
    .psh-add-institution-dialog input.mud-input-root::-webkit-input-placeholder,
    .psh-add-institution-dialog textarea.mud-input-root::-webkit-input-placeholder {
        font-size: 0.88rem !important;
    }

    .psh-create-user-dialog .mud-input-helper-text,
    .psh-create-user-dialog .mud-input-error,
    .psh-add-institution-dialog .mud-input-helper-text,
    .psh-add-institution-dialog .mud-input-error,
    .psh-renew-session-dialog .mud-input-helper-text,
    .psh-renew-session-dialog .mud-input-error {
        font-size: 0.64rem;
    }

    .psh-create-user-dialog .mud-typography-body2,
    .psh-add-institution-dialog .mud-typography-body2,
    .psh-renew-session-dialog .mud-typography-body2 {
        font-size: 0.72rem;
    }

    .psh-create-user-dialog .mud-alert-message,
    .psh-add-institution-dialog .mud-alert-message,
    .psh-renew-session-dialog .mud-alert-message {
        font-size: 0.7rem;
    }

    .psh-create-user-dialog .mud-dialog-actions .mud-button-root,
    .psh-add-institution-dialog .mud-dialog-actions .mud-button-root,
    .psh-renew-session-dialog .mud-dialog-actions .mud-button-root {
        border-radius: 18px !important;
        font-size: 0.84rem;
        min-height: 36px;
        min-width: 100px;
        padding-inline: 16px;
    }
}

@media (max-width: 480px) {
    .psh-organizations-header {
        align-items: stretch;
        flex-direction: column;
    }

    .psh-add-organization-button {
        align-self: flex-start;
    }

    .psh-workspace-page {
        max-width: none;
    }

    .psh-workspace-section {
        padding: 22px 18px;
    }

    .psh-workspace-search-row {
        /* 窄螢幕：欄位縮到約一半，三顆靠左排，Search/Clear 不再被擠到右邊 */
        grid-template-columns: auto auto auto;
        justify-content: start;
        gap: 6px;
    }

    .psh-workspace-search-field {
        width: 180px;   /* 約原本一半再 +20%，12 碼顯示更寬鬆 */
    }

    .psh-auth-page {
        padding: 0;
    }

    .psh-auth-shell {
        box-shadow: none;
        min-height: 100vh;
        width: 100%;
    }

    .psh-welcome-hero {
        min-height: 420px;
    }

    .psh-deletion-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        row-gap: 12px;
    }
}

/* Welcome：手機依實際可見高度分配品牌、主圖、Login 與 footer，
   避免固定 420px 主圖把 Login 推到首屏之外。 */
@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-welcome-page {
        min-height: 100svh;
        padding: 0;
    }

    .psh-welcome-shell {
        box-shadow: none;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        width: 100%;
    }

    .psh-welcome-shell .psh-brand-header {
        min-height: clamp(52px, 10dvh, 64px);
        padding: clamp(6px, 1.5dvh, 10px) 8px;
    }

    .psh-welcome-shell .psh-brand-logo {
        max-height: clamp(38px, 7dvh, 46px);
    }

    .psh-welcome-hero {
        flex: 1 1 auto;
        min-height: 80px;
    }

    .psh-welcome-content {
        flex: 0 0 auto;
        padding: clamp(12px, 2.4dvh, 20px) 20px clamp(10px, 2dvh, 16px);
    }

    .psh-welcome-subtitle {
        margin: 3px 0 clamp(10px, 2dvh, 16px) !important;
    }

    .psh-welcome-shell .psh-auth-footer {
        flex: 0 0 auto;
        padding: clamp(8px, 1.5dvh, 14px) 16px clamp(10px, 2dvh, 18px);
    }
}

/* ===== Static national dashboard mockup (reference screens 1–3) ===== */
.psh-dashboard-detail {
    background-color: #e8e8e8;
    color: #372b21;
}

.psh-dashboard-detail-header {
    background-color: #ffffff;
    border-bottom: 1px solid #b9b9b9;
    padding: 13px 17px 0;
}

.psh-dashboard-detail-back {
    align-items: center;
    background: none;
    border: 0;
    color: #6f6a66;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.78rem;
    gap: 1px;
    margin-bottom: 9px;
    padding: 0;
}

.psh-dashboard-detail-back:hover {
    color: #372b21;
}

.psh-dashboard-detail-back:focus-visible {
    border-radius: 4px;
    outline: 2px solid var(--mud-palette-info);
    outline-offset: 2px;
}

.psh-dashboard-detail-title-row,
.psh-dashboard-detail-title {
    align-items: center;
    display: flex;
}

.psh-dashboard-detail-title-row {
    justify-content: space-between;
}

.psh-dashboard-detail-title {
    gap: 6px;
}

.psh-dashboard-detail-title h1 {
    color: #29231f;
    font-size: 1.18rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.psh-dashboard-detail-title-row > span {
    color: #625d59;
    font-size: 0.55rem;
    white-space: nowrap;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-dashboard-detail-title-row {
        flex-wrap: wrap;
        row-gap: 5px;
    }

    .psh-dashboard-detail-title-row > span {
        flex: 0 0 100%;
        order: -1;
        text-align: right;
    }

    .psh-dashboard-detail-title h1 {
        white-space: nowrap;
    }
}

.psh-dashboard-detail-scope {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin: 8px -17px 0;
}

.psh-dashboard-detail-scope button {
    background: transparent;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    border-bottom: 3px solid transparent;
    color: #37322e;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.68rem;
    padding: 10px 4px 8px;
    text-align: center;
}

.psh-dashboard-detail-scope button:disabled {
    cursor: wait;
    opacity: 0.62;
}

.psh-dashboard-detail-scope .is-active {
    border-bottom-color: #335a36;
    font-weight: 700;
}

.psh-dashboard-detail-scope button:focus-visible {
    background-color: #f7f4ef;
    outline: 2px solid var(--mud-palette-info);
    outline-offset: -2px;
}

.psh-dashboard-detail-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 14px 18px;
}

.psh-dashboard-scope-filter {
    background-color: #ffffff;
    display: grid;
    gap: 8px;
    margin: -14px -14px 0;
    padding: 14px;
}

.psh-dashboard-chapter-filter {
    align-items: center;
    grid-template-columns: 78px minmax(0, 1fr);
}

.psh-dashboard-institution-filter {
    align-items: center;
    grid-template-columns: 78px minmax(0, 1fr);
}

.psh-dashboard-scope-filter label {
    color: #443d37;
    font-size: 0.68rem;
    font-weight: 600;
}

.psh-dashboard-scope-select {
    align-items: center;
    background-color: #f4f4f4;
    border: 1px solid #393939;
    border-radius: 4px;
    color: #37322e;
    display: flex;
    font-size: 0.62rem;
    justify-content: space-between;
    min-height: 34px;
    padding: 5px 8px;
}

select.psh-dashboard-scope-select {
    cursor: pointer;
    width: 100%;
}

select.psh-dashboard-scope-select:disabled {
    cursor: wait;
    opacity: 0.7;
}

.psh-dashboard-chapter-select {
    max-width: 100%;
    min-width: 0;
    width: 100%;
}

.psh-dashboard-chapter-select .mud-input-control,
.psh-dashboard-chapter-select .mud-input,
.psh-dashboard-chapter-select .mud-input-slot,
.psh-dashboard-chapter-select .mud-select-input {
    min-width: 0;
}

.psh-dashboard-chapter-select .mud-input-slot {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.psh-dashboard-chapter-select .mud-input-adornment {
    flex: 0 0 auto;
}

.psh-dashboard-chapter-select .mud-input,
.psh-dashboard-chapter-select .mud-select-input,
.psh-dashboard-chapter-select input.mud-input-root,
.psh-dashboard-chapter-select div.mud-input-slot,
.psh-dashboard-chapter-select-list .mud-list-item {
    font-size: 0.68rem !important;
}

.psh-dashboard-section-heading {
    color: #4a433d;
    font-size: 0.65rem;
    font-style: italic;
    margin: -2px 0 -2px;
    text-align: center;
}

.psh-dashboard-institutions-card h2 em {
    color: #a76636;
    font-style: normal;
}

.psh-dashboard-institutions-layout {
    display: grid;
    gap: 12px;
    grid-template-columns: 105px 1fr;
    margin-top: 10px;
}

.psh-dashboard-region-total {
    align-items: center;
    border-right: 1px solid #e8cda3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.psh-dashboard-region-total small {
    color: #8a8179;
    font-size: 0.48rem;
}

.psh-dashboard-region-total strong {
    color: #53311d;
    font-size: 2rem;
    line-height: 1.15;
}

.psh-dashboard-province-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
    max-height: 126px;
    overflow-y: auto;
    padding-right: 5px;
}

.psh-dashboard-province-list > div {
    align-items: center;
    display: flex;
    font-size: 0.48rem;
    justify-content: space-between;
}

.psh-dashboard-province-list b {
    color: #4d4640;
    font-weight: 600;
}

.psh-dashboard-province-list span:last-child {
    color: #9b502a;
    font-weight: 700;
}

.psh-dashboard-province-head {
    color: #837b74;
    font-size: 0.44rem !important;
    margin-bottom: 2px;
}

.psh-dashboard-province-head span:last-child {
    color: #837b74;
    font-weight: 400;
}

.psh-dashboard-detail-card {
    background-color: #ffffff;
    border: 1px solid #d3d3d3;
    border-radius: 7px;
    box-shadow: 0 2px 6px rgba(32, 25, 20, 0.14);
    padding: 14px;
}

.psh-dashboard-detail-card h2 {
    color: #4b433d;
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.psh-dashboard-detail-card h2 em {
    color: #a76636;
    font-style: normal;
}

.psh-dashboard-total-card .psh-dashboard-title-accent {
    color: #e05a2b;
}

.psh-dashboard-total-card .psh-dashboard-total-stats > strong {
    color: #1f1f1f;
}

.psh-dashboard-total-card .psh-dashboard-total-lines span {
    color: #555;
}

.psh-dashboard-total-card .psh-dashboard-total-lines b {
    color: #2f2f2f;
}

.psh-dashboard-collapsible-header {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.psh-dashboard-collapsible-actions {
    align-items: center;
    display: flex;
    margin-left: auto;
}

.psh-dashboard-collapse-button {
    align-items: center;
    background: transparent;
    border: 0;
    color: #69615b;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 20px;
    justify-content: center;
    padding: 2px;
    width: 20px;
}

.psh-dashboard-collapse-button i {
    border-bottom: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    display: block;
    height: 6px;
    transform: rotate(225deg) translate(-1px, -1px);
    transition: transform 0.15s ease;
    width: 6px;
}

.psh-dashboard-collapse-button.is-collapsed i {
    transform: rotate(45deg) translate(-1px, -1px);
}

.psh-dashboard-collapse-button:hover {
    color: #282421;
}

.psh-dashboard-collapse-button:focus-visible {
    border-radius: 3px;
    outline: 2px solid #555;
    outline-offset: 2px;
}

.psh-dashboard-collapsible-content {
    min-width: 0;
}

.psh-dashboard-total-stats {
    align-items: end;
    border-bottom: 1px solid #e7d7c3;
    display: grid;
    gap: 12px;
    grid-template-columns: 1.55fr 1fr 1fr;
    margin: 13px 0 9px;
    padding-bottom: 10px;
}

.psh-dashboard-total-stats > strong {
    color: #52301e;
    font-size: 2rem;
    line-height: 0.95;
}

.psh-dashboard-total-stats.psh-dashboard-total-only {
    grid-template-columns: 1fr;
}

.psh-dashboard-total-stats > div {
    display: flex;
    flex-direction: column;
}

.psh-dashboard-total-stats small {
    color: #615b56;
    font-size: 0.54rem;
}

.psh-dashboard-total-stats b {
    color: #52301e;
    font-size: 1rem;
}

.psh-dashboard-total-lines {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.psh-dashboard-total-lines > div {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    font-size: 0.54rem;
    gap: 4px;
}

.psh-dashboard-total-lines span {
    color: #5f5954;
}

.psh-dashboard-total-lines b {
    color: #3f3731;
}

.psh-dashboard-target-badge {
    background-color: #fff1d5;
    border: 1px solid #c9ab74;
    border-radius: 3px;
    color: #594324 !important;
    font-size: 0.48rem;
    font-weight: 700;
    margin-left: auto;
    padding: 2px 5px;
}

.psh-dashboard-card-header {
    align-items: center;
    display: flex;
    justify-content: space-between;
}

.psh-dashboard-fake-select {
    background-color: #fff5e1;
    border: 1px solid #d1b887;
    border-radius: 3px;
    color: #55483a;
    font-size: 0.55rem;
    padding: 4px 8px;
}

.psh-dashboard-chart-legend {
    align-items: center;
    display: flex;
    font-size: 0.52rem;
    gap: 12px;
    margin: 9px 0 5px;
}

.psh-dashboard-chart-legend span {
    align-items: center;
    display: flex;
    gap: 4px;
}

.psh-dashboard-chart-legend i {
    border-radius: 50%;
    display: inline-block;
    height: 6px;
    width: 6px;
}

.psh-dashboard-detail .male {
    background-color: #793b16;
}

.psh-dashboard-detail .female {
    background-color: #f2a0aa;
}

.psh-dashboard-vertical-chart,
.psh-dashboard-grouped-chart {
    border-bottom: 1px solid #cbbba5;
    border-left: 1px solid #cbbba5;
    display: grid;
    height: 165px;
    margin: 4px 4px 18px 24px;
    position: relative;
}

.psh-dashboard-y-grid {
    background-image: repeating-linear-gradient(to bottom, #e8ded1 0, #e8ded1 1px, transparent 1px, transparent 33px);
    inset: 0;
    pointer-events: none;
    position: absolute;
}

.psh-dashboard-month-chart {
    height: 190px;
    margin-bottom: 34px;
    margin-left: 28px;
    margin-top: 10px;
}

.psh-dashboard-month-chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 22px;
    padding-top: 6px;
}

.psh-dashboard-month-chart .psh-dashboard-y-grid {
    background-image: linear-gradient(to bottom, #e8ded1 1px, transparent 1px);
    background-size: 100% 20%;
}

.psh-dashboard-month-axis {
    bottom: -4px;
    color: #817870;
    display: flex;
    flex-direction: column;
    font-size: 0.42rem;
    justify-content: space-between;
    left: -28px;
    position: absolute;
    text-align: right;
    top: -4px;
    width: 23px;
}

.psh-dashboard-month-group,
.psh-dashboard-grouped-item {
    align-items: center;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: flex-end;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.psh-dashboard-month-values,
.psh-dashboard-grouped-bars {
    align-items: flex-end;
    display: flex;
    height: 100%;
    justify-content: center;
    width: 100%;
}

.psh-dashboard-month-values span,
.psh-dashboard-grouped-bars span {
    height: var(--chart-height);
    max-width: 18px;
    position: relative;
    width: 31%;
}

.psh-dashboard-month-values b,
.psh-dashboard-grouped-bars b {
    background: transparent;
    color: #4b433d;
    font-size: 0.37rem;
    font-weight: 600;
    left: 50%;
    position: absolute;
    top: -10px;
    transform: translateX(-50%);
    white-space: nowrap;
}

.psh-dashboard-month-group > small {
    align-items: center;
    bottom: -34px;
    color: #6e6761;
    display: flex;
    flex-direction: column;
    font-size: 0.48rem;
    font-style: normal;
    gap: 0;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.psh-dashboard-month-group > small b {
    color: #948b84;
    font-size: 0.42rem;
    font-weight: 500;
}

.psh-dashboard-region-table-wrap {
    margin-top: 7px;
    overflow-x: auto;
}

.psh-dashboard-region-table {
    border-collapse: collapse;
    color: #443d37;
    font-size: 0.49rem;
    table-layout: fixed;
    width: 100%;
}

.psh-dashboard-region-name-column {
    width: 34%;
}

.psh-dashboard-region-table th,
.psh-dashboard-region-table td {
    border: 1px solid #d5c9b8;
    height: 21px;
    padding: 2px 4px;
    text-align: left;
}

.psh-dashboard-region-name {
    font-size: 0.49rem;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.psh-dashboard-region-name.is-long {
    font-size: 0.44rem;
}

.psh-dashboard-region-name.is-very-long {
    font-size: 0.39rem;
}

.psh-dashboard-region-empty {
    color: #81776f;
    padding: 12px 4px !important;
    text-align: center !important;
}

.psh-dashboard-region-toggle {
    align-items: center;
    color: #71675f;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.5rem;
    gap: 5px;
    user-select: none;
}

.psh-dashboard-region-toggle input {
    height: 1px;
    opacity: 0;
    position: absolute;
    width: 1px;
}

.psh-dashboard-region-toggle-track {
    align-items: center;
    background: #fff;
    border: 1px solid #aaa;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-flex;
    height: 19px;
    padding: 2px;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    width: 32px;
}

.psh-dashboard-region-toggle-track i {
    background: #999;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgb(0 0 0 / 20%);
    display: block;
    height: 15px;
    transition: transform 0.15s ease;
    width: 15px;
}

.psh-dashboard-region-toggle input:checked + .psh-dashboard-region-toggle-track {
    background: #999;
    border-color: #999;
}

.psh-dashboard-region-toggle input:checked + .psh-dashboard-region-toggle-track i {
    background: #fff;
    transform: translateX(11px);
}

.psh-dashboard-region-toggle input:focus-visible + .psh-dashboard-region-toggle-track {
    outline: 2px solid #666;
    outline-offset: 2px;
}

.psh-dashboard-region-table th {
    background-color: #faf6ef;
    color: #29231f;
    font-weight: 700;
}

.psh-dashboard-age-chart {
    margin-top: 2px;
}

.psh-dashboard-age-chart svg {
    display: block;
    height: auto;
    width: 100%;
}

.psh-dashboard-age-chart .grid line {
    stroke: #e5dbce;
    stroke-width: 1;
}

.psh-dashboard-age-chart .center {
    stroke: #8d857d;
    stroke-width: 1;
}

.psh-dashboard-age-chart .male-area {
    fill: #793b16;
}

.psh-dashboard-age-chart .female-area {
    fill: #f2a0aa;
}

.psh-dashboard-age-chart .labels {
    fill: #817a73;
    font-size: 7px;
}

.psh-dashboard-hypertension-profile {
    padding-top: 0;
}

.psh-dashboard-profile-heading {
    font-size: 0.8rem;
    font-style: italic;
    padding: 11px 0 0;
    text-align: center;
}

.psh-dashboard-profile-section {
    background: #ece8e4;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px -8px -6px;
    padding: 0 8px 12px;
}

.psh-dashboard-profile-section .psh-dashboard-profile-heading {
    padding: 13px 0 1px;
}

.psh-dashboard-grouped-chart {
    grid-template-columns: repeat(3, 1fr);
    height: 145px;
}

.psh-dashboard-whtr-chart {
    margin-bottom: 32px;
}

.psh-dashboard-grouped-item > strong {
    bottom: -17px;
    color: #3c3631;
    font-size: 0.52rem;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.psh-dashboard-grouped-item > small {
    bottom: -27px;
    color: #807870;
    font-size: 0.43rem;
    left: 50%;
    position: absolute;
    transform: translateX(-50%);
    white-space: nowrap;
}

.psh-dashboard-horizontal-chart {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 10px;
}

.psh-dashboard-horizontal-row {
    align-items: center;
    display: grid;
    gap: 7px;
    grid-template-columns: 68px 1fr;
}

.psh-dashboard-horizontal-row > div:first-child {
    display: flex;
    flex-direction: column;
}

.psh-dashboard-horizontal-row strong {
    color: #403934;
    font-size: 0.5rem;
    font-weight: 600;
}

.psh-dashboard-horizontal-row small {
    color: #7c756f;
    font-size: 0.45rem;
}

.psh-dashboard-horizontal-bars {
    background-image: repeating-linear-gradient(to right, #e7ddd0 0, #e7ddd0 1px, transparent 1px, transparent 42px);
    border-left: 1px solid #cbbba5;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-height: 25px;
}

.psh-dashboard-horizontal-bars span {
    display: block;
    height: 11px;
    max-width: 100%;
    position: relative;
    width: var(--chart-width);
}

.psh-dashboard-horizontal-bars b {
    background: transparent;
    color: #5e5751;
    font-size: 0.38rem;
    left: calc(100% + 3px);
    position: absolute;
    top: 2px;
    white-space: nowrap;
}

.psh-dashboard-diagnosis-chart {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: 150px;
    margin-left: 28px;
}

.psh-dashboard-diagnosis-chart .psh-dashboard-y-grid {
    background-image: linear-gradient(to bottom, #e8ded1 1px, transparent 1px);
    background-size: 100% 20%;
}

.psh-dashboard-diagnosis-axis {
    bottom: -4px;
    color: #817870;
    display: flex;
    flex-direction: column;
    font-size: 0.42rem;
    justify-content: space-between;
    left: -28px;
    position: absolute;
    text-align: right;
    top: -4px;
    width: 23px;
}

.psh-dashboard-diagnosis-chart .psh-dashboard-grouped-item > strong {
    bottom: -20px;
}

.psh-dashboard-bp-grid {
    align-items: start;
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 1fr;
}

.psh-dashboard-bp-card {
    min-width: 0;
}

.psh-dashboard-bp-card h2 span {
    color: #b28d3b;
    font-size: 0.62rem;
}

.psh-dashboard-bp-card .psh-dashboard-collapsible-content {
    display: flex;
    flex-direction: column;
}

.psh-dashboard-bp-card .psh-dashboard-collapsible-content > small {
    color: #817a73;
    font-size: 0.43rem;
    margin: 2px 0 7px;
}

.psh-dashboard-bp-card .psh-dashboard-collapsible-content > strong {
    color: #6a3214;
    font-size: 1.85rem;
    line-height: 1;
}

.psh-dashboard-bp-card .psh-dashboard-collapsible-content > b {
    color: #403934;
    font-size: 0.5rem;
    margin-top: 5px;
}

.psh-dashboard-bp-card .psh-dashboard-collapsible-content > p {
    color: #706862;
    font-size: 0.44rem;
    margin: 6px 0 0;
}

.psh-dashboard-bp-card .psh-dashboard-collapsible-content > p em {
    color: #9e4e24;
    font-style: normal;
    font-weight: 700;
}

.psh-dashboard-comorbidity-chart .psh-dashboard-horizontal-row {
    grid-template-columns: 98px 1fr;
}

.psh-dashboard-title-note {
    color: #8c847e;
    font-size: 0.56rem;
    font-weight: 400;
}

.psh-dashboard-lifestyle-grid,
.psh-dashboard-lifestyle-legend {
    --lifestyle-never: #a89886;
    --lifestyle-rarely: #e66718;
    --lifestyle-sometimes: #7a3d17;
    --lifestyle-often: #e9ddcf;
}

.psh-dashboard-lifestyle-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
    margin-top: 12px;
}

.psh-dashboard-lifestyle-item {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.psh-dashboard-lifestyle-visual {
    align-items: center;
    display: grid;
    justify-items: center;
    min-height: 95px;
    width: 100%;
}

.psh-dashboard-pie {
    height: 72px;
    max-width: 130px;
    overflow: visible;
    transform: translateX(-5px);
    width: 100%;
}

.psh-dashboard-pie-slice {
    stroke: #fff;
    stroke-width: 0.75;
}

.psh-dashboard-pie-count {
    overflow: visible;
    pointer-events: none;
}

.psh-dashboard-pie-count div {
    align-items: center;
    color: #392e27;
    display: flex;
    font-size: 12.67px;
    font-weight: 800;
    height: 100%;
    justify-content: center;
    line-height: 1;
    width: 100%;
}

.psh-dashboard-pie-label text {
    dominant-baseline: middle;
    font-size: 12.67px;
    font-weight: 800;
    paint-order: stroke;
    pointer-events: none;
    stroke: #fff;
    stroke-linejoin: round;
    stroke-width: 2.2px;
}

.psh-dashboard-lifestyle-item strong {
    color: #443d37;
    font-size: 0.57rem;
}

.psh-dashboard-lifestyle-legend {
    border-top: 1px solid #e2dbd2;
    display: grid;
    font-size: 0.57rem;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 11px;
    padding-top: 8px;
}

.psh-dashboard-lifestyle-legend span {
    align-items: center;
    display: flex;
    gap: 4px;
    justify-content: center;
    min-width: 0;
    white-space: nowrap;
}

.psh-dashboard-lifestyle-legend i {
    display: inline-block;
    height: 3px;
    width: 16px;
}

.psh-dashboard-lifestyle-legend .never { background-color: var(--lifestyle-never); }
.psh-dashboard-lifestyle-legend .rarely { background-color: var(--lifestyle-rarely); }
.psh-dashboard-lifestyle-legend .sometimes { background-color: var(--lifestyle-sometimes); }
.psh-dashboard-lifestyle-legend .often { background-color: var(--lifestyle-often); }

.psh-dashboard-state {
    align-items: center;
    background: #fff;
    border: 1px solid #e5ddd5;
    border-radius: 10px;
    color: #5f554d;
    display: flex;
    gap: 12px;
    justify-content: center;
    min-height: 180px;
    padding: 24px;
}

.psh-dashboard-state-error {
    color: #9b321f;
    flex-wrap: wrap;
}

.psh-dashboard-state-nowrap {
    white-space: nowrap;
}

@media (max-width: 767.98px), (max-width: 959.98px) and (max-height: 600px) and (pointer: coarse) {
    .psh-dashboard-state-nowrap {
        font-size: clamp(0.5rem, 2.65vw, 0.85rem);
    }
}

.psh-dashboard-inline-error {
    align-items: center;
    background: #fff2ef;
    border: 1px solid #d8a096;
    border-radius: 6px;
    color: #8b2f20;
    display: flex;
    font-size: 0.55rem;
    gap: 7px;
    padding: 8px 10px;
}

.psh-dashboard-inline-error span {
    flex: 1;
}

.psh-dashboard-inline-error button {
    background: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    font-size: inherit;
    font-weight: 700;
    padding: 2px 4px;
    text-decoration: underline;
}

.psh-dashboard-state button {
    background: #a84620;
    border: 0;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    padding: 7px 14px;
}

.psh-dashboard-summary-classification {
    border-bottom: 1px solid #e8e0d8;
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 8px 0;
    padding: 8px 0;
}

.psh-dashboard-summary-classification span {
    color: #796f67;
    display: flex;
    flex-direction: column;
    font-size: 0.48rem;
}

.psh-dashboard-summary-classification b {
    color: #443d37;
    font-size: 0.68rem;
}

.psh-dashboard-select-label select {
    background: #fff;
    border: 1px solid #d9cec5;
    border-radius: 5px;
    color: #5d5149;
    font-size: 0.55rem;
    font-style: normal;
    padding: 4px 22px 4px 7px;
}

.psh-dashboard-quality {
    background: #faf4ed;
    border-left: 3px solid #d37a44;
    color: #72594a;
    font-size: 0.52rem;
    line-height: 1.45;
    margin-top: 10px;
    padding: 7px 9px;
}

.psh-dashboard-quality > summary {
    align-items: center;
    cursor: pointer;
    display: flex;
    font-weight: 600;
    justify-content: space-between;
    list-style: none;
}

.psh-dashboard-quality > summary::-webkit-details-marker {
    display: none;
}

.psh-dashboard-quality > summary::after {
    border-bottom: 1.5px solid currentColor;
    border-right: 1.5px solid currentColor;
    content: "";
    display: block;
    height: 6px;
    transform: rotate(45deg) translate(-1px, -1px);
    transition: transform 0.15s ease;
    width: 6px;
}

.psh-dashboard-quality[open] > summary::after {
    transform: rotate(225deg) translate(-1px, -1px);
}

.psh-dashboard-quality > div {
    border-top: 1px solid #e6d5c6;
    margin-top: 6px;
    padding-top: 6px;
}

.psh-dashboard-quality-outside {
    margin: -8px 0 12px;
}

.psh-dashboard-region-table-single th,
.psh-dashboard-region-table-single td {
    text-align: right;
}

.psh-dashboard-region-table-single th:first-child,
.psh-dashboard-region-table-single td:first-child {
    text-align: left;
}

.psh-dashboard-pyramid {
    display: grid;
    gap: 4px;
    margin-top: 12px;
}

.psh-dashboard-pyramid-chart {
    margin-top: 9px;
    width: 100%;
}

.psh-dashboard-pyramid-svg {
    display: block;
    height: auto;
    max-height: 310px;
    width: 100%;
}

.psh-dashboard-pyramid-grid line {
    stroke: #e7ddd3;
    stroke-width: 0.7;
}

.psh-dashboard-pyramid-male {
    fill: #793b16;
    opacity: 0.94;
}

.psh-dashboard-pyramid-female {
    fill: #f2a0aa;
    opacity: 0.94;
}

.psh-dashboard-pyramid-age-labels text {
    fill: #645c55;
    font-size: 6.2px;
    font-weight: 600;
}

.psh-dashboard-pyramid-axis-labels text {
    fill: #817870;
    font-size: 7px;
}

.psh-dashboard-pyramid-row {
    align-items: center;
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
}

.psh-dashboard-pyramid-row > strong {
    color: #6b6159;
    font-size: 0.45rem;
    text-align: center;
}

.psh-dashboard-pyramid-row > div {
    display: flex;
    height: 13px;
}

.psh-dashboard-pyramid-row > div.male {
    justify-content: flex-end;
}

.psh-dashboard-pyramid-row > div span {
    align-items: center;
    color: #fff;
    display: flex;
    font-size: 0.4rem;
    min-width: var(--chart-width);
    padding: 0 3px;
    width: var(--chart-width);
}

.psh-dashboard-pyramid-row > div.male span {
    background: #a84620;
    justify-content: flex-start;
}

.psh-dashboard-pyramid-row > div.female span {
    background: #df8a42;
    justify-content: flex-end;
}

.psh-dashboard-lifestyle-item small,
.psh-dashboard-horizontal-row small {
    color: #8a7f76;
    font-size: 0.44rem;
}

.psh-dashboard-scope-note {
    color: #786e66;
    font-size: 0.62rem;
    line-height: 1.5;
    margin: 12px 0 0;
}

.sr-only {
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 380px) {
    .psh-dashboard-detail-title-row > span {
        font-size: 0.48rem;
    }

    .psh-dashboard-lifestyle-grid {
        gap: 3px;
    }

    .psh-dashboard-donut {
        height: 58px;
        width: 58px;
    }
}

/* ===== User Distribution 資訊方塊：窄螢幕（iPhone 12 Pro 等）一律不換行 20260828 ===== */
.psh-admin-dist .psh-admin-stat-label {
    white-space: nowrap;
}

.psh-admin-dist .psh-admin-stat-num {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .psh-admin-dist {
        gap: 10px;
    }

    .psh-admin-dist .psh-admin-stat-label {
        font-size: 0.62rem;
    }

    .psh-admin-dist .psh-admin-stat-num {
        font-size: 1.5rem;
    }
}

/* ===== Action tiles：縮小圖示與文字間距，文字不再往右縮排 20260828 ===== */
.psh-workspace-actions .psh-action-tile .mr-2 {
    margin-right: 4px !important;
}

/* ===== 手機實機不換行修正（iPhone 12 Pro 等窄螢幕）20260828 ===== */
/* 防止 iOS Safari 自動放大字體（真機換行常見主因） */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Action tiles：三個橫條按鈕文字不換行 */
.psh-workspace-actions .psh-action-tile .mud-typography {
    white-space: nowrap;
}

/* Case Dashboard：標題、統計格 label、下方指標列都不換行 */
.psh-admin-innercard-title,
.psh-hypertension-summary-item > span,
.psh-admin-metric-row,
.psh-admin-metric-row span,
.psh-admin-metric-row b {
    white-space: nowrap;
}

@media (max-width: 480px) {
    /* 窄螢幕縮字級，讓 nowrap 之後仍放得下、不溢出 */
    .psh-workspace-actions .psh-action-tile .mud-typography {
        font-size: 0.8rem;
    }

    .psh-hypertension-summary-item > span {
        font-size: 0.52rem;
    }

    .psh-admin-metric-row {
        font-size: 0.62rem;
    }
}
