/* ═══════════════════════════════════════════════════════════════
   custom.css — global additions & overrides
   Load this LAST, after all other CSS files.
═══════════════════════════════════════════════════════════════ */

/* ── Base font upgrade ──────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Global focus rings ─────────────────────────────────────── */
input:focus,
select:focus,
textarea:focus {
    outline: none !important;
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* ── Tab panel state (self-contained for all pages) ─────────── */
.tab-panel {
    display: none;
}
.tab-panel.active {
    display: block;
}

/* ── Modal base (works on pages that don't load admin.css) ───── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
}
.modal-content {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 28px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.28);
}

/* ── Modal pop-in animation ─────────────────────────────────── */
@keyframes modal-pop-in {
    from { opacity: 0; transform: scale(0.96) translateY(-10px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);     }
}
.modal-opening {
    animation: modal-pop-in 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* ── Login overlay upgrade ──────────────────────────────────── */
.login-overlay {
    background: rgba(15, 23, 42, 0.88) !important;
    backdrop-filter: blur(5px) !important;
}
.login-card {
    border-radius: 18px !important;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32) !important;
}

/* ── Screen fade transition (assess / learn) ────────────────── */
@keyframes screen-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0);    }
}
.screen-enter {
    animation: screen-fade-in 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Option click press feedback ────────────────────────────── */
.option-press {
    transform: scale(0.975) !important;
    transition: transform 0.08s ease !important;
}

/* ── Button depth & lift ────────────────────────────────────── */
.btn-primary {
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3), 0 1px 2px rgba(0, 0, 0, 0.08) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease !important;
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}
.btn-primary:active:not(:disabled) {
    transform: translateY(0) !important;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25) !important;
}
.btn-secondary {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease !important;
}
.btn-secondary:hover:not(:disabled) {
    transform: translateY(-1px) !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1) !important;
}
.btn-secondary:active:not(:disabled) {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
}

/* ── Quiz option — selected checkmark ──────────────────────── */
.option {
    position: relative !important;
    padding-right: 48px !important;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease !important;
}
.option:hover:not(.selected) {
    transform: translateX(2px);
}
.option::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #2563eb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='1,5 4,8 11,1'/%3E%3C/svg%3E") center/12px no-repeat;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.option.selected::after {
    transform: translateY(-50%) scale(1);
}

/* ── Progress bar — smoother easing + shimmer glint ────────── */
.progress-fill {
    position: relative !important;
    overflow: hidden !important;
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -60%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.38), transparent);
    animation: progress-glint 2.4s ease-in-out infinite 0.6s;
}
@keyframes progress-glint {
    0%   { left: -60%; }
    100% { left: 140%; }
}
.progress-bar-fill {
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ── Card hover upgrades ────────────────────────────────────── */
.admin-quiz-card {
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}
.admin-quiz-card:hover {
    border-color: #cbd5e1 !important;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.09) !important;
}
.admin-course-card {
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-course-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.09);
}
.quiz-card {
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
}
.quiz-card:hover {
    border-color: #93c5fd !important;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1) !important;
}
/* ── Portal tab bar ─────────────────────────────────────────────── */
.portal-tab-bar {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 1.5px solid #e2e8f0;
}
.portal-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1.5px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.portal-tab-btn:hover { color: #1e293b; }
.portal-tab-btn.active { color: #2563eb; border-bottom-color: #2563eb; }
.portal-pane { display: none; }
.portal-pane.active { display: block; }

.course-card {
    transition: border-color 0.18s ease, box-shadow 0.18s ease !important;
    align-items: center !important;
    gap: 16px !important;
}
.course-card:hover {
    border-color: #93c5fd !important;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1) !important;
}
.course-card-body {
    flex: 1;
    min-width: 0;
}
.course-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.course-card-top h3 { margin: 0; }
.course-card-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 8px;
    line-height: 1.4;
}
.course-pbar-wrap {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}
.course-pbar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}
.course-pbar-label {
    font-size: 11px;
    color: #94a3b8;
}

