/* KSEP mock-up – layout and components (brand colours come from brand.css) */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --line: #e3e8ef;
  --line-strong: #cfd7e3;
  --ink: #1d2733;
  --ink-2: #4a5768;
  --ink-3: #7b8796;
  --good: #1f8a4c;   --good-bg: #e4f5ea;
  --warn: #b26a00;   --warn-bg: #fff3dc;
  --bad:  #c0362c;   --bad-bg:  #fde8e6;
  --info: var(--brand-700); --info-bg: var(--brand-100);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,32,64,.06), 0 2px 8px rgba(16,32,64,.05);
  --shadow-lg: 0 10px 30px rgba(16,32,64,.15);
  --topbar-h: 64px;
  --sidebar-w: 248px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Arabic", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--ink); }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 650; }
h3 { font-size: 16px; font-weight: 650; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* ---------- buttons, inputs, badges ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-weight: 600; font-size: 14px; background: var(--surface); color: var(--ink); transition: background .15s, border-color .15s; }
.btn-primary { background: var(--brand-700); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-800); text-decoration: none; }
.btn-outline { border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--brand-600); color: var(--brand-700); }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 8px 10px; }
.btn-ghost:hover { background: var(--brand-50); color: var(--brand-700); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; position: relative; }
.icon-btn:hover { background: var(--brand-50); color: var(--brand-700); }
.dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); border: 2px solid var(--surface); }
input, select, textarea { font: inherit; color: var(--ink); width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); font-weight: 400; }
.check input { width: auto; margin-top: 3px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge-count { background: var(--brand-700); color: #fff; border: 0; min-width: 22px; justify-content: center; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 24px; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: calc(var(--sidebar-w) - 20px); color: var(--ink); }
.brand:hover { text-decoration: none; }
.wordmark { background: var(--brand-700); color: var(--on-brand); font-weight: 800; letter-spacing: .08em; font-size: 15px;
  padding: 7px 10px; border-radius: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-size: 15px; }
.brand-text span { font-size: 11.5px; color: var(--ink-3); }
.brand img { height: 36px; }
.topnav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topnav a { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; white-space: nowrap; }
.topnav a:hover { background: var(--brand-50); color: var(--brand-700); text-decoration: none; }
.topnav a.active { color: var(--brand-700); background: var(--brand-50); }
.top-actions { display: flex; align-items: center; gap: 4px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-100); color: var(--brand-800); font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.avatar.lg { width: 84px; height: 84px; font-size: 28px; }
.user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; padding: 4px 6px 4px 4px; border-radius: 999px; }
.user-btn:hover { background: var(--brand-50); }
.user-btn .lang-chip { font-size: 12px; font-weight: 700; color: var(--ink-3); }

/* dropdown */
.dropdown { position: absolute; top: calc(var(--topbar-h) - 6px); inset-inline-end: 16px; width: 300px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 8px; z-index: 40; max-height: calc(100vh - 80px); overflow: auto; }
.dd-head { display: flex; gap: 12px; align-items: center; padding: 10px; }
.dd-sec { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 10px 10px 4px; }
.dd-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: start; border: 0;
  background: transparent; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink); font-size: 14px; }
.dd-item:hover { background: var(--brand-50); text-decoration: none; }
.dd-item.active { color: var(--brand-700); font-weight: 650; }
.dd-sep { height: 1px; background: var(--line); margin: 6px 4px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: calc(100vh - var(--topbar-h)); }
.sidebar { padding: 20px 12px; border-inline-end: 1px solid var(--line); background: var(--surface); }
.side-title { font-size: 11px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 4px 12px 10px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; }
.side-link:hover { background: var(--brand-50); color: var(--brand-700); text-decoration: none; }
.side-link.active { background: var(--brand-100); color: var(--brand-800); }
.side-link svg { flex: none; }
.side-foot { margin-top: 24px; padding: 14px; border-radius: var(--radius); background: var(--brand-50); font-size: 13px; color: var(--ink-2); }
.main { padding: 28px 32px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--ink-3); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.footer { text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 24px 0 8px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: transparent; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px;
  display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tab:hover { color: var(--brand-700); text-decoration: none; }
.tab.active { color: var(--brand-700); border-bottom-color: var(--brand-700); }

/* toolbar */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search input { padding-inline-start: 38px; border-radius: 999px; }
.search svg { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 13px; color: var(--ink-3); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 8px 10px; color: var(--ink-3); display: inline-flex; }
.seg button.active { background: var(--brand-50); color: var(--brand-700); }
.toolbar select { width: auto; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tag { border: 1px solid var(--line-strong); background: var(--surface); padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--ink-2); }
.tag.active { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

/* breadcrumb */
.crumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; margin-bottom: 16px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); font-weight: 550; }
.crumbs .sep { color: var(--line-strong); }
[dir="rtl"] .crumbs .sep { transform: scaleX(-1); display: inline-block; }

