/* Admin Layout */
.admin-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
    z-index: 100;
}

.sidebar-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
    font-size: 24px;
    font-weight: 800;
    text-decoration: none;
    display: inline-block;
}

.sidebar-logo .logo-leo {
    color: #FFD700;
}

.sidebar-logo .logo-class {
    color: white;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
}

.sidebar-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
    color: white;
    background: rgba(0, 102, 255, 0.2);
}

.sidebar-link svg {
    flex-shrink: 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-1);
    color: white;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info {
    min-width: 0;
}

.sidebar-user-name {
    color: white;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.sidebar-logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-logout-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.show {
    display: block;
}

/* Main Content Area */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-light);
}

/* Topbar */
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 32px;
    height: 64px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.topbar-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-dark);
    transition: var(--transition);
}

.topbar-hamburger:hover {
    background: var(--bg-light);
}

.topbar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Admin Content */
.admin-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.stat-card-icon.schools {
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-color);
}

.stat-card-icon.users {
    background: rgba(108, 92, 231, 0.1);
    color: var(--secondary-color);
}

.stat-card-icon.classes {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
}

.stat-card-icon.active-users {
    background: rgba(255, 159, 67, 0.1);
    color: #FF9F43;
}

.stat-card-body {
    margin-bottom: 12px;
}

.stat-card-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.stat-card-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
}

.meta-active {
    color: #25D366;
    font-weight: 500;
}

.meta-inactive {
    color: var(--text-lighter);
    font-weight: 500;
}

.meta-pct {
    color: var(--primary-color);
    font-weight: 600;
}

/* Dashboard Panels */
.dashboard-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.panel {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.panel-body {
    padding: 16px 24px;
}

/* Role Breakdown */
.role-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.role-row:last-child {
    border-bottom: none;
}

.role-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    width: 140px;
    flex-shrink: 0;
}

.role-bar-track {
    flex: 1;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.role-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--gradient-1);
    transition: width 0.6s ease;
}

.role-count {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    width: 40px;
    text-align: right;
    flex-shrink: 0;
}

/* Recent Users */
.recent-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.recent-row:last-child {
    border-bottom: none;
}

.recent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.recent-info {
    flex: 1;
    min-width: 0;
}

.recent-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-email {
    font-size: 12px;
    color: var(--text-lighter);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-meta {
    text-align: right;
    flex-shrink: 0;
}

.recent-role {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(0, 102, 255, 0.08);
    color: var(--primary-color);
}

.recent-time {
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 2px;
}

/* Empty state */
.panel-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-lighter);
    font-size: 14px;
}

/* Skeleton loading */
.skeleton-row {
    height: 48px;
    background: linear-gradient(90deg, var(--bg-light) 25%, #e8eaed 50%, var(--bg-light) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    margin-bottom: 8px;
    border: none !important;
}

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

/* ========================================
   Notification Settings
   ======================================== */

/* Tab Bar */
.notif-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 28px;
    overflow-x: auto;
}

.notif-tab {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.notif-tab:hover {
    color: var(--text-dark);
}

.notif-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Panels */
.notif-panel {
    display: none;
}

.notif-panel.active {
    display: block;
}

/* Settings Form */
.settings-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 720px;
}

.settings-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-form .form-group.full-width {
    grid-column: 1 / -1;
}

.settings-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.settings-form input,
.settings-form select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.settings-form input:focus,
.settings-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: #0052cc;
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-light);
}

.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 12px;
    grid-column: 1 / -1;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 26px;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--primary-color);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}

.toggle-switch.toggle-sm {
    width: 34px;
    height: 18px;
}

.toggle-switch.toggle-sm .toggle-slider::before {
    height: 14px;
    width: 14px;
    left: 2px;
    bottom: 2px;
}

.toggle-switch.toggle-sm input:checked + .toggle-slider::before {
    transform: translateX(16px);
}


/* WhatsApp Accounts */
.wa-accounts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.wa-accounts-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 8px;
}

.wa-account-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.wa-account-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
}

.wa-account-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.08);
}

.wa-account-info {
    flex: 1;
    min-width: 0;
}

.wa-account-phone {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.wa-account-name {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

.wa-edit-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.wa-edit-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-edit-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wa-edit-input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text);
    width: 220px;
}

.wa-edit-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.wa-edit-toggles {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wa-edit-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-edit-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wa-edit-toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.wa-edit-toggle-desc {
    font-size: 11px;
    color: var(--text-lighter);
}

.wa-edit-actions {
    display: flex;
    gap: 6px;
}

.wa-account-last-connected {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 4px;
}

.wa-account-error {
    font-size: 12px;
    color: #ff4757;
    margin-top: 4px;
}

.wa-account-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.wa-account-priority {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-lighter);
}

.wa-account-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.wa-reorder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.wa-reorder-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 102, 255, 0.04);
}

.wa-reorder-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.wa-main-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-color);
    margin-left: 8px;
    vertical-align: middle;
}

.wa-account-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.wa-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.wa-status-indicator.disconnected {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

.wa-status-indicator.connected {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
}

.wa-status-indicator.connecting {
    background: rgba(255, 165, 0, 0.1);
    color: #e69500;
}

.wa-status-indicator.pairing {
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-color);
}

.wa-status-indicator.paused {
    background: rgba(255, 165, 0, 0.1);
    color: #e69500;
}

.wa-feature-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wa-feature-badge.off {
    background: rgba(150, 150, 150, 0.12);
    color: #999;
}

.wa-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.wa-status-indicator.connecting .wa-status-dot,
.wa-status-indicator.pairing .wa-status-dot,
.wa-status-dot.pulsing {
    animation: waPulse 1.5s ease-in-out infinite;
}

@keyframes waPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Add Account Form */
.wa-add-form {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.wa-add-form h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.wa-add-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.wa-add-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wa-add-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.wa-add-form input {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.wa-add-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Pairing Section */
.wa-pairing-section {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
}

.wa-pairing-section h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.wa-pairing-code {
    font-size: 36px;
    font-weight: 800;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 4px;
    color: var(--primary-color);
    margin-bottom: 16px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    border: 2px dashed var(--primary-color);
    display: inline-block;
}

.wa-pairing-instructions {
    margin-bottom: 16px;
}

.wa-pairing-instructions p {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
}

.wa-pairing-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--primary-color);
    font-weight: 500;
}

/* AI Bypass Section */
.wa-bypass-section {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 8px;
}

.wa-bypass-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.wa-bypass-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.wa-bypass-desc {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: 1.5;
}

.wa-bypass-list {
    margin-bottom: 16px;
}

.wa-bypass-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-lighter);
    font-size: 13px;
}

.wa-bypass-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
}

.wa-bypass-card:last-child {
    margin-bottom: 0;
}

.wa-bypass-phone {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    font-family: 'Courier New', Courier, monospace;
    min-width: 140px;
}

.wa-bypass-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.wa-bypass-scope {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wa-bypass-scope.global {
    color: var(--primary-color);
}

.wa-bypass-scope.per-account {
    color: #e69500;
}

.wa-bypass-note {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wa-bypass-actions {
    flex-shrink: 0;
}

.wa-bypass-form {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.wa-bypass-form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.wa-bypass-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wa-bypass-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.wa-bypass-form input,
.wa-bypass-form select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.wa-bypass-form input:focus,
.wa-bypass-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.wa-bypass-edit-panel {
    width: 100%;
}

.wa-bypass-edit-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.wa-bypass-edit-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-bypass-edit-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wa-bypass-edit-field input,
.wa-bypass-edit-field select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.wa-bypass-edit-field input:focus,
.wa-bypass-edit-field select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.wa-bypass-edit-actions {
    display: flex;
    gap: 8px;
}

@media (max-width: 768px) {
    .wa-bypass-form-fields {
        grid-template-columns: 1fr;
    }
    .wa-bypass-card {
        flex-wrap: wrap;
    }
    .wa-bypass-edit-fields {
        grid-template-columns: 1fr;
    }
}

/* Test Section */
.wa-test-section {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 8px;
}

.wa-test-section h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.wa-test-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.wa-test-section .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wa-test-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

.wa-test-section input,
.wa-test-section select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.wa-test-section input:focus,
.wa-test-section select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Empty State */
.wa-empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-lighter);
}

.wa-empty-state p {
    font-size: 14px;
    color: var(--text-lighter);
}

/* Email Accounts */
.email-accounts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.email-accounts-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
}

.email-account-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.email-account-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: var(--transition);
}

.email-account-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.08);
}

.email-account-info {
    flex: 1;
    min-width: 0;
}

.email-account-sender {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.email-account-name {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 2px;
}

.email-account-smtp {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 2px;
    font-family: 'Courier New', Courier, monospace;
}

.email-account-last-success {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 4px;
}

.email-account-error {
    font-size: 12px;
    color: #ff4757;
    margin-top: 4px;
}

.email-account-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.email-account-priority {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-lighter);
}

.email-account-reorder {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex-shrink: 0;
}

.email-reorder-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 22px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.email-reorder-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(0, 102, 255, 0.04);
}

.email-reorder-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

.email-main-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-color);
    margin-left: 8px;
    vertical-align: middle;
}

.email-account-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.email-status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.email-status-indicator.active {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
}

.email-status-indicator.error {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

.email-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Email Add/Edit Form */
.email-add-form {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.email-add-form h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 16px;
}

.email-add-form-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.email-add-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.email-add-form .form-row:has(.form-group-sm) {
    grid-template-columns: 2fr 1fr 1fr;
}

.email-add-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.email-add-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.email-add-form input,
.email-add-form select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.email-add-form input:focus,
.email-add-form select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Email Test Section */
.email-test-section {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    margin-top: 8px;
}

.email-test-section h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.email-test-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.email-test-section .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.email-test-section label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dark);
}

.email-test-section input,
.email-test-section select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.email-test-section input:focus,
.email-test-section select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Email Empty State */
.email-empty-state {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-lighter);
}

.email-empty-state p {
    font-size: 14px;
    color: var(--text-lighter);
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 60px 24px;
    max-width: 400px;
    margin: 0 auto;
}

.coming-soon-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.coming-soon h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.coming-soon p {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-container:empty {
    display: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toastIn 0.3s ease;
    max-width: 400px;
}

.toast.success {
    background: #25D366;
}

.toast.error {
    background: #ff4757;
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ========================================
   School Management
   ======================================== */

/* Schools Header */
.schools-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.schools-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.schools-search-box {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.schools-search-box:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.schools-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.schools-filters select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.schools-filters select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* School Form Panel */
.school-form-panel .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.school-form-panel .form-row.full {
    grid-template-columns: 1fr;
}

.school-form-panel .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.school-form-panel label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.school-form-panel input:not([type="checkbox"]),
.school-form-panel select,
.school-form-panel textarea {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.school-form-panel input:not([type="checkbox"]):focus,
.school-form-panel select:focus,
.school-form-panel textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.school-form-panel textarea {
    resize: vertical;
    min-height: 70px;
}

.school-form-panel .form-hint {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 2px;
}

/* IT Admin Email Autocomplete */
.email-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.email-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-bottom: 1px solid var(--border-color, #eee);
    transition: background 0.15s;
}

.email-autocomplete-item:last-child {
    border-bottom: none;
}

.email-autocomplete-item:hover,
.email-autocomplete-item.active {
    background: var(--bg-hover, #f0f4ff);
}

.email-autocomplete-item .ac-email {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color, #1a1a2e);
}

.email-autocomplete-item .ac-name {
    font-size: 12px;
    color: var(--text-lighter, #888);
}

.email-autocomplete-item .ac-role {
    font-size: 11px;
    color: var(--primary-color, #0066ff);
    font-weight: 500;
}

.email-autocomplete-no-results {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-lighter, #888);
    text-align: center;
}

.school-level-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.school-level-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color, #e8e8ef);
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    background: white;
    transition: all 0.15s ease;
    user-select: none;
}

.school-level-option:hover {
    border-color: #99c2ff;
    background: rgba(0, 102, 255, 0.02);
}

.school-level-option.checked {
    background: rgba(0, 102, 255, 0.04);
    border-color: #0066ff;
}

.school-level-option input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px;
    accent-color: #0066ff;
    cursor: pointer;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 4px !important;
    flex-shrink: 0;
    appearance: auto;
}

.school-level-option-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.school-level-option-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    line-height: 1.3;
}

.school-level-option-hint {
    font-size: 12px;
    color: var(--text-lighter);
    line-height: 1.3;
}

.school-form-panel .req {
    color: #ff4757;
    font-weight: 400;
}

/* form-actions moved to modal-footer */

/* School Form Sections */
.school-form-section {
    margin-bottom: 24px;
    padding-bottom: 4px;
}

.school-form-section:last-of-type {
    margin-bottom: 16px;
}

.school-form-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.school-form-info {
    font-size: 11px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    padding: 3px 10px;
    border-radius: 20px;
    background: rgba(0, 102, 255, 0.08);
    color: var(--primary-color);
}

.school-code-input {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 1px;
    background: var(--bg-light) !important;
    color: var(--text-light) !important;
    cursor: default;
}

.school-it-edit-hint {
    color: #e69500 !important;
    font-weight: 500;
}

/* School Stats Bar */
.school-stats-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
}

.school-stats-bar .stat-total {
    font-weight: 700;
    color: var(--text-dark);
}

.school-stats-bar .stat-active {
    color: #25D366;
    font-weight: 600;
}

.school-stats-bar .stat-inactive {
    color: #ff4757;
    font-weight: 600;
}

.school-stats-bar .stat-sep {
    color: var(--border-color);
}

/* School Card List */
/* School table (desktop) */
.school-table-wrap {
    margin-bottom: 24px;
}

.school-table-wrap .ait-table {
    border-radius: 12px;
}

/* School cards (mobile only, hidden on desktop) */
.school-card-list {
    display: none;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.school-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
    border-left: 4px solid #ccc;
}

.school-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.school-card.plan-free {
    border-left-color: #aaa;
}

.school-card.plan-basic {
    border-left-color: var(--primary-color);
}

.school-card.plan-pro {
    border-left-color: #6c5ce7;
}

.school-card.plan-enterprise {
    border-left-color: #d4a006;
}

.school-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 12px;
    gap: 12px;
}

.school-card-title {
    flex: 1;
    min-width: 0;
}

.school-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.school-code-pill {
    display: inline-block;
    font-size: 11px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-light);
    background: var(--bg-light);
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 4px;
}

.school-card-code {
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    color: var(--text-lighter);
    margin-top: 2px;
    letter-spacing: 1px;
}

.school-card-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.school-plan-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.school-plan-badge.free {
    background: rgba(128, 128, 128, 0.1);
    color: #888;
}

.school-plan-badge.basic {
    background: rgba(0, 102, 255, 0.1);
    color: var(--primary-color);
}

.school-plan-badge.pro {
    background: rgba(108, 92, 231, 0.1);
    color: #6c5ce7;
}

.school-plan-badge.enterprise {
    background: rgba(255, 193, 7, 0.15);
    color: #d4a006;
}

.school-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.school-status-badge.active {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
}

.school-status-badge.inactive {
    background: rgba(255, 71, 87, 0.1);
    color: #ff4757;
}

.school-card-body {
    padding: 0 20px 16px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.school-card-contact {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.8;
}

.school-card-contact div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.school-card-contact-icon {
    display: inline-block;
    width: 16px;
    vertical-align: middle;
    margin-right: 4px;
    opacity: 0.5;
}

.school-card-it-admin {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color);
    font-size: 12px;
    color: var(--text-lighter);
}

.school-card-it-admin .it-label {
    font-weight: 600;
    color: var(--text-light);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.school-card-stat {
    flex-shrink: 0;
    text-align: center;
    padding: 8px 16px;
    background: var(--bg-light);
    border-radius: 10px;
    min-width: 80px;
}

.school-card-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.school-card-stat-label {
    font-size: 11px;
    color: var(--text-lighter);
    font-weight: 500;
}

.school-card-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

.school-card-actions .btn-sm {
    flex: 1;
    justify-content: center;
}

/* School Empty State */
.school-empty-state {
    text-align: center;
    padding: 80px 24px;
    color: var(--text-lighter);
    grid-column: 1 / -1;
}

.school-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg-light);
    margin: 0 auto 24px;
    color: var(--text-lighter);
}

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

