:root {
    --primary: #087f5b;
    --primary-dark: #056247;
    --primary-soft: #eaf8f2;
    --blue: #2563eb;
    --amber: #d97706;
    --surface: #ffffff;
    --background: #edf2f5;
    --text-main: #172033;
    --text-muted: #667085;
    --danger: #dc2626;
    --success: #15803d;
    --border: #d9e1e8;
    --sidebar: #15383d;
    --sidebar-muted: #a9c7c5;
}

html {
    background: var(--background);
}

body {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-main);
    background: var(--background);
    letter-spacing: 0;
}

button,
input,
select,
textarea {
    letter-spacing: 0;
}

.app-container {
    width: min(1280px, 100%);
    max-width: none;
    height: 100vh;
    height: 100dvh;
    min-height: 680px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 318px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 0 40px rgba(23, 32, 51, 0.12);
}

.registration-sidebar {
    grid-column: 1;
    grid-row: 1 / 3;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 28px 26px 24px;
    color: #fff;
    background: var(--sidebar);
}

.header {
    position: relative;
    z-index: 1;
    padding: 0;
    color: #fff;
    text-align: left;
    background: transparent;
    box-shadow: none;
}

.back-btn {
    position: absolute;
    top: 0;
    right: 0;
    left: auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 7px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.95rem;
}

.back-btn:hover,
.back-btn:focus-visible {
    color: var(--sidebar);
    background: #fff;
    outline: none;
}

.brand-lockup {
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-right: 46px;
}

.brand-lockup img {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #fff;
}

.brand-lockup strong,
.brand-lockup span {
    display: block;
}

.brand-lockup strong {
    color: #fff;
    font-size: 0.82rem;
    line-height: 1.35;
}

.brand-lockup span {
    margin-top: 3px;
    color: var(--sidebar-muted);
    font-size: 0.7rem;
}

.registration-topline {
    margin-top: 34px;
    display: block;
}

.header h1 {
    margin: 0;
    display: flex;
    align-items: center;
    color: #fff;
    font-size: 1rem;
    line-height: 1.2;
    white-space: nowrap;
    text-transform: none;
}

.blinking-text {
    display: none;
}

.registration-support {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 2px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    color: var(--sidebar-muted);
}

.registration-support > i {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #fbbf24;
    background: rgba(255, 255, 255, 0.08);
}

.registration-support span,
.registration-support strong {
    display: block;
}

.registration-support span {
    font-size: 0.66rem;
}

.registration-support strong {
    margin-top: 3px;
    color: #fff;
    font-size: 0.78rem;
}

#main-content {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    padding: 38px 48px 44px;
    background: #fbfcfd;
    scrollbar-gutter: stable;
}

#xetTuyenForm {
    width: min(820px, 100%);
    margin: 0 auto;
}

.step {
    display: none;
    animation: formStepIn 0.22s ease-out;
}

.step.active {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 22px;
}

@keyframes formStepIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-header {
    grid-column: 1 / -1;
    min-height: 54px;
    margin: 0 0 2px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 0 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-size: 1.28rem;
    font-weight: 800;
}

.step-header i {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 1rem;
}

.step > div[style*="display: flex"] {
    display: contents !important;
}

