/* Laravel-specific additions on top of the XIM portal design system */
.btn[disabled],
.btn.is-disabled,
.btn[aria-disabled="true"] {
    opacity: .6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.alert--err,
.field .help.err {
    overflow-wrap: anywhere;
}

.tag.is-met {
    background: var(--success-bg);
    border-color: var(--success-line);
    color: var(--success-ink);
}

.strength-bar {
    height: 6px;
    border-radius: 99px;
    background: var(--line);
    overflow: hidden;
}

.strength-bar i {
    display: block;
    height: 100%;
    width: 5%;
    border-radius: inherit;
    background: var(--ink-300);
    transition: width .2s, background-color .2s;
}

/* Candidate access: branded gateway + one form at a time. */
.auth-shell {
    width: min(100%, 1100px);
    margin-inline: auto;
    display: grid;
    gap: 16px;
}

.auth-layout {
    display: grid;
    grid-template-columns: minmax(260px, .92fr) minmax(360px, 1.08fr);
    align-items: stretch;
    gap: var(--gap);
}

.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 100%;
    padding: 32px 28px;
    border-radius: var(--r-lg);
    background:
        radial-gradient(circle at 112% -8%, rgba(255,255,255,.14), transparent 42%),
        linear-gradient(180deg, var(--brand-600) 0%, var(--brand-700) 100%);
    color: #fff;
}

.auth-aside .eyebrow {
    color: rgba(255,255,255,.62);
}

.auth-aside .pill,
.auth-aside .eyebrow {
    align-self: start;
}

.auth-aside h1 {
    max-width: 14ch;
    color: #fff;
    font-family: var(--font-serif);
    font-size: clamp(30px, 3.4vw, 40px);
    font-weight: 600;
    line-height: 1.15;
    text-wrap: balance;
}

.auth-aside > p {
    max-width: 36ch;
    color: rgba(255,255,255,.78);
    font-size: 15px;
    line-height: 1.6;
}

.auth-points {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.auth-points li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 12px;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    color: rgba(255,255,255,.92);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
}

.auth-points .ms {
    margin-top: 1px;
    color: #C9D7E8;
    font-size: 18px;
}

.auth-back,
.auth-help a,
.auth-label-row a {
    color: var(--brand-600);
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    font-size: 13px;
    text-decoration: none;
}

.auth-back .ms {
    font-size: 17px;
}

.auth-security {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.14);
    color: #D5E8DC;
    font-size: 12.5px;
    line-height: 1.5;
}

.auth-security .ms {
    margin-top: 1px;
    font-size: 18px;
}

.auth-card {
    display: grid;
    align-content: start;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
}

.auth-card::before {
    content: "";
    display: block;
    height: 4px;
    background: var(--brand-500);
}

.auth-task-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface-2);
}

.auth-task-tabs button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 8px 16px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink-500);
    font: 700 14px/1.3 var(--font);
    cursor: pointer;
}

.auth-task-tabs button .ms {
    font-size: 18px;
}

.auth-task-tabs button[aria-selected="true"] {
    background: #fff;
    color: var(--brand-700);
    box-shadow: none;
}

.auth-task-tabs button[aria-selected="true"]::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: -1px;
    height: 2px;
    background: var(--brand-500);
}

.auth-task-tabs button:hover {
    color: var(--ink-900);
}

.auth-task-tabs button[aria-selected="true"]:hover {
    color: var(--brand-700);
}

.auth-panel {
    display: grid;
    gap: 22px;
    padding: 28px;
}

.auth-panel-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.auth-panel-head .icon-chip {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: var(--brand-50);
    border: 1px solid var(--brand-100);
    color: var(--brand-600);
}

