/* Universal topbar search */
.topbar-menu {
    flex-wrap: nowrap;
}
.topbar-menu > .d-flex:last-child {
    flex: 1;
    justify-content: flex-end;
}
.topbar-search-universal {
    flex: 1 1 auto;
    min-width: 320px;
    max-width: 640px;
    margin: 0 1rem 0 0;
    padding: 0.45rem 1rem;
    border-radius: 50rem;
    background: var(--ct-gray-100, #f6f7fb);
    border: 1px solid var(--ct-gray-300, #e7e9eb);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.topbar-search-universal:hover,
.topbar-search-universal:focus-within {
    border-color: var(--ct-primary, #188ae2);
    box-shadow: 0 0 0 2px rgba(24, 138, 226, 0.12);
}
.topbar-search-universal span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#searchModal .modal-dialog {
    max-width: 720px;
}
#searchModal .form-control {
    font-size: 1.05rem;
    padding: 0.65rem 0.5rem;
}

/* Country Choices.js alignment */
.choices-country-wrap {
    width: 100%;
    position: relative;
}
.choices-country-wrap .choices {
    width: 100% !important;
    max-width: 100%;
    margin-bottom: 0;
}
.choices-country-wrap + .invalid-feedback {
    display: block;
}
.choices-country-wrap .choices__inner {
    min-height: 38px;
    padding: 0.45rem 2rem 0.45rem 0.65rem;
    border-radius: 0.375rem;
    border: 1px solid var(--ct-input-border-color, #ced4da);
    background: var(--ct-input-bg, #fff);
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.choices-country-wrap .choices__list--single {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    position: relative;
}

.choices-country-wrap .choices__list--single .choices__item[data-item][data-value] {
    padding: 0;
    margin: 0;
    width: auto;
    max-width: 100%;
    flex: 0 1 auto;
}

.choices-country-wrap .choices__list--single .choices__placeholder,
.choices-country-wrap .choices.crm-has-country-value .choices__placeholder,
.choices-country-wrap.crm-has-country-value .choices__placeholder,
.choices-country-wrap .choices__placeholder.choices__placeholder--hidden,
.choices-country-wrap .choices__list--single:has(.choices__item[data-item][data-value]:not([data-value=""])) .choices__placeholder,
.choices-country-wrap.crm-has-country-value .choices__list--single [data-placeholder] {
    display: none !important;
}

.choices-country-wrap:not(.crm-has-country-value) .choices__list--single .choices__placeholder {
    display: block;
    position: static;
    margin: 0;
    padding: 0;
    opacity: 0.65;
    flex: 1 1 auto;
}
.choices-country-wrap .choices__list--dropdown,
.choices-country-wrap .choices__list[aria-expanded] {
    z-index: 1060;
    border-radius: 0.625rem;
    margin-top: 4px;
    max-height: 300px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
    padding: 0.4rem 0;
}

.choices-country-wrap .choices__list--dropdown .choices__item,
.choices-country-wrap .choices__list[aria-expanded] .choices__item {
    padding: 0;
    display: block;
    overflow: visible;
    font-size: 0.875rem;
}
.choices-country-wrap .choices__input {
    background: transparent !important;
    margin-bottom: 0;
    padding: 4px 0;
}
.country-option-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Searchable filter selects (Choices.js) */
.crm-searchable-select-wrap .choices {
    width: 100%;
    margin-bottom: 0;
}
.crm-searchable-select-wrap .choices__inner {
    min-height: var(--crm-filter-control-height, 38px);
    padding: 0.45rem 0.75rem;
    font-size: inherit;
    line-height: 1.5;
    border-radius: 0.375rem;
    border: 1px solid var(--ct-input-border-color, #dee2e6);
    background-color: var(--ct-input-bg, #fff);
}
.crm-searchable-select-wrap .choices__list--single {
    padding: 0;
    display: flex;
    align-items: center;
}
.crm-searchable-select-wrap .choices__list--single .choices__item {
    padding: 0;
}
.crm-searchable-select-wrap .choices__list--dropdown,
.crm-searchable-select-wrap .choices__list[aria-expanded] {
    z-index: 1055;
    border-color: var(--ct-input-border-color, #dee2e6);
}
.crm-searchable-select-wrap .choices__input {
    background: transparent !important;
    margin-bottom: 0;
    padding: 0;
}

/* Audit / report filter rows — aligned labels + controls */
.crm-audit-filter-row {
    --crm-filter-control-height: 38px;
}
.crm-audit-filter-row .form-label {
    display: block;
    line-height: 1.25;
}
.crm-audit-filter-row .crm-filter-control,
.crm-audit-filter-row .form-control.crm-filter-control,
.crm-audit-filter-row .form-select.crm-filter-control {
    min-height: var(--crm-filter-control-height);
}
.crm-audit-filter-row .btn.crm-filter-control {
    min-height: var(--crm-filter-control-height);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.crm-audit-filter-row .crm-filter-control-host {
    min-height: var(--crm-filter-control-height);
}
.crm-audit-filter-row .crm-filter-control-host .choices,
.crm-audit-filter-row .crm-filter-control-host .choices__inner {
    min-height: var(--crm-filter-control-height);
}

/* CRM dropzone */
.crm-dropzone {
    border: 2px dashed var(--ct-gray-400, #ced4da);
    border-radius: 0.5rem;
    background: var(--ct-gray-100, #f6f7fb);
    min-height: 140px;
    padding: 1.25rem;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    position: relative;
}
.crm-dropzone .doc-slot-dropzone__message,
.crm-dropzone .dz-message,
.crm-dropzone .crm-dropzone__shift {
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.crm-dropzone.dz-drag-hover,
.crm-dropzone.drag-over {
    border-color: var(--ct-primary, #188ae2);
    border-style: solid;
    background: rgba(24, 138, 226, 0.08);
    box-shadow: 0 0 0 4px rgba(24, 138, 226, 0.18), 0 8px 24px rgba(24, 138, 226, 0.12);
    transform: translateY(-1px);
}
.crm-dropzone.dz-drag-hover .doc-slot-dropzone__message,
.crm-dropzone.dz-drag-hover .dz-message,
.crm-dropzone.drag-over .doc-slot-dropzone__message,
.crm-dropzone.drag-over .dz-message {
    transform: translateY(-3px);
}
.crm-dropzone.file-selected {
    border-color: var(--ct-primary, #188ae2);
    border-style: solid;
    background: rgba(24, 138, 226, 0.05);
    box-shadow: 0 0 0 3px rgba(24, 138, 226, 0.14);
}
.crm-dropzone.file-selected .doc-slot-dropzone__message,
.crm-dropzone.file-selected .dz-message {
    transform: translateY(-2px);
}
.crm-dropzone.upload-error {
    border-color: var(--ct-danger, #ff5b5b);
    background: rgba(255, 91, 91, 0.05);
    box-shadow: 0 0 0 3px rgba(255, 91, 91, 0.12);
}
.crm-upload-error {
    border-left: 3px solid var(--ct-danger, #ff5b5b);
}
.crm-dropzone .dz-message {
    margin: 1.5em 0;
    color: var(--ct-gray-600, #8a969c);
}
.crm-dropzone .dz-preview {
    margin: 8px;
}
.crm-dropzone__filename {
    word-break: break-word;
}
.crm-dropzone__meta {
    display: block;
    font-size: 0.8125rem;
    color: var(--ct-gray-600, #8a969c);
}
.upload-progress-wrap[data-upload-state="error"] .upload-status {
    color: var(--ct-danger, #ff5b5b);
}
.upload-progress-wrap[data-upload-state="success"] .upload-status {
    color: var(--ct-success, #10c469);
}

/* System stack check progress */
.crm-stack-check-progress {
    border: 1px solid rgba(24, 138, 226, 0.35);
    background: rgba(24, 138, 226, 0.06);
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
}
.crm-stack-check-progress[data-stack-check-state="checking"] {
    border-color: rgba(24, 138, 226, 0.55);
    box-shadow: 0 0 0 3px rgba(24, 138, 226, 0.12);
}
.crm-stack-check-progress[data-stack-check-state="error"] {
    border-color: rgba(255, 91, 91, 0.45);
    background: rgba(255, 91, 91, 0.06);
    box-shadow: none;
}
.crm-stack-check-progress__track {
    background-color: rgba(24, 138, 226, 0.15);
}

/* Photo crop */
.crm-photo-upload-card .photo-preview-wrap {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--ct-gray-300);
    margin: 0 auto 1rem;
    background: var(--ct-gray-100);
}
.crm-photo-upload-card .photo-preview-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
#photoCropModal .crm-photo-crop-container {
    width: 100%;
    max-height: min(72vh, 560px);
    min-height: 320px;
    overflow: hidden;
    background: #2a2a2a;
}
#photoCropModal .crm-photo-crop-container img {
    display: block;
    max-width: 100%;
}
#photoCropModal .cropper-container {
    max-height: min(72vh, 560px) !important;
}
/* Settings: favicon + logo row under robots toggle */
.crm-settings-branding-row .crm-favicon-upload,
.crm-settings-branding-row .crm-logo-upload {
    min-height: 100%;
}
.crm-settings-branding-row .crm-dropzone {
    min-height: 120px;
}

/* Favicon upload (settings) */
.crm-favicon-preview-wrap {
    width: 72px;
    height: 72px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid var(--ct-gray-300);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    image-rendering: pixelated;
}
.crm-favicon-preview-img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}
.crm-favicon-dropzone {
    min-height: 110px;
    padding: 0.75rem;
}
#faviconCropModal .crm-photo-crop-container {
    width: 100%;
    max-height: min(72vh, 480px);
    min-height: 280px;
    overflow: hidden;
    background: #2a2a2a;
}
#faviconCropModal .crm-photo-crop-container img {
    display: block;
    max-width: 100%;
}

/* Logo upload (settings) */
.crm-logo-preview-wrap {
    max-width: 100%;
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 2px solid var(--ct-gray-300);
    background: #fff;
}
.crm-logo-preview-img {
    max-width: 100%;
    max-height: 56px;
    width: auto;
    height: auto;
    object-fit: contain;
}
.crm-logo-dropzone {
    min-height: 100px;
    padding: 0.75rem;
}
#logoCropModal .crm-photo-crop-container {
    width: 100%;
    max-height: min(72vh, 480px);
    min-height: 280px;
    overflow: hidden;
    background: #2a2a2a;
}
#logoCropModal .crm-photo-crop-container img {
    display: block;
    max-width: 100%;
}

#photoCropModal .cropper-view-box,
#photoCropModal .cropper-face {
    border-radius: 0;
}
#crmDocumentPdfViewer canvas {
    max-width: 100%;
    height: auto !important;
}

/* Dynamic phones */
.phone-row .btn-remove-phone {
    min-height: calc(1.5em + 0.75rem + 2px);
}

/* Page toolbar — Edit / Delete alignment */
.crm-page-toolbar {
    margin-bottom: 1rem;
}
.crm-page-actions .btn,
.crm-page-actions form {
    margin: 0;
}
.crm-page-actions form.d-inline {
    display: inline-flex !important;
    align-items: center;
}

/* Dashboard KPI cards — uniform height */
.dashboard-stat-cards .dashboard-kpi-card,
.dashboard-stat-cards > .col > .card {
    min-height: 148px;
}
.dashboard-stat-cards .dashboard-kpi-card .card-header {
    padding-top: 0.85rem;
    padding-bottom: 0.5rem;
}
.dashboard-stat-cards .dashboard-kpi-card .card-body {
    padding-top: 0.25rem;
    padding-bottom: 0.85rem;
}
.dashboard-stat-cards .dashboard-kpi-card h3 {
    font-size: 1.65rem;
    line-height: 1.2;
}
.dashboard-stat-cards .dashboard-kpi-card .header-title {
    font-size: 0.95rem;
}

/* Invoice (Adminto-style) */
.crm-invoice-card {
    border: none;
    box-shadow: var(--ct-box-shadow, 0 0.75rem 1.5rem rgba(18, 38, 63, 0.03));
}
.crm-invoice-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 600;
}
.crm-invoice-summary td {
    padding: 0.35rem 0;
}

/* Student profile — remarks & issues */
.journey-profile-notes {
    text-align: left;
}
.journey-profile-notes .journey-remarks-list,
.journey-profile-notes .journey-issues-list {
    max-height: 220px;
    overflow-y: auto;
}
.crm-counsellor-reassignment-history__list {
    max-height: 180px;
    overflow-y: auto;
}
.student-profile-panel .card-body {
    text-align: left;
}

/* Breadcrumb */
.crm-breadcrumb {
    --bs-breadcrumb-divider: '›';
    font-size: 0.8125rem;
    margin-bottom: 0;
}

.country-flag-emoji {
    font-size: 1.15rem;
    line-height: 1;
    vertical-align: -0.1em;
}
.country-flag-display {
    justify-content: center;
}

/* Student documents manager */
#student-documents-card .document-upload-slot {
    background: var(--ct-gray-50, #fafbfc);
}
#student-documents-card .doc-slot-dropzone {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
#student-documents-card .doc-slot-dropzone__message {
    pointer-events: none;
    color: var(--ct-gray-600, #8a969c);
}
#student-documents-card .doc-slot-dropzone__filename {
    word-break: break-all;
}
#student-documents-card .upload-progress-wrap .upload-percent {
    min-width: 2.5rem;
    text-align: right;
}
#student-documents-card .document-slot-row .doc-field-label {
    margin-bottom: 0.35rem;
    min-height: 1.25rem;
}
#student-documents-card .document-slot-row .form-control {
    min-height: calc(1.5em + 0.75rem + 2px);
}
#student-documents-card .doc-slot-actions-col {
    display: flex;
    flex-direction: column;
}
#student-documents-card .doc-slot-actions {
    display: flex;
    gap: 0.375rem;
    align-items: stretch;
    flex: 1 1 auto;
    min-height: calc(1.5em + 0.75rem + 2px);
}
#student-documents-card .doc-slot-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding-left: 0.65rem;
    padding-right: 0.65rem;
}
#student-documents-card .doc-slot-actions .btn-upload-doc {
    flex: 1 1 auto;
}
#student-documents-card .doc-slot-actions .btn-remove-slot {
    flex: 0 0 auto;
    width: calc(1.5em + 0.75rem + 2px);
    min-width: calc(1.5em + 0.75rem + 2px);
    padding-left: 0;
    padding-right: 0;
}
#student-documents-card .file-selected-name {
    display: block;
    min-height: 1.125rem;
    line-height: 1.125rem;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    word-break: break-all;
}
#student-documents-card #documents-list .list-group-item {
    border-left: 0;
    border-right: 0;
}
#student-documents-card #documents-list .list-group-item > div:first-child {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
    flex: 1;
}
#student-documents-card #documents-list .btn-view-doc {
    padding: 0.15rem 0.4rem;
    line-height: 1;
}
#student-documents-card #documents-list .doc-view-link {
    word-break: break-word;
}