.school-empty-desc {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 24px;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.school-empty-cta {
    padding: 12px 32px;
    font-size: 15px;
}

/* School Pagination */
.school-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 16px 0;
}

.school-pagination button {
    padding: 8px 18px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: white;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.school-pagination button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.school-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.school-pagination-info {
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
}

/* Responsive — tablet */
@media (max-width: 968px) {
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        transition: left 0.3s ease;
    }

    .admin-sidebar.open {
        left: 0;
    }

    .topbar-hamburger {
        display: flex;
    }

    .admin-content {
        padding: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-panels {
        grid-template-columns: 1fr;
    }

    .settings-form {
        grid-template-columns: 1fr;
    }

    .wa-add-form-fields {
        grid-template-columns: 1fr;
    }

    .wa-test-fields {
        grid-template-columns: 1fr;
    }

    .wa-account-card {
        flex-wrap: wrap;
    }

    .wa-account-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .wa-account-reorder {
        flex-direction: row;
        order: 10;
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
    }

    .school-form-panel .form-row {
        grid-template-columns: 1fr;
    }

    .school-table-wrap {
        display: none;
    }

    .school-card-list {
        display: grid;
        grid-template-columns: 1fr;
    }

    .schools-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .schools-filters {
        flex-wrap: wrap;
    }

    .school-stats-bar {
        flex-wrap: wrap;
        font-size: 12px;
    }

    .email-add-form .form-row {
        grid-template-columns: 1fr;
    }

    .email-test-fields {
        grid-template-columns: 1fr;
    }

    .email-account-card {
        flex-wrap: wrap;
    }

    .email-account-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .email-account-reorder {
        flex-direction: row;
        order: 10;
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
    }
}

/* Responsive — mobile */
@media (max-width: 640px) {
    .admin-topbar {
        padding: 0 16px;
    }

    .admin-content {
        padding: 16px;
    }

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

    .stat-card {
        padding: 20px;
    }

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

    .role-label {
        width: 110px;
        font-size: 13px;
    }

    .panel-body {
        padding: 12px 16px;
    }

    .topbar-title {
        font-size: 17px;
    }

    .notif-tab {
        padding: 10px 16px;
        font-size: 13px;
    }

    .form-actions {
        flex-direction: column;
    }

    .wa-pairing-code {
        font-size: 24px;
        letter-spacing: 2px;
    }

    .school-card-body {
        flex-direction: column;
    }

    .school-card-actions {
        flex-wrap: wrap;
    }

    .school-card-actions .btn-sm {
        flex: none;
        width: 100%;
    }

    .school-pagination {
        flex-direction: column;
        gap: 8px;
    }

    .wa-accounts-header,
    .email-accounts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .toast-container {
        left: 16px;
        right: 16px;
    }

    .toast {
        max-width: 100%;
    }

    .modal-overlay {
        padding: 10px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .modal-dialog.modal-lg,
    .modal-dialog.modal-md,
    .modal-dialog.modal-xl {
        max-width: 100%;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-footer {
        flex-direction: column;
        padding: 12px 16px 16px;
    }
}

/* ──────────────────────────────────────────────
   Teacher Invitation Panel & Review Modal
   ────────────────────────────────────────────── */

/* Invite button in school card actions */
.btn-invite {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0d9488;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-invite:hover {
    background: #0f766e;
}

.btn-invite svg {
    flex-shrink: 0;
}

/* ── Generic Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    animation: modalOverlayIn 0.2s ease;
}

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

.modal-dialog {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.2s ease;
}

.modal-dialog.modal-sm {
    max-width: 440px;
}

.modal-dialog.modal-md {
    max-width: 640px;
}

.modal-dialog.modal-lg {
    max-width: 760px;
}

.modal-dialog.modal-xl {
    max-width: 960px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-lighter);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-dark);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Invite panel inside modal */
.school-invite-panel {
    background: #fff;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
}

.school-invite-panel h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 12px;
}

/* Send form row */
.invite-send-form {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.invite-send-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.invite-email-input,
.invite-phone-input {
    flex: 1;
    min-width: 160px;
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.invite-email-input:focus,
.invite-phone-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.invite-via-select {
    padding: 8px 12px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    cursor: pointer;
}

.invite-send-btn {
    white-space: nowrap;
}

/* Invitation list/table */
.invite-list-section {
    margin-top: 4px;
}

.invite-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.invite-table th {
    text-align: left;
    padding: 8px 10px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1.5px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invite-table td {
    padding: 10px 10px;
    vertical-align: middle;
    white-space: nowrap;
    border-bottom: none;
}

.invite-table td:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.invite-table td small {
    color: var(--text-lighter);
    font-size: 12px;
}

.invite-table tbody tr {
    box-shadow: inset 0 -1px 0 var(--border-color);
}

.invite-table tbody tr:last-child {
    box-shadow: none;
}

.invite-actions {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    border: none;
    transition: background 0.2s;
}

.btn-xs.btn-secondary {
    background: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

.btn-xs.btn-secondary:hover {
    background: var(--border-color);
}

.btn-xs.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-xs.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-xs.btn-danger {
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
}

.btn-xs.btn-danger:hover {
    background: #dc3545;
    color: #fff;
}

/* Status badges */
.invite-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.invite-status-badge.status-pending {
    background: #f3f4f6;
    color: #6b7280;
}

.invite-status-badge.status-sent {
    background: #dbeafe;
    color: #2563eb;
}

.invite-status-badge.status-submitted {
    background: #fef3c7;
    color: #d97706;
}

.invite-status-badge.status-approved {
    background: #dcfce7;
    color: #16a34a;
}

.invite-status-badge.status-rejected {
    background: #fee2e2;
    color: #dc2626;
}

.invite-status-badge.expired {
    background: #f3f4f6;
    color: #9ca3af;
}

.invite-empty {
    text-align: center;
    color: var(--text-lighter);
    padding: 20px;
    font-size: 14px;
}

.invite-loading {
    text-align: center;
    color: var(--text-lighter);
    padding: 16px;
    font-size: 13px;
}

/* Review modal overlay */
.invite-review-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.invite-review-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.2s ease;
}

.invite-review-modal.invite-review-modal-wide {
    max-width: 640px;
}

.invite-review-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 16px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invite-review-section-title:first-child {
    margin-top: 0;
}

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

.invite-review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.invite-review-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.invite-review-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-lighter);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.invite-review-close:hover {
    color: var(--text-dark);
}

.invite-review-body {
    padding: 24px;
}

.invite-review-row {
    display: flex;
    gap: 16px;
}

.invite-review-field {
    margin-bottom: 16px;
    flex: 1;
}

.invite-review-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.invite-review-field input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.invite-review-field input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.invite-review-actions {
    display: flex;
    gap: 10px;
    padding: 16px 24px 24px;
    justify-content: flex-end;
}

/* Responsive adjustments for invite panel */
@media (max-width: 640px) {
    .invite-send-row {
        flex-direction: column;
    }

    .invite-email-input,
    .invite-phone-input {
        min-width: 100%;
    }

    .invite-table th:nth-child(3),
    .invite-table td:nth-child(3) {
        display: none;
    }

    .invite-review-row {
        flex-direction: column;
        gap: 0;
    }

    .invite-review-actions {
        flex-direction: column;
    }

    .invite-table th:nth-child(3),
    .invite-table td:nth-child(3) {
        /* Hide tracking column on very small screens — already hiding school name (4th) above */
    }
}

/* ── Tracking Badges ── */
.tracking-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    vertical-align: middle;
}

.tracking-badge svg {
    flex-shrink: 0;
}

.tracking-opened {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.tracking-clicked {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

/* ── Redesigned Invite Send Form ── */
.invite-send-form-redesign {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.invite-send-row-v2 {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
}

.invite-send-row-v2:last-child {
    margin-bottom: 0;
}

.invite-send-row-v2 .invite-email-input,
.invite-send-row-v2 .invite-phone-input {
    flex: 1;
    min-width: 0;
}

.invite-send-row-v2 .invite-send-btn {
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#inviteStatsPanel {
    overflow-x: auto;
}

#inviteStatsPanel .invite-table {
    min-width: 700px;
}

.invite-wa-btn {
    background: #25D366 !important;
}

.invite-wa-btn:hover {
    background: #1fad55 !important;
}

/* ── Via Badges ── */
.invite-via-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    vertical-align: middle;
}

.invite-via-badge.via-email {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

.invite-via-badge.via-whatsapp {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
}

.tracking-badge-group {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

/* ── Tracking Detail Overlay ── */
.tracking-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    animation: modalOverlayIn 0.2s ease;
}

.tracking-detail-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 1100px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.2s ease;
}

.tracking-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.tracking-detail-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.tracking-detail-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Summary cards */
.tracking-detail-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.tracking-summary-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.tracking-summary-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.3;
}

.tracking-summary-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 4px;
}

/* Event log table */
.tracking-detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.tracking-detail-table th,
.tracking-detail-table td {
    padding: 8px 10px;
    vertical-align: middle;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tracking-detail-table th {
    text-align: left;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1.5px solid var(--border-color);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tracking-detail-table td {
    border-bottom: 1px solid var(--border-color);
}

/* Column widths */
.tracking-detail-table th:nth-child(1),
.tracking-detail-table td:nth-child(1) { width: 170px; }  /* Time */

.tracking-detail-table th:nth-child(2),
.tracking-detail-table td:nth-child(2) { width: 75px; }   /* Type */

.tracking-detail-table th:nth-child(3),
.tracking-detail-table td:nth-child(3) { width: 130px; }  /* IP */

.tracking-detail-table th:nth-child(5),
.tracking-detail-table td:nth-child(5) { width: 60px; }   /* Bot */

/* UA column gets remaining space */
.tracking-detail-table th:nth-child(4),
.tracking-detail-table td:nth-child(4) { width: auto; }

.tracking-detail-table tr:last-child td {
    border-bottom: none;
}

/* Bot row dimmed */
.tracking-event-bot {
    opacity: 0.45;
}

.tracking-bot-flag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255, 165, 0, 0.12);
    color: #e69500;
}

/* ── Mobile: card-based invite stats ── */
.invite-stats-cards-mobile {
    display: none;
}

.inv-stats-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.inv-stats-card:last-child {
    margin-bottom: 0;
}

.inv-stats-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.inv-stats-card-contact {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.inv-stats-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}

.inv-stats-card-via {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-light);
    font-size: 12px;
    font-weight: 500;
}

.inv-stats-card-school {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inv-stats-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Mobile: card-based tracking events ── */
.tracking-event-cards {
    display: none;
}

.tracking-event-card {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

.tracking-event-card:last-child {
    margin-bottom: 0;
}

.tracking-event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tracking-event-card-type {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-dark);
}

.tracking-event-card-time {
    font-size: 12px;
    color: var(--text-lighter);
}

.tracking-event-card-row {
    display: flex;
    gap: 6px;
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 4px;
}

.tracking-event-card-row:last-child {
    margin-bottom: 0;
}

.tracking-event-card-label {
    font-weight: 600;
    color: var(--text-dark);
    flex-shrink: 0;
    min-width: 28px;
}

.tracking-event-card-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tracking-event-card.is-bot {
    opacity: 0.45;
}

/* ── Responsive — tracking detail ── */
@media (max-width: 968px) {
    .tracking-detail-modal {
        max-width: 100%;
    }
}

@media (max-width: 640px) {
    .invite-send-row-v2 {
        flex-direction: column;
    }

    .invite-send-row-v2 .invite-email-input,
    .invite-send-row-v2 .invite-phone-input {
        min-width: 100%;
    }

    .invite-send-row-v2 .invite-send-btn {
        width: 100%;
        justify-content: center;
    }

    .tracking-detail-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .tracking-detail-table {
        display: none;
    }

    .tracking-event-cards {
        display: block;
    }

    .tracking-detail-modal {
        max-width: 100%;
    }

    .invite-stats-table-desktop {
        display: none;
    }

    .invite-stats-cards-mobile {
        display: block;
    }
}

/* ========================================
   Email Campaigns
   ======================================== */

/* Campaigns Header */
.campaigns-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 24px;
}

/* Campaign Card List */
.campaign-card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.campaign-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition);
}

.campaign-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.campaign-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 20px 12px;
    gap: 12px;
}

.campaign-card-title {
    flex: 1;
    min-width: 0;
}

.campaign-card-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.campaign-card-subject {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Campaign Status Badges */
.campaign-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    text-transform: capitalize;
}

.campaign-status-draft {
    background: #f3f4f6;
    color: #6b7280;
}

.campaign-status-sending {
    background: #fef3c7;
    color: #d97706;
}

.campaign-status-sent {
    background: #dcfce7;
    color: #16a34a;
}

.campaign-status-paused {
    background: #dbeafe;
    color: #2563eb;
}

/* Campaign Card Stats */
.campaign-card-stats {
    display: flex;
    gap: 0;
    padding: 0 20px 16px;
}

.campaign-stat {
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    background: var(--bg-light);
    border-right: 1px solid var(--border-color);
}

.campaign-stat:first-child {
    border-radius: 8px 0 0 8px;
}

.campaign-stat:last-child {
    border-radius: 0 8px 8px 0;
    border-right: none;
}

.campaign-stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-dark);
    line-height: 1.2;
}

.campaign-stat-label {
    font-size: 11px;
    color: var(--text-lighter);
    font-weight: 500;
}

.campaign-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}

.campaign-card-date {
    font-size: 12px;
    color: var(--text-lighter);
}

.campaign-card-actions-btns {
    display: flex;
    gap: 6px;
}

/* Campaign Editor */
.campaign-editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.campaign-editor-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.campaign-editor-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.campaign-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.campaign-editor-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.campaign-editor-form label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.campaign-editor-form .req {
    color: #ff4757;
}

.campaign-editor-form input[type="text"],
.campaign-editor-form input[type="email"] {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
}

.campaign-editor-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* HTML Editor */
.campaign-html-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.campaign-html-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.campaign-html-header label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.campaign-html-toggle {
    display: flex;
    gap: 4px;
}

.campaign-html-toggle .btn-xs.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.campaign-html-textarea {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: none;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: var(--text-dark);
    background: white;
    resize: vertical;
    box-sizing: border-box;
}

.campaign-html-textarea:focus {
    outline: none;
}

.campaign-html-preview {
    width: 100%;
    min-height: 500px;
    border: none;
    background: white;
}

/* Recipients Section */
.campaign-recipients-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.campaign-recipients-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-light);
}

.campaign-recipients-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.campaign-recipient-count {
    font-weight: 500;
    color: var(--text-lighter);
    font-size: 13px;
}

.campaign-recipients-actions {
    display: flex;
    gap: 8px;
}

.campaign-recipients-list {
    padding: 16px 20px;
    overflow-x: auto;
}

.campaign-recipients-table {
    min-width: 500px;
}

/* Action Bar */
.campaign-action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
}

/* Campaign Detail */
.campaign-detail-info {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.campaign-detail-row {
    font-size: 14px;
    color: var(--text-dark);
    padding: 6px 0;
    line-height: 1.8;
}

.campaign-detail-row strong {
    color: var(--text-light);
    font-weight: 600;
    margin-right: 4px;
}

/* Responsive — Campaigns */
@media (max-width: 968px) {
    .campaign-card-list {
        grid-template-columns: 1fr;
    }

    .campaign-form-row {
        grid-template-columns: 1fr;
    }

    .campaign-recipients-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .campaign-recipients-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 640px) {
    .campaign-action-bar {
        flex-wrap: wrap;
    }

    .campaign-action-bar .btn-danger {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
}

/* ── Template Picker ── */
.template-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 8px 0;
}

.template-picker-card {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    background: #fff;
}

.template-picker-card:hover {
    border-color: var(--primary-color, #4A90D9);
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.15);
    transform: translateY(-2px);
}

.template-picker-preview {
    height: 140px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
}

.template-picker-blank {
    background: #f0f4ff;
    color: #6c8ebf;
}

.template-picker-info {
    padding: 12px 14px;
}

.template-picker-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.template-picker-desc {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
    line-height: 1.4;
}

.template-default-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #4A90D9;
    background: #e8f0fe;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Template Manager ── */
.template-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.template-manager-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.2s ease;
}