/* ── Button loading state ───────────────────────────────────── */
.btn-loading {
    position: relative !important;
    pointer-events: none !important;
    color: transparent !important;
}
.btn-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btn-spin 0.55s linear infinite;
}
.btn-secondary.btn-loading::after,
.btn-ghost.btn-loading::after {
    border-color: rgba(55, 65, 81, 0.2);
    border-top-color: #374151;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ── Skeleton loader ────────────────────────────────────────── */
.skeleton-row {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
}
.skeleton-line {
    height: 11px;
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    border-radius: 6px;
    animation: shimmer 1.5s ease infinite;
    flex: 1;
}
.skeleton-line.short {
    flex: 0 0 72px;
}
@keyframes shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

/* ── Toast notifications ────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    min-width: 256px;
    max-width: 380px;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.13);
    pointer-events: auto;
    cursor: pointer;
    animation: toast-in 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.toast-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}
.toast-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.toast-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(18px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0)    scale(1);    }
}
.toast-leaving {
    animation: toast-out 0.2s ease forwards;
    overflow: hidden;
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); max-height: 80px; }
    to   { opacity: 0; transform: translateX(18px); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; }
}

/* ── Confirm dialog ─────────────────────────────────────────── */
#confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    animation: fade-in-bg 0.15s ease;
}
@keyframes fade-in-bg {
    from { opacity: 0; }
    to   { opacity: 1; }
}
#confirm-card {
    width: 100%;
    max-width: 380px;
    padding: 28px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 28px 64px rgba(0, 0, 0, 0.26);
    animation: modal-pop-in 0.2s cubic-bezier(0.34, 1.3, 0.64, 1);
}
#confirm-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
}
#confirm-card p {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.55;
    margin: 0 0 24px;
}
#confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ── Learning portal header ─────────────────────────────────── */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.portal-header-inner {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.portal-brand {
    display: flex;
    align-items: center;
}
.portal-brand a {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    letter-spacing: -0.015em;
}
.portal-brand span {
    font-size: 13px;
    font-weight: 400;
    color: #94a3b8;
    border-left: 1px solid #e2e8f0;
    margin-left: 14px;
    padding-left: 14px;
}
.portal-user-info {
    align-items: center;
    gap: 10px;
    font-size: 13px;
}
.portal-user-name {
    color: #374151;
    font-weight: 500;
}
.portal-signout-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.portal-signout-btn:hover {
    background: #f8fafc;
    color: #374151;
    border-color: #cbd5e1;
}
.portal-profile-link {
    background: transparent;
    border: 0;
    color: #2563eb;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 2px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.portal-profile-link:hover {
    color: #1d4ed8;
}
.learner-profile-modal {
    max-width: 560px;
}
.learner-certificates {
    margin-top: 22px;
}
.learner-certificates h3 {
    color: #0f172a;
    font-size: 14px;
    margin: 0 0 10px;
}
.learner-certificate-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.learner-certificate-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: inherit;
    text-decoration: none;
}
.learner-certificate-item:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
}
.learner-certificate-item strong,
.learner-certificate-item small {
    display: block;
}
.learner-certificate-item strong {
    color: #0f172a;
    font-size: 13px;
}
.learner-certificate-item small {
    color: #64748b;
    font-size: 12px;
    margin-top: 2px;
}
.learner-certificate-item code {
    align-self: center;
    color: #2563eb;
    font-size: 11px;
    white-space: nowrap;
}
@media (max-width: 640px) {
    .learner-profile-grid {
        grid-template-columns: 1fr;
    }
    .learner-certificate-item {
        flex-direction: column;
    }
}

/* ── Learning portal screens ────────────────────────────────── */
.portal-login-wrap {
    max-width: 360px;
    margin: 16px auto 0;
}
.portal-login-eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #2563eb;
    margin-bottom: 8px !important;
}
.portal-login-heading {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin-bottom: 6px !important;
}
.portal-login-sub {
    font-size: 13px !important;
    color: #64748b !important;
    margin-bottom: 24px !important;
}
.portal-section-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.portal-section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}
.portal-section-sub {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 !important;
}
.portal-course-title {
    font-size: 1.4rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin-bottom: 16px !important;
}

/* ── Course viewer (learner) ─────────────────────────────────── */
.learning-container.is-course-screen {
    max-width: 1040px !important;
    padding: 24px 28px !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

.course-viewer-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}
.course-viewer-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-viewer {
    display: flex;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    min-height: 540px;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.lesson-sidebar {
    width: 248px;
    flex-shrink: 0;
    background: #f8fafc;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-progress-wrap {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
}
.sidebar-progress-bar {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin-bottom: 7px;
    overflow: hidden;
}
.sidebar-progress-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 2px;
    transition: width 0.5s ease;
}
.sidebar-progress-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
}