.form-group {
    min-width: 0;
    margin: 0;
    padding: 0 0 18px;
    border: 0;
    border-bottom: 1px solid #e7ecf0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.form-group:has(#full_name),
.form-group:has(#noisinh_tinh),
.form-group:has(#tinh),
.form-group:has(#truong10_tinh),
.form-group:has(#tohop),
.form-group:has(#score_inputs),
#step4-description,
#tai-truong-mode-note,
#step5_xt > .cam-doan-box,
.submission-review {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 8px;
    color: #0d5f50;
    font-size: 0.82rem;
    font-weight: 800;
    line-height: 1.4;
}

.form-group label span {
    color: var(--danger);
}

.form-group label .field-label-text {
    color: inherit;
}

.field-guidance {
    width: 100%;
    margin: 7px 0 0 !important;
    display: block;
    padding: 8px 10px;
    border-left: 3px solid #f59e0b;
    border-radius: 6px;
    color: #9a4f08 !important;
    background: #fff7e6;
    font-size: 0.74rem !important;
    font-weight: 750;
    line-height: 1.45;
}

.field-guidance:empty {
    display: none !important;
}

.residence-title {
    margin-bottom: 10px;
    color: #0d5f50;
    font-size: 0.82rem;
    font-weight: 800;
}

.residence-title span {
    color: var(--danger);
}

.residence-location-row {
    margin-bottom: 12px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.residence-field {
    min-width: 0;
}

.residence-field > label {
    margin-bottom: 6px;
    color: #0d5f50;
    font-size: 0.72rem;
    font-weight: 800;
}

.phuong-fallback {
    margin-top: 7px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 9px;
    border: 1px solid #fed7aa;
    border-radius: 7px;
    color: #9a3412;
    background: #fff7ed;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.4;
}

.phuong-fallback[hidden] {
    display: none;
}

.phuong-fallback button {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid #fdba74;
    border-radius: 6px;
    color: #9a3412;
    background: #fff;
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.school-mode-selector {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(310px, 0.85fr);
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
    border: 1px solid #cfe3dc;
    border-radius: 8px;
    background: #f3faf7;
}

.school-mode-selector strong,
.school-mode-selector span {
    display: block;
}

.school-mode-selector strong {
    color: #173b35;
    font-size: 0.88rem;
}

.school-mode-selector span {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.4;
}

.school-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid #d6e1dd;
    border-radius: 8px;
    background: #fff;
}

.school-mode-button {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 10px;
    border: 0;
    border-radius: 6px;
    color: #53636d;
    background: transparent;
    font-size: 0.76rem;
    font-weight: 750;
    cursor: pointer;
}

.school-mode-button.active {
    color: #fff;
    background: var(--primary);
}

.school-mode-button:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.school-primary-field,
.school-different-fields > .form-group {
    grid-column: 1 / -1;
}

.school-different-fields[hidden] {
    display: none;
}

.school-different-fields:not([hidden]) {
    display: contents;
}

.form-control {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #cfd8e1;
    border-radius: 7px;
    color: var(--text-main);
    background-color: #fff;
    font-size: 0.94rem;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

select.form-control {
    padding-right: 42px;
    background-color: #fff;
}

.form-control:hover:not(:disabled) {
    border-color: #9eabb9;
}

.form-control:focus {
    border-color: var(--blue);
    outline: 0;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-control:disabled {
    border-color: #e2e7ec;
    color: #84909e;
    background: #f1f4f6;
}

.form-control.input-error,
.score-row input.score-invalid {
    border-color: var(--danger);
    background: #fff7f7;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.form-group small {
    color: var(--text-muted) !important;
    font-size: 0.74rem !important;
    line-height: 1.45 !important;
}

#hienthi_noisinh,
#hienthi_diachi,
.school-address-box {
    margin-top: 10px !important;
    padding: 11px 12px !important;
    border: 1px solid #bfdbfe !important;
    border-left: 3px solid var(--blue) !important;
    border-radius: 7px !important;
    color: #1e40af !important;
    background: #eff6ff !important;
    font-size: 0.8rem !important;
}

#text_noisinh,
#text_diachi {
    color: #1e3a8a !important;
}

.school-period-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #cbd5e1;
}

.school-period-summary[hidden] {
    display: none;
}

.school-period-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
    color: #0d5f50;
    font-size: 0.8rem;
}

.school-period-title i {
    color: var(--primary);
}

.school-period-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #e2e8f0;
}

.school-period-row > div {
    min-width: 0;
}

.school-period-row strong,
.school-period-row span,
.school-period-row small {
    display: block;
}

.school-period-row strong {
    color: #173b35;
    font-size: 0.78rem;
}

.school-period-row span {
    margin-top: 2px;
    color: #475569;
    font-size: 0.72rem;
}

.school-period-row small {
    margin-top: 3px;
    color: #64748b !important;
    font-size: 0.68rem !important;
}

.school-period-row b {
    min-width: 52px;
    padding: 5px 8px;
    border-radius: 5px;
    color: #0369a1;
    background: #e0f2fe;
    font-size: 0.72rem;
    text-align: center;
}

.school-period-row.is-unresolved b {
    color: #9a3412;
    background: #ffedd5;
}

.school-period-result {
    margin-top: 10px;
    color: #166534;
    font-size: 0.75rem;
    line-height: 1.45;
}

.school-period-result i {
    margin-right: 4px;
}

.school-period-result.is-warning {
    color: #b45309;
}

.dropdown-list {
    top: calc(100% + 4px);
    max-height: 270px;
    margin: 0;
    overflow-y: auto;
    border: 1px solid #aab6c3;
    border-radius: 7px;
    box-shadow: 0 14px 30px rgba(23, 32, 51, 0.16);
}

.dropdown-list li {
    min-height: 46px;
    padding: 10px 12px;
    font-size: 0.86rem;
}

.dropdown-list li:active,
.dropdown-list li:hover {
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.school-area {
    border-radius: 5px !important;
}

.form-group .btn-outline {
    min-height: 40px;
    border: 1px dashed #9fb0bf !important;
    border-radius: 7px !important;
    color: #354457;
    background: #fff;
}

.form-group .btn-outline:hover {
    border-color: var(--primary) !important;
    color: var(--primary-dark);
    background: var(--primary-soft);
}

.tohop-detail {
    margin-top: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #f8fafc;
}

.tohop-detail-title {
    padding: 10px 12px;
    border-bottom-color: #cbd5e1;
    color: #1e3a8a;
    background: #eef2ff;
    font-size: 0.8rem;
}

.tohop-card {
    padding: 11px 12px;
    border-bottom-color: #e2e8f0;
}

.tohop-card.selected {
    background: #fff;
    box-shadow: inset 3px 0 0 var(--primary);
}

.tohop-card strong {
    font-size: 0.86rem;
}

.tohop-card span {
    font-size: 0.78rem;
}

.score-box {
    padding: 18px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
}

.score-box > label {
    font-size: 0.94rem;
}

.score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
}

.score-row {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 10px;
}

.score-row label {
    font-size: 0.78rem;
}

.score-row input {
    min-height: 42px;
}

.score-live {
    margin-top: 14px;
    padding: 11px 12px;
    border: 1px solid #bbf7d0;
    border-radius: 7px;
    color: #166534;
    background: #f0fdf4;
    font-size: 0.8rem;
}

.submission-review {
    padding: 18px;
    border: 1px solid #cfe3dc;
    border-radius: 8px;
    background: #f8fbfa;
}

.submission-review-heading {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding-bottom: 14px;
    border-bottom: 1px solid #dce8e3;
}

.submission-review-heading > i {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 7px;
    color: #fff;
    background: var(--primary);
}

.submission-review-heading h2,
.submission-review-heading p {
    margin: 0;
}

.submission-review-heading h2 {
    color: #173b35;
    font-size: 1rem;
}

.submission-review-heading p {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.submission-review-grid {
    margin: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 22px;
}

.submission-review-item {
    min-width: 0;
    padding: 12px 0;
    border-bottom: 1px solid #e1e9e5;
}

.submission-review-item-wide {
    grid-column: 1 / -1;
}

.submission-review-item dt {
    margin-bottom: 4px;
    color: #667085;
    font-size: 0.7rem;
    font-weight: 700;
}

.submission-review-item dd {
    margin: 0;
    color: #172033;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.review-monospace {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.02em;
}

.submission-review-scores {
    margin-top: 16px;
}

.submission-review-scores h3 {
    margin: 0 0 7px;
    color: #0d5f50;
    font-size: 0.82rem;
}

.submission-review-scores h3 i {
    margin-right: 5px;
}

.submission-review-score-list {
    border-top: 1px solid #dce8e3;
}

.submission-review-score-row {
    min-height: 42px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid #e1e9e5;
}

.submission-review-score-row span {
    color: #344054;
    font-size: 0.76rem;
    line-height: 1.4;
}

.submission-review-score-row strong {
    min-width: 52px;
    padding: 5px 8px;
    border-radius: 5px;
    color: #075985;
    background: #e0f2fe;
    font-size: 0.76rem;
    text-align: center;
}

.submission-review-score-empty {
    padding: 12px 0 2px;
    color: #9a4f08;
    font-size: 0.78rem;
}

.cam-doan-box {
    min-height: 52px;
    margin-top: 0;
    padding: 14px;
    border: 1px solid #d7dee6;
    border-radius: 8px;
    background: #f8fafc;
}

.cam-doan-box input {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    accent-color: var(--primary);
}

.cam-doan-box label {
    color: #344054;
    font-size: 0.82rem;
}

#group_hs12_checkbox {
    border-color: #fed7aa !important;
    color: #9a3412;
    background: #fff7ed !important;
}

#group_hs12_checkbox label {
    color: #9a3412 !important;
}

#step4-description {
    margin: -8px 0 0 !important;
    color: var(--text-muted) !important;
}

#tai-truong-mode-note {
    margin: 0;
    padding: 13px 14px;
    border: 1px solid #86efac;
    border-radius: 8px;
    color: #166534;
    background: #f0fdf4;
    font-size: 0.8rem;
}

body.registration-at-school #step4-description {
    display: none;
}

body.registration-at-school .mc-tai-don,
body.registration-at-school #mc_cam_ket_box {
    display: none !important;
}

