:root {
    --rl-bg: #f4f7fb;
    --rl-panel: #ffffff;
    --rl-panel-soft: #f8fafc;
    --rl-text: #172033;
    --rl-muted: #667085;
    --rl-line: #d8e0eb;
    --rl-line-strong: #bdc8d8;
    --rl-primary: #2563eb;
    --rl-primary-dark: #1d4ed8;
    --rl-primary-soft: #eff6ff;
    --rl-accent: #0f766e;
    --rl-success: #047857;
    --rl-success-bg: #ecfdf3;
    --rl-warning: #a15c07;
    --rl-warning-bg: #fffbeb;
    --rl-error: #b42318;
    --rl-error-bg: #fef3f2;
    --rl-shadow: 0 10px 28px rgba(23, 32, 51, 0.08);
}

/* Medical Network annual KPI targets use cards so the backend content width
   never needs a five-column table or a horizontal scroll container. */
.rl-medical-network-kpi-settings,
.rl-medical-network-kpi-settings__cards,
.rl-medical-network-kpi-settings__card,
.rl-medical-network-kpi-settings__card-header,
.rl-medical-network-kpi-settings__target-field,
.rl-medical-network-kpi-settings__target-control,
.rl-medical-network-kpi-settings__details,
.rl-medical-network-kpi-settings__details div {
    min-width: 0;
    max-width: 100%;
}

.rl-medical-network-kpi-settings__cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: 100%;
}

@media (min-width: 761px) {
    .rl-medical-network-kpi-settings > .rl-form {
        width: 100%;
        min-width: 0;
        max-width: none;
    }
}

.rl-medical-network-kpi-settings__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.35em;
    min-width: 0;
}

.rl-medical-network-kpi-settings__heading-year,
.rl-medical-network-kpi-settings__heading-title {
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
}

.rl-medical-network-kpi-settings__card {
    display: grid;
    grid-template-columns: minmax(150px, 0.85fr) minmax(176px, 0.9fr) minmax(0, 2.4fr);
    align-items: start;
    column-gap: 24px;
    padding: 18px;
    border: 1px solid var(--rl-line);
    border-radius: 10px;
    background: #fff;
}

.rl-medical-network-kpi-settings__card-header {
    display: contents;
}

.rl-medical-network-kpi-settings__card h3 {
    grid-column: 1;
    margin: 4px 0 0;
    color: #243746;
    font-size: 20px;
    line-height: 1.4;
    overflow-wrap: break-word;
    word-break: normal;
}

.rl-medical-network-kpi-settings__target-field {
    display: grid;
    grid-column: 2;
    gap: 6px;
}

.rl-medical-network-kpi-settings__target-field > label,
.rl-medical-network-kpi-settings__details dt {
    color: var(--rl-muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
}

.rl-medical-network-kpi-settings__target-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rl-medical-network-kpi-settings__target-input {
    width: 132px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.rl-medical-network-kpi-settings__unit {
    flex: 0 0 auto;
    color: #243746;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.rl-medical-network-kpi-settings__details {
    display: grid;
    grid-column: 3;
    grid-row: 1;
    gap: 10px;
    margin: 0;
}

.rl-medical-network-kpi-settings__details div {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 16px;
    align-items: start;
    padding-top: 10px;
    border-top: 1px solid var(--rl-line);
}

.rl-medical-network-kpi-settings__details dt,
.rl-medical-network-kpi-settings__details dd {
    margin: 0;
}

.rl-medical-network-kpi-settings__details dd {
    color: #243746;
    line-height: 1.6;
    overflow-wrap: break-word;
    word-break: normal;
}

.rl-medical-network-kpi-settings__details dt {
    width: max-content;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
}

.rl-medical-network-kpi-page__toolbar-actions {
    margin-top: 0;
}

@media (max-width: 760px) {
    .rl-medical-network-kpi-page,
    .rl-medical-network-kpi-page .rl-panel,
    .rl-medical-network-kpi-page .rl-form,
    .rl-medical-network-kpi-page .rl-form-grid,
    .rl-medical-network-kpi-page .rl-actions {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .rl-medical-network-kpi-page .rl-toolbar,
    .rl-medical-network-kpi-page .rl-form-grid,
    .rl-medical-network-kpi-page .rl-actions {
        align-items: stretch;
        grid-template-columns: minmax(0, 1fr);
    }

    .rl-medical-network-kpi-page .rl-toolbar,
    .rl-medical-network-kpi-page .rl-actions {
        flex-direction: column;
    }

    .rl-medical-network-kpi-page .rl-toolbar > .rl-button,
    .rl-medical-network-kpi-page .rl-form-grid select,
    .rl-medical-network-kpi-page .rl-actions > .rl-button {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .rl-medical-network-kpi-page .rl-header h1,
    .rl-medical-network-kpi-page .rl-header p,
    .rl-medical-network-kpi-page .rl-panel p {
        overflow-wrap: break-word;
        word-break: normal;
    }

    .rl-medical-network-kpi-settings__card {
        display: block;
        padding: 16px;
        height: auto;
        min-height: 0;
        flex: none;
        align-self: auto;
    }

    .rl-medical-network-kpi-settings__card-header,
    .rl-medical-network-kpi-settings__details div {
        display: flex;
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        min-height: 0;
        flex: none;
        align-self: auto;
        justify-content: flex-start;
    }

    .rl-medical-network-kpi-settings__card h3,
    .rl-medical-network-kpi-settings__target-field,
    .rl-medical-network-kpi-settings__target-input {
        width: 100%;
        min-width: 0;
    }

    .rl-medical-network-kpi-settings__card h3 {
        flex: none;
        align-self: auto;
        height: auto;
        min-height: 0;
        margin: 0;
    }

    .rl-medical-network-kpi-settings__target-field {
        grid-template-rows: max-content max-content;
        gap: 10px;
        height: auto;
        min-height: 0;
        flex: none;
        align-self: stretch;
        align-content: start;
        justify-content: flex-start;
        margin: 0;
    }

    .rl-medical-network-kpi-settings__target-control {
        display: grid;
        grid-template-columns: minmax(0, 1fr) max-content;
        align-items: center;
        gap: 8px;
        height: auto;
        min-height: 0;
        flex: none;
        align-self: stretch;
        justify-content: flex-start;
        margin: 0;
    }

    .rl-medical-network-kpi-settings__unit {
        white-space: nowrap;
    }

    .rl-medical-network-kpi-settings__details {
        gap: 12px;
        height: auto;
        min-height: 0;
        flex: none;
        align-self: auto;
        justify-content: flex-start;
        margin: 14px 0 0;
    }

    .rl-medical-network-kpi-settings__details div {
        gap: 6px;
        padding-top: 8px;
    }
}

@media (max-width: 430px) {
    .rl-medical-network-kpi-settings__cards {
        gap: 14px;
    }

    .rl-medical-network-kpi-settings__card {
        padding: 16px;
    }
}

@media (max-width: 390px) {
    .rl-medical-network-kpi-settings__cards {
        gap: 12px;
    }

    .rl-medical-network-kpi-settings__card {
        padding: 14px;
    }

    .rl-medical-network-kpi-settings__card-header {
        gap: 12px;
    }
}

@media (max-width: 360px) {
    .rl-medical-network-kpi-settings__card {
        padding: 12px;
    }

    .rl-medical-network-kpi-settings__target-control {
        gap: 8px;
    }
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    background: var(--rl-bg);
    color: var(--rl-text);
    font-family: "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
}

a {
    color: inherit;
}

.rl-page {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0 56px;
}

.rl-header {
    margin-bottom: 24px;
}

.rl-header h1 {
    margin: 0 0 8px;
    font-size: 32px;
    line-height: 1.2;
}

.rl-header p {
    max-width: 760px;
    margin: 0;
    color: var(--rl-muted);
}

.rl-entry-page {
    display: grid;
    gap: 22px;
}

.rl-entry-hero {
    margin-bottom: 0;
    padding: 26px 28px;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--rl-shadow);
}

.rl-entry-hero h1 {
    max-width: 820px;
}

.rl-entry-section {
    display: grid;
    gap: 14px;
}

.rl-section-heading h2,
.rl-section-heading p {
    margin: 0;
}

.rl-section-heading h2 {
    font-size: 24px;
    line-height: 1.25;
}

.rl-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.rl-entry-card {
    display: flex;
    min-height: 150px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 20px;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--rl-shadow);
    color: var(--rl-text);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.rl-entry-card:hover {
    border-color: #9bb7ff;
    box-shadow: 0 14px 32px rgba(23, 32, 51, 0.12);
    transform: translateY(-2px);
}

.rl-entry-card:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.rl-entry-card__label {
    color: var(--rl-primary-dark);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.rl-entry-card__text {
    color: var(--rl-muted);
}

.rl-entry-card--admin {
    border-color: #b8d7d2;
}

.rl-entry-card--admin .rl-entry-card__label {
    color: var(--rl-accent);
}

.rl-admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
    align-items: stretch;
}

.rl-admin-card {
    display: block;
    min-height: 150px;
    padding: 22px 24px;
    border: 1px solid #bcd7df;
    border-top: 4px solid #008577;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: none;
    color: var(--rl-text);
    text-decoration: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.rl-admin-card::before,
.rl-admin-card::after {
    content: none;
    display: none;
}

.rl-admin-card:hover {
    border-color: #8ebcc6;
    border-top-color: #008577;
    box-shadow: 0 10px 24px rgba(15, 118, 110, 0.12);
    transform: translateY(-2px);
}

.rl-admin-card:focus-visible {
    outline: 3px solid rgba(0, 133, 119, 0.22);
    outline-offset: 2px;
}

.rl-admin-card .rl-entry-card__label,
.rl-admin-card .rl-entry-card__text {
    display: block;
}

.rl-admin-card .rl-entry-card__label {
    color: #05615d;
}

.rl-admin-card .rl-entry-card__text {
    margin-top: 18px;
}

.rl-entry-notice {
    box-shadow: none;
}

.rl-entry-notice p {
    margin: 0;
}

.rl-eyebrow {
    margin: 0 0 6px;
    color: var(--rl-accent);
    font-size: 14px;
    font-weight: 700;
}

.rl-auth-status,
.rl-access-message,
.rl-card,
.rl-panel,
.rl-kpi,
.rl-form {
    background: var(--rl-panel);
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    box-shadow: var(--rl-shadow);
}

.rl-auth-status,
.rl-access-message {
    margin-bottom: 20px;
    padding: 18px 20px;
}

.rl-auth-status dl {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 0;
}

.rl-auth-status dt,
.rl-list dt {
    color: var(--rl-muted);
    font-size: 14px;
    font-weight: 700;
}

.rl-auth-status dd,
.rl-list dd {
    margin: 2px 0 0;
}

.rl-auth-status dd {
    font-weight: 700;
}

.rl-auth-status__error,
.rl-access-message {
    color: var(--rl-error);
}

.rl-access-message {
    background: var(--rl-error-bg);
    border-color: #fecdca;
}

.rl-access-message h2,
.rl-access-message p {
    margin: 0;
}

.rl-access-message h2 {
    margin-bottom: 8px;
}

.rl-grid,
.rl-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.rl-card,
.rl-kpi {
    padding: 20px;
}

.rl-panel {
    padding: 24px;
}

.rl-panel + .rl-panel,
.rl-grid + .rl-panel,
.rl-kpi-grid + .rl-panel {
    margin-top: 18px;
}

.rl-card h2,
.rl-panel h2 {
    margin: 0 0 14px;
    font-size: 22px;
    line-height: 1.3;
}

.rl-card p,
.rl-panel p {
    margin: 0 0 12px;
}

.rl-card__meta,
.rl-badge,
.rl-muted-text {
    color: var(--rl-muted);
    font-size: 14px;
}

.rl-section-subtitle {
    margin: 22px 0 10px;
    font-size: 18px;
    line-height: 1.3;
}

.rl-score-line {
    display: block;
}

.rl-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    margin-top: 10px;
    padding: 3px 10px;
    border: 1px solid var(--rl-line);
    border-radius: 999px;
    background: var(--rl-panel-soft);
    font-weight: 700;
}

.rl-actions,
.rl-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.rl-actions {
    margin-top: 18px;
}

.rl-toolbar {
    justify-content: space-between;
    margin-bottom: 16px;
}

.rl-toolbar h2 {
    margin: 0;
}

/* Course-list filters appear below the list guidance and above its table. */
.rl-course-list-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 10px;
    margin: 16px 0 18px;
}

.rl-course-list-filter-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin: 0;
}

.rl-course-list-filter-group,
.rl-course-status-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
}

.rl-course-list-filter-group label,
.rl-course-status-filter label {
    margin: 0;
    font-weight: 700;
}

.rl-course-list-filter-group select,
.rl-course-status-filter select,
.rl-course-list-controls > .rl-button {
    box-sizing: border-box;
    min-height: 42px;
}

@media screen and (max-width: 760px) {
    .rl-course-list-controls,
    .rl-course-list-filter-form {
        align-items: stretch;
        flex-direction: column;
    }

    .rl-course-list-controls,
    .rl-course-list-filter-form,
    .rl-course-list-filter-group {
        width: 100%;
    }

    .rl-course-list-filter-group select,
    .rl-course-list-controls > .rl-button {
        width: 100%;
    }
}

.rl-button,
button.rl-button,
input[type="submit"].rl-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border: 1px solid var(--rl-primary);
    border-radius: 6px;
    background: var(--rl-primary);
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

.rl-button:hover,
button.rl-button:hover,
input[type="submit"].rl-button:hover {
    background: var(--rl-primary-dark);
    border-color: var(--rl-primary-dark);
}

/*
 * 停用中的按鈕。
 *
 * 為什麼一定要自己寫：.rl-button 寫死了 background 與 color，瀏覽器只會對「沒有
 * 自訂樣式」的按鈕自動變灰，有自訂背景色時 disabled 完全不影響外觀——按鈕會停在
 * 藍色，看起來完全可以按。
 *
 * 這是全站共用樣式，但目前只有課程狀態的三顆按鈕（送交審核／直接發布／核准發布）
 * 會被停用；其餘 disabled 都掛在 <input>／<select>（KPI 欄位、Virti 欄位），
 * 不帶 .rl-button，不受這裡影響。
 *
 * 顏色全部沿用既有色票，不新造一組。刻意不加 opacity：灰底已經和藍底拉開足夠
 * 差距，再壓不透明度只會讓文字更難讀。
 */
.rl-button:disabled,
button.rl-button:disabled,
input[type="submit"].rl-button:disabled {
    background: var(--rl-line);
    border-color: var(--rl-line-strong);
    color: var(--rl-muted);
    cursor: not-allowed;
    box-shadow: none;
}

/* hover／focus 不可以把停用中的按鈕變回「看起來能按」的樣子。 */
.rl-button:disabled:hover,
button.rl-button:disabled:hover,
input[type="submit"].rl-button:disabled:hover,
.rl-button:disabled:focus-visible,
button.rl-button:disabled:focus-visible,
input[type="submit"].rl-button:disabled:focus-visible {
    background: var(--rl-line);
    border-color: var(--rl-line-strong);
    color: var(--rl-muted);
}

.rl-button:focus-visible,
.rl-link-button:focus-visible,
.rl-form input:focus-visible,
.rl-form select:focus-visible,
.rl-panel input:focus-visible,
.rl-panel select:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.rl-button--secondary {
    background: #ffffff;
    color: var(--rl-primary);
}

/* 儀表板標題列右側：年度 KPI 目標設定、重新產生快照，時間戳跟在下面一行。 */
.rl-kpi-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

/* 快照時間戳刻意做成小字且貼著「重新產生快照」：它講的是下載檔的資料時間，
   不是下面那些 KPI 卡片的——卡片每次開啟都是即時計算的。做成整列的提示框時，
   它會被讀成「以下數字截至該時間」。 */
.rl-kpi-snapshot-stamp {
    flex-basis: 100%;
    margin: 0;
    text-align: right;
    font-size: 12px;
    font-weight: 400;
    color: var(--rl-muted);
}

.rl-kpi-snapshot-stamp--stale {
    color: var(--rl-warning);
    font-weight: 700;
}

/* 匯出列：兩顆下載按鈕跟著它們匯出的儀表板，對應關係不必用文字解釋。 */
.rl-kpi-export-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

/* 說明預設收合：查閱用的，不是每次進頁面都要讀的。 */
.rl-kpi-export-help {
    flex-basis: 100%;
    font-size: 13px;
    color: var(--rl-muted);
}

.rl-kpi-export-help > summary {
    width: fit-content;
    padding: 2px 0;
    cursor: pointer;
}

.rl-kpi-export-help__content {
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fafafa;
}

.rl-kpi-export-help__content p {
    margin: 0 0 8px;
    line-height: 1.6;
}

.rl-kpi-export-help__content p:last-child {
    margin-bottom: 0;
}

.rl-button--secondary:hover {
    background: var(--rl-primary-soft);
    color: var(--rl-primary-dark);
}

.rl-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--rl-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    line-height: 1;
}

.rl-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 18px;
    margin: 0;
}

.rl-list label {
    display: grid;
    grid-column: 1 / -1;
    gap: 6px;
    color: var(--rl-text);
    font-weight: 700;
}

.rl-form {
    display: grid;
    gap: 18px;
    max-width: 720px;
    padding: 24px;
}

.rl-form-group,
.rl-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Course material settings: author display rules above override the browser's
 * default hidden styling, so this component owns an explicit hidden state. */
.rl-virti-activity-id-field[hidden] {
    display: none !important;
}

/* Virti conversation-score cell in the learner table + the cross-course worklist. */
.rl-virti-score-cell {
    font-size: 0.85rem;
}

.rl-virti-score-cell__current strong {
    font-size: 1rem;
}

.rl-virti-score-cell__status {
    color: #555;
}

.rl-virti-score-cell__webhook {
    color: #2e7d32;
}

.rl-virti-score-cell__token code {
    word-break: break-all;
}

.rl-virti-score-cell__note {
    color: #666;
    margin: 2px 0;
}

.rl-virti-score-cell__form,
.rl-virti-score-history,
.rl-course-kpi-setting-history {
    margin-top: 6px;
}

.rl-course-kpi-setting-history__note {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: #555;
}

.rl-virti-score-cell__form .rl-form,
.rl-virti-scores-table .rl-form {
    gap: 6px;
    margin-top: 6px;
}

.rl-virti-scores-table code {
    word-break: break-all;
    font-size: 0.8rem;
}

.rl-virti-import-bucket {
    margin-top: 8px;
    font-size: 0.85rem;
}

.rl-virti-import-bucket code {
    word-break: break-all;
}

/* P1-04 conditional course configuration groups. Form layout rules use
 * display:flex, so scope !important hiding to these components only. */
.rl-medical-network-kpi-fields[hidden],
.rl-medical-credit-status-field[hidden] {
    display: none !important;
}

.rl-form-group label,
.rl-form label {
    color: var(--rl-text);
    font-weight: 700;
}

.rl-form input,
.rl-form select,
.rl-form textarea,
.rl-panel input,
.rl-panel select,
.rl-panel textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--rl-line-strong);
    border-radius: 6px;
    background: #ffffff;
    padding: 8px 11px;
    color: var(--rl-text);
    font: inherit;
}

.rl-form input:hover,
.rl-form select:hover,
.rl-form textarea:hover,
.rl-panel input:hover,
.rl-panel select:hover,
.rl-panel textarea:hover {
    border-color: #9aa8bd;
}

.rl-form textarea,
.rl-panel textarea {
    min-height: 120px;
    resize: vertical;
}

.rl-form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 16px;
}

.rl-form-check input[type="checkbox"],
.rl-form .rl-form-check input[type="checkbox"],
.rl-panel .rl-form-check input[type="checkbox"] {
    width: auto;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
}

.rl-form-check label {
    margin: 0;
    font-weight: 600;
    cursor: pointer;
}

.rl-course-option-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0;
}

.rl-course-option-stack .rl-form-check {
    min-height: 32px;
    margin: 0;
}

.rl-admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.rl-reports-page .rl-reports-nav__return {
    margin-inline-end: 12px;
}

/* Only the course-statistics search overrides the shared form dimensions. */
#course-stats > .rl-toolbar {
    margin-bottom: 10px;
}

#course-stats .rl-form.rl-course-stats-search {
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
    gap: 6px;
    padding: 10px 12px;
    margin: 0 0 8px;
}

#course-stats .rl-course-stats-search__row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 8px;
    min-width: 0;
}

#course-stats .rl-course-stats-search label {
    flex: 1 1 140px;
    min-width: 0;
    max-width: 100%;
    margin: 0;
    gap: 4px;
    font-size: 14px;
}

#course-stats .rl-course-stats-search .rl-course-stats-search__keyword {
    flex: 2 1 220px;
}

#course-stats .rl-course-stats-search input:not([type="hidden"]),
#course-stats .rl-course-stats-search .rl-button {
    height: 40px;
    min-height: 40px;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 7px 10px;
    font-size: 14px;
    line-height: 1.4;
}

#course-stats .rl-course-stats-search .rl-button {
    flex: 0 0 auto;
    white-space: nowrap;
}

#course-stats .rl-course-stats-search__help {
    margin: 0;
    color: var(--rl-muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

#course-stats .rl-course-stats-search__count {
    margin: 0 0 8px;
}

/* All-period report summary only: compact two-column cards on phones.
   單一課程報表（templates/admin-course-report-view.php）的課程成效摘要（#course-summary）沿用同一套。
   這組 @media 限定 screen，列印不受影響。 */
@media screen and (max-width: 760px) {
    .rl-reports-page .rl-reports-cumulative-summary .rl-kpi-grid,
    .rl-course-report-page #course-summary .rl-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        min-width: 0;
    }

    .rl-reports-page .rl-reports-cumulative-summary .rl-kpi,
    .rl-course-report-page #course-summary .rl-kpi {
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
        height: auto;
        min-height: 0;
        padding: 12px;
        overflow: visible;
    }

    .rl-reports-page .rl-reports-cumulative-summary .rl-kpi span,
    .rl-reports-page .rl-reports-cumulative-summary .rl-kpi strong,
    .rl-course-report-page #course-summary .rl-kpi span,
    .rl-course-report-page #course-summary .rl-kpi strong {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }

    .rl-reports-page .rl-reports-cumulative-summary .rl-kpi span,
    .rl-course-report-page #course-summary .rl-kpi span {
        font-size: 14px;
    }

    .rl-reports-page .rl-reports-cumulative-summary .rl-kpi strong,
    .rl-course-report-page #course-summary .rl-kpi strong {
        margin-top: 6px;
        font-size: 24px;
    }
}

/* Course statistics only: reuse table rows as labelled cards on phones. */
@media (max-width: 760px) {
    #course-stats,
    #course-stats .rl-table-wrap,
    #course-stats .rl-table,
    #course-stats .rl-table tbody,
    #course-stats .rl-table tfoot,
    #course-stats .rl-table tr,
    #course-stats .rl-table td {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    #course-stats .rl-table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible;
        border: 0;
        background: transparent;
    }

    #course-stats .rl-table,
    #course-stats .rl-table tbody,
    #course-stats .rl-table tfoot,
    #course-stats .rl-table tr,
    #course-stats .rl-table td {
        display: block;
    }

    #course-stats .rl-table thead {
        display: none;
    }

    #course-stats .rl-table tr {
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--rl-line);
        border-radius: 8px;
        background: #ffffff;
    }

    #course-stats .rl-table tr:last-child {
        margin-bottom: 0;
    }

    /* 合計卡片（tfoot）：與課程卡片同寬；tr／td／td::before 已由上面不分 tbody／tfoot 的規則套用。
       tbody 最後一張卡片的 margin-bottom 是 0，所以間距放在 tfoot 上；淺底色沿用表頭的 --rl-panel-soft。 */
    #course-stats .rl-table tfoot {
        margin-top: 12px;
    }

    #course-stats .rl-table tfoot tr {
        background: var(--rl-panel-soft);
    }

    #course-stats .rl-table td {
        padding: 6px 0;
        border: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #course-stats .rl-table td[data-label]::before {
        display: block;
        content: attr(data-label);
        margin-bottom: 3px;
        color: var(--rl-muted);
        font-size: 14px;
        font-weight: 700;
    }

    /* Shared action styles enforce fixed widths and nowrap with !important. */
    #course-stats .rl-table td.rl-table-cell-actions,
    #course-stats .rl-table-actions,
    #course-stats .rl-table-actions > a {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        white-space: normal !important;
    }

    #course-stats .rl-table-actions {
        flex-wrap: wrap !important;
    }

    #course-stats .rl-table-actions > a {
        padding: 10px !important;
        overflow-wrap: anywhere;
    }

    #course-stats .rl-toolbar,
    #course-stats .rl-toolbar > * {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    #course-stats .rl-course-stats-search .rl-button {
        flex: 1 1 auto;
        white-space: normal;
    }
}

.rl-backend-layout .rl-reports-page > :is(#annual-kpi-dashboard, #medical-network-kpi-dashboard, #course-stats, #quiz-records, #feedback-records, #discussion-records) {
    scroll-margin-top: var(--rl-reports-scroll-offset, 90px);
}

@media (max-width: 560px) {
    .rl-backend-layout .rl-reports-page > :is(#annual-kpi-dashboard, #medical-network-kpi-dashboard, #course-stats, #quiz-records, #feedback-records, #discussion-records) {
        scroll-margin-top: var(--rl-reports-scroll-offset, 180px);
    }
}

.rl-admin-section {
    padding: 24px;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: var(--rl-panel);
    margin-bottom: 22px;
}

.rl-checkout-records-table th:nth-child(1) { width: 21%; }
.rl-checkout-records-table th:nth-child(2) { width: 10%; }
.rl-checkout-records-table th:nth-child(3) { width: 14%; }
.rl-checkout-records-table th:nth-child(4) { width: 12%; }
.rl-checkout-records-table th:nth-child(5) { width: 20%; }
.rl-checkout-records-table th:nth-child(6) { width: 10%; }
.rl-checkout-records-table th:nth-child(7) { width: 13%; }

.rl-checkout-records-table td:nth-child(5),
.rl-checkout-records-table td:nth-child(7) {
    overflow-wrap: anywhere;
}