.sidebar-lesson-list {
    padding: 6px 0;
    flex: 1;
}
.sidebar-lesson-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.12s;
}
.sidebar-lesson-item:hover { background: #f1f5f9; }
.sidebar-lesson-item.is-active {
    background: #eff6ff;
    border-left-color: #2563eb;
}
.sidebar-lesson-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    margin-top: 1px;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.sidebar-lesson-item.is-active .sidebar-lesson-check {
    border-color: #2563eb;
    color: #2563eb;
}
.sidebar-lesson-item.is-complete .sidebar-lesson-check {
    background: #16a34a;
    border-color: #16a34a;
    color: #ffffff;
}
.sidebar-lesson-text { flex: 1; min-width: 0; }
.sidebar-lesson-title {
    font-size: 12.5px;
    font-weight: 500;
    color: #374151;
    line-height: 1.35;
}
.sidebar-lesson-item.is-active .sidebar-lesson-title {
    color: #1d4ed8;
    font-weight: 600;
}
.sidebar-lesson-item.is-complete .sidebar-lesson-title { color: #374151; }
.sidebar-lesson-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 2px;
}

.sidebar-block-list {
    padding: 2px 0 6px 20px;
}
.sidebar-block-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.1s;
}
.sidebar-block-item:hover { background: #f1f5f9; }
.sidebar-block-item.is-active { background: #dbeafe; }
.sidebar-block-pip {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #cbd5e1;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sidebar-block-item.is-active .sidebar-block-pip { background: #2563eb; }
.sidebar-block-label {
    font-size: 12px;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-block-item.is-active .sidebar-block-label {
    color: #1d4ed8;
    font-weight: 500;
}

.sidebar-cert-action {
    border-top: 1px solid #e5e7eb;
    padding: 14px;
}
.sidebar-cert-inner { display: flex; flex-direction: column; gap: 6px; }
.sidebar-cert-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}
.sidebar-cert-meta {
    font-size: 11px;
    color: #64748b;
    margin: 0;
}
.sidebar-cert-meta.is-passed { color: #16a34a; }
.sidebar-cert-meta.is-failed { color: #dc2626; }
.sidebar-cert-hint {
    font-size: 11px;
    color: #9ca3af;
    margin: 0;
}

/* ── Lesson main area ────────────────────────────────────────── */
.lesson-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.lesson-viewer {
    flex: 1;
    padding: 32px 40px 24px;
    overflow-y: auto;
}
.lesson-viewer-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin-bottom: 6px;
}
.lesson-viewer-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px;
    line-height: 1.25;
}
.lesson-viewer-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 24px;
}
.lesson-viewer-content { line-height: 1.65; }

.lesson-bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 40px;
    border-top: 1px solid #f1f5f9;
    background: #fafafa;
    gap: 12px;
}
.lesson-all-done-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #16a34a;
}