/* Auth login — theme gradient background */
.crm-auth-page {
    margin: 0;
}
.crm-auth-gradient {
    background: linear-gradient(
        145deg,
        #1475c0 0%,
        var(--ct-primary, #188ae2) 28%,
        var(--ct-secondary, #5b69bc) 58%,
        #2a3544 100%
    );
    background-attachment: fixed;
}
.crm-auth-alerts .alert {
    border-radius: 0.5rem;
    border: none;
    margin-bottom: 0.75rem;
}
.crm-auth-alerts .alert:last-child {
    margin-bottom: 0;
}
.crm-auth-card {
    border-radius: 0.75rem;
}
.crm-auth-footer {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.crm-auth-card .alert-danger {
    border-radius: 0.5rem;
    font-size: 0.875rem;
}
.crm-auth-card .input-group .btn-outline-secondary {
    border-color: var(--ct-input-border-color, #ced4da);
}

/* Login — standard reCAPTCHA, centered, no clipping */
.crm-login-recaptcha {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 4.875rem;
    padding: 0.25rem 0;
}
.crm-login-recaptcha.is-invalid #login-recaptcha-mount > div {
    outline: 2px solid var(--ct-danger, #dc3545);
    outline-offset: 2px;
    border-radius: 0.25rem;
}
#login-recaptcha-mount {
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 304px;
    margin: 0 auto;
}
#login-recaptcha-wrap.d-none {
    display: none !important;
}

/* Settings — SEO robots toggle (switch stays inside card) */
.crm-meta-robots-toggle .form-check-input {
    float: none;
    margin-left: 0;
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
}
.crm-footer-solution-row .crm-footer-version {
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0.85;
}

.crm-meta-robots-toggle .form-check.form-switch {
    padding-left: 0;
    min-height: auto;
}

/* Scroll targets sit below fixed topbar */
#crm-page-alerts {
    scroll-margin-top: 5.5rem;
}

.crm-connection-banner {
    position: fixed;
    top: var(--ct-topbar-height, 70px);
    left: 0;
    right: 0;
    z-index: 1045;
    padding: 0.5rem 1rem;
    background: #fff3cd;
    border-bottom: 1px solid #ffe69c;
    color: #664d03;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.crm-connection-banner__inner,
.crm-connection-toast__inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    max-width: 960px;
    margin: 0 auto;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.crm-connection-toast {
    position: fixed;
    top: calc(var(--ct-topbar-height, 70px) + 0.75rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1050;
    min-width: min(320px, calc(100vw - 2rem));
}

.crm-connection-toast__inner {
    padding: 0.65rem 1rem;
    border-radius: 0.5rem;
    background: #d1e7dd;
    border: 1px solid #a3cfbb;
    color: #0f5132;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.crm-connection-banner__icon,
.crm-connection-toast__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.crm-login-blocked-banner {
    position: fixed;
    top: var(--ct-topbar-height, 70px);
    left: 0;
    right: 0;
    z-index: 1046;
    padding: 0.65rem 1rem;
    background: #f8d7da;
    border-bottom: 1px solid #f1aeb5;
    color: #58151c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.crm-login-blocked-banner__inner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 1100px;
    margin: 0 auto;
}

.crm-login-blocked-banner__icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: #dc3545;
}

.crm-login-blocked-banner__content {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
}

.crm-login-blocked-banner__title {
    display: block;
    margin-bottom: 0.15rem;
}

.crm-login-blocked-banner__text {
    display: block;
    margin-bottom: 0.35rem;
}

.crm-login-blocked-banner__list {
    padding-left: 1.1rem;
    font-size: 0.8125rem;
}

.crm-login-blocked-banner__link {
    color: #842029;
    font-weight: 600;
    text-decoration: underline;
}

.crm-login-blocked-banner__link:hover {
    color: #58151c;
}

.crm-password-rotation-banner {
    position: fixed;
    top: var(--ct-topbar-height, 70px);
    left: 0;
    right: 0;
    z-index: 1045;
    padding: 0.65rem 1rem;
    background: #fff3cd;
    border-bottom: 1px solid #ffecb5;
    color: #664d03;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.crm-password-rotation-banner__inner {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 1100px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.crm-password-rotation-banner__icon {
    font-size: 1.35rem;
    flex-shrink: 0;
    color: var(--ct-primary, #188ae2);
    margin-top: 0.1rem;
}

.crm-password-rotation-banner__content {
    flex: 1 1 200px;
    min-width: 0;
}

.crm-password-rotation-banner__title {
    display: block;
    margin-bottom: 0.15rem;
}

.crm-password-rotation-banner__text {
    font-size: 0.875rem;
}

.topbar-notifications--alert .ri-notification-snooze-line {
    color: var(--ct-danger, #ff5b5b);
}

.noti-icon-badge--danger {
    background-color: var(--ct-danger, #ff5b5b) !important;
}

.crm-2fa-qr-box .crm-2fa-qr-server svg {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Logos: wide mark in expanded sidebar, square icon when collapsed */
.sidenav-menu .logo,
.app-topbar .logo {
    overflow: hidden;
}
.crm-logo-img--lg {
    height: var(--ct-logo-lg-height, 22px);
    max-width: min(220px, calc(var(--ct-sidenav-width, 245px) - 44px));
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}
.crm-logo-img--sm {
    height: var(--ct-logo-sm-height, 28px);
    max-width: calc(var(--ct-sidenav-width-sm, 80px) - 24px);
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}
html[data-sidenav-size="condensed"]:not([data-layout="topnav"]) .sidenav-menu .logo,
html[data-sidenav-size="sm"]:not([data-layout="topnav"]) .sidenav-menu .logo,
html[data-sidenav-size="sm-hover"]:not([data-layout="topnav"]) .sidenav-menu:not(:hover) .logo {
    padding-left: 12px;
    padding-right: 12px;
    text-align: center;
}
html[data-sidenav-size="condensed"]:not([data-layout="topnav"]) .sidenav-menu .logo .crm-logo-img--sm,
html[data-sidenav-size="sm"]:not([data-layout="topnav"]) .sidenav-menu .logo .crm-logo-img--sm,
html[data-sidenav-size="sm-hover"]:not([data-layout="topnav"]) .sidenav-menu:not(:hover) .logo .crm-logo-img--sm {
    display: block;
    margin-left: auto;
    margin-right: auto;
    max-width: 52px;
    max-height: 28px;
}
html[data-sidenav-size="condensed"]:not([data-layout="topnav"]) .sidenav-menu .logo span.logo-lg,
html[data-sidenav-size="sm"]:not([data-layout="topnav"]) .sidenav-menu .logo span.logo-lg,
html[data-sidenav-size="sm-hover"]:not([data-layout="topnav"]) .sidenav-menu:not(:hover) .logo span.logo-lg {
    display: none !important;
}
html[data-sidenav-size="condensed"]:not([data-layout="topnav"]) .sidenav-menu .logo span.logo-sm,
html[data-sidenav-size="sm"]:not([data-layout="topnav"]) .sidenav-menu .logo span.logo-sm,
html[data-sidenav-size="sm-hover"]:not([data-layout="topnav"]) .sidenav-menu:not(:hover) .logo span.logo-sm {
    display: block !important;
}

/* Six-box OTP input */
.crm-otp {
    display: flex;
    gap: 0.45rem;
    justify-content: center;
    flex-wrap: nowrap;
    padding: 0 0.75rem;
    margin: 0 auto;
    max-width: 19.5rem;
    box-sizing: border-box;
}

.crm-otp-digit {
    flex: 1 1 0;
    width: 2.5rem;
    max-width: 2.65rem;
    height: 3.1rem;
    padding: 0;
    text-align: center;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
    color: var(--ct-body-color, #313a46);
    background: var(--ct-gray-100, #f2f4f7);
    border: 1px solid var(--ct-gray-300, #e0e4ea);
    border-radius: 0.65rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.crm-otp-digit:focus {
    outline: none;
    background: #fff;
    border-color: var(--ct-primary, #188ae2);
    box-shadow: 0 0 0 3px rgba(24, 138, 226, 0.15);
}

.crm-otp--has-error .crm-otp-digit {
    border-color: var(--ct-danger, #f15776);
}

.crm-otp--has-error .crm-otp-digit:focus {
    box-shadow: 0 0 0 3px rgba(241, 87, 118, 0.15);
}

.crm-otp-form--submitting .crm-otp-digit {
    opacity: 0.72;
    cursor: wait;
}

.crm-otp-form--submitting [data-crm-otp-submit-btn] {
    pointer-events: none;
}

.crm-otp--locked .crm-otp-digit {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--ct-gray-200, #e8ebf0);
}

.crm-otp-submit-loading {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 380px) {
    .crm-otp {
        gap: 0.3rem;
        padding: 0 0.5rem;
        max-width: 100%;
    }

    .crm-otp-digit {
        width: 2.1rem;
        max-width: 2.25rem;
        height: 2.75rem;
        font-size: 1.1rem;
    }
}

/* Condensed sidebar: theme uses position:absolute so icons scroll away with the page */
html[data-sidenav-size="condensed"]:not([data-layout="topnav"]) .sidenav-menu,
html[data-sidenav-size="sm"]:not([data-layout="topnav"]) .sidenav-menu {
    position: fixed !important;
    top: 0;
    bottom: 0;
    left: 0;
}

/* Sidebar drag-and-drop reorder (Super Admin) */
.crm-nav-draggable {
    position: relative;
}

.crm-menu-drag-handle {
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1rem;
    height: 1.5rem;
    color: var(--ct-gray-500, #9095a0);
    cursor: grab;
    opacity: 0.55;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.crm-menu-drag-handle:active {
    cursor: grabbing;
}

.crm-nav-draggable:hover .crm-menu-drag-handle,
.crm-nav-chosen .crm-menu-drag-handle {
    opacity: 1;
    color: var(--ct-primary, #188ae2);
}

.side-nav-item.crm-nav-draggable > .side-nav-link {
    padding-left: 1.65rem;
}

.crm-nav-divider {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-left: 0.25rem !important;
}

.crm-nav-divider .crm-menu-drag-handle {
    position: static;
    transform: none;
    flex-shrink: 0;
}

.crm-nav-ghost {
    opacity: 0.45;
    background: rgba(24, 138, 226, 0.06);
    border-radius: 0.375rem;
}

.crm-nav-chosen {
    background: rgba(24, 138, 226, 0.04);
    border-radius: 0.375rem;
}

.crm-sidebar-sort-hint {
    border-top: 1px dashed var(--ct-gray-300, #e0e4ea);
    padding-top: 0.75rem !important;
    margin-top: 0.25rem;
}

html[data-sidenav-size="condensed"]:not([data-layout="topnav"]) .crm-sidebar-sort-hint,
html[data-sidenav-size="sm"]:not([data-layout="topnav"]) .crm-sidebar-sort-hint,
html[data-sidenav-size="sm-hover"]:not([data-layout="topnav"]) .sidenav-menu:not(:hover) .crm-sidebar-sort-hint {
    display: none !important;
}

/* Student profile tabs (show page) */
.crm-student-tabs-header {
    padding-bottom: 0 !important;
}

.crm-student-tabs {
    border-bottom: 2px solid var(--ct-border-color, #eef2f7);
    gap: 0.35rem;
    margin-bottom: 0;
}

.crm-student-tabs .nav-link {
    border: 1px solid var(--ct-gray-300, #e7e9eb);
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    color: var(--ct-gray-700, #6c757d);
    font-weight: 600;
    padding: 0.7rem 1.2rem;
    margin-bottom: -2px;
    background: var(--ct-gray-100, #f6f7fb);
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.crm-student-tabs .nav-link:hover,
.crm-student-tabs .nav-link:focus {
    color: var(--ct-primary, #188ae2);
    background: #fff;
    border-color: var(--ct-primary, #188ae2);
}

.crm-student-tabs .nav-link.active {
    color: var(--ct-primary, #188ae2);
    background: #fff;
    border-color: var(--ct-primary, #188ae2);
    border-bottom-color: #fff;
    box-shadow: inset 0 3px 0 var(--ct-primary, #188ae2);
}

@media (max-width: 575.98px) {
    .crm-student-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    .crm-student-tabs .nav-link {
        white-space: nowrap;
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }
}

/* Inline validation highlights */
.crm-form-error-summary {
    border-radius: 0.625rem;
}

.crm-error-summary-list {
    list-style: none;
}

.crm-error-summary-item {
    padding: 0.65rem 0;
    border-top: 1px solid rgba(255, 91, 91, 0.15);
}

.crm-error-summary-item:first-child {
    border-top: 0;
    padding-top: 0;
}

.crm-error-breadcrumb {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    padding: 0;
    margin: 0 0 0.25rem;
    border: 0;
    background: transparent;
    color: #842029;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
}

.crm-error-breadcrumb:hover,
.crm-error-breadcrumb:focus {
    color: #5a1620;
    text-decoration: underline;
}

.crm-error-breadcrumb__sep {
    color: #c76a74;
    font-weight: 500;
    padding: 0 0.1rem;
}

.crm-error-breadcrumb__segment.is-field {
    color: #a52834;
}

.crm-error-summary__message {
    font-size: 0.875rem;
    color: #5c1f27;
    line-height: 1.45;
}

.crm-inline-error__path {
    margin-bottom: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #a52834;
}

.crm-inline-error__path .crm-error-breadcrumb__sep {
    color: #c76a74;
}

.crm-inline-error__message {
    font-size: 0.875rem;
}

.crm-field-error-host .form-control.is-invalid,
.crm-field-error-host .form-select.is-invalid,
.crm-field-error-host .choices.is-invalid .choices__inner {
    border-color: var(--ct-danger, #ff5b5b) !important;
    box-shadow: 0 0 0 0.15rem rgba(255, 91, 91, 0.12);
}

.crm-field-error-host {
    position: relative;
}

.crm-duplicate-tip {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% - 0.15rem);
    z-index: 20;
    margin-top: 0.15rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
    line-height: 1.35;
    color: #842029;
    background: #fff5f5;
    border: 1px solid #f1aeb5;
    border-radius: 0.45rem;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.profile-phone-group.crm-field-error-host .crm-duplicate-tip {
    top: 100%;
}

.crm-inline-error {
    font-size: 0.8125rem;
}

/* Flatpickr — polished calendar UI (system-wide) */
.flatpickr-calendar {
    border: 1px solid var(--ct-gray-300, #e7e9eb);
    border-radius: 0.75rem;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
    font-family: inherit;
    padding: 0.35rem 0.25rem 0.5rem;
    width: 18.5rem;
}

.flatpickr-months {
    padding: 0.35rem 0.5rem 0.15rem;
}

.flatpickr-months .flatpickr-month {
    height: 2.25rem;
}

.flatpickr-current-month {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    font-weight: 600;
    color: #1e293b;
}

.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month {
    top: 0.55rem;
    padding: 0.35rem;
    border-radius: 0.5rem;
    fill: #64748b;
}

.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover {
    background: rgba(24, 138, 226, 0.08);
    fill: var(--ct-primary, #188ae2);
}

span.flatpickr-weekday {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
}

.flatpickr-day {
    border-radius: 0.45rem;
    color: #334155;
    font-weight: 500;
    line-height: 2rem;
    max-width: 2rem;
    height: 2rem;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
    background: rgba(24, 138, 226, 0.1);
    border-color: transparent;
}

.flatpickr-day.today {
    border-color: rgba(24, 138, 226, 0.35);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--ct-primary, #188ae2);
    border-color: var(--ct-primary, #188ae2);
    color: #fff;
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay {
    color: #cbd5e1;
}

.flatpickr-time {
    border-top: 1px solid var(--ct-gray-200, #eef2f7);
}

input.crm-date-alt-input,
input.crm-date-input--ready + .form-control.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

input[type="date"].crm-date-input--ready {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0;
    height: 0;
    padding: 0;
    border: 0;
}

.crm-role-permissions-panel {
    max-height: 280px;
    overflow-y: auto;
}

/* List table header sort + instant filter */
.crm-list-th {
    white-space: nowrap;
    vertical-align: middle;
}
.crm-list-th .btn-link {
    text-decoration: none;
}
.crm-list-th .dropdown-menu {
    min-width: 11rem;
    max-height: 16rem;
    overflow-y: auto;
}
.crm-list-th .dropdown-item.active {
    background-color: rgba(24, 138, 226, 0.12);
    color: var(--ct-primary, #188ae2);
}
