* { box-sizing: border-box; }

        :root {
            --blue: #179fc0;
            --blue-dark: #1385a1;
            --border: #d7dde2;
            --text: #333;
            --muted: #6f777d;
            --bg: #f5f6f8;
            --row-red: #fff1f1;
            --row-green: #eaf8ee;
        }

        body {
            margin: 0;
            background: var(--bg);
            color: var(--text);
            font-family: "Segoe UI", Tahoma, Arial, sans-serif;
            font-size: 14px;
        }

        button, input, select, textarea { font: inherit; }
        button { cursor: pointer; }

        .top-header {
            height: 58px;
            display: flex;
            align-items: center;
            padding: 0 24px;
            background: white;
            border-bottom: 3px solid var(--blue);
            box-shadow: 0 2px 6px rgba(0,0,0,.08);
        }

        .brand {
            color: var(--blue-dark);
            font-size: 21px;
            font-weight: 700;
        }

        .brand-subtitle {
            margin-left: 14px;
            color: #7a8288;
            font-size: 13px;
        }

        .page-container {
            width: min(1700px, calc(100% - 28px));
            margin: 22px auto 50px;
        }

        .panel {
            margin-bottom: 18px;
            padding: 18px;
            background: white;
            border: 1px solid var(--border);
            border-radius: 5px;
            box-shadow: 0 2px 7px rgba(0,0,0,.05);
        }

        .login-panel {
            width: min(520px, 100%);
            margin: 55px auto;
        }

        h2, h3 { margin: 0 0 14px; color: #2f3a40; }
        h2 { font-size: 21px; }
        h3 { font-size: 18px; }

        .description {
            margin: 0 0 18px;
            color: var(--muted);
            line-height: 1.55;
        }

        .stale-data-note {
            display: none;
            margin-top: 5px;
            max-width: 920px;
            color: #7d6b49;
            font-size: 12px;
            font-weight: 500;
            line-height: 1.45;
            opacity: 0.82;
        }

        .stale-data-note.visible {
            display: block;
        }

        .form-group { margin-bottom: 15px; }
        .form-label { display: block; margin-bottom: 6px; font-weight: 700; }

        .text-input,
        .select-input,
        .text-area {
            width: 100%;
            min-height: 38px;
            padding: 7px 10px;
            background: white;
            border: 1px solid #c8cfd5;
            border-radius: 3px;
            outline: none;
        }

        .text-area {
            min-height: 150px;
            resize: vertical;
            line-height: 1.5;
        }

        .text-input:focus,
        .select-input:focus,
        .text-area:focus {
            border-color: var(--blue);
            box-shadow: 0 0 0 2px rgba(23,159,192,.13);
        }

        .password-row {
            display: flex;
            align-items: center;
            gap: 7px;
            margin: 3px 0 18px;
        }

        .primary-button,
        .secondary-button,
        .danger-button,
        .add-button,
        .mini-button,
        .page-button {
            border-radius: 3px;
            font-weight: 700;
        }

        .primary-button {
            min-height: 40px;
            padding: 8px 17px;
            color: white;
            background: var(--blue);
            border: 1px solid var(--blue);
        }

        .primary-button:hover { background: var(--blue-dark); }
        .full-width { width: 100%; }

        .secondary-button {
            min-height: 36px;
            padding: 6px 13px;
            color: #3c6975;
            background: #eff8fa;
            border: 1px solid #9bcbd6;
        }

        .secondary-button:hover { background: #e1f3f7; }
        .secondary-button.is-loading {
            min-width: 190px;
            cursor: wait;
            white-space: nowrap;
        }

        .danger-button {
            min-height: 36px;
            padding: 6px 13px;
            color: white;
            background: #df5252;
            border: 1px solid #cf4444;
        }

        .danger-button:hover { background: #cf4444; }

        button:disabled {
            opacity: .58;
            cursor: not-allowed;
        }

        .status-box {
            display: none;
            margin-top: 15px;
            padding: 11px 12px;
            border-radius: 3px;
            line-height: 1.45;
            white-space: pre-line;
        }

        #dashboard { display: none; }

        .progress-banner {
            display: none;
            position: sticky;
            top: 0;
            z-index: 30;
            margin-bottom: 14px;
            padding: 12px 14px;
            color: #285f83;
            background: #edf7fd;
            border: 1px solid #b7d7ee;
            border-radius: 5px;
            box-shadow: 0 2px 8px rgba(0,0,0,.06);
        }

        .progress-banner.visible { display: flex; align-items: center; gap: 11px; }
        .progress-banner.error { color: #922727; background: #fdeaea; border-color: #e2aaaa; }
        .progress-banner.success { color: #246d34; background: #e8f5e9; border-color: #9ccc9c; }

        .refresh-toast {
            position: fixed;
            top: 14px;
            left: 50%;
            z-index: 10050;
            display: flex;
            align-items: center;
            gap: 9px;
            max-width: min(560px, calc(100vw - 28px));
            padding: 10px 14px;
            border: 1px solid transparent;
            border-radius: 7px;
            box-shadow: 0 5px 18px rgba(0,0,0,.16);
            font-weight: 600;
            line-height: 1.35;
            opacity: 0;
            pointer-events: none;
            transform: translate(-50%, -16px);
            transition: opacity .18s ease, transform .18s ease;
        }

        .refresh-toast.visible {
            opacity: 1;
            transform: translate(-50%, 0);
        }

        .refresh-toast.success {
            color: #246d34;
            background: #e8f5e9;
            border-color: #9ccc9c;
        }

        .refresh-toast.error {
            color: #922727;
            background: #fdeaea;
            border-color: #e2aaaa;
        }

        .spinner {
            width: 18px;
            height: 18px;
            border: 3px solid rgba(23,159,192,.25);
            border-top-color: var(--blue);
            border-radius: 50%;
            animation: spin .8s linear infinite;
            flex: 0 0 auto;
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        .semester-bar,
        .selected-summary,
        .table-controls,
        .table-footer,
        .action-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            flex-wrap: wrap;
        }

        .semester-name {
            color: var(--blue-dark);
            font-size: 18px;
            font-weight: 700;
        }

        .semester-note { margin-top: 6px; color: var(--muted); font-size: 13px; }

        .registration-badge {
            padding: 7px 11px;
            font-size: 13px;
            font-weight: 700;
            border-radius: 3px;
        }

        .registration-open { color: #26743b; background: #e6f7eb; border: 1px solid #9bd2a9; }
        .registration-closed { color: #9d2e2e; background: #fde9e9; border: 1px solid #dfa7a7; }

        .session-actions {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 9px;
            flex-wrap: wrap;
        }

        .logout-button {
            min-height: 34px;
            padding: 6px 12px;
            color: #8e2d2d;
            font-weight: 700;
            background: #fff3f3;
            border: 1px solid #e2aaaa;
            border-radius: 3px;
        }

        .logout-button:hover { background: #ffe7e7; }

        .main-heading { margin: 22px 0 12px; font-size: 17px; font-weight: 700; }
        .mode-options { margin-bottom: 18px; }
        .mode-option { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
        .mode-panels > div { display: none; }
        .mode-panels > div.active { display: block; }

        .filter-layout {
            display: grid;
            grid-template-columns: repeat(3, minmax(250px, 1fr));
            gap: 18px;
            margin-bottom: 14px;
        }

        .quick-entry-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

        .table-controls { margin: 12px 0; }
        .page-size-control,
        .global-search-control { display: flex; align-items: center; gap: 7px; }
        .page-size-control select { width: 75px; height: 34px; }
        .global-search-control input { width: 250px; height: 34px; }

        .table-shell {
            overflow: auto;
            border: 1px solid var(--border);
            background: white;
        }

        .table-hidden { display: none; }

        table {
            width: 100%;
            min-width: 1480px;
            border-collapse: collapse;
            font-size: 13px;
        }

        th, td {
            padding: 8px 9px;
            text-align: left;
            vertical-align: top;
            border-right: 1px solid #e1e5e8;
            border-bottom: 1px solid #e1e5e8;
        }

        th {
            color: #343b3f;
            font-weight: 700;
            white-space: nowrap;
            background: #f4f6f7;
        }

        thead .column-filter-row th { padding: 5px; background: #fafbfc; }

        .column-filter {
            width: 100%;
            min-width: 70px;
            height: 30px;
            padding: 4px 6px;
            border: 1px solid #cfd5da;
            border-radius: 2px;
            outline: none;
            font-size: 12px;
        }

        .full-course-row { background: var(--row-red); }
        .registered-course-row { background: var(--row-green); }
        .center { text-align: center; }
        .nowrap { white-space: nowrap; }
        .course-name { min-width: 190px; }
        .schedule-cell { min-width: 330px; line-height: 1.48; }

        .add-button {
            min-width: 62px;
            padding: 6px 10px;
            color: white;
            background: #12b4d4;
            border: 1px solid #12b4d4;
        }

        .added-button { color: #607178; background: #edf1f3; border-color: #cbd3d7; }
        .remove-selection-button {
            color: white;
            background: #d94848;
            border-color: #d94848;
        }
        .remove-selection-button:hover { background: #c33737; border-color: #c33737; }
        .dav-checkbox { width: 17px; height: 17px; cursor: default; }
        .remaining-full { color: #d53030; font-weight: 700; }
        .remaining-available { color: #333; font-weight: 700; }

        .course-status {
            display: inline-block;
            padding: 4px 7px;
            font-size: 12px;
            font-weight: 700;
            border-radius: 3px;
            white-space: nowrap;
        }

        .status-full { color: #a82929; background: #ffdede; border: 1px solid #e7abab; }
        .status-registered { color: #277040; background: #dff3e5; border: 1px solid #9bceaa; }
        .empty-table-message { padding: 28px; text-align: center; color: #778087; }
        .table-footer { margin-top: 12px; }
        .result-info { color: #667077; }
        .pagination { display: flex; align-items: center; gap: 4px; }

        .page-button {
            min-width: 34px;
            height: 32px;
            padding: 4px 8px;
            color: #455159;
            background: white;
            border: 1px solid #ccd3d8;
        }

        .page-button.active { color: white; background: var(--blue); border-color: var(--blue); }
        .selected-count { color: var(--blue-dark); font-weight: 700; }

        .selected-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            margin: 12px 0;
            flex-wrap: wrap;
        }

        .selected-toolbar-left {
            display: flex;
            align-items: center;
            gap: 9px;
            flex-wrap: wrap;
        }

        .priority-buttons { display: flex; justify-content: center; gap: 5px; white-space: nowrap; }

        .priority-input {
            width: 62px;
            height: 34px;
            padding: 5px 7px;
            text-align: center;
            font-weight: 800;
            border: 1px solid #bfcbd1;
            border-radius: 5px;
            background: white;
        }

        .priority-input:focus {
            outline: 0;
            border-color: var(--blue);
            box-shadow: 0 0 0 3px rgba(23,159,192,.13);
        }

        .remove-course-button:disabled,
        .remove-selection-button:disabled {
            color: #879198;
            background: #edf0f2;
            border-color: #cfd6da;
            cursor: not-allowed;
            opacity: .78;
        }

        .mini-button {
            min-width: 32px;
            padding: 5px 8px;
            color: #3e4b52;
            background: #f1f4f5;
            border: 1px solid #cbd3d7;
        }

        .remove-button { color: #9e2929; background: #fff0f0; border-color: #e5b4b4; }
        .selected-table { min-width: 1000px; }

        .registration-control-grid {
            display: grid;
            grid-template-columns: minmax(180px, 240px) auto auto 1fr;
            gap: 10px;
            align-items: end;
            margin-top: 14px;
        }

        .registration-state {
            justify-self: end;
            min-width: 150px;
            padding: 9px 12px;
            text-align: center;
            font-weight: 700;
            border-radius: 4px;
            color: #5e6870;
            background: #f1f3f5;
            border: 1px solid #cdd4d9;
        }

        .registration-state.running {
            color: #256b38;
            background: #e7f6eb;
            border-color: #9fd0aa;
        }

        .registration-state.running::before {
            content: "";
            display: inline-block;
            width: 8px;
            height: 8px;
            margin-right: 7px;
            border-radius: 50%;
            background: currentColor;
            vertical-align: 1px;
            animation: registration-live-pulse 1.2s ease-in-out infinite;
        }

        @keyframes registration-live-pulse {
            0%, 100% { opacity: .35; transform: scale(.8); }
            50% { opacity: 1; transform: scale(1.15); }
        }

        .registration-stats {
            margin: 12px 0;
            color: var(--muted);
            font-size: 13px;
        }

        .log-shell {
            max-height: 330px;
            overflow: auto;
            border: 1px solid var(--border);
            border-radius: 4px;
            background: #fbfcfd;
        }

        .log-empty {
            padding: 24px;
            text-align: center;
            color: #7a848b;
        }

        .log-entry {
            display: grid;
            grid-template-columns: 74px 82px minmax(130px, 190px) 1fr;
            gap: 9px;
            align-items: start;
            padding: 9px 11px;
            border-bottom: 1px solid #e6eaed;
            line-height: 1.4;
        }

        .log-entry:last-child { border-bottom: 0; }
        .log-time { color: #778087; font-variant-numeric: tabular-nums; }
        .log-course { font-weight: 700; color: #34434b; }

        .log-ltc {
            display: inline-block;
            margin-left: 6px;
            padding: 2px 7px;
            border-radius: 999px;
            font-size: 12px;
            font-style: italic;
            font-weight: 750;
            white-space: nowrap;
        }

        .log-ltc-0 { color: #1769aa; background: #e5f1fb; border: 1px solid #9ec8e8; }
        .log-ltc-1 { color: #8a4d0f; background: #fff0dc; border: 1px solid #e7bb83; }
        .log-ltc-2 { color: #6b3aa5; background: #f1e9fb; border: 1px solid #c6a9e8; }
        .log-ltc-3 { color: #14715d; background: #e1f5ef; border: 1px solid #91d2c1; }
        .log-ltc-4 { color: #a13d66; background: #fbe8f0; border: 1px solid #e2abc1; }
        .log-ltc-5 { color: #606b12; background: #f3f5d9; border: 1px solid #ccd38b; }

        .log-level {
            display: inline-block;
            padding: 3px 6px;
            text-align: center;
            font-size: 11px;
            font-weight: 700;
            border-radius: 3px;
        }

        .log-level.info { color: #315e78; background: #e8f3f9; }
        .log-level.waiting { color: #795f16; background: #fff3cf; }
        .log-level.success { color: #276d3b; background: #e4f5e9; }
        .log-level.warning { color: #925b18; background: #fff0d9; }
        .log-level.error { color: #922b2b; background: #fde6e6; }

        @media (max-width: 850px) {
            .registration-control-grid { grid-template-columns: 1fr 1fr; }
            .registration-state { justify-self: stretch; }
            .log-entry { grid-template-columns: 62px 72px 1fr; }
            .log-message { grid-column: 1 / -1; }
        }

        .modal-overlay {
            position: fixed;
            inset: 0;
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 22000;
            padding: 20px;
            background: rgba(0,0,0,.55);
        }

        #result-modal { z-index: 24000; }
        #failure-detail-modal { z-index: 24500; }

        .modal-overlay.open { display: flex; }
        .modal-box { width: min(1100px, 100%); max-height: 92vh; overflow: auto; background: white; border-radius: 8px; position: relative; }
        .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid #e1e5e8; }
        #result-modal .modal-header { position: sticky; top: 0; z-index: 30; background: white; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
        .modal-title { font-size: 20px; font-weight: 700; }
        .close-modal { width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 50%; font-size: 20px; }
        .modal-content { padding: 18px; line-height: 1.6; }

        .guide-example {
            position: relative;
            width: 100%;
            margin: 12px 0 18px;
            border: 1px solid #dce2e7;
            border-radius: 6px;
            overflow: hidden;
        }

        .guide-example img { display: block; width: 100%; height: auto; }
        .circle-mark { position: absolute; border: 4px solid red; border-radius: 999px; pointer-events: none; }
        .mark-code { left: 3.8%; top: 21%; width: 6%; height: 15%; }
        .mark-ltc { left: 27%; top: 21%; width: 5.5%; height: 15%; }
        .mark-class { left: 48.6%; top: 21%; width: 6.5%; height: 15%; }

        .guide-format-box {
            margin: 12px 0;
            padding: 12px 14px;
            background: #f8fbfd;
            border: 1px solid #d6eaf1;
            border-radius: 6px;
        }

        @media (max-width: 900px) {
            .filter-layout { grid-template-columns: 1fr; }
            .global-search-control input { width: 190px; }
            .brand-subtitle { display: none; }
        }


        /* V6: thông tin sinh viên, bộ lọc kiểu DAV và bảng cuộn cố định */
        .student-info {
            min-width: 190px;
            padding: 6px 10px;
            text-align: right;
            color: #34434b;
            background: #f7fafb;
            border: 1px solid #dbe4e8;
            border-radius: 4px;
            line-height: 1.35;
        }

        .student-info strong { display: block; font-size: 14px; }
        .student-info span { color: #718087; font-size: 12px; }

        .school-filter-layout {
            display: grid;
            grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
            gap: 18px;
            margin-bottom: 14px;
        }

        .school-filter-layout .select-input {
            height: 46px;
            font-size: 16px;
        }


        #school-filter-type option.show-all-courses-option,
        #school-filter-type.show-all-selected {
            color: #c62828;
            font-weight: 800;
        }

        .school-filter-value-wrap.hidden { display: none; }

        .search-hero {
            display: flex;
            align-items: center;
            flex: 1 1 520px;
            min-width: 280px;
            padding: 4px 10px;
            background: #f4fbfe;
            border: 2px solid var(--blue);
            border-radius: 7px;
            box-shadow: 0 3px 10px rgba(23,159,192,.12);
        }

        .search-hero .search-icon {
            margin-right: 8px;
            color: var(--blue-dark);
            font-size: 20px;
        }

        .search-hero input {
            width: 100%;
            height: 40px;
            padding: 6px 4px;
            border: 0;
            outline: none;
            background: transparent;
            font-size: 15px;
        }

        .course-table-shell {
            height: 520px;
            max-height: 520px;
            overflow: auto;
            border-color: #42aee0;
            border-radius: 5px;
        }

        .course-table-shell table { min-width: 1480px; }
        .course-table-shell thead tr:first-child th {
            position: sticky;
            top: 0;
            z-index: 6;
        }
        .course-table-shell thead tr.column-filter-row th {
            position: sticky;
            top: 37px;
            z-index: 5;
        }

        .selected-table .remove-cell { width: 72px; }
        .remove-course-button {
            padding: 6px 10px;
            color: white;
            font-weight: 700;
            background: #df5252;
            border: 1px solid #cf4444;
            border-radius: 3px;
        }
        .remove-course-button:hover { background: #c94242; }

        .registration-control-grid {
            grid-template-columns: auto auto minmax(160px, 1fr);
            align-items: center;
        }

        .run-fixed-note {
            margin-top: 7px;
            color: #6c777d;
            font-size: 13px;
        }

        .result-modal-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 74px;
            height: 74px;
            margin: 4px auto 14px;
            border-radius: 50%;
            font-size: 42px;
            font-weight: 700;
        }
        .result-modal-icon.success { color: #20723b; background: #dcf4e4; }
        .result-modal-icon.failure { color: #a03232; background: #fde3e3; }
        .result-modal-heading { text-align: center; font-size: 24px; font-weight: 800; }
        .result-modal-subtitle { margin: 8px auto 18px; text-align: center; color: #66737a; }
        .result-list { margin: 0; padding: 0; list-style: none; }
        .result-list li {
            margin-top: 9px;
            padding: 11px 13px;
            white-space: pre-line;
            background: #fff5f5;
            border: 1px solid #ebc0c0;
            border-radius: 5px;
            line-height: 1.45;
        }
        .result-list strong { display: block; color: #7f2929; }
        .result-list small { color: #6c777d; }

        @media (max-width: 900px) {
            .school-filter-layout { grid-template-columns: 1fr; }
            .student-info { text-align: left; width: 100%; }
            .registration-control-grid { grid-template-columns: 1fr; }
        }


        /* V7: bố cục tài khoản gọn, bảng có lề ngoài, log đồng màu trạng thái */
        .session-actions {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 7px;
        }

        .account-row {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
        }

        .student-info {
            min-width: 0;
            width: auto;
            max-width: 360px;
            padding: 4px 8px;
            display: inline-flex;
            align-items: baseline;
            gap: 7px;
            text-align: left;
            line-height: 1.2;
            white-space: nowrap;
        }

        .student-info strong,
        .student-info span {
            display: inline;
        }

        .student-info strong {
            max-width: 230px;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .registration-badge {
            align-self: flex-end;
        }

        .school-filter-layout {
            grid-template-columns: minmax(310px, .9fr) minmax(310px, 1.1fr);
        }

        .search-hero {
            flex: 1 1 650px;
            min-height: 52px;
            padding: 5px 13px;
            background: #ffffff;
            border-width: 2px;
            box-shadow: 0 4px 14px rgba(23,159,192,.19);
        }

        .search-hero:focus-within {
            border-color: #087fa4;
            box-shadow: 0 0 0 4px rgba(23,159,192,.13), 0 4px 14px rgba(23,159,192,.16);
        }

        .search-hero input {
            font-size: 16px;
            font-weight: 600;
        }

        .course-table-shell {
            width: calc(100% - 42px);
            margin-right: 42px;
        }

        .status-slot {
            color: #23713a;
            background: #e1f5e7;
            border: 1px solid #9fd1ac;
        }

        .selected-heading-block .selected-count {
            display: block;
            margin-top: 5px;
        }

        .registration-tool-panel {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
        }

        .tool-title-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 5px;
        }

        .tool-title-main {
            min-width: 0;
            display: flex;
            align-items: center;
            gap: 9px;
        }

        .tool-title-row h3 {
            margin: 0;
            white-space: nowrap;
        }

        .tool-title-row .registration-state {
            margin-left: auto;
        }

        .registration-control-grid {
            grid-template-columns: auto auto;
            justify-content: start;
            margin-top: 14px;
        }

        .log-entry.info { background: #edf6fb; border-left: 4px solid #68a8c8; }
        .log-entry.waiting { background: #f1f3f5; border-left: 4px solid #9aa4ab; }
        .log-entry.success { background: #e9f7ed; border-left: 4px solid #62ad77; }
        .log-entry.warning { background: #fff3df; border-left: 4px solid #d89a3c; }
        .log-entry.error { background: #fdecec; border-left: 4px solid #d46b6b; }

        .log-level.waiting {
            color: #556169;
            background: #e3e7ea;
        }

        .log-message {
            white-space: pre-line;
            line-height: 1.55;
            overflow-wrap: anywhere;
        }

        .attempt-badge {
            display: inline-flex;
            align-items: center;
            margin-right: 8px;
            padding: 3px 8px;
            color: #174f68;
            background: #dceff7;
            border: 1px solid #9cc8d9;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 800;
            white-space: nowrap;
        }

        .log-stop-note {
            display: block;
            margin-top: 7px;
            padding-top: 7px;
            color: #8d2929;
            border-top: 1px dashed rgba(141, 41, 41, .35);
            font-weight: 800;
            font-style: italic;
        }

        .result-list li {
            white-space: pre-line;
        }

        @media (max-width: 900px) {
            .session-actions,
            .registration-badge { align-items: stretch; align-self: stretch; }
            .account-row { justify-content: flex-start; flex-wrap: wrap; }
            .student-info { max-width: 100%; white-space: normal; }
            .course-table-shell { width: 100%; margin-right: 0; }
        }



        /* V18: thanh RapidDAV cố định và cấu hình chạy nâng cao */
        body {
            padding-top: 76px;
        }

        .top-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 10020;
            min-height: 66px;
            height: auto;
            justify-content: space-between;
            gap: 18px;
            padding: 8px 24px;
        }

        .header-brand-block {
            display: flex;
            align-items: baseline;
            gap: 10px;
            min-width: 0;
        }

        .header-brand-block .brand {
            flex: 0 0 auto;
            letter-spacing: .2px;
        }

        .header-brand-block .brand-subtitle {
            margin-left: 0;
        }

        .header-session-actions {
            display: none;
            flex-direction: column;
            align-items: flex-end;
            gap: 5px;
            min-width: 0;
        }

        .header-session-actions.visible {
            display: flex;
        }

        .header-session-actions .student-info {
            color: #29404a;
            background: #f7fbfc;
        }

        .header-session-actions .registration-badge {
            align-self: flex-end;
            padding: 3px 8px;
            font-size: 11px;
        }

        .refresh-toast {
            top: 82px;
        }

        .registration-settings-grid {
            display: grid;
            grid-template-columns: minmax(240px, .8fr) minmax(330px, 1.15fr) minmax(360px, 1.25fr);
            gap: 12px;
            margin: 14px 0;
        }

        .setting-card {
            padding: 13px 14px;
            background: #f8fbfc;
            border: 1px solid #d9e5e9;
            border-radius: 7px;
        }

        .setting-title {
            margin-bottom: 8px;
            font-weight: 800;
            color: #34464e;
        }

        .setting-check-row,
        .inline-radio-row {
            display: flex;
            align-items: flex-start;
            gap: 9px;
            line-height: 1.35;
        }

        .setting-check-row input,
        .inline-radio-row input[type="radio"] {
            margin-top: 3px;
            flex: 0 0 auto;
        }

        .setting-check-row small {
            display: block;
            margin-top: 3px;
            color: #6c7a81;
        }

        .inline-radio-row {
            align-items: center;
            margin-top: 8px;
            flex-wrap: wrap;
        }

        .compact-number-input,
        .compact-select {
            height: 34px;
            padding: 5px 8px;
            border: 1px solid #c8d1d6;
            border-radius: 4px;
            background: white;
        }

        .compact-number-input {
            width: 86px;
        }

        .compact-select {
            width: 84px;
        }

        .schedule-controls {
            display: grid;
            grid-template-columns: minmax(280px, 1fr) auto auto;
            gap: 8px;
            margin-top: 10px;
        }

        .schedule-date-time-fields {
            width: 100%;
            min-width: 0;
            max-width: 100%;
            display: grid;
            grid-template-columns: minmax(150px, 1fr) minmax(105px, 130px);
            gap: 7px;
        }

        /* Native date/time controls trên iOS có intrinsic min-width lớn hơn ô
           grid. Ép từng control được phép co lại để viền không tràn khỏi card. */
        .schedule-controls > *,
        .schedule-date-time-fields > .text-input {
            min-width: 0;
            max-width: 100%;
        }

        #auto-start-date,
        #auto-start-clock {
            display: block;
            width: 100%;
            min-width: 0;
            max-width: 100%;
            inline-size: 100%;
            min-inline-size: 0;
            max-inline-size: 100%;
        }

        .schedule-controls.disabled {
            opacity: .62;
        }

        .schedule-status {
            margin-top: 8px;
            color: var(--muted);
            font-size: 12px;
            line-height: 1.4;
        }

        .schedule-status.active {
            color: var(--good);
            font-weight: 700;
        }

        .schedule-status.error {
            color: var(--bad);
            font-weight: 700;
        }

        .log-entry.cancelled {
            background: #fff5dc;
            border-left: 4px solid #d8a12f;
        }

        .semester-status-side {
            display: flex;
            align-items: flex-start;
            justify-content: flex-end;
            margin-left: auto;
        }

        .registration-stats {
            margin-top: 14px;
            padding: 12px 14px;
            background: #f8fbfc;
            border: 1px solid #d9e5e9;
            border-radius: 7px;
        }

        .run-stats-strip {
            display: flex;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px 12px;
            font-weight: 700;
            line-height: 1.45;
        }

        .run-stat-base,
        .run-stat-success,
        .run-stat-failure,
        .run-stat-active,
        .run-stat-time {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 5px 9px;
            border-radius: 999px;
            border: 1px solid transparent;
        }

        .run-stat-base { color: #40515a; background: #eef2f4; border-color: #d5dde1; }
        .run-stat-success { color: #216d38; background: #e5f6ea; border-color: #a7d7b4; }
        .run-stat-failure { color: #9a2929; background: #fde9e9; border-color: #e5aaaa; }
        .run-stat-active { color: #86610e; background: #fff4d5; border-color: #e7ca78; }
        .run-stat-time { color: #315e78; background: #e8f3f9; border-color: #b8d6e5; }

        .failure-info-button {
            width: 21px;
            height: 21px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            color: #137ea6;
            background: #e8f6fb;
            border: 1px solid #78bdd6;
            border-radius: 50%;
            font-size: 13px;
            font-weight: 900;
            line-height: 1;
        }

        .failure-info-button:disabled {
            opacity: .38;
            cursor: default;
        }

        .failure-detail-list {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        .failure-detail-list li {
            margin-bottom: 10px;
            padding: 11px 12px;
            background: #fff7f7;
            border: 1px solid #efc3c3;
            border-radius: 6px;
            white-space: pre-line;
        }

        .failure-detail-list strong { color: #8e2929; }
        .failure-detail-list small { display: block; margin: 3px 0 6px; color: #6b777d; }

        .log-level.cancelled {
            color: #865d08;
            background: #ffecb5;
        }

        .registered-results-heading,
        .log-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 14px;
            flex-wrap: wrap;
        }

        .registered-results-count {
            margin-top: 3px;
            color: #216d38;
            font-weight: 700;
        }

        .registered-results-shell {
            max-height: 430px;
            overflow: auto;
        }

        .registered-results-table {
            min-width: 1040px;
        }

        .registered-results-table tbody tr {
            background: #f4fbf6;
        }

        .registered-results-table tbody tr:hover {
            background: #eaf7ee;
        }

        .registered-success-badge {
            display: inline-block;
            padding: 4px 8px;
            color: #216d38;
            background: #e5f6ea;
            border: 1px solid #a7d7b4;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 800;
            white-space: nowrap;
        }

        .log-toolbar {
            margin-top: 16px;
            margin-bottom: 8px;
            justify-content: flex-start;
        }

        .log-toolbar-title {
            margin: 2px 0 8px;
            font-weight: 800;
            color: #34434b;
        }

        .registered-delete-button {
            width: 30px;
            height: 30px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            color: #a52f2f;
            background: #fff1f1;
            border: 1px solid #e1aaaa;
            border-radius: 4px;
            font-size: 20px;
            font-weight: 800;
            line-height: 1;
        }

        .registered-delete-button:hover:not(:disabled) {
            color: white;
            background: #d84c4c;
            border-color: #c94242;
        }

        .registered-delete-button.is-loading {
            font-size: 15px;
            cursor: wait;
        }

        .registered-delete-unavailable {
            color: #a7afb4;
            font-weight: 700;
        }

        .registered-row-deleting {
            opacity: .58;
        }

        .logs-hidden {
            display: none;
        }

        @media (max-width: 1120px) {
            .registration-settings-grid {
                grid-template-columns: 1fr;
            }
        }

        @media (max-width: 760px) {
            body { padding-top: 104px; }
            .top-header {
                align-items: flex-start;
                flex-wrap: wrap;
                padding: 8px 12px;
            }
            .header-brand-block {
                flex-direction: column;
                align-items: flex-start;
                gap: 1px;
            }
            .header-session-actions.visible {
                align-items: flex-end;
            }
            .header-session-actions .account-row {
                flex-wrap: nowrap;
            }
            .header-session-actions .student-info {
                max-width: 190px;
            }
            .schedule-controls {
                grid-template-columns: 1fr;
            }
        }

    

        /* V24: license gate + tối ưu giao diện cảm ứng/điện thoại */
        .license-gate-note {
            display: flex;
            align-items: flex-start;
            gap: 9px;
            margin: -3px 0 16px;
            padding: 10px 12px;
            color: #526169;
            background: #f3f6f7;
            border: 1px solid #d9e1e4;
            border-radius: 6px;
            line-height: 1.45;
            font-size: 13px;
        }
        .license-gate-note.active {
            color: #235c72;
            background: #edf8fc;
            border-color: #acd6e3;
        }
        .license-gate-note.warning {
            color: #8a5d14;
            background: #fff7df;
            border-color: #e6ca83;
        }
        .license-gate-note.development {
            color: #6c7478;
            background: #f5f6f7;
        }
        .license-gate-icon { flex: 0 0 auto; line-height: 1.35; }

        .table-shell,
        .course-table-shell,
        .selected-table-shell,
        .registered-table-shell {
            -webkit-overflow-scrolling: touch;
            overscroll-behavior: contain;
        }

        @media (max-width: 760px) {
            :root { --mobile-header-height: 116px; }
            html { scroll-padding-top: calc(var(--mobile-header-height) + 12px); }
            body {
                padding-top: var(--mobile-header-height);
                font-size: 14px;
                overflow-x: hidden;
            }
            .top-header {
                min-height: var(--mobile-header-height);
                padding: 9px 10px;
                display: grid;
                grid-template-columns: minmax(0, 1fr) auto;
                grid-template-rows: auto auto;
                align-content: center;
                gap: 7px 9px;
            }
            .header-brand-block {
                grid-column: 1 / -1;
                display: flex;
                flex-direction: row;
                align-items: baseline;
                gap: 7px;
                min-width: 0;
            }
            .header-brand-block .brand { font-size: 20px; }
            .header-brand-block .brand-subtitle {
                display: block;
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                font-size: 12px;
            }
            .header-session-actions.visible {
                grid-column: 1 / -1;
                width: 100%;
                align-items: stretch;
            }
            .header-session-actions .account-row {
                width: 100%;
                display: grid;
                grid-template-columns: minmax(0, 1fr) auto;
                gap: 8px;
                align-items: center;
            }
            .header-session-actions .student-info {
                max-width: none;
                width: 100%;
                min-width: 0;
                display: grid;
                gap: 2px;
                padding: 5px 7px;
                white-space: normal;
            }
            .header-session-actions .student-info strong,
            .header-session-actions .student-info span {
                display: block;
                max-width: 100%;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            .logout-button {
                min-height: 42px;
                padding: 7px 11px;
            }
            .page-container {
                width: calc(100% - 14px);
                margin: 10px auto 30px;
            }
            .panel {
                margin-bottom: 12px;
                padding: 12px;
                border-radius: 7px;
            }
            .login-panel {
                width: 100%;
                margin: 14px auto;
            }
            h2 { font-size: 19px; }
            h3 { font-size: 17px; }
            .description { margin-bottom: 14px; }
            .text-input, .select-input, .text-area {
                min-height: 44px;
                font-size: 16px;
            }
            button, .primary-button, .secondary-button, .danger-button, .mini-button {
                min-height: 44px;
            }
            .semester-bar,
            .selected-summary,
            .table-controls,
            .table-footer,
            .action-row {
                align-items: stretch;
                gap: 9px;
            }
            .semester-bar > *,
            .selected-summary > *,
            .table-controls > *,
            .action-row > * {
                max-width: 100%;
            }
            .table-controls .secondary-button,
            .table-controls .danger-button,
            .action-row .primary-button,
            .action-row .secondary-button,
            .action-row .danger-button {
                flex: 1 1 150px;
            }
            .school-filter-layout,
            .registration-settings-grid,
            .registration-control-grid,
            .schedule-controls {
                grid-template-columns: minmax(0, 1fr) !important;
            }
            .search-hero {
                flex-basis: 100%;
                min-width: 0;
                min-height: 48px;
            }
            .search-hero input { font-size: 16px; }
            .course-table-shell {
                width: 100%;
                height: min(62vh, 560px);
                max-height: min(62vh, 560px);
                margin-right: 0;
            }
            .course-table-shell table { min-width: 1280px; }
            .selected-table-shell table,
            .registered-table-shell table { min-width: 940px; }
            .progress-banner {
                position: sticky;
                top: calc(var(--mobile-header-height) + 4px);
                z-index: 10010;
            }
            .refresh-toast {
                top: calc(var(--mobile-header-height) + 8px);
                max-width: calc(100vw - 16px);
                width: max-content;
            }
            .modal-overlay {
                padding: 6px;
                align-items: flex-end;
            }
            .modal-box {
                width: 100%;
                max-height: 92dvh;
                border-radius: 12px 12px 0 0;
            }
            .modal-header { padding: 12px; }
            .modal-content { padding: 12px; }
            .modal-title { font-size: 18px; }
            .close-modal {
                width: 42px;
                height: 42px;
                flex-basis: 42px;
            }
            .log-entry {
                grid-template-columns: 58px 72px minmax(0, 1fr);
                gap: 6px;
                padding: 9px 7px;
            }
            .log-course, .log-message { overflow-wrap: anywhere; }
            .registration-stats {
                display: grid;
                grid-template-columns: 1fr;
                gap: 7px;
            }
        }

        @media (max-width: 430px) {
            :root { --mobile-header-height: 122px; }
            .header-brand-block .brand-subtitle { font-size: 11px; }
            .header-session-actions .student-info strong { font-size: 13px; }
            .header-session-actions .student-info span { font-size: 11px; }
            .page-container { width: calc(100% - 10px); }
            .panel { padding: 10px; }
            .primary-button, .secondary-button, .danger-button { width: 100%; }
            .password-row { min-height: 38px; }
            .course-table-shell { height: 58vh; max-height: 58vh; }
        }



        /* V28: tab navigation, compact settings and registration history */
        .dashboard-tabs {
            position: sticky;
            top: 70px;
            z-index: 9000;
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 6px;
            margin-bottom: 14px;
            padding: 6px;
            background: rgba(245, 246, 248, .96);
            border: 1px solid #d7dde2;
            border-radius: 9px;
            backdrop-filter: blur(8px);
        }

        .dashboard-tab-button {
            min-height: 40px;
            padding: 8px 12px;
            color: #52636b;
            background: white;
            border: 1px solid #d4dde1;
            border-radius: 6px;
            font-weight: 800;
        }

        .dashboard-tab-button:hover { background: #eef8fa; }
        .dashboard-tab-button.active {
            color: white;
            background: var(--blue);
            border-color: var(--blue);
            box-shadow: 0 2px 6px rgba(19,133,161,.2);
        }

        .dashboard-tab-panel { display: none; }
        .dashboard-tab-panel.active { display: block; }

        .settings-toggle-button {
            width: fit-content;
            min-width: 118px;
            max-width: 150px;
            min-height: 38px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 9px;
            margin: 0;
            padding: 7px 12px;
            color: #315e6c;
            background: #f2f8fa;
            border: 1px solid #b9d7df;
            border-radius: 7px;
            font-weight: 800;
        }

        .settings-collapsible {
            overflow: hidden;
            max-height: 1200px;
            opacity: 1;
            transition: max-height .22s ease, opacity .18s ease, margin .22s ease;
        }

        .settings-collapsible.settings-hidden {
            max-height: 0;
            opacity: 0;
            margin: 0;
            pointer-events: none;
        }

        .activity-history-grid {
            display: grid;
            grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
            gap: 14px;
            margin-top: 16px;
        }

        .activity-card {
            min-width: 0;
            padding: 12px;
            background: #fbfcfd;
            border: 1px solid #dce4e7;
            border-radius: 8px;
        }

        .activity-card-header {
            min-height: 38px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            margin-bottom: 9px;
        }

        .activity-card-title { font-weight: 800; color: #34434b; }
        .activity-card-subtitle { margin-top: 2px; color: #748087; font-size: 12px; }
        .history-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
        .compact-action-button { min-height: 32px; padding: 4px 9px; font-size: 12px; }

        .history-shell {
            max-height: 460px;
            overflow: auto;
            display: grid;
            gap: 8px;
        }

        .history-entry {
            padding: 10px 11px;
            background: white;
            border: 1px solid #d9e2e6;
            border-radius: 7px;
        }

        .history-entry-head,
        .history-time-row,
        .history-result-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px 12px;
            flex-wrap: wrap;
        }

        .history-entry-head { color: #34464e; }
        .history-entry-head > span { color: #66757d; font-size: 12px; font-weight: 700; }
        .history-time-row { margin: 6px 0 8px; color: #728087; font-size: 12px; line-height: 1.4; }
        .history-result-row { justify-content: flex-start; }
        .history-success-count,
        .history-failure-count {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 5px 8px;
            border-radius: 999px;
            font-size: 12px;
            font-weight: 800;
        }
        .history-success-count { color: #216d38; background: #e5f6ea; border: 1px solid #a7d7b4; }
        .history-failure-count { color: #922727; background: #fde9e9; border: 1px solid #e5aaaa; }

        .info-circle-button {
            width: 22px !important;
            min-width: 22px !important;
            height: 22px !important;
            min-height: 22px !important;
            aspect-ratio: 1 / 1;
            flex: 0 0 22px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin: 0;
            padding: 0 !important;
            color: #137ea6;
            background: #f3fbfe;
            border: 1px solid #78bdd6;
            border-radius: 999px !important;
            font-family: Arial, sans-serif;
            font-size: 13px;
            font-weight: 900;
            line-height: 1;
            vertical-align: middle;
            appearance: none;
            -webkit-appearance: none;
        }
        .info-circle-button:disabled { opacity: .38; cursor: default; }

        #history-detail-modal { z-index: 24500; }
        .history-detail-list { margin: 0; padding: 0; list-style: none; }
        .history-detail-list li {
            margin-bottom: 10px;
            padding: 11px 12px;
            border-radius: 7px;
            white-space: pre-line;
        }
        .history-detail-list.failure li { background: #fff7f7; border: 1px solid #efc3c3; }
        .history-detail-list.failure strong { color: #8e2929; }
        .history-detail-list.success li { background: #f3fbf5; border: 1px solid #b9dfc3; }
        .history-detail-list.success strong { color: #216d38; }
        .history-detail-list small { display: block; margin: 3px 0 6px; color: #6b777d; }

        .status-disabled {
            color: #805b10;
            background: #fff6dc;
            border-color: #e4c66f;
        }

        @media (max-width: 1000px) {
            .activity-history-grid { grid-template-columns: 1fr; }
        }

        @media (max-width: 760px) {
            .dashboard-tabs {
                top: calc(var(--mobile-header-height) + 4px);
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 4px;
                margin-bottom: 9px;
                padding: 4px;
            }
            .dashboard-tab-button {
                min-height: 38px;
                padding: 6px 5px;
                font-size: 12px;
                white-space: nowrap;
            }
            .panel {
                padding: 9px;
                margin-bottom: 9px;
            }
            .semester-bar { padding: 8px 9px; }
            .main-heading { margin: 10px 0 7px; }
            .mode-options { gap: 5px; margin-bottom: 9px; }
            .mode-option { padding: 7px 8px; }
            .selected-toolbar,
            .table-controls,
            .registered-results-heading,
            .tool-title-row {
                gap: 7px;
            }
            .setting-card { padding: 9px 10px; }
            .tool-title-main { gap: 6px; }
            .settings-toggle-button { min-width: 104px; padding: 6px 8px; }
            .registration-state { min-width: 112px; padding: 8px; }
            .schedule-date-time-fields {
                grid-template-columns: minmax(0, 1fr) minmax(0, 108px);
            }
            #auto-start-clock {
                padding-left: 7px;
                padding-right: 7px;
            }
            .registration-settings-grid { gap: 7px; margin: 8px 0; }
            .registration-control-grid { gap: 7px; }
            .registration-stats { margin-top: 9px; padding: 8px; }
            .run-stats-strip { gap: 5px; }
            .run-stat-base,
            .run-stat-success,
            .run-stat-failure,
            .run-stat-active,
            .run-stat-time {
                padding: 4px 7px;
                font-size: 12px;
            }
            .activity-history-grid { margin-top: 9px; gap: 9px; }
            .activity-card { padding: 8px; }
            .activity-card-header { margin-bottom: 6px; }
            .log-shell, .history-shell { max-height: 360px; }
            .history-entry { padding: 8px; }
            .history-result-row { align-items: flex-start; }
            .history-success-count,
            .history-failure-count { border-radius: 7px; }
            .primary-button,
            .secondary-button,
            .danger-button { width: auto; }
            .registration-control-grid .primary-button,
            .registration-control-grid .danger-button { width: 100%; }
            .selected-toolbar .secondary-button,
            .selected-toolbar .danger-button,
            .history-actions .secondary-button,
            .history-actions .danger-button { width: auto; }
        }

        @media (max-width: 430px) {
            .dashboard-tab-button { font-size: 11px; }
            .history-actions { width: 100%; justify-content: flex-end; }
            .activity-card-header { align-items: flex-start; flex-wrap: wrap; }
            .history-time-row { display: grid; grid-template-columns: 1fr; gap: 2px; }
            .history-result-row { display: grid; grid-template-columns: 1fr; gap: 5px; }
            .history-success-count,
            .history-failure-count { justify-content: space-between; }
        }


        /* V30: mobile compact layout + bảng môn vừa khung điện thoại */
        @media (max-width: 760px) {
            :root { --mobile-header-height: 94px; }
            body {
                padding-top: var(--mobile-header-height);
                font-size: 12.5px;
            }
            .top-header {
                min-height: var(--mobile-header-height);
                padding: 6px 8px;
                gap: 4px 7px;
            }
            .header-brand-block .brand { font-size: 18px; }
            .header-brand-block .brand-subtitle { font-size: 10.5px; }
            .header-session-actions .student-info {
                padding: 3px 6px;
                gap: 0;
            }
            .header-session-actions .student-info strong { font-size: 12px; }
            .header-session-actions .student-info span { font-size: 10px; }
            .logout-button { min-height: 32px; padding: 4px 8px; font-size: 11px; }

            .page-container {
                width: calc(100% - 8px);
                margin: 6px auto 18px;
            }
            .panel {
                margin-bottom: 7px;
                padding: 7px;
                border-radius: 6px;
            }
            h2 { margin-bottom: 8px; font-size: 17px; }
            h3 { margin-bottom: 7px; font-size: 15px; }
            .description { font-size: 11.5px; line-height: 1.4; }
            .form-group { margin-bottom: 9px; }
            .form-label { margin-bottom: 4px; font-size: 12px; }
            .text-input, .select-input, .text-area {
                min-height: 36px;
                padding: 5px 7px;
                font-size: 14px;
            }
            .primary-button, .secondary-button, .danger-button, .mini-button, .page-button {
                min-height: 34px;
                padding: 5px 8px;
                font-size: 11.5px;
                width: auto;
            }
            .primary-button.full-width { width: 100%; }
            .dashboard-tabs {
                gap: 3px;
                margin-bottom: 6px;
                padding: 3px;
            }
            .dashboard-tab-button {
                min-height: 33px;
                padding: 4px 3px;
                font-size: 10.5px;
            }
            .semester-bar { padding: 6px 7px; font-size: 11px; }
            .school-filter-layout { gap: 7px; margin-bottom: 7px; }
            .school-filter-layout .select-input { height: 36px; font-size: 13px; }
            .mode-options { margin-bottom: 6px; }
            .mode-option { margin: 4px 0; padding: 5px 6px; font-size: 11.5px; }
            .table-controls { margin: 6px 0; gap: 5px; }
            .search-hero { min-height: 36px; padding: 2px 6px; border-width: 1px; }
            .search-hero .search-icon { margin-right: 4px; font-size: 15px; }
            .search-hero input { height: 31px; font-size: 12px; }
            .table-footer { margin-top: 6px; font-size: 10.5px; }
            .selected-toolbar { margin: 6px 0; gap: 5px; }
            .selected-count { font-size: 11.5px; }
            .setting-card, .activity-card { padding: 6px 7px; }
            .registration-settings-grid, .registration-control-grid { gap: 5px; }
            .settings-toggle-button { min-width: 92px; min-height: 32px; padding: 4px 6px; font-size: 10.5px; }
            .registration-state { min-width: 94px; padding: 6px; font-size: 11px; }
            .registration-stats { margin: 6px 0; padding: 6px; font-size: 11px; }
            .run-stat-base, .run-stat-success, .run-stat-failure, .run-stat-active, .run-stat-time {
                padding: 3px 5px;
                font-size: 10.5px;
            }
            .activity-history-grid { margin-top: 6px; gap: 6px; }
            .activity-card-header { margin-bottom: 4px; }
            .activity-card-title { font-size: 12px; }
            .activity-card-subtitle { font-size: 10px; }
            .compact-action-button { min-height: 28px; padding: 3px 6px; font-size: 10px; }
            .log-entry { padding: 6px 5px; font-size: 10.5px; }
            .log-shell, .history-shell { max-height: 300px; }
            .history-entry { padding: 6px; font-size: 10.5px; }
            .modal-content, .modal-header { padding: 9px; }
            .modal-title { font-size: 16px; }
            .close-modal { width: 34px; height: 34px; flex-basis: 34px; }

            .course-table-shell {
                width: 100%;
                height: min(58vh, 470px);
                max-height: min(58vh, 470px);
                overflow-x: hidden;
                overflow-y: auto;
            }
            .course-table-shell .course-table {
                width: 100%;
                min-width: 0 !important;
                table-layout: fixed;
                font-size: clamp(7px, 2.05vw, 9px);
            }
            .course-table-shell .column-filter-row { display: none; }
            .course-table-shell thead tr:first-child th { top: 0; }
            .course-table-shell th,
            .course-table-shell td {
                padding: 3px 1px;
                line-height: 1.15;
                white-space: normal;
                overflow-wrap: anywhere;
                word-break: break-word;
            }
            .course-table-shell th { text-align: center; }
            .course-table-shell th:nth-child(1), .course-table-shell td:nth-child(1) { width: 8%; }
            .course-table-shell th:nth-child(2), .course-table-shell td:nth-child(2) { width: 9%; }
            .course-table-shell th:nth-child(3), .course-table-shell td:nth-child(3) { width: 17%; }
            .course-table-shell th:nth-child(4), .course-table-shell td:nth-child(4) { width: 5%; }
            .course-table-shell th:nth-child(5), .course-table-shell td:nth-child(5) { width: 5%; }
            .course-table-shell th:nth-child(6), .course-table-shell td:nth-child(6) { width: 8%; }
            .course-table-shell th:nth-child(7), .course-table-shell td:nth-child(7) { width: 6%; }
            .course-table-shell th:nth-child(8), .course-table-shell td:nth-child(8) { width: 6%; }
            .course-table-shell th:nth-child(9), .course-table-shell td:nth-child(9) { width: 21%; }
            .course-table-shell th:nth-child(10), .course-table-shell td:nth-child(10) { width: 15%; }
            .course-table-shell .course-name,
            .course-table-shell .schedule-cell { min-width: 0; }
            .course-table-shell .nowrap { white-space: normal; }
            .course-table-shell .add-button {
                width: 100%;
                min-width: 0;
                min-height: 24px;
                padding: 2px 0;
                font-size: clamp(7px, 1.9vw, 8.5px);
                border-radius: 2px;
            }
            .course-table-shell .course-status {
                max-width: 100%;
                padding: 2px 2px;
                font-size: clamp(7px, 1.85vw, 8.5px);
                line-height: 1.1;
                white-space: normal;
                border-radius: 2px;
            }
            .selected-table { min-width: 760px; font-size: 11px; }
            .selected-table th, .selected-table td { padding: 5px 6px; }
            .priority-input { width: 48px; height: 30px; padding: 3px; }
            .registered-results-shell table { min-width: 760px; font-size: 11px; }
        }

        @media (max-width: 430px) {
            :root { --mobile-header-height: 86px; }
            .header-brand-block .brand-subtitle { display: none; }
            .page-container { width: calc(100% - 6px); }
            .panel { padding: 6px; }
            .dashboard-tab-button { font-size: 9.5px; }
            .course-table-shell .course-table { font-size: clamp(6.8px, 2vw, 8px); }
            .course-table-shell .add-button,
            .course-table-shell .course-status { font-size: 7px; }
        }


        /* V32: giữ dạng bảng trên mọi thiết bị; chỉ cuộn ngang khi dưới ngưỡng đọc được */
        .table-shell,
        .course-table-shell,
        #selected-table-area .table-shell,
        .registered-results-shell {
            width: 100%;
            max-width: 100%;
            overflow-x: auto;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }

        .course-table,
        .selected-table,
        .registered-results-table {
            width: 100%;
            table-layout: fixed;
        }

        /* Màn hình PC/laptop thông thường: vừa khung, không cần cuộn ngang. */
        .course-table-shell .course-table { min-width: 900px !important; }
        .selected-table { min-width: 790px; }
        .registered-results-table { min-width: 900px; }

        .course-table th,
        .course-table td,
        .selected-table th,
        .selected-table td,
        .registered-results-table th,
        .registered-results-table td {
            min-width: 0;
            overflow-wrap: anywhere;
            word-break: normal;
        }

        .course-table th:nth-child(1), .course-table td:nth-child(1) { width: 6.5%; }
        .course-table th:nth-child(2), .course-table td:nth-child(2) { width: 7.5%; }
        .course-table th:nth-child(3), .course-table td:nth-child(3) { width: 15.5%; }
        .course-table th:nth-child(4), .course-table td:nth-child(4) { width: 4.2%; }
        .course-table th:nth-child(5), .course-table td:nth-child(5) { width: 4.2%; }
        .course-table th:nth-child(6), .course-table td:nth-child(6) { width: 7.2%; }
        .course-table th:nth-child(7), .course-table td:nth-child(7) { width: 5.2%; }
        .course-table th:nth-child(8), .course-table td:nth-child(8) { width: 5.2%; }
        .course-table th:nth-child(9), .course-table td:nth-child(9) { width: 27.5%; }
        .course-table th:nth-child(10), .course-table td:nth-child(10) { width: 17%; }

        .selected-table th:nth-child(1), .selected-table td:nth-child(1) { width: 6.5%; }
        .selected-table th:nth-child(2), .selected-table td:nth-child(2) { width: 9%; }
        .selected-table th:nth-child(3), .selected-table td:nth-child(3) { width: 21%; }
        .selected-table th:nth-child(4), .selected-table td:nth-child(4) { width: 6%; }
        .selected-table th:nth-child(5), .selected-table td:nth-child(5) { width: 9%; }
        .selected-table th:nth-child(6), .selected-table td:nth-child(6) { width: 7%; }
        .selected-table th:nth-child(7), .selected-table td:nth-child(7) { width: 20%; }
        .selected-table th:nth-child(8), .selected-table td:nth-child(8) { width: 9%; }
        .selected-table th:nth-child(9), .selected-table td:nth-child(9) { width: 12.5%; }

        .registered-results-table th:nth-child(1), .registered-results-table td:nth-child(1) { width: 5.5%; }
        .registered-results-table th:nth-child(2), .registered-results-table td:nth-child(2) { width: 4.5%; }
        .registered-results-table th:nth-child(3), .registered-results-table td:nth-child(3) { width: 8%; }
        .registered-results-table th:nth-child(4), .registered-results-table td:nth-child(4) { width: 18%; }
        .registered-results-table th:nth-child(5), .registered-results-table td:nth-child(5) { width: 5%; }
        .registered-results-table th:nth-child(6), .registered-results-table td:nth-child(6) { width: 4.5%; }
        .registered-results-table th:nth-child(7), .registered-results-table td:nth-child(7) { width: 5%; }
        .registered-results-table th:nth-child(8), .registered-results-table td:nth-child(8) { width: 8%; }
        .registered-results-table th:nth-child(9), .registered-results-table td:nth-child(9) { width: 29%; }
        .registered-results-table th:nth-child(10), .registered-results-table td:nth-child(10) { width: 12.5%; }

        .log-entry,
        .history-entry,
        .history-entry-head,
        .history-time-row,
        .history-result-row {
            min-width: 0;
            max-width: 100%;
        }

        .log-course,
        .log-message,
        .history-entry,
        .history-entry * {
            overflow-wrap: anywhere;
            word-break: normal;
        }

        @media (max-width: 1100px) {
            .course-table-shell .course-table { min-width: 820px !important; font-size: 11px; }
            .selected-table { min-width: 720px; font-size: 11px; }
            .registered-results-table { min-width: 820px; font-size: 11px; }
            .course-table th, .course-table td,
            .selected-table th, .selected-table td,
            .registered-results-table th, .registered-results-table td {
                padding: 6px 5px;
            }
        }

        /* Điện thoại vẫn là bảng như V30, không chuyển thành thẻ. */
        @media (max-width: 760px) {
            .course-table-shell,
            #selected-table-area .table-shell,
            .registered-results-shell {
                overflow-x: auto !important;
                overflow-y: auto;
            }

            .course-table-shell .course-table,
            #selected-table-area .selected-table,
            .registered-results-shell .registered-results-table {
                display: table;
                width: 100%;
                min-width: 300px !important;
                table-layout: fixed;
                font-size: clamp(6.8px, 2vw, 8.8px);
            }

            .course-table thead,
            .selected-table thead,
            .registered-results-table thead {
                display: table-header-group;
            }

            .course-table tbody,
            .selected-table tbody,
            .registered-results-table tbody {
                display: table-row-group;
                min-width: 0;
                padding: 0;
            }

            .course-table tbody tr,
            .selected-table tbody tr,
            .registered-results-table tbody tr {
                display: table-row;
                min-width: 0;
                border-radius: 0;
                box-shadow: none;
            }

            .course-table th,
            .course-table td,
            .selected-table th,
            .selected-table td,
            .registered-results-table th,
            .registered-results-table td {
                display: table-cell;
                width: auto;
                min-width: 0 !important;
                padding: 3px 1px;
                line-height: 1.15;
                text-align: left;
                white-space: normal !important;
                overflow-wrap: anywhere;
                word-break: break-word;
                border-right: 1px solid #e1e5e8;
                border-bottom: 1px solid #e1e5e8;
            }

            .course-table th.center,
            .course-table td.center,
            .selected-table th.center,
            .selected-table td.center,
            .registered-results-table th.center,
            .registered-results-table td.center {
                text-align: center;
            }

            .course-table td::before,
            .selected-table td::before,
            .registered-results-table td::before {
                content: none !important;
                display: none !important;
            }

            .course-table .column-filter-row { display: none; }
            .course-table thead tr:first-child th { top: 0; }

            .course-table .add-button,
            .course-table .course-status,
            .selected-table .remove-course-button,
            .registered-results-table .registered-delete-button,
            .registered-results-table .registered-delete-unavailable {
                width: 100%;
                min-width: 0;
                max-width: 100%;
                min-height: 23px;
                padding: 2px 1px;
                font-size: inherit;
                line-height: 1.05;
                border-radius: 2px;
                white-space: normal;
            }

            .selected-table .priority-input {
                width: 100%;
                min-width: 0;
                height: 26px;
                padding: 2px 1px;
                font-size: inherit;
            }

            .selected-table .priority-buttons {
                gap: 1px;
                white-space: normal;
            }

            .selected-table .mini-button {
                min-width: 0;
                min-height: 23px;
                padding: 1px 2px;
                font-size: inherit;
            }

            /* Tỷ lệ cột riêng cho mobile để cả bảng lọt trong màn hình thường. */
            .course-table th:nth-child(1), .course-table td:nth-child(1) { width: 8%; }
            .course-table th:nth-child(2), .course-table td:nth-child(2) { width: 9%; }
            .course-table th:nth-child(3), .course-table td:nth-child(3) { width: 17%; }
            .course-table th:nth-child(4), .course-table td:nth-child(4) { width: 5%; }
            .course-table th:nth-child(5), .course-table td:nth-child(5) { width: 5%; }
            .course-table th:nth-child(6), .course-table td:nth-child(6) { width: 8%; }
            .course-table th:nth-child(7), .course-table td:nth-child(7) { width: 6%; }
            .course-table th:nth-child(8), .course-table td:nth-child(8) { width: 6%; }
            .course-table th:nth-child(9), .course-table td:nth-child(9) { width: 21%; }
            .course-table th:nth-child(10), .course-table td:nth-child(10) { width: 15%; }

            .selected-table th:nth-child(1), .selected-table td:nth-child(1) { width: 8%; }
            .selected-table th:nth-child(2), .selected-table td:nth-child(2) { width: 10%; }
            .selected-table th:nth-child(3), .selected-table td:nth-child(3) { width: 20%; }
            .selected-table th:nth-child(4), .selected-table td:nth-child(4) { width: 7%; }
            .selected-table th:nth-child(5), .selected-table td:nth-child(5) { width: 10%; }
            .selected-table th:nth-child(6), .selected-table td:nth-child(6) { width: 8%; }
            .selected-table th:nth-child(7), .selected-table td:nth-child(7) { width: 17%; }
            .selected-table th:nth-child(8), .selected-table td:nth-child(8) { width: 9%; }
            .selected-table th:nth-child(9), .selected-table td:nth-child(9) { width: 11%; }

            .registered-results-table th:nth-child(1), .registered-results-table td:nth-child(1) { width: 7%; }
            .registered-results-table th:nth-child(2), .registered-results-table td:nth-child(2) { width: 5%; }
            .registered-results-table th:nth-child(3), .registered-results-table td:nth-child(3) { width: 9%; }
            .registered-results-table th:nth-child(4), .registered-results-table td:nth-child(4) { width: 18%; }
            .registered-results-table th:nth-child(5), .registered-results-table td:nth-child(5) { width: 6%; }
            .registered-results-table th:nth-child(6), .registered-results-table td:nth-child(6) { width: 5%; }
            .registered-results-table th:nth-child(7), .registered-results-table td:nth-child(7) { width: 6%; }
            .registered-results-table th:nth-child(8), .registered-results-table td:nth-child(8) { width: 8%; }
            .registered-results-table th:nth-child(9), .registered-results-table td:nth-child(9) { width: 24%; }
            .registered-results-table th:nth-child(10), .registered-results-table td:nth-child(10) { width: 12%; }

            .activity-history-grid {
                grid-template-columns: minmax(0, 1fr);
            }

            .activity-card,
            .log-shell,
            .history-shell {
                min-width: 0;
                max-width: 100%;
            }

            .log-shell,
            .history-shell {
                overflow-x: auto;
            }

            .log-entry,
            .history-entry {
                min-width: 280px;
            }

            .log-entry {
                grid-template-columns: 46px 58px minmax(0, 1fr);
                gap: 4px;
                padding: 6px 5px;
                font-size: 10px;
            }

            .log-message { grid-column: 1 / -1; }
            .history-entry-head,
            .history-result-row {
                align-items: flex-start;
                gap: 5px;
            }
        }

        @media (max-width: 430px) {
            .course-table-shell .course-table,
            #selected-table-area .selected-table,
            .registered-results-shell .registered-results-table {
                min-width: 292px !important;
                font-size: clamp(6.4px, 1.95vw, 8px);
            }
        }


        /* V33: chuẩn hóa popup, badge và kích thước điều khiển trên mobile */
        :root {
            --ui-radius-panel: 10px;
            --ui-radius-control: 6px;
            --ui-radius-pill: 999px;
            --ui-focus-ring: 0 0 0 3px rgba(23, 159, 192, .24);
            --ui-modal-gutter: 14px;
        }

        button {
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }

        button:focus-visible,
        input:focus-visible,
        select:focus-visible,
        textarea:focus-visible {
            outline: 2px solid var(--blue-dark);
            outline-offset: 2px;
        }

        button:active:not(:disabled) {
            transform: translateY(1px);
        }

        /* Popup luôn nằm giữa visual viewport, kể cả Safari mobile có thanh địa chỉ động. */
        .modal-overlay {
            width: 100vw;
            height: 100dvh;
            min-height: 100dvh;
            padding: max(var(--ui-modal-gutter), env(safe-area-inset-top))
                     max(var(--ui-modal-gutter), env(safe-area-inset-right))
                     max(var(--ui-modal-gutter), env(safe-area-inset-bottom))
                     max(var(--ui-modal-gutter), env(safe-area-inset-left));
            align-items: center !important;
            justify-content: center !important;
            overflow-y: auto;
            overscroll-behavior: contain;
        }

        .modal-box {
            width: min(1100px, calc(100vw - (var(--ui-modal-gutter) * 2)));
            max-height: calc(100dvh - (var(--ui-modal-gutter) * 2));
            margin: auto;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            border-radius: var(--ui-radius-panel) !important;
            box-shadow: 0 18px 52px rgba(0, 0, 0, .28);
        }

        .modal-header {
            flex: 0 0 auto;
            min-width: 0;
        }

        .modal-title {
            min-width: 0;
            line-height: 1.3;
            overflow-wrap: anywhere;
        }

        .modal-content {
            min-height: 0;
            overflow-y: auto;
            overscroll-behavior: contain;
        }

        .close-modal,
        .info-circle-button,
        .failure-info-button,
        .result-modal-icon {
            box-sizing: border-box;
            aspect-ratio: 1 / 1;
            flex-shrink: 0;
            border-radius: 50% !important;
        }

        .close-modal {
            width: 36px !important;
            min-width: 36px !important;
            height: 36px !important;
            min-height: 36px !important;
            flex: 0 0 36px !important;
            display: inline-grid !important;
            place-items: center;
            margin: 0;
            padding: 0 !important;
            color: #167ba2;
            background: #f1f4f6;
            border: 1px solid #d8dfe3 !important;
            font-family: Arial, sans-serif;
            font-size: 25px !important;
            font-weight: 500;
            line-height: 1 !important;
            appearance: none;
            -webkit-appearance: none;
        }

        .close-modal:hover {
            color: #0d6589;
            background: #e8f4f8;
            border-color: #9bcbd6 !important;
        }

        .close-modal:focus-visible,
        .info-circle-button:focus-visible,
        .failure-info-button:focus-visible {
            outline: 0;
            box-shadow: var(--ui-focus-ring);
        }

        .result-modal-icon {
            width: 68px;
            height: 68px;
            flex: 0 0 68px;
            line-height: 1;
        }

        .info-circle-button,
        .failure-info-button {
            width: 22px !important;
            min-width: 22px !important;
            height: 22px !important;
            min-height: 22px !important;
            flex: 0 0 22px !important;
            display: inline-grid !important;
            place-items: center;
            margin: 0;
            padding: 0 !important;
            font-size: 13px !important;
            line-height: 1 !important;
            appearance: none;
            -webkit-appearance: none;
        }

        /* Desktop: cột trạng thái chỉ rộng vừa đủ và luôn nằm trên một dòng. */
        @media (min-width: 761px) {
            .course-table th:nth-child(9),
            .course-table td:nth-child(9) { width: 32%; }

            .course-table th:nth-child(10),
            .course-table td:nth-child(10) { width: 12.5%; }

            .course-table th:nth-child(10),
            .course-table td:nth-child(10) {
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .course-table td:nth-child(10) .course-status {
                max-width: 100%;
                padding: 2px 4px;
                font-size: 10px;
                line-height: 1.25;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                vertical-align: middle;
            }
        }

        @media (max-width: 760px) {
            :root {
                --ui-modal-gutter: 10px;
            }

            .modal-overlay {
                padding: max(var(--ui-modal-gutter), env(safe-area-inset-top))
                         max(var(--ui-modal-gutter), env(safe-area-inset-right))
                         max(var(--ui-modal-gutter), env(safe-area-inset-bottom))
                         max(var(--ui-modal-gutter), env(safe-area-inset-left));
            }

            .modal-box,
            #result-modal .modal-box,
            #history-detail-modal .modal-box,
            #context-help-modal .modal-box {
                width: min(620px, calc(100vw - (var(--ui-modal-gutter) * 2))) !important;
                max-height: calc(100dvh - (var(--ui-modal-gutter) * 2));
                border-radius: 12px !important;
            }

            #result-modal .modal-box {
                width: min(520px, calc(100vw - (var(--ui-modal-gutter) * 2))) !important;
            }

            .modal-header {
                padding: 10px 12px;
                gap: 10px;
            }

            .modal-content {
                padding: 13px 12px 15px;
            }

            .modal-title {
                font-size: 16px;
            }

            .close-modal {
                width: 32px !important;
                min-width: 32px !important;
                height: 32px !important;
                min-height: 32px !important;
                flex-basis: 32px !important;
                font-size: 22px !important;
            }

            .result-modal-icon {
                width: 56px;
                height: 56px;
                flex-basis: 56px;
                margin: 2px auto 11px;
                font-size: 32px;
            }

            .result-modal-heading {
                padding: 0 3px;
                font-size: 20px;
                line-height: 1.3;
            }

            .result-modal-subtitle {
                margin: 7px auto 10px;
                font-size: 13px;
                line-height: 1.45;
            }

            /* Nhật ký: badge giữ đúng tỉ lệ, không ép chữ thành nhiều dòng. */
            .log-entry {
                grid-template-columns: 43px max-content minmax(0, 1fr);
                gap: 4px 5px;
                min-width: 292px;
                padding: 6px 6px;
                font-size: 10px;
                line-height: 1.35;
            }

            .log-time {
                padding-top: 2px;
                font-size: 9.5px;
                white-space: nowrap;
            }

            .log-level {
                width: auto;
                min-width: 0;
                max-width: none;
                padding: 2px 5px;
                border-radius: 4px;
                font-size: 9px;
                line-height: 1.25;
                white-space: nowrap;
            }

            .log-course {
                padding-top: 1px;
                font-size: 10px;
                line-height: 1.35;
            }

            .log-message {
                grid-column: 1 / -1;
                font-size: 10.5px;
                line-height: 1.45;
            }

            .attempt-badge {
                margin-right: 5px;
                padding: 2px 6px;
                border-radius: var(--ui-radius-pill);
                font-size: 9px;
                line-height: 1.25;
                white-space: nowrap;
                vertical-align: 1px;
            }

            .log-ltc {
                margin-left: 4px;
                padding: 1px 5px;
                font-size: 9px;
                line-height: 1.25;
            }

            .log-stop-note {
                margin-top: 5px;
                padding-top: 5px;
                font-size: 10px;
            }

            .run-stat-base,
            .run-stat-success,
            .run-stat-failure,
            .run-stat-active,
            .run-stat-time,
            .history-success-count,
            .history-failure-count {
                border-radius: var(--ui-radius-pill);
                white-space: nowrap;
            }
        }

        @media (max-width: 430px) {
            .modal-title { font-size: 15px; }
            .modal-content { padding: 11px 10px 13px; }
            .result-modal-heading { font-size: 18px; }
            .result-modal-subtitle { font-size: 12px; }
            .log-entry { font-size: 9.5px; }
        }



        /* V34: bảng dữ liệu một dòng như V28; thiếu chỗ thì cuộn ngang, không ép chữ */
        .course-table-shell,
        #selected-table-area .table-shell,
        .registered-results-shell {
            width: 100%;
            max-width: 100%;
            overflow-x: auto !important;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            scrollbar-gutter: auto;
        }

        .course-table,
        .selected-table,
        .registered-results-table {
            width: 100%;
            table-layout: auto !important;
            border-collapse: collapse;
        }

        .course-table {
            width: 100% !important;
            min-width: 1310px !important;
        }
        .selected-table {
            width: 100% !important;
            min-width: 950px !important;
        }
        .registered-results-table {
            width: 100% !important;
            min-width: 1270px !important;
        }

        .course-table th,
        .course-table td,
        .selected-table th,
        .selected-table td,
        .registered-results-table th,
        .registered-results-table td {
            width: auto !important;
            min-width: 0;
            white-space: nowrap !important;
            overflow-wrap: normal !important;
            word-break: normal !important;
            hyphens: none;
            vertical-align: middle;
        }

        /* Cột bảng chọn môn: các cột số ngắn, lịch học và trạng thái đủ đọc trên một dòng. */
        .course-table th:nth-child(1), .course-table td:nth-child(1) { width: auto !important; min-width: 68px !important; }
        .course-table th:nth-child(2), .course-table td:nth-child(2) { width: auto !important; min-width: 88px !important; }
        .course-table th:nth-child(3), .course-table td:nth-child(3) { width: auto !important; min-width: 200px !important; }
        .course-table th:nth-child(4), .course-table td:nth-child(4) { width: auto !important; min-width: 54px !important; }
        .course-table th:nth-child(5), .course-table td:nth-child(5) { width: auto !important; min-width: 58px !important; }
        .course-table th:nth-child(6), .course-table td:nth-child(6) { width: auto !important; min-width: 90px !important; }
        .course-table th:nth-child(7), .course-table td:nth-child(7) { width: auto !important; min-width: 72px !important; }
        .course-table th:nth-child(8), .course-table td:nth-child(8) { width: auto !important; min-width: 68px !important; }
        .course-table th:nth-child(9), .course-table td:nth-child(9) { width: auto !important; min-width: 430px !important; }
        .course-table th:nth-child(10), .course-table td:nth-child(10) { width: auto !important; min-width: 145px !important; }

        .course-table .course-name,
        .course-table .schedule-cell,
        .registered-results-table .schedule-cell {
            white-space: nowrap !important;
            overflow-wrap: normal !important;
            word-break: normal !important;
        }

        /* Thời khóa biểu chỉ xuống dòng tại separator do DAV cung cấp (<hr>, <br>, newline). */
        .course-table .schedule-cell,
        .registered-results-table .schedule-cell {
            line-height: 1.45;
        }

        .course-table td:nth-child(10),
        .course-table td:nth-child(10) .course-status {
            overflow: visible !important;
            text-overflow: clip !important;
            max-width: none !important;
            white-space: nowrap !important;
        }

        /* Hàng lọc luôn nằm gọn trong chính cột của nó. */
        .course-table thead .column-filter-row th {
            overflow: hidden;
            padding: 5px !important;
        }

        .course-table .column-filter {
            display: block;
            width: 100% !important;
            max-width: 100% !important;
            min-width: 0 !important;
            height: 30px;
            margin: 0;
            padding: 4px 6px;
            box-sizing: border-box;
        }

        /* Cột bảng chuẩn bị. */
        .selected-table th:nth-child(1), .selected-table td:nth-child(1) { width: auto !important; min-width: 68px !important; }
        .selected-table th:nth-child(2), .selected-table td:nth-child(2) { width: auto !important; min-width: 90px !important; }
        .selected-table th:nth-child(3), .selected-table td:nth-child(3) { width: auto !important; min-width: 220px !important; }
        .selected-table th:nth-child(4), .selected-table td:nth-child(4) { width: auto !important; min-width: 56px !important; }
        .selected-table th:nth-child(5), .selected-table td:nth-child(5) { width: auto !important; min-width: 100px !important; }
        .selected-table th:nth-child(6), .selected-table td:nth-child(6) { width: auto !important; min-width: 72px !important; }
        .selected-table th:nth-child(7), .selected-table td:nth-child(7) { width: auto !important; min-width: 170px !important; }
        .selected-table th:nth-child(8), .selected-table td:nth-child(8) { width: auto !important; min-width: 72px !important; }
        .selected-table th:nth-child(9), .selected-table td:nth-child(9) { width: auto !important; min-width: 100px !important; }

        .selected-table .priority-input {
            display: block;
            width: 40px !important;
            min-width: 40px !important;
            max-width: 40px !important;
            height: 28px !important;
            min-height: 28px !important;
            margin: 0 auto;
            padding: 0 4px !important;
            text-align: center !important;
            line-height: 26px;
            font-size: 12px;
            font-weight: 800;
            font-variant-numeric: tabular-nums;
            appearance: textfield;
            -moz-appearance: textfield;
        }

        .selected-table .priority-input::-webkit-outer-spin-button,
        .selected-table .priority-input::-webkit-inner-spin-button {
            margin: 0;
            -webkit-appearance: none;
        }

        .selected-table .priority-buttons {
            flex-wrap: nowrap;
            white-space: nowrap !important;
        }

        /* Cột bảng môn đã đăng ký. */
        .registered-results-table th:nth-child(1), .registered-results-table td:nth-child(1) { width: auto !important; min-width: 66px !important; }
        .registered-results-table th:nth-child(2), .registered-results-table td:nth-child(2) { width: auto !important; min-width: 50px !important; }
        .registered-results-table th:nth-child(3), .registered-results-table td:nth-child(3) { width: auto !important; min-width: 90px !important; }
        .registered-results-table th:nth-child(4), .registered-results-table td:nth-child(4) { width: auto !important; min-width: 220px !important; }
        .registered-results-table th:nth-child(5), .registered-results-table td:nth-child(5) { width: auto !important; min-width: 58px !important; }
        .registered-results-table th:nth-child(6), .registered-results-table td:nth-child(6) { width: auto !important; min-width: 52px !important; }
        .registered-results-table th:nth-child(7), .registered-results-table td:nth-child(7) { width: auto !important; min-width: 58px !important; }
        .registered-results-table th:nth-child(8), .registered-results-table td:nth-child(8) { width: auto !important; min-width: 100px !important; }
        .registered-results-table th:nth-child(9), .registered-results-table td:nth-child(9) { width: auto !important; min-width: 430px !important; }
        .registered-results-table th:nth-child(10), .registered-results-table td:nth-child(10) { width: auto !important; min-width: 145px !important; }

        /* Mobile giữ nguyên mật độ hiện tại; chỉ tăng chiều rộng bảng và cho vuốt ngang. */
        @media (max-width: 760px) {
            .course-table-shell,
            #selected-table-area .table-shell,
            .registered-results-shell {
                overflow-x: auto !important;
                overscroll-behavior-x: contain;
            }

            .course-table-shell .course-table {
                display: table;
                min-width: 1310px !important;
                table-layout: auto !important;
                font-size: clamp(6.8px, 2vw, 8.8px);
            }

            #selected-table-area .selected-table {
                display: table;
                min-width: 950px !important;
                table-layout: auto !important;
                font-size: 11px;
            }

            .registered-results-shell .registered-results-table {
                display: table;
                min-width: 1270px !important;
                table-layout: auto !important;
                font-size: 11px;
            }

            .course-table th,
            .course-table td,
            .selected-table th,
            .selected-table td,
            .registered-results-table th,
            .registered-results-table td {
                display: table-cell;
                padding: 5px 6px;
                line-height: 1.2;
                white-space: nowrap !important;
                overflow-wrap: normal !important;
                word-break: normal !important;
            }

            .course-table .column-filter-row { display: none; }

            .course-table .add-button,
            .course-table .course-status,
            .selected-table .remove-course-button,
            .registered-results-table .registered-delete-button,
            .registered-results-table .registered-delete-unavailable {
                width: auto;
                min-width: max-content;
                max-width: none;
                white-space: nowrap !important;
            }

            .selected-table .priority-input {
                width: 40px !important;
            min-width: 40px !important;
                max-width: 40px !important;
                height: 28px !important;
                font-size: 11px;
            }
        }



        /* V36: bảng co theo nội dung thực tế, không dành khoảng trắng cố định quá lớn. */
        .course-table-shell,
        #selected-table-area .table-shell,
        .registered-results-shell {
            width: 100%;
            max-width: 100%;
            overflow-x: auto !important;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
            overscroll-behavior-x: contain;
        }

        .course-table,
        .selected-table,
        .registered-results-table {
            width: max-content !important;
            min-width: 100% !important;
            max-width: none !important;
            table-layout: auto !important;
            border-collapse: collapse;
        }

        .course-table th,
        .course-table td,
        .selected-table th,
        .selected-table td,
        .registered-results-table th,
        .registered-results-table td {
            width: 1% !important;
            min-width: max-content !important;
            max-width: none !important;
            padding: 10px 16px !important;
            white-space: nowrap !important;
            overflow-wrap: normal !important;
            word-break: normal !important;
            hyphens: none !important;
            vertical-align: middle;
        }

        /* Cột thao tác và các cột số chỉ rộng vừa nhãn/dữ liệu. */
        .course-table th:nth-child(1), .course-table td:nth-child(1) { min-width: 72px !important; }
        .course-table th:nth-child(2), .course-table td:nth-child(2) { min-width: 84px !important; }
        .course-table th:nth-child(3), .course-table td:nth-child(3) { min-width: 150px !important; }
        .course-table th:nth-child(4), .course-table td:nth-child(4),
        .course-table th:nth-child(5), .course-table td:nth-child(5) { min-width: 62px !important; }
        .course-table th:nth-child(6), .course-table td:nth-child(6) { min-width: 80px !important; }
        .course-table th:nth-child(7), .course-table td:nth-child(7),
        .course-table th:nth-child(8), .course-table td:nth-child(8) { min-width: 76px !important; }
        .course-table th:nth-child(9), .course-table td:nth-child(9) {
            width: 1% !important;
            min-width: 180px !important;
        }
        .course-table th:nth-child(10), .course-table td:nth-child(10) { min-width: 108px !important; }

        .course-table .course-name,
        .course-table .schedule-cell,
        .registered-results-table .schedule-cell {
            width: 1% !important;
            min-width: max-content !important;
            max-width: none !important;
        }

        /* Giữ đúng line-break DAV; CSS không tự bẻ thêm trong từng dòng lịch. */
        .course-table .schedule-cell,
        .registered-results-table .schedule-cell {
            white-space: nowrap !important;
            overflow-wrap: normal !important;
            word-break: normal !important;
            line-height: 1.45;
        }

        .course-table th:nth-child(10),
        .course-table td:nth-child(10),
        .course-table td:nth-child(10) .course-status {
            white-space: nowrap !important;
            max-width: none !important;
            overflow: visible !important;
            text-overflow: clip !important;
        }

        /* Hàng lọc bám đúng độ rộng cột, không tràn sang ô kế bên. */
        .course-table thead .column-filter-row th {
            overflow: hidden !important;
            padding: 6px 8px !important;
        }

        .course-table .column-filter {
            display: block;
            width: 100% !important;
            max-width: 100% !important;
            min-width: 0 !important;
            box-sizing: border-box;
            margin: 0;
        }

        /* Bảng chuẩn bị: vừa nội dung, không giữ các khoảng trắng cột cũ. */
        .selected-table th:nth-child(1), .selected-table td:nth-child(1) { min-width: 68px !important; }
        .selected-table th:nth-child(2), .selected-table td:nth-child(2) { min-width: 84px !important; }
        .selected-table th:nth-child(3), .selected-table td:nth-child(3) { min-width: 150px !important; }
        .selected-table th:nth-child(4), .selected-table td:nth-child(4) { min-width: 62px !important; }
        .selected-table th:nth-child(5), .selected-table td:nth-child(5) { min-width: 80px !important; }
        .selected-table th:nth-child(6), .selected-table td:nth-child(6) { min-width: 76px !important; }
        .selected-table th:nth-child(7), .selected-table td:nth-child(7) { min-width: 110px !important; }
        .selected-table th:nth-child(8), .selected-table td:nth-child(8) { min-width: 78px !important; }
        .selected-table th:nth-child(9), .selected-table td:nth-child(9) { min-width: 96px !important; }

        /* Bảng kết quả đăng ký: chiều rộng theo dữ liệu, lịch không còn cột 430px cố định. */
        .registered-results-table th:nth-child(1), .registered-results-table td:nth-child(1) { min-width: 62px !important; }
        .registered-results-table th:nth-child(2), .registered-results-table td:nth-child(2) { min-width: 54px !important; }
        .registered-results-table th:nth-child(3), .registered-results-table td:nth-child(3) { min-width: 84px !important; }
        .registered-results-table th:nth-child(4), .registered-results-table td:nth-child(4) { min-width: 150px !important; }
        .registered-results-table th:nth-child(5), .registered-results-table td:nth-child(5),
        .registered-results-table th:nth-child(6), .registered-results-table td:nth-child(6),
        .registered-results-table th:nth-child(7), .registered-results-table td:nth-child(7) { min-width: 62px !important; }
        .registered-results-table th:nth-child(8), .registered-results-table td:nth-child(8) { min-width: 80px !important; }
        .registered-results-table th:nth-child(9), .registered-results-table td:nth-child(9) { min-width: 180px !important; }
        .registered-results-table th:nth-child(10), .registered-results-table td:nth-child(10) { min-width: 118px !important; }

        @media (max-width: 760px) {
            .course-table,
            .selected-table,
            .registered-results-table,
            .course-table-shell .course-table,
            #selected-table-area .selected-table,
            .registered-results-shell .registered-results-table {
                display: table !important;
                width: max-content !important;
                min-width: 100% !important;
                max-width: none !important;
                table-layout: auto !important;
            }

            .course-table th,
            .course-table td,
            .selected-table th,
            .selected-table td,
            .registered-results-table th,
            .registered-results-table td {
                display: table-cell !important;
                padding: 10px 20px !important;
                white-space: nowrap !important;
                min-width: max-content !important;
                font-size: 11px;
                line-height: 1.25;
            }

            .course-table th:nth-child(1), .course-table td:nth-child(1) { min-width: 76px !important; }
            .course-table th:nth-child(2), .course-table td:nth-child(2) { min-width: 88px !important; }
            .course-table th:nth-child(3), .course-table td:nth-child(3) { min-width: 150px !important; }
            .course-table th:nth-child(4), .course-table td:nth-child(4),
            .course-table th:nth-child(5), .course-table td:nth-child(5) { min-width: 70px !important; }
            .course-table th:nth-child(6), .course-table td:nth-child(6) { min-width: 84px !important; }
            .course-table th:nth-child(7), .course-table td:nth-child(7),
            .course-table th:nth-child(8), .course-table td:nth-child(8) { min-width: 82px !important; }
            .course-table th:nth-child(9), .course-table td:nth-child(9) { min-width: 180px !important; }
            .course-table th:nth-child(10), .course-table td:nth-child(10) { min-width: 112px !important; }

            .selected-table th:nth-child(3), .selected-table td:nth-child(3),
            .registered-results-table th:nth-child(4), .registered-results-table td:nth-child(4) {
                min-width: 150px !important;
            }

            .course-table .column-filter-row { display: none !important; }
        }



        /* V37: giảm mật độ cell trên mobile và đồng nhất typography bảng môn đã đăng ký. */
        html {
            -webkit-text-size-adjust: 100%;
            text-size-adjust: 100%;
        }

        @media (max-width: 760px) {
            .course-table th,
            .course-table td,
            .selected-table th,
            .selected-table td,
            .registered-results-table th,
            .registered-results-table td {
                padding: 5px 10px !important;
            }

            /* Safari có thể tự phóng chữ không đồng đều trong bảng rộng; khóa về một cỡ thống nhất. */
            .registered-results-shell,
            .registered-results-table {
                -webkit-text-size-adjust: 100% !important;
                text-size-adjust: 100% !important;
            }

            .registered-results-table {
                font-size: 11px !important;
                line-height: 1.25 !important;
            }

            .registered-results-table thead,
            .registered-results-table tbody,
            .registered-results-table tr,
            .registered-results-table th,
            .registered-results-table td,
            .registered-results-table td > strong,
            .registered-results-table td > span:not(.registered-delete-unavailable) {
                font-size: inherit !important;
                line-height: inherit !important;
            }

            .registered-results-table th,
            .registered-results-table td {
                font-weight: 400;
            }

            .registered-results-table th,
            .registered-results-table td > strong {
                font-weight: 700;
            }

            .registered-results-table .registered-delete-button {
                width: 26px !important;
                min-width: 26px !important;
                max-width: 26px !important;
                height: 26px !important;
                min-height: 26px !important;
                max-height: 26px !important;
                padding: 0 !important;
                display: inline-grid !important;
                place-items: center;
                font-size: 17px !important;
                line-height: 1 !important;
                border-radius: 4px !important;
                vertical-align: middle;
            }

            .registered-results-table .registered-delete-button.is-loading {
                font-size: 13px !important;
            }

            .registered-results-table .registered-delete-unavailable {
                display: inline-block;
                width: 26px;
                min-width: 26px;
                font-size: 11px !important;
                line-height: 26px !important;
                text-align: center;
                vertical-align: middle;
            }
        }


        /* V49: min-width chỉ là ngưỡng cuộn ngang; màn hình rộng phải lấp đầy viền. */
        .course-table-shell > .course-table,
        #selected-table-area .table-shell > .selected-table,
        .registered-results-shell > .registered-results-table {
            width: 100% !important;
            max-width: none !important;
        }

/* Contextual help buttons: move static notes off the main layout. */
.field-label-with-help,
.section-title-with-help,
.activity-title-with-help {
    display: inline-flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start;
    width: fit-content;
    max-width: 100%;
    gap: 7px;
}

.setting-check-with-help {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    width: 100%;
    gap: 7px;
}

.field-label-with-help {
    margin-bottom: 6px;
}

.field-label-with-help .form-label,
.section-title-with-help h3,
.activity-title-with-help .activity-card-title {
    margin: 0;
    min-width: 0;
}

.section-title-with-help,
.activity-title-with-help {
    margin-bottom: 2px;
}

.setting-check-with-help .setting-check-row {
    flex: 1 1 auto;
    min-width: 0;
}

/* Dùng button.help-circle-button để thắng các rule desktop dành cho button chung. */
button.help-circle-button {
    width: 24px !important;
    min-width: 24px !important;
    max-width: 24px !important;
    height: 24px !important;
    min-height: 24px !important;
    max-height: 24px !important;
    flex: 0 0 24px !important;
    display: inline-grid !important;
    place-items: center !important;
    align-self: center;
    margin: 0 !important;
    padding: 0 !important;
    color: #5f4700 !important;
    background-color: #ffd85a !important;
    background-image: none !important;
    border: 1px solid #c99d00 !important;
    border-radius: 999px !important;
    box-shadow: 0 1px 2px rgba(73, 54, 0, .18) !important;
    font-family: Arial, sans-serif !important;
    font-size: 14px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

button.help-circle-button.help-circle-button-small {
    width: 21px !important;
    min-width: 21px !important;
    max-width: 21px !important;
    height: 21px !important;
    min-height: 21px !important;
    max-height: 21px !important;
    flex-basis: 21px !important;
    font-size: 12px !important;
}

button.help-circle-button:hover {
    color: #4b3800 !important;
    background-color: #ffcf2f !important;
    background-image: none !important;
    border-color: #a98100 !important;
    transform: translateY(-1px);
}

button.help-circle-button:active {
    transform: translateY(0) !important;
}

button.help-circle-button:focus-visible {
    outline: 3px solid rgba(255, 193, 7, .34) !important;
    outline-offset: 2px;
}

#context-help-modal {
    z-index: 24600;
}

.context-help-box {
    width: min(720px, 100%);
}

.context-help-content {
    color: var(--text);
}

.context-help-content > :first-child {
    margin-top: 0;
}

.context-help-content > :last-child {
    margin-bottom: 0;
}

.context-help-content p {
    margin: 0 0 12px;
}

.context-help-content ul {
    margin: 10px 0 0;
    padding-left: 21px;
}

.context-help-content li + li {
    margin-top: 6px;
}

@media (max-width: 760px) {
    button.help-circle-button {
        width: 23px !important;
        min-width: 23px !important;
        max-width: 23px !important;
        height: 23px !important;
        min-height: 23px !important;
        max-height: 23px !important;
        flex-basis: 23px !important;
    }

    button.help-circle-button.help-circle-button-small {
        width: 21px !important;
        min-width: 21px !important;
        max-width: 21px !important;
        height: 21px !important;
        min-height: 21px !important;
        max-height: 21px !important;
        flex-basis: 21px !important;
    }

    #context-help-modal .modal-box {
        width: min(620px, calc(100vw - (var(--ui-modal-gutter) * 2))) !important;
    }
}


/* v61: subtle persistent notices for retained/shared data. */
@media (max-width: 720px) {
    .stale-data-note {
        margin-top: 4px;
        font-size: 10.5px;
        line-height: 1.4;
    }
}

/* V67: khung nhật ký/lịch sử co giãn kín chiều cao theo màn hình */
.activity-history-grid {
    align-items: stretch;
}

.activity-history-grid .activity-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#registration-log-area,
#registration-history-area {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

#registration-log-area .log-shell,
#registration-history-area .history-shell {
    width: 100%;
    height: clamp(300px, 42vh, 560px);
    min-height: clamp(300px, 42vh, 560px);
    max-height: none;
    flex: 1 1 auto;
}

.remote-run-note {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: clamp(22px, 5vw, 48px);
    text-align: center;
    color: #52636b;
    background: linear-gradient(180deg, #f5fbfd 0%, #fbfcfd 100%);
}

.remote-run-note strong {
    color: var(--heading);
    font-size: 15px;
}

.remote-run-note span {
    max-width: 560px;
    line-height: 1.55;
}

@media (min-width: 1500px) {
    #registration-log-area .log-shell,
    #registration-history-area .history-shell {
        height: clamp(380px, 48vh, 680px);
        min-height: clamp(380px, 48vh, 680px);
    }
}

@media (max-width: 760px) {
    #registration-log-area .log-shell,
    #registration-history-area .history-shell {
        height: clamp(260px, 46vh, 420px);
        min-height: clamp(260px, 46vh, 420px);
    }

    .remote-run-note {
        padding: 22px 14px;
    }
}

.history-entry.interrupted {
    border-color: #e2bd69;
    background: #fffaf0;
}

.history-head-meta {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.history-state-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
}

.history-state-badge.interrupted {
    color: #7b5612;
    background: #fff0c8;
    border: 1px solid #e2bd69;
}

.history-finish-note {
    margin: 0 0 8px;
    padding: 7px 8px;
    color: #765516;
    background: #fff5d9;
    border: 1px solid #ead095;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.45;
}


/* v70: nhóm thao tác bảng kết quả đăng ký */
.registered-heading-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}
@media (max-width: 720px) {
    .registered-heading-actions { width: 100%; justify-content: stretch; }
    .registered-heading-actions .secondary-button { flex: 1 1 210px; }
}

/* OTP remains usable without Gmail and on narrow screens. */
.otp-gear {font-size:24px;border:1px solid #d1d9e4;border-radius:10px;background:white;color:#174b79;cursor:pointer;padding:5px 11px;}
.otp-notice {background:#eaf3ff;color:#123f72;padding:12px 24px;border-bottom:1px solid #cbdff7;}
.otp-dialog {width:min(540px,calc(100% - 32px));max-height:85vh;overflow:auto;border:0;border-radius:16px;padding:24px;box-shadow:0 20px 70px #1235;color:#22354b;}
.otp-dialog::backdrop {background:rgb(10 26 48 / 55%);}
.otp-dialog-heading {display:flex;justify-content:space-between;align-items:center;gap:12px;}
.otp-dialog-heading h2 {font-size:21px;margin:0;}
.otp-dialog button {cursor:pointer;border:1px solid #c5d4e4;border-radius:8px;background:#edf4fc;color:#164b7e;padding:9px 12px;font:inherit;}
.otp-dialog button:disabled {opacity:.55;cursor:default;}
.otp-dialog input,.otp-dialog select {display:block;width:100%;box-sizing:border-box;padding:10px;margin:8px 0 16px;border:1px solid #bacbdd;border-radius:8px;font:inherit;}
.otp-dialog label {display:block;font-weight:600;}
.otp-dialog p {font-size:14px;line-height:1.6;}
.otp-actions {display:flex;gap:8px;flex-wrap:wrap;}
#otp-submit {background:#175cb4;color:white;}
#otp-code {font-size:24px;letter-spacing:.2em;}
[hidden] {display:none!important;}

/* Account navigation and body-only dialog scrolling. */
.account-settings-anchor{position:relative;flex:0 0 auto}
.account-menu{position:absolute;right:0;top:calc(100% + 10px);z-index:10000;min-width:210px;padding:7px;border:1px solid #d5dfec;border-radius:14px;background:white;box-shadow:0 14px 40px #1233}
.account-menu button{display:flex;align-items:center;gap:12px;width:100%;padding:14px;border:0;border-radius:9px;background:white;color:#174b79;text-align:left;font:600 15px system-ui;cursor:pointer}
.account-menu button:hover,.account-menu button:focus-visible{background:#edf4ff;outline:2px solid #99baf3;outline-offset:-2px}
.account-menu .account-logout{color:#b91c1c;border-top:1px solid #eef1f5}
.account-menu .account-logout:hover{background:#fff1f2}
.otp-resume-button{display:block;width:100%;padding:18px 20px;margin:0 0 20px;border:2px solid #991b1b;border-radius:12px;background:#b91c1c;color:white;font:800 18px system-ui;cursor:pointer;box-shadow:0 5px 15px #b91c1c30;text-align:left}
.otp-resume-button span{display:block;margin-top:5px;font-size:13px;font-weight:400}
.otp-resume-button:hover{background:#991b1b}.otp-resume-button:focus-visible{outline:3px solid #fca5a5;outline-offset:3px}
.otp-dialog{box-sizing:border-box;padding:0;max-height:min(88dvh,760px);overflow:hidden}
.otp-dialog[open]{display:flex;flex-direction:column}
.otp-dialog-heading{flex:0 0 auto;padding:18px 22px;border-bottom:1px solid #dbe5f1;background:#f5f9ff}
.otp-dialog-heading button{flex-shrink:0;width:40px;height:40px;padding:0;font-size:24px;background:white}
.otp-dialog-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:20px 22px;scrollbar-gutter:stable}
.otp-eyebrow{margin:0 0 4px!important;font-size:10px!important;letter-spacing:.12em;font-weight:800;color:#426898}
.otp-setting-section{padding:16px;margin-bottom:16px;border-radius:12px;border:1px solid}
.otp-setting-section h3{font-size:15px;margin:0 0 14px}.otp-setting-section p:last-child{margin-bottom:0}
.otp-section-blue{background:#f0f6ff;border-color:#c8dcff}.otp-section-blue h3{color:#1d4ed8}
.otp-section-green{background:#f0fdf7;border-color:#b7e7cd}.otp-section-green h3{color:#166534}
.otp-section-amber{background:#fffbeb;border-color:#f2dfa9}.otp-section-amber h3{color:#854d0e}
.otp-small-note{font-size:12px!important;color:#536477}.otp-connection-status{font-weight:700}
.otp-optional{font-size:12px;font-weight:400}.otp-feedback{padding:10px;border-radius:8px;background:#edf3fa;min-height:20px}
#otp-save-settings,#otp-gmail-connect{background:#185ab6;color:white;border-color:#185ab6}
@media(max-width:540px){.otp-dialog-heading{padding:15px 16px}.otp-dialog-heading h2{font-size:19px}.otp-dialog-body{padding:16px}.otp-setting-section{padding:13px}.otp-resume-button{font-size:16px}.account-row{grid-template-columns:minmax(0,1fr) auto!important}}