.auth-panel-head > div {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.auth-panel-head h2 {
    font-size: 22px;
}

.auth-panel-head p,
.auth-help {
    color: var(--ink-500);
    font-size: 13.5px;
    line-height: 1.6;
}

.auth-help {
    padding: 14px 16px;
    border-top: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    text-align: left;
}

.auth-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.auth-label-row label {
    color: var(--ink-700);
    font-size: 12.5px;
    font-weight: 700;
}

.auth-label-row a {
    flex-shrink: 0;
    font-size: 12px;
}

.auth-shell .control {
    background: var(--surface-2);
}

.auth-shell .choice {
    background: var(--surface-2);
}

.auth-shell .choice.is-on {
    background: var(--brand-50);
}

.auth-shell .control:focus-within {
    background: #fff;
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.auth-shell .phone-control {
    gap: 6px;
}

.auth-shell .phone-control #country_code_select {
    flex: 0 0 52px;
    width: 52px;
    padding: 0;
}

.auth-shell .phone-control input {
    padding-left: 4px;
    border-left: 1px solid var(--line);
}

.auth-shell .choice:focus-within {
    outline: 2px solid var(--brand-400);
    outline-offset: 2px;
}

.auth-shell input:focus-visible,
.auth-shell select:focus-visible {
    outline: 0;
}

.auth-shell fieldset[disabled] {
    opacity: .65;
}

/* Admissions home: preserve all content while keeping one clear reading path. */
.home-shell {
    display: grid;
    gap: var(--gap);
}

.home-shell > * {
    min-width: 0;
}

.home-top {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
    align-items: stretch;
    gap: var(--gap);
    padding-block: var(--s-5) var(--s-3);
}

.home-intro {
    display: grid;
    justify-items: start;
    align-content: center;
    gap: 12px;
    padding: var(--s-7) var(--s-6);
    text-align: left;
}

.home-intro h1 {
    max-width: 680px;
    color: var(--ink-900);
    font-family: var(--font-serif);
    font-size: clamp(38px, 4.4vw, 54px);
    font-weight: 600;
    line-height: 1.12;
    text-wrap: balance;
}

.home-intro h1 em {
    font-style: italic;
}

.home-intro > p {
    max-width: 620px;
    color: var(--ink-500);
    font-size: 16px;
    line-height: 1.65;
}

.home-intro-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.home-text-link {
    padding: 10px 4px;
    color: var(--brand-600);
    font-size: 13.5px;
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.home-offerings {
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    gap: var(--s-5);
    padding: var(--s-6);
}

.home-offerings-summary,
.home-offerings-breakdown {
    min-width: 0;
}

.home-offerings-summary {
    display: grid;
    gap: 12px;
}

.home-offerings .offer-figure strong {
    font-size: 40px;
}

.home-offerings .offer-status {
    grid-template-columns: 1fr;
    gap: 7px;
    border-top: 0;
    padding-top: 0;
}

.home-offerings-breakdown {
    display: grid;
    gap: 10px;
    padding-top: var(--s-5);
    border-top: 1px solid var(--line);
}

.home-offerings .seg {
    flex: 1;
}

.home-preflight {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: var(--gap);
}

.home-resources {
    padding: var(--s-5) var(--s-6);
}

.home-section-head {
    display: grid;
    justify-items: start;
    gap: 5px;
    min-width: 0;
}

.home-section-head h2 {
    color: var(--ink-900);
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
}

.home-section-head .pill {
    margin-top: 3px;
}

.home-resources .quick-actions {
    margin-top: var(--s-4);
    padding-top: 0;
    border-top: 1px solid var(--line);
}

.home-shell .cycles {
    padding: var(--s-6);
}

.home-shell .cycles-head {
    align-items: end;
}

.home-shell .search-suggest button {
    min-height: 44px;
    height: auto;
    padding: 7px 12px;
}

.home-shell .search-suggest button:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: 2px;
}

.home-shell .pg-course-title {
    margin: 0;
    color: var(--ink-900);
    font-size: var(--fs-h3);
    font-weight: 700;
    line-height: 1.35;
}

.home-shell .pg-card--phd .pg-course-title {
    font-size: 18px;
}

.home-shell .pg-card.is-closed .pg-school,
.home-shell .pg-card.is-closed .pg-title,
.home-shell .pg-card.is-closed .pg-meta {
    opacity: 1;
}

.home-shell .pg-card.is-closed {
    color: var(--ink-700);
}

.home-milestones {
    display: grid;
    gap: var(--s-4);
}

.home-milestones .stats {
    width: 100%;
}

@media (max-width: 860px) {
    .home-top {
        grid-template-columns: 1fr;
        padding-top: 0;
    }

    .home-preflight {
        grid-template-columns: 1fr;
    }

    .home-intro {
        width: min(100%, 780px);
        margin-inline: auto;
        justify-items: center;
        text-align: center;
    }

    .home-intro-actions {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .home-intro {
        width: 100%;
        justify-items: start;
        padding: 16px 0 8px;
        text-align: left;
    }

    .home-intro h1 {
        font-size: 28px;
        text-wrap: initial;
    }

    .home-intro > p {
        font-size: 14px;
    }

    .home-intro-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr;
        justify-items: stretch;
    }

    .home-top {
        gap: 16px;
    }

    .home-intro-actions .btn {
        width: 100%;
    }

    .home-text-link {
        text-align: center;
    }

    .home-offerings {
        padding: 16px;
    }

    .home-offerings .offer-status {
        grid-template-columns: 1fr;
    }

    .home-resources,
    .home-shell .cycles {
        padding: 16px;
    }

    .home-section-head h2 {
        font-size: 21px;
    }

    .home-shell .cycles-head {
        align-items: stretch;
    }

    .home-shell .search-suggest {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .home-shell .search-suggest > span {
        grid-column: 1 / -1;
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(20, 22, 43, .45);
    backdrop-filter: blur(4px);
}

.modal-overlay.is-open {
    display: flex !important;
}

.modal-overlay .modal {
    width: min(760px, 100%);
    max-height: min(90vh, 860px);
    display: flex;
    flex-direction: column;
}

.modal-overlay .modal-body {
    overflow: auto;
    max-height: min(58vh, 520px);
}

.xim-app .modal-backdrop {
    z-index: 2000;
}

.xim-app .modal.fade {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2010;
    display: none;
    width: 100% !important;
    max-width: none;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    pointer-events: auto;
}

.xim-app .modal.fade.show {
    display: block;
}

.xim-app .modal.fade .modal-dialog {
    position: relative;
    width: auto;
    max-width: 800px;
    margin: 1.75rem auto;
    pointer-events: none;
    z-index: 2011;
}

.xim-app .modal.fade .modal-content {
    pointer-events: auto;
    position: relative;
    z-index: 2012;
}

.xim-app .modal.fade .modal-body {
    display: block;
    width: 100%;
    max-height: none;
}

#courseInstructionsModal .modal-body {
    width: 100%;
    justify-items: stretch;
}

#courseInstructionsModal .xim-instruction-body {
    width: 100%;
    max-width: 100%;
    max-height: min(42vh, 420px);
    overflow: auto;
}

#courseInstructionsModal .xim-instruction-body table,
#courseInstructionsModal .xim-instruction-body .table {
    width: 100%;
    min-width: 0;
    border-spacing: 0;
}