@keyframes lesson-complete-flash {
    0%   { background: #16a34a; border-color: #16a34a; color: #fff; transform: scale(1.03); }
    70%  { background: #16a34a; border-color: #16a34a; color: #fff; transform: scale(1.03); }
    100% { background: #16a34a; border-color: #16a34a; color: #fff; transform: scale(1); }
}
.btn-completing {
    animation: lesson-complete-flash 0.5s ease forwards !important;
    pointer-events: none;
}

@media (max-width: 720px) {
    .learning-container.is-course-screen { padding: 12px !important; }
    .course-viewer { flex-direction: column; }
    .lesson-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e5e7eb; max-height: 220px; }
    .sidebar-lesson-list { display: flex; flex-direction: row; overflow-x: auto; padding: 4px 0; gap: 0; }
    .sidebar-lesson-item { flex-direction: column; align-items: center; text-align: center; min-width: 80px; border-left: none; border-bottom: 3px solid transparent; gap: 4px; }
    .sidebar-lesson-item.is-active { border-bottom-color: #2563eb; border-left-color: transparent; }
    .sidebar-block-list { display: none; }
    .lesson-viewer { padding: 20px 18px 16px; }
    .lesson-bottom-nav { padding: 12px 18px; }
}

/* ── Landing page enhancements ──────────────────────────────── */
.landing-hero {
    background: linear-gradient(145deg, #e8f0fe 0%, #eef2f7 45%, #f0f4ff 100%);
    border-radius: 20px;
}
.landing-feature-cell {
    transition: background 0.18s ease;
    cursor: default;
}
.landing-feature-cell:hover {
    background: #f8fafc !important;
}
.landing-feature-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #eff6ff;
    border-radius: 10px;
    margin-bottom: 14px;
}

/* ── Inline course AI panel ─────────────────────────────────── */
.course-ai-panel {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 24px;
    overflow: hidden;
}

.course-ai-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: #f8fafc;
    border: none;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}
.course-ai-toggle:hover {
    background: #f1f5f9;
    color: #1e40af;
}
.course-ai-toggle svg:first-child { color: #3b82f6; flex-shrink: 0; }
.course-ai-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.course-ai-body {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}
.course-ai-body .form-group:last-of-type { margin-bottom: 12px; }
.course-ai-body textarea {
    min-height: 100px;
    resize: vertical;
}

/* Regenerate state — amber tint matching lesson-ai-regen */
.course-ai-panel.is-regen {
    border-color: #fcd34d;
}
.course-ai-panel.is-regen .course-ai-toggle {
    background: #fffbeb;
    color: #92400e;
}
.course-ai-panel.is-regen .course-ai-toggle:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}
.course-ai-panel.is-regen .course-ai-toggle svg:first-child {
    color: #d97706;
}

/* ── Per-lesson AI row ───────────────────────────────────────── */
.lesson-ai-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e2e8f0;
}

.lesson-ai-generate-btn svg { color: #3b82f6; flex-shrink: 0; }

.lesson-ai-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #475569;
}
.lesson-ai-phase { font-style: italic; }

.block-ai-generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    font-family: inherit;
    color: #64748b;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    margin-bottom: 6px;
}
.block-ai-generate-btn svg { color: #3b82f6; flex-shrink: 0; }
.block-ai-generate-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}
.block-ai-generate-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.content-block-heading-input {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    border-color: transparent;
    background: transparent;
    padding-left: 0;
}
.content-block-heading-input:hover,
.content-block-heading-input:focus {
    background: #ffffff;
    border-color: #cbd5e1;
    padding-left: 8px;
}

/* ── Course start screen ─────────────────────────────────────── */
.course-start-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 28px 32px;
    max-width: 640px;
}

.course-start-card .form-group {
    margin-bottom: 20px;
}

.course-start-card textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    resize: vertical;
    line-height: 1.55;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.course-start-card textarea:focus {
    outline: none;
    border-color: #2563eb;
}

.label-hint {
    font-size: 12px;
    font-weight: 400;
    color: #9ca3af;
}

.course-start-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.btn-ghost {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.btn-ghost:hover { color: #1f2937; }

.course-start-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #4b5563;
    padding: 4px 0;
}

/* ── Generate lesson content pulse highlight ─────────────────── */
@keyframes lesson-ai-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); background: #eff6ff; border-color: #93c5fd; }
    50%  { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); background: #eff6ff; border-color: #93c5fd; }
    100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); background: #eff6ff; border-color: #93c5fd; }
}

.lesson-ai-toggle--highlight {
    animation: lesson-ai-pulse 0.9s ease-out 0s 3 forwards;
    color: #1e40af !important;
}