.template-manager-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.template-manager-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.template-manager-card-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.template-manager-card-date {
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
}

.template-manager-card-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 16px;
}

.template-manager-card-actions {
    display: flex;
    gap: 8px;
}

/* Campaigns header gap */
.campaigns-header {
    gap: 12px;
}

/* Responsive — Templates */
@media (max-width: 968px) {
    .template-card-grid {
        grid-template-columns: 1fr;
    }
}

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

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

/* ═══════════════════════════════════════════
   Sidebar Section Labels
   ═══════════════════════════════════════════ */
.sidebar-section-label {
    padding: 20px 16px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.3);
}

.sidebar-section-label:first-child {
    padding-top: 4px;
}

/* ═══════════════════════════════════════════
   Coming Soon Placeholder Pages
   ═══════════════════════════════════════════ */
.coming-soon-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 120px);
    padding: 40px 24px;
    text-align: center;
}

.coming-soon-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.1), rgba(139, 92, 246, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    color: #0066ff;
}

.coming-soon-icon svg {
    width: 40px;
    height: 40px;
}

.coming-soon-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 12px;
}

.coming-soon-subtitle {
    font-size: 16px;
    color: #666;
    max-width: 480px;
    margin: 0 0 40px;
    line-height: 1.6;
}

.coming-soon-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 680px;
    width: 100%;
    margin-bottom: 40px;
}

.coming-soon-feature-card {
    background: white;
    border: 1px solid #e8e8ef;
    border-radius: 16px;
    padding: 24px;
    text-align: left;
    transition: var(--transition);
}

.coming-soon-feature-card:hover {
    border-color: rgba(0, 102, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.08);
    transform: translateY(-2px);
}

.coming-soon-feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.08), rgba(139, 92, 246, 0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: #0066ff;
}

.coming-soon-feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.coming-soon-feature-card p {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
    margin: 0;
}

.coming-soon-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px;
    background: linear-gradient(135deg, #0066ff, #8b5cf6);
    color: white;
    font-size: 14px;
    font-weight: 600;
    border-radius: 100px;
    letter-spacing: 0.5px;
}

@media (max-width: 640px) {
    .coming-soon-features {
        grid-template-columns: 1fr;
    }

    .coming-soon-title {
        font-size: 22px;
    }

    .coming-soon-subtitle {
        font-size: 14px;
    }

    .coming-soon-container {
        min-height: auto;
        padding: 24px 16px;
    }
}

/* ========================================
   AI Tutoring
   ======================================== */

/* Tabs */
.ait-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.ait-tab {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.ait-tab:hover {
    color: var(--text-dark);
}

.ait-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Panels */
.ait-panel {
    display: none;
}

.ait-panel.active {
    display: block;
}

/* Section Header */
.ait-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.ait-section-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Filter Bar */
.ait-filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ait-filter-search {
    flex: 1;
    min-width: 180px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
    box-sizing: border-box;
}

.ait-filter-search:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.ait-filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    cursor: pointer;
    min-width: 140px;
    box-sizing: border-box;
}

.ait-filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Table */
.ait-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.ait-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
}

.ait-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-dark);
    vertical-align: middle;
}

.ait-table tbody tr {
    border-bottom: 1px solid var(--border-color);
}

.ait-table tbody tr:last-child {
    border-bottom: none;
}

.ait-table tbody tr:hover {
    background: rgba(0, 102, 255, 0.02);
}

.ait-table-sub {
    font-size: 12px;
    color: var(--text-lighter);
}

.ait-table-actions {
    white-space: nowrap;
}

.ait-table-actions .btn-sm {
    margin-right: 6px;
}

.ait-table-actions .btn-sm:last-child {
    margin-right: 0;
}

/* Reorder (up/down arrow) buttons */
.ait-reorder-cell {
    width: 60px;
    text-align: center;
    white-space: nowrap;
}

.ait-reorder-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin: 0 1px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1;
}

.ait-reorder-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.ait-reorder-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

.ait-reorder-mobile {
    display: flex;
    gap: 4px;
}

.ait-mono {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
}

/* Subject cell with icon */
.ait-subject-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ait-subject-cell svg {
    flex-shrink: 0;
    color: var(--primary-color);
}

/* Badge */
.ait-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.ait-badge-green {
    background: rgba(37, 211, 102, 0.1);
    color: #25D366;
}

.ait-badge-gray {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-lighter);
}

.ait-badge-blue {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* Modal */
.ait-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.ait-modal-overlay.show {
    display: flex;
}

.ait-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: aitModalIn 0.2s ease;
}

.ait-modal-lg {
    max-width: 860px;
}

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

.ait-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.ait-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
}

.ait-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-lighter);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.ait-modal-close:hover {
    color: var(--text-dark);
}

.ait-modal-body {
    padding: 24px;
    overflow-x: hidden;
}

.ait-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Form */
.ait-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.ait-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    min-width: 0;
    overflow: hidden;
}

.ait-form-row .ait-form-group {
    margin-bottom: 0;
}

.ait-form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.ait-form-group input,
.ait-form-group select,
.ait-form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: var(--transition);
    resize: vertical;
    min-width: 0;
    box-sizing: border-box;
    text-overflow: ellipsis;
}

.ait-form-group input:focus,
.ait-form-group select:focus,
.ait-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.ait-form-hint {
    font-size: 12px;
    color: var(--text-lighter);
}

.ait-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
}

.ait-toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

/* ── i18n Translations Section ── */
.ait-i18n-section {
    margin: 8px 0 12px;
}

.ait-i18n-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    width: 100%;
    transition: background 0.15s;
}

.ait-i18n-toggle:hover {
    background: var(--bg-light);
}

.ait-i18n-toggle svg {
    transition: transform 0.2s;
}

.ait-i18n-toggle.open svg {
    transform: rotate(180deg);
}

.ait-i18n-fields {
    margin-top: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 14px;
    background: var(--bg-light);
}

.ait-i18n-grid {
    display: grid;
    gap: 12px;
}

.ait-i18n-lang label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-lighter);
    margin-bottom: 4px;
    text-transform: none;
}

.ait-i18n-lang input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 4px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ait-i18n-lang input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* ── Chat Layout ── */
.ait-chat-layout {
    display: flex;
    gap: 0;
    height: calc(100vh - 200px);
    min-height: 500px;
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.ait-chat-sidebar {
    width: 280px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-light);
}

.ait-chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.ait-chat-sidebar-header .btn-sm {
    flex-shrink: 0;
}

.ait-chat-subject-select {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: white;
    color: var(--text-dark);
    overflow: hidden;
    text-overflow: ellipsis;
}

.ait-conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.ait-conv-item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: var(--transition);
}

.ait-conv-item:hover {
    background: rgba(0, 102, 255, 0.06);
}

.ait-conv-item.active {
    background: rgba(0, 102, 255, 0.1);
}

.ait-conv-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ait-conv-meta {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 2px;
}

/* Chat Main Area */
.ait-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ait-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.ait-chat-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#chatHeaderTitle {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
}

.ait-chat-header-meta {
    font-size: 12px;
    color: var(--text-lighter);
}

/* Messages */
.ait-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ait-chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-lighter);
    gap: 12px;
    text-align: center;
    padding: 40px;
}

.ait-chat-empty p {
    font-size: 14px;
    max-width: 300px;
}

/* Message Bubbles */
.ait-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.ait-msg-user {
    align-self: flex-end;
    align-items: flex-end;
}

.ait-msg-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.ait-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.ait-msg-user .ait-msg-bubble {
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.ait-msg-assistant .ait-msg-bubble {
    background: var(--bg-light);
    color: var(--text-dark);
    border-bottom-left-radius: 4px;
}

.ait-msg-bubble pre {
    background: rgba(0, 0, 0, 0.06);
    padding: 10px 14px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}

.ait-msg-bubble code {
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.ait-msg-bubble pre code {
    background: none;
    padding: 0;
}

.ait-msg-bubble code:not(pre code) {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
}

.ait-msg-user .ait-msg-bubble code:not(pre code) {
    background: rgba(255, 255, 255, 0.2);
}

.ait-msg-user .ait-msg-bubble pre {
    background: rgba(255, 255, 255, 0.15);
}

.ait-msg-time {
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 4px;
    padding: 0 4px;
}

.ait-typing {
    color: var(--text-lighter);
    font-style: italic;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ait-search-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat center / contain;
    animation: aitSearchPulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes aitSearchPulse {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.ait-error {
    color: #ff4757;
}

/* Chat Input */
.ait-chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.ait-chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    resize: none;
    max-height: 150px;
    line-height: 1.5;
    transition: var(--transition);
}

.ait-chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.ait-chat-input-area .btn-primary {
    padding: 10px 14px;
    border-radius: 12px;
    flex-shrink: 0;
}

.ait-chat-input-area .btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Preset Provider Grid ── */
.ait-preset-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 20px;
    line-height: 1.5;
}

.ait-preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ait-preset-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.ait-preset-card:hover {
    border-color: var(--primary-color);
    background: rgba(0, 102, 255, 0.03);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.ait-preset-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary-color);
}

.ait-preset-info {
    min-width: 0;
}

.ait-preset-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 2px;
}

.ait-preset-desc {
    font-size: 12px;
    color: var(--text-lighter);
    line-height: 1.4;
}

.ait-back-link {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin-bottom: 16px;
    display: inline-block;
}

.ait-back-link:hover {
    text-decoration: underline;
}

/* ── Model Input with Fetch Button ── */
.ait-model-input-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.ait-model-input-wrap input,
.ait-model-input-wrap select {
    flex: 1;
    min-width: 0;
}

.ait-fetch-models-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--primary-color);
    background: rgba(0, 102, 255, 0.08);
    border: 1px solid rgba(0, 102, 255, 0.2);
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}

.ait-fetch-models-btn:hover {
    background: rgba(0, 102, 255, 0.14);
    border-color: var(--primary-color);
}

.ait-fetch-models-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@keyframes aitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ait-spin {
    animation: aitSpin 0.8s linear infinite;
}

/* Provider Cards (mobile) */
.ait-providers-cards {
    display: none;
}

.ait-provider-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.ait-provider-card-header {
    margin-bottom: 12px;
}

.ait-provider-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.ait-provider-card-title strong {
    font-size: 15px;
    color: var(--text-dark);
}

.ait-provider-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.ait-provider-card-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.ait-provider-card-row .ait-mono {
    word-break: break-all;
    font-size: 12px;
}

.ait-provider-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ait-provider-card-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.ait-provider-card-actions .btn-sm {
    flex: 1;
    text-align: center;
}

/* Subject Cards (mobile) */
.ait-subjects-cards {
    display: none;
}

.ait-subject-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.ait-subject-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.ait-subject-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-subtle, #f5f5f5);
    border-radius: 10px;
    color: var(--primary-color, #4f46e5);
}

.ait-subject-card-info {
    flex: 1;
    min-width: 0;
}

.ait-subject-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

.ait-subject-card-title strong {
    font-size: 15px;
    color: var(--text-dark);
}

.ait-subject-card-desc {
    font-size: 13px;
    color: var(--text-lighter);
}

.ait-subject-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.ait-subject-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.ait-subject-card-row .ait-mono {
    font-size: 12px;
    word-break: break-all;
}

.ait-subject-card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.ait-subject-card-actions {
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.ait-subject-card-actions .btn-sm {
    flex: 1;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .ait-providers-table,
    .ait-subjects-table {
        display: none;
    }

    .ait-providers-cards,
    .ait-subjects-cards {
        display: block;
    }

    .ait-modal-overlay {
        padding: 12px;
    }

    .ait-modal,
    .ait-modal-lg {
        max-width: 100%;
    }

    .ait-modal-body {
        padding: 16px;
    }

    .ait-form-group input,
    .ait-form-group select,
    .ait-form-group textarea {
        min-width: 0;
        max-width: 100%;
        box-sizing: border-box;
    }

    .ait-chat-layout {
        flex-direction: column;
        height: calc(100vh - 180px);
    }

    .ait-chat-sidebar {
        width: 100%;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .ait-form-row {
        grid-template-columns: 1fr;
    }

    .ait-msg {
        max-width: 90%;
    }

    .ait-preset-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════════════════════════════════════════════
   School Users Page (su-* prefix)
   ═══════════════════════════════════════════════════ */

.su-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.su-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.su-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.su-school-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.su-school-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.su-school-code {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-lighter);
    background: var(--bg-light);
    padding: 3px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Table wrapper — desktop only */
.su-table-wrap {
    display: block;
}

/* Card list — mobile only */
.su-card-list {
    display: none;
}

/* Role badge */
.su-role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Cards */
.su-card {
    background: white;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

.su-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.su-card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}

.su-card-info {
    flex: 1;
    min-width: 0;
}

.su-card-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.su-card-email {
    font-size: 13px;
    color: var(--text-lighter);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.su-card-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.su-card-meta {
    font-size: 12px;
    color: var(--text-lighter);
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.su-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.su-empty-state {
    text-align: center;
    padding: 60px 20px;
}

/* Bulk Toolbar */
.su-bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.su-bulk-count {
    font-size: 13px;
    font-weight: 600;
    color: #4338ca;
    margin-right: 8px;
}

.su-bulk-clear {
    margin-left: auto;
    color: var(--text-lighter) !important;
}

/* Action dropdown menu */
.su-action-menu {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    padding: 6px 0;
    animation: suMenuFadeIn 0.12s ease;
}

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

.su-action-menu button {
    display: block;
    width: 100%;
    padding: 9px 16px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
    transition: background 0.15s;
}

.su-action-menu button:hover {
    background: #f3f4f6;
}

.su-action-menu hr {
    border: none;
    border-top: 1px solid var(--border-color, #e5e7eb);
    margin: 4px 0;
}

.su-action-danger {
    color: #dc2626 !important;
}

.su-action-danger:hover {
    background: #fef2f2 !important;
}

/* Actions cell */
.su-actions-cell {
    white-space: nowrap;
}

/* Card checkbox alignment */
.su-card-header .su-card-cb {
    flex-shrink: 0;
    margin-right: 4px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ── School Users Responsive ── */
@media (max-width: 900px) {
    .su-table-wrap {
        display: none;
    }

    .su-card-list {
        display: block;
    }

    .su-header-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .su-school-name {
        font-size: 17px;
    }

    .su-bulk-toolbar {
        gap: 6px;
        padding: 8px 12px;
    }

    .su-bulk-toolbar .btn-sm {
        font-size: 11px;
        padding: 4px 8px;
    }

    .su-bulk-clear {
        margin-left: 0;
    }
}

/* ── Edit User Modal Sections ── */
.su-edit-user-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.su-edit-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 20px 0 10px;
}

.su-edit-section-title:first-of-type {
    margin-top: 0;
}

/* ── Role Option Cards ── */
.su-role-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.su-role-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    position: relative;
}

.su-role-option:hover {
    border-color: #c7d2fe;
    background: #fafbff;
}

.su-role-option-active {
    border-color: #0066ff;
    background: #eef2ff;
}

.su-role-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.su-role-option-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.su-role-option-body {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.su-role-option-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.su-role-option-desc {
    font-size: 12px;
    color: var(--text-lighter);
}

/* ── Teacher Assignment Styles ── */

/* Teacher tags (table + card) */
.su-teacher-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(5, 150, 105, 0.1);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.2);
    margin: 1px 3px 1px 0;
    white-space: nowrap;
}

.su-no-teachers {
    font-size: 12px;
    color: var(--text-lighter);
    font-style: italic;
}

.su-na-cell {
    color: var(--text-lighter);
    font-size: 13px;
}

.su-teachers-cell {
    max-width: 220px;
    line-height: 1.8;
}

/* Card teachers row */
.su-card-teachers {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px 0;
    border-top: 1px dashed var(--border-color, #e5e7eb);
}

.su-card-teachers-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    margin-right: 4px;
}

/* Manage Teachers Modal */
.su-teacher-add-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}

.su-teacher-select {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-dark);
    background: white;
    transition: border-color 0.2s;
}

.su-teacher-select:focus {
    outline: none;
    border-color: var(--primary-color, #0066ff);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.su-assigned-teachers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.su-assigned-teacher-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-light, #f8f9fa);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 10px;
    transition: background 0.15s;
}

.su-assigned-teacher-item:hover {
    background: #f0f4ff;
}

.su-assigned-teacher-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.su-assigned-teacher-info {
    flex: 1;
    min-width: 0;
}

.su-assigned-teacher-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.su-assigned-teacher-email {
    font-size: 12px;
    color: var(--text-lighter);
}

.su-remove-teacher-btn {
    flex-shrink: 0;
    padding: 4px 10px !important;
    font-size: 14px !important;
    line-height: 1;
    border-radius: 6px;
}

.su-teachers-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-lighter);
    font-size: 13px;
    background: var(--bg-light, #f8f9fa);
    border-radius: 10px;
    border: 1px dashed var(--border-color, #e5e7eb);
}

.su-teachers-loading {
    text-align: center;
    padding: 16px;
    color: var(--text-lighter);
    font-size: 13px;
}

/* Add User - setup email checkbox */
.su-add-setup-row {
    margin-top: 20px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.su-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
}

.su-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0066ff;
    cursor: pointer;
}

.su-add-setup-hint {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 4px;
    padding-left: 26px;
}

.su-field-hint {
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 4px;
}

/* ── Student Picker (parent linking) ── */
.student-picker-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.student-picker-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e0f2fe;
    color: #0369a1;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    animation: suTagFadeIn 0.15s ease;
}

@keyframes suTagFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.student-picker-tag .remove-tag {
    background: none;
    border: none;
    color: #0369a1;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
    font-weight: 700;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.student-picker-tag .remove-tag:hover {
    opacity: 1;
}

.student-search-wrap {
    position: relative;
}

.student-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    display: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.student-search-results .search-item {
    padding: 10px 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
    border-bottom: 1px solid #f1f5f9;
}

.student-search-results .search-item:last-child {
    border-bottom: none;
}

.student-search-results .search-item:hover {
    background: #f0f9ff;
}

.student-search-results .search-item-name {
    font-weight: 500;
    color: var(--text-dark);
}

.student-search-results .search-item-email {
    color: var(--text-lighter);
    font-size: 12px;
}

.student-search-results .search-item-empty {
    padding: 12px 14px;
    color: var(--text-lighter);
    font-size: 13px;
    text-align: center;
}

.student-search-results .search-item-more {
    padding: 8px 14px;
    color: var(--text-lighter);
    font-size: 12px;
    text-align: center;
    border-top: 1px solid #f1f5f9;
}

.student-picker-hint {
    color: var(--text-lighter);
    font-size: 12px;
    margin-top: 6px;
}

/* Responsive - teacher add row */
@media (max-width: 640px) {
    .su-teacher-add-row {
        flex-direction: column;
        align-items: stretch;
    }

    .su-teacher-add-row .btn-sm {
        width: 100%;
        justify-content: center;
    }
}

/* ═══════════════════════════════════════════════ */
/* Bulk Add Modal                                  */
/* ═══════════════════════════════════════════════ */

.bulk-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.bulk-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-lighter);
    transition: var(--transition);
}