#courseInstructionsModal .xim-instruction-body th,
#courseInstructionsModal .xim-instruction-body td,
#courseInstructionsModal .xim-instruction-body .table tr td,
#courseInstructionsModal .xim-instruction-body .table tr td:first-child,
#courseInstructionsModal .xim-instruction-body .table tr td:last-child,
#courseInstructionsModal .xim-instruction-body .table tr th {
    text-align: left;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    border-radius: 0;
}

#courseInstructionsModal .xim-instruction-body th:first-child,
#courseInstructionsModal .xim-instruction-body td:first-child {
    width: 32%;
}

.xim-instruction-body h3,
.xim-instruction-body h4 {
    color: var(--ink-900);
    margin: 0 0 .5rem;
}

.xim-instruction-body h3 { font-size: 1.05rem; font-weight: 800; }
.xim-instruction-body h4 { font-size: .95rem; font-weight: 700; }
.xim-instruction-body p { margin: 0 0 .65rem; color: var(--ink-700); }
.xim-instruction-body table { width: 100%; border-collapse: collapse; margin-bottom: .75rem; font-size: 13px; }
.xim-instruction-body th,
.xim-instruction-body td { border: 1px solid var(--line-strong); padding: .45rem .6rem; vertical-align: top; }
.xim-instruction-body th {
    background: var(--brand-50);
    color: var(--brand-700);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.g-recaptcha { transform-origin: left top; }

/* reCAPTCHA ships a fixed 304px-wide widget — scale it down so it never
   overflows narrow mobile viewports */
.recaptcha-wrap { max-width: 100%; overflow: hidden; }
@media (max-width: 340px) {
    .g-recaptcha {
        transform: scale(.84);
        margin-bottom: -13px;
    }
}

.swal2-popup { font-family: var(--font) !important; }

/* Helpdesk / generic content that used to rely on Tailwind */
.portal-table-wrap { overflow-x: auto; }
.portal-table { width: 100%; border-collapse: collapse; }
.portal-table th {
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-400);
    padding: 12px 16px;
    background: var(--surface-2);
}
.portal-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--ink-700);
    vertical-align: top;
}
.portal-table a { color: var(--brand-600); font-weight: 700; text-decoration: none; }
.portal-table a:hover { color: var(--brand-700); }

