/* ==========================================================================
   TalentHub — Modern UI Polish (polish.css)
   Tập trung: micro-animations, depth, smooth transitions, modern feel.
   Load sau tất cả portal CSS. Không thay đổi layout hay logic.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ANIMATION KEYFRAMES
   -------------------------------------------------------------------------- */

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

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

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

@keyframes pulseRing {
    0%   { box-shadow: 0 0 0 0 rgba(255, 107, 0, 0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(255, 107, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 107, 0, 0); }
}

/* --------------------------------------------------------------------------
   2. GLOBAL TRANSITION TUNING
   -------------------------------------------------------------------------- */

:root {
    --transition-fast:   0.12s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base:   0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow:   0.38s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-spring: 0.4s  cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --------------------------------------------------------------------------
   3. SIDEBAR — smooth slide + entrance animations
   -------------------------------------------------------------------------- */

/* Sidebar enter animation on page load */
.learner-sidebar,
.teacher-sidebar,
.school-sidebar,
.ent-sidebar {
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Nav links: staggered entrance */
.learner-sidebar__nav ul li,
.teacher-sidebar__nav ul li,
.school-sidebar__nav ul li,
.ent-sidebar__nav ul li {
    animation: fadeInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.learner-sidebar__nav ul li:nth-child(1)  { animation-delay: 0.06s; }
.learner-sidebar__nav ul li:nth-child(2)  { animation-delay: 0.10s; }
.learner-sidebar__nav ul li:nth-child(3)  { animation-delay: 0.14s; }
.learner-sidebar__nav ul li:nth-child(4)  { animation-delay: 0.18s; }
.learner-sidebar__nav ul li:nth-child(5)  { animation-delay: 0.22s; }
.learner-sidebar__nav ul li:nth-child(6)  { animation-delay: 0.26s; }
.learner-sidebar__nav ul li:nth-child(7)  { animation-delay: 0.30s; }
.learner-sidebar__nav ul li:nth-child(n+8){ animation-delay: 0.32s; }

.teacher-sidebar__nav ul li:nth-child(1)  { animation-delay: 0.06s; }
.teacher-sidebar__nav ul li:nth-child(2)  { animation-delay: 0.10s; }
.teacher-sidebar__nav ul li:nth-child(3)  { animation-delay: 0.14s; }
.teacher-sidebar__nav ul li:nth-child(4)  { animation-delay: 0.18s; }
.teacher-sidebar__nav ul li:nth-child(n+5){ animation-delay: 0.22s; }

.school-sidebar__nav ul li:nth-child(1)   { animation-delay: 0.06s; }
.school-sidebar__nav ul li:nth-child(2)   { animation-delay: 0.10s; }
.school-sidebar__nav ul li:nth-child(3)   { animation-delay: 0.14s; }
.school-sidebar__nav ul li:nth-child(4)   { animation-delay: 0.18s; }
.school-sidebar__nav ul li:nth-child(5)   { animation-delay: 0.22s; }
.school-sidebar__nav ul li:nth-child(n+6) { animation-delay: 0.26s; }

.ent-sidebar__nav ul li:nth-child(1)      { animation-delay: 0.06s; }
.ent-sidebar__nav ul li:nth-child(2)      { animation-delay: 0.10s; }
.ent-sidebar__nav ul li:nth-child(3)      { animation-delay: 0.14s; }
.ent-sidebar__nav ul li:nth-child(4)      { animation-delay: 0.18s; }
.ent-sidebar__nav ul li:nth-child(5)      { animation-delay: 0.22s; }
.ent-sidebar__nav ul li:nth-child(n+6)    { animation-delay: 0.26s; }

/* --------------------------------------------------------------------------
   4. CARDS — smooth hover với spring physics
   -------------------------------------------------------------------------- */

.card--hoverable {
    transition:
        transform    var(--transition-spring),
        box-shadow   var(--transition-base),
        border-color var(--transition-fast);
}

.card--hoverable:hover {
    transform: translateY(-3px) scale(1.005);
    box-shadow:
        0 4px 6px  -1px rgba(15, 23, 42, 0.06),
        0 10px 28px -4px rgba(15, 23, 42, 0.10),
        0 0 0 1px rgba(255, 107, 0, 0.06);
}

/* KPI cards */
.teacher-kpi-card,
.school-kpi-card,
.ent-metric-card,
.learner-kpi-card,
.stat-card {
    transition:
        transform    var(--transition-spring),
        box-shadow   var(--transition-base),
        border-color var(--transition-fast);
}

.teacher-kpi-card:hover,
.school-kpi-card:hover,
.ent-metric-card:hover,
.learner-kpi-card:hover,
.stat-card:hover {
    transform: translateY(-3px) scale(1.01);
}

/* Page entrance animation cho main content */
.learner-content,
.teacher-body,
.school-body,
.ent-body {
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: 0.05s;
}

/* Section boxes */
.teacher-section-box,
.school-section-box,
.section-box,
.ent-featured-talents-box {
    transition:
        box-shadow   var(--transition-base),
        border-color var(--transition-fast),
        transform    var(--transition-spring);
}

.teacher-section-box:hover,
.school-section-box:hover,
.section-box:hover {
    transform: translateY(-1px);
    box-shadow:
        0 4px 12px rgba(15, 23, 42, 0.06),
        0 1px 3px  rgba(15, 23, 42, 0.04);
}

/* --------------------------------------------------------------------------
   5. BUTTONS — crisp, responsive feel
   -------------------------------------------------------------------------- */

.btn {
    transition:
        background-color var(--transition-fast),
        border-color     var(--transition-fast),
        color            var(--transition-fast),
        transform        var(--transition-spring),
        box-shadow       var(--transition-base);
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    transition-duration: 0.08s;
}

/* Primary: pulse on click */
.btn-primary:active:not(:disabled) {
    animation: pulseRing 0.4s ease-out;
}

/* --------------------------------------------------------------------------
   6. ACCOUNT DROPDOWN — smooth pop
   -------------------------------------------------------------------------- */

.learner-account-menu.is-open,
.teacher-account-menu.is-open,
.school-account-menu.is-open,
.ent-account-menu.is-open {
    animation: scaleIn 0.18s cubic-bezier(0.4, 0, 0.2, 1) both;
    transform-origin: top right;
}

/* Items: stagger */
.learner-account-menu__list li,
.teacher-account-menu__list li,
.school-account-menu__list li,
.ent-account-menu__list li {
    animation: fadeInDown 0.15s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.learner-account-menu__list li:nth-child(1),
.teacher-account-menu__list li:nth-child(1),
.school-account-menu__list li:nth-child(1),
.ent-account-menu__list li:nth-child(1)  { animation-delay: 0.04s; }

.learner-account-menu__list li:nth-child(2),
.teacher-account-menu__list li:nth-child(2),
.school-account-menu__list li:nth-child(2),
.ent-account-menu__list li:nth-child(2)  { animation-delay: 0.08s; }

/* --------------------------------------------------------------------------
   7. BADGES & STATUS PILLS — soft pop
   -------------------------------------------------------------------------- */

.badge,
.teacher-status-pill,
.school-class-badge,
.ent-metric-card__trend {
    transition:
        transform    var(--transition-spring),
        box-shadow   var(--transition-fast),
        background-color var(--transition-fast);
}

.badge:hover {
    transform: scale(1.05);
}

/* --------------------------------------------------------------------------
   8. FORM INPUTS — focus ring animation
   -------------------------------------------------------------------------- */

.form-input,
.form-select,
.form-textarea,
.auth-field input,
.auth-field select {
    transition:
        border-color     var(--transition-fast),
        box-shadow       0.2s cubic-bezier(0.4, 0, 0.2, 1),
        background-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    box-shadow:
        0 0 0 3px rgba(255, 107, 0, 0.15),
        0 1px 2px rgba(15, 23, 42, 0.04) inset;
}

/* --------------------------------------------------------------------------
   9. TABS — sliding indicator
   -------------------------------------------------------------------------- */

.tab-btn {
    transition:
        color            var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow       var(--transition-base),
        transform        var(--transition-spring);
}

.tab-btn.is-active {
    animation: scaleIn 0.15s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* --------------------------------------------------------------------------
   10. MODALS — smooth entrance
   -------------------------------------------------------------------------- */

.modal-backdrop.is-open .modal {
    animation: scaleIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    transform-origin: center top;
}

/* --------------------------------------------------------------------------
   11. HEADER — sticky với glassmorphism transition
   -------------------------------------------------------------------------- */

.learner-header,
.teacher-header,
.school-header,
.ent-header {
    transition:
        background-color var(--transition-base),
        box-shadow       var(--transition-base);
}

/* --------------------------------------------------------------------------
   12. PROGRESS BARS — animated fill
   -------------------------------------------------------------------------- */

.progress-fill,
.learner-progress > span {
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --------------------------------------------------------------------------
   13. SKELETON — smoother shimmer
   -------------------------------------------------------------------------- */

@keyframes shimmerModern {
    0%   { background-position: -800px 0; }
    100% { background-position: 800px 0; }
}

.skeleton {
    background: linear-gradient(
        90deg,
        #f1f5f9 0%,
        #e8ecf0 20%,
        #f8fafc 40%,
        #e8ecf0 60%,
        #f1f5f9 80%
    );
    background-size: 800px 100%;
    animation: shimmerModern 1.4s linear infinite;
}

/* --------------------------------------------------------------------------
   14. TOAST — bounce in
   -------------------------------------------------------------------------- */

.toast.is-visible {
    animation: fadeInUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.portal-toast.is-visible,
.school-toast.is-visible,
.teacher-toast.is-visible,
.ent-toast.is-visible {
    animation: fadeInUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* --------------------------------------------------------------------------
   15. ICON BUTTONS — hover rotation for brand mark
   -------------------------------------------------------------------------- */

.learner-brand__mark,
.teacher-sidebar__brand .site-header__brand-icon,
.school-sidebar__brand  .site-header__brand-icon,
.ent-sidebar__brand     .site-header__brand-icon,
.brand-mark {
    transition: transform var(--transition-spring), box-shadow var(--transition-base);
}

.learner-brand:hover .learner-brand__mark,
.teacher-sidebar__brand .site-header__brand:hover .site-header__brand-icon,
.school-sidebar__brand  .site-header__brand:hover .site-header__brand-icon,
.ent-sidebar__brand     .site-header__brand:hover .site-header__brand-icon,
.brand:hover .brand-mark {
    transform: rotate(10deg) scale(1.08);
    box-shadow:
        0 4px 14px rgba(255, 107, 0, 0.40),
        0 0 0 4px rgba(255, 107, 0, 0.12);
}

/* --------------------------------------------------------------------------
   16. SIDEBAR NAV LINKS — slide feedback
   -------------------------------------------------------------------------- */

.teacher-sidebar__link,
.school-sidebar__link,
.ent-sidebar__link,
.learner-sidebar__link {
    transition:
        background-color var(--transition-fast),
        color            var(--transition-fast),
        transform        var(--transition-spring),
        box-shadow       var(--transition-base);
}

.teacher-sidebar__link:hover:not(.is-active),
.school-sidebar__link:hover:not(.is-active),
.ent-sidebar__link:hover:not(.is-active),
.learner-sidebar__link:hover:not(.is-active) {
    transform: translateX(3px);
}

/* Active: subtle scale */
.teacher-sidebar__link.is-active,
.school-sidebar__link.is-active,
.ent-sidebar__link.is-active,
.learner-sidebar__link.is-active {
    animation: fadeInUp 0.2s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* --------------------------------------------------------------------------
   17. NOTIFICATION DOT — pulse animation
   -------------------------------------------------------------------------- */

.learner-notification-dot,
.teacher-header__badge,
.school-header__badge,
.ent-header__badge {
    animation: pulseRing 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --------------------------------------------------------------------------
   18. EMPTY STATE ICON — float
   -------------------------------------------------------------------------- */

@keyframes floatY {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

.empty-state__icon,
.teacher-empty-state__icon {
    animation: floatY 3s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   19. SCROLL BEHAVIOR — smooth + momentum
   -------------------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-height) + 1rem);
}

.learner-sidebar__nav,
.teacher-sidebar__nav,
.school-sidebar__nav,
.ent-sidebar__nav {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --------------------------------------------------------------------------
   20. TABLE ROWS — hover transition
   -------------------------------------------------------------------------- */

.data-table tbody tr,
.teacher-students-table tbody tr,
.school-class-table tbody tr {
    transition: background-color var(--transition-fast);
}

/* --------------------------------------------------------------------------
   21. LANDING PAGE — hero animations
   -------------------------------------------------------------------------- */

.hero-content {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.hero-visual {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

.hero-badge {
    animation: scaleIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) 0.05s both;
}

.stats-strip {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.15s both;
}

.bento-card {
    animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) both;
    transition:
        transform    var(--transition-spring),
        box-shadow   var(--transition-base),
        border-color var(--transition-fast);
}

.bento-card:nth-child(1) { animation-delay: 0.05s; }
.bento-card:nth-child(2) { animation-delay: 0.10s; }
.bento-card:nth-child(3) { animation-delay: 0.15s; }
.bento-card:nth-child(4) { animation-delay: 0.20s; }
.bento-card:nth-child(5) { animation-delay: 0.25s; }

.bento-card:hover {
    transform: translateY(-5px) scale(1.005);
    box-shadow:
        0 8px 16px -2px rgba(15, 23, 42, 0.08),
        0 20px 40px -8px rgba(255, 107, 0, 0.10);
}

/* --------------------------------------------------------------------------
   22. AUTH FORM — input field animations
   -------------------------------------------------------------------------- */

.auth-field {
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.auth-form .auth-field:nth-child(1) { animation-delay: 0.05s; }
.auth-form .auth-field:nth-child(2) { animation-delay: 0.10s; }
.auth-form .auth-field:nth-child(3) { animation-delay: 0.15s; }
.auth-form .auth-field:nth-child(4) { animation-delay: 0.20s; }
.auth-form .auth-field:nth-child(n+5){ animation-delay: 0.25s; }

.auth-submit {
    transition:
        background    var(--transition-fast),
        box-shadow    var(--transition-base),
        transform     var(--transition-spring);
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-1px);
}

.auth-submit:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

/* --------------------------------------------------------------------------
   23. CHEVRON ROTATION — account trigger
   -------------------------------------------------------------------------- */

.learner-header__chevron,
.teacher-header__chevron,
.school-header__chevron,
.ent-header__chevron {
    transition: transform var(--transition-base), color var(--transition-fast);
}

/* --------------------------------------------------------------------------
   24. FOCUS VISIBLE — sharp, branded
   -------------------------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255, 107, 0, 0.15);
    border-radius: var(--radius-xs);
    transition: box-shadow var(--transition-fast), outline var(--transition-fast);
}

/* --------------------------------------------------------------------------
   25. SCROLL INDICATOR — thin top progress bar
   -------------------------------------------------------------------------- */

html::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, #FF8C38 50%, var(--primary-hover) 100%);
    z-index: calc(var(--z-toast) + 10);
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

/* Activated by JS — class .page-loading on <html> */
html.page-loading::before {
    opacity: 1;
    animation: pageLoadBar 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes pageLoadBar {
    0%   { transform: scaleX(0); }
    60%  { transform: scaleX(0.8); }
    100% { transform: scaleX(1); opacity: 0; }
}

/* --------------------------------------------------------------------------
   26. ACCESSIBILITY — reduced motion override
      Tất cả animation tắt khi prefers-reduced-motion
   -------------------------------------------------------------------------- */

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

    .learner-notification-dot,
    .teacher-header__badge,
    .school-header__badge,
    .ent-header__badge,
    .empty-state__icon,
    .teacher-empty-state__icon {
        animation: none !important;
    }
}

/* --------------------------------------------------------------------------
   27. SURFACE REFINEMENT — calmer depth and stronger visual hierarchy
   -------------------------------------------------------------------------- */

body {
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 107, 0, 0.045), transparent 28rem),
        var(--background);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.learner-header,
.teacher-header,
.school-header,
.ent-header,
.topbar {
    background: rgba(255, 255, 255, 0.86);
    border-bottom-color: rgba(226, 232, 240, 0.82);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.025), 0 8px 24px rgba(15, 23, 42, 0.035);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.learner-card,
.teacher-section-box,
.school-section-box,
.ent-featured-talents-box,
.card,
.stat-card,
.bento-card {
    border-color: rgba(203, 213, 225, 0.78);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.035), 0 8px 24px rgba(15, 23, 42, 0.035);
}

.learner-card:hover,
.teacher-section-box:hover,
.school-section-box:hover,
.ent-featured-talents-box:hover,
.card:hover,
.stat-card:hover {
    border-color: rgba(255, 107, 0, 0.24);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(255, 107, 0, 0.04);
}

.learner-header__right,
.teacher-header__right,
.school-header__right,
.ent-header__right {
    min-width: 0;
}

@media (max-width: 640px) {
    body {
        background: var(--background);
    }

    .learner-card,
    .teacher-section-box,
    .school-section-box,
    .ent-featured-talents-box,
    .card,
    .stat-card {
        box-shadow: var(--shadow-sm);
    }

    .learner-header,
    .teacher-header,
    .school-header,
    .ent-header,
    .topbar {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, 0.98);
    }
}

/* --------------------------------------------------------------------------
   28. PRODUCT POLISH — hierarchy, controls and dense-data readability
   -------------------------------------------------------------------------- */

.page-header,
.portal-welcome,
.learner-welcome,
.teacher-welcome {
    position: relative;
}

.page-header__title,
.portal-welcome__title,
.learner-welcome__title,
.teacher-welcome__title {
    letter-spacing: -0.025em;
}

.page-header__subtitle,
.portal-welcome__subtitle,
.learner-welcome__subtitle,
.teacher-welcome__subtitle {
    max-width: 68ch;
}

.form-input,
.form-select,
.form-textarea,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    transition:
        border-color var(--transition-fast),
        box-shadow var(--transition-base),
        background-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.14), 0 3px 10px rgba(15, 23, 42, 0.06);
}

.data-table,
.teacher-students-table,
.school-class-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th,
.teacher-students-table thead th,
.school-class-table thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.data-table tbody tr:hover,
.teacher-students-table tbody tr:hover,
.school-class-table tbody tr:hover {
    background: rgba(255, 107, 0, 0.035);
}

.learner-sidebar__link,
.teacher-sidebar__link,
.school-sidebar__link,
.ent-sidebar__link {
    border: 1px solid transparent;
}

.learner-sidebar__link:focus-visible,
.teacher-sidebar__link:focus-visible,
.school-sidebar__link:focus-visible,
.ent-sidebar__link:focus-visible {
    border-color: rgba(255, 107, 0, 0.42);
    box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.12);
}

@media (hover: hover) {
    .btn-primary:hover:not(:disabled),
    .auth-submit:hover:not(:disabled) {
        filter: saturate(1.04);
    }

    .portal-notifications-panel {
        position: absolute;
        top: calc(100% + 0.625rem);
        right: 0;
        z-index: var(--z-dropdown, 1000);
        width: min(22rem, calc(100vw - 2rem));
        overflow: hidden;
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        background: var(--surface);
        box-shadow: var(--shadow-lg);
    }

    .learner-header__notif,
    .teacher-header__notif,
    .school-header__notif,
    .ent-header__notif {
        position: relative;
    }

    .portal-notifications-panel[hidden] { display: none; }
    .portal-notifications-panel__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.875rem 1rem;
        border-bottom: 1px solid var(--border);
        color: var(--text-primary);
    }
    .portal-notifications-panel__close {
        border: 0;
        background: transparent;
        color: var(--text-muted);
        font-size: 1.25rem;
        line-height: 1;
        cursor: pointer;
    }
    .portal-notifications-panel__list { margin: 0; padding: 0; list-style: none; }
    .portal-notifications-panel__list li {
        display: grid;
        gap: 0.2rem;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border);
    }
    .portal-notifications-panel__list li:last-child { border-bottom: 0; }
    .portal-notifications-panel__list span { color: var(--text-secondary); font-size: var(--text-sm); }
}

/* Shared ver2 theme: warm product surfaces and orange-first navigation. */
:root {
    --primary: #c2410c;
    --primary-hover: #9a3412;
    --primary-light: #fff7ed;
    --primary-dark: #7c2d12;
    --secondary: #2563eb;
    --secondary-hover: #1d4ed8;
    --secondary-light: #eff6ff;
    --background: #fffaf5;
    --surface: #ffffff;
    --surface-hover: #fff7ed;
    --text-primary: #1c1917;
    --text-main: #1c1917;
    --text-secondary: #57534e;
    --text-muted: #78716c;
    --border: #e7e5e4;
    --border-strong: #cfc8c2;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgb(28 25 23 / 0.06);
    --shadow-md: 0 12px 28px rgb(28 25 23 / 0.10);
    --shadow-lg: 0 20px 44px rgb(28 25 23 / 0.14);
    --focus-ring: 0 0 0 2px #fff, 0 0 0 5px #c2410c;
    --brand-icon-bg: linear-gradient(135deg, #c2410c 0%, #9a3412 100%);
    --brand-name-hub-color: #c2410c;
}

body:not(.landing-page) {
    background:
        radial-gradient(circle at 100% 0, rgb(249 115 22 / 0.07), transparent 28rem),
        var(--background);
}

body:not(.landing-page) .portal-header,
body:not(.landing-page) .teacher-header,
body:not(.landing-page) .school-header,
body:not(.landing-page) .ent-header {
    background: rgb(255 255 255 / 0.94);
    border-bottom-color: var(--border);
    box-shadow: 0 1px 0 rgb(28 25 23 / 0.04);
}

:where(.learner-sidebar, .teacher-sidebar, .school-sidebar, .ent-sidebar, .portal-sidebar) {
    background: #211914;
    border-right-color: #49352b;
}

:where(.learner-sidebar__link, .teacher-sidebar__link, .school-sidebar__link, .ent-sidebar__link) {
    color: #d6c7bf;
    border-radius: 8px;
}

:where(.learner-sidebar__link:hover, .teacher-sidebar__link:hover, .school-sidebar__link:hover, .ent-sidebar__link:hover) {
    background: #4a362b;
    color: #fff;
}

:where(.learner-sidebar__link.is-active, .teacher-sidebar__link.is-active, .school-sidebar__link.is-active, .ent-sidebar__link.is-active) {
    background: var(--primary);
    color: #fff;
    box-shadow: inset 3px 0 0 #fed7aa;
}

:where(.learner-card, .card, .section-box, .teacher-section-box, .school-section-box,
    .ent-section-box, .stat-card, .bento-card, .ent-metric-card, .metric-card) {
    border-color: var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

:where(.learner-card, .card, .section-box, .teacher-section-box, .school-section-box,
    .ent-section-box, .stat-card, .ent-metric-card, .metric-card):hover {
    border-color: #fdba74;
    box-shadow: var(--shadow-md);
}

:where(.page-header, .ent-page-header, .teacher-page-header, .school-page-header) {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

:where(.page-header__title, .ent-page-title, .teacher-page-title, .school-page-title) {
    color: var(--text-primary);
    letter-spacing: -0.035em;
}

:where(input, select, textarea) {
    border-color: var(--border-strong);
    border-radius: var(--radius-sm);
    background: #fff;
}

:where(.btn-primary, .teacher-grading-button--primary) {
    background: var(--primary);
    border-color: var(--primary);
}

:where(.btn-primary, .teacher-grading-button--primary):hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}

.auth-brand {
    background:
        radial-gradient(circle at 100% 0, rgb(249 115 22 / 0.22), transparent 22rem),
        #211914;
}

.auth-panel {
    background: var(--background);
}

.auth-eyebrow {
    color: #fb923c;
}

.auth-kicker {
    color: var(--primary);
}

.role-selection-page {
    background:
        radial-gradient(circle at 12% 8%, rgb(249 115 22 / 0.12), transparent 22rem),
        var(--background);
}

@media (prefers-reduced-motion: reduce) {
    .learner-sidebar,
    .teacher-sidebar,
    .school-sidebar,
    .ent-sidebar {
        animation: none;
    }
}

/* --------------------------------------------------------------------------
   29. RESPONSIVE — viewport stability, mobile-first fallback guards
   -------------------------------------------------------------------------- */

@media (max-width: 480px) {
    .learner-header,
    .teacher-header,
    .school-header,
    .ent-header {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .page-header__title,
    .ent-page-title,
    .teacher-page-title,
    .school-page-title {
        font-size: clamp(1.25rem, 5vw, 1.5rem);
        line-height: 1.25;
    }

    .page-header__subtitle,
    .ent-page-header__subtitle,
    .teacher-page-header__subtitle,
    .school-page-header__subtitle {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .data-table,
    .teacher-students-table,
    .school-class-table {
        font-size: 0.825rem;
    }

    .data-table thead th,
    .teacher-students-table thead th,
    .school-class-table thead th {
        padding: 0.5rem 0.625rem;
        font-size: 0.65rem;
        letter-spacing: 0.02em;
    }

    .data-table tbody td,
    .teacher-students-table tbody td,
    .school-class-table tbody td {
        padding: 0.625rem;
    }
}

@media (max-width: 768px) {
    .learner-content,
    .teacher-body,
    .school-body,
    .ent-body {
        padding: 1rem;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .page-header__actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* --------------------------------------------------------------------------
   30. OVERFLOW SAFETY — prevent horizontal scroll from long content
   -------------------------------------------------------------------------- */

.learner-card,
.teacher-section-box,
.school-section-box,
.section-box,
.card,
.stat-card,
.bento-card,
.ent-metric-card,
.metric-card {
    overflow-wrap: break-word;
    word-break: break-word;
}

.data-table,
.teacher-students-table,
.school-class-table {
    table-layout: auto;
    width: 100%;
}

/* --------------------------------------------------------------------------
   31. ACCESSIBILITY FOCUS POLISH — clear, branded focus for non-button links
   -------------------------------------------------------------------------- */

a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: var(--radius-sm, 4px);
}

/* --------------------------------------------------------------------------
   32. SMOOTH HEADER ON SCROLL — soft elevation
   -------------------------------------------------------------------------- */

body:not(.landing-page) .portal-header.is-scrolled,
body:not(.landing-page) .teacher-header.is-scrolled,
body:not(.landing-page) .school-header.is-scrolled,
body:not(.landing-page) .ent-header.is-scrolled {
    box-shadow: 0 1px 0 rgb(28 25 23 / 0.05), 0 12px 32px rgb(15 23 42 / 0.08);
}

/* --------------------------------------------------------------------------
   33. MASTER BRANDING SYNC — Logo + Role-tag đồng bộ 100% portals
   Chuẩn hoá Learner / Teacher / School / Enterprise / Admin về cùng:
   - logo width: 178px (mobile: 152px, tablet: 166px)
   - role-tag font: 0.6875rem, color primary-coral, pill 3px 12px
   - brand wrapper: flex-column centered, padding-bottom 0.875rem, border-bottom

   Lưu ý: Patch này được đặt trong polish.css vì polish.css load SAU
   các portal-specific CSS, đảm bảo override chính xác.
   -------------------------------------------------------------------------- */

:root {
    --brand-master-logo-width: 178px;
    --brand-master-padding-bottom: 0.875rem;
    --brand-master-margin-bottom: 1rem;
}

/* — Logo image: width đồng bộ tuyệt đối 178px cho mọi portal — */
.learner-sidebar__logo-img,
.teacher-sidebar__logo-img,
.school-sidebar__logo-img,
.ent-sidebar__logo-img,
img.admin-sidebar__logo-img {
    width: var(--brand-master-logo-width) !important;
    max-width: 100%;
    height: auto !important;
    object-fit: contain;
    aspect-ratio: 401 / 122;
    display: block;
    margin: 0 auto;
}

/* — Role-tag: đồng bộ typography & spacing — */
.learner-sidebar__role-tag,
.teacher-sidebar__role-tag,
.school-sidebar__role-tag,
.ent-sidebar__role-tag {
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    color: var(--primary-coral, #F83F70) !important;
    background-color: #FFF0EB !important;
    border: 1px solid #FFDACB !important;
    padding: 3px 12px !important;
    border-radius: 999px !important;
    letter-spacing: 0.02em !important;
    line-height: 1.4 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 8px auto 0 auto !important;
    white-space: nowrap !important;
}

/* — Brand wrapper: đảm bảo alignment & spacing chuẩn master — */
.learner-sidebar__brand,
.teacher-sidebar__brand,
.school-sidebar__brand,
.ent-sidebar__brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    text-align: center;
    padding-bottom: var(--brand-master-padding-bottom) !important;
    border-bottom: 1px solid var(--border, #F0E6DD) !important;
    margin-bottom: var(--brand-master-margin-bottom) !important;
    box-sizing: border-box;
}

/* — Brand link (clickable logo): đồng bộ hover effect — */
.learner-sidebar__brand-link,
.teacher-sidebar__brand-link,
.school-sidebar__brand-link,
.ent-sidebar__brand-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    line-height: 1 !important;
    margin: 0 auto !important;
    transition: opacity 0.15s ease, transform 0.15s ease !important;
}

.learner-sidebar__brand-link:hover,
.teacher-sidebar__brand-link:hover,
.school-sidebar__brand-link:hover,
.ent-sidebar__brand-link:hover {
    opacity: 0.92 !important;
    transform: translateY(-1px) !important;
}

/* — Header section separation: khoảng cách rõ ràng giữa brand và content — */
.learner-sidebar__brand + .learner-sidebar__nav,
.teacher-sidebar__brand + .teacher-sidebar__nav,
.school-sidebar__brand + .school-sidebar__nav,
.ent-sidebar__brand + .ent-sidebar__nav {
    margin-top: clamp(12px, 1.5vw, 16px);
}

/* — Responsive: thu nhỏ đồng bộ trên mobile — */
@media (max-width: 480px) {
    :root {
        --brand-master-logo-width: 152px;
        --brand-master-padding-bottom: 0.75rem;
        --brand-master-margin-bottom: 0.875rem;
    }
    .learner-sidebar__role-tag,
    .teacher-sidebar__role-tag,
    .school-sidebar__role-tag,
    .ent-sidebar__role-tag {
        font-size: 0.625rem !important;
        padding: 2px 10px !important;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    :root {
        --brand-master-logo-width: 166px;
    }
}

/* — Print & safety — */
@media print {
    .learner-sidebar__brand,
    .teacher-sidebar__brand,
    .school-sidebar__brand,
    .ent-sidebar__brand {
        border-bottom: 0.5pt solid #999 !important;
    }
}
