/* CSS Variables */
:root {
    --rockmah-green: #2d7a3e;
    --rockmah-green-light: #4caf50;
    --ai-purple: #667eea;
    --ai-purple-dark: #764ba2;
    --google-blue: #4285f4;
    --text-dark: #111;
    --text-medium: #333;
    --text-light: #666;
    --background: #f8f9fa;
    --white: #ffffff;
    --border-light: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-medium);
    background: var(--background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow-x: hidden;
}

main {
    flex: 1;
    width: 100%;
    min-width: 0;
}

img, video, svg {
    max-width: 100%;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header & Navigation */
header {
    background: var(--text-dark);
    color: white;
    padding: 18px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    cursor: pointer;
}

.nav-toggle-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

.nav-logout {
    display: inline;
    margin: 0;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    color: white;
    letter-spacing: 0.5px;
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links a, .nav-links button {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s;
    font-size: 15px;
}

.nav-links a:hover, .nav-links button:hover {
    opacity: 1;
}

.nav-user-greeting {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-portal-link, .nav-admin-link {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    transition: background 0.2s;
    font-weight: 500;
}

.nav-portal-link:hover, .nav-admin-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-login {
    padding: 10px 24px;
    background: var(--google-blue);
    color: white !important;
    border-radius: 24px;
    font-weight: 600;
    transition: all 0.2s;
    opacity: 1 !important;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

.btn-login:hover {
    background: #357ae8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.btn-link {
    background: none;
    border: none;
    cursor: pointer;
    font: inherit;
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 4px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
}

.lang-switcher a {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 5px 8px;
    border-radius: 999px;
    opacity: 0.7;
    text-decoration: none;
    color: white;
}

.lang-switcher a:hover,
.lang-switcher a.is-active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.18);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f0f7 100%);
    padding: 80px 0 60px 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, rgba(45, 122, 62, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 50%, rgba(102, 126, 234, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--text-dark);
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.hero-highlight {
    background: linear-gradient(135deg, var(--rockmah-green) 0%, var(--ai-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto 40px;
    text-align: center;
    line-height: 1.6;
}

/* Courses Section */
.courses-section {
    background: white;
    padding: 80px 0;
}

.section-title {
    font-size: 42px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-dark);
}

.section-subtitle {
    font-size: 18px;
    color: var(--text-light);
    text-align: center;
    margin-bottom: 60px;
}

.course-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
}

.course-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.course-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: height 0.3s;
}

.course-card-excel::before {
    background: linear-gradient(90deg, var(--rockmah-green) 0%, var(--rockmah-green-light) 100%);
}

.course-card-ai::before {
    background: linear-gradient(90deg, var(--ai-purple) 0%, var(--ai-purple-dark) 100%);
}

.course-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.course-card:hover::before {
    height: 6px;
}

.course-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.course-icon {
    font-size: 48px;
}

.course-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.course-badge-excel {
    background: rgba(45, 122, 62, 0.1);
    color: var(--rockmah-green);
}

.course-badge-ai {
    background: rgba(102, 126, 234, 0.1);
    color: var(--ai-purple);
}

.course-card h3 {
    font-size: 28px;
    margin-bottom: 16px;
    color: var(--text-dark);
    font-weight: 700;
}

.course-description {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 24px;
    flex-grow: 1;
    font-size: 16px;
}

.course-features {
    list-style: none;
    padding: 0;
    margin: 0 0 32px 0;
}

.course-features li {
    padding: 10px 0;
    color: var(--text-medium);
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.feature-icon {
    color: var(--rockmah-green-light);
    font-weight: 700;
}

.btn-course {
    width: 100%;
    text-align: center;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-course-excel {
    background: var(--rockmah-green);
    color: white;
}

.btn-course-excel:hover {
    background: var(--rockmah-green-light);
    transform: scale(1.02);
}

.btn-course-ai {
    background: linear-gradient(135deg, var(--ai-purple) 0%, var(--ai-purple-dark) 100%);
    color: white;
}

.btn-course-ai:hover {
    background: linear-gradient(135deg, var(--ai-purple-dark) 0%, var(--ai-purple) 100%);
    transform: scale(1.02);
}

/* Auth Pages (Login/Register) */
.auth-container {
    min-height: calc(100vh - 200px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f0f7 100%);
    padding: 40px 20px;
}

.auth-card {
    background: white;
    padding: 48px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    max-width: 460px;
    width: 100%;
}

.auth-card-wide {
    max-width: 560px;
}

.authenticator-key {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 1.15rem;
    letter-spacing: 0.12em;
    background: #f1f5f9;
    padding: 14px 16px;
    border-radius: 12px;
    text-align: center;
    word-break: break-all;
}

.auth-steps {
    margin: 0 0 0 18px;
}

.auth-steps li {
    margin: 8px 0;
}

.recovery-codes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    list-style: none;
    margin: 0 0 24px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 16px;
    color: var(--text-light);
}

/* Google Button */
.google-btn {
    width: 100%;
    padding: 14px 20px;
    background: white;
    border: 2px solid #dadce0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-medium);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
    margin-bottom: 24px;
}

.google-btn:hover {
    background: #f8f9fa;
    border-color: #b8bcc4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.google-icon {
    width: 20px;
    height: 20px;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 28px 0;
    color: var(--text-light);
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-light);
}

.auth-divider span {
    padding: 0 16px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-medium);
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--google-blue);
    box-shadow: 0 0 0 4px rgba(66, 133, 244, 0.1);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-check label {
    font-size: 14px;
    color: var(--text-medium);
    cursor: pointer;
    margin-bottom: 0;
    font-weight: 400;
}

.form-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--google-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #357ae8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

.btn-secondary {
    width: 100%;
    padding: 14px 24px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #4b5563;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-light);
}

.auth-footer a {
    color: var(--google-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.text-danger {
    color: #dc2626;
    font-size: 14px;
    margin-top: 6px;
}

.validation-summary-errors {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.validation-summary-errors ul {
    margin: 0;
    padding-left: 20px;
}

.validation-summary-errors li {
    color: #dc2626;
    font-size: 14px;
}

/* Footer */
footer {
    background: var(--text-dark);
    color: white;
    text-align: center;
    padding: 32px 0;
    margin-top: auto;
}

.footer-main {
    font-weight: 600;
    margin-bottom: 8px;
}

.footer-legal {
    font-size: 14px;
    opacity: 0.7;
}

/* Admin Sections */
.admin-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    max-width: 100%;
    min-width: 0;
}

.error-page {
    margin-top: 32px;
    margin-bottom: 32px;
}

.request-id {
    display: block;
    margin-top: 6px;
    word-break: break-all;
    overflow-wrap: anywhere;
    font-size: 13px;
}

.admin-section h2 {
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--ai-purple) 0%, var(--ai-purple-dark) 100%);
    color: white;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 16px;
    opacity: 0.9;
}

.stat-meta {
    font-size: 14px;
    opacity: 0.7;
    margin-top: 4px;
}

/* Tables */
.table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 20px;
}