/* Bước 3 dành cho cán bộ tiếp nhận: nhúng đúng quy trình của mục Đề xuất,
   rồi áp phương án được xếp đầu vào hồ sơ tại trường. */
.at-school-auto-selection {
    display: none;
    grid-column: 1 / -1;
    padding: 18px;
    border: 1px solid #99d5c9;
    border-radius: 10px;
    background: #f0fdf9;
}

body.registration-at-school .at-school-auto-selection {
    display: block;
}

/* Luồng tại trường lấy kết quả từ khối tự tính ở trên. Các điều khiển cũ vẫn
   tồn tại để giữ nguyên cấu trúc dữ liệu gửi đi, nhưng không cho chọn trùng. */
body.registration-at-school #phuongthuc_group,
body.registration-at-school #tohop_group,
body.registration-at-school #score_group {
    display: none !important;
}

.at-school-auto-head {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 15px;
}

.at-school-auto-head > i {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    flex: 0 0 40px;
    border-radius: 9px;
    color: #0f766e;
    background: #ccfbf1;
}

.at-school-auto-head h3 {
    margin: 0;
    color: #115e59;
    font-size: 1rem;
    line-height: 1.35;
}

.at-school-auto-head p {
    margin: 4px 0 0;
    color: #475569;
    font-size: 0.8rem;
    line-height: 1.5;
}