/* ── Lesson / course visual hierarchy ───────────────────────── */
.lesson-block {
    background: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.lesson-content-builder {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 14px;
}

.lesson-content-builder .content-blocks-label {
    color: #475569;
}

/* ── Admin search filter ────────────────────────────────────── */
.admin-search {
    display: block;
    width: 100%;
    max-width: 340px;
    padding: 8px 12px;
    margin-bottom: 14px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-search:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.admin-search::placeholder { color: #94a3b8; }

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

/* ── Quiz preview banner ─────────────────────────────────────── */
.preview-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #1e40af;
    color: #ffffff;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    padding: 9px 16px;
    letter-spacing: 0.01em;
}

/* ── Admin sidebar layout ───────────────────────────────────── */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    inset-block: 0;
    left: 0;
    width: 220px;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.admin-sidebar-brand {
    padding: 18px 18px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}
.admin-sidebar-brand a {
    color: #f1f5f9;
    font-size: 17px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: -0.01em;
    display: block;
}
.admin-sidebar-brand span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    font-weight: 400;
}

.admin-sidebar-nav {
    flex: 1;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

/* Tab buttons in sidebar — keep .tab-btn class for JS compatibility */
.admin-sidebar .tab-btn {
    width: 100%;
    text-align: left;
    padding: 10px 13px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
}
.admin-sidebar .tab-btn:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
}
.admin-sidebar .tab-btn.active {
    background: #1e3a8a;
    color: #ffffff;
    border-bottom: none;
    box-shadow: inset 3px 0 0 #60a5fa;
}

.admin-sidebar-bottom {
    padding: 10px 8px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}
.admin-sidebar-bottom a,
.admin-sidebar-bottom button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 13px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 400;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    font-family: inherit;
}
.admin-sidebar-bottom a:hover,
.admin-sidebar-bottom button:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #e2e8f0;
}
.admin-sidebar-bottom .sidebar-danger {
    color: #fca5a5;
}
.admin-sidebar-bottom .sidebar-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.admin-main {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    min-height: 100vh;
}

.admin-topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.admin-topbar-title {
    font-size: 16px;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}
.admin-topbar .plan-summary {
    font-size: 13px;
}

.admin-content {
    padding: 28px;
    flex: 1;
}

/* Mobile sidebar */
#sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    color: #374151;
    flex-shrink: 0;
}
#sidebar-toggle svg {
    display: block;
}

@media (max-width: 768px) {
    #sidebar-toggle {
        display: flex;
    }
    .admin-sidebar {
        transform: translateX(-100%);
    }
    body.sidebar-open .admin-sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }
    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 39;
        background: rgba(0, 0, 0, 0.4);
    }
    .admin-main {
        margin-left: 0;
    }
    .admin-content {
        padding: 16px;
    }
    .section-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    .admin-search {
        max-width: 100%;
    }
}

/* ── AI coach slash-command overlay ─────────────────────────── */

/* ── Quill WYSIWYG editor ──────────────────────────────────────── */
.content-block-body-editor .ql-toolbar.ql-snow {
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 4px 6px;
    font-family: inherit;
}
.content-block-body-editor .ql-container.ql-snow {
    border: 1px solid #e5e7eb;
    border-radius: 0 0 8px 8px;
    font-family: inherit;
    font-size: 13px;
}
.content-block-body-editor .ql-container.ql-snow:focus-within {
    border-color: #2563eb;
}
.content-block-body-editor .ql-toolbar.ql-snow:has(+ .ql-container.ql-snow:focus-within) {
    border-color: #2563eb;
}
.content-block-body-editor .ql-editor {
    min-height: 160px;
    line-height: 1.6;
    padding: 8px 10px;
}
.content-block-body-editor .ql-editor.ql-blank::before {
    font-style: normal;
    color: #9ca3af;
    font-size: 13px;
}
.content-block-body-editor .ql-snow .ql-stroke {
    stroke: #6b7280;
}
.content-block-body-editor .ql-snow .ql-fill {
    fill: #6b7280;
}
.content-block-body-editor .ql-snow.ql-toolbar button:hover .ql-stroke,
.content-block-body-editor .ql-snow .ql-toolbar button:hover .ql-stroke {
    stroke: #2563eb;
}
/* Rendered lesson content (preview / learner view) */
.lesson-content.ql-editor {
    padding: 0;
    font-size: 14px;
    line-height: 1.65;
}
.lesson-content.ql-editor p { margin-bottom: 0.5em; }
.lesson-content.ql-editor ul,
.lesson-content.ql-editor ol { padding-left: 1.5em; margin-bottom: 0.5em; }
.lesson-content.ql-editor h2 { font-size: 1.15em; font-weight: 600; margin: 0.8em 0 0.3em; }
.lesson-content.ql-editor h3 { font-size: 1.05em; font-weight: 600; margin: 0.6em 0 0.25em; }