.data-table {
    width: 100%;
    min-width: 560px;
    border-collapse: collapse;
    margin-top: 0;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-dark);
}

.data-table tr:hover {
    background: #f9fafb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: #dcfce7;
    color: #166534;
}

.badge-draft {
    background: #f3f4f6;
    color: #374151;
}

.badge-paused {
    background: #fef3c7;
    color: #92400e;
}

.badge-completed {
    background: #dbeafe;
    color: #1e40af;
}

/* Cards (Admin/Generic) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.card {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.card h3 {
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.card p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.btn, .btn-danger, .btn-sm {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

.text-muted {
    color: var(--text-light);
    font-size: 14px;
}

/* Info Box */
.info-box {
    background: #eff6ff;
    border-left: 4px solid var(--google-blue);
    padding: 20px;
    border-radius: 8px;
}

.info-box h3 {
    margin-bottom: 12px;
    color: #1e40af;
}

.info-box ul {
    margin-left: 20px;
}

.info-box li {
    margin: 8px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 50px 0 40px 0;
    }

    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .section-title {
        font-size: 32px;
    }
    
    .section-subtitle {
        font-size: 16px;
    }
    
    .course-cards {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .course-card {
        padding: 30px;
    }
    
    .form-row {
        flex-direction: column;
    }

    .logo-text {
        font-size: 18px;
    }
    
    .card-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        padding: 14px 0;
        position: relative;
    }
    
    .courses-section {
        padding: 50px 0;
    }

    .auth-card {
        padding: 32px 24px;
    }

    .auth-title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 28px;
    }
    
    .container {
        padding: 0 16px;
    }
    
    .course-card {
        padding: 24px;
    }
    
    .course-icon {
        font-size: 40px;
    }
    
    .btn-course {
        padding: 12px 20px;
        font-size: 15px;
    }

    .auth-card {
        padding: 24px 20px;
    }

    .google-btn {
        padding: 12px 16px;
        font-size: 15px;
    }
}