.at-school-rec-step {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid #d7e8e5;
    border-radius: 9px;
    background: #fff;
}

.at-school-rec-step[hidden] {
    display: none;
}

.at-school-rec-step h4 {
    margin: 0 0 5px;
    color: #115e59;
    font-size: 0.9rem;
}

.at-school-rec-sub {
    margin: 0 0 12px;
    color: #667085;
    font-size: 0.78rem;
    line-height: 1.5;
}

.at-school-rec-step > label {
    display: block;
    margin: 12px 0 7px;
    color: #344054;
    font-size: 0.78rem;
    font-weight: 750;
}

.at-school-rec-subject-row {
    display: grid;
    grid-template-columns: 22px minmax(110px, 1fr) 150px;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 8px 0;
    border-bottom: 1px solid #eef2f4;
    color: #344054;
    font-size: 0.8rem;
}

.at-school-rec-subject-row > input[type="checkbox"],
.at-school-rec-skip > input {
    width: 20px;
    height: 20px;
    min-height: 0;
    accent-color: #0f766e;
}

.at-school-rec-subject-row > span {
    font-weight: 750;
}

.at-school-rec-subject-row input[type="text"],
.at-school-rec-score-row input,
.at-school-rec-score-row select,
#at_school_rec_subject_count {
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    background: #fff;
    color: #172033;
    font: inherit;
    font-size: 0.8rem;
}