@media (max-width: 760px) {
    .rl-admin-attendance-page .rl-table-wrap {
        margin-right: 0;
        overflow: visible;
    }

    .rl-admin-attendance-page .rl-admin-records-table,
    .rl-admin-attendance-page .rl-admin-records-table tbody,
    .rl-admin-attendance-page .rl-admin-records-table tr,
    .rl-admin-attendance-page .rl-admin-records-table td {
        display: block;
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }

    .rl-admin-attendance-page .rl-admin-records-table thead {
        display: none;
    }

    .rl-admin-attendance-page .rl-admin-records-table tr {
        padding: 12px;
        border-bottom: 1px solid var(--rl-line);
    }

    .rl-admin-attendance-page .rl-admin-records-table tr:last-child {
        border-bottom: 0;
    }

    .rl-admin-attendance-page .rl-admin-records-table td {
        display: grid;
        grid-template-columns: minmax(84px, 35%) minmax(0, 1fr);
        gap: 8px;
        padding: 6px 0;
        border: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-admin-attendance-page .rl-admin-records-table td::before {
        content: attr(data-label);
        color: var(--rl-muted);
        font-size: .82rem;
        font-weight: 700;
    }
}

#course-stats,
#feedback-records,
#quiz-records,
#discussion-records {
    scroll-margin-top: 24px;
}

.rl-annual-kpi-dashboard {
    scroll-margin-top: 24px;
}

.rl-annual-kpi-dashboard .rl-toolbar {
    align-items: flex-start;
    gap: 16px;
}

.rl-annual-kpi-dashboard .rl-toolbar h2 {
    margin-bottom: 4px;
}

.rl-annual-kpi-dashboard .rl-toolbar p {
    margin: 0;
}

.rl-annual-kpi-year-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    margin: 18px 0;
}

.rl-annual-kpi-year-filter label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-weight: 600;
}

.rl-annual-kpi-year-filter select {
    min-width: 180px;
}

.rl-annual-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

/* Medical Network KPI cards share the annual-dashboard container and use the
   same five-card desktop proportion without changing generic KPI cards. */
.rl-medical-network-kpi-dashboard .rl-annual-kpi-grid {
    width: 100%;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rl-medical-network-kpi-dashboard .rl-annual-kpi-card__values {
    grid-template-columns: minmax(0, 1fr);
}

.rl-medical-network-kpi-dashboard .rl-annual-kpi-card__values dd {
    overflow-wrap: break-word;
    word-break: keep-all;
}

.rl-medical-network-kpi-dashboard__trace-details {
    width: 100%;
    margin-top: 18px;
    border: 1px solid var(--rl-line);
    border-radius: 10px;
    background: #fff;
}

.rl-medical-network-kpi-dashboard__trace-details > summary {
    cursor: pointer;
    padding: 14px 16px;
    color: #243746;
    font-weight: 700;
}

.rl-medical-network-kpi-dashboard__trace-details > summary:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: -3px;
}

.rl-medical-network-kpi-dashboard__trace-details[open] > summary {
    border-bottom: 1px solid var(--rl-line);
}

.rl-medical-network-kpi-dashboard__trace-content {
    width: 100%;
    padding: 18px;
}

.rl-medical-network-kpi-dashboard__trace-content > h3 {
    margin-top: 0;
}

.rl-medical-network-kpi-dashboard__trace-content .rl-medical-network-kpi-dashboard__table-wrap {
    width: 100%;
    overflow: visible;
}

.rl-medical-network-kpi-dashboard__trace-content .rl-medical-network-kpi-dashboard__table {
    width: 100%;
    table-layout: fixed;
}

.rl-medical-network-kpi-dashboard__trace-content .rl-medical-network-kpi-dashboard__table th,
.rl-medical-network-kpi-dashboard__trace-content .rl-medical-network-kpi-dashboard__table td {
    overflow-wrap: break-word;
    word-break: normal;
}

@media (max-width: 1199px) {
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.rl-annual-kpi-card {
    --rl-annual-kpi-light: #7b8794;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--rl-line);
    border-left: 5px solid var(--rl-annual-kpi-light);
    border-radius: 10px;
    background: #fff;
}

.rl-annual-kpi-card--green { --rl-annual-kpi-light: #2e7d32; }
.rl-annual-kpi-card--yellow { --rl-annual-kpi-light: #a56b00; }
.rl-annual-kpi-card--red { --rl-annual-kpi-light: #b3261e; }
.rl-annual-kpi-card--gray { --rl-annual-kpi-light: #6b7280; }

.rl-annual-kpi-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.rl-annual-kpi-card__header h3 {
    margin: 0;
    color: #243746;
    font-size: 18px;
    line-height: 1.4;
}

.rl-annual-kpi-light {
    flex: 0 0 auto;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--rl-annual-kpi-light);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.rl-annual-kpi-card__values {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 12px;
    margin: 0;
}

.rl-annual-kpi-card__values div {
    min-width: 0;
}

.rl-annual-kpi-card__values dt {
    margin: 0 0 4px;
    color: #667781;
    font-size: 13px;
}

.rl-annual-kpi-card__values dd {
    margin: 0;
    color: #243746;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.rl-annual-kpi-card__note {
    margin: -4px 0 0;
    color: #59636e;
    font-size: 14px;
    line-height: 1.5;
}

/* 「健康台灣深耕計畫 KPI」區塊裡，把對外申報指標與內部參考指標分開的樣式。 */
.rl-annual-kpi-group-note {
    margin: 0 0 12px;
    color: #59636e;
    font-size: 14px;
    line-height: 1.6;
}

.rl-annual-kpi-group-note strong {
    color: #243746;
}

/* 內部參考指標（目前只有「完課率」）：換底色與框線，跟上方申報指標明顯分開。 */
.rl-annual-kpi-internal-reference {
    margin-top: 24px;
    padding: 16px;
    border: 1px dashed #c9a227;
    border-radius: 12px;
    background: #fdf7e6;
}

.rl-annual-kpi-internal-reference__title {
    margin: 0 0 4px;
    color: #7a5c00;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
}

.rl-annual-kpi-internal-reference .rl-annual-kpi-group-note {
    color: #6b5a1f;
}

.rl-annual-kpi-internal-reference .rl-annual-kpi-group-note strong {
    color: #7a5c00;
}

/* 培訓人數：深耕計畫唯一的正式申報 KPI，獨立成顯著區塊。保留既有的燈號
   左側色條（--rl-annual-kpi-light，達標變綠、未達標變紅等），這裡只加粗
   外框、加深底色、放大字級，不覆蓋燈號系統。 */
.rl-annual-kpi-primary {
    margin-bottom: 20px;
}

.rl-annual-kpi-primary__title {
    margin: 0 0 10px;
    color: #1a4d8f;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.rl-annual-kpi-grid--primary {
    grid-template-columns: minmax(280px, 420px);
}

.rl-annual-kpi-grid--primary .rl-annual-kpi-card {
    border-width: 2px;
    border-color: #1a4d8f;
    border-left-width: 8px;
    background: #f3f7fd;
}

.rl-annual-kpi-grid--primary .rl-annual-kpi-card__header h3 {
    font-size: 22px;
}

.rl-annual-kpi-grid--primary .rl-annual-kpi-card__values dd {
    font-size: 22px;
}

.rl-annual-kpi-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ebf0;
}

.rl-annual-kpi-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--rl-annual-kpi-light);
}

@media (max-width: 640px) {
    .rl-annual-kpi-dashboard .rl-toolbar {
        flex-direction: column;
    }

    .rl-annual-kpi-year-filter {
        align-items: stretch;
    }

    .rl-annual-kpi-year-filter label,
    .rl-annual-kpi-year-filter select,
    .rl-annual-kpi-year-filter .rl-button {
        width: 100%;
    }
}
.rl-admin-section > p {
    max-width: 760px;
}

.rl-subsection {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--rl-line);
}

.rl-subsection h3 {
    margin: 0 0 12px;
    font-size: 19px;
    line-height: 1.3;
}

.rl-quiz-question {
    margin-bottom: 24px;
}

.rl-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.rl-quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #d7e0ee;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.rl-quiz-option input[type="radio"],
.rl-form .rl-quiz-option input[type="radio"],
.rl-panel .rl-quiz-option input[type="radio"] {
    width: auto;
    min-width: 16px;
    height: 16px;
    min-height: 16px;
    margin: 3px 0 0;
    padding: 0;
    flex: 0 0 auto;
}

.rl-quiz-option__text {
    line-height: 1.6;
    font-weight: 600;
}

.rl-quiz-option:hover {
    background: #f8fbff;
    border-color: #9bbcff;
}

.rl-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: #ffffff;
}

.rl-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.rl-table th,
.rl-table td {
    border-bottom: 1px solid var(--rl-line);
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
}