.bulk-tab:hover {
    color: var(--text-dark);
}

.bulk-tab.active {
    color: #0066ff;
    border-bottom-color: #0066ff;
    font-weight: 600;
}

.bulk-tab-content {
    display: none;
}

.bulk-tab-content.active {
    display: block;
}

.bulk-file-drop {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-light);
}

.bulk-file-drop:hover,
.bulk-file-drop.dragover {
    border-color: #0066ff;
    background: rgba(0, 102, 255, 0.04);
}

.bulk-file-drop svg {
    color: #999;
    margin-bottom: 8px;
}

.bulk-file-drop-text {
    font-size: 14px;
    color: var(--text-lighter);
    margin-bottom: 4px;
}

.bulk-file-drop-hint {
    font-size: 12px;
    color: #aaa;
}

.bulk-file-input {
    display: none;
}

.bulk-paste-area {
    width: 100%;
    min-height: 140px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
}

.bulk-paste-area:focus {
    outline: none;
    border-color: #0066ff;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.bulk-paste-hint {
    font-size: 12px;
    color: #aaa;
    margin-top: 8px;
}

.bulk-parse-btn {
    margin-top: 12px;
}

.bulk-template-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 12px;
    color: #0066ff;
    cursor: pointer;
    text-decoration: underline;
}

/* Preview table */
.bulk-preview-wrap {
    margin-top: 16px;
    max-height: 340px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.bulk-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 700px;
}

.bulk-preview-table th {
    background: var(--bg-light);
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-lighter);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 1px solid var(--border-color);
}

.bulk-preview-table td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bulk-preview-table tr.bulk-row-error {
    background: #fff5f5;
}

.bulk-preview-table tr.bulk-row-error td {
    color: #c0392b;
}

.bulk-preview-table tr.bulk-row-valid {
    background: #f0fdf4;
}

.bulk-row-status-ok {
    color: #059669;
    font-weight: 600;
    font-size: 12px;
}

.bulk-row-status-err {
    color: #dc2626;
    font-weight: 500;
    font-size: 12px;
}

.bulk-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
    padding: 10px 14px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 13px;
}

.bulk-summary-valid {
    color: #059669;
    font-weight: 600;
}

.bulk-summary-errors {
    color: #dc2626;
    font-weight: 600;
}

.bulk-setup-row {
    margin-top: 12px;
}

.bulk-progress {
    margin-top: 16px;
}

.bulk-progress-bar-wrap {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.bulk-progress-bar {
    height: 100%;
    background: #0066ff;
    border-radius: 4px;
    width: 0;
    transition: width 0.3s ease;
}

.bulk-progress-text {
    font-size: 13px;
    color: var(--text-lighter);
    margin-top: 6px;
}

/* Results summary */
.bulk-results {
    margin-top: 16px;
}

.bulk-results-summary {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
}

.bulk-results-summary.all-success {
    background: #f0fdf4;
    color: #059669;
}

.bulk-results-summary.has-errors {
    background: #fef2f2;
    color: #dc2626;
}

@media (max-width: 640px) {
    .bulk-preview-wrap {
        max-height: 240px;
    }

    .bulk-summary {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .su-header-right {
        flex-wrap: wrap;
        gap: 6px;
    }
}


/* ═══════════════════════════════════════════
   AI Content Generation (aic-)
   ═══════════════════════════════════════════ */

/* Stats Row */
.aic-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.aic-stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.aic-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.aic-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aic-stat-blue { background: #e8f0fe; color: #1a73e8; }
.aic-stat-green { background: #e6f4ea; color: #1e8e3e; }
.aic-stat-purple { background: #f3e8fd; color: #7c3aed; }
.aic-stat-amber { background: #fef3cd; color: #d97706; }

.aic-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.aic-stat-label {
    font-size: 13px;
    color: var(--text-lighter);
    margin-top: 4px;
}

/* Generator Layout (side-by-side form + preview) */
.aic-generator-layout,
.aic-worksheet-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.aic-generator-form,
.aic-worksheet-config {
    min-width: 0;
}

.aic-generator-preview,
.aic-worksheet-preview {
    min-width: 0;
    position: sticky;
    top: 96px;
}

/* Form Card */
.aic-form-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.aic-form-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-dark);
}

.aic-form-desc {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0 0 20px;
    line-height: 1.5;
}

.aic-form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.aic-form-actions .btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aic-form-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.aic-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-dark);
    cursor: pointer;
}

.aic-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Preview Card */
.aic-preview-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.aic-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
}

.aic-preview-header h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--text-dark);
}

.aic-preview-actions {
    display: flex;
    gap: 6px;
}

.aic-preview-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.aic-preview-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-lighter);
}

.aic-preview-empty svg {
    color: #d0d5dd;
    margin-bottom: 16px;
}

.aic-preview-empty p {
    font-size: 14px;
    color: var(--text-light);
    margin: 0 0 8px;
}

.aic-preview-hint {
    font-size: 12px;
    color: var(--text-lighter);
}

/* Generated Content Preview */
.aic-preview-content {
    font-size: 14px;
    line-height: 1.6;
}

.aic-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.aic-meta-tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    background: #f0f2f5;
    color: var(--text-light);
    font-size: 11px;
    font-weight: 500;
}

.aic-preview-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 16px;
    color: var(--text-dark);
}

.aic-question-block {
    display: flex;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f2f5;
}

.aic-question-block:last-child {
    border-bottom: none;
}

.aic-question-num {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 14px;
    min-width: 28px;
    flex-shrink: 0;
}

.aic-question-content {
    flex: 1;
    min-width: 0;
}

.aic-question-text {
    margin: 0 0 8px;
    color: var(--text-dark);
}

.aic-mc-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.aic-mc-option {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-dark);
    background: #f8f9fa;
}

.aic-mc-option span:first-child {
    font-weight: 600;
    margin-right: 4px;
}

.aic-mc-option.aic-correct {
    background: #e6f4ea;
    color: #1e8e3e;
}

.aic-answer-badge {
    font-size: 10px;
    font-weight: 600;
    background: #1e8e3e;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    text-transform: uppercase;
}

.aic-answer-line {
    font-size: 13px;
    padding: 8px 10px;
    background: #f0f7ff;
    border-radius: 6px;
    margin-top: 8px;
    color: var(--text-dark);
}

.aic-explanation {
    font-size: 12px;
    padding: 8px 10px;
    background: #fffbeb;
    border-radius: 6px;
    margin-top: 6px;
    color: #92400e;
}

.aic-marks {
    font-size: 12px;
    color: var(--text-lighter);
    font-style: italic;
    float: right;
}

.aic-answer-space {
    border: 1px dashed #d0d5dd;
    border-radius: 6px;
    padding: 20px;
    margin-top: 8px;
    text-align: center;
    color: #d0d5dd;
    font-size: 12px;
    min-height: 60px;
}

.aic-sub-question {
    font-size: 13px;
    color: var(--text-dark);
    padding: 4px 0 4px 16px;
    margin-top: 8px;
    font-weight: 500;
}

.aic-preview-note {
    margin-top: 20px;
    padding: 12px 16px;
    background: #f0f7ff;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-light);
    text-align: center;
}

.aic-preview-note a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Generating animation */
.aic-generating {
    text-align: center;
    padding: 60px 24px;
}

.aic-generating p {
    font-size: 14px;
    color: var(--text-dark);
    margin: 16px 0 4px;
}

.aic-generating span {
    font-size: 12px;
    color: var(--text-lighter);
}

.aic-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: aic-spin 0.6s linear infinite;
}

.aic-spinner-lg {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #e8f0fe;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: aic-spin 0.8s linear infinite;
}

@keyframes aic-spin {
    to { transform: rotate(360deg); }
}

/* Worksheet Sections Builder */
.aic-sections-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.aic-section-item {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 10px;
}

.aic-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.aic-section-num {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 14px;
    min-width: 24px;
    text-align: center;
}

.aic-section-title {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

.aic-section-type {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
    min-width: 100px;
}

.aic-section-count {
    width: 56px;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    background: #fff;
}

.aic-section-remove {
    background: none;
    border: none;
    color: #d0d5dd;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.aic-section-remove:hover {
    color: #ff4757;
}

/* Worksheet Preview Styles */
.aic-ws-school-header {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    padding: 12px;
    border-bottom: 2px solid var(--text-dark);
    margin-bottom: 16px;
    color: var(--text-dark);
}

.aic-ws-header {
    margin-bottom: 24px;
}

.aic-ws-header h3 {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--text-dark);
}

.aic-ws-info {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.aic-ws-fields {
    font-size: 13px;
    color: var(--text-dark);
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.aic-ws-section {
    margin-top: 20px;
}

.aic-ws-section h4 {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-dark);
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.aic-section-instruction {
    font-size: 12px;
    color: var(--text-lighter);
    margin: 0 0 12px;
    font-style: italic;
}

.aic-ws-answers {
    margin-top: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.aic-ws-answers h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
    color: var(--text-dark);
}

.aic-answer-section {
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.aic-tf-options {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 6px;
}

/* Assessment Specific */
.aic-asm-cover {
    text-align: center;
    padding: 24px 16px;
    border: 2px solid var(--text-dark);
    border-radius: 8px;
    margin-bottom: 24px;
}

.aic-asm-cover-school {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-dark);
}

.aic-asm-cover h3 {
    font-size: 20px;
    font-weight: 700;
    margin: 8px 0 16px;
    color: var(--text-dark);
}

.aic-asm-cover-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    text-align: left;
    max-width: 360px;
    margin: 0 auto 16px;
    font-size: 13px;
    color: var(--text-dark);
}

.aic-asm-cover-instructions {
    text-align: left;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 16px 0;
}

.aic-asm-cover-instructions h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px;
}

.aic-asm-cover-instructions ol {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-dark);
}

.aic-asm-marking {
    margin-top: 24px;
    padding: 16px;
    background: #fff8f0;
    border: 1px solid #f59e0b;
    border-radius: 8px;
}

.aic-asm-marking h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #92400e;
}

.aic-marking-section {
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-dark);
}

/* Bloom's Taxonomy */
.aic-blooms-tag {
    margin-top: 16px;
    padding: 16px;
    background: #f0f7ff;
    border-radius: 8px;
    border: 1px solid #bfdbfe;
}

.aic-blooms-tag h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 10px;
    color: #1e40af;
}

.aic-blooms-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.aic-blooms-level {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 500;
}

.aic-bl-1 { background: #fee2e2; color: #991b1b; }
.aic-bl-2 { background: #fef3c7; color: #92400e; }
.aic-bl-3 { background: #d1fae5; color: #065f46; }
.aic-bl-4 { background: #dbeafe; color: #1e40af; }
.aic-bl-5 { background: #ede9fe; color: #5b21b6; }
.aic-bl-6 { background: #fce7f3; color: #9d174d; }

/* Resource Library */
.aic-library-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.aic-library-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.aic-library-search svg {
    color: var(--text-lighter);
    flex-shrink: 0;
}

.aic-library-search input {
    border: none;
    outline: none;
    font-size: 14px;
    width: 100%;
    background: transparent;
}

.aic-library-filters {
    display: flex;
    gap: 8px;
}

.aic-library-filters select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: var(--text-dark);
}

.aic-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.aic-library-card {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px;
    position: relative;
    transition: box-shadow 0.2s;
}

.aic-library-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.aic-library-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.aic-lib-blue { background: #e8f0fe; color: #1a73e8; }
.aic-lib-green { background: #e6f4ea; color: #1e8e3e; }
.aic-lib-purple { background: #f3e8fd; color: #7c3aed; }

.aic-library-card-body {
    flex: 1;
    min-width: 0;
}

.aic-library-card-body h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aic-library-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
}

.aic-library-card-date {
    font-size: 11px;
    color: var(--text-lighter);
}

.aic-library-card-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    color: #d0d5dd;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

.aic-library-card:hover .aic-library-card-delete {
    opacity: 1;
}

.aic-library-card-delete:hover {
    color: #ff4757;
    background: #fff0f0;
}

.aic-library-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 24px;
    color: var(--text-lighter);
}

.aic-library-empty svg {
    color: #d0d5dd;
    margin-bottom: 12px;
}

.aic-library-empty h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--text-dark);
}

.aic-library-empty p {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0 0 16px;
}

/* ── AI Content Responsive ── */
@media (max-width: 1200px) {
    .aic-generator-layout,
    .aic-worksheet-layout {
        grid-template-columns: 1fr;
    }

    .aic-generator-preview,
    .aic-worksheet-preview {
        position: static;
    }
}

@media (max-width: 968px) {
    .aic-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .aic-stats-row {
        grid-template-columns: 1fr;
    }

    .aic-library-header {
        flex-direction: column;
        align-items: stretch;
    }

    .aic-library-search {
        max-width: none;
    }

    .aic-library-filters {
        flex-wrap: wrap;
    }

    .aic-library-filters select {
        flex: 1;
        min-width: 0;
    }

    .aic-section-header {
        flex-wrap: wrap;
    }

    .aic-section-title {
        order: 2;
        flex-basis: 100%;
    }

    .aic-library-grid {
        grid-template-columns: 1fr;
    }

    .aic-asm-cover-details {
        grid-template-columns: 1fr;
    }

    .aic-ws-info {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .aic-form-options {
        flex-direction: column;
        gap: 10px;
    }

    .aic-blooms-grid {
        flex-direction: column;
    }
}

/* AI-generated content rendering */
.aic-rendered-content {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-dark);
    word-wrap: break-word;
}

.aic-rendered-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 24px 0 12px;
    color: var(--text-dark);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 6px;
}

.aic-rendered-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 10px;
    color: var(--text-dark);
}

.aic-rendered-content h5 {
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: var(--text-dark);
}

.aic-rendered-content strong {
    font-weight: 600;
    color: #1a1a2e;
}

.aic-rendered-content em {
    font-style: italic;
}

.aic-rendered-content pre {
    background: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
    overflow-x: auto;
    font-size: 13px;
}

.aic-rendered-content code {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.aic-rendered-content pre code {
    background: none;
    padding: 0;
}

.aic-rendered-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

.aic-preview-footer {
    margin-top: 20px;
    padding: 10px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-light);
    text-align: right;
}

.aic-preview-error {
    text-align: center;
    padding: 48px 24px;
    color: #dc3545;
}

.aic-preview-error svg {
    margin-bottom: 12px;
    stroke: #dc3545;
}

.aic-preview-error p {
    font-size: 14px;
    margin: 0;
}

.aic-meta-tag.aic-tag-ai {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 500;
}

/* ── AI Content: Image Upload Zone ── */

.aic-image-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--bg-light);
}

