:root {
  --navy: #172c4a;
  --blue: #5479b7;
  --blue-deep: #3d619b;
  --lavender: #a69acb;
  --lavender-soft: #eeeafa;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --text: #202b3c;
  --muted: #758195;
  --line: #e5e9f1;
  --success: #398466;
  --success-soft: #e7f4ed;
  --warning: #d5a04d;
  --warning-soft: #fff5df;
  --danger: #c76d6d;
  --danger-soft: #faeaea;
  --shadow-sm: 0 3px 16px rgba(23, 44, 74, 0.06);
  --shadow-md: 0 15px 45px rgba(23, 44, 74, 0.11);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --sidebar-width: 254px;
  --header-height: 76px;
  --transition: 180ms ease;
}

[data-theme="dark"] {
  --bg: #101826;
  --surface: #172234;
  --surface-2: #1c2b40;
  --text: #edf2fa;
  --muted: #9ba9bd;
  --line: #2d3c51;
  --lavender-soft: #2d2a43;
  --success-soft: #1b3a32;
  --warning-soft: #41361e;
  --danger-soft: #42292c;
  --shadow-sm: 0 3px 16px rgba(0, 0, 0, 0.14);
  --shadow-md: 0 15px 45px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-width); flex: 0 0 var(--sidebar-width); background: var(--surface);
  border-inline-end: 1px solid var(--line); min-height: 100vh; padding: 24px 16px 18px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 3px 10px 26px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display:grid; place-items:center; color:white; background: linear-gradient(135deg, var(--navy), var(--blue)); box-shadow: 0 8px 18px rgba(84,121,183,.25); }