.rl-table th {
    background: var(--rl-panel-soft);
    color: var(--rl-muted);
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.rl-table tr:last-child td {
    border-bottom: 0;
}

.rl-table tbody tr:hover {
    background: #fbfdff;
}

.rl-status-badge {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border: 1px solid var(--rl-line);
    border-radius: 999px;
    background: var(--rl-panel-soft);
    color: var(--rl-muted);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.rl-status-badge--draft {
    border-color: #d0d5dd;
    background: #f8fafc;
    color: #475467;
}

.rl-status-badge--pending_review {
    border-color: #fedf89;
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.rl-status-badge--published {
    border-color: #abefc6;
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.rl-status-badge--archived {
    border-color: #fedf89;
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.rl-status-badge--unpublished {
    border-color: #d0d5dd;
    background: #f2f4f7;
    color: #475467;
}

.rl-status-badge--pending {
    border-color: #fedf89;
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.rl-status-badge--approved {
    border-color: #abefc6;
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.rl-status-badge--rejected,
.rl-status-badge--suspended {
    border-color: #fecdca;
    background: var(--rl-error-bg);
    color: var(--rl-error);
}

.rl-platform-access-card {
    max-width: 760px;
}

.rl-onboarding-card {
    display: grid;
    gap: 18px;
    padding: 24px;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: var(--rl-panel);
    box-shadow: var(--rl-shadow);
}

.rl-onboarding-card--wide {
    max-width: 860px;
}

.rl-onboarding-card > p {
    margin: 0;
    color: var(--rl-muted);
}

.rl-onboarding-steps {
    display: grid;
    gap: 8px;
    margin: 0;
    padding-left: 22px;
}

.rl-onboarding-steps li {
    padding-left: 4px;
}

.rl-onboarding-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rl-register-guide-logout-form {
    margin: 0;
}

.rl-register-guide-status {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border: 1px solid #bdd7e5;
    border-radius: 8px;
    background: #f5fbff;
    color: #234a62;
}

.rl-register-guide-status > span {
    font-size: .84rem;
    font-weight: 700;
}

.rl-register-guide-status > strong {
    font-size: 1.08rem;
    overflow-wrap: anywhere;
}

.rl-register-guide-status--pending {
    border-color: #fedf89;
    background: #fffbeb;
    color: #915f00;
}

.rl-register-guide-status--approved {
    border-color: #9acfbf;
    background: #edf9f4;
    color: #08705b;
}

.rl-register-guide-status--rejected,
.rl-register-guide-status--suspended,
.rl-register-guide-status--error {
    border-color: #ebbbb7;
    background: #fff1f0;
    color: #a33d35;
}

.rl-course-certificate-page {
    width: min(1120px, calc(100% - 40px));
    padding: 32px 0 44px;
}

.rl-course-certificate__controls {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.rl-course-certificate__print-note {
    margin: 0;
    color: var(--rl-muted);
}

.rl-course-certificate {
    --rl-certificate-frame: #0d577f;
    --rl-certificate-platform: #0f766e;
    --rl-certificate-heading: #123750;
    --rl-certificate-muted: #526879;
    --rl-certificate-label: #5d7485;
    --rl-certificate-value: #163d57;
    --rl-certificate-rule: #cbdce6;
    --rl-certificate-rule-width: min(100%, 88mm);
    --rl-certificate-fields-width: 76%;
    --rl-certificate-field-column-gap: clamp(60px, 7vw, 80px);
    --rl-certificate-field-row-gap: clamp(16px, 2vw, 22px);
    display: grid;
    min-width: 0;
    gap: 24px;
    padding: clamp(24px, 4vw, 48px);
    border: 12px double var(--rl-certificate-frame);
    background: #ffffff;
    box-shadow: var(--rl-shadow);
}

.rl-course-certificate__header {
    display: grid;
    gap: 8px;
    text-align: center;
}

.rl-course-certificate__brand-logo {
    display: block;
    width: clamp(180px, 22vw, 220px);
    max-width: 100%;
    height: auto;
    margin: 0 auto 4px;
}

.rl-course-certificate__header > p {
    margin: 0;
    color: var(--rl-certificate-platform);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: .08em;
}

.rl-course-certificate__header h1 {
    margin: 0;
    color: var(--rl-certificate-heading);
    font-size: clamp(2.25rem, 5vw, 3.35rem);
    font-weight: 900;
    letter-spacing: .12em;
}

.rl-course-certificate__header > span {
    color: var(--rl-certificate-muted);
    font-size: .94rem;
    line-height: 1.7;
}

.rl-course-certificate__fields {
    display: grid;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-flow: row;
    width: var(--rl-certificate-fields-width);
    column-gap: var(--rl-certificate-field-column-gap);
    row-gap: var(--rl-certificate-field-row-gap);
    margin: 0 auto;
}

.rl-course-certificate__fields > div {
    position: relative;
    min-width: 0;
    width: 100%;
    padding-bottom: 12px;
}

.rl-course-certificate__fields > div::after {
    position: absolute;
    bottom: 0;
    left: 0;
    width: var(--rl-certificate-rule-width);
    height: 1px;
    background: var(--rl-certificate-rule);
    content: "";
}

.rl-course-certificate__fields dt {
    margin-bottom: 5px;
    color: var(--rl-certificate-label);
    font-size: .88rem;
    font-weight: 700;
}

.rl-course-certificate__fields dd {
    min-width: 0;
    margin: 0;
    color: var(--rl-certificate-value);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.rl-course-certificate__fields > div:nth-child(-n + 2) dd {
    color: var(--rl-certificate-frame);
    font-size: 1.22rem;
}

/* 發證單位是最後一行、置中佔整列（上課時數改成一般欄位，跟完成日期並排）。 */
.rl-course-certificate__issuer-name {
    grid-column: 1 / -1;
    width: 46% !important;
    justify-self: center;
    --rl-certificate-rule-width: 100%;
}

/* 表單欄位旁的就地錯誤訊息（例如上課時數填錯）。 */
.rl-field-error {
    color: var(--rl-error);
    font-weight: 700;
}

/* 課名可換行：長課名不得超出證書外框（不要改回 nowrap；列印版在 course-certificate.php）。 */
.rl-course-certificate__course-title dd {
    font-size: clamp(1rem, 1.8vw, 1.22rem) !important;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rl-course-certificate__number {
    color: var(--rl-certificate-frame) !important;
    font-family: Consolas, "Courier New", monospace;
    letter-spacing: .04em;
}

.rl-course-certificate__issuer {
    padding-top: 14px;
    border-top: 1px solid var(--rl-certificate-rule);
    color: var(--rl-certificate-muted);
    font-size: .9rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-align: center;
}

.rl-notice {
    padding: 12px 14px;
    border: 1px solid #fedf89;
    border-radius: 8px;
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.rl-notice p {
    margin: 0;
}

.rl-notice p + p {
    margin-top: .6rem;
}

/* Override panel intro styles only for the course publication validation error. */
#course-create .rl-course-create-validation-error {
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid #f04438;
    border-radius: 8px;
    background: var(--rl-error-bg);
    color: var(--rl-error);
    font-weight: 700;
}

.rl-enrollment-status {
    max-width: 760px;
    padding: 16px 18px;
    border: 1px solid #abefc6;
    border-radius: 8px;
    background: var(--rl-success-bg);
    color: var(--rl-success);
    font-weight: 800;
}

.rl-enrollment-status p {
    margin: 0;
}

.rl-video-locked {
    max-width: 760px;
    padding: 16px 18px;
    border: 1px solid #bdd7e5;
    border-radius: 8px;
    background: #f2f8fb;
    color: #23445b;
}

.rl-video-locked p {
    margin: 0;
}

.rl-video-locked p + p {
    margin-top: 6px;
}

.rl-video-access-note {
    color: #123f63;
    font-weight: 800;
}

.rl-learning-actions .rl-actions {
    margin-top: 0;
}

.rl-learning-actions .rl-button {
    min-width: 150px;
}

.rl-approval-table .rl-table-col-actions,
.rl-approval-table .rl-table-cell-actions {
    width: 360px !important;
    min-width: 360px !important;
    max-width: none !important;
}

.rl-approval-actions {
    display: grid;
    gap: 10px;
    min-width: 320px;
}

.rl-approval-actions label {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.rl-approval-actions input[type="text"] {
    width: 100%;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--rl-line);
    border-radius: 6px;
}

.rl-table-cell-actions {
    vertical-align: middle;
    white-space: nowrap;
}

.rl-table-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    flex-wrap: nowrap;
}

.rl-table-actions .rl-action-button {
    display: inline-flex;
    min-width: 52px;
    min-height: 32px;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.rl-action-button--edit {
    border: 1px solid #2563eb;
    background: var(--rl-primary-soft);
    color: var(--rl-primary-dark);
}

.rl-action-button--edit:hover {
    background: #dbeafe;
}

.rl-action-button--archive {
    border: 1px solid #dc2626;
    background: #fff7ed;
    color: #b42318;
}

.rl-action-button--archive:hover {
    background: #fee2e2;
}

.rl-table-action-form {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    width: auto;
}

.rl-kpi-grid {
    margin-bottom: 18px;
}

.rl-detail-card {
    margin-bottom: 18px;
}

.rl-detail-summary {
    margin-top: 18px;
}

.rl-detail-section {
    margin-top: 18px;
}

.rl-detail-export-actions {
    align-items: flex-start;
}

.rl-kpi {
    position: relative;
    overflow: hidden;
    border-color: #c7d7fe;
    background: #ffffff;
}

.rl-kpi::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--rl-primary), var(--rl-accent));
}

.rl-kpi span,
.rl-kpi strong {
    display: block;
}

.rl-kpi span {
    color: var(--rl-muted);
    font-weight: 700;
}

.rl-kpi strong {
    margin-top: 10px;
    color: var(--rl-primary-dark);
    font-size: 34px;
    line-height: 1.1;
}

.rl-evidence-list {
    margin: 0;
    padding-left: 20px;
}

.rl-panel > p:not(:last-child) {
    margin-bottom: 12px;
}

.rl-panel > p {
    color: var(--rl-muted);
}

.rl-panel > p:only-child,
.rl-panel > h2 + p {
    padding: 10px 12px;
    border: 1px solid var(--rl-line);
    border-radius: 6px;
    background: var(--rl-panel-soft);
}

@media (max-width: 760px) {
    .rl-page {
        width: min(100% - 24px, 1180px);
        padding: 28px 0 40px;
    }

    .rl-header h1 {
        font-size: 26px;
    }

    .rl-entry-page {
        gap: 18px;
    }

    .rl-entry-hero {
        padding: 20px;
    }

    .rl-section-heading h2 {
        font-size: 22px;
    }

    .rl-entry-grid {
        grid-template-columns: 1fr;
    }

    .rl-entry-card {
        min-height: 0;
    }

    .rl-panel,
    .rl-card,
    .rl-kpi,
    .rl-form {
        padding: 18px;
    }

    .rl-list {
        grid-template-columns: 1fr;
    }

    .rl-actions,
    .rl-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .rl-actions .rl-button,
    .rl-actions button,
    .rl-toolbar .rl-button,
    .rl-toolbar button {
        width: 100%;
    }

    .rl-onboarding-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .rl-onboarding-actions .rl-button {
        width: 100%;
    }

    .rl-onboarding-actions .rl-register-guide-logout-form,
    .rl-onboarding-actions .rl-register-guide-logout-form .rl-button {
        width: 100%;
    }

    .rl-course-certificate-page {
        width: min(100% - 24px, 1120px);
        padding: 22px 0 32px;
    }

    .rl-course-certificate {
        gap: 24px;
        padding: 24px 20px;
        border-width: 8px;
    }

    .rl-course-certificate__fields {
        grid-template-columns: 1fr;
        gap: 14px;
        width: 100%;
    }

    .rl-course-certificate__issuer-name {
        width: 100% !important;
        justify-self: stretch;
    }

    .rl-course-certificate__controls .rl-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .rl-course-certificate__controls .rl-button {
        width: 100%;
        box-sizing: border-box;
    }

    .rl-table-wrap {
        margin-right: -6px;
        padding-bottom: 2px;
    }

    .rl-table {
        min-width: 720px;
    }

    .rl-table th,
    .rl-table td {
        padding: 10px 12px;
        white-space: normal;
    }

    .rl-kpi strong {
        font-size: 30px;
    }
}

/* Certificate administration: list only certificate snapshots and statuses. */
.rl-certificate-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.rl-certificate-summary__card {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--rl-line);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: var(--rl-shadow);
}

.rl-certificate-summary__card span {
    color: var(--rl-muted);
    font-size: .9rem;
    font-weight: 700;
}

.rl-certificate-summary__card strong {
    color: #163d57;
    font-size: clamp(1.35rem, 2.5vw, 1.8rem);
}

.rl-admin-certificates__filters .rl-form-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.rl-admin-certificates-table {
    min-width: 960px;
}

.rl-admin-certificates-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-certificate-status--issued {
    border-color: #abefc6;
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.rl-certificate-status--revoked {
    border-color: #fecdca;
    background: var(--rl-danger-bg);
    color: var(--rl-danger);
}

.rl-certificate-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 18px;
}

.rl-certificate-pagination > span {
    color: var(--rl-muted);
    font-weight: 700;
}

.rl-admin-certificate-detail__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 22px;
    margin: 0;
}

.rl-admin-certificate-detail__fields > div {
    min-width: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rl-line);
}

.rl-admin-certificate-detail__fields dt {
    margin-bottom: 5px;
    color: var(--rl-muted);
    font-size: .86rem;
    font-weight: 700;
}

.rl-admin-certificate-detail__fields dd {
    min-width: 0;
    margin: 0;
    color: #163d57;
    font-weight: 700;
    line-height: 1.6;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-admin-certificate-detail__actions {
    margin-top: 20px;
}

.rl-admin-certificate-detail__actions form {
    margin: 0;
}

.rl-admin-certificate-detail__actions .rl-button--danger {
    border-color: #b42318;
    background: #b42318;
    color: #ffffff;
}

.rl-admin-certificate-detail__actions .rl-button--danger:hover,
.rl-admin-certificate-detail__actions .rl-button--danger:focus-visible {
    border-color: #912018;
    background: #912018;
    color: #ffffff;
}

@media (max-width: 767.98px) {
    .rl-admin-certificates-page,
    .rl-admin-certificate-view-page {
        max-width: calc(100vw - 24px);
        min-width: 0;
        overflow-x: hidden;
    }

    .rl-certificate-summary {
        grid-template-columns: 1fr;
    }

    .rl-certificate-summary__card {
        padding: 16px;
    }

    .rl-admin-certificates-table-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0;
        overflow: visible !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-sizing: border-box;
    }

    .rl-admin-certificates-table {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    .rl-admin-certificates-table thead {
        display: none;
    }

    .rl-admin-certificates-table tbody {
        display: grid;
        gap: 12px;
    }

    .rl-admin-certificates-table__row {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        border: 1px solid #e3ebf0;
        border-radius: 12px;
        background: #ffffff;
        box-sizing: border-box;
    }

    .rl-admin-certificates-table td {
        display: grid;
        grid-template-columns: minmax(6.5rem, 40%) minmax(0, 1fr);
        gap: 10px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 10px 14px !important;
        border: 0;
        border-bottom: 1px solid #edf2f5;
        background: #ffffff !important;
        color: var(--rl-text);
        text-align: left !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-admin-certificates-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: #788897;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.45;
    }

    .rl-admin-certificates-table td:last-child {
        border-bottom: 0;
    }

    .rl-admin-certificates-table__empty {
        display: block !important;
        padding: 16px !important;
        border: 1px solid #e3ebf0 !important;
        border-radius: 12px;
        text-align: center !important;
    }

    .rl-admin-certificates-table__empty::before {
        display: none;
    }

    .rl-admin-certificates-table td .rl-status-badge {
        width: fit-content;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-admin-certificates-table__actions {
        display: block !important;
    }

    .rl-admin-certificates-table__actions::before {
        display: block;
        margin-bottom: 8px;
    }

    .rl-admin-certificates-table__actions .rl-table-actions {
        display: grid !important;
        grid-template-columns: 1fr;
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        gap: 8px !important;
        white-space: normal !important;
        box-sizing: border-box;
    }

    .rl-admin-certificates-table__actions .rl-table-actions > a,
    .rl-admin-certificates-table__actions .rl-table-actions > form {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
    }

    .rl-admin-certificates-table__actions .rl-table-actions > a,
    .rl-admin-certificates-table__actions .rl-table-actions > form > button {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 44px !important;
        margin: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 14px !important;
        box-sizing: border-box !important;
        text-align: center !important;
        white-space: normal !important;
    }

    .rl-certificate-pagination {
        align-items: stretch;
        flex-direction: column;
        gap: 8px;
    }

    .rl-certificate-pagination .rl-button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

    .rl-admin-certificate-detail__fields {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .rl-admin-certificate-detail__actions,
    .rl-admin-certificate-detail__actions form,
    .rl-admin-certificate-detail__actions .rl-button {
        width: 100%;
        box-sizing: border-box;
    }
}

.rl-table-cell-actions {
    vertical-align: middle !important;
    white-space: nowrap !important;
    min-width: 140px !important;
}

.rl-table-actions {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    width: max-content !important;
}

.rl-table-action-form {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
}

.rl-table-actions .rl-action-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 52px !important;
    min-height: 32px !important;
    padding: 6px 10px !important;
    border-radius: 6px !important;
    line-height: 1 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    width: auto !important;
}

.rl-table-actions button.rl-action-button {
    font: inherit !important;
    appearance: none !important;
    background: transparent;
}

.rl-action-button--edit {
    border: 1px solid #2563eb !important;
}

.rl-action-button--archive {
    border: 1px solid #dc2626 !important;
}

.rl-table td.rl-table-cell-actions {
    vertical-align: middle !important;
    white-space: nowrap !important;
    min-width: 140px !important;
}

.rl-table td.rl-table-cell-actions > .rl-table-actions {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: max-content !important;
    white-space: nowrap !important;
}

.rl-table td.rl-table-cell-actions > .rl-table-actions > a,
.rl-table td.rl-table-cell-actions > .rl-table-actions > form {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

.rl-table td.rl-table-cell-actions > .rl-table-actions > form > button {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
}

.rl-table-col-actions,
.rl-table-cell-actions {
    width: 150px !important;
    min-width: 150px !important;
    max-width: 150px !important;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
}

.rl-table-cell-actions * {
    white-space: nowrap !important;
}

.rl-table-actions {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    white-space: nowrap !important;
}

.rl-table-action-form {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    min-width: auto !important;
    flex: 0 0 auto !important;
}

.rl-action-button,
.rl-table-actions a,
.rl-table-actions button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 52px !important;
    height: 32px !important;
    padding: 6px 10px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
}

.rl-table-actions button {
    font: inherit !important;
    cursor: pointer !important;
}

.rl-quiz-option {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px !important;
    border: 1px solid #d7e0ee !important;
    border-radius: 8px !important;
    background: #fff !important;
    cursor: pointer !important;
}

.rl-quiz-option input[type="radio"] {
    display: inline-block !important;
    width: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    min-height: 16px !important;
    max-height: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    flex: 0 0 16px !important;
}

.rl-quiz-option__text {
    display: inline-block !important;
    flex: 1 1 auto !important;
    line-height: 1.6 !important;
    font-weight: 600 !important;
    margin: 0 !important;
}

.rl-quiz-options {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

@media print {
    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    html,
    body {
        background: #fff !important;
        color: #111827 !important;
    }

    body {
        margin: 0 !important;
    }

    .rl-page {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .rl-header,
    .rl-panel,
    .rl-detail-card,
    .rl-detail-section {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .rl-panel,
    .rl-kpi,
    .rl-table-wrap {
        border: 1px solid #111827 !important;
        background: #fff !important;
    }

    .rl-button,
    button,
    .rl-actions,
    .rl-print-actions,
    .rl-no-print,
    .rl-toolbar .rl-button,
    .rl-toolbar button,
    .rl-table-cell-actions,
    .rl-table-col-actions,
    script {
        display: none !important;
    }

    .rl-table-wrap {
        overflow: visible !important;
        border-radius: 0 !important;
    }

    .rl-table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: collapse !important;
    }

    .rl-table th,
    .rl-table td {
        border: 1px solid #111827 !important;
        padding: 6px 8px !important;
        color: #111827 !important;
        background: #fff !important;
        vertical-align: top !important;
    }

    .rl-table th {
        font-weight: 700 !important;
    }

    .rl-kpi-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
    }

    .rl-kpi {
        padding: 10px !important;
    }

    .rl-status-badge,
    .rl-badge {
        border: 1px solid #111827 !important;
        background: #fff !important;
        color: #111827 !important;
    }
}

.rl-approval-table .rl-table-col-actions,
.rl-approval-table .rl-table-cell-actions {
    width: 360px !important;
    min-width: 360px !important;
    max-width: none !important;
}

.rl-approval-table .rl-table-actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    width: auto !important;
}

@media screen {
    :root {
        --rl-bg: #f3f6f8;
        --rl-panel: #ffffff;
        --rl-panel-soft: #f7f9fb;
        --rl-text: #17212f;
        --rl-muted: #5f6f82;
        --rl-line: #d7e1ea;
        --rl-line-strong: #aebdca;
        --rl-primary: #1769aa;
        --rl-primary-dark: #0f4f82;
        --rl-primary-soft: #eaf4fb;
        --rl-accent: #087f7a;
        --rl-danger: #b42318;
        --rl-danger-soft: #fff3f1;
        --rl-shadow: 0 14px 32px rgba(22, 38, 55, 0.08);
    }

    body {
        background:
            linear-gradient(180deg, #eef5f7 0, rgba(238, 245, 247, 0) 280px),
            var(--rl-bg);
    }

    .rl-page {
        width: min(1120px, calc(100% - 48px));
        padding: 36px 0 64px;
    }

    .rl-header {
        margin-bottom: 22px;
        padding-bottom: 16px;
        border-bottom: 1px solid var(--rl-line);
    }

    .rl-header h1 {
        color: #102033;
        font-size: 30px;
        font-weight: 800;
        letter-spacing: 0;
    }

    .rl-header p {
        color: var(--rl-muted);
    }

    .rl-eyebrow {
        color: var(--rl-accent);
        letter-spacing: 0;
    }

    .rl-entry-hero {
        position: relative;
        overflow: hidden;
        padding: 32px;
        border-color: #c7dce7;
        background: linear-gradient(135deg, #ffffff 0%, #f4fbfb 100%);
    }

    .rl-entry-hero::before {
        content: "";
        position: absolute;
        inset: 0 auto 0 0;
        width: 6px;
        background: linear-gradient(180deg, var(--rl-primary), var(--rl-accent));
    }

    .rl-entry-hero h1 {
        margin-bottom: 10px;
        font-size: 34px;
    }

    .rl-entry-section {
        padding: 22px;
        border: 1px solid var(--rl-line);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.72);
    }

    .rl-entry-section--admin {
        border-color: #bfd9d6;
        background: #f3fbfa;
    }

    .rl-section-heading h2,
    .rl-card h2,
    .rl-panel h2,
    .rl-toolbar h2 {
        color: #122238;
        font-weight: 800;
    }

    .rl-card,
    .rl-panel,
    .rl-kpi,
    .rl-form,
    .rl-onboarding-card,
    .rl-auth-status,
    .rl-access-message {
        border-color: var(--rl-line);
        border-radius: 8px;
        box-shadow: var(--rl-shadow);
    }

    .rl-card,
    .rl-panel,
    .rl-onboarding-card {
        background: var(--rl-panel);
    }

    .rl-panel {
        padding: 26px;
    }

    .rl-panel + .rl-panel,
    .rl-grid + .rl-panel,
    .rl-kpi-grid + .rl-panel {
        margin-top: 20px;
    }

    .rl-entry-grid,
    .rl-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 18px;
    }

    .rl-entry-card,
    .rl-course-card {
        border-top: 4px solid var(--rl-primary);
    }

    .rl-entry-card--admin {
        border-top-color: var(--rl-accent);
        background: #fbfffe;
    }

    .rl-entry-card__label {
        color: var(--rl-primary-dark);
    }

    .rl-entry-card--admin .rl-entry-card__label {
        color: #05615d;
    }

    .rl-course-card {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .rl-course-card .rl-actions {
        margin-top: auto;
    }

    .rl-list {
        grid-template-columns: minmax(112px, 150px) minmax(0, 1fr);
        gap: 9px 18px;
    }

    .rl-list dt {
        color: #607086;
    }

    .rl-list dd {
        min-width: 0;
        color: #1d2939;
        font-weight: 600;
        word-break: break-word;
    }

    .rl-button,
    button.rl-button,
    input[type="submit"].rl-button,
    .rl-action-button {
        border-radius: 6px !important;
        transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    }

    .rl-button,
    button.rl-button,
    input[type="submit"].rl-button {
        border-color: var(--rl-primary);
        background: var(--rl-primary);
        box-shadow: 0 6px 14px rgba(23, 105, 170, 0.18);
    }

    .rl-button:hover,
    button.rl-button:hover,
    input[type="submit"].rl-button:hover {
        background: var(--rl-primary-dark);
        border-color: var(--rl-primary-dark);
    }

    .rl-button--secondary {
        background: #ffffff;
        color: var(--rl-primary-dark);
        box-shadow: none;
    }

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

    .rl-button--danger,
    .rl-action-button--archive {
        border-color: var(--rl-danger) !important;
        background: var(--rl-danger-soft) !important;
        color: var(--rl-danger) !important;
        box-shadow: none;
    }

    .rl-action-button--edit {
        border-color: var(--rl-primary) !important;
        background: var(--rl-primary-soft) !important;
        color: var(--rl-primary-dark) !important;
    }

    .rl-table-wrap {
        border-color: var(--rl-line);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }

    .rl-table {
        color: #1d2939;
    }

    .rl-table th {
        background: #edf4f7;
        color: #344054;
        font-weight: 800;
    }

    .rl-table td {
        background: #ffffff;
    }

    .rl-table tbody tr:hover td {
        background: #f8fbfc;
    }

    .rl-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 14px;
    }

    .rl-kpi {
        min-height: 118px;
        border-color: #c8dce8;
    }

    .rl-kpi::before {
        background: linear-gradient(90deg, var(--rl-primary), var(--rl-accent));
    }

    .rl-kpi span {
        color: #526579;
        font-size: 14px;
    }

    .rl-kpi strong {
        color: #123f63;
        font-size: 32px;
    }

    .rl-status-badge,
    .rl-badge {
        margin-top: 0;
        border-radius: 999px;
        font-size: 13px;
        line-height: 1;
    }

    .rl-status-badge--enrolled,
    .rl-status-badge--signed,
    .rl-status-badge--completed {
        border-color: #abefc6;
        background: var(--rl-success-bg);
        color: var(--rl-success);
    }

    .rl-status-badge--disabled {
        border-color: #d0d5dd;
        background: #f2f4f7;
        color: #475467;
    }

    .rl-notice,
    .rl-info-box {
        padding: 14px 16px;
        border: 1px solid #bdd7e5;
        border-radius: 8px;
        background: #f2f8fb;
        color: #23445b;
    }

    .rl-message {
        margin: 0 0 12px;
        padding: 12px 14px;
        border: 1px solid #bdd7e5;
        border-radius: 8px;
        background: #f2f8fb;
        color: #23445b;
        font-weight: 700;
    }

    .rl-message--success {
        border-color: #abefc6;
        background: var(--rl-success-bg);
        color: var(--rl-success);
    }

    .rl-message--warning {
        border-color: #fedf89;
        background: var(--rl-warning-bg);
        color: var(--rl-warning);
    }

    .rl-message--error {
        border-color: #fecdca;
        background: var(--rl-error-bg);
        color: var(--rl-error);
    }

    .rl-course-manage-page .rl-settings-result,
    .rl-course-manage-page .rl-course-release-blockers {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        max-width: 760px;
        overflow-wrap: anywhere;
    }

    .rl-course-manage-page .rl-settings-result.rl-message--success {
        --rl-settings-result-icon-bg: #157347;
    }

    .rl-course-manage-page .rl-settings-result.rl-message--error {
        --rl-settings-result-icon-bg: #b42318;
    }

    .rl-course-manage-page .rl-settings-result.rl-message--warning,
    .rl-course-manage-page .rl-course-release-blockers.rl-message--warning {
        --rl-settings-result-icon-bg: #9a5b00;
    }

    .rl-course-manage-page .rl-settings-result__icon,
    .rl-course-manage-page .rl-course-release-blockers__icon {
        display: inline-flex;
        flex: 0 0 24px;
        align-items: center;
        justify-content: center;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background-color: var(--rl-settings-result-icon-bg, #23445b);
        color: #fff;
        font-family: "Segoe UI Symbol", "Microsoft JhengHei", sans-serif;
        font-size: 16px;
        font-weight: 800;
        line-height: 1;
        text-align: center;
    }

    .rl-course-manage-page .rl-settings-result__content,
    .rl-course-manage-page .rl-course-release-blockers__content {
        min-width: 0;
    }

    .rl-course-manage-page .rl-settings-result__title,
    .rl-course-manage-page .rl-course-release-blockers__title {
        display: block;
    }

    .rl-course-manage-page .rl-settings-result__detail {
        margin: 4px 0 0;
        font-weight: 400;
    }

    .rl-course-manage-page .rl-course-release-blockers {
        margin: 0 0 12px;
    }

    .rl-course-manage-page .rl-course-release-blockers__list {
        /* 全站把 ul 的項目符號 reset 掉了，這裡要明確加回來：缺項是一份清單，
           有符號才看得出「有幾項、各是什麼」。 */
        margin: 4px 0 0;
        padding-left: 20px;
        font-weight: 400;
        list-style: disc outside;
    }

    /* 每一項都能點去對應區塊，就得看起來像連結——否則沒人知道可以點。 */
    .rl-course-manage-page .rl-course-release-blockers__list a {
        color: var(--rl-warning);
        text-decoration: underline;
        text-underline-offset: 2px;
    }

    .rl-course-manage-page .rl-course-release-blockers__list a:hover,
    .rl-course-manage-page .rl-course-release-blockers__list a:focus-visible {
        color: var(--rl-error);
    }

    .rl-course-manage-page .rl-course-release-blockers__list li + li {
        margin-top: 2px;
    }

    /*
     * 缺項提示的警示圖示。
     *
     * 提示框本身維持黃色警告色系——這是「還沒完成」不是「出錯了」，整框轉紅會
     * 過度緊張。只有圖示用紅色當視覺錨點，並比一般訊息圖示大一號；外圈用
     * --rl-error-bg 墊一圈淺底，讓紅色在黃底上跳出來。
     */
    .rl-course-manage-page .rl-course-release-blockers__icon {
        flex: 0 0 30px;
        width: 30px;
        height: 30px;
        background-color: var(--rl-error);
        box-shadow: 0 0 0 3px var(--rl-error-bg);
        font-size: 20px;
        font-weight: 900;
    }

    .rl-panel > p:only-child,
    .rl-panel > h2 + p {
        border-color: #bdd7e5;
        background: #f2f8fb;
        color: #23445b;
    }

    .rl-form {
        max-width: 760px;
        box-shadow: none;
    }

    .rl-form input,
    .rl-form select,
    .rl-form textarea,
    .rl-panel input,
    .rl-panel select,
    .rl-panel textarea {
        border-color: var(--rl-line-strong);
    }

    .rl-video-frame {
        width: 100%;
        aspect-ratio: 16 / 9;
        min-height: 260px;
        border: 0;
        border-radius: 8px;
        background: #101828;
    }

    .rl-virti-hero {
        display: grid;
        gap: 12px;
        max-width: 760px;
        padding: 18px;
        border: 1px solid #cfe0eb;
        border-radius: 14px;
        background: linear-gradient(180deg, #f6fbfe 0%, #eef7fb 100%);
        box-shadow: 0 8px 22px rgba(17, 65, 95, 0.06);
    }

    .rl-virti-hero__title {
        margin: 0;
        color: #0f4d73;
        font-size: 1.22rem;
        font-weight: 800;
    }

    .rl-virti-hero__lead,
    .rl-virti-hero__note {
        margin: 0;
        color: var(--rl-text-muted);
        font-size: 0.98rem;
        line-height: 1.65;
    }

    .rl-virti-hero__lead {
        color: #184d67;
        font-weight: 600;
    }

    .rl-virti-hero__note {
        color: #35546b;
    }

    .rl-virti-hero__actions {
        margin-top: 2px;
    }

    .rl-virti-open-button {
        min-height: 52px;
        padding: 0 22px;
        border-radius: 12px;
        font-size: 1.05rem;
        font-weight: 800;
        box-shadow: 0 10px 18px rgba(18, 107, 130, 0.18);
    }

    .rl-virti-open-button:hover {
        box-shadow: 0 12px 24px rgba(18, 107, 130, 0.24);
    }

    .rl-video-fallback {
        margin: 10px 0 0;
        color: var(--rl-text-muted);
        font-size: 0.92rem;
    }

    .rl-video-fallback--button {
        margin-top: 14px;
    }

    .rl-video-fallback a:not(.rl-video-fallback-button) {
        color: var(--rl-primary);
        font-weight: 700;
    }

    .rl-video-fallback-button {
        white-space: nowrap;
    }

    .rl-print-actions {
        border-color: #b6d4e2;
        background: #f6fbfd;
    }

    .rl-detail-card {
        border-top: 4px solid var(--rl-primary);
    }

    .rl-detail-section {
        border-top: 4px solid #d5e6ee;
    }
}

@media screen and (min-width: 1440px) {
    .rl-page {
        width: min(1080px, calc(100% - 64px));
    }
}

@media screen and (max-width: 760px) {
    .rl-page {
        width: min(100% - 24px, 1120px);
        padding: 24px 0 42px;
    }

    .rl-header {
        margin-bottom: 18px;
    }

    .rl-header h1 {
        font-size: 26px;
    }

    .rl-entry-section,
    .rl-entry-hero,
    .rl-panel,
    .rl-card,
    .rl-onboarding-card {
        padding: 18px;
    }

    .rl-list {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .rl-list dd {
        margin-bottom: 8px;
    }

    .rl-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .rl-table {
        min-width: 680px;
    }

    .rl-video-frame {
        min-height: 190px;
    }

    .rl-video-fallback-button {
        width: 100%;
        justify-content: center;
    }

    .rl-virti-open-button {
        width: 100%;
        min-width: 0;
        justify-content: center;
        box-sizing: border-box;
        line-height: 1.35;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

.rl-honeypot {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
}

.rl-manage-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin: 18px 0;
    padding: 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    background: #fff;
    border: 1px solid #d8e0e8;
    border-radius: 10px;
}

.rl-manage-tabs a { white-space: nowrap; padding: 8px 12px; border-radius: 6px; background: #eef5f8; text-decoration: none; }
.rl-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.rl-inline-form { display: inline; margin-left: 8px; }
.rl-link-button { border: 0; padding: 0; color: #9b2c2c; background: transparent; text-decoration: underline; cursor: pointer; }
.rl-block { display: block; margin-top: 6px; color: #52606d; }
.rl-quiz-actions-cell { min-width: 140px; text-align: center; }
.rl-quiz-actions { display: flex; align-items: center; justify-content: center; gap: 8px; }
.rl-quiz-actions form { margin: 0; }
.rl-quiz-actions .rl-action-button { white-space: nowrap; }
.rl-quiz-select-cell { width: 2.5rem; text-align: center; }
.rl-quiz-batch-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}
.rl-quiz-batch-actions__label { font-size: .85rem; color: var(--rl-muted); }

.rl-form .rl-inline-checkbox {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 44px;
    margin: 8px 0 14px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    text-align: left;
    cursor: pointer;
}

.rl-form .rl-inline-checkbox input[type="checkbox"] {
    display: inline-block !important;
    position: static !important;
    flex: 0 0 auto;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    vertical-align: middle;
    cursor: pointer;
}

.rl-form .rl-inline-checkbox span { display: inline-block; }

.rl-record-filter {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;
    white-space: nowrap;
}

.rl-record-filter label {
    display: inline-block;
    margin: 0;
    font-weight: 600;
}

.rl-record-filter select {
    width: auto;
    min-width: 180px;
    margin: 0;
}

#pretest details > summary,
#posttest details > summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    margin: 14px 0 20px;
    padding: 11px 20px;
    border-radius: 8px;
    color: #fff;
    font-size: 0;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(15, 40, 60, 0.2);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

#pretest details > summary { background: #126b82; }
#posttest details > summary { background: #6b4ca5; }
#pretest details > summary:hover { background: #0c5366; box-shadow: 0 4px 10px rgba(18, 107, 130, 0.3); }
#posttest details > summary:hover { background: #543783; box-shadow: 0 4px 10px rgba(107, 76, 165, 0.3); }
#pretest details > summary:active,
#posttest details > summary:active { transform: translateY(1px); }
#pretest details > summary::marker,
#posttest details > summary::marker { content: ''; }
#pretest details:not([open]) > summary::after { content: '＋ 新增前測題目'; font-size: 17px; }
#posttest details:not([open]) > summary::after { content: '＋ 新增後測題目'; font-size: 17px; }
#pretest details[open] > summary::after,
#posttest details[open] > summary::after { content: '收合新增題目'; font-size: 17px; }

@media (max-width: 720px) {
    .rl-manage-tabs { position: static; }
    .rl-manage-tabs a { min-height: 44px; display: inline-flex; align-items: center; }
    .rl-quiz-actions { flex-wrap: wrap; }
    #pretest details > summary,
    #posttest details > summary { display: flex; width: 100%; }
    #learners .rl-toolbar { align-items: stretch; }
    .rl-record-filter { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
    .rl-record-filter select { width: 100%; min-width: 0; }
}
/* Course list: fixed name, status and action columns with a horizontally scrollable middle. */
#course-list .rl-table-wrap {
    position: relative;
    max-width: 100%;
    overflow-x: auto;
}

.rl-courses-table {
    width: 100%;
    min-width: 1250px;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.rl-courses-table .rl-course-title-column {
    min-width: 220px;
    width: 220px;
    max-width: 220px;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: middle !important;
}

.rl-courses-table .rl-col-course-name {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #ffffff;
    box-sizing: border-box;
    border-right: 1px solid #c8dce7;
    box-shadow: 3px 0 5px rgba(0, 0, 0, 0.05);
}

.rl-courses-table .rl-course-id-column {
    min-width: 60px;
    width: 60px;
    text-align: center;
    white-space: nowrap;
}

.rl-courses-table .rl-course-date-column {
    min-width: 120px;
    white-space: nowrap;
}

.rl-courses-table .rl-course-time-column,
.rl-courses-table .rl-course-location-column {
    min-width: 110px;
    white-space: nowrap;
}

.rl-courses-table .rl-course-type-column {
    min-width: 130px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rl-courses-table .rl-course-lecturer-column {
    min-width: 120px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rl-courses-table .rl-course-hospital-column {
    min-width: 130px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rl-courses-table .rl-course-capacity-column {
    min-width: 100px;
    text-align: center;
    white-space: nowrap;
}

.rl-courses-table .rl-col-status,
.rl-courses-table .rl-col-actions {
    box-sizing: border-box;
    padding: 12px 14px !important;
    vertical-align: middle !important;
    background: #ffffff;
}

.rl-courses-table .rl-col-status {
    position: sticky;
    right: 270px;
    z-index: 3;
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    text-align: center !important;
    white-space: normal;
    border-left: 1px solid #c8dce7;
    box-shadow: -3px 0 5px rgba(0, 0, 0, 0.05);
}

.rl-courses-table .rl-col-actions {
    position: sticky;
    right: 0;
    z-index: 3;
    width: 270px;
    min-width: 270px;
    max-width: 270px;
    text-align: center !important;
    white-space: normal;
    border-left: 1px solid #c8dce7;
}

.rl-courses-table thead .rl-col-course-name,
.rl-courses-table thead .rl-col-status,
.rl-courses-table thead .rl-col-actions {
    background: var(--rl-panel-soft);
}

.rl-courses-table thead .rl-col-course-name {
    z-index: 6;
}

.rl-courses-table thead .rl-col-status,
.rl-courses-table thead .rl-col-actions {
    z-index: 5;
}

.rl-courses-table tbody tr:hover .rl-col-course-name,
.rl-courses-table tbody tr:hover .rl-col-status,
.rl-courses-table tbody tr:hover .rl-col-actions {
    background: #fbfdff;
}

.rl-courses-table .rl-course-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin: 0;
}

.rl-courses-table .rl-course-status .rl-status-badge,
.rl-courses-table .rl-course-status .rl-block {
    margin: 0;
}

.rl-courses-table .rl-course-status .rl-block {
    color: #52606d;
    line-height: 1.35;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rl-courses-table .rl-course-action-list {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px !important;
    flex-wrap: wrap !important;
    width: 100%;
    margin: 0;
}

.rl-courses-table .rl-course-action-list > a,
.rl-courses-table .rl-course-action-list > form,
.rl-courses-table .rl-course-action-list .rl-action-button {
    flex: 0 0 auto;
}

.rl-courses-table .rl-course-action-list > form {
    margin: 0 !important;
}

.rl-courses-table .rl-course-action-list .rl-action-button {
    min-width: 0 !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 6px 8px !important;
    font-size: 14px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
}

.rl-courses-table .rl-course-empty-row {
    text-align: center;
    white-space: normal;
}
/* User approvals: keep the reviewed user and available actions visible while horizontally scrolling. */
.rl-user-review-table-wrap {
    position: relative;
    overflow-x: auto;
    max-width: 100%;
}

.rl-user-review-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
}

.rl-user-identity-column {
    position: sticky;
    left: 0;
    min-width: 180px;
    width: 180px;
    max-width: 220px;
    vertical-align: middle !important;
    white-space: normal !important;
    background: #ffffff !important;
    box-sizing: border-box;
    border-right: 1px solid #c8dce7;
    overflow-wrap: anywhere;
    z-index: 4;
    box-shadow: 3px 0 5px rgba(0, 0, 0, 0.05);
}

.rl-user-review-table thead .rl-user-identity-column {
    z-index: 6;
    background: #eaf3f7 !important;
}

.rl-user-identity-name {
    font-weight: 700;
    color: #12304a;
}

.rl-user-identity-account {
    margin-top: 4px;
    font-size: 0.88rem;
    color: #5c7085;
}

/* Joomla 帳號已刪除的審核紀錄（孤兒紀錄）：標示並取代操作按鈕 */
.rl-user-identity-deleted {
    margin: 4px 0 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #9b2c2c;
}

.rl-user-actions-column {
    position: sticky;
    right: 0;
    min-width: 350px;
    width: 350px;
    max-width: 350px;
    vertical-align: middle !important;
    white-space: normal !important;
    background: #ffffff !important;
    box-sizing: border-box;
    border-left: 1px solid #c8dce7;
    z-index: 4;
    box-shadow: -3px 0 5px rgba(0, 0, 0, 0.05);
}

.rl-user-review-table thead .rl-user-actions-column {
    z-index: 6;
    background: #eaf3f7 !important;
    text-align: center;
}

.rl-user-status-column {
    min-width: 95px;
    text-align: center !important;
    vertical-align: middle !important;
    white-space: nowrap;
}

.rl-user-review-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.rl-user-review-actions label {
    font-weight: 700;
    text-align: center;
}

.rl-user-review-actions input[type="text"] {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 8px 10px;
    border: 1px solid var(--rl-line);
    border-radius: 6px;
    box-sizing: border-box;
}

.rl-user-action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

/* 手機寬度（≤767.98px）：兩張審核表改成卡片，不再橫向捲動。卡片本體沿用報表頁那套
   data-label 卡片規則（下方「Single-course learner, feedback, and discussion tables」那段，
   清單裡的 .rl-user-review-table 項目）：表頭隱藏、每列一張卡片、每格「欄名｜值」、
   「使用者」格當卡片標題、「操作」格欄名在上佔滿整列。
   這裡只放審核頁自己要覆寫的：桌機的左右固定欄（sticky、陰影、分隔線、固定寬度）在卡片裡要取消，
   操作按鈕觸控目標至少 44px 高並可換行。桌機（≥768px）完全不變。
   （732909b 起手機版兩欄都 sticky、合計 375px 大於可視寬度而重疊；1b8f9b9 改成只固定使用者欄仍需
   橫向捲動，2026-11 改為卡片。） */
@media (max-width: 767.98px) {
    .rl-user-review-table .rl-user-identity-column,
    .rl-user-review-table .rl-user-actions-column {
        position: static;
        box-shadow: none;
        border-left: 0;
        border-right: 0;
        z-index: auto;
    }

    /* 不用 input[type="text"]：表單裡另外只有 hidden input（不顯示），tests/support/css-cascade.php
       也不支援屬性選擇器，這樣寫測試才算得到實際生效的值。 */
    .rl-user-review-table .rl-user-review-actions input {
        min-height: 44px;
    }

    .rl-user-action-buttons {
        justify-content: flex-start;
    }

    .rl-user-review-table .rl-user-action-buttons .rl-action-button {
        height: auto !important;
        min-height: 44px !important;
        white-space: normal !important;
    }
}

/* Course evidence report: print as a continuous A4 landscape document. */
@page {
    size: A4 landscape;
    margin: 12mm;
}

@media print {
    html,
    body {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
        margin: 0 !important;
        background: #fff !important;
        color: #000 !important;
    }

    .rl-course-report,
    .rl-course-report-page,
    .rl-report-container,
    main {
        display: block !important;
        position: static !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        transform: none !important;
    }

    .rl-course-report {
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
    }

    /* Keep report headings continuous with the first content block. */
    .rl-course-report .rl-header,
    .rl-course-report .rl-course-basic-info,
    .rl-course-report .rl-report-section,
    .rl-course-report .rl-table-wrap,
    .rl-course-report table {
        break-before: auto !important;
        page-break-before: auto !important;
        break-inside: auto !important;
        page-break-inside: auto !important;
    }

    .rl-course-report .rl-kpi {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .rl-course-report tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .rl-course-report thead {
        display: table-header-group;
    }

    .rl-course-report .rl-table-wrap {
        overflow: visible !important;
        width: 100% !important;
        max-width: none !important;
    }

    .rl-course-report .rl-table {
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto !important;
        font-size: 10pt !important;
    }

    .rl-course-report .rl-table th,
    .rl-course-report .rl-table td {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    /* 報名與出席佐證／測驗成效／滿意度與回饋／互動討論／學員明細五張表在手機版是卡片（見下方 max-width: 767.98px 那組規則）。
       那組 @media 沒限定 screen，A4 可列印寬度約 718px 也會命中，所以列印時還原成一般表格。
       選擇器多帶 .rl-course-report，優先權才高過卡片規則（id＋class＋元素）。 */
    .rl-course-report #quiz-evidence .rl-table-wrap,
    .rl-course-report #feedback-evidence .rl-table-wrap,
    .rl-course-report #discussion-evidence .rl-table-wrap,
    .rl-course-report #learner-details .rl-table-wrap,
    .rl-course-report #attendance-evidence .rl-table-wrap {
        border: 1px solid var(--rl-line);
        border-radius: 8px;
        background: #ffffff;
    }

    /* 對齊 @media (max-width: 760px) 的 `.rl-table-wrap`（卡片規則把 margin／padding 歸零了）。 */
    @media (max-width: 760px) {
        .rl-course-report #quiz-evidence .rl-table-wrap,
        .rl-course-report #feedback-evidence .rl-table-wrap,
        .rl-course-report #discussion-evidence .rl-table-wrap,
        .rl-course-report #learner-details .rl-table-wrap,
        .rl-course-report #attendance-evidence .rl-table-wrap {
            margin-right: -6px;
            padding-bottom: 2px;
        }
    }

    .rl-course-report #quiz-evidence .rl-quiz-record-table,
    .rl-course-report #feedback-evidence .rl-feedback-table,
    .rl-course-report #discussion-evidence .rl-discussion-table,
    .rl-course-report #learner-details .rl-learning-record-table,
    .rl-course-report #attendance-evidence .rl-learning-record-table {
        display: table;
        border-collapse: collapse;
        border-spacing: revert;
    }

    .rl-course-report #quiz-evidence .rl-quiz-record-table thead,
    .rl-course-report #feedback-evidence .rl-feedback-table thead,
    .rl-course-report #discussion-evidence .rl-discussion-table thead,
    .rl-course-report #learner-details .rl-learning-record-table thead,
    .rl-course-report #attendance-evidence .rl-learning-record-table thead {
        display: table-header-group;
    }

    .rl-course-report #quiz-evidence .rl-quiz-record-table tbody,
    .rl-course-report #feedback-evidence .rl-feedback-table tbody,
    .rl-course-report #discussion-evidence .rl-discussion-table tbody,
    .rl-course-report #learner-details .rl-learning-record-table tbody,
    .rl-course-report #attendance-evidence .rl-learning-record-table tbody {
        display: table-row-group;
    }

    .rl-course-report #quiz-evidence .rl-quiz-record-table tr,
    .rl-course-report #feedback-evidence .rl-feedback-table tr,
    .rl-course-report #discussion-evidence .rl-discussion-table tr,
    .rl-course-report #learner-details .rl-learning-record-table tr,
    .rl-course-report #attendance-evidence .rl-learning-record-table tr {
        display: table-row;
        width: auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    /* 值對齊上方全站 @media print 的 `.rl-table td`（框線、顏色由那條的 !important 決定，這裡不重寫）。 */
    .rl-course-report #quiz-evidence .rl-quiz-record-table td,
    .rl-course-report #feedback-evidence .rl-feedback-table td,
    .rl-course-report #discussion-evidence .rl-discussion-table td,
    .rl-course-report #learner-details .rl-learning-record-table td,
    .rl-course-report #attendance-evidence .rl-learning-record-table td {
        display: table-cell;
        width: auto !important;
        min-width: 0 !important;
        padding: 6px 8px !important;
        background: #fff !important;
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
        vertical-align: top !important;
    }

    .rl-course-report #quiz-evidence .rl-quiz-record-table td::before,
    .rl-course-report #feedback-evidence .rl-feedback-table td::before,
    .rl-course-report #discussion-evidence .rl-discussion-table td::before,
    .rl-course-report #learner-details .rl-learning-record-table td::before,
    .rl-course-report #attendance-evidence .rl-learning-record-table td::before {
        content: none;
    }

    .rl-no-print,
    .rl-report-actions,
    .rl-anchor-nav,
    .rl-course-report .rl-actions,
    .rl-course-report .rl-admin-nav,
    header:not(.rl-header),
    footer,
    .back-to-top,
    .back-to-top-link,
    #back-top,
    .floating-decoration,
    .floating-mascot,
    .floating-rabbit,
    .rabbit-decoration,
    .rabbit-mascot {
        display: none !important;
    }

    .floating-decoration,
    .floating-mascot,
    .floating-rabbit,
    .rabbit-decoration,
    .rabbit-mascot {
        position: static !important;
        transform: none !important;
    }
}

.rl-page-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.rl-page-heading-row .rl-page-header {
    flex: 1;
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .rl-page-heading-row {
        flex-direction: column;
        align-items: stretch;
    }

    .rl-page-heading-row .rl-button {
        align-self: flex-start;
    }
}
.rl-improvement-table .rl-table-actions {
    flex-wrap: wrap !important;
    white-space: normal !important;
}

@media (max-width: 768px) {
    .rl-improvement-table .rl-table-actions {
        justify-content: flex-start;
    }
}
.rl-kpi-actions-column {
    min-width: 190px !important;
    width: 190px !important;
    max-width: none !important;
    text-align: center !important;
    vertical-align: middle !important;
    background: #ffffff;
    box-sizing: border-box;
    white-space: nowrap !important;
}

.rl-kpi-target-table thead .rl-kpi-actions-column { background: #eaf3f7; }

.rl-kpi-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
    width: 100%;
}

.rl-kpi-actions .rl-table-action-form {
    margin: 0;
    padding: 0;
    width: auto;
    flex: 0 0 auto;
}

.rl-kpi-target-list .rl-kpi-target-value-unit {
    display: none;
}

/* Annual KPI target list only: keep the existing rows and action forms on phones. */
@media screen and (max-width: 760px) {
    .rl-kpi-target-list,
    .rl-kpi-target-list .rl-table-wrap,
    .rl-kpi-target-list .rl-kpi-target-table,
    .rl-kpi-target-list .rl-kpi-target-table tbody,
    .rl-kpi-target-list .rl-kpi-target-table tr,
    .rl-kpi-target-list .rl-kpi-target-table td {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .rl-kpi-target-list .rl-table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .rl-kpi-target-list .rl-kpi-target-table,
    .rl-kpi-target-list .rl-kpi-target-table tbody,
    .rl-kpi-target-list .rl-kpi-target-table tr,
    .rl-kpi-target-list .rl-kpi-target-table td {
        display: block;
    }

    .rl-kpi-target-list .rl-kpi-target-table thead {
        display: none;
    }

    .rl-kpi-target-list .rl-kpi-target-table tr {
        display: grid;
        grid-template-columns: repeat(12, minmax(0, 1fr));
        gap: 8px;
        margin-bottom: 10px;
        padding: 10px;
        min-height: 0;
        border: 1px solid var(--rl-line);
        border-radius: 8px;
        background: #ffffff;
    }

    .rl-kpi-target-list .rl-kpi-target-table tr:last-child {
        margin-bottom: 0;
    }

    .rl-kpi-target-list .rl-kpi-target-table td {
        padding: 0;
        min-height: 0;
        border: 0;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .rl-kpi-target-list td[data-label]::before {
        display: inline;
        content: attr(data-label) '：';
        color: var(--rl-muted);
        font-size: 14px;
        font-weight: 700;
    }

    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(1) {
        grid-column: 1 / 9;
        grid-row: 1;
        align-self: center;
        font-weight: 700;
    }

    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(6) {
        grid-column: 9 / -1;
        grid-row: 1;
        align-self: start;
        text-align: right;
    }

    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(2) {
        grid-column: 1 / 7;
        grid-row: 2;
    }

    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(5) {
        grid-column: 7 / -1;
        grid-row: 2;
    }

    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(4) {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .rl-kpi-target-list .rl-kpi-target-table td.rl-kpi-actions-column {
        grid-column: 1 / -1;
        grid-row: 4;
    }

    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(3),
    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(1)::before,
    .rl-kpi-target-list .rl-kpi-target-table td:nth-child(6)::before,
    .rl-kpi-target-list .rl-kpi-actions-column::before {
        display: none;
    }

    .rl-kpi-target-list .rl-kpi-target-value-unit {
        display: inline;
    }

    .rl-kpi-target-list .rl-kpi-target-table td[colspan] {
        grid-column: 1 / -1;
        font-weight: normal;
    }

    /* Override the shared fixed action column and inline form widths. */
    .rl-kpi-target-list .rl-kpi-target-table td.rl-kpi-actions-column,
    .rl-kpi-target-list .rl-kpi-actions,
    .rl-kpi-target-list .rl-kpi-actions > *,
    .rl-kpi-target-list .rl-kpi-actions button {
        box-sizing: border-box;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .rl-kpi-target-list .rl-kpi-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
        align-items: stretch;
    }

    .rl-kpi-target-list .rl-kpi-actions > a,
    .rl-kpi-target-list .rl-kpi-actions button {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 40px !important;
        padding: 6px !important;
        font: inherit;
        line-height: 1.25 !important;
        text-decoration: none;
    }

    .rl-kpi-target-list .rl-status-badge {
        box-sizing: border-box;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }
}

@media (max-width: 768px) {
    .rl-kpi-actions { flex-wrap: wrap; }
    .rl-kpi-actions-column { min-width: 150px !important; width: 150px !important; }
}

.rl-status-badge--closed { background: #6b3f2a; color: #fff; }
.rl-course-closed-notice { border-left: 4px solid #8a4b28; }
.rl-course-closed-note { margin: 10px 0; padding-left: 0; color: #6b3f2a; }
.rl-button--disabled { opacity: .65; cursor: not-allowed; pointer-events: none; }

/* Pending-review course controls: keep the return form separate from approval. */
#course-status .rl-course-review-action-layout {
    max-width: 720px;
    margin-top: 18px;
}

#course-status .rl-course-return-form {
    margin: 0;
}

#course-status .rl-course-return-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: var(--rl-text);
    font-weight: 700;
}

#course-status .rl-course-return-form small {
    color: var(--rl-muted);
    font-weight: 400;
}

#course-status .rl-course-review-action-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: min(100%, 440px);
    margin-top: 16px;
}

#course-status .rl-course-review-action-buttons form {
    min-width: 0;
    margin: 0;
}

#course-status .rl-course-review-action-buttons .rl-button {
    width: 100%;
    min-height: 42px;
    justify-content: center;
}

#course-status .rl-course-review-action-buttons .rl-button--danger {
    border-color: var(--rl-danger);
    background: var(--rl-danger-soft);
    color: var(--rl-danger);
}

#course-status .rl-course-review-action-buttons .rl-button--danger:hover {
    background: #ffe3df;
}

@media (max-width: 480px) {
    #course-status .rl-course-review-action-buttons {
        grid-template-columns: 1fr;
        width: 100%;
    }
}

.rl-course-return-form {
    display: grid;
    gap: 10px;
    min-width: min(100%, 420px);
}

.rl-course-return-form label {
    display: grid;
    gap: 6px;
    margin: 0;
    font-weight: 600;
}

.rl-course-return-form textarea {
    min-height: 110px;
    resize: vertical;
}

.rl-course-return-form small {
    color: #667781;
    font-weight: 400;
}

.rl-course-return-notice {
    margin: 14px 0;
    padding: 14px 16px;
    border: 1px solid #d7b36a;
    border-left: 4px solid #a56b00;
    border-radius: 8px;
    background: #fff9e8;
}

.rl-course-return-notice h3,
.rl-course-return-notice p {
    margin: 0;
}

.rl-course-return-notice p + p {
    margin-top: 8px;
}

.rl-course-return-notice__meta {
    color: #59636e;
    font-size: 14px;
}

.rl-course-review-history-table td:last-child {
    min-width: 220px;
    white-space: normal;
}
/* Course editor assignment: compact, selectable rows rather than separate cards. */
#course-editors .rl-course-editor-list {
    display: grid;
    max-width: 720px;
    max-height: 320px;
    margin: 12px 0 16px;
    overflow-y: auto;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: #ffffff;
}

#course-editors .rl-course-editor-option {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    width: 100%;
    box-sizing: border-box;
    min-height: 64px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--rl-line);
    background: #ffffff;
    cursor: pointer;
    transition: background-color .15s ease;
}

#course-editors .rl-course-editor-option:last-child {
    border-bottom: 0;
}

#course-editors .rl-course-editor-option:hover {
    background: var(--rl-primary-soft);
}

#course-editors .rl-course-editor-option__checkbox {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
}