.aic-image-upload-zone:hover,
.aic-image-upload-zone.dragover {
    border-color: #0066ff;
    background: rgba(0, 102, 255, 0.04);
}

.aic-image-upload-zone svg {
    color: #999;
}

.aic-image-upload-text {
    font-size: 13px;
    color: var(--text-lighter);
}

.aic-image-upload-hint {
    font-size: 11px;
    color: #aaa;
}

.aic-image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.aic-image-previews:empty {
    display: none;
}

.aic-image-preview-item {
    position: relative;
    width: 100px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.aic-image-preview-item img {
    width: 100%;
    height: 72px;
    object-fit: cover;
    display: block;
}

.aic-image-preview-info {
    padding: 4px 6px;
}

.aic-image-preview-name {
    display: block;
    font-size: 10px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aic-image-preview-size {
    font-size: 10px;
    color: #999;
}

.aic-image-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.aic-image-preview-item:hover .aic-image-preview-remove {
    opacity: 1;
}

.aic-doc-preview-icon {
    width: 100%;
    height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    gap: 2px;
}

.aic-doc-ext-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .aic-image-upload-zone {
        padding: 16px;
    }

    .aic-image-preview-item {
        width: 80px;
    }

    .aic-image-preview-item img,
    .aic-doc-preview-icon {
        height: 56px;
    }
}

/* ── School AI Provider Section ── */

.school-ai-subsection {
    margin-bottom: 20px;
}

.school-ai-subsection-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 4px;
    display: block;
}

.school-ai-provider-checklist {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
}

.school-ai-provider-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 13px;
}

.school-ai-provider-check:hover {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.03);
}

.school-ai-provider-check input[type="checkbox"] {
    flex-shrink: 0;
}

.sap-check-content {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.sap-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ccc;
    flex-shrink: 0;
}

.sap-status-dot.active {
    background: #22c55e;
}

.sap-check-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sap-check-model {
    color: var(--text-lighter);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* AI Token Usage Bar */

.ai-token-usage-bar-wrap {
    margin-top: 6px;
}

.ai-token-usage-bar {
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.ai-token-usage-fill {
    height: 100%;
    border-radius: 4px;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.ai-token-usage-fill.warning {
    background: #f59e0b;
}

.ai-token-usage-fill.danger {
    background: #ef4444;
}

.ai-token-usage-text {
    display: block;
    font-size: 12px;
    color: var(--text-lighter);
    margin-top: 4px;
}

/* Custom Provider Cards */

.school-custom-provider-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 6px;
    gap: 12px;
}

.scpc-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.scpc-info strong {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scpc-model {
    color: var(--text-lighter);
    font-size: 12px;
    white-space: nowrap;
}

.scpc-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Custom Provider Form */

.school-custom-provider-form {
    border: 2px solid var(--primary);
    border-radius: 10px;
    padding: 20px;
    background: rgba(0, 102, 255, 0.02);
    margin-top: 10px;
}

.school-custom-provider-form h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 16px;
}

.scpf-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .school-custom-provider-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .scpc-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ── Plans Management ── */
.plans-header {
    margin-bottom: 20px;
}

.plans-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.plans-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.plan-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.plan-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.plan-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.plan-card-inactive {
    opacity: 0.6;
}

.plan-card-color-bar {
    height: 4px;
    width: 100%;
}

.plan-card-body {
    padding: 20px;
}

.plan-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.plan-card-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 10px;
}

.plan-card-icon svg {
    width: 22px;
    height: 22px;
}

.plan-card-title-wrap {
    flex: 1;
    min-width: 0;
}

.plan-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.3;
}

.plan-card-slug {
    font-size: 12px;
    color: var(--text-lighter);
    font-family: monospace;
}

.plan-badge-inactive {
    background: #fef2f2;
    color: #dc2626;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
}

.plan-card-desc {
    font-size: 13px;
    color: var(--text-light);
    margin: 0 0 16px;
    line-height: 1.5;
}

.plan-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
}

.plan-stat {
    text-align: center;
}

.plan-stat-value {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1.3;
}

.plan-stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-lighter);
    margin-top: 2px;
}

.plan-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.plan-feature-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.plan-card-price {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
}

.plan-price-yearly {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-lighter);
}

.plan-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    border-top: 1px solid #f0f0f0;
}

.plan-school-count {
    font-size: 13px;
    color: var(--text-lighter);
}

.plan-card-actions {
    display: flex;
    gap: 8px;
}

.plan-feature-toggles {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.plan-feature-toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-dark);
}

.plan-feature-toggle-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0066ff;
}

/* Addon table */
.addon-table-wrap {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

.addon-table-wrap .data-table {
    width: 100%;
    border-collapse: collapse;
}

.addon-table-wrap .data-table th,
.addon-table-wrap .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.addon-table-wrap .data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text-light);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.addon-table-wrap .data-table tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.active {
    background: #ecfdf5;
    color: #059669;
}

.status-badge.inactive {
    background: #fef2f2;
    color: #dc2626;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-weight: 500;
}

.btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

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