.at-school-rec-subject-row input:focus,
.at-school-rec-score-row input:focus,
.at-school-rec-score-row select:focus,
#at_school_rec_subject_count:focus {
    border-color: #0f766e;
    outline: 3px solid rgba(15, 118, 110, 0.12);
}

.at-school-rec-subject-row input:disabled {
    color: #94a3b8;
    background: #f1f5f9;
}

#at_school_rec_subjects.is-disabled {
    opacity: 0.48;
}

.at-school-rec-skip {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0 !important;
    padding: 10px 11px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #475569 !important;
    background: #f8fafc;
    cursor: pointer;
}

.at-school-rec-note {
    margin-top: 10px;
    padding: 10px 11px;
    border-radius: 8px;
    font-size: 0.76rem;
    line-height: 1.5;
}

.at-school-rec-note[hidden] {
    display: none;
}

.at-school-rec-note.is-success {
    border: 1px solid #a7f3d0;
    color: #14532d;
    background: #f0fdf4;
}

.at-school-rec-note.is-warning {
    border: 1px solid #fed7aa;
    color: #9a3412;
    background: #fff7ed;
}

.at-school-rec-note.is-info {
    border: 1px solid #bae6fd;
    color: #075985;
    background: #f0f9ff;
}

.at-school-rec-secondary {
    width: 100%;
    min-height: 42px;
    margin-top: 12px;
    border: 1px solid #0f766e;
    border-radius: 8px;
    color: #0f766e;
    background: #fff;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.at-school-rec-score-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 150px;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #eef2f4;
}

.at-school-rec-score-row > span {
    color: #344054;
    font-size: 0.78rem;
    font-weight: 700;
}

.at-school-rec-average {
    margin-top: 10px;
    padding: 10px 11px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    color: #475569;
    background: #f8fafc;
    font-size: 0.78rem;
}

.at-school-rec-average b {
    color: #0f766e;
}

.at-school-rec-danger {
    color: #b42318;
}

.at-school-rec-exam-title {
    margin: 16px 0 8px;
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.5;
}

.at-school-auto-action {
    width: 100%;
    min-height: 46px;
    margin-top: 14px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: #0f766e;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
}

.at-school-auto-action:hover {
    background: #115e59;
}

.at-school-auto-result {
    margin-top: 12px;
    padding: 11px 13px;
    border: 1px solid #99d5c9;
    border-radius: 8px;
    color: #14532d;
    background: #ecfdf5;
    font-size: 0.8rem;
    line-height: 1.55;
}

.at-school-auto-result[hidden] {
    display: none;
}

.at-school-auto-result.is-error {
    border-color: #fecaca;
    color: #991b1b;
    background: #fef2f2;
}

.at-school-rec-result-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.at-school-rec-result-head span {
    display: inline-block;
    margin-right: 6px;
    padding: 2px 7px;
    border-radius: 999px;
    color: #fff;
    background: #0f766e;
    font-size: 0.68rem;
    font-weight: 800;
}

.at-school-rec-result-head b,
.at-school-rec-result-head strong {
    display: block;
    margin-top: 4px;
}

.at-school-rec-result-head em {
    color: #0f766e;
    font-size: 1.25rem;
    font-style: normal;
    font-weight: 850;
}

.at-school-rec-result-detail {
    margin-top: 9px;
    padding-top: 9px;
    border-top: 1px solid #d1fae5;
}

.at-school-auto-result p {
    margin: 9px 0 0;
    font-weight: 700;
}

.at-school-auto-result details {
    margin-top: 9px;
}