#course-editors .rl-course-editor-option__content {
    display: grid;
    min-width: 0;
    gap: 3px;
}

#course-editors .rl-course-editor-option__name {
    color: var(--rl-text);
    font-weight: 700;
    line-height: 1.35;
}

#course-editors .rl-course-editor-option__meta {
    color: var(--rl-muted);
    font-size: .9em;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

#course-editors .rl-course-editor-option:focus-within {
    outline: 2px solid rgba(42, 122, 170, .35);
    outline-offset: 2px;
}

#course-editors .rl-course-editor-option:has(input:checked) {
    background: var(--rl-primary-soft);
}

@media (max-width: 640px) {
    #course-editors .rl-course-editor-option {
        padding: 10px 12px;
    }

    #course-editors .rl-course-editor-list + .rl-button {
        width: 100%;
    }
}

/* Keep hash targets below the sticky course-management navigation. */
.rl-course-manage-page .rl-panel[id] {
    scroll-margin-top: 80px;
}

@media (max-width: 768px) {
    .rl-course-manage-page .rl-panel[id] {
        scroll-margin-top: 152px;
    }
}

/* In-platform notification page: all presentation is scoped to this component. */
.rl-notifications-page {
    max-width: 1040px;
}

.rl-notifications-page__nav,
.rl-notification-card__actions,
.rl-notifications-page__filters,
.rl-notification-card__meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rl-notifications-page__nav {
    justify-content: space-between;
    flex-wrap: wrap;
    margin: 18px 0;
}

.rl-notifications-page__nav form,
.rl-notification-card__actions form {
    margin: 0;
}

.rl-notifications-page__filters {
    flex-wrap: wrap;
    margin-bottom: 18px;
    font-weight: 700;
}

.rl-notifications-page__filter {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 4px 12px;
    border: 1px solid var(--rl-line);
    border-radius: 999px;
    color: var(--rl-text);
    font-weight: 600;
    text-decoration: none;
}

.rl-notifications-page__filter:hover,
.rl-notifications-page__filter:focus-visible,
.rl-notifications-page__filter.is-active {
    border-color: var(--rl-primary);
    background: var(--rl-primary-soft);
    color: var(--rl-primary);
}

.rl-notification-list {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rl-notification-card {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--rl-line);
    border-left: 5px solid #7f8b93;
    border-radius: 9px;
    background: #ffffff;
}

.rl-notification-card--unread {
    border-left-color: var(--rl-primary);
    background: #f4fbff;
    box-shadow: 0 1px 3px rgba(25, 73, 94, .14);
}

.rl-notification-card--read {
    background: #fbfcfd;
}

.rl-notification-card__meta {
    flex-wrap: wrap;
    color: var(--rl-muted);
    font-size: .9rem;
}

.rl-notification-card__state {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 1px 9px;
    border: 1px solid currentColor;
    border-radius: 999px;
    color: #52616b;
    font-weight: 700;
}

.rl-notification-card--unread .rl-notification-card__state {
    color: #075f8b;
}

.rl-notification-card h2,
.rl-notification-card p {
    margin: 0;
}

.rl-notification-card h2 {
    color: var(--rl-text);
    font-size: 1.1rem;
}