@media (max-width: 640px) {
    .plan-cards-grid {
        grid-template-columns: 1fr;
    }

    .plan-card-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .plans-header-row {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ═══════════════════════════════════════════════════
   AI Analytics
   ═══════════════════════════════════════════════════ */

/* Stat card icon variants */
.stat-card-icon.ai-conversations {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.stat-card-icon.ai-students {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.stat-card-icon.ai-tokens {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-card-icon.ai-whatsapp {
    background: rgba(37, 211, 102, 0.1);
    color: #25d366;
}

/* Analytics toolbar */
.analytics-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}

.analytics-toolbar h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

.analytics-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Analytics select */
.analytics-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 160px;
}

.analytics-select:focus {
    outline: none;
    border-color: #0066FF;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Refresh button */
.btn-refresh {
    width: 36px;
    height: 36px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-refresh:hover {
    background: #f8fafc;
    color: #0066FF;
    border-color: #0066FF;
}

/* Analytics chart container */
.analytics-chart {
    width: 100%;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-chart svg {
    width: 100%;
    height: auto;
}

/* Scrollable panel body */
.panel-body-scroll {
    max-height: 400px;
    overflow-y: auto;
}

/* Analytics table */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.analytics-table thead th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 600;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.analytics-table tbody td {
    padding: 10px 12px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
}

.analytics-table tbody tr:hover {
    background: #f8fafc;
}

.analytics-table tbody tr:last-child td {
    border-bottom: none;
}

/* Link button */
.btn-link {
    background: none;
    border: none;
    color: #0066FF;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 0;
    text-decoration: none;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Crisis alerts */
.analytics-crisis-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.crisis-stat {
    text-align: center;
    padding: 12px 8px;
    background: #f8fafc;
    border-radius: 8px;
}

.crisis-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.crisis-stat-value.crisis-warn {
    color: #ef4444;
}

.crisis-stat-label {
    font-size: 11px;
    color: #64748b;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.crisis-recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.crisis-row {
    padding: 10px 12px;
    background: #fef2f2;
    border-radius: 8px;
    border-left: 3px solid #ef4444;
}

.crisis-row-pattern {
    font-size: 13px;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 4px;
}

.crisis-row-meta {
    font-size: 12px;
    color: #6b7280;
}

/* EDB compliance progress bars */
.edb-requirement {
    margin-bottom: 16px;
}

.edb-req-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
}

.edb-progress-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.edb-progress-fill {
    height: 100%;
    background: #0066FF;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.edb-progress-fill.edb-done {
    background: #10b981;
}

.edb-subject-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #eff6ff;
    color: #1e40af;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

/* Responsive analytics */
@media (max-width: 768px) {
    .analytics-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .analytics-toolbar-right {
        justify-content: flex-end;
    }

    .analytics-select {
        min-width: 0;
        flex: 1;
    }

    .analytics-crisis-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-table {
        font-size: 12px;
    }

    .analytics-table thead th,
    .analytics-table tbody td {
        padding: 8px 6px;
    }
}

/* ══════════════════════════════════════════════════════
   AI LITERACY PAGE (ail- prefix)
   ══════════════════════════════════════════════════════ */

/* ── Module Cards Grid ── */
.ail-level-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ail-level-btn {
    padding: 6px 16px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ail-level-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

.ail-level-btn.active {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
}

.ail-modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.ail-module-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
}

.ail-module-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.ail-module-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.ail-module-num {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    color: #fff;
}

.ail-module-num.primary { background: #3b82f6; }
.ail-module-num.junior { background: #8b5cf6; }
.ail-module-num.senior { background: #ec4899; }

.ail-module-info {
    flex: 1;
    min-width: 0;
}

.ail-module-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.ail-module-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

.ail-module-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ail-module-chevron {
    color: #9ca3af;
    transition: transform 0.2s;
    flex-shrink: 0;
    margin-top: 4px;
}

.ail-module-card.expanded {
    grid-column: 1 / -1;
}

.ail-module-card.expanded .ail-module-chevron {
    transform: rotate(180deg);
}

.ail-module-body {
    display: none;
    padding: 0 20px 16px;
    border-top: 1px solid #f3f4f6;
}

.ail-module-card.expanded .ail-module-body {
    display: block;
}

.ail-module-desc {
    font-size: 13px;
    color: #4b5563;
    line-height: 1.6;
    margin-top: 12px;
}

.ail-module-topics {
    margin-top: 12px;
}

.ail-module-topics h5 {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.ail-module-topics ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ail-module-topics li {
    font-size: 13px;
    color: #4b5563;
    padding: 4px 0 4px 16px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ail-module-topics li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d1d5db;
    flex-shrink: 0;
}

.ail-topic-text {
    flex: 1;
    min-width: 0;
}

.ail-topic-plan-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #6366f1;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease;
    flex-shrink: 0;
}

.ail-module-topics li:hover .ail-topic-plan-btn {
    opacity: 1;
}

.ail-topic-plan-btn:hover {
    background: #e0e7ff;
    color: #4f46e5;
}

.ail-topics-hint {
    font-size: 11px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #9ca3af;
}

/* ── Skills Assessment Accordion ── */
.ail-skills-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ail-skill-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.ail-skill-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.15s;
}

.ail-skill-header:hover {
    background: #f9fafb;
}

.ail-skill-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ail-skill-icon.understanding { background: #dbeafe; color: #2563eb; }
.ail-skill-icon.application { background: #dcfce7; color: #16a34a; }
.ail-skill-icon.ethics { background: #fef3c7; color: #d97706; }
.ail-skill-icon.computational { background: #f3e8ff; color: #9333ea; }
.ail-skill-icon.creation { background: #fce7f3; color: #db2777; }

.ail-skill-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.ail-skill-chevron {
    color: #9ca3af;
    transition: transform 0.2s;
}

.ail-skill-card.expanded .ail-skill-chevron {
    transform: rotate(180deg);
}

.ail-skill-body {
    display: none;
    padding: 0 20px 20px;
    border-top: 1px solid #f3f4f6;
}

.ail-skill-card.expanded .ail-skill-body {
    display: block;
}

.ail-skill-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 12px 0 16px;
    line-height: 1.5;
}

.ail-rubric-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ail-rubric-table th {
    background: #f9fafb;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.ail-rubric-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
    vertical-align: top;
    line-height: 1.5;
}

.ail-rubric-level {
    font-weight: 600;
    white-space: nowrap;
}

.ail-rubric-level.beginner { color: #2563eb; }
.ail-rubric-level.intermediate { color: #d97706; }
.ail-rubric-level.advanced { color: #16a34a; }

/* ── Activity Planner ── */
.ail-activity-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.ail-activity-form .aic-form-card,
.ail-activity-preview .aic-preview-card {
    height: 100%;
}

.ail-activity-records {
    margin-top: 32px;
}

.ail-records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ail-records-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.ail-records-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    font-size: 13px;
}

.ail-records-table thead th {
    background: #f9fafb;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.ail-records-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid #f3f4f6;
    color: #4b5563;
    vertical-align: middle;
}

.ail-records-table tbody tr:hover {
    background: #f9fafb;
}

.ail-records-table tbody tr:last-child td {
    border-bottom: none;
}

.ail-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ail-status-badge:hover {
    opacity: 0.8;
}

.ail-status-badge.planned {
    background: #fef3c7;
    color: #92400e;
}

.ail-status-badge.completed {
    background: #dcfce7;
    color: #166534;
}

.ail-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.ail-action-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

.ail-records-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 14px;
}

/* ── Resources Tab ── */
.ail-resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.ail-resource-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.ail-resource-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ail-resource-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.ail-resource-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.ail-resource-icon.teaching_guide { background: #dbeafe; }
.ail-resource-icon.online_tool { background: #dcfce7; }
.ail-resource-icon.lesson_pack { background: #f3e8ff; }
.ail-resource-icon.edb_resource { background: #fef3c7; }
.ail-resource-icon.video { background: #fce7f3; }
.ail-resource-icon.external_link { background: #e0e7ff; }
.ail-resource-icon.other { background: #f3f4f6; }

.ail-resource-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    flex: 1;
}

.ail-resource-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 12px;
    flex: 1;
}

.ail-resource-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}

.ail-resource-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.ail-resource-tag {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    background: #f3f4f6;
    color: #6b7280;
}

.ail-resource-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.ail-resource-link:hover {
    text-decoration: underline;
}

.ail-resource-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #d1d5db;
    border-radius: 4px;
    transition: color 0.15s;
}

.ail-resource-delete:hover {
    color: #ef4444;
}

.ail-resource-section-label {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.ail-resource-section-label:first-child {
    margin-top: 0;
}

/* ── Add Resource Modal ── */
.ail-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.ail-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.ail-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    transform: translateY(20px);
    transition: transform 0.2s;
}

.ail-modal-overlay.show .ail-modal {
    transform: translateY(0);
}

.ail-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.ail-modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.ail-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    font-size: 20px;
    line-height: 1;
}

.ail-modal-body {
    padding: 24px;
}

.ail-modal-body .ait-form-group {
    margin-bottom: 16px;
}

.ail-modal-body .ait-form-group:last-child {
    margin-bottom: 0;
}

.ail-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
}

/* ── Export Button ── */
.ail-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
}

.ail-export-btn:hover {
    border-color: #6366f1;
    color: #6366f1;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
    .ail-activity-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 968px) {
    .ail-modules-grid {
        grid-template-columns: 1fr;
    }

    .ail-resources-grid {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 640px) {
    .ail-level-filters {
        gap: 6px;
    }

    .ail-level-btn {
        padding: 5px 12px;
        font-size: 12px;
    }

    .ail-module-header {
        padding: 12px 14px;
    }

    .ail-module-body {
        padding: 0 14px 12px;
    }

    .ail-rubric-table th,
    .ail-rubric-table td {
        padding: 8px 10px;
        font-size: 12px;
    }

    /* ail-records-table card view handled in global table card view section below */

    .ail-topic-plan-btn {
        opacity: 1;
        padding: 3px 6px;
        font-size: 10px;
    }

    .ail-topics-hint {
        display: none;
    }
}

/* ══════════════════════════════════════════
   AI Literacy — Assessment Styles
   ══════════════════════════════════════════ */

.ail-assess-toggle {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 20px;
    width: fit-content;
}

.ail-assess-toggle-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.ail-assess-toggle-btn.active {
    background: #fff;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ail-assess-toggle-btn:hover:not(.active) {
    color: #334155;
}

.ail-assess-subview {
    display: none;
}

.ail-assess-subview.active {
    display: block;
}

.ail-assess-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ail-assess-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ail-assess-toolbar-left label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
}

.ail-assess-toolbar-left select {
    min-width: 220px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: #1e293b;
}

.ail-assess-student-count {
    font-size: 12px;
    color: #64748b;
}

.ail-assess-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.ail-assess-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
}

.ail-assess-empty svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.ail-assess-empty p {
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    margin: 0 0 6px;
}

.ail-assess-empty span {
    font-size: 12px;
}

.ail-assess-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    color: #64748b;
    font-size: 13px;
}

.ail-assess-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ail-assess-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.ail-assess-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}

.ail-assess-table tbody tr:last-child {
    border-bottom: none;
}

.ail-assess-table tbody tr:hover {
    background: #f8fafc;
}

.ail-assess-table td {
    padding: 8px 12px;
    vertical-align: middle;
}

.ail-assess-student-name {
    font-weight: 500;
    color: #1e293b;
    white-space: nowrap;
    min-width: 140px;
}

.ail-assess-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.ail-assess-badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.ail-lvl-none {
    background: #f1f5f9;
    color: #94a3b8;
    border-color: #e2e8f0;
}

.ail-lvl-beginner {
    background: #fffbeb;
    color: #b45309;
    border-color: #fcd34d;
}

.ail-lvl-intermediate {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #93c5fd;
}

.ail-lvl-advanced {
    background: #f0fdf4;
    color: #15803d;
    border-color: #86efac;
}

.ail-assess-notes-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.15s;
}

.ail-assess-notes-btn:hover {
    color: #4f46e5;
    background: #eef2ff;
}

/* Notes modal dimension rows */
.ail-assess-notes-dimensions {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ail-assess-note-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.ail-assess-badge-sm {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
}

.ail-assess-note-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
}

.ail-assess-note-input:focus {
    outline: none;
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Responsive */
@media (max-width: 768px) {
    .ail-assess-toggle {
        width: 100%;
    }

    .ail-assess-toggle-btn {
        flex: 1;
        text-align: center;
        padding: 8px 12px;
    }

    .ail-assess-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ail-assess-toolbar-left {
        flex-direction: column;
        align-items: stretch;
    }

    .ail-assess-toolbar-left select {
        min-width: 100%;
    }

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

    .ail-assess-badge {
        min-width: 64px;
        padding: 3px 8px;
        font-size: 10px;
    }
}

/* ═══════════════════════════════════════
   Lessons (les- prefix)
   ═══════════════════════════════════════ */

.les-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 4px 0;
}

.les-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
}

.les-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.les-card-header {
    padding: 16px 16px 0;
}

.les-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.les-badge-subject {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #eff6ff;
    color: #2563eb;
}

.les-badge-grade {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #f3e8ff;
    color: #7c3aed;
}

.les-badge-demo {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #fffbeb;
    color: #d97706;
}

.les-badge-premium {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.les-badge-official {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #ecfdf5;
    color: #059669;
}

.les-badge-draft {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #f3f4f6;
    color: #6b7280;
}

.les-badge-fork {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #ede9fe;
    color: #7c3aed;
}

.lbr-forked-note {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 6px;
    background: #ede9fe;
    color: #5b21b6;
    border: 1px solid #c4b5fd;
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    line-height: 1.5;
}

.lbr-forked-note svg {
    flex-shrink: 0;
}

.lbr-forked-note small {
    display: block;
    width: 100%;
    color: #6d28d9;
    opacity: 0.8;
}

.les-badge-community {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e0f2fe;
    color: #0284c7;
}

.les-badge-pending {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #fef3c7;
    color: #b45309;
}

.les-approval-toggle {
    padding-left: 20px;
    font-size: 12px;
    color: #6b7280;
}

.les-card-body {
    padding: 12px 16px;
    flex: 1;
}

.les-card-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px;
    line-height: 1.3;
}

.les-card-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 8px;
    line-height: 1.4;
}

.les-card-creator {
    font-size: 12px;
    color: #9ca3af;
}

.les-creator-link {
    color: #3b82f6;
    text-decoration: none;
    cursor: pointer;
}

.les-creator-link:hover {
    text-decoration: underline;
    color: #2563eb;
}

.les-card-footer {
    padding: 12px 16px;
    border-top: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.les-card-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #9ca3af;
}

.les-card-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.btn-warning {
    background: #f59e0b;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

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

.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #374151;
    transition: background 0.15s;
}

.btn-xs:hover {
    background: #f9fafb;
}

.btn-xs.btn-danger {
    border-color: #fecaca;
    color: #dc2626;
    background: #fef2f2;
}

.btn-xs.btn-danger:hover {
    background: #fee2e2;
}

.btn-xs.btn-warning {
    border-color: #fde68a;
    color: #d97706;
    background: #fffbeb;
}

.btn-xs.btn-warning:hover {
    background: #fef3c7;
}

/* Toolbar */
.les-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.les-toolbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.les-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.les-filter-select {
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    color: #374151;
    background: #fff;
    cursor: pointer;
}

.les-search-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 0 10px;
}

.les-search-input {
    border: none;
    outline: none;
    padding: 6px 0;
    font-size: 13px;
    min-width: 180px;
    background: transparent;
}

/* Dropzone */
.les-dropzone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 32px;
    text-align: center;
    color: #9ca3af;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.les-dropzone:hover,
.les-dropzone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.les-dropzone p {
    margin: 8px 0 4px;
    font-size: 14px;
    color: #6b7280;
}

.les-dropzone span {
    font-size: 12px;
}

.les-file-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.les-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 12px;
    color: #374151;
}

.les-file-chip-remove {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0 2px;
}

.les-file-chip-remove:hover {
    color: #ef4444;
}

/* Editor wrap */
.les-editor-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    min-height: 300px;
}

.les-editor-wrap textarea {
    width: 100%;
    min-height: 300px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
}

.les-content-rendered {
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fafafa;
    overflow-y: auto;
    max-height: 400px;
    font-size: 14px;
    line-height: 1.6;
}

.les-content-rendered h3 { font-size: 18px; margin: 16px 0 8px; }
.les-content-rendered h4 { font-size: 16px; margin: 14px 0 6px; }
.les-content-rendered h5 { font-size: 14px; margin: 12px 0 4px; }
.les-content-rendered pre { background: #f3f4f6; padding: 12px; border-radius: 6px; overflow-x: auto; }
.les-content-rendered code { background: #f3f4f6; padding: 1px 4px; border-radius: 3px; font-size: 13px; }
.les-content-rendered pre code { background: none; padding: 0; }
.les-content-rendered ul { padding-left: 20px; }
.les-content-rendered li { margin-bottom: 4px; }

/* Attachments in view modal */
.les-attachments {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.les-attachments h5 {
    margin: 0 0 10px;
    font-size: 14px;
    color: #374151;
}

.les-attachment-item {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.les-attachment-item a {
    color: #2563eb;
    text-decoration: none;
    font-size: 13px;
}

.les-attachment-item a:hover {
    text-decoration: underline;
}

/* Empty state */
.les-empty {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.les-empty svg {
    margin-bottom: 12px;
}

.les-empty p {
    font-size: 15px;
    margin: 0;
}

/* Visibility radio options */
.les-visibility-options {
    display: flex;
    gap: 16px;
    padding: 8px 0;
}

.les-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}

.les-radio input[type="radio"] {
    cursor: pointer;
}

/* Request access button */
.les-btn-request {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: #fff;
    cursor: pointer;
    transition: opacity 0.15s;
}

.les-btn-request:hover {
    opacity: 0.85;
}

/* Responsive */
@media (max-width: 768px) {
    .les-grid {
        grid-template-columns: 1fr;
    }

    .les-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .les-toolbar-left,
    .les-toolbar-right {
        flex-wrap: wrap;
    }

    .les-editor-wrap {
        grid-template-columns: 1fr;
    }

    .les-card-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ═══════════════════════════════════════════════════════════════
   LESSON BUILDER (lbr- prefix)
   ═══════════════════════════════════════════════════════════════ */

/* ── Page Layout ── */
.lbr-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f5f7fa;
    font-family: 'Inter', sans-serif;
}

/* ── Top Bar ── */
.lbr-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 12px;
}

.lbr-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.lbr-topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.lbr-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #64748b;
    transition: all 0.15s;
    flex-shrink: 0;
}

.lbr-back-btn:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.lbr-title-input {
    font-size: 18px;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    min-width: 0;
    padding: 4px 8px;
    border-radius: 6px;
    color: #1e293b;
}

.lbr-title-input:focus {
    background: #f8fafc;
    box-shadow: 0 0 0 2px #3b82f620;
}

.lbr-title-input::placeholder {
    color: #94a3b8;
}

.lbr-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.lbr-status-saved {
    color: #10b981;
    background: #ecfdf5;
}

.lbr-status-dirty {
    color: #f59e0b;
    background: #fffbeb;
}

/* ── Container ── */
.lbr-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ── Sidebar ── */
.lbr-sidebar {
    width: 280px;
    background: #fff;
    border-right: 1px solid #e2e8f0;
    overflow-y: auto;
    flex-shrink: 0;
    height: calc(100vh - 57px);
    position: sticky;
    top: 57px;
}

.lbr-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 110;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #3b82f6;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    align-items: center;
    justify-content: center;
}

.lbr-sidebar-overlay {
    display: none;
}

/* Settings Section */
.lbr-settings-section {
    border-bottom: 1px solid #f1f5f9;
}

.lbr-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    user-select: none;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lbr-settings-header:hover {
    background: #f8fafc;
}

.lbr-settings-header svg {
    transition: transform 0.2s;
}

.lbr-settings-header.collapsed svg {
    transform: rotate(-90deg);
}

.lbr-settings-body {
    padding: 0 16px 16px;
}

.lbr-settings-body.collapsed {
    display: none;
}

.lbr-settings-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin: 10px 0 4px;
}

.lbr-settings-label:first-child {
    margin-top: 0;
}

.lbr-settings-input {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #1e293b;
    background: #fff;
    font-family: inherit;
    box-sizing: border-box;
}

.lbr-settings-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f620;
}

.lbr-settings-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #1e293b;
    background: #fff;
    cursor: pointer;
    box-sizing: border-box;
}

.lbr-settings-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f620;
}

/* Cover Upload */
.lbr-cover-upload {
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.15s;
}

.lbr-cover-upload:hover {
    border-color: #94a3b8;
}

.lbr-cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px;
    color: #94a3b8;
    font-size: 12px;
}

.lbr-cover-preview {
    position: relative;
}

.lbr-cover-preview img {
    width: 100%;
    display: block;
    border-radius: 6px;
}

.lbr-cover-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
}

/* Toggle */
.lbr-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
}

.lbr-toggle input {
    display: none;
}

.lbr-toggle-slider {
    width: 36px;
    height: 20px;
    background: #e2e8f0;
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.lbr-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.lbr-toggle input:checked + .lbr-toggle-slider {
    background: #3b82f6;
}

.lbr-toggle input:checked + .lbr-toggle-slider::after {
    transform: translateX(16px);
}

/* Result Mode Radio Group */
.lbr-result-mode {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lbr-radio-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.lbr-radio-option:hover {
    background: #f1f5f9;
}

.lbr-radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: #0066ff;
    margin-top: 1px;
    cursor: pointer;
    flex-shrink: 0;
}

.lbr-radio-label {
    font-size: 13px;
    color: #475569;
    line-height: 1.4;
    cursor: pointer;
}

/* Block Palette */
.lbr-palette-group {
    margin-bottom: 12px;
}

.lbr-palette-group-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.lbr-palette {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.lbr-palette-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    background: #fafbfc;
    cursor: pointer;
    transition: all 0.15s;
    color: #475569;
    font-size: 11px;
    font-weight: 500;
}

.lbr-palette-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

/* ── Canvas ── */
.lbr-canvas {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    height: calc(100vh - 57px);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Chapter Tabs */
.lbr-chapter-tabs {
    display: flex;
    gap: 4px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: nowrap;
}

.lbr-chapter-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    transition: all 0.15s;
}

.lbr-chapter-tab:hover {
    border-color: #94a3b8;
    color: #1e293b;
}

.lbr-chapter-tab.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.lbr-chapter-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
}

.lbr-chapter-close:hover {
    opacity: 1;
    background: rgba(255,255,255,0.2);
}

.lbr-chapter-add {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 20px;
    font-weight: 300;
    transition: all 0.15s;
    flex-shrink: 0;
}

.lbr-chapter-add:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.lbr-chapter-rename-input {
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #3b82f6;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
    width: 120px;
}

/* Block Cards */
.lbr-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #999;
    border-radius: 10px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: box-shadow 0.15s;
}

.lbr-block:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.lbr-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
}

.lbr-block-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lbr-block-actions {
    display: flex;
    gap: 2px;
}

.lbr-block-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s;
}

.lbr-block-action-btn:hover {
    background: #f1f5f9;
    color: #475569;
}

.lbr-block-delete:hover {
    background: #fef2f2;
    color: #ef4444;
}

.lbr-block-body {
    padding: 14px;
}

/* Empty State */
.lbr-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: #94a3b8;
    text-align: center;
}

.lbr-empty-state p {
    font-size: 14px;
    max-width: 400px;
}

/* Add Block Button */
.lbr-add-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    margin-top: 8px;
}

.lbr-add-block:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* Inline Block Picker */
.lbr-add-block-wrap {
    position: relative;
    margin-top: 8px;
}

.lbr-add-block-wrap .lbr-add-block {
    margin-top: 0;
}

.lbr-inline-picker {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
    animation: lbr-picker-in 0.15s ease-out;
}

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

.lbr-inline-picker-group {
    margin-bottom: 10px;
}

.lbr-inline-picker-group:last-child {
    margin-bottom: 0;
}

.lbr-inline-picker-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.lbr-inline-picker-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.lbr-inline-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: #475569;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.12s;
    white-space: nowrap;
}

.lbr-inline-picker-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.lbr-inline-picker-btn svg {
    flex-shrink: 0;
}

/* ── Text Block ── */
.lbr-text-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.lbr-text-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #475569;
    font-size: 14px;
    transition: all 0.1s;
}

.lbr-text-btn:hover {
    background: #e2e8f0;
}

.lbr-text-editor {
    min-height: 120px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #1e293b;
    outline: none;
    word-wrap: break-word;
}

.lbr-text-editor:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f620;
}

.lbr-text-editor:empty::before {
    content: attr(data-placeholder);
    color: #94a3b8;
    pointer-events: none;
}

.lbr-text-editor h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 8px 0;
}

.lbr-text-editor ul, .lbr-text-editor ol {
    padding-left: 24px;
    margin: 8px 0;
}

.lbr-text-editor a {
    color: #3b82f6;
    text-decoration: underline;
}

/* ── Upload Zone ── */
.lbr-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 32px 16px;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.15s;
    text-align: center;
    margin-bottom: 8px;
}

.lbr-upload-zone p {
    font-size: 13px;
    margin: 0;
}

.lbr-upload-zone:hover, .lbr-upload-zone.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
}

.lbr-upload-preview {
    position: relative;
    margin-bottom: 8px;
}

.lbr-upload-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    display: block;
}

.lbr-audio-preview {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lbr-audio-preview audio {
    flex: 1;
    max-width: 100%;
}

.lbr-upload-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 26px;
    text-align: center;
}

.lbr-upload-remove:hover {
    background: #ef4444;
}

.lbr-upload-loading {
    padding: 20px;
    text-align: center;
    color: #3b82f6;
    font-size: 14px;
}