.at-school-auto-result summary {
    cursor: pointer;
    font-weight: 700;
}

.at-school-rec-other {
    padding: 7px 0;
    border-top: 1px solid #d1fae5;
}

@media (max-width: 720px) {
    .at-school-rec-subject-row {
        grid-template-columns: 22px 1fr;
    }

    .at-school-rec-subject-row input[type="text"] {
        grid-column: 2;
    }

    .at-school-rec-score-row {
        grid-template-columns: minmax(100px, 1fr) 120px;
    }
}

.document-note {
    margin: -3px 0 8px;
    color: #b42318;
    font-size: 0.72rem;
}

.file-upload {
    min-height: 118px;
    margin-top: 8px;
    padding: 18px;
    border: 1.5px dashed #aab6c3;
    border-radius: 8px;
    color: #475467;
    background: #fff;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.file-upload:hover,
.file-upload:focus-within {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.file-info {
    gap: 7px;
    font-size: 0.8rem;
}

.file-info svg {
    width: 30px;
    height: 30px;
    color: var(--primary);
}

.file-name {
    max-width: 100%;
    color: var(--success);
    font-size: 0.72rem;
}

.bottom-nav {
    position: relative;
    grid-column: 2;
    grid-row: 2;
    left: auto;
    right: auto;
    bottom: auto;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 13px 48px;
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 20px rgba(23, 32, 51, 0.05);
}

.btn {
    min-height: 46px;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0 22px;
    border-radius: 7px;
    font-size: 0.86rem;
    font-weight: 800;
}

.btn-primary {
    border: 1px solid var(--primary);
    color: #fff;
    background: var(--primary);
}

.btn-primary:hover:not(:disabled) {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
}

.btn-outline {
    border: 1px solid #aab6c3;
    color: #344054;
    background: #fff;
}

.btn-outline:hover {
    border-color: #667085;
    background: #f8fafc;
}

.btn:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.18);
    outline-offset: 2px;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#btnBack_xt {
    margin-right: auto;
}

#loading-overlay {
    position: fixed;
    inset: 0;
    border-radius: 0;
    background: rgba(248, 250, 252, 0.94);
    backdrop-filter: blur(3px);
}

#maintenance-screen,
#success-screen {
    grid-column: 2;
    grid-row: 1 / 3;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    background: #fbfcfd;
}

.maintenance-card {
    width: min(520px, 100%);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 18px 44px rgba(23, 32, 51, 0.1);
}

.maintenance-icon {
    border-radius: 8px;
}

#success-screen {
    padding: 38px 48px;
}

#success-screen > * {
    width: min(680px, 100%) !important;
}

.check-circle {
    width: 68px;
    height: 68px;
    margin-top: 8px;
}

.success-notification-card,
#success-direct-approval-note,
#success-online-next-step {
    border-radius: 8px !important;
    box-shadow: none;
}

#toast-box {
    top: 18px;
    left: calc(50% + 159px);
    width: min(430px, calc(100% - 350px));
}

.toast {
    border-radius: 8px;
}

.swal-bottom-sheet {
    border-radius: 12px !important;
}

@media (max-width: 960px) {
    .app-container {
        grid-template-columns: 270px minmax(0, 1fr);
    }

    .registration-sidebar {
        padding: 24px 20px 20px;
    }

    #main-content {
        padding: 32px 28px 40px;
    }

    .bottom-nav {
        padding-right: 28px;
        padding-left: 28px;
    }

    .step.active {
        gap: 18px;
    }
}