.rl-notification-card__message {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.rl-notification-card__actions {
    flex-wrap: wrap;
}

@media (max-width: 560px) {
    .rl-notifications-page__nav,
    .rl-notification-card__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .rl-notifications-page__nav .rl-button,
    .rl-notifications-page__nav form,
    .rl-notifications-page__nav form .rl-button,
    .rl-notification-card__actions .rl-button,
    .rl-notification-card__actions form,
    .rl-notification-card__actions form .rl-button {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Shared management backend layout. These rules are scoped to backend pages only. */
.rl-backend-layout {
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
    min-height: 100vh;
    overflow-x: clip;
    background: var(--rl-bg);
}

.rl-backend-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    max-height: 100dvh;
    flex-direction: column;
    border-right: 1px solid #164e79;
    background: linear-gradient(180deg, #0d3d61 0%, #102f4a 100%);
    color: #f7fbff;
    overflow-y: auto;
    z-index: 20;
}

.rl-backend-sidebar__header,
.rl-backend-sidebar__footer {
    padding: 18px;
}

.rl-backend-sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid rgba(216, 234, 248, .2);
}

.rl-backend-sidebar__brand {
    color: #ffffff;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.35;
    text-decoration: none;
}

.rl-backend-sidebar__brand:focus-visible,
.rl-backend-menu-item:focus-visible,
.rl-backend-topbar__menu-toggle:focus-visible,
.rl-backend-sidebar__close:focus-visible,
.rl-backend-layout .rl-backend-logout-button:focus-visible {
    outline: 3px solid #b9e3ff;
    outline-offset: 3px;
}

.rl-backend-sidebar__close,
.rl-backend-topbar__menu-toggle {
    min-height: 38px;
    border: 1px solid #9fc4df;
    border-radius: 6px;
    background: #ffffff;
    color: #0d3d61;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.rl-backend-sidebar__close {
    display: none;
    padding: 4px 10px;
}

.rl-backend-menu {
    display: grid;
    gap: 16px;
    padding: 18px 12px;
}

.rl-backend-menu__group {
    display: grid;
    gap: 5px;
}

.rl-backend-menu__group--current-course {
    border-top: 1px solid rgba(255, 255, 255, .3);
}

.rl-backend-current-course__name {
    margin: 0.25rem 8px 0.75rem;
    color: #ffffff;
    font-size: .9rem;
    font-weight: 700;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.rl-backend-menu-item--course-list {
    margin-bottom: .35rem;
}

.rl-backend-menu__group-title {
    margin: 0 8px 4px;
    color: #b7d6e9;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
}

.rl-backend-menu-item {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid transparent;
    border-radius: 7px;
    color: #edf7ff;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
}

.rl-backend-menu-item:hover,
.rl-backend-menu-item:focus-visible {
    border-color: rgba(185, 227, 255, .42);
    background: rgba(255, 255, 255, .12);
    color: #ffffff;
}

.rl-backend-menu-item-active {
    border-color: #8dd3ff;
    background: #e8f6ff;
    color: #0a4168;
    box-shadow: inset 4px 0 0 #1477ad;
}

.rl-backend-menu-item-active:hover,
.rl-backend-menu-item-active:focus-visible {
    border-color: #8dd3ff;
    background: #e8f6ff;
    color: #0a4168;
}

.rl-backend-menu-item__label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.rl-backend-menu-item__badge {
    display: inline-grid;
    min-width: 24px;
    min-height: 24px;
    place-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    background: #d94c3d;
    color: #ffffff;
    font-size: .78rem;
    line-height: 1;
}

.rl-backend-sidebar__footer {
    margin-top: auto;
    border-top: 1px solid rgba(216, 234, 248, .2);
}

.rl-backend-menu-item--platform {
    border-color: rgba(185, 227, 255, .28);
}

.rl-backend-main {
    min-width: 0;
}

.rl-backend-main > .rl-page {
    width: min(1480px, calc(100% - 48px));
    margin-right: auto;
    margin-left: auto;
}

.rl-backend-topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    min-height: 62px;
    align-items: center;
    gap: 16px;
    padding: 10px 24px;
    border-bottom: 1px solid var(--rl-line);
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 2px 8px rgba(23, 32, 51, .05);
}

.rl-backend-topbar__menu-toggle {
    display: none;
    flex: 0 0 auto;
    padding: 5px 12px;
}

.rl-backend-topbar__title {
    flex: 1 1 14rem;
    min-width: 0;
    margin: 0;
    color: var(--rl-text);
    font-weight: 800;
    overflow-wrap: anywhere;
}

.rl-backend-topbar__user {
    display: flex;
    min-width: 0;
    margin-left: auto;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
    color: var(--rl-muted);
    font-size: .9rem;
    text-align: right;
}

.rl-backend-topbar__user-name {
    color: var(--rl-text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.rl-backend-topbar__role {
    white-space: nowrap;
}

.rl-backend-layout .rl-backend-user {
    flex: 0 1 auto;
}

.rl-backend-layout .rl-backend-user-name {
    max-inline-size: min(28vw, 280px);
}

.rl-backend-layout .rl-backend-user-role {
    flex: 0 0 auto;
}

.rl-backend-logout-form {
    margin: 0;
}

.rl-backend-layout .rl-backend-logout-button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 5px 10px;
    border: 1px solid #0d3d61;
    border-radius: 6px;
    background: #0d3d61;
    color: #ffffff;
    font: inherit;
    font-size: .86rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}

.rl-backend-layout .rl-backend-logout-button:hover {
    border-color: #0a4168;
    background: #0a4168;
}

.rl-backend-layout__overlay {
    display: none;
}

@media (max-width: 900px) {
    .rl-backend-layout {
        display: block;
    }

    .rl-backend-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(86vw, 300px);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: 14px 0 32px rgba(8, 35, 54, .28);
    }

    .rl-backend-layout.is-menu-open .rl-backend-sidebar {
        transform: translateX(0);
    }

    .rl-backend-layout__overlay {
        position: fixed;
        inset: 0;
        display: block;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(8, 35, 54, .45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 15;
    }

    .rl-backend-layout.is-menu-open .rl-backend-layout__overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .rl-backend-sidebar__close,
    .rl-backend-topbar__menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .rl-backend-topbar {
        padding: 10px 16px;
    }

    .rl-backend-layout .rl-backend-user {
        align-items: flex-end;
        flex-wrap: wrap;
        justify-content: flex-end;
        column-gap: 8px;
        row-gap: 4px;
        font-size: .8rem;
    }

    .rl-backend-layout .rl-backend-user-name {
        flex-basis: 100%;
        max-inline-size: min(42vw, 280px);
    }

    .rl-backend-layout .rl-backend-logout-button {
        min-height: 36px;
    }

    .rl-backend-main > .rl-page {
        width: min(100% - 28px, 1480px);
        padding-top: 26px;
    }
}

@media (max-width: 560px) {
    .rl-backend-topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 9px 14px;
    }

    .rl-backend-topbar__menu-toggle {
        grid-column: 1;
        grid-row: 1;
    }

    .rl-backend-topbar__title {
        grid-column: 2;
        grid-row: 1;
        font-size: .92rem;
    }

    .rl-backend-layout .rl-backend-user {
        display: grid;
        grid-column: 1 / -1;
        grid-template-columns: minmax(0, 1fr) auto;
        width: 100%;
        margin-left: 0;
        align-items: center;
        column-gap: 8px;
        row-gap: 4px;
    }

    .rl-backend-layout .rl-backend-user-name {
        grid-column: 1 / -1;
        max-inline-size: none;
    }

    .rl-backend-layout .rl-backend-user-role {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .rl-backend-layout .rl-backend-logout-button {
        grid-column: 2;
        grid-row: 2;
    }
}

/* 手機（≤767.98px）：共用頂欄改成不透明白底。
   桌機沿用上面的 rgba(255, 255, 255, .96)；手機上內容從 sticky 頂欄底下捲過時，那 4%
   透明度會讓後面的文字透出來（醫療院所管理頁實測回報，所有走共用版面的後台頁都一樣）。
   層級不用動：z-index 10 已高於內容區所有 z-index（最高 6），又低於選單遮罩（15）與
   側欄（20），選單打開時仍要被遮住。限定 screen：列印時頂欄本來就隱藏。 */
@media screen and (max-width: 767.98px) {
    .rl-backend-layout .rl-backend-topbar {
        background: #ffffff;
    }
}

/* 手機（≤767.98px）：共用頂欄縮成一行——左邊「選單」＋頁面名稱，右邊只留「登出」。
   原本 ≤560px 是兩列的 grid（第二列放姓名、身分與登出），561～767px 的 flex 也會因為
   姓名 flex-basis: 100% 換行，頂欄佔掉 100px 以上。
   - 姓名與身分文字改成視覺隱藏（不是 display: none）：螢幕閱讀器仍會在「目前登入者」
     區塊讀到，畫面上不佔位置。管理首頁原本那條 display: none 一併拿掉，改由這裡處理。
   - 頁面名稱單行加刪節號；名稱再長也只會縮短自己，「登出」固定寬度不被擠出畫面。
   - 選擇器都是 .rl-backend-layout 開頭（0-2-0 以上），而且排在 ≤900px／≤560px 兩段之後，
     同特異性靠順序蓋過那兩段的 grid 設定。
   限定 screen：列印時頂欄本來就隱藏；桌機（≥768px）不受影響。 */
@media screen and (max-width: 767.98px) {
    .rl-backend-layout .rl-backend-topbar {
        display: flex;
        min-height: 0;
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
        padding: 9px 14px;
    }

    .rl-backend-layout .rl-backend-topbar__menu-toggle {
        flex: 0 0 auto;
    }

    .rl-backend-layout .rl-backend-topbar__title {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        font-size: .92rem;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow-wrap: normal;
    }

    .rl-backend-layout .rl-backend-user {
        display: flex;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        width: auto;
        margin-left: 0;
        align-items: center;
        gap: 0;
    }

    .rl-backend-layout .rl-backend-user-name,
    .rl-backend-layout .rl-backend-user-role {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        clip-path: inset(50%);
        border: 0;
        white-space: nowrap;
    }

    .rl-backend-layout .rl-backend-logout-button {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* Account for the shared sticky topbar when opening course-management hashes. */
.rl-backend-layout .rl-manage-tabs {
    top: 62px;
}

.rl-backend-layout .rl-course-manage-page .rl-panel[id] {
    scroll-margin-top: 146px;
}

@media (max-width: 720px) {
    .rl-backend-layout .rl-manage-tabs {
        position: static;
        top: auto;
    }
}

@media (max-width: 768px) {
    .rl-backend-layout .rl-course-manage-page .rl-panel[id] {
        scroll-margin-top: 214px;
    }
}

@media print {
    .rl-backend-sidebar,
    .rl-backend-topbar,
    .rl-backend-layout__overlay {
        display: none !important;
    }

    .rl-backend-layout,
    .rl-backend-main {
        display: block !important;
    }
}

/* Course list only: retain the wide, sticky-column table and its own scroll container on desktop. */
@media (min-width: 768px) {
    #course-list .rl-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-gutter: stable;
    }

    #course-list .rl-admin-course-table {
        display: table;
        width: 100%;
        min-width: 1250px !important;
    }
}

.rl-course-status-actions__title-mobile-admin,
.rl-course-admin-operation-links {
    display: none;
}

.rl-course-editor-mobile-summary,
.rl-site-feedback-mobile-list {
    display: none;
}

.rl-course-editor-mobile-report {
    display: none;
}

/* Shared compact single-course view for platform administrators and course editors on phones only. */
@media (max-width: 767.98px) {
    .rl-course-manage-page.rl-course-editor-view {
        display: flex;
        flex-direction: column;
    }

    .rl-course-manage-page.rl-course-editor-view > * {
        min-width: 0;
        order: 50;
    }

    .rl-course-manage-page.rl-course-editor-view > .rl-header {
        order: 0;
    }

    .rl-course-manage-page.rl-course-editor-view > .rl-message {
        order: 5;
    }

    .rl-course-manage-page.rl-course-editor-view > .rl-course-dashboard-summary {
        order: 10;
    }

    .rl-course-manage-page.rl-course-editor-view > #course-status {
        order: 20;
    }

    .rl-course-manage-page.rl-course-editor-view > #course-editors {
        order: 30;
    }

    .rl-course-manage-page.rl-course-editor-view > .rl-manage-tabs {
        order: 40;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-dashboard-summary__toolbar,
    .rl-course-manage-page.rl-course-editor-view .rl-course-dashboard-kpis,
    .rl-course-manage-page.rl-course-editor-view .rl-improvement-summary {
        display: none;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-summary {
        display: grid;
        min-width: 0;
        gap: 14px;
    }

    .rl-course-editor-mobile-summary__heading h2,
    .rl-course-editor-mobile-summary__heading p {
        margin: 0;
    }

    .rl-course-editor-mobile-summary__heading p {
        margin-top: 5px;
        color: var(--rl-text);
        font-size: 1.05rem;
        font-weight: 700;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    .rl-course-editor-mobile-summary__details,
    .rl-site-feedback-mobile-card__details {
        display: grid;
        gap: 7px;
        margin: 0;
    }

    .rl-course-editor-mobile-summary__details > div,
    .rl-site-feedback-mobile-card__details > div {
        display: grid;
        grid-template-columns: 6rem minmax(0, 1fr);
        gap: 8px;
        padding-bottom: 7px;
        border-bottom: 1px solid #edf2f5;
    }

    .rl-course-editor-mobile-summary__details > div:last-child,
    .rl-site-feedback-mobile-card__details > div:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .rl-course-editor-mobile-summary__details dt,
    .rl-site-feedback-mobile-card__details dt {
        color: var(--rl-muted);
        font-size: .84rem;
        font-weight: 700;
    }

    .rl-course-editor-mobile-summary__details dd,
    .rl-site-feedback-mobile-card__details dd {
        min-width: 0;
        margin: 0;
        color: var(--rl-text);
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .rl-course-editor-mobile-summary__details .rl-status-badge {
        font-size: .78rem;
    }

    .rl-course-editor-mobile-summary__actions,
    .rl-site-feedback-mobile-card__actions {
        display: grid;
        gap: 8px;
    }

    .rl-course-editor-mobile-summary__actions .rl-button,
    .rl-site-feedback-mobile-card__actions .rl-button {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow-wrap: anywhere;
    }

    .rl-course-editor-mobile-summary__metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .rl-course-editor-mobile-summary__metrics article {
        min-width: 0;
        padding: 12px;
        border: 1px solid #e3ebf0;
        border-radius: 8px;
        background: #f9fcfd;
    }

    .rl-course-editor-mobile-summary__metrics span,
    .rl-course-editor-mobile-summary__metrics strong {
        display: block;
        overflow-wrap: anywhere;
    }

    .rl-course-editor-mobile-summary__metrics span {
        color: var(--rl-muted);
        font-size: .8rem;
        font-weight: 700;
        line-height: 1.35;
    }

    .rl-course-editor-mobile-summary__metrics strong {
        margin-top: 4px;
        color: var(--rl-text);
        font-size: 1.05rem;
        line-height: 1.35;
    }

    .rl-course-manage-page.rl-course-admin-mobile-view .rl-course-status-actions__title-default {
        display: none;
    }

    .rl-course-manage-page.rl-course-admin-mobile-view .rl-course-status-actions__title-mobile-admin {
        display: inline;
    }

    .rl-course-manage-page.rl-course-admin-mobile-view .rl-course-admin-operation-links {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-top: 14px;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-status-actions,
    .rl-course-manage-page.rl-course-editor-view .rl-course-status-actions form,
    .rl-course-manage-page.rl-course-editor-view .rl-course-review-action-layout,
    .rl-course-manage-page.rl-course-editor-view .rl-course-return-form {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-review-action-layout {
        width: 100%;
        margin-top: 14px;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-review-action-buttons {
        grid-template-columns: 1fr;
        width: 100%;
        margin-top: 12px;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-return-form textarea {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-return-notice,
    .rl-course-manage-page.rl-course-editor-view .rl-course-return-notice__meta {
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-status-actions > form .rl-button,
    .rl-course-manage-page.rl-course-editor-view .rl-course-review-action-buttons .rl-button,
    .rl-course-manage-page.rl-course-admin-mobile-view .rl-course-admin-operation-links .rl-button {
        width: 100%;
        min-width: 0;
        justify-content: center;
        box-sizing: border-box;
    }

    .rl-course-manage-page.rl-course-editor-view #course-report > .rl-course-report__heading,
    .rl-course-manage-page.rl-course-editor-view #course-report > .rl-course-report-full {
        display: none;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report {
        display: block;
        min-width: 0;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report > summary {
        display: flex;
        min-width: 0;
        min-height: 44px;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 12px;
        border: 1px solid #d8e5ed;
        border-radius: 8px;
        background: #f9fcfd;
        color: var(--rl-text);
        cursor: pointer;
        list-style: none;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report > summary::-webkit-details-marker {
        display: none;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__title,
    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__toggle {
        min-width: 0;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__title {
        font-size: .95rem;
        font-weight: 700;
        line-height: 1.35;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__toggle {
        flex: 0 1 auto;
        color: #356179;
        font-size: .84rem;
        font-weight: 700;
        line-height: 1.35;
        text-align: right;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__toggle--open,
    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report[open] .rl-course-editor-mobile-report__toggle--closed {
        display: none;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report[open] .rl-course-editor-mobile-report__toggle--open {
        display: block;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin-top: 10px;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics article {
        min-width: 0;
        min-height: 0;
        padding: 11px 12px;
        border: 1px solid #e3ebf0;
        border-radius: 8px;
        background: #ffffff;
        box-sizing: border-box;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics span,
    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics strong {
        display: block;
        min-width: 0;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics span {
        color: var(--rl-muted);
        font-size: .8rem;
        font-weight: 700;
        line-height: 1.4;
    }

    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics strong {
        margin-top: 4px;
        color: var(--rl-text);
        font-size: 1rem;
        line-height: 1.3;
    }
}

@media (max-width: 359.98px) {
    .rl-course-manage-page.rl-course-editor-view .rl-course-editor-mobile-report__metrics {
        grid-template-columns: 1fr;
    }
}

/* Single-course learner, feedback, and discussion tables only: show each record as a readable phone card.
   同一套卡片規則也套用在課程主控台的「審核歷程」（#review-history）與前台課程頁的
   「課程互動討論」（#discussion），兩者都以區塊 id＋專屬 class 限定範圍，不動全站 .rl-table。
   單一課程報表（templates/admin-course-report-view.php）的測驗成效（#quiz-evidence）、
   滿意度與回饋（#feedback-evidence）、互動討論（#discussion-evidence）三張表也併入這裡。
   報表檢視（admin-reports.php）的測驗紀錄（#quiz-records）、滿意度與回饋紀錄（#feedback-records）、
   互動討論紀錄（#discussion-records）三張表同樣併入。
   單一課程報表的學員明細與原始紀錄（#learner-details）、報名與出席佐證（#attendance-evidence）
   沿用 #learners 的 rl-learning-record-* class。
   平台使用審核頁（admin-user-approvals.php）的兩張表（.rl-user-review-table，2026-11）也併入：
   「使用者」格＝標題、「操作」格＝長內容欄；取消固定欄等審核頁專屬覆寫寫在審核頁那段 @media。 */
@media (max-width: 767.98px) {
    #learners .rl-table-wrap,
    #feedback .rl-table-wrap,
    #review-history .rl-table-wrap,
    #discussion .rl-table-wrap,
    #quiz-evidence .rl-table-wrap,
    #feedback-evidence .rl-table-wrap,
    #discussion-evidence .rl-table-wrap,
    #quiz-records .rl-table-wrap,
    #feedback-records .rl-table-wrap,
    #discussion-records .rl-table-wrap,
    #learner-details .rl-table-wrap,
    #attendance-evidence .rl-table-wrap,
    .rl-user-review-table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    #learners .rl-learning-record-table,
    #feedback .rl-feedback-table,
    #feedback .rl-discussion-table,
    #review-history .rl-course-review-history-table,
    #discussion .rl-discussion-table,
    #quiz-evidence .rl-quiz-record-table,
    #feedback-evidence .rl-feedback-table,
    #discussion-evidence .rl-discussion-table,
    #quiz-records .rl-quiz-record-table,
    #feedback-records .rl-feedback-table,
    #discussion-records .rl-discussion-table,
    #learner-details .rl-learning-record-table,
    #attendance-evidence .rl-learning-record-table,
    .rl-user-review-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    #learners .rl-learning-record-table thead,
    #feedback .rl-feedback-table thead,
    #feedback .rl-discussion-table thead,
    #review-history .rl-course-review-history-table thead,
    #discussion .rl-discussion-table thead,
    #quiz-evidence .rl-quiz-record-table thead,
    #feedback-evidence .rl-feedback-table thead,
    #discussion-evidence .rl-discussion-table thead,
    #quiz-records .rl-quiz-record-table thead,
    #feedback-records .rl-feedback-table thead,
    #discussion-records .rl-discussion-table thead,
    #learner-details .rl-learning-record-table thead,
    #attendance-evidence .rl-learning-record-table thead,
    .rl-user-review-table thead {
        display: none;
    }

    #learners .rl-learning-record-table tbody,
    #feedback .rl-feedback-table tbody,
    #feedback .rl-discussion-table tbody,
    #review-history .rl-course-review-history-table tbody,
    #discussion .rl-discussion-table tbody,
    #quiz-evidence .rl-quiz-record-table tbody,
    #feedback-evidence .rl-feedback-table tbody,
    #discussion-evidence .rl-discussion-table tbody,
    #quiz-records .rl-quiz-record-table tbody,
    #feedback-records .rl-feedback-table tbody,
    #discussion-records .rl-discussion-table tbody,
    #learner-details .rl-learning-record-table tbody,
    #attendance-evidence .rl-learning-record-table tbody,
    .rl-user-review-table tbody {
        display: grid;
        gap: 12px;
    }

    #learners .rl-learning-record-card,
    #feedback .rl-feedback-card,
    #feedback .rl-discussion-card,
    #review-history .rl-review-history-card,
    #discussion .rl-discussion-card,
    #quiz-evidence .rl-quiz-record-card,
    #feedback-evidence .rl-feedback-card,
    #discussion-evidence .rl-discussion-card,
    #quiz-records .rl-quiz-record-card,
    #feedback-records .rl-feedback-card,
    #discussion-records .rl-discussion-card,
    #learner-details .rl-learning-record-card,
    #attendance-evidence .rl-learning-record-card,
    .rl-user-review-table tbody tr {
        display: block;
        width: 100%;
        min-width: 0;
        overflow: hidden;
        border: 1px solid #e3ebf0;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 1px 4px rgba(20, 56, 82, 0.06);
        box-sizing: border-box;
    }

    #learners .rl-learning-record-table td,
    #feedback .rl-feedback-table td,
    #feedback .rl-discussion-table td,
    #review-history .rl-course-review-history-table td,
    #discussion .rl-discussion-table td,
    #quiz-evidence .rl-quiz-record-table td,
    #feedback-evidence .rl-feedback-table td,
    #discussion-evidence .rl-discussion-table td,
    #quiz-records .rl-quiz-record-table td,
    #feedback-records .rl-feedback-table td,
    #discussion-records .rl-discussion-table td,
    #learner-details .rl-learning-record-table td,
    #attendance-evidence .rl-learning-record-table td,
    .rl-user-review-table td {
        display: grid;
        grid-template-columns: 5.75rem minmax(0, 1fr);
        gap: 8px;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 10px 14px !important;
        border: 0;
        border-bottom: 1px solid #edf2f5;
        background: #ffffff !important;
        color: var(--rl-text);
        text-align: left !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    #learners .rl-learning-record-table td:last-child,
    #feedback .rl-feedback-table td:last-child,
    #feedback .rl-discussion-table td:last-child,
    #review-history .rl-course-review-history-table td:last-child,
    #discussion .rl-discussion-table td:last-child,
    #quiz-evidence .rl-quiz-record-table td:last-child,
    #feedback-evidence .rl-feedback-table td:last-child,
    #discussion-evidence .rl-discussion-table td:last-child,
    #quiz-records .rl-quiz-record-table td:last-child,
    #feedback-records .rl-feedback-table td:last-child,
    #discussion-records .rl-discussion-table td:last-child,
    #learner-details .rl-learning-record-table td:last-child,
    #attendance-evidence .rl-learning-record-table td:last-child,
    .rl-user-review-table td:last-child {
        border-bottom: 0;
    }

    #learners .rl-learning-record-table td::before,
    #feedback .rl-feedback-table td::before,
    #feedback .rl-discussion-table td::before,
    #review-history .rl-course-review-history-table td::before,
    #discussion .rl-discussion-table td::before,
    #quiz-evidence .rl-quiz-record-table td::before,
    #feedback-evidence .rl-feedback-table td::before,
    #discussion-evidence .rl-discussion-table td::before,
    #quiz-records .rl-quiz-record-table td::before,
    #feedback-records .rl-feedback-table td::before,
    #discussion-records .rl-discussion-table td::before,
    #learner-details .rl-learning-record-table td::before,
    #attendance-evidence .rl-learning-record-table td::before,
    .rl-user-review-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: #788897;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.45;
    }

    #learners .rl-learning-record-card__name,
    #feedback .rl-feedback-card__name,
    #feedback .rl-discussion-table .rl-discussion-card__name,
    #review-history .rl-course-review-history-table .rl-review-history-card__action,
    #discussion .rl-discussion-table .rl-discussion-card__name,
    #quiz-evidence .rl-quiz-record-table .rl-quiz-record-card__name,
    #feedback-evidence .rl-feedback-table .rl-feedback-card__name,
    #discussion-evidence .rl-discussion-table .rl-discussion-card__name,
    #quiz-records .rl-quiz-record-table .rl-quiz-record-card__name,
    #feedback-records .rl-feedback-table .rl-feedback-card__name,
    #learner-details .rl-learning-record-table .rl-learning-record-card__name,
    #attendance-evidence .rl-learning-record-table .rl-learning-record-card__name,
    .rl-user-review-table .rl-user-identity-column {
        display: block;
        padding: 14px !important;
        color: var(--rl-text);
        font-size: 1.05rem;
        font-weight: 700;
        line-height: 1.45;
    }

    #learners .rl-learning-record-card__name::before,
    #feedback .rl-feedback-card__name::before,
    #feedback .rl-discussion-card__name::before,
    #review-history .rl-review-history-card__action::before,
    #discussion .rl-discussion-card__name::before,
    #quiz-evidence .rl-quiz-record-card__name::before,
    #feedback-evidence .rl-feedback-card__name::before,
    #discussion-evidence .rl-discussion-card__name::before,
    #quiz-records .rl-quiz-record-card__name::before,
    #feedback-records .rl-feedback-card__name::before,
    #learner-details .rl-learning-record-card__name::before,
    #attendance-evidence .rl-learning-record-card__name::before,
    .rl-user-review-table .rl-user-identity-column::before {
        display: none;
    }

    /* 長文字欄（退回原因、前台留言、課程主控台的課程討論留言）：欄名放上方、內容佔滿
       整張卡片寬度並自動換行。內容由 nl2br() 輸出 <br>，所以這裡維持 white-space: normal，
       不用 pre-wrap（pre-wrap 會讓原文的換行字元再多斷一次行）。
       選擇器刻意帶上表格 class：要蓋過上面 `#… .…-table td { display: grid }`（id＋class＋元素）。 */
    #review-history .rl-course-review-history-table .rl-review-history-card__reason,
    #discussion .rl-discussion-table .rl-discussion-card__message,
    #feedback .rl-discussion-table .rl-discussion-card__message,
    #feedback-evidence .rl-feedback-table .rl-feedback-card__content,
    #discussion-evidence .rl-discussion-table .rl-discussion-card__message,
    #feedback-records .rl-feedback-table .rl-feedback-card__content,
    #discussion-records .rl-discussion-table .rl-discussion-card__message,
    .rl-user-review-table .rl-user-actions-column {
        display: block;
        min-width: 0;
        line-height: 1.6;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #review-history .rl-course-review-history-table .rl-review-history-card__reason::before,
    #discussion .rl-discussion-table .rl-discussion-card__message::before,
    #feedback .rl-discussion-table .rl-discussion-card__message::before,
    #feedback-evidence .rl-feedback-table .rl-feedback-card__content::before,
    #discussion-evidence .rl-discussion-table .rl-discussion-card__message::before,
    #feedback-records .rl-feedback-table .rl-feedback-card__content::before,
    #discussion-records .rl-discussion-table .rl-discussion-card__message::before,
    .rl-user-review-table .rl-user-actions-column::before {
        display: block;
        margin-bottom: 8px;
    }

    #feedback .rl-feedback-card__content,
    #feedback .rl-discussion-card__message,
    #feedback .rl-discussion-card__actions {
        display: block;
        min-width: 0;
    }

    #feedback .rl-feedback-card__content::before,
    #feedback .rl-discussion-card__message::before,
    #feedback .rl-discussion-card__actions::before {
        display: block;
        margin-bottom: 8px;
    }

    #feedback .rl-feedback-card__content,
    #feedback .rl-discussion-card__message {
        line-height: 1.6;
        white-space: pre-wrap !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #learners .rl-learning-record-card__completion-status,
    #feedback .rl-discussion-card__status-value {
        display: inline-flex;
        width: fit-content;
        max-width: 100%;
        align-items: center;
        min-width: 0;
        padding: 3px 8px;
        border: 1px solid #d7e6ef;
        border-radius: 999px;
        background: #f5fafc;
        color: #356179;
        font-size: .8rem;
        font-weight: 700;
        line-height: 1.35;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    #feedback .rl-discussion-card__actions form {
        display: flex;
        width: 100%;
        min-width: 0;
        margin: 0;
    }

    #feedback .rl-discussion-card__actions button {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding: 8px 10px;
        box-sizing: border-box;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* 課程主控台「學員與紀錄」卡片：「教材」與「採計分數（最高）」兩格裡有多個段落與可展開的
   表單。卡片的 td 是「欄名｜值」兩欄 grid，這些子元素會在 5.75rem 的欄名欄與值欄之間交錯，
   表單欄位還會撐出卡片（卡片 overflow: hidden，超出的部分直接被切掉）。
   改成欄名在上、內容佔整列寬度（比照上面長文字欄的做法）。選擇器帶 td.class（1-2-1）才
   蓋得過 `#learners .rl-learning-record-table td`（1-1-1）。限定 screen：上面那組沒限定，
   A4 列印寬度也會命中，這裡不帶進列印。 */
@media screen and (max-width: 767.98px) {
    #learners .rl-learning-record-table td.rl-material-cell,
    #learners .rl-learning-record-table td.rl-virti-score-cell {
        display: block;
    }

    #learners .rl-learning-record-table td.rl-material-cell::before,
    #learners .rl-learning-record-table td.rl-virti-score-cell::before {
        display: block;
        margin-bottom: 8px;
    }

    #learners .rl-learning-record-table td.rl-material-cell > *,
    #learners .rl-learning-record-table td.rl-virti-score-cell > * {
        max-width: 100%;
        min-width: 0;
    }

    /* 表單在窄卡片裡收掉資料輸入表單的 720px 上限與 24px 內距；欄位是 grid item，
       min-width 預設 auto 會被日期時間欄位的最小寬度撐開，要明確歸零。 */
    #learners .rl-learning-record-table td.rl-material-cell .rl-form,
    #learners .rl-learning-record-table td.rl-virti-score-cell .rl-form {
        max-width: none;
        min-width: 0;
        padding: 12px;
    }

    #learners .rl-learning-record-table td.rl-material-cell .rl-form > *,
    #learners .rl-learning-record-table td.rl-virti-score-cell .rl-form > *,
    #learners .rl-learning-record-table td.rl-material-cell .rl-form input,
    #learners .rl-learning-record-table td.rl-material-cell .rl-form textarea,
    #learners .rl-learning-record-table td.rl-virti-score-cell .rl-form input {
        min-width: 0;
        max-width: 100%;
    }
}

/* 課程主控台手機版（≤767.98px）的兩處超出卡片：
   1. 「教材設定」：YouTube 預覽播放器由 IFrame API 以 width="320" 建立在 #rlm-youtube-duration-probe。
      .rl-form 是 grid、子項 min-width 預設 auto，唯一的欄軌被撐到 320px 以上，教材來源、網址、
      影片長度、有效範圍等欄位跟著變寬而超出卡片（卡片內容寬在 375px 手機上只有約 270px）。
      欄軌改成 minmax(0, 1fr)、子項（含 YouTube 群組裡的播放器）min-width 歸零、max-width: 100%，
      欄位一律滿寬。
   2. 「學員與紀錄」裡的「Virti 分數登錄歷程」表：上面卡片規則的 `#learners .rl-table-wrap
      { overflow: visible !important }` 是給學員卡片表用的，連帶讓這張一般表格（min-width 720px）
      整張撐出卡片。改回在外框內左右捲動（比照其他一般表格）。
   選擇器都帶 .rl-course-manage-page，只作用在這一頁；限定 screen，列印不變。 */
@media screen and (max-width: 767.98px) {
    .rl-course-manage-page #material .rl-form {
        grid-template-columns: minmax(0, 1fr);
        max-width: none;
        min-width: 0;
    }

    .rl-course-manage-page #material .rl-form > *,
    .rl-course-manage-page #material .rl-form .rl-form-group > * {
        min-width: 0;
        max-width: 100%;
    }

    .rl-course-manage-page #material .rl-form input,
    .rl-course-manage-page #material .rl-form select,
    .rl-course-manage-page #material .rl-form textarea {
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .rl-course-manage-page #learners .rl-virti-score-history .rl-table-wrap {
        max-width: 100%;
        overflow-x: auto !important;
    }
}

/* 報表檢視（admin-reports.php）三張紀錄表：上面那組 @media 沒限定 screen，A4 可列印寬度約 718px
   也會命中，所以列印時還原成一般表格（比照課程報表 .rl-course-report 的 @media print）。
   數值對齊全站 @media print 的 `.rl-table td` 與 @media (max-width: 760px) 的 `.rl-table-wrap`；
   操作欄由全站 @media print 的 `.rl-table-cell-actions { display: none !important }` 照舊隱藏。
   選擇器多帶 .rl-reports-page，優先權才高過卡片規則（id＋class＋元素）。 */
@media print {
    .rl-reports-page #quiz-records .rl-table-wrap,
    .rl-reports-page #feedback-records .rl-table-wrap,
    .rl-reports-page #discussion-records .rl-table-wrap {
        border: 1px solid var(--rl-line);
        background: #ffffff;
    }

    @media (max-width: 760px) {
        .rl-reports-page #quiz-records .rl-table-wrap,
        .rl-reports-page #feedback-records .rl-table-wrap,
        .rl-reports-page #discussion-records .rl-table-wrap {
            margin-right: -6px;
            padding-bottom: 2px;
        }
    }

    .rl-reports-page #quiz-records .rl-quiz-record-table,
    .rl-reports-page #feedback-records .rl-feedback-table,
    .rl-reports-page #discussion-records .rl-discussion-table {
        display: table;
        border-collapse: collapse;
        border-spacing: revert;
    }

    .rl-reports-page #quiz-records .rl-quiz-record-table thead,
    .rl-reports-page #feedback-records .rl-feedback-table thead,
    .rl-reports-page #discussion-records .rl-discussion-table thead {
        display: table-header-group;
    }

    .rl-reports-page #quiz-records .rl-quiz-record-table tbody,
    .rl-reports-page #feedback-records .rl-feedback-table tbody,
    .rl-reports-page #discussion-records .rl-discussion-table tbody {
        display: table-row-group;
    }

    .rl-reports-page #quiz-records .rl-quiz-record-table tr,
    .rl-reports-page #feedback-records .rl-feedback-table tr,
    .rl-reports-page #discussion-records .rl-discussion-table tr {
        display: table-row;
        width: auto;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .rl-reports-page #quiz-records .rl-quiz-record-table td,
    .rl-reports-page #feedback-records .rl-feedback-table td,
    .rl-reports-page #discussion-records .rl-discussion-table td {
        display: table-cell;
        width: auto !important;
        min-width: 0 !important;
        padding: 6px 8px !important;
        background: #fff !important;
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
        overflow-wrap: normal;
        word-break: normal;
        vertical-align: top !important;
    }

    .rl-reports-page #quiz-records .rl-quiz-record-table td::before,
    .rl-reports-page #feedback-records .rl-feedback-table td::before,
    .rl-reports-page #discussion-records .rl-discussion-table td::before {
        content: none;
    }
}

/* Course-management anchors only: replace the mobile horizontal rail with an equal-width grid. */
@media (max-width: 767.98px) {
    .rl-course-manage-page .rl-manage-tabs {
        position: static;
        top: auto;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        max-width: 100%;
        overflow-x: visible;
        padding: 10px;
        box-sizing: border-box;
    }

    .rl-course-manage-page .rl-manage-tabs a {
        display: flex;
        width: 100%;
        min-width: 0;
        min-height: 42px;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        padding: 8px 10px;
        text-align: center;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }
}

@media (max-width: 359.98px) {
    .rl-course-manage-page .rl-manage-tabs {
        grid-template-columns: 1fr;
    }
}

/* Course list only: turn each existing table row into a labelled course card below desktop width. */
@media (max-width: 767.98px) {
    #course-list .rl-table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    #course-list .rl-admin-course-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    #course-list .rl-admin-course-table thead {
        display: none;
    }

    #course-list .rl-admin-course-table tbody {
        display: grid;
        gap: 14px;
    }

    #course-list .rl-admin-course-table .rl-admin-course-card,
    #course-list .rl-admin-course-table .rl-admin-course-empty-card {
        display: block;
        width: 100%;
        overflow: hidden;
        border: 1px solid var(--rl-line);
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 2px 8px rgba(20, 56, 82, 0.08);
    }

    #course-list .rl-admin-course-table .rl-admin-course-card td {
        position: static !important;
        display: grid;
        grid-template-columns: minmax(5.5rem, 36%) minmax(0, 1fr);
        gap: 10px;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box;
        padding: 10px 12px !important;
        border: 0;
        border-bottom: 1px solid var(--rl-line);
        background: #ffffff !important;
        box-shadow: none;
        color: var(--rl-text);
        text-align: left !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    #course-list .rl-admin-course-table .rl-admin-course-card td:last-child {
        border-bottom: 0;
    }

    #course-list .rl-admin-course-table .rl-admin-course-card td::before {
        content: attr(data-label);
        color: var(--rl-muted);
        font-size: .85rem;
        font-weight: 800;
        line-height: 1.45;
    }

    #course-list .rl-admin-course-table .rl-course-title-column {
        grid-template-columns: 1fr;
    }

    #course-list .rl-admin-course-table .rl-admin-course-title {
        display: block;
        color: var(--rl-text);
        font-size: 1.05rem;
        font-weight: 800;
        line-height: 1.5;
        overflow-wrap: anywhere;
    }

    #course-list .rl-admin-course-table .rl-course-status {
        align-items: flex-start;
        text-align: left;
    }

    #course-list .rl-admin-course-table .rl-course-status .rl-block {
        text-align: left;
    }

    #course-list .rl-admin-course-table .rl-admin-course-actions {
        display: block;
    }

    #course-list .rl-admin-course-table .rl-admin-course-actions::before {
        display: block;
        margin-bottom: 8px;
    }

    #course-list .rl-admin-course-table .rl-admin-course-actions__buttons {
        display: flex !important;
        width: 100% !important;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px !important;
        flex-wrap: wrap !important;
        white-space: normal !important;
    }

    #course-list .rl-admin-course-table .rl-admin-course-actions__buttons > a,
    #course-list .rl-admin-course-table .rl-admin-course-actions__buttons > form {
        display: flex !important;
        flex: 1 1 135px !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    #course-list .rl-admin-course-table .rl-admin-course-actions__buttons .rl-action-button {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100%;
        min-height: 42px !important;
        height: auto !important;
        padding: 8px 10px !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    #course-list .rl-admin-course-table .rl-admin-course-empty-card td {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 18px 12px !important;
        border: 0;
        background: #ffffff;
        text-align: center;
    }
}