/* ── Audio Block TTS ── */
.lbr-audio-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 12px;
    gap: 0;
}

.lbr-audio-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #94a3b8;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.lbr-audio-tab:hover {
    color: #475569;
}

.lbr-audio-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.lbr-audio-tab svg {
    flex-shrink: 0;
}

.lbr-audio-tab-panel {
    display: none;
}

.lbr-audio-tab-panel.active {
    display: block;
}

.lbr-tts-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lbr-tts-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

.lbr-tts-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.lbr-tts-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.lbr-tts-field {
    flex: 1;
    min-width: 0;
}

.lbr-tts-field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 4px;
}

.lbr-tts-select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #1e293b;
    cursor: pointer;
    box-sizing: border-box;
}

.lbr-tts-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.lbr-tts-char-count {
    font-size: 12px;
    color: #94a3b8;
    text-align: right;
}

.lbr-tts-char-count.over-limit {
    color: #ef4444;
    font-weight: 500;
}

.lbr-tts-generate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.lbr-tts-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0891b2, #0e7490);
    box-shadow: 0 2px 8px rgba(6,182,212,0.35);
}

.lbr-tts-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lbr-tts-generate-btn .lbr-tts-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: lbr-spin 0.6s linear infinite;
}

@keyframes lbr-spin {
    to { transform: rotate(360deg); }
}

.lbr-tts-error {
    font-size: 12px;
    color: #ef4444;
    padding: 6px 8px;
    background: #fef2f2;
    border-radius: 6px;
}

.lbr-tts-voices-loading {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

/* ── MCQ Block ── */
.lbr-options-list {
    margin: 10px 0;
}

.lbr-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #fafbfc;
    transition: all 0.15s;
}

.lbr-option-row.lbr-option-correct {
    background: #ecfdf5;
    border-color: #a7f3d0;
}

.lbr-option-radio-label {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.lbr-option-radio {
    cursor: pointer;
    accent-color: #10b981;
}

.lbr-option-letter {
    font-size: 12px;
    font-weight: 700;
    color: #94a3b8;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.lbr-option-text {
    flex: 1;
    min-width: 0;
}

.lbr-option-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.lbr-option-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}

.lbr-add-option-btn {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.15s;
}

.lbr-add-option-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

/* ── MCQ Image Support ── */
.lbr-option-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lbr-option-content .lbr-option-text {
    width: 100%;
}

.lbr-mcq-question-img,
.lbr-mcq-option-img {
    line-height: 0;
}

.lbr-mcq-img-add {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px dashed #d1d5db;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
    line-height: 1;
}

.lbr-mcq-img-add:hover {
    border-color: #8b5cf6;
    color: #8b5cf6;
    background: #f5f3ff;
}

.lbr-mcq-img-add-sm {
    padding: 3px 8px;
    font-size: 0;
    gap: 0;
}

.lbr-mcq-img-preview {
    position: relative;
    display: inline-block;
    margin-top: 6px;
}

.lbr-mcq-img-preview img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 6px;
    display: block;
}

.lbr-mcq-img-preview-sm {
    margin-top: 4px;
}

.lbr-mcq-img-preview-sm img {
    max-height: 100px;
    max-width: 160px;
}

.lbr-mcq-img-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    line-height: 22px;
    text-align: center;
}

.lbr-mcq-img-remove:hover {
    background: #ef4444;
}

/* ── Reorder Block ── */
.lbr-reorder-list {
    margin: 10px 0;
}

.lbr-reorder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    margin-bottom: 6px;
    background: #fafbfc;
}

.lbr-reorder-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lbr-reorder-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lbr-reorder-item-content .lbr-reorder-text {
    width: 100%;
}

.lbr-reorder-text {
    flex: 1;
    min-width: 0;
}

.lbr-reorder-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.lbr-reorder-remove:hover {
    color: #ef4444;
    background: #fef2f2;
}

.lbr-reorder-hint {
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
    margin-top: 4px;
}

/* ── Fill in the Blank ── */
.lbr-fb-answers-label,
.lbr-dd-dropdowns-label,
.lbr-label-list-header {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    margin: 10px 0 6px;
}

.lbr-fb-answers-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lbr-fb-answer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lbr-fb-answer-num {
    font-size: 13px;
    font-weight: 600;
    color: #0ea5e9;
    min-width: 36px;
    white-space: nowrap;
}

.lbr-fb-answer {
    flex: 1;
    min-width: 0;
}

/* ── Question Media Row (Image + Audio side by side) ── */
.lbr-question-media-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 6px 0;
}

.lbr-question-audio-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border-radius: 8px;
    padding: 6px 10px;
    border: 1px solid #e2e8f0;
}

.lbr-question-audio-preview audio {
    height: 32px;
    max-width: 240px;
}

.lbr-question-audio-preview .lbr-mcq-img-remove {
    position: static;
    flex-shrink: 0;
}

/* ── Insert Marker Button (Fill Blank / Dropdown) ── */
.lbr-cloze-textarea-wrap {
    position: relative;
}

.lbr-insert-marker-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #0ea5e9;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    z-index: 1;
}

.lbr-insert-marker-btn:hover {
    background: #e0f2fe;
    border-color: #7dd3fc;
}

/* ── Matching ── */
.lbr-match-header {
    display: flex;
    gap: 8px;
    padding: 0 36px;
    margin-top: 10px;
}

.lbr-match-col-label {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lbr-match-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 4px;
}

.lbr-match-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lbr-match-num {
    width: 24px;
    font-size: 13px;
    font-weight: 600;
    color: #d946ef;
    text-align: center;
    flex-shrink: 0;
}

.lbr-match-side {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.lbr-match-left,
.lbr-match-right {
    width: 100%;
}

.lbr-match-arrow {
    color: #cbd5e1;
    font-size: 16px;
    flex-shrink: 0;
}

/* ── Dropdown / Cloze ── */
.lbr-dd-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lbr-dd-group {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e2e8f0;
}

.lbr-dd-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.lbr-dd-remove-group {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
}

.lbr-dd-remove-group:hover {
    color: #ef4444;
    background: #fef2f2;
}

.lbr-dd-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.lbr-dd-option-text {
    flex: 1;
    min-width: 0;
}

.lbr-dd-add-opt-btn {
    font-size: 12px !important;
    padding: 4px 10px !important;
    margin-top: 4px;
}

/* ── Labeling / Hotspot ── */
.lbr-label-image-wrap {
    margin: 10px 0;
}

.lbr-label-image-preview {
    position: relative;
    display: inline-block;
}

.lbr-label-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
}

.lbr-label-image-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(239,68,68,0.9);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lbr-label-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lbr-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lbr-label-num {
    width: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #f43f5e;
    text-align: center;
    flex-shrink: 0;
}

.lbr-label-text {
    flex: 1;
    min-width: 0;
}

.lbr-label-pos {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.lbr-label-pos input {
    width: 56px;
}

/* ── Rating / Likert Scale ── */
.lbr-rating-settings {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 10px 0 8px;
}

.lbr-rating-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lbr-rating-field label {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.lbr-rating-field input[type="number"] {
    width: 70px;
}

.lbr-rating-field input[type="text"] {
    width: 160px;
}

.lbr-rating-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.lbr-rating-preview-label {
    font-size: 12px;
    color: #64748b;
}

.lbr-rating-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #a855f7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #a855f7;
    background: #fff;
}

/* ── Audio Response ── */
.lbr-ar-settings {
    display: flex;
    gap: 12px;
    margin: 8px 0;
}

.lbr-ar-field {
    display: flex;
    align-items: center;
    gap: 6px;
}

.lbr-ar-field label {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.lbr-ar-field input[type="number"] {
    width: 80px;
}

.lbr-ar-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px dashed #e2e8f0;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 13px;
}

.lbr-ar-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.5;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.lbr-ar-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
    stroke: #f59e0b;
}

.lbr-ar-notice a {
    color: #b45309;
    text-decoration: underline;
}

.lbr-ar-notice-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.lbr-ar-notice-success svg {
    stroke: #10b981;
}

/* ── True/False Options ── */
.lbr-tf-options {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.lbr-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #475569;
    cursor: pointer;
}

.lbr-radio-label input[type="radio"] {
    accent-color: #3b82f6;
}

/* ── Long Answer ── */
.lbr-la-maxwords-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.lbr-la-maxwords-row label {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
}

.lbr-la-maxwords {
    width: 100px;
}

/* ── AI Grading Toggle ── */
.lbr-ai-grading-row {
    margin-top: 10px;
}

.lbr-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: #475569;
}

.lbr-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #6366f1;
    cursor: pointer;
}

.lbr-ai-rubric-wrap {
    margin-top: 8px;
}

.lbr-ai-rubric {
    width: 100%;
    resize: vertical;
}

.lbr-ai-rubric-hint {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 4px;
}

/* ── Quiz Block ── */
.lbr-quiz-container {
    background: #f8fafc;
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
}

.lbr-quiz-container .lbr-block {
    background: #fff;
    margin-bottom: 10px;
}

.lbr-quiz-container .lbr-block:last-child {
    margin-bottom: 0;
}

.lbr-quiz-empty {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 14px;
}

.lbr-quiz-add-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 13px;
    color: #64748b;
    flex-wrap: wrap;
}

.lbr-quiz-add-btn {
    padding: 5px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    color: #475569;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.15s;
}

.lbr-quiz-add-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* Quiz Header Row */
.lbr-quiz-header-row {
    margin-bottom: 8px;
}

.lbr-quiz-header-row .lbr-quiz-title {
    width: 100%;
}

/* Quiz Settings Row (total marks + time limit) */
.lbr-quiz-settings-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.lbr-quiz-setting {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.lbr-quiz-setting label {
    font-size: 12px;
    font-weight: 500;
    color: #64748b;
}

.lbr-quiz-setting .lbr-settings-input {
    width: 80px;
    text-align: center;
}

.lbr-quiz-setting-unit {
    font-size: 12px;
    color: #94a3b8;
}

/* Quiz Marks Warning */
.lbr-quiz-marks-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
    line-height: 1.4;
}

.lbr-quiz-marks-warning svg {
    flex-shrink: 0;
}

.lbr-quiz-marks-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.lbr-quiz-marks-warn svg {
    stroke: #f59e0b;
}

.lbr-quiz-marks-over {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.lbr-quiz-marks-over svg {
    stroke: #ef4444;
}

.lbr-quiz-marks-ok {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.lbr-quiz-marks-ok svg {
    stroke: #10b981;
}

.lbr-quiz-marks-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0c4a6e;
}

.lbr-quiz-marks-info svg {
    stroke: #0ea5e9;
}

/* Quiz add bar separator */
.lbr-quiz-add-sep {
    color: #e2e8f0;
    font-size: 16px;
    user-select: none;
}

.lbr-quiz-add-content {
    border-style: dashed;
}

/* Per-question marks */
.lbr-quiz-q-marks-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 4px;
}

.lbr-quiz-q-marks-wrap label {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}

.lbr-quiz-q-marks {
    width: 52px;
    padding: 3px 6px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    text-align: center;
    color: #1e293b;
    background: #fff;
}

.lbr-quiz-q-marks:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px #3b82f620;
}

/* ── Hint / Tooltip for Students (lesson builder) ── */
.lbr-hint-details {
    margin-top: 10px;
    border-top: 1px dashed #e2e8f0;
    padding-top: 6px;
}

.lbr-hint-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
    list-style: none;
}

.lbr-hint-summary::-webkit-details-marker {
    display: none;
}

.lbr-hint-summary::before {
    content: '\25B6';
    font-size: 8px;
    transition: transform 0.2s;
}

.lbr-hint-details[open] > .lbr-hint-summary::before {
    transform: rotate(90deg);
}

.lbr-hint-summary:hover {
    color: #64748b;
}

.lbr-hint-summary svg {
    flex-shrink: 0;
    fill: #a78bfa;
}

.lbr-hint-input {
    margin-top: 6px;
    font-size: 13px;
    width: 100%;
    resize: vertical;
    min-height: 40px;
}

/* ── View Modal Block Content (used on lessons.html view modal) ── */
.lbr-view-chapter {
    margin-bottom: 24px;
}

.lbr-view-chapter-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
}

.lbr-view-block {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-left: 4px solid #e2e8f0;
    border-radius: 0 8px 8px 0;
    background: #fafbfc;
}

.lbr-view-block-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: #94a3b8;
}

.lbr-view-block p {
    margin: 4px 0;
    color: #1e293b;
    line-height: 1.6;
}

.lbr-view-options {
    margin: 8px 0;
    padding-left: 0;
    list-style: none;
}

.lbr-view-options li {
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-size: 14px;
    color: #475569;
    background: #fff;
    border: 1px solid #e2e8f0;
}

.lbr-view-options li.correct {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
    font-weight: 500;
}

.lbr-view-answer {
    margin-top: 8px;
    padding: 8px 12px;
    background: #eff6ff;
    border-radius: 6px;
    font-size: 13px;
    color: #1e40af;
}

.lbr-view-quiz {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.lbr-view-chapter-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.lbr-view-chapter-tab {
    padding: 6px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

.lbr-view-chapter-tab.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .lbr-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        z-index: 200;
        height: 100vh;
        transition: left 0.3s ease;
        box-shadow: none;
    }

    .lbr-sidebar.open {
        left: 0;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
    }

    .lbr-sidebar-toggle {
        display: flex;
    }

    .lbr-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.3);
        z-index: 190;
    }

    .lbr-sidebar-overlay.show {
        display: block;
    }

    .lbr-canvas {
        padding: 16px;
    }

    .lbr-topbar {
        padding: 8px 12px;
    }

    .lbr-title-input {
        font-size: 15px;
    }

    .lbr-topbar-right .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }

    .lbr-chapter-tabs {
        padding-bottom: 12px;
    }
}

/* ═══════════════════════════════════════════════════════
   AI Create Lesson Modal
   ═══════════════════════════════════════════════════════ */

.btn-ai {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    box-shadow: 0 2px 8px rgba(99,102,241,0.35);
}

.btn-ai.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
    border-radius: 8px;
}

/* Overlay */
.lbr-ai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: lbr-ai-fade-in 0.2s ease-out;
}

@keyframes lbr-ai-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal */
.lbr-ai-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: lbr-ai-slide-in 0.25s ease-out;
}

@keyframes lbr-ai-slide-in {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.lbr-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.lbr-ai-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
}

.lbr-ai-header-title svg {
    color: #8b5cf6;
}

.lbr-ai-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 8px;
    font-size: 20px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
}

.lbr-ai-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

.lbr-ai-body {
    padding: 24px;
    overflow-y: auto;
}

/* Form */
.lbr-ai-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.lbr-ai-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    font-family: Inter, sans-serif;
    resize: vertical;
    transition: border-color 0.15s;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.lbr-ai-textarea:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}

.lbr-ai-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.lbr-ai-field {
    flex: 1;
}

.lbr-ai-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: Inter, sans-serif;
    background: #fff;
    box-sizing: border-box;
}

.lbr-ai-select:focus {
    outline: none;
    border-color: #8b5cf6;
}

.lbr-ai-hint {
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

/* Dropzone */
.lbr-ai-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 16px;
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    background: #f9fafb;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
}

.lbr-ai-dropzone:hover,
.lbr-ai-dropzone.dragover {
    border-color: #8b5cf6;
    background: #f5f3ff;
    color: #7c3aed;
}

.lbr-ai-dropzone-sub {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 400;
}

