/* ==========================================================================
   DERSHANEPRO KURUMSAL BULUT SAAS DESIGN SYSTEM v6.0 (THEME SUPPORT: DARK & LIGHT)
   ========================================================================== */

:root, [data-theme="dark"] {
    --bg-main: #0B0F17;
    --bg-surface: #111827;
    --bg-surface-elevated: #1F2937;
    --bg-sidebar: #090D14;
    --bg-sidebar-hover: #161F30;
    --border-color: #1F2937;
    --border-subtle: #1E293B;
    --border-input: #374151;
    
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: rgba(79, 70, 229, 0.15);
    
    --text-main: #F9FAFB;
    --text-muted: #9CA3AF;
    --text-light: #6B7280;
    
    --table-header-bg: #0D131F;
    --table-row-hover: #161F30;
    --card-inner-bg: #0B0F17;
    --input-bg: #0B0F17;
    --input-color: #F9FAFB;
    --modal-bg: #111827;
    --modal-footer-bg: #0B0F17;
    
    --success: #10B981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #F59E0B;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --indigo: #6366F1;
    --indigo-bg: rgba(99, 102, 241, 0.12);
    --blue: #0EA5E9;
    --blue-bg: rgba(14, 165, 233, 0.12);
    
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(79, 70, 229, 0.35);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

[data-theme="light"] {
    --bg-main: #F1F5F9;
    --bg-surface: #FFFFFF;
    --bg-surface-elevated: #F8FAFC;
    --bg-sidebar: #0F172A;
    --bg-sidebar-hover: #1E293B;
    --border-color: #E2E8F0;
    --border-subtle: #CBD5E1;
    --border-input: #CBD5E1;
    
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: rgba(79, 70, 229, 0.1);
    
    --text-main: #0F172A;
    --text-muted: #475569;
    --text-light: #64748B;
    
    --table-header-bg: #F8FAFC;
    --table-row-hover: #F1F5F9;
    --card-inner-bg: #F8FAFC;
    --input-bg: #FFFFFF;
    --input-color: #0F172A;
    --modal-bg: #FFFFFF;
    --modal-footer-bg: #F8FAFC;
    
    --success: #059669;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #D97706;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --danger: #DC2626;
    --danger-bg: rgba(239, 68, 68, 0.12);
    --indigo: #4F46E5;
    --indigo-bg: rgba(99, 102, 241, 0.12);
    --blue: #0284C7;
    --blue-bg: rgba(14, 165, 233, 0.12);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.2);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 270px;
    background-color: var(--bg-sidebar);
    color: #F8FAFC;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 22px 20px 16px 20px;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo-icon {
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    color: #FFFFFF;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.4);
    flex-shrink: 0;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: #FFFFFF;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.65rem;
    font-weight: 600;
    color: #818CF8;
    letter-spacing: 0.04em;
    display: block;
    margin-top: 2px;
}

.tenant-switcher-box {
    padding: 0 16px 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tenant-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: #94A3B8;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 6px;
}

.tenant-select {
    width: 100%;
    background: #1E293B;
    border: 1px solid #334155;
    color: #F8FAFC;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    font-family: var(--font-body);
}

.tenant-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.3);
}

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

.nav-section-title {
    font-size: 0.65rem;
    font-weight: 800;
    color: #64748B;
    letter-spacing: 0.08em;
    padding: 12px 10px 4px 10px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: #94A3B8;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.15s ease;
    cursor: pointer;
}

.nav-item:hover {
    background-color: var(--bg-sidebar-hover);
    color: #F8FAFC;
}

.nav-item.active {
    background-color: var(--primary);
    color: #FFFFFF;
}

.nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

.nav-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
}