/* P0 admin */
.admin-subnav {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 16px 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

.admin-subnav-link {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 14px;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
    font-size: 14px;
    border: 1px solid var(--border-light);
}

.admin-subnav-link:hover {
    background: #f3f4f6;
}

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn-inline {
    width: auto !important;
    display: inline-block;
}

.form-actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.stat-card-green {
    background: linear-gradient(135deg, var(--rockmah-green) 0%, var(--rockmah-green-light) 100%);
}

.stat-card-warn {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
}

.stat-card-dark {
    background: linear-gradient(135deg, #111 0%, #374151 100%);
}

.stat-value-sm {
    font-size: 28px;
}

.price-was {
    text-decoration: line-through;
    color: var(--text-light);
    margin-right: 6px;
    font-size: 13px;
}

.diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.badge-own { background: #dbeafe; color: #1e40af; }
.badge-partner { background: #ede9fe; color: #5b21b6; }
.badge-draft { background: #f3f4f6; color: #374151; }
.badge-submitted { background: #fef3c7; color: #92400e; }
.badge-changes_requested { background: #ffedd5; color: #9a3412; }
.badge-scheduled { background: #e0e7ff; color: #3730a3; }
.badge-published { background: #dcfce7; color: #166534; }
.badge-unpublished { background: #e5e7eb; color: #1f2937; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-archived { background: #f3f4f6; color: #6b7280; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-revoked { background: #fee2e2; color: #991b1b; }
.badge-frozen { background: #fef3c7; color: #92400e; }
.badge-refund { background: #fee2e2; color: #991b1b; }

.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-paid { background: #dcfce7; color: #166534; }
.badge-available { background: #e0e7ff; color: #3730a3; }
.badge-open { background: #dbeafe; color: #1e40af; }
.badge-waiting_customer { background: #fef3c7; color: #92400e; }
.badge-waiting_instructor { background: #ffedd5; color: #9a3412; }
.badge-waiting_staff { background: #e0e7ff; color: #3730a3; }
.badge-escalated { background: #fee2e2; color: #991b1b; }
.badge-closed { background: #e5e7eb; color: #1f2937; }
.badge-high { background: #fee2e2; color: #991b1b; }
.badge-normal { background: #f3f4f6; color: #374151; }
.badge-student { background: #dbeafe; color: #1e40af; }
.badge-instructor { background: #ede9fe; color: #5b21b6; }
.badge-staff { background: #dcfce7; color: #166534; }
.badge-system { background: #f3f4f6; color: #6b7280; }
.badge-kyc { background: #fef3c7; color: #92400e; }
.badge-payout { background: #e0e7ff; color: #3730a3; }
.badge-review { background: #ede9fe; color: #5b21b6; }
.badge-content { background: #dbeafe; color: #1e40af; }
.badge-other { background: #f3f4f6; color: #374151; }

.support-thread {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.support-msg {
    background: #f8faf9;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 14px 16px;
}

.support-msg p {
    margin: 0;
    white-space: pre-wrap;
}

.support-msg-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px !important;
}

.support-msg-internal {
    background: #fff7ed;
    border-color: #fed7aa;
}

.student-shell { padding-bottom: 40px; }

.player-wrap {
    position: relative;
}

.player-16x9 {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    background: #111;
    border-radius: 8px;
}

.player-16x9 iframe,
.player-16x9 video,
.player-16x9 mux-player {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.player-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    color: #f3f4f6;
    text-align: center;
}

.watermark {
    position: absolute;
    z-index: 3;
    pointer-events: none;
    opacity: 0.55;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #111;
    background: rgba(255,255,255,0.62);
    padding: 2px 8px;
    border-radius: 4px;
    max-width: 70%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    animation: watermark-drift 32s linear infinite;
}

@keyframes watermark-drift {
    0%   { top: 8%;  left: 6%;  right: auto; bottom: auto; }
    25%  { top: 14%; left: auto; right: 8%;  bottom: auto; }
    50%  { top: auto; left: 10%; right: auto; bottom: 12%; }
    75%  { top: auto; left: auto; right: 10%; bottom: 16%; }
    100% { top: 8%;  left: 6%;  right: auto; bottom: auto; }
}

.lesson-list {
    list-style: none;
    padding-left: 0;
}

.lesson-list li {
    margin: 6px 0;
}

.lesson-done { color: #166534; font-weight: 700; margin-right: 6px; }
.lesson-pending { color: #9ca3af; margin-right: 6px; }

.progress-chip {
    display: inline-block;
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
}

.comment-block {
    border-top: 1px solid #e5e7eb;
    padding: 12px 0;
}

.comment-reply {
    margin: 8px 0 8px 20px;
}

.comment-hidden {
    opacity: 0.55;
}

.cert-print {
    padding: 48px 24px;
    margin: 24px auto;
    max-width: 720px;
}

.cert-kicker {
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 700;
}

.classroom-grid {
    align-items: start;
}

@media print {
    .admin-subnav, .no-print, .site-header, header, nav, footer,
    .portal-sidebar, .portal-backdrop, .nav-toggle {
        display: none !important;
    }
    body.is-portal {
        display: block !important;
    }
    .portal-main {
        padding: 0 !important;
    }
    .cert-print {
        border: 2px solid #111;
    }
}

.cert-brand {
    border: 2px solid #111;
    text-align: center;
    padding: 32px;
}

.alert {
    background: #ecfdf5;
    color: #065f46;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
}

@media (max-width: 900px) {
    .nav-toggle {
        display: inline-flex;
        margin-left: auto;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 8px;
        padding: 8px 0 4px;
    }

    .nav-links.is-open {
        display: flex;
    }

    .nav-bar-inner {
        flex-wrap: wrap;
    }

    .nav-user-greeting {
        max-width: none;
        white-space: normal;
        padding: 4px 0;
    }

    .lang-switcher {
        justify-content: center;
        margin: 8px 0 0;
        width: 100%;
    }

    .nav-portal-link,
    .nav-admin-link,
    .btn-login,
    .nav-logout .btn-link {
        display: block;
        width: 100%;
        text-align: center;
        min-height: 44px;
        padding: 8px 14px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
    }

    .nav-logout {
        display: block;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .diff-grid {
        grid-template-columns: 1fr;
    }

    .admin-section {
        padding: 18px 14px;
        margin-bottom: 20px;
    }

    .admin-section h2,
    .container > h1 {
        font-size: 22px;
        overflow-wrap: anywhere;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .stat-value {
        font-size: 32px;
    }

    .stat-card {
        padding: 16px 12px;
    }

    .filter-bar .form-control {
        max-width: none !important;
        width: 100%;
    }

    .page-head {
        align-items: flex-start;
    }

    .btn-inline {
        max-width: 100%;
    }

    video {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 480px) {
    .data-table {
        min-width: 480px;
    }
}

/* Portal shell — lateral collapsed nav, mobile drawer */
:root {
    --portal-header-h: 64px;
    --portal-rail: 76px;
    --portal-expanded: 268px;
    --portal-bg: #0f1412;
    --portal-bg-2: #171d1a;
    --portal-line: rgba(255, 255, 255, 0.08);
    --portal-text: rgba(255, 255, 255, 0.78);
    --portal-muted: rgba(255, 255, 255, 0.48);
    --portal-accent: var(--rockmah-green);
}

body.is-admin {
    --portal-accent: #7c6bf0;
    --portal-bg: #12101c;
    --portal-bg-2: #1a1730;
}

body.is-instructor {
    --portal-accent: #0f766e;
    --portal-bg: #0f1716;
    --portal-bg-2: #142422;
}

body.is-portal {
    background: #f3f5f4;
}

body.is-portal .site-header {
    padding: 10px 0;
    padding-top: max(10px, env(safe-area-inset-top));
}

body.is-portal .nav-portal-link,
body.is-portal .nav-admin-link {
    display: none;
}

body.is-portal .nav-logout .btn-link {
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    min-height: 40px;
}

body.is-portal .nav-logout .btn-link:hover {
    background: rgba(255, 255, 255, 0.18);
}

.portal-icon-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.portal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 180;
    background: rgba(15, 20, 18, 0.48);
    backdrop-filter: blur(4px);
}

.portal-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: linear-gradient(180deg, var(--portal-bg) 0%, var(--portal-bg-2) 100%);
    color: var(--portal-text);
    z-index: 190;
}

.portal-sidebar-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 12px 12px;
    min-height: 56px;
}

.portal-kicker {
    flex: 1;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--portal-muted);
    padding-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.portal-icon-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.portal-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.portal-nav,
.portal-sidebar-foot {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.portal-nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.portal-sidebar-foot {
    border-top: 1px solid var(--portal-line);
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.portal-nav-group {
    margin: 14px 8px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--portal-muted);
}

.portal-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--portal-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.portal-nav-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: white;
}

.portal-nav-link.is-active {
    background: rgba(45, 122, 62, 0.28);
    color: white;
    box-shadow: inset 0 0 0 1px rgba(76, 175, 80, 0.35);
}

body.is-admin .portal-nav-link.is-active {
    background: rgba(124, 107, 240, 0.28);
    box-shadow: inset 0 0 0 1px rgba(124, 107, 240, 0.4);
}

body.is-instructor .portal-nav-link.is-active {
    background: rgba(15, 118, 110, 0.3);
    box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.35);
}

.portal-nav-icon {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
}

.portal-nav-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-main {
    min-width: 0;
    padding: 12px 0 48px;
}

body.is-portal .portal-main h1,
body.is-portal .portal-main .page-head h1 {
    font-size: 30px;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 8px 0 10px;
    color: var(--text-dark);
}

body.is-portal .admin-section {
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 2px rgba(15, 20, 18, 0.04);
    border-radius: 16px;
}

body.is-portal .form-check,
body.is-portal .admin-section > label,
body.is-portal form > label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 12px 0;
    line-height: 1.4;
}

.page-lead {
    color: var(--text-light);
    margin-bottom: 20px;
    max-width: 62ch;
}

.entity-list {
    display: grid;
    gap: 14px;
    margin-top: 8px;
}

.entity-card {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15, 20, 18, 0.04);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.entity-card h2,
.entity-card h3 {
    font-size: 18px;
    margin: 0 0 4px;
    color: var(--text-dark);
}

.entity-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.entity-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.entity-card .btn,
.entity-card .btn-sm,
.entity-card .btn-primary,
.entity-card .btn-secondary {
    min-height: 44px;
}

.empty-state {
    background: white;
    border: 1px dashed #d1d5db;
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    color: var(--text-light);
}

.notice-list {
    display: grid;
    gap: 12px;
}

.notice-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.notice-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.lesson-list.lesson-rows {
    display: grid;
    gap: 8px;
}

.lesson-row {
    margin: 0 !important;
}

.lesson-row-link,
.lesson-row-static {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #f8faf9;
    border: 1px solid var(--border-light);
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 600;
}

.lesson-row-link:hover {
    background: #eef6f0;
    border-color: #cfe3d4;
}

.module-block {
    margin: 20px 0;
}

.module-block h2 {
    font-size: 18px;
    margin-bottom: 10px;
}

.watch-actions {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.watch-actions .form-control {
    margin: 8px 0;
}

.action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

body.is-portal .btn,
body.is-portal .btn-sm,
body.is-portal .btn-primary,
body.is-portal .btn-secondary,
body.is-portal .btn-inline {
    min-height: 44px;
}

body.is-portal .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body.is-portal .container > .filter-bar {
    background: white;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 12px;
}

/* Mobile: off-canvas drawer. Desktop: collapsed rail. */
@media (max-width: 1023px) {
    body.is-portal .nav-toggle {
        display: inline-flex;
        margin-left: 0;
        order: 0;
    }

    body.is-portal .logo {
        order: 1;
        margin-right: auto;
    }

    body.is-portal .nav-links {
        order: 2;
    }

    body.is-portal .nav-bar-inner {
        flex-wrap: nowrap;
        gap: 10px;
    }

    body.is-portal .nav-user-greeting {
        display: none;
    }

    body.is-portal .nav-links {
        display: flex !important;
        flex-direction: row;
        align-items: center;
        width: auto;
        padding: 0;
        gap: 8px;
    }

    body.is-portal .nav-logout {
        width: auto;
        display: inline;
        margin: 0;
    }

    body.is-portal .nav-logout .btn-link {
        width: auto;
        min-height: 40px;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.1);
    }

    body.is-portal .container {
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .portal-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 88vw);
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.18);
        padding-top: env(safe-area-inset-top);
    }

    .portal-sidebar.is-open {
        transform: translateX(0);
    }

    .portal-collapse-btn {
        display: none;
    }

    body.portal-drawer-open {
        overflow: hidden;
    }

    body.is-portal .portal-main h1,
    body.is-portal .portal-main .page-head h1 {
        font-size: 24px;
    }

    body.is-portal .stats-grid {
        grid-template-columns: 1fr;
    }

    body.is-portal .page-head {
        flex-direction: column;
        align-items: stretch;
    }

    body.is-portal .page-head .btn,
    body.is-portal .page-head .btn-primary {
        width: 100%;
        text-align: center;
    }

    body.is-portal footer {
        padding: 18px 0;
    }

    body.is-portal .footer-legal {
        display: none;
    }
}

@media (min-width: 1024px) {
    body.is-portal {
        display: grid;
        grid-template-columns: var(--portal-rail) minmax(0, 1fr);
        grid-template-rows: auto 1fr auto;
        min-height: 100vh;
    }

    body.is-portal.portal-expanded {
        grid-template-columns: var(--portal-expanded) minmax(0, 1fr);
    }

    body.is-portal > .portal-backdrop {
        display: none !important;
    }

    body.is-portal > .portal-sidebar {
        grid-column: 1;
        grid-row: 1 / -1;
        position: sticky;
        top: 0;
        height: 100vh;
        overflow: hidden;
    }

    body.is-portal > .site-header {
        grid-column: 2;
        grid-row: 1;
        position: sticky;
        top: 0;
    }

    body.is-portal > main {
        grid-column: 2;
        grid-row: 2;
        min-width: 0;
    }

    body.is-portal > footer {
        grid-column: 2;
        grid-row: 3;
    }

    body.is-portal .nav-toggle,
    body.is-portal .portal-close-btn {
        display: none;
    }

    body.is-portal header .container,
    body.is-portal footer .container,
    body.is-portal .portal-main > .container {
        max-width: 1180px;
    }

    body.is-portal:not(.portal-expanded) .portal-kicker,
    body.is-portal:not(.portal-expanded) .portal-nav-text {
        display: none;
    }

    body.is-portal:not(.portal-expanded) .portal-nav-group {
        height: 1px;
        margin: 8px 18px;
        overflow: hidden;
        color: transparent;
        background: var(--portal-line);
    }

    body.is-portal:not(.portal-expanded) .portal-nav-link {
        justify-content: center;
        padding: 10px 0;
    }

    body.is-portal:not(.portal-expanded) .portal-sidebar-head {
        justify-content: center;
        padding-left: 8px;
        padding-right: 8px;
    }

    body.is-portal:not(.portal-expanded) .portal-collapse-btn {
        margin: 0;
    }

    .portal-sidebar-head {
        justify-content: space-between;
    }
}

@media (prefers-reduced-motion: reduce) {
    .portal-sidebar {
        transition: none;
    }
}
    body.is-portal .stats-grid {
        grid-template-columns: 1fr;
    }

    .entity-card-top {
        flex-direction: column;
    }

    .entity-card-top > .btn,
    .entity-card-top > .btn-primary,
    .entity-card-actions > .btn,
    .entity-card-actions > .btn-primary,
    .entity-card-actions > .btn-secondary,
    .entity-card-actions form {
        width: 100%;
    }

    .entity-card-actions form .btn,
    .entity-card-actions form .btn-inline {
        width: 100%;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions-row .btn,
    .form-actions-row .btn-inline {
        width: 100%;
    }
}