@media (max-width: 760px) {
    body {
        overflow: hidden;
        background: #fff;
    }

    .app-container {
        width: 100%;
        min-height: 0;
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(0, 1fr) auto;
        box-shadow: none;
    }

    .registration-sidebar {
        grid-column: 1;
        grid-row: 1;
        min-height: 0;
        padding: 10px 12px 9px;
        background: #fff;
        color: var(--text-main);
        border-bottom: 1px solid var(--border);
    }

    .header {
        color: var(--text-main);
    }

    .back-btn {
        top: 0;
        right: 0;
        width: 34px;
        height: 34px;
        border-color: var(--border);
        color: #344054;
        background: #fff;
    }

    .brand-lockup {
        min-height: 34px;
        gap: 8px;
        padding-right: 42px;
    }

    .brand-lockup img {
        width: 34px;
        height: 34px;
    }

    .brand-lockup strong {
        color: #14343a;
        font-size: 0.68rem;
    }

    .brand-lockup span {
        color: var(--text-muted);
        font-size: 0.58rem;
    }

    .registration-topline {
        margin-top: 8px;
    }

    .header h1 {
        color: var(--text-main);
        font-size: 0.88rem;
        line-height: 1.2;
    }

    .registration-support {
        display: none;
    }

    #main-content {
        grid-column: 1;
        grid-row: 2;
        padding: 0 12px 18px;
        scrollbar-gutter: auto;
        background: #fff;
    }

    #xetTuyenForm {
        width: 100%;
    }

    .step.active {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px 10px;
    }

    .step-header,
    .form-group:has(#full_name),
    .form-group:has(#noisinh_tinh),
    .form-group:has(#tinh),
    .form-group:has(#truong10_tinh),
    .form-group:has(#tohop),
    .form-group:has(#score_inputs),
    #step4-description,
    #tai-truong-mode-note,
    #step5_xt > .cam-doan-box,
    .submission-review {
        grid-column: 1 / -1;
    }

    #step2_xt > .form-group,
    #step3_xt > .form-group,
    #step4_xt > .form-group {
        grid-column: 1 / -1;
    }

    .submission-review {
        padding: 14px 12px;
    }

    .submission-review-heading h2 {
        font-size: 0.9rem;
    }

    .submission-review-grid {
        grid-template-columns: 1fr;
        column-gap: 0;
    }

    .submission-review-item-wide {
        grid-column: 1;
    }

    .step-header {
        display: none;
    }

    .step-header i {
        width: 32px;
        height: 32px;
        border-radius: 7px;
        font-size: 0.88rem;
    }

    .step > div[style*="display: flex"] {
        grid-column: 1 / -1;
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .form-group {
        padding-bottom: 11px;
    }

    .form-group label {
        min-height: 34px;
        margin-bottom: 6px;
        display: flex;
        align-items: flex-end;
        font-size: 0.76rem;
        line-height: 1.25;
    }

    .form-group label[for="sonha"] {
        min-height: 0;
        margin-top: 10px !important;
    }

    .residence-title {
        margin-bottom: 8px;
        font-size: 0.76rem;
    }

    .residence-location-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .residence-field--detail {
        grid-column: 1 / -1;
    }

    .residence-field > label {
        min-height: 0;
        align-items: center;
        font-size: 0.66rem;
    }

    .school-mode-selector {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .school-mode-selector strong {
        font-size: 0.8rem;
    }

    .school-mode-selector span {
        font-size: 0.68rem;
    }

    .school-mode-button {
        min-height: 44px;
        padding: 8px 6px;
        font-size: 0.72rem;
    }

    .form-control {
        min-height: 48px;
        padding: 10px 11px;
        border-radius: 8px;
        font-size: 16px;
    }

    .form-group small {
        font-size: 0.68rem !important;
    }

    #hienthi_noisinh,
    #hienthi_diachi,
    .school-address-box {
        font-size: 0.72rem !important;
    }

    .school-period-summary {
        margin-top: 10px;
        padding-top: 10px;
    }

    .school-period-row {
        padding: 8px 0;
    }

    .school-period-row b {
        max-width: 105px;
        font-size: 0.68rem;
    }

    .dropdown-list {
        max-height: min(320px, 46vh);
    }

    .score-box {
        padding: 14px 12px;
    }

    .score-grid {
        grid-template-columns: 1fr;
    }

    .score-row {
        grid-template-columns: minmax(0, 1fr) 92px;
    }

    .score-row label {
        min-height: 0;
        align-items: center;
        font-size: 0.74rem;
    }

    .file-upload {
        min-height: 74px;
        justify-content: flex-start;
        padding: 11px 13px;
    }

    .file-info {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        gap: 11px;
        text-align: left;
    }

    .file-info svg {
        width: 27px;
        height: 27px;
        flex: 0 0 auto;
    }

    .file-name {
        margin-left: auto;
        text-align: right;
    }

    .bottom-nav {
        position: relative;
        grid-column: 1;
        grid-row: 3;
        min-height: 64px;
        gap: 7px;
        padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
        border-radius: 0;
    }

    .nav-step-status {
        min-width: 96px;
        margin-right: auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
        color: #173b35;
        font-size: 0.7rem;
        font-weight: 800;
        line-height: 1.2;
        white-space: nowrap;
    }

    .nav-step-status::before {
        content: "Thông tin cá nhân";
    }

    .nav-step-status::after {
        margin-top: 3px;
        content: "Bước 1/5";
        color: #788795;
        font-size: 0.59rem;
        font-weight: 700;
    }

    .app-container:has(#step2_xt.active) .nav-step-status::before {
        content: "Thông tin học vấn";
    }

    .app-container:has(#step2_xt.active) .nav-step-status::after {
        content: "Bước 2/5";
    }

    .app-container:has(#step3_xt.active) .nav-step-status::before {
        content: "Thông tin xét tuyển";
    }

    .app-container:has(#step3_xt.active) .nav-step-status::after {
        content: "Bước 3/5";
    }

    .app-container:has(#step4_xt.active) .nav-step-status::before {
        content: "Minh chứng";
    }

    body.registration-at-school .app-container:has(#step4_xt.active) .nav-step-status::before {
        content: "Đăng ký tại trường";
    }

    .app-container:has(#step4_xt.active) .nav-step-status::after {
        content: "Bước 4/5";
    }

    .app-container:has(#step5_xt.active) .nav-step-status::before {
        content: "Kiểm tra thông tin";
    }

    .app-container:has(#step5_xt.active) .nav-step-status::after {
        content: "Bước 5/5";
    }

    .bottom-nav .btn {
        min-width: 104px;
        min-height: 46px;
        flex: 0 1 auto;
        gap: 7px;
        padding: 0 13px;
        font-size: 0.8rem;
    }

    #btnBack_xt {
        margin-right: 0;
        min-width: 94px;
    }

    #maintenance-screen,
    #success-screen {
        grid-column: 1;
        grid-row: 2 / 4;
    }

    #success-screen {
        padding: 24px 16px;
    }

    #toast-box {
        top: 10px;
        left: 50%;
        width: calc(100% - 24px);
    }

    .swal-bottom-sheet {
        max-width: 100% !important;
        border-radius: 14px 14px 0 0 !important;
    }
}

@media (max-width: 350px) {
    .registration-sidebar {
        padding-right: 10px;
        padding-left: 10px;
    }

    #main-content {
        padding-right: 10px;
        padding-left: 10px;
    }

    .step.active {
        grid-template-columns: 1fr;
    }

    .step-header,
    .form-group:has(#full_name),
    .form-group:has(#noisinh_tinh),
    .form-group:has(#tinh),
    .form-group:has(#truong10_tinh),
    .form-group:has(#tohop),
    .form-group:has(#score_inputs),
    #step4-description,
    #tai-truong-mode-note,
    #step5_xt > .cam-doan-box,
    .submission-review {
        grid-column: 1;
    }

    .step > div[style*="display: flex"] {
        grid-column: 1;
        grid-template-columns: 1fr;
    }

    .form-group label {
        min-height: 0;
    }

    .bottom-nav {
        padding-right: 10px;
        padding-left: 10px;
    }

    .brand-lockup strong {
        max-width: 190px;
    }

    .nav-step-status {
        min-width: 78px;
        font-size: 0.64rem;
    }

    .bottom-nav .btn {
        min-width: 94px;
        padding: 0 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