/* 課程列表卡片的「操作」格：上面那條 `#course-list .rl-admin-course-table .rl-admin-course-actions
   { display: block }`（1-2-0）輸給 `… .rl-admin-course-card td { display: grid }`（1-2-1），按鈕
   群組一直被擠在 64% 寬的值欄裡。選擇器帶 td（1-3-1）讓欄名在上、按鈕群組佔整列，按鈕依
   `flex: 1 1 135px` 整齊換行（375px 時一顆一列）。限定 screen，列印不變。 */
@media screen and (max-width: 767.98px) {
    #course-list .rl-admin-course-table .rl-admin-course-card td.rl-admin-course-actions {
        display: block;
    }
}

/* Pretest and posttest question lists only: labelled question cards below tablet width. */
@media (max-width: 767.98px) {
    #pretest .rl-quiz-table-wrap,
    #posttest .rl-quiz-table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    #pretest .rl-quiz-table,
    #posttest .rl-quiz-table {
        display: block;
        width: 100%;
        min-width: 0 !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    #pretest .rl-quiz-table thead,
    #posttest .rl-quiz-table thead {
        display: none;
    }

    #pretest .rl-quiz-table tbody,
    #posttest .rl-quiz-table tbody {
        display: grid;
        gap: 12px;
    }

    #pretest .rl-quiz-table .rl-quiz-question,
    #posttest .rl-quiz-table .rl-quiz-question {
        display: block;
        width: 100%;
        margin: 0;
        overflow: hidden;
        border: 1px solid #e3ebf0;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 1px 4px rgba(20, 56, 82, 0.06);
    }

    #pretest .rl-quiz-table .rl-quiz-question td,
    #posttest .rl-quiz-table .rl-quiz-question td {
        display: grid;
        grid-template-columns: 5.25rem minmax(0, 1fr);
        gap: 8px;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box;
        padding: 9px 14px !important;
        border: 0;
        border-bottom: 1px solid #edf2f5;
        background: #ffffff !important;
        color: var(--rl-text);
        text-align: left !important;
        vertical-align: top !important;
        font-size: .92rem;
        line-height: 1.45;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    #pretest .rl-quiz-table .rl-quiz-question td:last-child,
    #posttest .rl-quiz-table .rl-quiz-question td:last-child {
        border-bottom: 0;
    }

    #pretest .rl-quiz-table .rl-quiz-question td::before,
    #posttest .rl-quiz-table .rl-quiz-question td::before {
        content: attr(data-label);
        color: #788897;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.45;
    }

    #pretest .rl-quiz-table .rl-quiz-question__content,
    #posttest .rl-quiz-table .rl-quiz-question__content {
        display: block !important;
        grid-template-columns: 1fr;
        padding: 14px !important;
        white-space: normal !important;
        overflow-wrap: break-word;
        word-break: normal;
        line-height: 1.6;
    }

    #pretest .rl-quiz-table .rl-quiz-question__content::before,
    #posttest .rl-quiz-table .rl-quiz-question__content::before {
        display: block;
        margin-bottom: 8px;
    }

    #pretest .rl-quiz-table .rl-quiz-question__text,
    #posttest .rl-quiz-table .rl-quiz-question__text,
    #pretest .rl-quiz-table .rl-quiz-question-options,
    #posttest .rl-quiz-table .rl-quiz-question-options {
        display: block;
        min-width: 0;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    #pretest .rl-quiz-table .rl-quiz-question__text,
    #posttest .rl-quiz-table .rl-quiz-question__text {
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.55;
    }

    #pretest .rl-quiz-table .rl-quiz-question-options,
    #posttest .rl-quiz-table .rl-quiz-question-options {
        display: grid;
        gap: 6px;
        margin-top: 10px;
        color: #647587;
        font-size: .9rem;
        line-height: 1.45;
    }

    #pretest .rl-quiz-table .rl-quiz-question-options > span,
    #posttest .rl-quiz-table .rl-quiz-question-options > span {
        display: block;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        line-height: 1.6;
    }

    #pretest .rl-quiz-table .rl-quiz-question__status,
    #posttest .rl-quiz-table .rl-quiz-question__status {
        display: inline-flex;
        align-items: center;
        min-height: 24px;
        padding: 3px 8px;
        border: 1px solid #d7e6ef;
        border-radius: 999px;
        background: #f5fafc;
        color: #356179;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.2;
    }

    #pretest .rl-quiz-table .rl-quiz-question__actions,
    #posttest .rl-quiz-table .rl-quiz-question__actions {
        display: block;
    }

    #pretest .rl-quiz-table .rl-quiz-question__actions::before,
    #posttest .rl-quiz-table .rl-quiz-question__actions::before {
        display: block;
        margin-bottom: 8px;
    }

    #pretest .rl-quiz-table .rl-quiz-question__action-list,
    #posttest .rl-quiz-table .rl-quiz-question__action-list {
        display: flex;
        width: 100%;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        flex-direction: column;
        flex-wrap: nowrap;
        white-space: normal;
    }

    #pretest .rl-quiz-table .rl-quiz-question__action-list > a,
    #pretest .rl-quiz-table .rl-quiz-question__action-list > form,
    #posttest .rl-quiz-table .rl-quiz-question__action-list > a,
    #posttest .rl-quiz-table .rl-quiz-question__action-list > form {
        display: flex !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
    }

    #pretest .rl-quiz-table .rl-quiz-question__action-list .rl-action-button,
    #posttest .rl-quiz-table .rl-quiz-question__action-list .rl-action-button {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 40px !important;
        height: auto !important;
        padding: 8px 10px !important;
        font-size: .9rem !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    #pretest details > summary,
    #posttest details > summary {
        min-height: 42px;
        margin: 12px 0 16px;
        padding: 9px 16px;
    }

    #pretest details > summary::after,
    #posttest details > summary::after {
        font-size: .95rem !important;
    }
}

/* Pretest and posttest question lists only: keep question text and options readable in desktop tables. */
@media (min-width: 768px) {
    #pretest .rl-quiz-table .rl-quiz-question__content,
    #posttest .rl-quiz-table .rl-quiz-question__content {
        min-width: 0;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }

    #pretest .rl-quiz-table .rl-quiz-question__text,
    #posttest .rl-quiz-table .rl-quiz-question__text {
        display: block;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        line-height: 1.55;
    }

    #pretest .rl-quiz-table .rl-quiz-question-options,
    #posttest .rl-quiz-table .rl-quiz-question-options {
        display: grid;
        gap: 4px;
        min-width: 0;
        margin-top: 10px;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
        line-height: 1.55;
    }

    #pretest .rl-quiz-table .rl-quiz-question-options > span,
    #posttest .rl-quiz-table .rl-quiz-question-options > span {
        display: block;
        white-space: normal;
        overflow-wrap: break-word;
        word-break: normal;
    }
}

/* Platform home redesign: scoped to the remote-learning entry page only. */
.rl-platform-home {
    display: grid;
    width: min(1240px, calc(100% - 40px));
    gap: 28px;
    padding: 32px 0 44px;
}

.rl-backend-layout .rl-backend-main > .rl-platform-home {
    width: min(1240px, calc(100% - 48px));
}

.rl-platform-home .rl-platform-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(220px, .7fr);
    align-items: center;
    gap: clamp(18px, 3vw, 38px);
    padding: clamp(20px, 3vw, 32px);
    overflow: hidden;
    border: 1px solid #cbdce6;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(20, 56, 82, .08);
}

.rl-platform-home .rl-platform-hero::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: #0d577f;
    content: "";
}

.rl-platform-home .rl-platform-hero__content {
    position: relative;
    min-width: 0;
}

.rl-platform-home .rl-platform-hero__logo {
    display: block;
    width: auto;
    max-width: 100%;
    height: 48px;
    margin: 0 0 12px;
    object-fit: contain;
    object-position: left center;
}

.rl-platform-home .rl-platform-section__heading > p,
.rl-platform-home .rl-platform-status-card__header p {
    margin: 0 0 8px;
    color: #0f766e;
    font-size: .88rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.rl-platform-home .rl-platform-hero h1 {
    max-width: 720px;
    margin: 0;
    color: #123750;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.2;
    letter-spacing: .01em;
}

.rl-platform-home .rl-platform-hero__english {
    margin: 10px 0 0;
    color: #37708b;
    font-size: clamp(.98rem, 1.8vw, 1.12rem);
    font-weight: 700;
    letter-spacing: .015em;
}

.rl-platform-home .rl-platform-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
}

.rl-platform-home .rl-platform-actions .rl-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border: 1px solid #0d577f;
    border-radius: 8px;
    background: #0d577f;
    box-shadow: none;
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

.rl-platform-home .rl-platform-actions .rl-button:hover {
    border-color: #0a4564;
    background: #0a4564;
    color: #ffffff;
}

.rl-platform-home .rl-platform-actions .rl-button--secondary {
    background: #ffffff;
    color: #0d577f;
}

.rl-platform-home .rl-platform-actions .rl-button--secondary:hover {
    background: #eaf4f8;
    color: #0a4564;
}