.brand-word { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.brand-sub { display:block; color: var(--muted); font-size: 10px; font-weight: 500; margin-top: -2px; }
.nav-label { color: var(--muted); font-size: 11px; margin: 0 11px 8px; font-weight: 700; letter-spacing: .04em; }
.nav-list { display: grid; gap: 4px; overflow: auto; padding-inline-end: 2px; }
.nav-item { border: 0; background: transparent; color: var(--muted); display:flex; align-items:center; gap: 11px; min-height: 42px; padding: 9px 11px; border-radius: 11px; text-align: start; transition: var(--transition); }
.nav-item:hover { background: var(--surface-2); color: var(--text); transform: translateX(-2px); }
[dir="ltr"] .nav-item:hover { transform: translateX(2px); }
.nav-item.active { background: #eaf0fa; color: var(--blue-deep); font-weight: 700; }
[data-theme="dark"] .nav-item.active { background: #223752; color: #bfd2f2; }
.nav-item .nav-icon { width: 19px; height: 19px; display:grid; place-items:center; flex: 0 0 19px; }
.nav-badge { margin-inline-start: auto; min-width: 22px; height: 22px; display:grid; place-items:center; background: var(--lavender-soft); color: var(--blue-deep); border-radius: 8px; font-size: 11px; }
.sidebar-spacer { flex: 1; }
.sidebar-bottom { border-top: 1px solid var(--line); padding-top: 15px; }
.ai-mini-card { background: linear-gradient(145deg, #eff1fb 0%, #f7f8fd 100%); border-radius: 15px; padding: 14px; margin: 0 3px 16px; border: 1px solid #e4e3f3; }
[data-theme="dark"] .ai-mini-card { background: linear-gradient(145deg, #272b46, #20283d); border-color: #3a3c5b; }
.ai-mini-card p { margin: 7px 0 12px; font-size: 12px; color: var(--muted); line-height: 1.65; }
.ai-mini-card strong { font-size: 13px; }

.main-wrap { min-width: 0; flex: 1; }
.topbar { height: var(--header-height); padding: 0 32px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); display:flex; align-items:center; gap: 18px; position: sticky; top:0; z-index: 15; }
.mobile-menu { display:none; }
.search-box { max-width: 340px; flex:1; position:relative; }
.search-box input { width:100%; border:1px solid transparent; background: var(--surface-2); height: 42px; padding: 0 43px 0 14px; border-radius: 12px; outline:none; color:var(--text); transition:var(--transition); }
[dir="ltr"] .search-box input { padding: 0 14px 0 43px; }
.search-box input:focus { border-color: #b8c9e5; background: var(--surface); box-shadow: 0 0 0 3px rgba(84,121,183,.11); }
.search-box .search-icon { position:absolute; inset-inline-start: 14px; top: 12px; color:var(--muted); }
.header-actions { margin-inline-start: auto; display:flex; align-items:center; gap: 9px; }
[dir="ltr"] .header-actions { margin-inline-start:auto; }
.icon-btn { border:1px solid transparent; background:transparent; color:var(--muted); width:40px; height:40px; border-radius:11px; display:grid; place-items:center; transition:var(--transition); position:relative; }
.icon-btn:hover { background:var(--surface-2); color:var(--text); border-color:var(--line); }
.notification-dot { width:7px; height:7px; border-radius:50%; background:var(--danger); border:2px solid var(--surface); position:absolute; top:8px; inset-inline-end:9px; }
.header-divider { height: 30px; width:1px; background:var(--line); margin:0 5px; }
.profile-chip { border:0; background:transparent; display:flex; align-items:center; gap:9px; color:var(--text); padding:3px 4px; border-radius:12px; }
.profile-chip:hover { background:var(--surface-2); }
.avatar { width:36px; height:36px; background:linear-gradient(135deg,#d8e1f1,#9db5d9); color:var(--navy); border-radius:12px; display:grid; place-items:center; font-weight:800; font-size:13px; }
.profile-name { font-size:13px; font-weight:700; text-align:start; line-height:1.2; }
.profile-role { font-size:10px; color:var(--muted); font-weight:500; display:block; margin-top:3px; }

.page { max-width: 1440px; margin:0 auto; padding: 28px 32px 48px; }
.page-heading { display:flex; justify-content:space-between; gap:22px; align-items:flex-start; margin-bottom: 24px; }
.eyebrow { color:var(--blue); font-size:12px; font-weight:700; letter-spacing:.01em; margin:0 0 6px; }
h1, h2, h3, h4, p { margin-top:0; }
h1 { font-size:30px; letter-spacing:-.04em; margin-bottom:8px; line-height:1.3; }
h2 { font-size:21px; letter-spacing:-.025em; margin-bottom:5px; }
h3 { font-size:16px; margin-bottom:5px; }
.page-heading p, .muted { color:var(--muted); }
.page-heading p { margin:0; font-size:14px; }
.actions { display:flex; flex-wrap:wrap; align-items:center; gap:9px; }
.btn { min-height:42px; border:1px solid var(--line); background:var(--surface); color:var(--text); display:inline-flex; align-items:center; justify-content:center; gap:8px; padding:0 15px; border-radius:11px; font-weight:700; font-size:13px; transition:var(--transition); }
.btn:hover { transform:translateY(-1px); box-shadow:var(--shadow-sm); border-color:#bdc9dc; }
.btn-primary { background:var(--navy); color:#fff; border-color:var(--navy); box-shadow:0 7px 16px rgba(23,44,74,.17); }
.btn-primary:hover { background:#223d64; border-color:#223d64; }
.btn-soft { background:var(--lavender-soft); color:var(--blue-deep); border-color:transparent; }
.btn-success { background:var(--success-soft); color:var(--success); border-color:transparent; }
.btn-danger { background:var(--danger-soft); color:var(--danger); border-color:transparent; }
.btn-ghost { border-color:transparent; background:transparent; color:var(--muted); }
.btn-sm { min-height:34px; padding:0 10px; font-size:12px; border-radius:9px; }
.badge, .pill { display:inline-flex; align-items:center; gap:5px; padding:5px 8px; border-radius:7px; background:var(--lavender-soft); color:var(--blue-deep); font-size:10px; font-weight:700; white-space:nowrap; }
.badge-warning { background:var(--warning-soft); color:var(--warning); }
.badge-lock { background:var(--surface-2); color:var(--muted); }

.grid { display:grid; gap:17px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0,1fr)); margin-bottom:20px; }
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius-md); box-shadow:var(--shadow-sm); }
.stat-card { padding:18px; position:relative; overflow:hidden; }
.stat-card:after { content:""; width:76px; height:76px; border-radius:50%; background:var(--lavender-soft); position:absolute; inset-inline-end:-24px; bottom:-26px; opacity:.8; }
.stat-top { display:flex; align-items:center; justify-content:space-between; color:var(--muted); font-size:12px; position:relative; z-index:1; }
.stat-icon { width:33px; height:33px; display:grid; place-items:center; border-radius:10px; background:var(--lavender-soft); color:var(--blue-deep); }
.stat-value { font-size:26px; font-weight:800; margin:15px 0 2px; letter-spacing:-.04em; position:relative; z-index:1; }
.stat-note { color:var(--muted); font-size:11px; position:relative; z-index:1; }
.stat-note strong { color:var(--success); }
.dashboard-hero { background: linear-gradient(110deg, #edf2fb 0%, #f6f5fc 59%, #edeafa 100%); border:1px solid #e0e6f2; padding:28px 30px; border-radius:20px; display:flex; align-items:center; justify-content:space-between; gap:26px; margin-bottom:20px; overflow:hidden; position:relative; }
[data-theme="dark"] .dashboard-hero { background:linear-gradient(110deg,#1b2d45,#27253d); border-color:#304158; }
.dashboard-hero:after { content:""; position:absolute; width:280px; height:280px; border-radius:50%; border: 1px solid rgba(84,121,183,.16); inset-inline-end:6%; top:-160px; box-shadow: 0 0 0 26px rgba(84,121,183,.04), 0 0 0 54px rgba(84,121,183,.03); }
.hero-copy { max-width: 630px; position:relative; z-index:1; }
.hero-copy h1 { font-size:28px; max-width:630px; }
.hero-copy p { color:var(--muted); line-height:1.8; margin-bottom:18px; font-size:14px; }
.hero-art { width: 220px; height: 150px; position:relative; z-index:1; flex:0 0 auto; }
.hero-orb { position:absolute; width:128px; height:128px; border-radius:50%; background:linear-gradient(135deg,#a8bde2,#e3e0f6); inset-inline-end:34px; top:12px; opacity:.8; }
.hero-orb:before, .hero-orb:after { content:""; position:absolute; border:2px solid rgba(23,44,74,.23); border-radius:8px; width:78px; height:48px; transform:rotate(-27deg); }
.hero-orb:before { inset:30px auto auto -20px; }
.hero-orb:after { inset:49px -20px auto auto; border-color:rgba(84,121,183,.35); }
.section-row { display:flex; justify-content:space-between; align-items:center; gap:15px; margin:24px 0 13px; }
.section-row h2 { margin:0; }
.section-link { color:var(--blue-deep); font-size:12px; font-weight:700; border:0; background:transparent; padding:6px; }
.quick-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.quick-card { padding:18px; min-height:128px; display:flex; flex-direction:column; justify-content:space-between; transition:var(--transition); cursor:pointer; }
.quick-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); }
.quick-card-top { display:flex; align-items:center; justify-content:space-between; }
.quick-icon { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:var(--lavender-soft); color:var(--blue-deep); }
.quick-arrow { color:var(--muted); }
.quick-card h3 { margin:14px 0 2px; font-size:14px; }
.quick-card p { color:var(--muted); margin:0; font-size:11px; line-height:1.5; }
.two-col { grid-template-columns: minmax(0,1.42fr) minmax(300px, .78fr); align-items:start; }
.chart-card, .recommend-card, .course-card, .activity-card { padding:20px; }
.card-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:15px; margin-bottom:17px; }
.card-heading h3 { margin:0; }
.card-heading p { color:var(--muted); font-size:11px; margin:4px 0 0; }
.chart { height:185px; display:flex; align-items:stretch; gap:13px; padding-top:12px; }
.chart-y { display:flex; flex-direction:column; justify-content:space-between; color:var(--muted); font-size:10px; padding-bottom:25px; }
.chart-bars { flex:1; display:flex; align-items:flex-end; justify-content:space-around; gap:10px; border-bottom:1px solid var(--line); background:repeating-linear-gradient(to bottom, transparent 0, transparent 43px, var(--line) 44px, transparent 45px); }
.bar-col { height:100%; display:flex; flex-direction:column; justify-content:flex-end; align-items:center; gap:8px; min-width:20px; }
.bar { width:22px; border-radius:7px 7px 3px 3px; background:linear-gradient(to top,var(--blue),#91aad2); transition:height .45s ease; min-height:8px; }
.bar-col span { font-size:10px; color:var(--muted); transform:translateY(24px); }
.recommend-card { background:linear-gradient(145deg,var(--navy),#2c4c79); color:white; border:0; min-height:230px; position:relative; overflow:hidden; }
.recommend-card:after { content:"✦"; position:absolute; font-size:110px; opacity:.06; inset-inline-end:19px; bottom:-32px; }
.recommend-card .eyebrow { color:#bdd0f2; }
.recommend-card h3 { font-size:19px; line-height:1.5; max-width:260px; margin:11px 0 10px; }
.recommend-card p { color:#c4d1e4; line-height:1.7; font-size:12px; max-width:285px; }
.recommend-card .btn { background:white; color:var(--navy); border:0; margin-top:10px; }
.course-progress { height:7px; background:var(--line); border-radius:9px; overflow:hidden; }
.course-progress span { display:block; height:100%; background:var(--blue); border-radius:inherit; }
.course-row { display:flex; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.course-row:last-child { border-bottom:0; padding-bottom:0; }
.course-thumb { width:44px; height:44px; border-radius:12px; display:grid; place-items:center; background:linear-gradient(135deg,#dfe8f7,#c8c0e5); color:var(--navy); flex:0 0 auto; }
.course-row-main { min-width:0; flex:1; }
.course-row-main strong { font-size:13px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.course-row-main small { display:block; color:var(--muted); font-size:11px; margin-top:4px; }
.course-row-side { text-align:end; color:var(--blue-deep); font-size:12px; font-weight:700; }
[dir="ltr"] .course-row-side { text-align:right; }
.activity-item { display:flex; gap:11px; padding:11px 0; border-bottom:1px solid var(--line); }
.activity-item:last-child { border-bottom:0; }
.activity-dot { width:28px; height:28px; display:grid; place-items:center; background:var(--surface-2); color:var(--blue-deep); border-radius:9px; flex:0 0 auto; }
.activity-item p { margin:0; font-size:12px; line-height:1.45; }
.activity-item small { display:block; color:var(--muted); font-size:10px; margin-top:4px; }

.toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:18px; }
.toolbar .search-box { flex: 1 1 230px; max-width:none; }
.field { display:flex; flex-direction:column; gap:7px; margin-bottom:14px; }
.field label { font-size:12px; font-weight:700; color:var(--text); }
.field input, .field select, .field textarea { width:100%; border:1px solid var(--line); background:var(--surface); color:var(--text); border-radius:10px; min-height:42px; padding:9px 12px; outline:0; transition:var(--transition); }
.field textarea { min-height:96px; resize:vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(84,121,183,.12); }
.field-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:13px; }
.checkbox-row { display:flex; flex-wrap:wrap; gap:9px; }
.check-pill { border:1px solid var(--line); border-radius:9px; padding:9px 11px; font-size:12px; display:flex; align-items:center; gap:7px; color:var(--muted); cursor:pointer; }
.check-pill:has(input:checked) { border-color:#a7bde2; background:#eef3fb; color:var(--blue-deep); }
[data-theme="dark"] .check-pill:has(input:checked) { background:#223752; }
.check-pill input { accent-color:var(--blue); }

.page-card { padding:22px; }
.course-hero { padding:24px; display:flex; align-items:center; justify-content:space-between; gap:22px; background:linear-gradient(130deg,var(--navy),#355c8f); color:#fff; border:0; overflow:hidden; position:relative; }
.course-hero:after { content:""; position:absolute; width:300px; height:300px; border:1px solid rgba(255,255,255,.16); border-radius:50%; inset-inline-end:-90px; top:-140px; box-shadow:0 0 0 28px rgba(255,255,255,.04),0 0 0 58px rgba(255,255,255,.035); }
.course-hero > * { position:relative; z-index:1; }
.course-hero .eyebrow { color:#c3d5f5; }
.course-hero h1 { font-size:27px; margin-bottom:7px; }
.course-hero p { color:#d2deef; font-size:13px; max-width:580px; margin:0; line-height:1.7; }
.course-hero .btn { background:#fff; border-color:#fff; color:var(--navy); }
.course-meta { display:flex; gap:20px; margin-top:16px; flex-wrap:wrap; color:#d5e0ef; font-size:11px; }
.course-meta span { display:flex; align-items:center; gap:6px; }
.filter-tabs { display:flex; gap:6px; overflow:auto; padding-bottom:4px; }
.tab { border:0; background:transparent; color:var(--muted); padding:9px 12px; font-size:12px; border-radius:9px; white-space:nowrap; }
.tab.active, .tab:hover { background:var(--lavender-soft); color:var(--blue-deep); font-weight:700; }
.library-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.library-card { padding:17px; position:relative; }
.file-icon { width:43px; height:43px; border-radius:12px; display:grid; place-items:center; background:var(--lavender-soft); color:var(--blue-deep); }
.library-card .star { position:absolute; top:15px; inset-inline-end:15px; color:var(--muted); border:0; background:transparent; }
.library-card .star.active { color:var(--warning); }
.library-card h3 { margin:16px 0 4px; font-size:14px; }
.library-card p { color:var(--muted); font-size:11px; margin-bottom:16px; }
.card-footer { display:flex; align-items:center; justify-content:space-between; gap:8px; border-top:1px solid var(--line); padding-top:12px; }
.card-footer small { color:var(--muted); font-size:10px; }

.upload-layout { grid-template-columns:minmax(0,1.05fr) minmax(330px,.95fr); align-items:start; }
.upload-zone { min-height:250px; border:1.5px dashed #afbdd2; border-radius:17px; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:25px; text-align:center; transition:var(--transition); background:var(--surface-2); }
.upload-zone.dragging, .upload-zone:hover { border-color:var(--blue); background:#f0f5fd; }
[data-theme="dark"] .upload-zone.dragging, [data-theme="dark"] .upload-zone:hover { background:#1e314a; }
.upload-zone-icon { width:58px; height:58px; display:grid; place-items:center; background:var(--lavender-soft); color:var(--blue-deep); border-radius:17px; margin-bottom:13px; }
.upload-zone h3 { margin-bottom:6px; }
.upload-zone p { color:var(--muted); font-size:12px; margin-bottom:17px; }
.file-preview { display:flex; gap:13px; align-items:center; padding:14px; background:var(--surface-2); border:1px solid var(--line); border-radius:13px; margin-top:13px; }
.file-preview .file-icon { flex:0 0 auto; }
.file-preview-main { flex:1; min-width:0; }
.file-preview-main strong { font-size:12px; display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.file-preview-main small { color:var(--muted); font-size:10px; display:block; margin-top:4px; }
.upload-status { color:var(--success); font-size:11px; font-weight:700; }
.progress-line { height:7px; background:var(--line); border-radius:8px; overflow:hidden; margin-top:9px; }
.progress-line span { height:100%; width:0; display:block; background:linear-gradient(90deg,var(--blue),var(--lavender)); transition:width .3s; }
.step-list { display:grid; gap:9px; margin-top:17px; }
.process-step { display:flex; gap:10px; align-items:center; font-size:12px; color:var(--muted); }
.process-step.active { color:var(--blue-deep); font-weight:700; }
.process-step.done { color:var(--success); }
.step-dot { width:22px; height:22px; border-radius:50%; display:grid; place-items:center; border:1px solid var(--line); font-size:10px; background:var(--surface); }
.process-step.active .step-dot { background:var(--lavender-soft); color:var(--blue-deep); border-color:transparent; }
.process-step.done .step-dot { background:var(--success-soft); color:var(--success); border-color:transparent; }

.summary-layout { grid-template-columns:minmax(0,1fr) 290px; align-items:start; }
.summary-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:9px; padding-bottom:17px; border-bottom:1px solid var(--line); margin-bottom:17px; }
.summary-search { flex:1 1 220px; position:relative; }
.summary-search input { width:100%; height:38px; border-radius:9px; border:1px solid var(--line); padding:0 12px; background:var(--surface-2); color:var(--text); }
.summary-section { border-bottom:1px solid var(--line); padding:15px 0; }
.summary-section:last-child { border-bottom:0; }
.summary-section button { width:100%; padding:0; display:flex; justify-content:space-between; align-items:center; border:0; background:transparent; color:var(--text); font-weight:800; font-size:14px; text-align:start; }
.summary-section .section-body { padding:12px 0 3px; color:var(--muted); font-size:13px; line-height:1.9; }
.summary-section .section-body ul { margin:0; padding-inline-start:19px; }
.highlight { background:#fff1bf; color:var(--text); padding:1px 3px; border-radius:4px; }
[data-theme="dark"] .highlight { background:#66531f; color:#fff4bf; }
.source-ref { display:inline-flex; align-items:center; gap:4px; font-size:10px; color:var(--blue-deep); background:var(--lavender-soft); padding:3px 6px; border-radius:6px; margin-inline-start:5px; }
.focus-panel { padding:18px; background:var(--lavender-soft); border:1px solid #e1ddf1; border-radius:15px; position:sticky; top:95px; }
[data-theme="dark"] .focus-panel { border-color:#3b385b; }
.focus-panel .ai-label { display:flex; align-items:center; gap:7px; color:var(--blue-deep); font-size:11px; font-weight:800; }
.focus-panel h3 { line-height:1.6; margin:12px 0 9px; font-size:15px; }
.focus-panel p { font-size:12px; color:var(--muted); line-height:1.7; margin-bottom:15px; }

.chat-layout { grid-template-columns:250px minmax(0,1fr); align-items:stretch; min-height:650px; }
.chat-history { padding:15px; }
.chat-history-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:13px; }
.chat-history-header strong { font-size:13px; }
.chat-list { display:grid; gap:5px; }
.chat-item { padding:11px; border-radius:10px; color:var(--muted); border:0; background:transparent; text-align:start; font-size:12px; }
.chat-item.active, .chat-item:hover { background:var(--lavender-soft); color:var(--blue-deep); font-weight:700; }
.chat-window { display:flex; flex-direction:column; min-height:650px; padding:19px 20px 16px; }
.chat-window-header { padding-bottom:15px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; }
.chat-window-header strong { font-size:14px; }
.chat-window-header small { color:var(--success); font-size:10px; display:block; margin-top:3px; }
.messages { flex:1; padding:22px 4px; display:flex; flex-direction:column; gap:15px; overflow:auto; }
.message { display:flex; gap:9px; max-width:75%; align-items:flex-start; }
.message.user { align-self:flex-start; flex-direction:row-reverse; }
.message.assistant { align-self:flex-end; }
.message-bubble { padding:12px 14px; border-radius:13px; line-height:1.75; font-size:12px; }
.message.user .message-bubble { background:var(--navy); color:#fff; border-bottom-left-radius:4px; }
[dir="rtl"] .message.user .message-bubble { border-bottom-right-radius:4px; border-bottom-left-radius:13px; }
.message.assistant .message-bubble { background:var(--surface-2); border:1px solid var(--line); border-bottom-right-radius:4px; }
[dir="rtl"] .message.assistant .message-bubble { border-bottom-left-radius:4px; border-bottom-right-radius:13px; }
.message-avatar { width:28px; height:28px; flex:0 0 auto; display:grid; place-items:center; border-radius:9px; font-size:10px; background:var(--lavender-soft); color:var(--blue-deep); font-weight:800; }
.chat-prompts { display:flex; gap:7px; overflow:auto; padding:0 0 12px; }
.prompt-chip { white-space:nowrap; border:1px solid var(--line); color:var(--muted); background:var(--surface); padding:7px 10px; border-radius:20px; font-size:11px; }
.prompt-chip:hover { color:var(--blue-deep); border-color:#b5c8e8; }
.chat-compose { display:flex; gap:8px; border:1px solid var(--line); background:var(--surface-2); padding:7px; border-radius:12px; }
.chat-compose input { flex:1; border:0; outline:0; background:transparent; color:var(--text); padding:0 8px; min-width:0; }

.quiz-levels { grid-template-columns:repeat(4,minmax(0,1fr)); }
.level-card { padding:17px; cursor:pointer; transition:var(--transition); }
.level-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); }
.level-card.locked { opacity:.65; }
.level-top { display:flex; justify-content:space-between; align-items:center; }
.level-icon { width:38px; height:38px; border-radius:11px; display:grid; place-items:center; background:var(--lavender-soft); color:var(--blue-deep); }
.level-card h3 { margin:15px 0 6px; }
.level-card p { color:var(--muted); font-size:11px; line-height:1.6; min-height:36px; }
.level-meta { color:var(--muted); font-size:10px; display:flex; justify-content:space-between; border-top:1px solid var(--line); padding-top:11px; }
.quiz-shell { max-width:860px; margin:0 auto; }
.quiz-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:13px; }
.quiz-top strong { font-size:14px; }
.quiz-top span { color:var(--muted); font-size:12px; }
.quiz-progress { height:8px; background:var(--line); border-radius:9px; overflow:hidden; margin-bottom:20px; }
.quiz-progress span { height:100%; display:block; background:var(--blue); transition:width .35s; }
.question-card { padding:24px; }
.question-card .question-type { color:var(--blue); font-size:11px; font-weight:700; margin-bottom:10px; }
.question-card h2 { font-size:21px; line-height:1.6; max-width:700px; margin-bottom:20px; }
.options { display:grid; gap:10px; }
.option { width:100%; border:1px solid var(--line); background:var(--surface); padding:13px 14px; text-align:start; display:flex; align-items:center; gap:10px; border-radius:11px; color:var(--text); font-size:13px; transition:var(--transition); }
.option:hover { border-color:#a8bfdf; background:#f5f8fd; }
[data-theme="dark"] .option:hover { background:#21344d; }
.option.selected { border-color:var(--blue); background:#edf3fc; color:var(--blue-deep); font-weight:700; }
[data-theme="dark"] .option.selected { background:#223b5e; color:#c6d7f4; }
.option-letter { width:26px; height:26px; display:grid; place-items:center; border:1px solid var(--line); border-radius:8px; color:var(--muted); font-size:11px; }
.option.selected .option-letter { background:var(--blue); color:#fff; border-color:var(--blue); }
.quiz-actions { display:flex; justify-content:space-between; gap:10px; margin-top:24px; }
.results-card { padding:25px; text-align:center; }
.score-ring { width:130px; height:130px; border-radius:50%; display:grid; place-items:center; margin:8px auto 18px; background:conic-gradient(var(--success) 0 84%, var(--line) 84% 100%); position:relative; }
.score-ring:after { content:""; position:absolute; width:101px; height:101px; border-radius:50%; background:var(--surface); }
.score-ring strong { position:relative; z-index:1; font-size:27px; }
.result-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:11px; margin:20px 0; }
.result-stat { padding:13px; background:var(--surface-2); border-radius:11px; }
.result-stat strong { display:block; font-size:18px; }
.result-stat small { color:var(--muted); font-size:10px; }

.flash-layout { grid-template-columns:minmax(0,1fr) 260px; align-items:start; }
.flash-stage { min-height:420px; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:28px; background:linear-gradient(145deg,var(--surface),var(--surface-2)); }
.flash-counter { color:var(--muted); font-size:12px; margin-bottom:17px; }
.flashcard { width:min(520px, 100%); min-height:260px; perspective:1000px; cursor:pointer; }
.flashcard-inner { width:100%; height:100%; min-height:260px; position:relative; transform-style:preserve-3d; transition:transform .55s cubic-bezier(.2,.8,.2,1); }
.flashcard.flipped .flashcard-inner { transform:rotateY(180deg); }
.flash-face { position:absolute; inset:0; backface-visibility:hidden; border-radius:20px; border:1px solid var(--line); box-shadow:var(--shadow-md); padding:30px; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; }
.flash-front { background:linear-gradient(145deg,#fff,#eff3fb); }
[data-theme="dark"] .flash-front { background:linear-gradient(145deg,#202e42,#182538); }
.flash-back { background:linear-gradient(145deg,var(--navy),#355c8f); color:#fff; transform:rotateY(180deg); }
.flash-label { color:var(--blue); font-size:11px; font-weight:800; margin-bottom:15px; }
.flash-back .flash-label { color:#c3d4f2; }
.flash-face h2 { font-size:24px; line-height:1.5; }
.flash-face p { color:var(--muted); line-height:1.8; font-size:13px; }
.flash-back p { color:#d6e0ef; }
.flash-actions { display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:9px; margin-top:20px; }
.flash-side { padding:18px; }
.meter { margin:17px 0; }
.meter-line { display:flex; justify-content:space-between; font-size:11px; color:var(--muted); margin-bottom:7px; }
.meter-bar { height:8px; border-radius:9px; background:var(--line); overflow:hidden; }
.meter-bar span { display:block; height:100%; background:var(--success); }
.mini-list { display:grid; gap:8px; margin-top:17px; }
.mini-list-item { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:10px; background:var(--surface-2); border-radius:9px; font-size:11px; }
.mini-list-item small { color:var(--muted); }

.worksheet-layout { grid-template-columns:minmax(0,1fr) 285px; align-items:start; }
.exercise { padding:17px; margin-bottom:11px; }
.exercise-header { display:flex; gap:10px; justify-content:space-between; align-items:flex-start; }
.exercise h3 { font-size:14px; line-height:1.6; }
.exercise p { color:var(--muted); font-size:11px; margin-bottom:13px; }
.exercise-answer { padding:10px 12px; background:var(--success-soft); color:var(--success); border-radius:9px; font-size:11px; margin-top:11px; }
.hint-box { padding:14px; background:var(--warning-soft); border-radius:11px; color:var(--warning); font-size:12px; line-height:1.7; }

.board-shell { padding:16px; }
.board-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:7px; border-bottom:1px solid var(--line); padding-bottom:14px; margin-bottom:14px; }
.board-canvas { height:520px; border-radius:14px; border:1px solid var(--line); position:relative; overflow:hidden; background-color:var(--surface-2); background-image:radial-gradient(var(--line) 1px, transparent 1px); background-size:22px 22px; }
.board-node { position:absolute; min-width:126px; max-width:180px; padding:12px 13px; border-radius:12px; border:1px solid #ccd8eb; background:var(--surface); box-shadow:var(--shadow-sm); cursor:grab; user-select:none; z-index:2; }
.board-node:active { cursor:grabbing; }
.board-node.core { background:var(--navy); color:#fff; border-color:var(--navy); min-width:155px; text-align:center; }
.board-node.lav { background:var(--lavender-soft); border-color:#d9d2ef; }
.board-node strong { display:block; font-size:12px; }
.board-node small { display:block; font-size:10px; color:var(--muted); margin-top:5px; }
.board-node.core small { color:#c7d4e8; }
.board-line { position:absolute; height:2px; background:#b8c6dc; transform-origin:0 50%; z-index:1; opacity:.8; }
.board-help { color:var(--muted); font-size:11px; margin:0; }

.planner-layout { grid-template-columns:minmax(0,1.25fr) minmax(280px,.75fr); align-items:start; }
.calendar { padding:18px; }
.calendar-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:17px; }
.calendar-head strong { font-size:14px; }
.week-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:7px; }
.day { min-height:108px; border:1px solid var(--line); border-radius:11px; padding:9px; background:var(--surface-2); }
.day.today { background:var(--lavender-soft); border-color:#d2c9ef; }
.day-name { color:var(--muted); font-size:10px; }
.day-date { font-weight:800; font-size:15px; margin:6px 0 11px; }
.day-task { font-size:10px; line-height:1.35; padding:5px 6px; border-radius:6px; background:var(--surface); margin-top:5px; color:var(--blue-deep); }
.day-task.done { text-decoration:line-through; color:var(--success); }
.task-list { padding:18px; }
.task-item { display:flex; align-items:flex-start; gap:10px; padding:12px 0; border-bottom:1px solid var(--line); }
.task-item:last-child { border-bottom:0; }
.task-check { width:22px; height:22px; border:1px solid #bec9d9; background:var(--surface); color:#fff; border-radius:7px; flex:0 0 auto; display:grid; place-items:center; }
.task-item.done .task-check { background:var(--success); border-color:var(--success); }
.task-item strong { font-size:12px; display:block; }
.task-item small { color:var(--muted); font-size:10px; display:block; margin-top:5px; }

.analytics-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.analytics-card { padding:18px; }
.analytics-card.wide { grid-column:span 2; }
.analytics-card h3 { margin-bottom:16px; }
.line-chart { height:180px; position:relative; border-bottom:1px solid var(--line); border-left:1px solid var(--line); background:repeating-linear-gradient(to bottom,transparent 0,transparent 43px,var(--line) 44px,transparent 45px); }
.line-chart svg { position:absolute; inset:0; width:100%; height:100%; overflow:visible; }
.legend { display:flex; gap:14px; margin-top:12px; font-size:10px; color:var(--muted); }
.legend span { display:flex; align-items:center; gap:6px; }
.legend i { width:8px; height:8px; border-radius:50%; background:var(--blue); display:block; }
.legend i.lav { background:var(--lavender); }
.subject-row { margin-bottom:15px; }
.subject-row:last-child { margin-bottom:0; }
.subject-head { display:flex; justify-content:space-between; font-size:11px; margin-bottom:6px; }
.subject-head span:last-child { color:var(--muted); }
.subject-bar { height:9px; background:var(--line); border-radius:10px; overflow:hidden; }
.subject-bar span { display:block; height:100%; border-radius:inherit; }

.settings-grid { grid-template-columns:200px minmax(0,1fr); align-items:start; }
.settings-nav { padding:10px; }
.settings-nav button { display:block; width:100%; text-align:start; border:0; background:transparent; padding:11px; color:var(--muted); border-radius:9px; font-size:12px; }
.settings-nav button.active, .settings-nav button:hover { background:var(--lavender-soft); color:var(--blue-deep); font-weight:700; }
.settings-body { padding:23px; }
.setting-row { display:flex; justify-content:space-between; gap:20px; align-items:center; padding:16px 0; border-bottom:1px solid var(--line); }
.setting-row:last-child { border-bottom:0; }
.setting-row strong { font-size:13px; display:block; }
.setting-row small { color:var(--muted); font-size:11px; display:block; margin-top:5px; }
.switch { width:42px; height:24px; background:var(--line); border-radius:20px; padding:3px; border:0; transition:var(--transition); flex:0 0 auto; }
.switch span { width:18px; height:18px; display:block; border-radius:50%; background:#fff; transition:var(--transition); box-shadow:0 1px 3px rgba(0,0,0,.14); }
.switch.on { background:var(--blue); }
.switch.on span { transform:translateX(-18px); }
[dir="ltr"] .switch.on span { transform:translateX(18px); }

.auth-page { min-height:100vh; display:grid; grid-template-columns:1.05fr .95fr; background:var(--bg); }
.auth-art { background:linear-gradient(145deg,var(--navy),#365c8d); color:#fff; padding:52px; display:flex; flex-direction:column; justify-content:space-between; position:relative; overflow:hidden; }
.auth-art:after { content:""; width:540px; height:540px; border:1px solid rgba(255,255,255,.14); border-radius:50%; position:absolute; inset-inline-end:-210px; top:-130px; box-shadow:0 0 0 35px rgba(255,255,255,.04),0 0 0 78px rgba(255,255,255,.03); }
.auth-copy { position:relative; z-index:1; max-width:470px; margin:auto 0; }
.auth-copy h1 { font-size:42px; line-height:1.35; margin:20px 0 13px; }
.auth-copy p { color:#d2deef; font-size:15px; line-height:1.9; }
.auth-points { display:grid; gap:12px; margin-top:29px; }
.auth-point { display:flex; align-items:center; gap:9px; font-size:12px; color:#dbe5f4; }
.auth-point i { width:23px; height:23px; display:grid; place-items:center; background:rgba(255,255,255,.13); border-radius:7px; font-style:normal; }
.auth-panel { max-width:485px; width:calc(100% - 50px); margin:auto; padding:28px; }
.auth-brand { display:flex; align-items:center; gap:10px; margin-bottom:38px; }
.auth-panel h2 { font-size:27px; margin-bottom:8px; }
.auth-panel > p { color:var(--muted); font-size:13px; margin-bottom:24px; line-height:1.7; }
.auth-tabs { display:flex; gap:5px; background:var(--surface-2); padding:4px; border-radius:11px; margin-bottom:22px; }
.auth-tabs button { flex:1; border:0; background:transparent; color:var(--muted); padding:9px; border-radius:8px; font-size:12px; }
.auth-tabs button.active { background:var(--surface); color:var(--blue-deep); box-shadow:var(--shadow-sm); font-weight:700; }
.social-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin-bottom:18px; }
.divider { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:10px; margin:17px 0; }
.divider:before,.divider:after { content:""; height:1px; background:var(--line); flex:1; }
.auth-foot { text-align:center; color:var(--muted); font-size:11px; margin-top:19px; }
.auth-foot button { border:0; color:var(--blue); background:transparent; font-weight:700; }

.modal-backdrop { position:fixed; inset:0; background:rgba(12,23,40,.48); display:grid; place-items:center; z-index:60; padding:20px; animation:fadein .18s ease; }
.modal { width:min(520px,100%); max-height:min(720px,calc(100vh - 40px)); overflow:auto; background:var(--surface); border:1px solid var(--line); border-radius:18px; box-shadow:var(--shadow-md); padding:22px; animation:slideup .22s ease; }
.modal-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; margin-bottom:18px; }
.modal-head h3 { font-size:18px; margin:0; }
.modal-head p { color:var(--muted); font-size:11px; margin:5px 0 0; }
.close-btn { width:32px; height:32px; border:0; border-radius:8px; background:var(--surface-2); color:var(--muted); display:grid; place-items:center; }
.toast-root { position:fixed; inset-inline-end:22px; bottom:22px; z-index:80; display:grid; gap:9px; }
.toast { background:var(--navy); color:#fff; padding:12px 15px; border-radius:11px; box-shadow:var(--shadow-md); font-size:12px; max-width:320px; animation:slidein .22s ease; }
.toast.success { background:var(--success); }
.toast.warning { background:#80601d; }
.empty-state { padding:35px; text-align:center; color:var(--muted); }
.empty-state .empty-icon { width:48px; height:48px; display:grid; place-items:center; margin:0 auto 12px; background:var(--surface-2); border-radius:14px; color:var(--blue); }
.mobile-bottom-nav { display:none; }

@keyframes fadein { from{opacity:0} to{opacity:1} }
@keyframes slideup { from{opacity:0; transform:translateY(10px)} to{opacity:1; transform:none} }
@keyframes slidein { from{opacity:0; transform:translateX(13px)} to{opacity:1; transform:none} }

@media (max-width: 1150px) {
  :root { --sidebar-width:225px; }
  .quick-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .stats-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .library-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .quiz-levels { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position:fixed; inset-inline-start:0; transform:translateX(110%); transition:transform .25s ease; box-shadow:var(--shadow-md); }
  [dir="ltr"] .sidebar { transform:translateX(-110%); }
  .sidebar.open { transform:translateX(0); }
  .main-wrap { width:100%; }
  .mobile-menu { display:grid; }
  .topbar { padding:0 20px; }
  .two-col, .upload-layout, .summary-layout, .flash-layout, .worksheet-layout, .planner-layout { grid-template-columns:1fr; }
  .focus-panel { position:static; }
  .chat-layout { grid-template-columns:1fr; }
  .chat-history { display:none; }
  .analytics-card.wide { grid-column:span 1; }
  .analytics-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .settings-grid { grid-template-columns:1fr; }
  .settings-nav { display:flex; gap:5px; overflow:auto; }
  .settings-nav button { white-space:nowrap; width:auto; }
  .auth-page { grid-template-columns:1fr; }
  .auth-art { display:none; }
}
@media (max-width: 600px) {
  :root { --header-height:64px; }
  .topbar { padding:0 13px; gap:8px; }
  .topbar .search-box { display:none; }
  .header-divider, .profile-name { display:none; }
  .header-actions { gap:2px; }
  .page { padding:21px 14px 84px; }
  .page-heading { flex-direction:column; gap:13px; margin-bottom:19px; }
  .page-heading h1 { font-size:25px; }
  .page-heading .actions { width:100%; }
  .page-heading .actions .btn { flex:1; }
  .dashboard-hero { padding:22px; }
  .hero-copy h1 { font-size:24px; }
  .hero-art { display:none; }
  .stats-grid, .quick-grid, .library-grid, .quiz-levels, .analytics-grid { grid-template-columns:1fr; }
  .stat-card { min-height:125px; }
  .course-hero { flex-direction:column; align-items:flex-start; }
  .course-hero .actions { width:100%; }
  .course-hero .btn { width:100%; }
  .field-row { grid-template-columns:1fr; gap:0; }
  .page-card { padding:16px; }
  .chart-card, .recommend-card, .course-card, .activity-card { padding:16px; }
  .week-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .day { min-height:100px; }
  .result-grid { grid-template-columns:1fr; }
  .question-card { padding:18px; }
  .question-card h2 { font-size:18px; }
  .flash-stage { padding:18px; min-height:390px; }
  .flash-face { padding:22px; }
  .flash-face h2 { font-size:20px; }
  .board-canvas { height:470px; }
  .auth-panel { width:calc(100% - 28px); padding:16px; }
  .modal { padding:17px; }
  .mobile-bottom-nav { position:fixed; display:flex; inset-inline:10px; bottom:9px; height:62px; background:color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter:blur(15px); border:1px solid var(--line); border-radius:17px; box-shadow:var(--shadow-md); z-index:30; justify-content:space-around; align-items:center; }
  .mobile-bottom-nav button { color:var(--muted); background:transparent; border:0; display:flex; flex-direction:column; align-items:center; gap:4px; font-size:9px; min-width:48px; }
  .mobile-bottom-nav button.active { color:var(--blue-deep); font-weight:700; }
  .mobile-bottom-nav svg { width:18px; height:18px; }
  .toast-root { inset-inline:12px; bottom:78px; }
  .toast { max-width:none; }
}