.nav-badge {
    margin-left: auto;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.academic-year-card {
    background: #1E293B;
    border: 1px solid #334155;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.academic-year-lbl {
    font-size: 0.65rem;
    color: #94A3B8;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.academic-year-val {
    font-weight: 700;
    font-size: 0.82rem;
    color: #F8FAFC;
    margin-top: 2px;
}

.academic-year-sub {
    font-size: 0.68rem;
    color: #818CF8;
    margin-top: 3px;
    font-family: var(--font-mono);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.badge-campus {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #6366F1;
    background: rgba(99, 102, 241, 0.12);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.page-heading {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.page-subheading {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
}

[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: block; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    text-decoration: none;
    font-family: var(--font-body);
}

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

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

.btn-secondary {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border-color: var(--border-color);
}

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

.btn-warning {
    background: #D97706;
    color: #FFFFFF;
}

.btn-warning:hover {
    background: #B45309;
}

.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
}

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

.btn-sm {
    padding: 5px 10px;
    font-size: 0.76rem;
}

.btn-glow {
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.35);
}

.btn-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.15s ease;
}

.btn-close:hover {
    color: var(--text-main);
}

/* Content Body */
.content-body {
    padding: 24px 32px;
    flex: 1;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    transition: all 0.2s ease;
}

.kpi-card:hover {
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
}

.kpi-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.kpi-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.kpi-icon-box {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bg-indigo { background: rgba(99, 102, 241, 0.15); color: #6366F1; }
.bg-emerald { background: rgba(16, 185, 129, 0.15); color: #10B981; }
.bg-blue { background: rgba(14, 165, 233, 0.15); color: #0EA5E9; }
.bg-amber { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }

.kpi-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 10px;
    color: var(--text-main);
}

.text-emerald { color: #10B981; }
.text-blue { color: #0EA5E9; }
.text-amber { color: #F59E0B; }
.text-primary { color: var(--primary); }

.kpi-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.kpi-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
}

.badge-indigo { background: rgba(99, 102, 241, 0.15); color: #6366F1; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #059669; }
.badge-info { background: rgba(14, 165, 233, 0.15); color: #0284C7; }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #D97706; }

.kpi-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Document Generator Cards Grid */
.doc-generators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-top: 14px;
}

.doc-gen-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.2s ease;
    cursor: pointer;
}

.doc-gen-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.doc-gen-icon {
    width: 44px;
    height: 44px;
    background: rgba(79, 70, 229, 0.12);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.doc-gen-title {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 0.96rem;
    color: var(--text-main);
    margin-bottom: 4px;
}

.doc-gen-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
    flex: 1;
}

/* Dashboard Grid 2 */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .dashboard-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* AI Banner Card */
.ai-banner-card {
    background: linear-gradient(135deg, #1E1B4B, #312E81);
    border: 1px solid #4338CA;
    color: #FFFFFF;
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.ai-banner-icon {
    background: rgba(99, 102, 241, 0.25);
    color: #818CF8;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.ai-banner-content {
    flex: 1;
}

.ai-banner-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.ai-banner-desc {
    font-size: 0.8rem;
    color: #C7D2FE;
    line-height: 1.5;
}

/* Table Cards */
.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.table-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.table-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--table-header-bg);
}

.data-table td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.84rem;
    vertical-align: middle;
    color: var(--text-main);
}

.data-table tr:hover td {
    background: var(--table-row-hover);
}

.text-right {
    text-align: right;
}

/* Student Cells & Avatars */
.student-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.student-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface-elevated);
    color: var(--primary);
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.student-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 0.86rem;
}

.student-no {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.branch-tag {
    display: inline-block;
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 2px;
    border: 1px solid var(--border-color);
}

.progress-bar-container {
    background: var(--bg-surface-elevated);
    height: 5px;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 6px;
    width: 120px;
}

.progress-bar-fill {
    background: #10B981;
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Toolbar & Filters */
.toolbar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-pills-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-pill {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.filter-pill:hover {
    background: var(--border-color);
    color: var(--text-main);
}

.filter-pill.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

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

.toolbar-search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    min-width: 240px;
}

.toolbar-search-box input {
    border: none;
    background: transparent;
    font-size: 0.8rem;
    color: var(--text-main);
    outline: none;
    width: 100%;
    font-family: var(--font-body);
}

/* Schedule Grid */
.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-top: 12px;
}

.schedule-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: border-color 0.15s ease;
}

.schedule-card:hover {
    border-color: var(--border-subtle);
}

.schedule-time {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.schedule-subject {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-main);
    margin-bottom: 5px;
}

.schedule-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.74rem;
    color: var(--text-muted);
}

/* Kütüphane Masaları Grid */
.seats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.seat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s ease;
}

.seat-card.occupied {
    border-color: #EF4444;
}

.seat-card.free {
    border-color: #10B981;
}

.seat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.seat-number {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.seat-section {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Genel Merkez Konsolide Grid */
.hq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.hq-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.hq-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.hq-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.84rem;
    color: var(--text-muted);
}

/* Exam Summary Grid & SVG Chart */
.exam-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.exam-stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.stat-num {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    margin-top: 3px;
    color: var(--text-main);
}

.exam-chart-wrapper {
    padding: 6px 0;
}

.branch-bar-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.branch-bar-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.branch-bar-label {
    width: 150px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.branch-bar-track {
    flex: 1;
    height: 18px;
    background: var(--bg-surface-elevated);
    border-radius: 4px;
    overflow: hidden;
}

.branch-bar-fill {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding-left: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    color: #FFFFFF;
    transition: width 0.5s ease;
}

/* MEB Contract Card */
.meb-contract-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
}

.meb-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.meb-icon-box {
    background: rgba(99, 102, 241, 0.15);
    padding: 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.meb-content-box {
    font-size: 0.84rem;
    line-height: 1.7;
    color: var(--text-main);
    background: var(--card-inner-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px;
    margin-bottom: 16px;
}

.meb-content-box p {
    margin-bottom: 10px;
}

.meb-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 8px;
}

/* Turnstile Grid */
.turnstile-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.turnstile-card {
    width: 360px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.turnstile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.turnstile-icon-box {
    background: rgba(99, 102, 241, 0.15);
    padding: 8px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.turnstile-mode-group {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    justify-content: center;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
}

.qr-target-box {
    background: var(--card-inner-bg);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.qr-laser-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #6366F1;
    box-shadow: 0 0 8px #6366F1;
    animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
    0% { top: 10%; opacity: 0.3; }
    50% { top: 90%; opacity: 1; }
    100% { top: 10%; opacity: 0.3; }
}

/* Mobile Portal Simulator */
.mobile-portal-wrapper {
    display: flex;
    gap: 32px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.mobile-portal-controls {
    flex: 1;
    min-width: 280px;
}

.phone-frame {
    width: 320px;
    height: 600px;
    background: #000000;
    border-radius: 40px;
    padding: 12px;
    box-shadow: var(--shadow-lg);
    border: 3px solid #374151;
    position: relative;
    margin: 0 auto;
}

.phone-notch {
    width: 110px;
    height: 16px;
    background: #000000;
    border-radius: 0 0 12px 12px;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.phone-screen {
    background: #0B0F17;
    height: 100%;
    border-radius: 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.phone-header {
    background: linear-gradient(135deg, #3730A3, #4F46E5);
    color: #FFFFFF;
    padding: 30px 14px 14px 14px;
    border-radius: 28px 28px 14px 14px;
}

.phone-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.phone-card {
    background: #111827;
    border: 1px solid #1F2937;
    border-radius: 10px;
    padding: 10px 12px;
}

.phone-card-label {
    font-size: 0.62rem;
    color: #9CA3AF;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
    animation: modalFade 0.15s ease;
}

@keyframes modalFade {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: scale(1); }
}

.modal-card {
    background: var(--modal-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-lg {
    max-width: 740px;
}

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

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.modal-subtitle {
    font-size: 0.76rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    background: var(--modal-footer-bg);
}

/* Forms */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.form-group label {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-control {
    padding: 8px 10px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-family: var(--font-body);
    outline: none;
    transition: border-color 0.15s ease;
    background: var(--input-bg);
    color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus,
.form-control:focus {
    border-color: var(--primary);
}

.form-section-divider {
    height: 1px;
    background: var(--border-color);
    margin: 10px 0 14px 0;
}

/* AI Coach Box */
.ai-coach-card {
    background: linear-gradient(135deg, #1E1B4B, #312E81);
    border: 1px solid #4338CA;
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 16px;
}

.ai-coach-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.ai-badge {
    font-size: 0.68rem;
    font-weight: 700;
    color: #818CF8;
    background: rgba(99, 102, 241, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

.ai-target {
    font-size: 0.74rem;
    font-weight: 700;
    color: #E0E7FF;
}

.ai-coach-text {
    font-size: 0.8rem;
    color: #C7D2FE;
    line-height: 1.4;
}

/* Bono Paper */
.bono-paper {
    background: #FFFBEB;
    color: #0F172A;
    border: 2px solid #D97706;
    border-radius: 6px;
    padding: 24px;
    font-family: var(--font-heading);
}

.bono-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

.bono-divider {
    border-bottom: 1px dashed #D97706;
    margin: 14px 0;
}

.bono-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    font-size: 0.8rem;
}

/* Toast Container */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 2000;
}

.toast {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-lg);
    animation: toastSlide 0.2s ease;
    max-width: 360px;
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==========================================================================
   RBAC & AUTHENTICATION UI STYLES
   ========================================================================== */

/* User Profile Chip in Topbar */
.user-profile-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    padding: 4px 10px 4px 6px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-profile-chip:hover {
    border-color: var(--primary);
}

.user-avatar-chip {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    color: #FFFFFF;
    font-weight: 800;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-info-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.user-name-label {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-main);
}

.user-role-tag {
    font-size: 0.65rem;
    font-weight: 700;
    margin-top: 1px;
}

.badge-role-manager { color: #6366F1; }
.badge-role-accounting { color: #10B981; }
.badge-role-teacher { color: #0EA5E9; }
.badge-role-guidance { color: #F59E0B; }
.badge-role-parent { color: #EC4899; }

.btn-icon-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.btn-icon-logout:hover {
    color: #EF4444;
}

/* Auth Modal / Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 15, 23, 0.94);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.auth-overlay.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.auth-card {
    background: #111827;
    border: 1px solid #374151;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 32px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
}

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

.auth-logo-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #4F46E5, #6366F1);
    color: #FFFFFF;
    border-radius: 12px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-glow);
}

.auth-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    color: #FFFFFF;
}

.auth-subtitle {
    font-size: 0.78rem;
    color: #9CA3AF;
    margin-top: 4px;
}

/* Quick Demo Role Cards */
.demo-roles-section {
    margin-top: 24px;
    border-top: 1px solid #1F2937;
    padding-top: 18px;
}

.demo-roles-title {
    font-size: 0.7rem;
    font-weight: 800;
    color: #6B7280;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
    text-align: center;
}

.demo-roles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.demo-role-btn {
    background: #1F2937;
    border: 1px solid #374151;
    color: #D1D5DB;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
}

.demo-role-btn:hover {
    background: #374151;
    color: #FFFFFF;
    border-color: #4F46E5;
}

.demo-role-name {
    font-weight: 800;
    color: #FFFFFF;
    font-size: 0.78rem;
}

.demo-role-sub {
    font-size: 0.65rem;
    color: #9CA3AF;
    margin-top: 2px;
}