/* catalogue tiles (countries, languages, topics) */
.nav-tile { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; text-align: start; width: 100%; }
.nav-tile:hover { border-color: var(--brand-500); transform: translateY(-1px); text-decoration: none; }
.nav-tile .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700);
  display: inline-flex; align-items: center; justify-content: center; flex: none; font-weight: 800; font-size: 14px; }
.nav-tile .t { flex: 1; min-width: 0; }
.nav-tile .t b { display: block; font-size: 15px; }
.nav-tile .t span { font-size: 13px; color: var(--ink-3); }
.flag { width: 44px; height: 30px; border-radius: 5px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }

/* course cards */
.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); color: var(--ink); transition: border-color .15s, transform .15s; }
.course-card:hover { border-color: var(--brand-500); transform: translateY(-2px); text-decoration: none; }
.cover { height: 132px; position: relative; display: flex; align-items: flex-end; padding: 12px; color: #fff; }
.cover .topic-ico { position: absolute; inset-inline-end: 14px; top: 14px; opacity: .9; }
.cover .lang { background: rgba(0,0,0,.28); backdrop-filter: blur(2px); color: #fff; border: 0; }
.course-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.course-body h3 { font-size: 15.5px; }
.meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--ink-3); font-size: 12.5px; align-items: center; }
.meta span { display: inline-flex; gap: 5px; align-items: center; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand-600); border-radius: 999px; }
.progress.good > i { background: var(--good); }
.card-foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.list .course-card { flex-direction: row; }
.list .cover { width: 180px; height: auto; min-height: 120px; flex: none; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }

/* course page */
.course-hero { border-radius: var(--radius); padding: 28px; color: #fff; display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 20px; flex-wrap: wrap; }
.course-hero h1 { color: #fff; font-size: 26px; max-width: 760px; }
.course-hero .meta { color: rgba(255,255,255,.85); margin-top: 10px; }
.hero-progress { min-width: 240px; background: rgba(255,255,255,.14); border-radius: var(--radius); padding: 14px 16px; }
.hero-progress .progress { background: rgba(255,255,255,.25); margin: 8px 0 4px; }
.hero-progress .progress > i { background: #fff; }
.course-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 20px; align-items: start; }
.section { margin-bottom: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: start; }
.section-head h3 { display: flex; gap: 10px; align-items: center; }
.section-body { border-top: 1px solid var(--line); }
.activity { display: flex; gap: 14px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.activity:last-child { border-bottom: 0; }
.act-ico { width: 40px; height: 40px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.act-main { flex: 1; min-width: 0; }
.act-main a { font-weight: 600; color: var(--ink); }
.act-main a:hover { color: var(--brand-700); }
.act-type { font-size: 12.5px; color: var(--ink-3); }
.done-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 12.5px; color: var(--ink-2); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.done-btn.done { background: var(--good-bg); color: var(--good); border-color: transparent; }
.side-block { margin-bottom: 16px; }
.side-block h3 { margin-bottom: 12px; }
.stars { color: #f2a900; letter-spacing: 2px; font-size: 18px; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }

/* achievements */
.badge-card { text-align: center; padding: 22px 16px 16px; }
.medal { width: 104px; height: 104px; border-radius: 50%; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; }
.medal.off { filter: grayscale(1); opacity: .35; }
.badge-card h3 { font-size: 15px; margin-bottom: 8px; }
.cert-card { display: flex; gap: 16px; align-items: center; padding: 18px 20px; }
.cert-thumb { width: 92px; height: 64px; border-radius: 6px; background: linear-gradient(135deg, var(--brand-50), #fff); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center; color: var(--brand-700); flex: none; }

/* certificate preview */
.certificate { background: #fff; color: #1d2733; border: 10px solid var(--brand-700); outline: 2px solid var(--brand-100); outline-offset: -18px; padding: 44px 40px; text-align: center; border-radius: 4px; }
.certificate .c-org { font-weight: 800; letter-spacing: .12em; color: var(--brand-700); }
.certificate h2 { font-size: 30px; margin: 18px 0 6px; font-family: Georgia, "Times New Roman", serif; color: var(--brand-900); }
.certificate .c-name { font-size: 26px; font-weight: 700; margin: 18px 0 6px; font-family: Georgia, serif; }
.certificate .c-course { font-size: 18px; color: var(--brand-800); font-weight: 650; }
.certificate .c-foot { display: flex; justify-content: space-between; margin-top: 34px; font-size: 13px; color: var(--ink-2); gap: 12px; flex-wrap: wrap; }

/* profile */
.profile-head { display: flex; gap: 20px; align-items: center; }
.list-rows .row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list-rows .row:last-child { border-bottom: 0; }

/* dashboard */
.kpi { padding: 18px 20px; }
.kpi .k-label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.kpi .k-value { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 6px 0 2px; color: var(--ink); }
.kpi .k-target { font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.chart { position: relative; }
.chart svg text { font-family: var(--font); }
.tooltip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12.5px; padding: 8px 10px; border-radius: 8px;
  box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); z-index: 5; }
.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--ink-2); margin-top: 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-inline-end: 6px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: start; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }

/* placeholder page */
.planned { padding: 28px; }
.planned ul { margin: 12px 0 0; padding-inline-start: 20px; color: var(--ink-2); }
.planned li { margin: 6px 0; }

/* modal + toast */
.modal-back { position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); width: min(860px, 100%); max-height: calc(100vh - 40px); overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px; }
.modal-body { padding: 20px; }
.player { background: linear-gradient(135deg, var(--brand-800), var(--brand-600)); color: #fff; border-radius: var(--radius-sm); min-height: 320px; padding: 32px;
  display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.player h2 { color: #fff; font-size: 24px; }
.quiz-opt { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; font-weight: 400; color: var(--ink); font-size: 14.5px; }
.quiz-opt:hover { border-color: var(--brand-500); }
.quiz-opt input { width: auto; }
.toast { position: fixed; bottom: 24px; inset-inline-end: 24px; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); z-index: 70; display: flex; gap: 10px; align-items: center; max-width: 380px; }

/* ---------- login ---------- */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-brand { background: radial-gradient(1200px 600px at 10% 10%, var(--brand-600), var(--brand-900)); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand .wordmark { background: #fff; color: var(--brand-800); }
.auth-brand .brand-text span { color: rgba(255,255,255,.8); }
.auth-brand h1 { color: #fff; font-size: 36px; max-width: 520px; margin-top: 48px; }
.auth-brand p { color: rgba(255,255,255,.85); max-width: 520px; font-size: 16px; }
.auth-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 560px; }
.auth-stats div { background: rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px; }
.auth-stats b { display: block; font-size: 24px; }
.auth-stats span { font-size: 13px; color: rgba(255,255,255,.8); }
.auth-side { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-card { width: min(440px, 100%); margin: auto; }
.auth-card .tabs { margin-bottom: 22px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lang-select { width: auto; padding: 7px 10px; font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .course-layout { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .brand { min-width: 0; }
  .brand-text span { display: none; }
  .main { padding: 20px 16px 40px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .g-4 { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px 0; gap: 8px; }
  .brand { flex: 1; }
  .topnav { order: 3; flex: 0 0 100%; margin: 0 -12px; padding: 4px 8px 8px; border-top: 1px solid var(--line); }
  .dropdown { top: 60px; inset-inline-end: 8px; width: calc(100% - 16px); }
  .toolbar .search { min-width: 0; flex: 1 1 100%; max-width: none; }
  .course-hero { padding: 20px; }
  .course-hero h1 { font-size: 21px; }
  .cert-card { flex-wrap: wrap; }
  .list .course-card { flex-direction: column; }
  .list .cover { width: auto; }
}

/* ===== iteration 2: Moco-like My learning, preview, collapsible menu, Library ===== */
.burger { margin-inline-end: -8px; }
.sidebar { transition: width .2s ease; overflow: hidden; }
.shell { transition: grid-template-columns .2s ease; }
.shell.collapsed { grid-template-columns: 72px 1fr; }
.shell.collapsed .sidebar { padding: 20px 10px; }
.shell.collapsed .side-title, .shell.collapsed .lbl { display: none; }
.shell.collapsed .side-link { justify-content: center; padding: 10px 0; }
.shell.collapsed .side-foot { padding: 12px 0; display: flex; justify-content: center; background: transparent; }

.ml-head { align-items: center; }
.ml-head .search { max-width: 380px; }
.ml-tabs-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 16px; margin-bottom: 18px; flex-wrap: wrap; }
.ml-tabs { border-bottom: 0; margin: 0; }
.ml-tabs .tab { padding: 16px 12px 14px; }
.ml-controls { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.ml-controls select { width: auto; }
.icon-only { padding: 9px 10px; position: relative; }
.icon-only .badge-count { position: absolute; top: -7px; inset-inline-end: -7px; font-size: 11px; min-width: 18px; padding: 1px 5px; }
.icon-only.on, .icon-only.active { border-color: var(--brand-600); color: var(--brand-700); background: var(--brand-50); }
.filter-panel { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; width: 280px; padding: 14px; z-index: 20; box-shadow: var(--shadow-lg); }
.fp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.fp-list { max-height: 220px; overflow: auto; margin: 10px 0 12px; }
.fp-item { margin: 0; padding: 5px 2px; font-size: 14px; color: var(--ink); }

.cards-grid { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 20px; }
.thumb { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.thumb:hover { border-color: var(--brand-500); transform: translateY(-2px); }
.thumb:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.thumb.selected { border-color: var(--brand-600); box-shadow: 0 0 0 2px var(--brand-100), var(--shadow); }
.thumb.selected::after { content: ""; position: absolute; bottom: -12px; left: 50%; width: 18px; height: 18px; background: var(--surface); border-left: 1px solid var(--brand-600); border-top: 1px solid var(--brand-600); transform: translateX(-50%) rotate(45deg); z-index: 3; }
.thumb-img { position: relative; aspect-ratio: 2 / 1; border-radius: var(--radius) var(--radius) 0 0; overflow: visible; }
.thumb-img img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: var(--radius) var(--radius) 0 0; }
.thumb-img .lang { position: absolute; top: 10px; inset-inline-start: 10px; background: rgba(255,255,255,.92); color: var(--ink); border: 0; gap: 6px; }
.ring { --p: 0; position: absolute; inset-inline-end: 12px; bottom: -22px; width: 46px; height: 46px; border-radius: 50%;
  background: conic-gradient(var(--brand-600) calc(var(--p) * 1%), var(--line) 0); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 3px var(--surface); }
.ring span { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.thumb-cap { padding: 28px 16px 8px; flex: 1; }
.thumb-cap h6 { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.course-period { color: var(--ink-3); font-size: 12.5px; margin-top: 8px; display: flex; gap: 5px; align-items: center; }
.thumb-more { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.more-link { color: var(--brand-700); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.thumb.selected .more-link svg { transform: rotate(180deg); }

.cards-list { gap: 10px; }
.list-row { flex-direction: row; align-items: center; gap: 16px; padding: 10px 16px 10px 10px; }
.list-row > img { width: 132px; height: 66px; object-fit: cover; border-radius: 8px; flex: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.list-row h6 { margin: 0 0 6px; font-size: 15px; }
.list-row .ring { position: static; box-shadow: none; flex: none; }

.preview { grid-column: 1 / -1; padding: 0; border-color: var(--brand-600); animation: pvIn .2s ease; }
@keyframes pvIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.pv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 20px 12px; border-bottom: 1px solid var(--line); }
.pv-head h3 { font-size: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pv-body { display: grid; grid-template-columns: minmax(240px, 1fr) 2fr; gap: 28px; padding: 18px 20px 22px; }
.pv-left .btn-primary { margin-bottom: 14px; }
.pv-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.pv-badge { width: 36px; height: 39px; }
.pv-left hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.pv-left .progress { margin: 6px 0 2px; }
.pv-summary { background: var(--brand-50); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 10px; }
.pv-summary p { margin: 0 0 8px; }
.pv-sec { border-bottom: 1px solid var(--line); }
.pv-sec-h { border: 0; background: transparent; width: 100%; text-align: start; padding: 9px 2px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.pv-sec-h svg { transition: transform .15s; }
.pv-sec-h.open svg { transform: rotate(90deg); }
[dir="rtl"] .pv-sec-h svg { transform: scaleX(-1); }
.pv-sec-b { padding: 0 0 10px 22px; }
.pv-mod { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.act-ico.sm { width: 26px; height: 26px; border-radius: 7px; }

.cat-h { margin: 0 0 12px; }
.cat-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.cat-btn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); }
.cat-btn:hover { border-color: var(--brand-500); text-decoration: none; background: var(--brand-50); }
.cat-btn .cat-lbl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cat-btn .cat-lbl small { color: var(--ink-3); font-size: 12.5px; }
.cat-btn .ico { width: 38px; height: 38px; border-radius: 9px; background: var(--brand-50); color: var(--brand-700); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; }
.cat-btn .flag { width: 38px; height: 26px; }

.badge-art { width: 112px; height: 121px; display: block; margin: 0 auto 10px; }

.lib-controls { flex-wrap: wrap; padding: 0 0 6px; }
.lib-controls .search { flex: 1 1 280px; max-width: 460px; }
.push-end { margin-inline-start: auto; }
.res-list { margin-top: 8px; border-top: 1px solid var(--line); }
.res-item { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.res-main { flex: 1; min-width: 0; }
.res-main a { font-weight: 600; color: var(--ink); }
.res-main a:hover { color: var(--brand-700); }
.res-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.res-meta { text-align: end; line-height: 1.6; white-space: nowrap; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.pager a { min-width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink-2); }
.pager a.active { background: var(--brand-700); color: #fff; border-color: var(--brand-700); }

@media (max-width: 900px) {
  .burger { display: none; }
  .pv-body { grid-template-columns: 1fr; }
  .ml-head .search { max-width: none; flex: 1 1 100%; }
  .res-meta { display: none; }
}

/* ===== iteration 3: Moco-like catalogue cards and banner, achievements, search ===== */
.cat-cards { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.cat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px; min-height: 196px; color: var(--ink);
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.cat-card:hover { border-color: var(--brand-500); transform: translateY(-2px); text-decoration: none; }
.cc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.cc-pic { width: 80px; height: 80px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.cc-pic.flag { height: 56px; margin-top: 12px; }
.cc-pic.code { background: linear-gradient(135deg, var(--brand-700), var(--accent)); color: #fff; font-weight: 800; font-size: 24px; letter-spacing: .04em; }
.cc-count { min-width: 28px; height: 28px; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.cc-label { font-size: 15.5px; font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cc-sub { font-size: 12.5px; color: var(--ink-3); margin-top: -6px; }
.cat-banner { height: 280px; border-radius: var(--radius); background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 24px 70px; }
.cat-banner h2 { color: #fff; font-size: 34px; font-weight: 750; text-shadow: 0 2px 12px rgba(0,0,0,.45); letter-spacing: -.01em; }
.cat-cards.over-banner { margin-top: -80px; padding: 0 28px; position: relative; z-index: 2; }
.cat-cards.over-banner .cat-card { min-height: 160px; box-shadow: var(--shadow-lg); }

.ach-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.ach-bar .tabs { margin: 0; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.ach-card { background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 20px 20px 16px; min-height: 340px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.ach-img { width: 96px; height: 104px; margin-bottom: 14px; }
.ach-name { font-weight: 650; font-size: 15.5px; margin-bottom: 14px; }
.ach-status { font-size: 14px; }
.ach-foot { margin-top: auto; width: 100%; display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: 14px; padding-top: 16px; }

.search-form { display: flex; max-width: 760px; }
.search-form input { border-start-end-radius: 0; border-end-end-radius: 0; font-size: 15px; }
.search-form .btn { border-start-start-radius: 0; border-end-start-radius: 0; padding: 0 16px; }
.search-results { display: grid; gap: 10px; max-width: 960px; }
.sr-item { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; color: var(--ink); }
.sr-item:hover { border-color: var(--brand-500); text-decoration: none; }
.sr-main { flex: 1; min-width: 0; }
.sr-title { font-weight: 650; font-size: 15.5px; color: var(--brand-800); }
.sr-path { font-size: 12.5px; color: var(--good); margin: 2px 0 6px; }
.sr-snip { font-size: 14px; color: var(--ink-2); }
mark { background: #fff1b8; color: inherit; padding: 0 2px; border-radius: 3px; }

@media (max-width: 1280px) { .cat-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .cat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cat-cards.over-banner { padding: 0 12px; } .cat-banner { height: 220px; } }

/* ===== iteration 4: user profile as in Moco ===== */
.pr-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; background: #e7ebf0; color: var(--ink-2); font-weight: 500; }
.pr-head h1 { font-size: 30px; font-weight: 600; color: var(--ink-2); }
.pr-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.pr-box { padding: 20px 22px; margin-bottom: 20px; box-shadow: none; }
.pr-box h3 { font-size: 20px; font-weight: 500; color: var(--ink-2); margin-bottom: 12px; }
.pr-kv { margin-bottom: 14px; }
.pr-kv b { display: block; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.pr-sub { font-weight: 600; margin-bottom: 10px; }
.pr-link { display: block; padding: 3px 0; }
.pr-badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.pr-badge { text-align: center; font-size: 14px; }
.pr-badge img { width: 92px; height: 99px; display: block; margin: 0 auto 6px; }
.pr-gdpr { border-top: 1px dashed var(--line-strong); margin-top: 12px; padding-top: 12px; }
.pr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .pr-cols { grid-template-columns: 1fr; } }

/* ===== iteration 5: Moco user profile (org/profile) ===== */
.mp-head { overflow: hidden; margin-bottom: 18px; }
.mp-cover { height: 300px; background-size: cover; background-position: center; }
.mp-id { display: flex; gap: 22px; align-items: flex-end; padding: 0 24px 20px; margin-top: -84px; }
.mp-avatar { width: 160px; height: 160px; border-radius: 50%; background: var(--brand-600); color: #fff; font-size: 58px; display: inline-flex; align-items: center; justify-content: center;
  border: 6px solid var(--surface); box-shadow: var(--shadow); flex: none; }
.mp-name { padding-bottom: 6px; }
.mp-name h1 { font-size: 26px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mp-tabs { display: flex; justify-content: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.mp-tab { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 24px 10px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; }
.mp-tab:hover { color: var(--brand-700); text-decoration: none; }
.mp-tab.active { color: var(--brand-700); border-bottom-color: var(--brand-700); }
.mp-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }
.mp-card { margin-bottom: 16px; overflow: hidden; }
.mp-card-h { background: var(--surface-2); border-bottom: 1px solid var(--line); padding: 14px 20px; font-size: 19px; font-weight: 500; color: var(--ink-2); }
.mp-card-b { padding: 18px 20px; }
.mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.mp-grid.mp-sep { border-top: 1px dashed var(--line-strong); margin-top: 10px; padding-top: 16px; }
.mp-f { margin-bottom: 14px; }
.mp-l { font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.mp-v { font-size: 14px; color: var(--ink-3); }
.mp-card .tabs { margin-bottom: 14px; }
.req { color: var(--bad); }
@media (max-width: 900px) { .mp-cols, .mp-grid { grid-template-columns: 1fr; } .mp-id { flex-direction: column; align-items: flex-start; } .mp-avatar { width: 120px; height: 120px; font-size: 42px; } }
.mp-id { display: block; margin-top: 0; padding: 0 24px 20px; }
.mp-avatar { margin-top: -90px; position: relative; }
.mp-name { padding: 10px 0 0; }
@media (max-width: 900px) { .mp-avatar { margin-top: -60px; } }
.mp-cols { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.mp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.mp-v { overflow-wrap: anywhere; }
.mp-card .data { display: block; overflow-x: auto; }
@media (max-width: 900px) { .mp-cols, .mp-grid { grid-template-columns: minmax(0, 1fr); } .mp-tab { padding: 8px 12px 10px; } }

/* ===== iteration 6: dropdown arrows, login language buttons, login gradient ===== */
/* All dropdowns: own chevron with room from the edge (mirrored for Arabic) */
select { -webkit-appearance: none; appearance: none; cursor: pointer;
  background: var(--surface) 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='%235b6b7f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 16px;
  padding-inline-end: 40px; }
[dir="rtl"] select { background-position: left 14px center; }
select:hover { border-color: var(--brand-500); }
select::-ms-expand { display: none; }

/* Language buttons on the login page */
.lang-pills { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 1px 2px rgba(16,24,40,.05); }
.lang-pills .lp-ico { display: inline-flex; color: var(--ink-3); padding: 0 6px 0 8px; }
.lang-pills .lp { border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 500; padding: 6px 12px; border-radius: 999px; cursor: pointer; transition: background .15s, color .15s; }
.lang-pills .lp:hover { background: var(--brand-50); color: var(--brand-700); }
.lang-pills .lp.active { background: var(--brand-700); color: #fff; box-shadow: 0 2px 6px rgba(0,83,155,.25); }
.lang-pills .lp:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 1px; }
.auth-top { justify-content: center; }
@media (min-width: 1200px) { .auth-top { justify-content: flex-end; } }

/* Login brand panel: layered mesh gradient with contour lines and grain */
.auth-brand { position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(60% 50% at 0% 0%, rgba(0,163,224,.65) 0%, rgba(0,163,224,0) 70%),
    radial-gradient(55% 60% at 100% 15%, rgba(42,127,208,.75) 0%, rgba(42,127,208,0) 70%),
    radial-gradient(50% 45% at 85% 100%, rgba(0,178,169,.45) 0%, rgba(0,178,169,0) 70%),
    radial-gradient(45% 50% at 5% 95%, rgba(98,72,214,.45) 0%, rgba(98,72,214,0) 70%),
    conic-gradient(from 210deg at 65% 45%, #00264d, #003a70 25%, #0a4f94 45%, #003a70 70%, #00264d);
}
.auth-brand::before { content: ""; position: absolute; inset: -20%; z-index: -1; opacity: .16; pointer-events: none;
  background: repeating-radial-gradient(circle at 78% 30%, transparent 0 22px, rgba(255,255,255,.9) 23px 24px, transparent 25px 46px); 
  -webkit-mask-image: radial-gradient(60% 60% at 75% 30%, #000 0%, transparent 75%); mask-image: radial-gradient(60% 60% at 75% 30%, #000 0%, transparent 75%); }
.auth-brand::after { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .22; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.ab-glow { position: absolute; z-index: -1; border-radius: 50%; filter: blur(60px); pointer-events: none; }
.ab-glow.g1 { width: 380px; height: 380px; left: -80px; top: 35%; background: rgba(0,163,224,.45); }
.ab-glow.g2 { width: 320px; height: 320px; right: -60px; bottom: -40px; background: rgba(0,200,180,.35); }
.ab-glow.g3 { width: 260px; height: 260px; right: 18%; top: -80px; background: rgba(120,90,230,.35); }
@media (prefers-reduced-motion: no-preference) {
  .ab-glow.g1 { animation: abDrift 18s ease-in-out infinite alternate; }
  .ab-glow.g2 { animation: abDrift 22s ease-in-out infinite alternate-reverse; }
  .ab-glow.g3 { animation: abDrift 26s ease-in-out infinite alternate; }
  @keyframes abDrift { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, -30px) scale(1.12); } }
}
.auth-stats div { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