/* ── Invite link card (admin users tab) ─────────────────────────────────── */
.invite-link-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    margin-bottom: 20px;
}
.invite-link-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.invite-link-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 2px;
}
.invite-link-card-sub {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}
.invite-link-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.invite-link-input {
    flex: 1;
    font-size: 12px;
    color: #475569;
    background: #fff;
    min-width: 0;
}
.invite-link-meta {
    font-size: 11px;
    color: #94a3b8;
    margin: 6px 0 0;
}
.invite-link-disabled-msg {
    font-size: 13px;
    color: #64748b;
}

/* ── Invite link card — updated states ─────────────────────────────────── */
.invite-link-state {
    margin-top: 12px;
}
.invite-link-muted {
    font-size: 13px;
    color: #94a3b8;
    display: block;
    margin-bottom: 10px;
}
.invite-link-footer-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}
.invite-confirm-bar {
    margin-top: 12px;
    background: #fefce8;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 14px;
}
.invite-confirm-msg {
    display: block;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 10px;
    line-height: 1.5;
}
.invite-confirm-actions {
    display: flex;
    gap: 8px;
}

/* ── Admin email verification banner ────────────────────────────────────── */
.admin-verify-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    padding: 10px 20px;
    font-size: 13px;
    color: #92400e;
    line-height: 1.4;
}
.admin-verify-banner span { flex: 1; }
.admin-verify-resend {
    flex-shrink: 0;
    background: none;
    border: 1px solid #d97706;
    color: #b45309;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}
.admin-verify-resend:hover { background: #fef3c7; }
.admin-verify-resend:disabled { opacity: 0.55; cursor: default; }

/* ── Learner table badges ───────────────────────────────────────── */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-ok {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
.badge-warn {
    background: #fef9c3;
    color: #a16207;
    border: 1px solid #fde68a;
}
.user-email-cell { font-size: 13px; color: #475569; }
.user-email-none { color: #cbd5e1; }

/* ── Due date badges (learner portal) ──────────────────────────────── */
.due-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    margin-top: 6px;
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}
.due-badge--warning {
    background: #fef9c3;
    color: #a16207;
    border-color: #fde68a;
}
.due-badge--overdue {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

/* ── Admin modal: assignment rows with due dates ──────────────────── */
.assignment-row { justify-content: flex-start; }
.assignment-row-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assignment-due-label {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 500;
    color: #94a3b8;
    white-space: nowrap;
    margin-right: 2px;
}
.assignment-due-date {
    flex-shrink: 0;
    width: 130px;
    font-size: 12px;
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    color: #475569;
    background: #f8fafc;
    cursor: pointer;
}
.assignment-due-date--set {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}
.assignment-due-date:focus { outline: 2px solid #2563eb; border-color: transparent; }

/* ── Settings tab ───────────────────────────────────────────── */
.settings-page {
    max-width: 600px;
}
.settings-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 28px 28px 24px;
    margin-bottom: 24px;
}
.settings-section-heading {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
    margin: 0 0 4px;
}
.settings-section-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 20px;
    line-height: 1.5;
}
.settings-form .form-group {
    margin-bottom: 20px;
}
.settings-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}
.settings-form .form-group input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
}
.field-hint {
    font-size: 12px;
    color: #94a3b8;
    margin: 5px 0 0;
}
.settings-form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}
.settings-save-status {
    font-size: 13px;
    color: #16a34a;
    font-weight: 500;
    transition: opacity 0.3s;
}

/* Logo upload */
.logo-upload-area {
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    background: #f8fafc;
    padding: 20px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
    min-height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.logo-upload-area:hover,
.logo-upload-area.drag-over {
    border-color: #2563eb;
    background: #eff6ff;
}
.logo-upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    pointer-events: none;
    text-align: center;
}
.logo-upload-prompt span { font-size: 13px; }
.logo-upload-hint { font-size: 11px !important; color: #cbd5e1 !important; }
.logo-preview-wrap {
    position: relative;
    display: inline-flex;
}
.logo-preview-wrap img#logoPreview {
    max-height: 72px;
    max-width: 280px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
}
.logo-remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ── Certificate style controls ─────────────────────────────── */
.form-select {
    width: 100%;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #0f172a;
    background: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
    cursor: pointer;
}
.form-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.cert-color-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.cert-color-swatches {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s;
    padding: 0;
}
.color-swatch:hover  { transform: scale(1.18); }
.color-swatch.active { border-color: #0f172a; }