/* File list */
.lbr-ai-files {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.lbr-ai-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

.lbr-ai-file-icon {
    color: #8b5cf6;
    flex-shrink: 0;
    display: flex;
}

.lbr-ai-file-name {
    flex: 1;
    color: #334155;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lbr-ai-file-size {
    color: #94a3b8;
    font-size: 12px;
    flex-shrink: 0;
}

.lbr-ai-file-remove {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}

.lbr-ai-file-remove:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Generate button */
.lbr-ai-generate-btn {
    width: 100%;
    padding: 13px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.15s;
}

.lbr-ai-generate-btn:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

/* Progress */
.lbr-ai-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.lbr-ai-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e2e8f0;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: lbr-ai-spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes lbr-ai-spin {
    to { transform: rotate(360deg); }
}

.lbr-ai-progress-text {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.lbr-ai-progress-hint {
    font-size: 13px;
    color: #94a3b8;
    margin: 0;
}

/* Error */
.lbr-ai-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.lbr-ai-error svg {
    color: #ef4444;
    margin-bottom: 16px;
}

.lbr-ai-error p {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 16px 0;
    max-width: 400px;
}

/* Responsive */
@media (max-width: 640px) {
    .lbr-ai-modal {
        max-height: 100vh;
        border-radius: 12px;
    }

    .lbr-ai-row {
        flex-direction: column;
        gap: 8px;
    }

    .lbr-ai-body {
        padding: 16px;
    }

    .btn-ai span {
        display: none;
    }
}

/* ══════════════════════════════════════════════════════
   Student Activities (.sa-*) Styles
   ══════════════════════════════════════════════════════ */

/* Toolbar */
.sa-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sa-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sa-filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    background: #fff;
    color: var(--text-dark);
    min-width: 140px;
}

/* Activity Cards Grid */
.sa-activities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.sa-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.2s;
}

.sa-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.sa-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 8px;
}

.sa-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.sa-badge-type {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sa-type-workshop { background: #e8f0fe; color: #1a73e8; }
.sa-type-competition { background: #fef3cd; color: #d97706; }
.sa-type-project { background: #e6f4ea; color: #1e8e3e; }
.sa-type-talk { background: #f3e8fd; color: #7c3aed; }
.sa-type-field_trip { background: #fce4ec; color: #c62828; }
.sa-type-exhibition { background: #e0f7fa; color: #00838f; }
.sa-type-hackathon { background: #fff3e0; color: #e65100; }
.sa-type-other { background: #f5f5f5; color: #616161; }

.sa-badge-level {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: #f0f0f0;
    color: #555;
}

.sa-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    white-space: nowrap;
}

.sa-status-planned {
    background: #fff3e0;
    color: #e65100;
}

.sa-status-completed {
    background: #e6f4ea;
    color: #1e8e3e;
}

.sa-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.sa-card-topic {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0 0 10px 0;
}

.sa-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--text-lighter);
}

.sa-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sa-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.sa-card-actions .btn-sm {
    font-size: 12px;
    padding: 4px 12px;
}

/* Empty State */
.sa-empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-lighter);
    grid-column: 1 / -1;
}

.sa-empty-state svg {
    margin-bottom: 12px;
    opacity: 0.4;
}

.sa-empty-state p {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 6px 0;
    color: var(--text-dark);
}

.sa-empty-state span {
    font-size: 13px;
}

/* Enrollment Toolbar */
.sa-enrollment-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.sa-enrollment-toolbar label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    margin-right: 4px;
}

.sa-enrollment-toolbar .sa-filter-select {
    min-width: 220px;
}

/* Enrollment Table */
.sa-enrollment-table {
    width: 100%;
}

.sa-status-select {
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
}

.sa-notes-input {
    width: 100%;
    min-width: 120px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
}

.sa-notes-input:focus,
.sa-status-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

/* Compliance Dashboard */
.sa-compliance-header {
    margin-bottom: 24px;
}

.sa-compliance-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 6px 0;
}

.sa-compliance-header p {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0;
}

.sa-compliance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.sa-compliance-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

.sa-compliance-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.sa-compliance-card-header h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.sa-compliance-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: #f5f5f5;
    color: #888;
}

.sa-badge-met {
    background: #e6f4ea;
    color: #1e8e3e;
}

.sa-badge-notmet {
    background: #fce8e6;
    color: #c62828;
}

.sa-compliance-desc {
    font-size: 13px;
    color: var(--text-lighter);
    margin: 0 0 14px 0;
}

.sa-progress-bar {
    width: 100%;
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 8px;
}

.sa-progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.5s ease;
    min-width: 0;
}

.sa-progress-green { background: #1e8e3e; }
.sa-progress-orange { background: #e65100; }

.sa-progress-label {
    font-size: 12px;
    color: var(--text-lighter);
}

.sa-compliance-actions {
    display: flex;
    gap: 12px;
}

/* Activity Detail Modal */
.sa-detail-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.sa-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.sa-detail-row strong {
    color: var(--text-dark);
    font-weight: 500;
    min-width: 140px;
}

.sa-detail-row span,
.sa-detail-row p {
    color: var(--text-lighter);
}

.sa-detail-full {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.sa-detail-full p {
    margin: 0;
    white-space: pre-wrap;
}

.sa-detail-enrollment-summary {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
}

.sa-detail-enrollment-summary h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-dark);
}

.sa-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: var(--text-lighter);
}

/* Enroll Students Modal */
.sa-student-search {
    margin-bottom: 12px;
}

.sa-student-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.sa-student-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.sa-student-list {
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.sa-student-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 14px;
}

.sa-student-item:last-child {
    border-bottom: none;
}

.sa-student-item:hover {
    background: #f8f9fa;
}

.sa-student-item input[type="checkbox"] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.sa-student-name {
    font-weight: 500;
    color: var(--text-dark);
}

.sa-student-email {
    font-size: 12px;
    color: var(--text-lighter);
    margin-left: auto;
}

.sa-student-selected-count {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-lighter);
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .sa-activities-grid {
        grid-template-columns: 1fr;
    }

    .sa-compliance-grid {
        grid-template-columns: 1fr;
    }

    .sa-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .sa-toolbar-left {
        flex-direction: column;
    }

    .sa-enrollment-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .sa-enrollment-toolbar .sa-filter-select {
        min-width: unset;
        width: 100%;
    }

    .sa-enrollment-table-wrap {
        overflow-x: auto;
    }

    .sa-detail-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* ──────────────────────────────────────
   Exam System Styles
   ────────────────────────────────────── */

/* Exam block banner in lesson builder */
.lbr-exam-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Assignment page styles */
.la-filter-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 24px;
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.la-filter-bar select,
.la-filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    background: white;
    min-width: 160px;
}

.la-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.la-stat-card {
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.la-stat-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

.la-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
}

/* Status badges */
.la-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.la-badge-active { background: #dcfce7; color: #16a34a; }
.la-badge-closed { background: #fee2e2; color: #dc2626; }
.la-badge-draft { background: #f1f5f9; color: #64748b; }
.la-badge-submitted { background: #fef3c7; color: #d97706; }
.la-badge-graded { background: #dcfce7; color: #16a34a; }
.la-badge-in_progress { background: #dbeafe; color: #2563eb; }
.la-badge-not_started { background: #f1f5f9; color: #94a3b8; }

/* Assignment table */
.la-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.la-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #94a3b8;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.la-table td {
    padding: 12px 16px;
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.la-table tr:last-child td {
    border-bottom: none;
}

.la-table tr:hover td {
    background: #f8fafc;
}

.la-submission-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.la-submission-track {
    flex: 1;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
}

.la-submission-fill {
    height: 100%;
    border-radius: 3px;
    background: #3b82f6;
    transition: width 0.3s ease;
}

.la-submission-text {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
}

.la-action {
    background: none;
    border: none;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
    color: #64748b;
    transition: all 0.15s ease;
}

.la-action:hover {
    background: #f1f5f9;
    color: var(--text-dark);
}

.la-action-danger:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Modal styles */
.la-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.la-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.la-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.la-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.la-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
}

.la-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.la-form-group {
    margin-bottom: 16px;
}

.la-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.la-form-group select,
.la-form-group input,
.la-form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.la-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* Grading panel */
.gr-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.gr-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 720px;
    max-width: 100%;
    height: 100vh;
    background: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}

.gr-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: #f8fafc;
}

.gr-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.gr-panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gr-answer-card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.gr-answer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.gr-answer-body {
    padding: 16px;
}

.gr-answer-compare {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.gr-answer-box {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
}

.gr-answer-correct {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.gr-answer-student {
    background: #f8fafc;
    border: 1px solid var(--border-color);
}

.gr-marks-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.gr-marks-input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.gr-feedback-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.gr-correct-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
}

.gr-correct-yes { background: #dcfce7; color: #16a34a; }
.gr-correct-no { background: #fee2e2; color: #dc2626; }
.gr-correct-partial { background: #fef3c7; color: #d97706; }

/* Release results panel */
.gr-release-panel {
    padding: 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 24px;
}

.gr-release-options {
    display: flex;
    gap: 24px;
    margin: 12px 0;
}

.gr-release-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

/* Empty state */
.la-empty {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.la-empty svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.la-empty p {
    font-size: 14px;
    margin: 0;
}

@media (max-width: 768px) {
    .la-filter-bar {
        flex-direction: column;
    }

    .la-filter-bar select,
    .la-filter-bar input {
        min-width: unset;
        width: 100%;
    }

    .gr-panel {
        width: 100%;
    }

    .gr-answer-compare {
        grid-template-columns: 1fr;
    }

}

/* Warning banner for provider fallback */
.ait-provider-warning {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 8px 0;
    font-size: 13px;
    color: #92400e;
}

.ait-warning-content {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.ait-warning-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ait-warning-dismiss {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #92400e;
    padding: 0 4px;
    line-height: 1;
}

/* Override badge on subject checklist */
.sap-override-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* ========================================
   Mobile Card View for Tables
   ======================================== */
@media (max-width: 768px) {
    .ait-table,
    .la-table,
    .ail-records-table,
    .analytics-table,
    .bulk-preview-table,
    .invite-table,
    .tracking-detail-table,
    .addon-table-wrap .data-table {
        border: none;
        background: transparent;
    }

    .ait-table thead,
    .la-table thead,
    .ail-records-table thead,
    .analytics-table thead,
    .bulk-preview-table thead,
    .invite-table thead,
    .tracking-detail-table thead,
    .addon-table-wrap .data-table thead {
        display: none;
    }

    .ait-table tbody,
    .la-table tbody,
    .ail-records-table tbody,
    .analytics-table tbody,
    .bulk-preview-table tbody,
    .invite-table tbody,
    .tracking-detail-table tbody,
    .addon-table-wrap .data-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .ait-table tbody tr,
    .la-table tbody tr,
    .ail-records-table tbody tr,
    .analytics-table tbody tr,
    .bulk-preview-table tbody tr,
    .invite-table tbody tr,
    .tracking-detail-table tbody tr,
    .addon-table-wrap .data-table tbody tr {
        display: flex;
        flex-direction: column;
        background: white;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        padding: 0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    }

    .ait-table tbody tr:hover,
    .la-table tbody tr:hover,
    .ail-records-table tbody tr:hover,
    .analytics-table tbody tr:hover,
    .bulk-preview-table tbody tr:hover,
    .invite-table tbody tr:hover,
    .tracking-detail-table tbody tr:hover,
    .addon-table-wrap .data-table tbody tr:hover {
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .ait-table tbody td,
    .la-table tbody td,
    .ail-records-table tbody td,
    .analytics-table tbody td,
    .bulk-preview-table tbody td,
    .invite-table tbody td,
    .tracking-detail-table tbody td,
    .addon-table-wrap .data-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 16px;
        border-bottom: 1px solid var(--border-color);
        font-size: 14px;
        gap: 12px;
        white-space: normal;
    }

    .ait-table tbody td:last-child,
    .la-table tbody td:last-child,
    .ail-records-table tbody td:last-child,
    .analytics-table tbody td:last-child,
    .bulk-preview-table tbody td:last-child,
    .invite-table tbody td:last-child,
    .tracking-detail-table tbody td:last-child,
    .addon-table-wrap .data-table tbody td:last-child {
        border-bottom: none;
    }

    .ait-table tbody td::before,
    .la-table tbody td::before,
    .ail-records-table tbody td::before,
    .analytics-table tbody td::before,
    .bulk-preview-table tbody td::before,
    .invite-table tbody td::before,
    .tracking-detail-table tbody td::before,
    .addon-table-wrap .data-table tbody td::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 600;
        color: var(--text-light);
        text-transform: uppercase;
        letter-spacing: 0.3px;
        flex-shrink: 0;
        min-width: 90px;
    }

    .ait-table tbody td.actions-cell,
    .la-table tbody td.actions-cell,
    .ait-table tbody td.ait-table-actions,
    .la-table tbody td:last-child:has(.la-action),
    .ail-records-table tbody td:last-child:has(button),
    .analytics-table tbody td.actions-cell,
    .bulk-preview-table tbody td.actions-cell,
    .invite-table tbody td.actions-cell,
    .tracking-detail-table tbody td.actions-cell,
    .addon-table-wrap .data-table tbody td.actions-cell,
    .addon-table-wrap .data-table tbody td:last-child:has(button) {
        justify-content: flex-end;
        padding: 12px 16px;
        background: var(--bg-light);
        border-radius: 0 0 12px 12px;
        gap: 8px;
        flex-wrap: wrap;
    }

    .ait-table tbody td.actions-cell::before,
    .la-table tbody td.actions-cell::before,
    .ait-table tbody td.ait-table-actions::before,
    .la-table tbody td:last-child:has(.la-action)::before,
    .ail-records-table tbody td:last-child:has(button)::before,
    .analytics-table tbody td.actions-cell::before,
    .bulk-preview-table tbody td.actions-cell::before,
    .invite-table tbody td.actions-cell::before,
    .tracking-detail-table tbody td.actions-cell::before,
    .addon-table-wrap .data-table tbody td.actions-cell::before,
    .addon-table-wrap .data-table tbody td:last-child:has(button)::before {
        display: none;
    }

    .ait-table tbody td.table-empty,
    .la-table tbody td.table-empty,
    .ail-records-table tbody td.table-empty,
    .analytics-table tbody td.table-empty,
    .bulk-preview-table tbody td.table-empty,
    .invite-table tbody td.table-empty,
    .tracking-detail-table tbody td.table-empty,
    .addon-table-wrap .data-table tbody td.table-empty {
        justify-content: center;
    }

    .ait-table tbody td.table-empty::before,
    .la-table tbody td.table-empty::before,
    .ail-records-table tbody td.table-empty::before,
    .analytics-table tbody td.table-empty::before,
    .bulk-preview-table tbody td.table-empty::before,
    .invite-table tbody td.table-empty::before,
    .tracking-detail-table tbody td.table-empty::before,
    .addon-table-wrap .data-table tbody td.table-empty::before {
        display: none;
    }

    /* Override invite-table white-space for card view */
    .invite-table td {
        white-space: normal;
    }

    .invite-table td:first-child {
        max-width: none;
    }

    /* Ensure table wraps don't force horizontal scroll in card view */
    .sa-enrollment-table-wrap,
    .addon-table-wrap,
    .bulk-preview-wrap {
        overflow-x: visible;
    }
}

/* ── Marketplace ── */
.les-badge-price {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.les-badge-purchased {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #dcfce7;
    color: #16a34a;
}

.les-badge-marketplace {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #fef3c7;
    color: #b45309;
}

.les-btn-buy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}
.les-btn-buy:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}
.les-btn-buy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mkp-wallet-balance {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fef9c3, #fde68a, #fbbf24);
    border: 1px solid #f59e0b;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    color: #78350f;
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
    cursor: default;
}
.mkp-wallet-balance svg { color: #d97706; flex-shrink: 0; }
.mkp-wallet-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: #1e293b;
    color: #f1f5f9;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
    width: 260px;
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.mkp-wallet-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 24px;
    border: 6px solid transparent;
    border-bottom-color: #1e293b;
}
.mkp-wallet-balance:hover .mkp-wallet-tooltip { display: block; }

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

.mkp-price-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}
.mkp-price-input-group input {
    width: 100px;
}
.mkp-price-input-group .mkp-price-label {
    font-size: 13px;
    color: #64748b;
}

/* Purchase confirmation modal overlay */
.mkp-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.mkp-confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.mkp-confirm-box {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.mkp-confirm-box h4 {
    margin: 0 0 16px;
    font-size: 18px;
    color: #1e293b;
}
.mkp-confirm-detail {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #475569;
}
.mkp-confirm-detail:last-of-type {
    border-bottom: none;
}
.mkp-confirm-detail .label {
    color: #94a3b8;
}
.mkp-confirm-detail .value {
    font-weight: 600;
    color: #1e293b;
}
.mkp-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}