/* Application form (Bootstrap) restyle to match the new tokens */
.xim-app {
    --xim-primary: #234A7C;
    --xim-primary-ink: #132A47;
    --xim-hover: #1B3A61;
    --xim-header: #ffffff;
    --xim-section: #234A7C;
    --xim-page: #F6F7F8;
    --xim-card: #ffffff;
    --xim-soft: #F0F4F9;
    --xim-soft-high: #DDE5F0;
    --xim-soft-low: #F4F5F7;
    --xim-border: #E3E5E9;
    --xim-input-border: #D2D6DC;
    --xim-text: #3B424E;
    --xim-muted: #5D6470;
    --xim-on-surface: #1B1F27;
    --xim-on-variant: #5D6470;
    --xim-danger: #B4423A;
    --xim-success: #205C3A;
    --xim-ochre: #234A7C;
    --xim-ochre-ink: #ffffff;
    --xim-teal: #1B3A61;
    --xim-radius: 10px;
    --xim-input-radius: 6px;
    --xim-shadow: 0 1px 2px rgba(16,24,40,.05);
    --font-ui: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
    --font-display: "Source Serif 4", Georgia, serif;
    background: var(--canvas) !important;
    color: var(--ink-700);
    font-family: var(--font);
}

.xim-app .xim-main {
    width: 100%;
    margin: 0;
    padding: 0;
}

.xim-app .card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: none;
    overflow: visible;
}

.xim-app .xim-main .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
    gap: 0;
}

.xim-app .xim-main .row[class*="row--"] {
    display: grid;
    margin-right: 0;
    margin-left: 0;
    gap: var(--gap);
}

.xim-app .xim-main p {
    margin-bottom: .5rem;
}

.xim-app .input-group {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
}

.xim-app .input-group > .form-control {
    height: 44px;
}

.xim-app .input-group-append,
.xim-app .input-group-prepend {
    display: flex;
}

.xim-app .input-group-text {
    display: flex;
    align-items: center;
    border: 1px solid var(--line-strong);
    background: #fff;
}

.xim-app .phone-with-country {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
}

.xim-app .phone-with-country .country-code-select,
.xim-app .phone-with-country select.form-control {
    flex: 0 0 92px;
    width: 92px;
    max-width: 92px;
    height: 44px !important;
    min-height: 44px;
    padding: 8px 28px 8px 12px;
    border-radius: 6px 0 0 6px !important;
    border-right: 0 !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B7280' d='M1.4.8 6 5.4 10.6.8 12 2.2 6 8 0 2.2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
}

.xim-app .phone-with-country input.form-control {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px !important;
    min-height: 44px;
    border-radius: 0 6px 6px 0 !important;
}

.xim-app .phone-with-country .country-code-select:focus,
.xim-app .phone-with-country input.form-control:focus {
    z-index: 2;
        border-right-width: 1px !important;
}