.rl-platform-home .rl-platform-actions__text-link {
    padding: 8px 4px;
    color: #0d577f;
    font-size: .94rem;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rl-platform-home .rl-platform-actions__text-link:hover {
    color: #0a4564;
}

.rl-platform-home .rl-platform-session {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-top: 24px;
}

.rl-platform-home .rl-platform-session__greeting {
    min-width: 0;
    color: #163d57;
    font-size: 1.04rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.rl-platform-home .rl-platform-session__greeting strong {
    font-weight: 900;
}

.rl-platform-home .rl-platform-session__role {
    display: inline-flex;
    min-height: 28px;
    align-items: center;
    padding: 3px 9px;
    border: 1px solid #b8d7db;
    border-radius: 999px;
    background: #f2fbfa;
    color: #0f766e;
    font-size: .88rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.rl-platform-home .rl-platform-session__logout-form {
    display: flex;
    min-width: 0;
    margin: 0;
}

.rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary {
    min-height: 40px;
    padding: 8px 16px;
    border-color: #0d577f;
    background: #0d577f;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    font-weight: 700;
    opacity: 1;
    white-space: normal;
}

.rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary:hover,
.rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary:focus,
.rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary:focus-visible {
    border-color: #0a4564;
    background: #0a4564;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    opacity: 1;
}

.rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary:active {
    border-color: #073b56;
    background: #073b56;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;
    opacity: 1;
}

.rl-platform-home .rl-platform-actions a:focus-visible,
.rl-platform-home .rl-platform-home-action-card:focus-visible,
.rl-platform-home .rl-platform-management-card:focus-visible,
.rl-platform-home .rl-platform-learning-summary__courses a:focus-visible,
.rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary:focus-visible {
    outline: 3px solid #66bdce;
    outline-offset: 3px;
}

.rl-platform-home .rl-platform-hero__visual {
    display: grid;
    min-width: 0;
    place-items: center;
}

.rl-platform-home .rl-platform-hero__visual-panel {
    position: relative;
    width: min(100%, 280px);
    min-height: 208px;
    overflow: hidden;
    border: 1px solid #b9dce0;
    border-radius: 14px;
    background: #edf8f8;
}

.rl-platform-home .rl-platform-hero__visual-panel::before,
.rl-platform-home .rl-platform-hero__visual-panel::after {
    position: absolute;
    border: 1px solid rgba(13, 87, 127, .15);
    border-radius: 50%;
    content: "";
}

.rl-platform-home .rl-platform-hero__visual-panel::before {
    top: -58px;
    right: -40px;
    width: 160px;
    height: 160px;
}

.rl-platform-home .rl-platform-hero__visual-panel::after {
    bottom: -94px;
    left: -68px;
    width: 195px;
    height: 195px;
}

.rl-platform-home .rl-platform-hero__visual-ring {
    position: absolute;
    top: 34px;
    left: 38px;
    width: 83px;
    height: 83px;
    border: 13px solid #6db9c3;
    border-right-color: #0d577f;
    border-radius: 50%;
}

.rl-platform-home .rl-platform-hero__visual-dot {
    position: absolute;
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #0f766e;
}

.rl-platform-home .rl-platform-hero__visual-dot--one {
    top: 35px;
    right: 48px;
}

.rl-platform-home .rl-platform-hero__visual-dot--two {
    bottom: 38px;
    left: 58px;
    width: 8px;
    height: 8px;
    background: #70a5c9;
}

.rl-platform-home .rl-platform-hero__visual-line {
    position: absolute;
    display: block;
    height: 2px;
    border-radius: 999px;
    background: #9eced2;
    transform: rotate(-32deg);
    transform-origin: left center;
}

.rl-platform-home .rl-platform-hero__visual-line--one {
    top: 122px;
    left: 90px;
    width: 110px;
}

.rl-platform-home .rl-platform-hero__visual-line--two {
    top: 150px;
    left: 120px;
    width: 86px;
    background: #75a6c4;
}

.rl-platform-home .rl-platform-hero__visual-card {
    position: absolute;
    display: grid;
    gap: 6px;
    padding: 12px;
    border: 1px solid #c8dde5;
    border-radius: 10px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 6px 14px rgba(20, 56, 82, .08);
}

.rl-platform-home .rl-platform-hero__visual-card span {
    display: block;
    height: 5px;
    border-radius: 999px;
    background: #b5d4dc;
}

.rl-platform-home .rl-platform-hero__visual-card span:first-child {
    width: 38px;
    background: #0d577f;
}

.rl-platform-home .rl-platform-hero__visual-card--course {
    right: 27px;
    bottom: 30px;
    width: 94px;
}

.rl-platform-home .rl-platform-hero__visual-card--record {
    top: 74px;
    right: 34px;
    width: 78px;
}

.rl-platform-home .rl-platform-hero__visual-plus {
    position: absolute;
    top: 125px;
    left: 34px;
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: #0f766e;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 400;
    line-height: 1;
}

.rl-platform-home .rl-platform-section,
.rl-platform-home .rl-platform-learning-summary {
    display: grid;
    gap: 16px;
}

.rl-platform-home .rl-platform-section__heading h2,
.rl-platform-home .rl-platform-status-card h2 {
    margin: 0;
    color: #163d57;
    font-size: clamp(1.42rem, 2.4vw, 1.9rem);
    line-height: 1.3;
}

.rl-platform-home .rl-platform-steps,
.rl-platform-home .rl-platform-features,
.rl-platform-home .rl-platform-home-actions,
.rl-platform-home .rl-platform-management__grid {
    display: grid;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rl-platform-home .rl-platform-steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rl-platform-home .rl-platform-features {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rl-platform-home .rl-platform-step-card,
.rl-platform-home .rl-platform-feature-card,
.rl-platform-home .rl-platform-home-action-card,
.rl-platform-home .rl-platform-management-card,
.rl-platform-home .rl-platform-learning-summary,
.rl-platform-home .rl-platform-status-card {
    border: 1px solid #cddde6;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 5px 16px rgba(20, 56, 82, .06);
}

.rl-platform-home .rl-platform-step-card,
.rl-platform-home .rl-platform-feature-card {
    min-width: 0;
    padding: 22px;
}

.rl-platform-home .rl-platform-step-card__number {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: #dbeef0;
    color: #0d577f;
    font-size: .9rem;
    font-weight: 800;
}

.rl-platform-home .rl-platform-step-card h3,
.rl-platform-home .rl-platform-feature-card h3,
.rl-platform-home .rl-platform-home-action-card h3,
.rl-platform-home .rl-platform-management-card h3,
.rl-platform-home .rl-platform-learning-summary__courses h3 {
    margin: 14px 0 6px;
    color: #17435f;
    font-size: 1.08rem;
    line-height: 1.4;
}

.rl-platform-home .rl-platform-step-card p,
.rl-platform-home .rl-platform-feature-card p,
.rl-platform-home .rl-platform-home-action-card p,
.rl-platform-home .rl-platform-management-card p,
.rl-platform-home .rl-platform-learning-summary__courses p {
    margin: 0;
    color: #617788;
    font-size: .94rem;
}

.rl-platform-home .rl-platform-feature-card {
    position: relative;
    padding-top: 50px;
}

.rl-platform-home .rl-platform-feature-card__marker {
    position: absolute;
    top: 19px;
    left: 22px;
    color: #0f766e;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.rl-platform-home .rl-platform-status-card {
    display: grid;
    gap: 14px;
    max-width: 820px;
    padding: clamp(24px, 4vw, 34px);
    border-color: #e8d2a6;
    background: #fffdf8;
}

.rl-platform-home .rl-platform-status-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.rl-platform-home .rl-platform-status-card__badge {
    display: inline-flex;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border: 1px solid #d7b36a;
    border-radius: 999px;
    background: #fff4d6;
    color: #80560c;
    font-size: .86rem;
    font-weight: 800;
    white-space: nowrap;
}

.rl-platform-home .rl-platform-status-card__badge--approved {
    border-color: #9acfbf;
    background: #edf9f4;
    color: #08705b;
}

.rl-platform-home .rl-platform-status-card__badge--rejected,
.rl-platform-home .rl-platform-status-card__badge--suspended,
.rl-platform-home .rl-platform-status-card__badge--error {
    border-color: #ebbbb7;
    background: #fff1f0;
    color: #a33d35;
}

.rl-platform-home .rl-platform-status-card > p {
    margin: 0;
    color: #5a6f7d;
}

.rl-platform-home .rl-platform-status-card__hint {
    padding-top: 12px;
    border-top: 1px solid #eadfca;
}

.rl-platform-home .rl-platform-home-actions {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rl-platform-home .rl-platform-home-action-card,
.rl-platform-home .rl-platform-management-card {
    display: block;
    min-width: 0;
    padding: 22px 24px;
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.rl-platform-home .rl-platform-home-action-card {
    border-top: 4px solid #0d577f;
}

.rl-platform-home .rl-platform-home-action-card__kicker {
    color: #0f766e;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .06em;
}

.rl-platform-home .rl-platform-home-action-card:hover,
.rl-platform-home .rl-platform-management-card:hover {
    border-color: #8dbbc9;
    background: #fafdfe;
    box-shadow: 0 8px 20px rgba(20, 56, 82, .1);
}

.rl-platform-home .rl-platform-learning-summary {
    padding: clamp(22px, 4vw, 30px);
    background: #fafdfe;
}

.rl-platform-home .rl-platform-learning-summary__content {
    display: grid;
    grid-template-columns: minmax(220px, .85fr) minmax(0, 1.15fr);
    gap: 24px;
}

.rl-platform-home .rl-platform-learning-summary__metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.rl-platform-home .rl-platform-learning-summary__metrics article {
    display: grid;
    align-content: start;
    gap: 3px;
    min-width: 0;
    padding: 18px;
    border: 1px solid #d6e5eb;
    border-radius: 12px;
    background: #ffffff;
}

.rl-platform-home .rl-platform-learning-summary__metrics span,
.rl-platform-home .rl-platform-learning-summary__metrics small {
    color: #607888;
    font-size: .84rem;
}

.rl-platform-home .rl-platform-learning-summary__metrics strong {
    color: #0d577f;
    font-size: 2rem;
    line-height: 1.15;
}

.rl-platform-home .rl-platform-learning-summary__courses {
    min-width: 0;
}

.rl-platform-home .rl-platform-learning-summary__courses h3 {
    margin-top: 0;
}

.rl-platform-home .rl-platform-learning-summary__courses ul {
    display: grid;
    gap: 9px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rl-platform-home .rl-platform-learning-summary__courses li {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-top: 9px;
    border-top: 1px solid #dce8ed;
}

.rl-platform-home .rl-platform-learning-summary__courses a,
.rl-platform-home .rl-platform-learning-summary__courses li > span {
    min-width: 0;
    color: #17435f;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.rl-platform-home .rl-platform-learning-summary__courses a {
    text-decoration: none;
}

.rl-platform-home .rl-platform-learning-summary__courses a:hover {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rl-platform-home .rl-platform-learning-summary__courses small {
    flex: 0 0 auto;
    color: #718795;
    font-size: .82rem;
}

.rl-platform-home .rl-platform-management {
    padding: clamp(22px, 4vw, 30px);
    border: 1px solid #c9e0dc;
    border-radius: 16px;
    background: #f5fbfa;
}

.rl-platform-home .rl-platform-management__grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rl-platform-home .rl-platform-management-card {
    border-top: 4px solid #0f766e;
}

.rl-platform-home .rl-platform-management-card h3 {
    color: #0c645e;
}

@media (max-width: 900px) {
    .rl-platform-home .rl-platform-hero {
        grid-template-columns: minmax(0, 1fr) minmax(200px, .54fr);
        gap: 20px;
    }

    .rl-platform-home .rl-platform-hero__visual {
        justify-content: end;
    }

    .rl-platform-home .rl-platform-hero__visual-panel {
        width: min(100%, 230px);
        min-height: 180px;
    }

    .rl-platform-home .rl-platform-hero__visual-ring {
        top: 26px;
        left: 30px;
        width: 70px;
        height: 70px;
        border-width: 11px;
    }

    .rl-platform-home .rl-platform-hero__visual-card--record {
        top: 63px;
        right: 28px;
    }

    .rl-platform-home .rl-platform-hero__visual-card--course {
        right: 22px;
        bottom: 22px;
    }

    .rl-platform-home .rl-platform-hero__visual-line--one {
        top: 105px;
        left: 74px;
        width: 90px;
    }

    .rl-platform-home .rl-platform-hero__visual-line--two {
        top: 129px;
        left: 100px;
        width: 72px;
    }

    .rl-platform-home .rl-platform-hero__visual-plus {
        top: 108px;
        left: 28px;
    }

    .rl-platform-home .rl-platform-features {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .rl-platform-home .rl-platform-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .rl-platform-home,
    .rl-backend-layout .rl-backend-main > .rl-platform-home {
        width: min(100% - 24px, 1240px);
        gap: 22px;
        padding: 22px 0 32px;
    }

    .rl-platform-home .rl-platform-hero {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        grid-auto-rows: auto;
        align-items: start;
        height: auto;
        min-height: 0;
        gap: 0;
        padding: 18px 16px 10px;
        border-radius: 14px;
    }

    .rl-platform-home .rl-platform-hero__logo {
        height: 40px;
        margin-bottom: 10px;
    }

    .rl-platform-home .rl-platform-hero__content {
        height: auto;
        min-height: 0;
    }

    .rl-platform-home .rl-platform-hero h1 {
        font-size: 2rem;
    }

    .rl-platform-home .rl-platform-hero__visual {
        display: none !important;
        width: auto;
        height: auto;
        min-height: 0;
        margin: 0;
        padding: 0;
    }

    .rl-platform-home .rl-platform-hero__visual-panel::before,
    .rl-platform-home .rl-platform-hero__visual-panel::after {
        display: none;
        content: none;
    }

    .rl-platform-home .rl-platform-actions {
        align-items: stretch;
    }

    .rl-platform-home .rl-platform-actions .rl-button {
        flex: 1 1 100%;
        width: 100%;
    }

    .rl-platform-home .rl-platform-actions__text-link {
        align-self: flex-start;
    }

    .rl-platform-home .rl-platform-session {
        align-items: stretch;
    }

    .rl-platform-home .rl-platform-session__greeting,
    .rl-platform-home .rl-platform-session__logout-form,
    .rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary {
        flex-basis: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    .rl-platform-home .rl-platform-session__role {
        align-self: flex-start;
    }

    .rl-platform-home .rl-platform-session .rl-platform-logout-button.rl-button.rl-button--secondary {
        justify-content: center;
    }

    .rl-platform-home .rl-platform-steps,
    .rl-platform-home .rl-platform-features,
    .rl-platform-home .rl-platform-home-actions,
    .rl-platform-home .rl-platform-management__grid,
    .rl-platform-home .rl-platform-learning-summary__content {
        grid-template-columns: 1fr;
    }

    .rl-platform-home .rl-platform-step-card,
    .rl-platform-home .rl-platform-feature-card,
    .rl-platform-home .rl-platform-home-action-card,
    .rl-platform-home .rl-platform-management-card {
        padding: 20px;
    }

    .rl-platform-home .rl-platform-status-card {
        padding: 22px;
    }

    .rl-platform-home .rl-platform-status-card__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .rl-platform-home .rl-platform-learning-summary {
        padding: 22px;
    }

    .rl-platform-home .rl-platform-management {
        padding: 22px;
        border-radius: 14px;
    }
}

@media (max-width: 430px) {
    .rl-platform-home .rl-platform-learning-summary__courses li {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
    }
}

/* 前台首頁「我的學習摘要」的兩個統計框（已報名課程／待完成學習活動）：手機寬度也左右並排的精簡卡。
   比照後台「全期間累計摘要」統計卡（.rl-reports-cumulative-summary .rl-kpi）的手機值：兩欄、間距 8px、
   內距 12px、數字 24px、文字可換行（overflow-wrap: anywhere）。標題與單位比原本的 .84rem 再小一點
   （後台的 14px 比這裡原本的字還大，所以不照抄），數字仍是框內最醒目的文字。
   原本 ≤430px 會改成單欄、上下兩個大框（2026-11 改掉）。兩邊類別不共用，不影響後台統計卡；桌機不變。 */
@media (max-width: 767.98px) {
    .rl-platform-home .rl-platform-learning-summary__metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        min-width: 0;
    }

    .rl-platform-home .rl-platform-learning-summary__metrics article {
        box-sizing: border-box;
        min-width: 0;
        max-width: 100%;
        gap: 2px;
        padding: 12px;
    }

    .rl-platform-home .rl-platform-learning-summary__metrics span,
    .rl-platform-home .rl-platform-learning-summary__metrics small {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }

    .rl-platform-home .rl-platform-learning-summary__metrics span {
        font-size: 13px;
    }

    .rl-platform-home .rl-platform-learning-summary__metrics small {
        font-size: 12px;
    }

    .rl-platform-home .rl-platform-learning-summary__metrics strong {
        font-size: 24px;
        line-height: 1.2;
    }
}

.rl-learner-course-record-card__course-date {
    display: block;
    color: var(--rl-muted);
    font-size: .875rem;
}

.rl-learner-course-record-card__checkout-status {
    display: none;
}

/* Desktop course records: keep the course, completion and actions visible while the middle columns scroll. */
@media screen and (min-width: 768px) {
    .rl-learner-course-records-table-wrap {
        position: relative;
        max-width: 100%;
        overflow-x: auto;
    }

    .rl-learner-course-records-table {
        --rl-learning-record-course-width: 150px;
        --rl-learning-record-completion-width: 190px;
        --rl-learning-record-actions-width: 150px;

        min-width: 1180px;
        table-layout: auto;
    }

    .rl-learner-course-records-table thead th {
        position: relative;
        z-index: 4;
    }

    .rl-learner-course-records-table tbody td {
        position: relative;
        z-index: 1;
    }

    .rl-learner-course-records-table .rl-learning-record-course,
    .rl-learner-course-records-table .rl-learning-record-completion,
    .rl-learner-course-records-table .rl-learning-record-actions {
        position: sticky;
        box-sizing: border-box;
        background: #ffffff;
        background-clip: padding-box;
        z-index: 3;
    }

    .rl-learner-course-records-table th.rl-learning-record-course,
    .rl-learner-course-records-table th.rl-learning-record-completion,
    .rl-learner-course-records-table th.rl-learning-record-actions {
        background: var(--rl-panel-soft);
        z-index: 6;
    }

    .rl-learner-course-records-table .rl-learning-record-course {
        left: 0;
        width: var(--rl-learning-record-course-width);
        min-width: var(--rl-learning-record-course-width);
        max-width: var(--rl-learning-record-course-width);
        border-right: 1px solid #dce7ed;
        box-shadow: 5px 0 8px -8px rgba(20, 56, 82, .45);
        white-space: normal;
        word-break: normal;
        overflow-wrap: break-word;
    }

    .rl-learner-course-records-table .rl-learning-record-completion {
        right: var(--rl-learning-record-actions-width);
        width: var(--rl-learning-record-completion-width);
        min-width: var(--rl-learning-record-completion-width);
        max-width: var(--rl-learning-record-completion-width);
        border-left: 1px solid #dce7ed;
        box-shadow: -5px 0 8px -8px rgba(20, 56, 82, .45);
        white-space: normal;
        text-align: center;
    }

    .rl-learner-course-records-table .rl-learning-record-completion .rl-status-badge {
        width: fit-content;
        max-width: 100%;
        min-height: 28px;
        height: auto;
        line-height: 1.4;
        white-space: normal;
        overflow: visible;
        overflow-wrap: anywhere;
        text-align: center;
        text-overflow: clip;
    }

    .rl-learner-course-records-table .rl-learning-record-actions {
        right: 0;
        width: var(--rl-learning-record-actions-width);
        min-width: var(--rl-learning-record-actions-width);
        max-width: var(--rl-learning-record-actions-width);
        padding-right: 10px;
        padding-left: 10px;
        border-left: 1px solid #dce7ed;
        white-space: normal;
    }

    .rl-learner-course-records-table tbody tr:hover .rl-learning-record-course,
    .rl-learner-course-records-table tbody tr:hover .rl-learning-record-completion,
    .rl-learner-course-records-table tbody tr:hover .rl-learning-record-actions {
        background: #fbfdff;
    }

    .rl-learner-course-records-table .rl-learning-record-actions .rl-table-actions {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        min-width: 0 !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        flex-wrap: nowrap !important;
        white-space: normal !important;
    }

    .rl-learner-course-records-table .rl-learning-record-actions .rl-table-actions .rl-action-button {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        white-space: nowrap !important;
    }
}

/* Learner course records only: replace wide tables with labelled cards on phones. */
@media (max-width: 767.98px) {
    .rl-learner-course-records-page {
        max-width: calc(100vw - 24px);
        min-width: 0;
        overflow-x: hidden;
    }

    .rl-learner-course-records-table-wrap,
    .rl-learner-discussion-records-table-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0;
        overflow: visible !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-sizing: border-box;
    }

    .rl-learner-course-records-table,
    .rl-learner-discussion-records-table {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0 !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    .rl-learner-course-records-table thead,
    .rl-learner-discussion-records-table thead {
        display: none;
    }

    .rl-learner-course-records-table tbody,
    .rl-learner-discussion-records-table tbody {
        display: grid;
        gap: 12px;
    }

    .rl-learner-course-record-card,
    .rl-learner-discussion-record-card {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        border: 1px solid #e3ebf0;
        border-radius: 10px;
        background: #ffffff;
        box-shadow: 0 1px 4px rgba(20, 56, 82, 0.06);
        box-sizing: border-box;
    }

    .rl-learner-course-records-table td,
    .rl-learner-discussion-records-table td {
        display: grid;
        grid-template-columns: minmax(5.75rem, 38%) minmax(0, 1fr);
        gap: 8px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 10px 14px !important;
        border: 0;
        border-bottom: 1px solid #edf2f5;
        background: #ffffff !important;
        color: var(--rl-text);
        text-align: left !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-learner-course-records-table td:last-child,
    .rl-learner-discussion-records-table td:last-child {
        border-bottom: 0;
    }

    .rl-learner-course-records-table td::before,
    .rl-learner-discussion-records-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: #788897;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.45;
    }

    .rl-learner-course-record-card__course,
    .rl-learner-discussion-record-card__course {
        display: block !important;
        padding: 14px !important;
    }

    .rl-learner-course-record-card__course::before,
    .rl-learner-discussion-record-card__course::before {
        display: none;
    }

    .rl-learner-course-record-card__course-title,
    .rl-learner-discussion-record-card__course {
        display: block;
        min-width: 0;
        color: var(--rl-text);
        font-size: 1.05rem;
        font-weight: 700;
        line-height: 1.45;
        word-break: keep-all;
        overflow-wrap: break-word;
    }

    .rl-learner-course-record-card__course-date {
        display: grid;
        grid-template-columns: minmax(5.75rem, 38%) minmax(0, 1fr);
        gap: 8px;
        margin-top: 10px;
        color: var(--rl-muted);
        font-size: .9rem;
        font-weight: 400;
        line-height: 1.45;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-learner-course-record-card__course-date::before {
        content: "課程日期";
        color: #788897;
        font-size: .78rem;
        font-weight: 700;
    }

    .rl-learner-course-record-card__attendance {
        align-items: start;
    }

    .rl-learner-course-records-table .rl-learning-record-score-list {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        min-width: 0;
    }

    .rl-learner-course-records-table .rl-score-line--mobile-hidden {
        display: none;
    }

    .rl-learner-course-record-card__attendance .rl-status-badge,
    .rl-learner-course-record-card__completion .rl-status-badge,
    .rl-learner-discussion-record-card__status .rl-status-badge {
        width: fit-content;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-learner-course-record-card__attendance .rl-status-badge + .rl-status-badge {
        margin-top: 6px;
    }

    .rl-learner-course-record-card__checkout-status {
        display: inline-flex;
        grid-column: 2;
    }

    .rl-learner-course-record-card__actions,
    .rl-learner-discussion-record-card__actions,
    .rl-learner-discussion-record-card__message {
        display: block !important;
        min-width: 0;
    }

    .rl-learner-course-record-card__actions::before,
    .rl-learner-discussion-record-card__actions::before,
    .rl-learner-discussion-record-card__message::before {
        display: block;
        margin-bottom: 8px;
    }

    .rl-learner-course-record-card__actions .rl-table-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        gap: 8px !important;
        white-space: normal !important;
        box-sizing: border-box;
    }

    .rl-learner-course-record-card__actions .rl-table-actions > a,
    .rl-learner-course-record-card__actions .rl-table-actions > span,
    .rl-learner-discussion-record-card__actions .rl-action-button {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        padding: 8px 10px !important;
        text-align: center;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-learner-discussion-record-card__message {
        line-height: 1.6;
        white-space: pre-wrap !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-learner-discussion-record-card__status--empty {
        display: none !important;
    }
}

@media (max-width: 359.98px) {
    .rl-learner-course-record-card__actions .rl-table-actions {
        grid-template-columns: 1fr;
    }
}

/* Latest announcements: public cards are text-only and remain readable on narrow screens. */
.rl-platform-home .rl-platform-announcements__list {
    display: grid;
    gap: 10px;
}

.rl-platform-home .rl-platform-announcement-card {
    display: grid;
    grid-template-columns: minmax(7.5rem, .28fr) minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 18px;
    row-gap: 5px;
    min-width: 0;
    padding: 15px 18px;
    border: 1px solid #cddde6;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(20, 56, 82, .05);
}

.rl-platform-home .rl-platform-announcement-card__meta,
.rl-announcement-card__meta,
.rl-announcement-view__meta {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: #617788;
    font-size: .86rem;
}

.rl-platform-home .rl-platform-announcement-card__pinned,
.rl-announcement-pin {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e4f4f1;
    color: #0c645e;
    font-size: .78rem;
    font-weight: 800;
    line-height: 1.4;
}

.rl-platform-home .rl-platform-announcement-card__meta {
    grid-row: 1 / span 2;
}

.rl-platform-home .rl-platform-announcement-card h3,
.rl-platform-home .rl-platform-announcement-card p {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-platform-home .rl-platform-announcement-card h3 {
    color: #17435f;
    font-size: 1rem;
    line-height: 1.45;
}

.rl-platform-home .rl-platform-announcement-card p {
    color: #617788;
    font-size: .92rem;
    line-height: 1.5;
}

.rl-platform-announcement-card__link,
.rl-announcement-card__link {
    color: #0d577f;
    font-size: .9rem;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}

.rl-platform-announcement-card__link:hover,
.rl-announcement-card__link:hover {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rl-platform-home .rl-platform-announcement-card__link {
    grid-column: 3;
    grid-row: 1 / span 2;
}

.rl-platform-announcements__empty,
.rl-platform-announcements__migration-notice,
.rl-announcements-notice {
    margin: 0;
    padding: 16px 18px;
    border: 1px solid #cddde6;
    border-radius: 12px;
    background: #ffffff;
    color: #617788;
}

.rl-platform-announcements__migration-notice {
    border-color: #e8d2a6;
    background: #fffdf8;
    color: #80560c;
}

.rl-platform-announcements__migration-notice code {
    overflow-wrap: anywhere;
}

.rl-platform-announcements__actions,
.rl-announcements-page__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.rl-platform-announcements__actions .rl-button,
.rl-announcements-page__actions .rl-button {
    text-decoration: none;
}

.rl-announcements-page,
.rl-announcement-view-page {
    display: grid;
    gap: 22px;
}

.rl-announcements-list {
    display: grid;
    gap: 14px;
}

.rl-announcement-card,
.rl-announcement-view {
    min-width: 0;
    padding: clamp(20px, 4vw, 30px);
    border: 1px solid var(--rl-line);
    border-radius: 12px;
    background: var(--rl-panel);
    box-shadow: var(--rl-shadow);
}

.rl-announcement-card h2,
.rl-announcement-view h1 {
    margin: 10px 0 8px;
    color: #17435f;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-announcement-card h2 {
    font-size: clamp(1.15rem, 2vw, 1.35rem);
}

.rl-announcement-card h2 a {
    color: inherit;
    text-decoration: none;
}

.rl-announcement-card h2 a:hover {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.rl-announcement-card > p {
    margin: 0 0 14px;
    color: var(--rl-muted);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-announcement-view__content {
    color: var(--rl-text);
    line-height: 1.8;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-announcements-notice p {
    margin: 0;
}

@media (max-width: 760px) {
    .rl-platform-home .rl-platform-announcement-card {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 9px;
        padding: 16px;
    }

    .rl-platform-home .rl-platform-announcement-card__meta,
    .rl-platform-home .rl-platform-announcement-card__link {
        grid-column: auto;
        grid-row: auto;
    }

    .rl-platform-home .rl-platform-announcement-card__link {
        justify-self: start;
    }

    .rl-platform-announcements__actions,
    .rl-announcements-page__actions {
        align-items: stretch;
    }

    .rl-platform-announcements__actions .rl-button,
    .rl-announcements-page__actions .rl-button {
        width: 100%;
        min-width: 0;
        text-align: center;
        white-space: normal;
    }

    .rl-announcement-card,
    .rl-announcement-view,
    .rl-announcements-notice {
        min-width: 0;
        padding: 20px;
    }
}

/* 已登入學員首頁：手機版僅保留精簡品牌、登入者與安全登出。 */
@media (max-width: 760px) {
    .rl-platform-home.rl-platform-home--learner .rl-platform-hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
        height: auto;
        min-height: 0;
        padding: 18px 16px 10px;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-actions {
        display: none;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-hero h1 {
        display: flex;
        flex-wrap: wrap;
        gap: 0 0.22em;
        font-size: clamp(1.55rem, 7vw, 1.9rem);
        line-height: 1.2;
        letter-spacing: 0;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-hero__title-part {
        display: inline-block;
        white-space: nowrap;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-hero__english {
        margin-top: 8px;
        font-size: 0.94rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-session {
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        flex-wrap: wrap;
        margin-top: 18px;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-session__greeting {
        flex: 0 1 auto;
        width: auto;
        min-width: 0;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-session__role {
        display: none;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-session__logout-form {
        display: flex;
        flex: 0 0 auto;
        width: auto;
        min-width: 0;
        max-width: 100%;
        margin: 0;
    }

    .rl-platform-home.rl-platform-home--learner .rl-platform-session .rl-platform-logout-button {
        display: inline-flex;
        flex: 0 0 auto;
        width: auto;
        min-height: 34px;
        padding: 6px 12px;
        box-sizing: border-box;
        white-space: nowrap;
    }
}

/* Announcement management only: turn the existing admin table into labelled phone cards. */
@media (max-width: 767.98px) {
    .rl-admin-announcements-page .rl-admin-announcements-table-wrap {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        padding: 0;
        overflow: visible !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-sizing: border-box;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0 !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table thead {
        display: none;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table tbody {
        display: grid;
        gap: 12px;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__row {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
        overflow: hidden;
        border: 1px solid #e3ebf0;
        border-radius: 12px;
        background: #ffffff;
        box-sizing: border-box;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table td {
        display: grid;
        grid-template-columns: minmax(5.5rem, 36%) minmax(0, 1fr);
        gap: 10px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding: 10px 14px !important;
        border: 0;
        border-bottom: 1px solid #edf2f5;
        background: #ffffff !important;
        color: var(--rl-text);
        text-align: left !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: #788897;
        font-size: .78rem;
        font-weight: 700;
        line-height: 1.45;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table td:last-child {
        border-bottom: 0;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__empty {
        display: block;
        padding: 16px !important;
        border: 1px solid #e3ebf0;
        border-radius: 12px;
        text-align: center !important;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__empty::before {
        display: none;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table td .rl-status-badge {
        width: fit-content;
        max-width: 100%;
        min-width: 0;
        white-space: normal;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions {
        display: block !important;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions::before {
        display: block;
        margin-bottom: 8px;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        gap: 8px !important;
        white-space: normal !important;
        box-sizing: border-box;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions > .rl-admin-announcement-action,
    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions > .rl-admin-announcement-action-form {
        display: flex !important;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        align-self: stretch;
        box-sizing: border-box;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions > .rl-admin-announcement-action-form {
        height: 44px;
        min-height: 44px;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions > .rl-admin-announcement-action,
    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions > .rl-admin-announcement-action-form > .rl-admin-announcement-action {
        display: flex !important;
        width: 100% !important;
        height: 44px !important;
        min-width: 0 !important;
        min-height: 44px !important;
        margin: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 10px 14px !important;
        border-width: 1px !important;
        border-style: solid;
        font: inherit !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        text-align: center !important;
        text-decoration: none !important;
        appearance: none;
        -webkit-appearance: none;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
        box-sizing: border-box !important;
    }

    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions > :last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 359.98px) {
    .rl-admin-announcements-page .rl-admin-announcements-table__actions .rl-table-actions {
        grid-template-columns: 1fr;
    }
}

/* Management home only: use the compact mobile header and hero without changing desktop. */
@media (max-width: 760px) {
    .rl-backend-layout.rl-backend-layout--backend_home .rl-backend-topbar {
        display: flex;
        min-height: 0;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 9px 14px;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-backend-topbar__menu-toggle {
        flex: 0 0 auto;
        grid-column: auto;
        grid-row: auto;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-backend-topbar__title {
        flex: 1 1 auto;
        grid-column: auto;
        grid-row: auto;
        min-width: 0;
        margin: 0;
        font-size: .92rem;
        white-space: nowrap;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-backend-topbar__user {
        display: flex;
        flex: 0 0 auto;
        grid-column: auto;
        grid-template-columns: none;
        grid-row: auto;
        width: auto;
        margin-left: 0;
        align-items: center;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 0;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-backend-logout-button {
        grid-column: auto;
        grid-row: auto;
        min-height: 34px;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-hero {
        grid-template-columns: minmax(0, 1fr);
        height: auto;
        min-height: 0;
        gap: 0;
        padding: 18px 16px 10px;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-actions {
        display: none !important;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-hero h1 {
        max-width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0 .22em;
        font-size: clamp(1.65rem, 7.5vw, 2rem);
        line-height: 1.2;
        letter-spacing: 0;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-hero__title-part {
        display: inline-block;
        white-space: nowrap;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-hero__english {
        margin-top: 8px;
        font-size: .94rem;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-session {
        align-items: center;
        gap: 8px;
        margin-top: 18px;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-session__greeting {
        flex: 0 1 auto;
        width: auto;
        min-width: 0;
    }

    .rl-backend-layout.rl-backend-layout--backend_home .rl-platform-home .rl-platform-session__role {
        flex: 0 0 auto;
        align-self: auto;
        max-width: 100%;
    }
}

/* Medical Network dashboard details become labelled cards on narrow screens.
   This is scoped to the KPI section and does not change other report tables. */
@media (max-width: 760px) {
    .rl-medical-network-kpi-dashboard,
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-grid,
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card,
    .rl-medical-network-kpi-dashboard__trace-details,
    .rl-medical-network-kpi-dashboard__trace-content,
    .rl-medical-network-kpi-dashboard__table-wrap,
    .rl-medical-network-kpi-dashboard__table {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .rl-medical-network-kpi-dashboard .rl-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .rl-medical-network-kpi-dashboard .rl-medical-network-kpi-year-filter {
        align-items: stretch;
    }

    .rl-medical-network-kpi-dashboard .rl-medical-network-kpi-year-filter label,
    .rl-medical-network-kpi-dashboard .rl-medical-network-kpi-year-filter select,
    .rl-medical-network-kpi-dashboard .rl-medical-network-kpi-year-filter .rl-button {
        width: 100%;
    }

    .rl-medical-network-kpi-dashboard .rl-toolbar > .rl-button {
        width: 100%;
        min-width: 0;
    }

    .rl-medical-network-kpi-dashboard .rl-annual-kpi-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card {
        padding: 16px;
    }

    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card__header,
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card__values {
        grid-template-columns: minmax(0, 1fr);
    }

    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card__header {
        align-items: flex-start;
        gap: 10px;
    }

    .rl-medical-network-kpi-dashboard__table td {
        overflow-wrap: break-word;
        word-break: normal;
    }

    .rl-medical-network-kpi-dashboard__trace-details > summary {
        padding: 14px;
    }

    .rl-medical-network-kpi-dashboard__trace-content {
        padding: 14px;
    }

    .rl-medical-network-kpi-dashboard__table-wrap {
        overflow: visible;
        border: 0;
    }

    .rl-medical-network-kpi-dashboard__table,
    .rl-medical-network-kpi-dashboard__table tbody,
    .rl-medical-network-kpi-dashboard__table tr,
    .rl-medical-network-kpi-dashboard__table td {
        display: block;
    }

    .rl-medical-network-kpi-dashboard__table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .rl-medical-network-kpi-dashboard__table tr {
        margin: 0 0 12px;
        padding: 12px;
        border: 1px solid var(--rl-line);
        border-radius: 10px;
        background: #fff;
    }

    .rl-medical-network-kpi-dashboard__table td {
        padding: 9px 0;
        border: 0;
    }

    .rl-medical-network-kpi-dashboard__table td + td {
        border-top: 1px solid var(--rl-line);
    }

    .rl-medical-network-kpi-dashboard__table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 3px;
        color: var(--rl-muted);
        font-size: 14px;
        font-weight: 700;
        line-height: 1.45;
    }

    .rl-medical-network-kpi-dashboard__table ul {
        margin: 0;
        padding-left: 1.25em;
    }
}

@media (max-width: 430px) {
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card,
    .rl-medical-network-kpi-dashboard__table tr {
        padding: 14px;
    }
}

@media (max-width: 390px) {
    .rl-medical-network-kpi-dashboard .rl-annual-kpi-card,
    .rl-medical-network-kpi-dashboard__table tr {
        padding: 12px;
    }
}

/* Improvement review history: keep the audit trail readable without changing
   the existing desktop improvement-record table. */
.rl-improvements-page .rl-improvement-return-notice,
.rl-improvements-page .rl-improvement-review-history {
    min-width: 0;
    margin-top: 24px;
    padding: 18px;
    border: 1px solid var(--rl-line);
    border-radius: 10px;
    background: var(--rl-panel-soft);
}

.rl-improvements-page .rl-improvement-return-notice {
    border-color: #f0c36a;
    background: #fff9eb;
}

.rl-improvements-page .rl-improvement-return-notice h3,
.rl-improvements-page .rl-improvement-review-history h3 {
    margin: 0 0 12px;
}

.rl-improvements-page .rl-improvement-return-notice__reason,
.rl-improvements-page .rl-improvement-review-history__table td {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.rl-improvements-page .rl-improvement-review-history__table-wrap {
    max-width: 100%;
}

.rl-improvements-page .rl-improvement-review-history__table th:nth-child(1) { width: 16%; }
.rl-improvements-page .rl-improvement-review-history__table th:nth-child(2) { width: 15%; }
.rl-improvements-page .rl-improvement-review-history__table th:nth-child(3),
.rl-improvements-page .rl-improvement-review-history__table th:nth-child(4) { width: 12%; }
.rl-improvements-page .rl-improvement-review-history__table th:nth-child(5) { width: 15%; }
.rl-improvements-page .rl-improvement-review-history__table th:nth-child(6) { width: 30%; }

@media (max-width: 760px) {
    .rl-improvements-page,
    .rl-improvements-page .rl-panel,
    .rl-improvements-page .rl-form,
    .rl-improvements-page .rl-improvement-return-notice,
    .rl-improvements-page .rl-improvement-review-history,
    .rl-improvements-page .rl-improvement-review-history__table-wrap,
    .rl-improvements-page .rl-improvement-review-history__table,
    .rl-improvements-page .rl-improvement-review-history__table tbody,
    .rl-improvements-page .rl-improvement-review-history__table tr,
    .rl-improvements-page .rl-improvement-review-history__table td {
        min-width: 0 !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    .rl-improvements-page .rl-improvement-return-notice,
    .rl-improvements-page .rl-improvement-review-history {
        padding: 16px;
    }

    .rl-improvements-page .rl-improvement-review-history__table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible !important;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .rl-improvements-page .rl-improvement-review-history__table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: separate;
        border-spacing: 0 12px;
    }

    .rl-improvements-page .rl-improvement-review-history__table thead {
        display: none !important;
    }

    .rl-improvements-page .rl-improvement-review-history__table tbody {
        display: grid;
        gap: 12px;
    }

    .rl-improvements-page .rl-improvement-review-history__table tr {
        display: block;
        overflow: hidden;
        border: 1px solid var(--rl-line);
        border-radius: 8px;
        background: #fff;
    }

    .rl-improvements-page .rl-improvement-review-history__table td {
        display: grid;
        grid-template-columns: minmax(88px, 38%) minmax(0, 1fr);
        gap: 10px;
        width: 100% !important;
        padding: 10px 12px !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-improvements-page .rl-improvement-review-history__table td::before {
        content: attr(data-label);
        min-width: 0;
        color: var(--rl-muted);
        font-weight: 700;
        overflow-wrap: anywhere;
    }

    .rl-improvements-page .rl-improvement-review-history__table td:last-child {
        border-bottom: 0;
    }

    .rl-improvements-page .rl-improvement-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 8px !important;
        margin-bottom: 12px;
    }

    .rl-improvements-page .rl-improvement-summary-grid .rl-kpi {
        min-width: 0;
        min-height: 0 !important;
        padding: 14px 12px !important;
    }

    .rl-improvements-page .rl-improvement-summary-grid .rl-kpi span {
        font-size: .82rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-improvements-page .rl-improvement-summary-grid .rl-kpi strong {
        margin-top: 6px;
        font-size: 26px;
    }

    .rl-improvements-page .rl-improvement-table-wrap {
        margin: 0;
        padding: 0;
        overflow: visible !important;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }

    .rl-improvements-page .rl-improvement-table,
    .rl-improvements-page .rl-improvement-table tbody,
    .rl-improvements-page .rl-improvement-table tr,
    .rl-improvements-page .rl-improvement-table td {
        min-width: 0 !important;
        max-width: 100%;
        box-sizing: border-box;
    }

    .rl-improvements-page .rl-improvement-table {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        table-layout: auto;
        border-collapse: separate;
        border-spacing: 0;
        background: transparent;
    }

    .rl-improvements-page .rl-improvement-table thead {
        display: none !important;
    }

    .rl-improvements-page .rl-improvement-table tbody {
        display: grid;
        gap: 12px;
    }

    .rl-improvements-page .rl-improvement-table tr {
        display: block;
        width: 100%;
        overflow: hidden;
        border: 1px solid var(--rl-line);
        border-radius: 10px;
        background: #fff;
    }

    .rl-improvements-page .rl-improvement-table td {
        display: grid;
        grid-template-columns: minmax(5rem, 36%) minmax(0, 1fr);
        gap: 8px;
        width: 100% !important;
        padding: 10px 12px !important;
        border: 0;
        border-bottom: 1px solid #edf2f5;
        background: #fff !important;
        text-align: left !important;
        vertical-align: top !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-improvements-page .rl-improvement-table td::before {
        content: attr(data-label);
        min-width: 0;
        color: var(--rl-muted);
        font-size: .82rem;
        font-weight: 700;
        line-height: 1.45;
        overflow-wrap: anywhere;
    }

    .rl-improvements-page .rl-improvement-table td:last-child {
        border-bottom: 0;
    }

    .rl-improvements-page .rl-improvement-table__actions .rl-table-actions {
        display: flex !important;
        flex-flow: row wrap !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100%;
        min-width: 0 !important;
        white-space: normal !important;
        box-sizing: border-box;
    }

    .rl-improvements-page .rl-improvement-table__actions .rl-table-actions > a,
    .rl-improvements-page .rl-improvement-table__actions .rl-table-actions > form {
        display: flex !important;
        flex: 1 1 110px !important;
        width: auto !important;
        max-width: 100%;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
    }

    .rl-improvements-page .rl-improvement-table__actions .rl-table-actions > a,
    .rl-improvements-page .rl-improvement-table__actions .rl-table-actions > form > button {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 40px !important;
        height: auto !important;
        white-space: normal !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

/* 網站意見回饋：手機版改用直式卡片，避免 9 欄表格在 360-430px 產生橫向捲動。
   標籤／值、按鈕全寬等排版直接沿用 .rl-course-editor-mobile-summary 的宣告
   （見上方各規則的 selector list），這裡只補該模式沒有的「清單 + 卡片外框」。 */
@media (max-width: 767.98px) {
    .rl-site-feedback-page .rl-table-wrap {
        display: none;
    }

    .rl-site-feedback-page .rl-site-feedback-mobile-list {
        display: grid;
        min-width: 0;
        gap: 12px;
    }

    .rl-site-feedback-mobile-card {
        display: grid;
        min-width: 0;
        gap: 10px;
        padding: 14px;
        border: 1px solid #e3ebf0;
        border-radius: 8px;
        background: #f9fcfd;
    }

    .rl-site-feedback-mobile-card__heading {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        min-width: 0;
    }

    .rl-site-feedback-mobile-card__category {
        min-width: 0;
        color: var(--rl-text);
        font-size: 1.02rem;
        font-weight: 700;
        line-height: 1.4;
        overflow-wrap: anywhere;
    }

    .rl-site-feedback-mobile-card__id {
        color: var(--rl-muted);
        font-size: .78rem;
        font-weight: 700;
    }

    .rl-site-feedback-mobile-card__text {
        min-width: 0;
        margin: 0;
        color: var(--rl-text);
        line-height: 1.55;
        overflow-wrap: anywhere;
    }

    .rl-site-feedback-mobile-card__flagged {
        display: block;
        margin-top: 4px;
        color: var(--rl-muted);
        overflow-wrap: anywhere;
    }

    .rl-site-feedback-mobile-card__actions textarea {
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }
}

/* 課程清單的「一般年度 KPI」欄位。
   兩種狀態都上色，不是只標示例外的那一種：這一欄要用來掃出「誤計入」的課程，
   而誤計入的那一列顯示的是「計入」——只標「不計入」的話，該被看見的那一列
   反而是沒有記號的那些。 */
.rl-annual-kpi-badge--included {
    border-color: #abefc6;
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.rl-annual-kpi-badge--excluded {
    border-color: #d0d5dd;
    background: #f2f4f7;
    color: #475467;
}

/* 報名名單的「收集狀態」欄位與篩選列。

   三種狀態都上色，理由與課程清單那一欄相同：這一欄要用來掃出「還沒處理的」，
   只標例外的話，該被看見的那些反而是沒有記號的。

   未收集用警示色而不是中性灰——它是補件的工作單，是唯一需要主動聯絡當事人的
   狀態。待歸戶也要處理，但那是內部作業（把自由文字對到正式代碼），不必聯絡人，
   所以用另一個色階區分，避免兩份不同的工作被混成同一批。 */
.rl-service-status-badge--not-collected {
    border-color: #fedf89;
    background: var(--rl-warning-bg);
    color: var(--rl-warning);
}

.rl-service-status-badge--pending-mapping {
    border-color: #b2ddff;
    background: #eff8ff;
    color: #175cd3;
}

.rl-service-status-badge--collected {
    border-color: #abefc6;
    background: var(--rl-success-bg);
    color: var(--rl-success);
}

.rl-filter-form {
    display: flex;
    flex-wrap: wrap;
    /* 頂端對齊：右側控制項那一塊（清除篩選＋匯出＋警語）比左邊的篩選標籤高，
       底部對齊會讓標籤沉到列的下緣、與第一顆按鈕差半個區塊高，看起來像跑版。 */
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    /* `.rl-form` 的 max-width: 720px 是為了資料輸入表單的可讀性——一行文字太長不好
       讀。篩選列不是那種東西，它是一條控制列：左邊選條件、右邊匯出選出來的結果。
       被截在 720px 的話右側控制項會被擠到第二行，「同一列」就不成立了。 */
    max-width: none;
}

.rl-filter-form label {
    flex: 1 1 320px;
    min-width: 0;
}

/* 匯出按鈕與它的個資警語（admin-attendance.php 三個區塊共用）。

   🔴 兩者必須是同一個視覺群組。警語原本與按鈕同為 .rl-toolbar 的直接子元素，
      而 .rl-toolbar 是 space-between——標題靠左、按鈕被擠到中間、警語飛到螢幕
      最右邊。讀的人先看到按鈕，視線要移到另一端才知道那個檔案含個資。
      警語離它要說明的按鈕越遠越沒有作用，那是它唯一的用途。

   包成一個子元素之後 .rl-toolbar 自然回到兩欄（標題｜匯出群組），
   這一列不需要任何額外的排版規則。 */
.rl-export-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    /* 警語限寬才會斷成兩三行貼在按鈕下方；不限寬會拉成一長條橫跨整列，
       視覺上又和按鈕分家了。 */
    max-width: min(100%, 32ch);
}

.rl-export-notice {
    margin: 0;
    color: var(--rl-muted);
    font-size: 13px;
    line-height: 1.5;
    text-align: right;
}

@media (max-width: 760px) {
    /* 窄螢幕上 .rl-toolbar 會轉成單欄、按鈕滿版（既有規則），
       此時右對齊會讓警語貼在螢幕邊緣、與滿版按鈕對不齊，改回靠左。 */
    .rl-export-group {
        align-items: stretch;
        max-width: 100%;
        width: 100%;
    }

    .rl-export-notice {
        text-align: left;
    }
}

/* 標題要與按鈕頂端對齊，不是垂直置中。

   .rl-toolbar 預設 align-items: center，而匯出群組（按鈕＋警語兩行）比標題高，
   置中會讓標題浮在中間、和按鈕錯開。這裡只改這一種工具列，不動其他頁面既有的
   .rl-toolbar 行為。 */
.rl-export-toolbar {
    align-items: flex-start;
}

@media (max-width: 760px) {
    /* 卡片版面裡，td 是 grid 容器（標籤欄｜值欄），徽章身為 grid item 預設會被
       拉成整個值欄的寬度，看起來像一顆可以按的按鈕。狀態徽章不是控制項，
       靠左貼齊自己的內容寬度就好。 */
    .rl-admin-attendance-page .rl-admin-records-table td .rl-status-badge {
        justify-self: start;
    }
}

/* 補件（enrollment-service-backfill.php）的勾選清單。

   每一列要看得出是哪一門課、什麼時候報的——使用者要能判斷「這筆該不該套用
   這組資料」。只列 id 的話他無從判斷，只能全部照單全收。 */
.rl-backfill-targets {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 選擇器要寫成 .rl-form .rl-backfill-target（0-2-0），不能只寫 .rl-backfill-target
   （0-1-0）——`.rl-form label`（0-1-1）的特異性比較高，光靠順序蓋不過它，
   勾選框會被排到文字上方。 */
.rl-form .rl-backfill-target {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--rl-line);
    border-radius: 8px;
    background: var(--rl-panel-soft);
}

.rl-backfill-target__content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rl-backfill-target__course {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.rl-backfill-target__meta {
    color: var(--rl-muted);
    font-size: 13px;
    overflow-wrap: anywhere;
}

/* 「尚未填寫服務機構／身分別」的提示。用警示色，因為它是待辦不是資訊。 */
.rl-service-backfill-notice {
    border-color: #fedf89;
    background: var(--rl-warning-bg);
}

/* 🔴 hidden 屬性必須贏過版面規則。

   `.rl-form-group, .rl-form label { display: flex }` 會蓋掉瀏覽器預設的
   `[hidden] { display: none }`——CSS 作者樣式的 display 優先於 UA 樣式。結果是
   任何標了 hidden 的表單群組**照樣顯示**。

   實測（Chrome，載入本檔）：
     .rl-form-group[hidden]                    → display:flex，看得見（錯）
     .rl-form label[hidden]                    → display:flex，看得見（錯）
     .rl-medical-network-kpi-fields[hidden]    → display:none（對，因為它另有 !important 規則）

   受影響的是報名表單的「其他服務機構名稱」：它只該在服務機構選「其他」時出現，
   但一直都看得見。PHP 的初始狀態與 app.js 的 setGroupVisible() 都是靠 hidden
   屬性，兩者同時失效。功能面沒有壞（伺服器端一律清掉不該有的值，控制項也被
   disabled），但畫面上會有一個永遠停在那裡、標著必填星號卻不能填的欄位。

   改成通則之後，往後新增相依欄位不必再各自補一條 !important。 */
.rl-form-group[hidden],
.rl-form label[hidden] {
    display: none !important;
}

/* 補件的勾選框不是輸入欄位，不該套 `.rl-form input { width: 100% }`——
   套了會變成一顆撐滿整列的巨大方塊，看起來像按鈕而不是勾選框。 */
.rl-form .rl-backfill-target input[type="checkbox"] {
    width: auto;
    min-width: 0;
    min-height: 0;
    flex: 0 0 auto;
    margin-top: 2px;
}

/* 匯出群組待在篩選列右側（報名名單那一區）。

   🔴 位置是語意不是排版：這一區匯出的是「目前篩選出來的那一份」，所以按鈕待在
      決定「目前是哪一份」的控制項旁邊。放回標題列會讓人以為那是「匯出全部」，
      而這一頁的匯出真的會被當成補件工作單直接使用。

   右側的控制項（清除篩選、匯出群組）包在 .rl-filter-form__actions 裡一起處理。
   不包的話它們各自依 flex 規則落點：有篩選時「清除篩選」貼在標籤右緣、匯出群組
   被 margin-left:auto 推到更右，兩塊錯開且不對齊。

   align-items: flex-start 讓按鈕頂端與左邊的篩選標籤齊平——篩選標籤底下還有一行
   說明小字，沿用篩選列的 flex-end 會錯開一大截。 */
.rl-filter-form__actions {
    margin-left: auto;
    display: flex;
    /* 欄式而不是列式，而且明確夾住寬度。

       ⚠️ 沒有 max-width 時這一塊會把整列撐到換行：匯出群組的固有寬度取決於警語
          那一整句話**不換行時**的長度（很寬），群組自己的 max-width 沒有夾住它
          對外層 flex 的寬度貢獻。實測（篩選狀態）它量到 797px，於是被擠到第二行
          ——「同一列」就不成立了。夾住之後 320（篩選標籤）＋ 300 遠小於容器寬度。 */
    flex: 0 1 auto;
    max-width: 300px;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

@media (max-width: 760px) {
    /* 窄螢幕上篩選列改成堆疊。DOM 順序就是堆疊順序：
       篩選下拉 → 清除篩選 → 匯出按鈕＋警語。
       「先決定要哪一份，再匯出」——動作的先後與閱讀的先後一致。 */
    .rl-filter-form__actions {
        margin-left: 0;
        width: 100%;
        max-width: none;
        /* ⚠️ 這一塊是 flex-direction: column，所以決定左右對齊的是 align-items，
           不是 justify-content（那個管的是直向）。寫錯的話「清除篩選」會維持靠右、
           而匯出按鈕滿版，兩顆按鈕對不齊。 */
        align-items: stretch;
    }

    .rl-filter-form .rl-export-group--filter {
        width: 100%;
        max-width: none;
    }
}

/* 醫療院所管理：一般管理者看到的「合作醫院」「本院」欄位——不可操作，所以刻意
   不用 .rl-status-badge 的圓角膠囊外觀（那看起來像可以點的按鈕）。純文字＋灰階，
   旁邊一行小字說明。滑鼠游標維持預設（不是手型），span/small 本來就不會變手型。 */
.rl-institution-partner-status,
.rl-institution-own-status {
    font-weight: 700;
    color: var(--rl-muted);
}

.rl-institution-partner-status-note,
.rl-institution-own-status-note {
    display: block;
    margin-top: 2px;
    color: var(--rl-muted);
    font-size: .78rem;
    font-weight: 400;
}

/* 醫療院所管理：「系統管理者設定」欄——合作醫院、本院兩塊迷你切換表單。
   寬螢幕並排（flex row，各佔一半），窄螢幕自動換行成上下堆疊；兩塊用不同
   色系＋左側色條區分，不再需要中間的分隔線。只有 rl_is_joomla_super_admin()
   會看到這一欄（見 admin-institutions.php）。 */
.rl-institution-sysadmin-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: stretch;
    min-width: 20rem;
}

.rl-institution-flag-block {
    flex: 1 1 9rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 8px;
    border: 1px solid var(--rl-line);
    border-left-width: 4px;
    border-radius: 6px;
}

.rl-institution-flag-block--partner {
    background: var(--rl-primary-soft);
    border-left-color: var(--rl-primary);
}

.rl-institution-flag-block--own {
    background: var(--rl-success-bg);
    border-left-color: var(--rl-accent);
}

.rl-institution-flag-block__title {
    margin: 0;
    font-weight: 700;
    font-size: .88rem;
}

.rl-institution-flag-block__current {
    margin: 1px 0 5px;
    font-size: .8rem;
    color: var(--rl-muted);
}

.rl-institution-flag-form {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: auto;
}

.rl-institution-flag-reason {
    display: block;
    font-size: .8rem;
    color: var(--rl-muted);
}

.rl-institution-flag-reason input[type="text"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 3px;
}

.rl-institution-flag-form button {
    width: 100%;
}

/* 待歸戶機構名稱彙整：某個原文名稱剛好對到一家已建立的正式機構時，在該列附上
   的提示。刻意用淺綠底（不是紅／黃的警示色）——這是「已經處理好了」的正向資訊，
   不是要人採取行動的警告。 */
.rl-reconciliation-match {
    margin: 6px 0 0;
    padding: 8px 10px;
    border: 1px solid #bfe3cf;
    border-radius: 6px;
    background: var(--rl-success-bg);
    color: #1c5b3a;
    font-size: .85rem;
    line-height: 1.5;
}

.rl-reconciliation-match code {
    background: rgba(255, 255, 255, .6);
    padding: 0 .25em;
    border-radius: 3px;
}

/* 待歸戶機構名稱彙整：人工標記狀態與標記表單。
   標記狀態用中性藍底（不是「已建立正式機構」那段的正向綠，也不是警示色）——
   它陳述的是「有人處理過、處理成什麼」，是資訊不是行動呼籲。 */
.rl-reconciliation-manual-mark {
    margin: 0 0 6px;
    padding: 8px 10px;
    border: 1px solid var(--rl-line-strong);
    border-left: 3px solid var(--rl-primary);
    border-radius: 6px;
    background: var(--rl-primary-soft);
    font-size: .85rem;
    line-height: 1.5;
}

.rl-reconciliation-mark-form {
    font-size: .85rem;
}

.rl-reconciliation-mark-form summary {
    cursor: pointer;
    color: var(--rl-primary);
}

.rl-reconciliation-mark-form form {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 22rem;
}

.rl-reconciliation-mark-form label {
    display: block;
    font-size: .82rem;
    color: var(--rl-muted);
}

.rl-reconciliation-mark-form select,
.rl-reconciliation-mark-form input[type="text"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 4px;
}

.rl-reconciliation-mark-cell__empty {
    color: var(--rl-muted);
}

/* 醫療院所管理：列上的「編輯」連結、狀態切換、已停用列，以及「編輯院所」面板。 */
.rl-institution-edit-link {
    margin-left: 8px;
    font-size: .82rem;
    white-space: nowrap;
}

.rl-institution-active-form {
    display: inline;
    margin-left: 8px;
}

.rl-institution-active-state--off {
    color: var(--rl-muted);
    font-weight: 700;
}

.rl-institution-row--inactive td {
    background: #fafafa;
    color: var(--rl-muted);
}

.rl-institution-row--inactive td code {
    opacity: .7;
}

.rl-edit-institution-panel .rl-edit-institution-warning {
    color: #8a5a00;
    font-weight: 600;
}

.rl-edit-institution-panel .rl-edit-institution-collision {
    margin-top: 6px;
    color: #1c5b3a;
    font-weight: 600;
}

/* ── 醫療院所管理／待歸戶機構名稱彙整：手機版把寬表格改成卡片 ─────────────────
   兩頁的資料表欄位多（醫療院所 7 欄、待歸戶 5 欄、其中「受影響的報名紀錄 ID」是
   一長串），在窄螢幕上 .rl-table 的 min-width 會撐出左右拉條。比照
   .rl-admin-attendance-page .rl-admin-records-table 等既有做法：thead 隱藏、每個
   td 用 ::before 取 data-label 當欄名。兩頁的 <td> 都已帶 data-label。
   （這不是治標——是這個專案處理寬表格手機版的標準解法，見 CLAUDE.md 第十九節。） */
@media (max-width: 760px) {
    .rl-admin-institutions-page .rl-table-wrap,
    .rl-admin-institution-reconciliation-page .rl-table-wrap {
        overflow: visible;
        border: 0;
        background: transparent;
    }

    .rl-admin-institutions-page .rl-table,
    .rl-admin-institutions-page .rl-table tbody,
    .rl-admin-institutions-page .rl-table tr,
    .rl-admin-institutions-page .rl-table td,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table tbody,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table tr,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td {
        display: block;
        box-sizing: border-box;
        width: 100%;
        min-width: 0;
    }

    .rl-admin-institutions-page .rl-table thead,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table thead {
        display: none;
    }

    .rl-admin-institutions-page .rl-table tr,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table tr {
        margin-bottom: 12px;
        padding: 12px;
        border: 1px solid var(--rl-line);
        border-radius: 8px;
        background: #fff;
    }

    .rl-admin-institutions-page .rl-table tr:last-child,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table tr:last-child {
        margin-bottom: 0;
    }

    .rl-admin-institutions-page .rl-table td,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td {
        display: grid;
        grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr);
        gap: 8px;
        padding: 6px 0;
        border: 0;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .rl-admin-institutions-page .rl-table td::before,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td::before {
        content: attr(data-label);
        color: var(--rl-muted);
        font-size: .82rem;
        font-weight: 700;
    }

    /* td 在卡片版面是 grid 容器，徽章身為 grid item 預設會被拉成整個值欄的寬度，
       看起來像一顆可以按的按鈕（同 admin-attendance.php 的既有處理）。 */
    .rl-admin-institutions-page .rl-table td .rl-status-badge {
        justify-self: start;
    }

    /* 「系統管理者設定」那一格在卡片版面：欄名放上面、兩塊表單改回上下堆疊
       （窄螢幕並排會太擠），各自撐滿整行、不產生左右拉條。 */
    .rl-admin-institutions-page .rl-institution-sysadmin-cell {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        min-width: 0;
    }

    .rl-admin-institutions-page .rl-institution-sysadmin-cell::before {
        display: block;
        margin-bottom: 6px;
    }

    .rl-admin-institutions-page .rl-institution-flag-block {
        flex: 0 0 auto;
    }

    .rl-admin-institutions-page .rl-institution-flag-form {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .rl-admin-institutions-page .rl-institution-flag-reason {
        display: block;
        font-size: .82rem;
        color: var(--rl-muted);
    }

    .rl-admin-institutions-page .rl-institution-flag-reason input[type="text"] {
        width: 100%;
        box-sizing: border-box;
        margin-top: 4px;
    }

    .rl-admin-institutions-page .rl-institution-flag-form button {
        width: 100%;
    }

    /* 「機構名稱（原文）」這一格在卡片版面是 2 欄 grid（欄名｜值）。對到正式機構
       的提示要橫跨整行，不要被擠進值那一欄。 */
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td .rl-reconciliation-match {
        grid-column: 1 / -1;
        margin-top: 8px;
    }

    /* 「人工標記」這一格的狀態說明與標記表單同樣橫跨整行。 */
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td .rl-reconciliation-manual-mark,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td .rl-reconciliation-mark-form,
    .rl-admin-institution-reconciliation-page .rl-institution-reconciliation-table td .rl-reconciliation-mark-cell__empty {
        grid-column: 1 / -1;
    }

    .rl-admin-institution-reconciliation-page .rl-reconciliation-mark-form form {
        max-width: none;
    }

    /* 「編輯」連結、狀態切換表單在卡片版面各自佔一整行，不擠在值欄裡。 */
    .rl-admin-institutions-page .rl-table td .rl-institution-edit-link,
    .rl-admin-institutions-page .rl-table td .rl-institution-active-form {
        grid-column: 1 / -1;
        justify-self: start;
        margin-left: 0;
        margin-top: 6px;
    }

    .rl-admin-institutions-page .rl-table td .rl-institution-active-state {
        justify-self: start;
    }

    .rl-admin-institutions-page .rl-table tr.rl-institution-row--inactive {
        background: #fafafa;
    }

    /* 「編輯院所」面板的表單比照其他面板，輸入框不要撐出卡片。 */
    .rl-admin-institutions-page .rl-edit-institution-panel .rl-form input[type="text"],
    .rl-admin-institutions-page .rl-edit-institution-panel .rl-form input[type="number"] {
        width: 100%;
        box-sizing: border-box;
    }
}

/* 醫療院所管理卡片版面的兩個修正。限定 screen：上面那組 @media 沒限定 screen，A4 列印寬度
   也會命中，這裡的改動不帶進列印。 */
@media screen and (max-width: 760px) {
    /* 「編輯」連結與「停用／啟用」按鈕放回值欄，分別排在機構名稱與啟用狀態底下。上面那條
       grid-column: 1 / -1 ＋ justify-self: start 讓它們從欄名那一欄起排，「編輯」看起來就是
       一個欄名、右邊什麼都沒有。 */
    .rl-admin-institutions-page .rl-table td .rl-institution-edit-link,
    .rl-admin-institutions-page .rl-table td .rl-institution-active-form {
        grid-column: 2;
        margin-top: 0;
    }

    /* 系統管理者設定：選擇器一定要帶 td。卡片版面的 `.rl-admin-institutions-page .rl-table td`
       （display: grid，0-2-1）比只寫 class 的 `.rl-admin-institutions-page .rl-institution-sysadmin-cell`
       （0-2-0）高，上面那條的 display: flex 從來沒生效——td 仍是「欄名｜值」兩欄 grid，
       合作醫院落在值欄（靠右）、本院換行落進窄的欄名欄。 */
    .rl-admin-institutions-page .rl-table td.rl-institution-sysadmin-cell {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 8px;
        min-width: 0;
    }

    .rl-admin-institutions-page .rl-table td.rl-institution-sysadmin-cell::before {
        margin-bottom: 0;
    }

    .rl-admin-institutions-page .rl-table td.rl-institution-sysadmin-cell > .rl-institution-flag-block {
        flex: 0 0 auto;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin: 0;
    }
}

/* 課程討論「講師」標示（前台討論區、課程主控台、平台報表、單一課程報表）。
   身分靠「講師」兩個字表達，不只靠顏色；邊框讓它在列印與高對比模式下仍看得出是標示。
   文字 #0b4f6c 對底色 #e6f2f8 對比約 7.8:1（≥ 4.5:1）。 */
.rl-discussion-role-badge {
    display: inline-block;
    padding: 0 .45em;
    border: 1px solid #0b4f6c;
    border-radius: 4px;
    background: #e6f2f8;
    color: #0b4f6c;
    font-size: .82em;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    vertical-align: baseline;
}

/* 課程主控台課程討論「操作」欄：「設為非公開」與「回覆」兩顆按鈕，空間不夠時換行（手機卡片不擠出畫面）。 */
.rl-discussion-card__action-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-width: 0;
    max-width: 100%;
}

/* .rl-action-button 的 display: inline-flex !important 會蓋掉 hidden 屬性（見 CLAUDE.md 第二十節）。
   「回覆」按鈕在沒有 JavaScript 時要維持隱藏，所以 hidden 一律生效。 */
.rl-action-button[hidden] {
    display: none !important;
}

/* 課程主控台「以講師身分留言」表單。 */
.rl-staff-discussion-form textarea {
    width: 100%;
    min-height: 6rem;
    box-sizing: border-box;
}