.xim-app .domicile-help {
    width: 18px;
    height: 18px;
    margin-left: 2px;
    padding: 0;
    border: 1px solid var(--brand-300);
    border-radius: 50%;
    background: var(--brand-50);
    color: var(--brand-600);
    font: 700 11px/1 var(--font);
    cursor: help;
    vertical-align: middle;
    flex-shrink: 0;
}

.xim-app #state_of_domicile_display {
    background: var(--surface-2);
    color: var(--ink-900);
}

.xim-app .checkbox.checkbox-fill input[type="checkbox"] {
    width: auto;
    height: auto;
}

.xim-app .card-header,
.xim-app .bg-primary {
    background: var(--brand-500) !important;
    border-color: var(--brand-500) !important;
}

.xim-app .btn-primary,
.xim-app .btn-success,
.xim-app button.btn-primary {
    background: var(--brand-500) !important;
    border-color: var(--brand-500) !important;
    color: #fff !important;
    border-radius: 6px;
    font-weight: 700;
}

.xim-app .form-control,
.xim-app .custom-select,
.xim-app select.form-control {
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    min-height: 44px;
    font-family: var(--font);
}

.xim-app .form-control:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--brand-100);
}

.xim-app .xim-title-block,
.xim-app .xim-topbar,
.xim-app .xim-notice,
.xim-app .xim-dossier,
.xim-app .xim-stepper,
.xim-app .xim-site-footer { display: none !important; }

.xim-app .topnav a { color: var(--ink-500) !important; }
.xim-app .topnav a.is-active,
.xim-app .topnav a:hover { color: #fff !important; }
.xim-app .topnav a:hover { background: var(--surface-2); color: var(--ink-900) !important; }
.xim-app .topnav a.is-active:hover { background: var(--brand-500); color: #fff !important; }
.xim-app .brand,
.xim-app .brand:hover { color: inherit !important; text-decoration: none; }
.xim-app .account-text a { color: var(--ink-500) !important; }
.xim-app .notice-help { color: var(--ink-900) !important; }
.xim-app .footer a { color: var(--ink-700) !important; }
.xim-app .btn--primary,
.xim-app .btn--primary:hover { color: #fff !important; }
.xim-app .btn--ghost { color: var(--ink-900) !important; }
.xim-app .btn--open { color: var(--success-ink) !important; }
.xim-app .contact-list .v a { color: var(--ink-900) !important; }

@media (max-width: 640px) {
    .xim-app .xim-main { width: min(100% - 32px, var(--container)); }
}

@media (max-width: 960px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-aside {
        min-height: 0;
        padding: 24px 22px;
    }

    .auth-aside h1 {
        max-width: none;
        font-size: 30px;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        gap: 12px;
    }

    .auth-aside {
        padding: 20px 18px;
        gap: 10px;
    }

    .auth-aside h1 {
        font-size: 27px;
    }

    .auth-points {
        gap: 6px;
        margin-top: 4px;
    }

    .auth-task-tabs {
        position: sticky;
        top: 8px;
        z-index: 10;
    }

    .auth-task-tabs button {
        min-height: 48px;
        padding-inline: 10px;
        font-size: 13.5px;
    }

    .auth-panel {
        gap: 18px;
        padding: 20px 16px 18px;
    }

    .auth-panel-head {
        padding-bottom: 14px;
    }

    .auth-panel-head h2 {
        font-size: 20px;
    }

    .auth-label-row {
        align-items: flex-start;
    }

    .modal-overlay {
        padding: 12px;
    }

    /* Keep legacy Bootstrap-backed candidate forms on the same compact
       mobile rhythm as the public portal pages. */
    .xim-app .xim-main {
        width: min(100% - 24px, var(--container));
    }

    .xim-app .card-body {
        padding: 1rem;
    }

    .xim-app .form-group {
        margin-bottom: .875rem;
    }

    .xim-app .form-control,
    .xim-app .custom-select,
    .xim-app select.form-control {
        font-size: 14px;
    }

    .xim-app .modal.fade .modal-dialog {
        margin: 12px;
    }
}
