:root {
  --ink: #14262B; --ink-2: #33464B; --muted: #5E6E72; --line: #D5DCDA; --line-2: #E3E9E7;
  --bg: #F5F4EE; --surface: #FFFFFF; --surface-2: #FBFBF8; --soft: #E8EEEC;
  --brand: #0E3B43; --brand-2: #1F5A63; --accent: #E07A2F; --accent-ink: #B4561A; --accent-soft: #FBEFE4;
  --blue: #1380B0; --blue-soft: #DCEBF0; --ok: #2F6E4A; --ok-soft: #E3F1E8; --warn: #9A5B00; --warn-soft: #FBEBD2;
  --danger: #A23B2C; --danger-soft: #F8E1DC; --info: #1E5F7A; --info-soft: #DCEBF0;
  --radius: 12px; --shadow: 0 1px 2px rgba(14,59,67,.06), 0 4px 16px rgba(14,59,67,.06);
  --font: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); }
[dir="rtl"] { font-family: var(--font), 'Noto Naskh Arabic'; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--brand); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
textarea { resize: vertical; }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; } .mono { font-family: ui-monospace, Consolas, monospace; }
.ok-text { color: var(--ok); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Shell */
.shell { display: flex; min-height: 100vh; background: linear-gradient(to right, var(--brand) 248px, transparent 248px); }
.side { width: 248px; flex: none; background: var(--brand); color: #D8E6E3; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: #F5F4EE; font-weight: 700; font-size: 18px; padding: 4px 8px 20px; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: #9FC0BB; letter-spacing: .3px; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--ink); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 20px; flex: none; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; color: #BFD3D0; padding: 9px 12px; border-radius: 9px; font-weight: 500; }
.side nav a:hover { background: #164A53; text-decoration: none; color: #fff; }
.side nav a.active { background: var(--brand-2); color: #fff; font-weight: 600; }
.side nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.side-foot { margin-top: auto; border-top: 1px solid #24535B; padding: 14px 8px 0; }
.me b { display: block; color: #F5F4EE; } .me span { font-size: 12.5px; color: #9FC0BB; }
.signout { margin-top: 10px; background: none; border: 1px solid #3B6970; color: #D8E6E3; border-radius: 8px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.signout:hover { background: #164A53; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 12px 32px 0; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.lang button { border: 0; background: none; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--ink-2); font-family: var(--font), 'Noto Naskh Arabic'; }
.lang button.on { background: var(--brand); color: #fff; }
.demo-flag { font-size: 12.5px; color: var(--accent-ink); background: var(--accent-soft); padding: 4px 10px; border-radius: 20px; font-weight: 600; }

/* Page */
.page { padding: 12px 32px 48px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 4px 0 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--ink); }
.page-head .sub { margin: 6px 0 0; color: var(--muted); max-width: 820px; }
.back { display: inline-block; margin-bottom: 6px; font-size: 13.5px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font-size: 16px; font-weight: 700; color: var(--ink); }
.card-body { padding: 16px 18px; }
.card + .card { margin-top: 18px; }
.stack .card + .card { margin-top: 0; }
h3.mini { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 18px 0 10px; font-weight: 700; }
h3.mini:first-child { margin-top: 0; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 9px; padding: 8px 16px; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; white-space: nowrap; text-decoration: none !important; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #1E1206; }
.btn-primary:hover:not(:disabled) { background: #CF6B22; }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: #9DB3B0; }
.btn-secondary:hover:not(:disabled) { background: var(--soft); }
.btn-ghost { background: none; color: var(--info); padding-left: 6px; padding-right: 6px; }
.btn-ghost:hover:not(:disabled) { background: var(--soft); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: #E3B4AA; }
.btn-danger:hover:not(:disabled) { background: var(--danger-soft); }
.btn-sm { padding: 5px 11px; font-size: 13.5px; border-radius: 8px; }
.x { border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--muted); padding: 2px 6px; border-radius: 6px; }
.x:hover { background: var(--soft); color: var(--ink); }

/* Badges */
.badge { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; vertical-align: middle; }
.badge-neutral { background: var(--soft); color: var(--ink-2); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 6px; }
.field .label { margin-bottom: 0; }
.hint { font-size: 12.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 0 16px; }
.grid4 { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.grid2 .wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; align-items: center; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-weight: 500; }
.banner { background: var(--info-soft); color: var(--ink); border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; }
.banner-ok { background: var(--ok-soft); }
.banner-danger { background: var(--danger-soft); }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 160px; }
.filters input[type="search"] { min-width: 260px; }
.filters.bar { margin-bottom: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pills button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 5px 12px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink-2); }
.pills button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: start; font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #F4F8F7; }
.table tr.selected td { background: var(--blue-soft); }
.table.compact td, .table.compact th { padding: 7px 10px; }
.table input.narrow, input.narrow { width: 80px; text-align: end; }
.card .table th:first-child, .card .table td:first-child { padding-inline-start: 18px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 16px 0; color: var(--muted); }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.loading { padding: 40px; color: var(--muted); display: flex; gap: 10px; align-items: center; justify-content: center; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat.clickable { cursor: pointer; } .stat.clickable:hover { border-color: #9DB3B0; }
.stat-label { font-size: 13.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 30px; font-weight: 700; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-value.tone-warn { color: var(--accent-ink); } .stat-value.tone-ok { color: var(--ok); }
.stat-sub { font-size: 13px; color: var(--muted); }
.small-stats .stat-value { font-size: 24px; }

/* Dashboard */
.grid-dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; align-items: start; }
.grid-dash.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-dash > .card + .card { margin-top: 0; }
.barlist { position: relative; display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(70px, 150px) minmax(60px, 1fr) auto; gap: 12px; align-items: center; font-size: 14px; }
.bar-row.clickable { cursor: pointer; }
.bar-row.clickable:hover .bar-label { text-decoration: underline; }
.bar-label { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { position: relative; height: 18px; background: var(--soft); border-radius: 4px; }
.bar-fill { position: absolute; inset-inline-start: 0; top: 0; bottom: 0; background: var(--blue); border-radius: 4px; }
.bar-fill.below { background: var(--accent); }
.bar-target { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.bar-value { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13.5px; }
.bar-value.below { color: var(--accent-ink); font-weight: 600; }
.chart { position: relative; }
.linechart { width: 100%; height: auto; max-height: 320px; display: block; }
.linechart .grid { stroke: var(--line-2); }
.linechart .axis { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.linechart .crosshair { stroke: var(--muted); stroke-dasharray: 3 3; }
.legend, .split-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin-bottom: 8px; }
.legend i, .split-legend i, .tip .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.tip { position: absolute; transform: translate(12px, -110%); background: var(--ink); color: #fff; font-size: 13px; padding: 8px 10px; border-radius: 8px; pointer-events: none; white-space: nowrap; z-index: 5; box-shadow: var(--shadow); }
.splitbar { display: flex; height: 22px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface); }
.splitbar span { display: block; }
.split-legend { margin-top: 8px; }
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert a { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--ink); }
.alert a:hover { text-decoration: none; border-color: #9DB3B0; }
.alert-high a { background: #FDF3EC; border-color: #F0CDB3; }
.feed { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.feed li:last-child { border: 0; }

/* Split layout (list + panel) */
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(360px, 1fr); gap: 18px; align-items: start; }
.split > .card + .card { margin-top: 0; }
.review-panel { position: sticky; top: 16px; }
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 14px; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }
.quote { background: var(--surface-2); border-inline-start: 3px solid var(--accent); padding: 8px 12px; border-radius: 6px; margin: 8px 0; font-size: 14px; white-space: pre-wrap; }
.checks { list-style: none; padding: 0; margin: 0 0 12px; font-size: 14px; }
.checks li { padding: 4px 0; } .checks li.ok { color: var(--ok); } .checks li.no { color: var(--accent-ink); }
.review-form { border-top: 1px solid var(--line-2); margin-top: 14px; padding-top: 14px; }

/* Course builder */
.builder { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.builder > .card + .card { margin-top: 0; }
.outline { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.ol-item { display: flex; gap: 8px; align-items: center; width: 100%; text-align: start; border: 0; background: none; padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; color: var(--ink-2); }
.ol-item:hover { background: var(--soft); }
.ol-item.on { background: var(--blue-soft); color: var(--ink); font-weight: 600; }
.ol-item.mod { font-weight: 700; color: var(--ink); margin-top: 6px; }
.ol-item.sub { padding-inline-start: 22px; font-size: 13.5px; }
.ol-item.final { margin-top: 10px; border: 1px dashed #9DB3B0; font-weight: 600; color: var(--brand); }
.kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: 1px 6px; border-radius: 5px; flex: none; background: var(--soft); color: var(--ink-2); }
.kind-video { background: var(--blue-soft); color: var(--info); } .kind-pdf { background: #E6E3F3; color: #4B4380; }
.kind-image { background: var(--ok-soft); color: var(--ok); } .kind-quiz { background: var(--accent-soft); color: var(--accent-ink); } .kind-task { background: var(--warn-soft); color: var(--warn); }
.editor .card + .card { margin-top: 18px; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 10px; }
.facts { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); padding-top: 4px; }
.upload { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.preview { max-width: 100%; max-height: 300px; border-radius: 10px; margin-top: 8px; border: 1px solid var(--line); }
.qlist { padding-inline-start: 22px; margin: 0; }
.qlist > li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.qlist > li:last-child { border: 0; }
.qview ul { list-style: none; padding: 0; margin: 6px 0; font-size: 14px; }
.qview ul li { padding: 2px 0; color: var(--ink-2); }
.qview ul li.correct { color: var(--ok); font-weight: 600; }
.qtext { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qactions { display: flex; gap: 6px; margin-top: 6px; }
.qform { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin: 6px 0 12px; }
.opt-row { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.opt-row.correct input:not([type]) , .opt-row.correct input[type="text"] { border-color: var(--ok); }
.ok-label { color: var(--ok); font-weight: 700; font-size: 13px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }

/* Profile */
.enrol-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.enrol-progress { display: flex; gap: 10px; align-items: center; min-width: 220px; font-size: 13.5px; }
.enrol-progress .progress { flex: 1; }
.cert-row { padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.cert-row:last-child { border: 0; }
.progress { height: 8px; background: var(--soft); border-radius: 5px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; background: var(--blue); border-radius: 5px; }
.progress-fill.tone-ok { background: var(--ok); }

/* Trainings modal */
.pick-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pick-list button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 4px 10px; cursor: pointer; font: inherit; font-size: 13.5px; }
.pick-list button:hover { background: var(--soft); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { background: var(--blue-soft); color: var(--info); border-radius: 20px; padding: 3px 4px 3px 12px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--info); font-size: 16px; padding: 0 6px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(20,38,43,.45); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-head h2 { font-size: 18px; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line-2); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.2); max-width: 420px; font-weight: 500; border-inline-start: 4px solid #8DB9A6; }
.toast-err { border-inline-start-color: #E8806E; } .toast-warn { border-inline-start-color: var(--accent); }

/* Auth */
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-art { background: var(--brand); color: #D8E6E3; padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.auth-art h1 { font-family: var(--serif); font-size: 46px; color: #F5F4EE; font-weight: 600; max-width: 560px; }
.auth-art p { font-size: 17px; max-width: 540px; color: #BFD3D0; margin: 0; }
.brand.big { font-size: 22px; padding: 0 0 12px; }
.auth-points { margin: 6px 0 0; padding-inline-start: 20px; color: #F5F4EE; line-height: 1.9; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px 56px; gap: 26px; }
.auth-form { background: var(--surface); padding: 26px; border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; max-width: 520px; width: 100%; }
.auth-form h2 { font-family: var(--serif); font-size: 26px; margin-bottom: 10px; }
.auth-form .btn { margin-top: 6px; }
.auth-form.reg { max-width: 640px; }
.demo-accounts { max-width: 520px; }
.demo-accounts h3 { font-size: 15px; margin-bottom: 10px; }
.demo-acc { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: start; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 14px; margin-bottom: 7px; cursor: pointer; font: inherit; }
.demo-acc:hover { border-color: var(--accent); background: #FFFDF9; }
.demo-acc span { font-size: 13px; color: var(--muted); }

/* Learner */
.continue { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.continue:last-child { border: 0; }
.grow { flex: 1; min-width: 0; }
.reco { padding: 10px 0; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.reco:last-child { border: 0; }
.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.course-card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line-2); box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.cover { height: 120px; background: linear-gradient(135deg, #0E3B43, #1F5A63); display: flex; align-items: flex-end; padding: 14px 18px; }
.cover span { font-family: var(--serif); font-size: 34px; font-weight: 600; color: #F5F4EE; }
.cover-dsp { background: linear-gradient(135deg, #5B3A6B, #7E5491); } .cover-enc { background: linear-gradient(135deg, #1E5F7A, #2C7E8F); } .cover-kmc { background: linear-gradient(135deg, #7A3E14, #B4561A); }
.cc-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.cc-body h3 { font-size: 19px; } .cc-body p { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1; }
.cc-meta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; font-size: 13.5px; color: var(--muted); }
.cc-body .btn { align-self: flex-start; }

/* Player */
.player { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.player-nav { position: sticky; top: 16px; padding: 14px; max-height: calc(100vh - 32px); overflow: auto; }
.pn-progress { font-size: 13.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 10px; }
.pn-mtitle { font-weight: 700; font-size: 14px; margin: 12px 0 4px; color: var(--ink); }
.pn-step { display: flex; gap: 8px; align-items: flex-start; width: 100%; text-align: start; background: none; border: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--ink-2); }
.pn-step:hover { background: var(--soft); }
.pn-step.on { background: var(--blue-soft); color: var(--ink); font-weight: 600; }
.pn-step .tick { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid #9DB3B0; flex: none; display: grid; place-items: center; font-size: 11px; color: #fff; margin-top: 1px; }
.pn-step.done .tick { background: var(--ok); border-color: var(--ok); }
.pn-step.final { margin-top: 12px; border: 1px dashed #9DB3B0; font-weight: 600; }
.pn-certs { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.media { width: 100%; border-radius: 12px; margin-bottom: 14px; max-height: 440px; background: #000; }
.media.placeholder { aspect-ratio: 16/8; background: linear-gradient(135deg, #0E3B43, #1F5A63); color: #F5F4EE; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.media.placeholder svg { width: 64px; height: 64px; fill: #F5F4EE; background: rgba(255,255,255,.12); border-radius: 50%; padding: 12px; }
.media.placeholder small { font-weight: 400; color: #9FC0BB; }
.media.placeholder.light { background: var(--soft); color: var(--ink-2); aspect-ratio: 16/6; }
.media.placeholder.light small { color: var(--muted); }
.media.placeholder.slim { aspect-ratio: auto; padding: 18px; }
.lesson-text { font-size: 16.5px; line-height: 1.65; max-width: 760px; }
.player-pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.quiz { padding-inline-start: 22px; margin: 0; }
.quiz > li { margin-bottom: 18px; }
.quiz .q { font-weight: 600; font-size: 16px; margin: 0 0 8px; }
.opt { display: flex; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 7px; cursor: pointer; background: var(--surface); }
.opt:hover { background: var(--surface-2); }
.opt.chosen { border-color: var(--blue); background: #F1F7FA; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.wrong { border-color: var(--danger); background: var(--danger-soft); }
.opt span { flex: 1; }
.tag-ok { color: var(--ok); font-size: 13px; } .tag-no { color: var(--danger); font-size: 13px; }
.feedback { font-size: 14px; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; color: var(--ink-2); }
.result { display: flex; gap: 18px; align-items: center; border-radius: 12px; padding: 16px 18px; margin-bottom: 18px; }
.result.pass { background: var(--ok-soft); } .result.fail { background: var(--warn-soft); }
.result .score { font-family: var(--serif); font-size: 44px; font-weight: 600; color: var(--brand); }
.result .btn { margin-top: 8px; }
.submit-box { border-top: 1px solid var(--line-2); margin-top: 14px; padding-top: 14px; }

/* Certificate */
.verify-page { min-height: 100vh; padding: 24px; background: var(--bg); }
.verify-bar { max-width: 900px; margin: 0 auto 14px; display: flex; justify-content: space-between; align-items: center; }
.cert { max-width: 900px; margin: 0 auto; background: var(--surface); border-radius: 6px; padding: 48px 56px; text-align: center; border: 10px solid var(--brand); outline: 2px solid var(--accent); outline-offset: -22px; box-shadow: var(--shadow); }
.cert-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; text-align: start; }
.cert .brand { color: var(--brand); padding: 0; } .cert .brand small { color: var(--muted); }
.verified { background: var(--ok-soft); color: var(--ok); font-weight: 700; padding: 5px 12px; border-radius: 20px; font-size: 13.5px; }
.cert-kicker { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: var(--accent-ink); font-weight: 700; }
.cert h1 { font-family: var(--serif); font-size: 44px; color: var(--brand); margin: 10px 0 4px; }
.cert h2 { font-family: var(--serif); font-size: 30px; margin: 6px 0 20px; color: var(--ink); }
.cert p { margin: 6px 0; color: var(--ink-2); }
.cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; text-align: start; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.cert-foot dl { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.cert-foot dt { color: var(--muted); } .cert-foot dd { margin: 0; font-weight: 600; }
.qr { text-align: center; } .qr div { width: 140px; height: 140px; } .qr svg { width: 100%; height: 100%; }
.cert.invalid { border-color: var(--danger); }
@media print { .no-print { display: none !important; } .verify-page { padding: 0; background: #fff; } .cert { box-shadow: none; } }

@media (max-width: 1100px) {
  .grid-dash, .grid-dash.three, .split, .builder, .player { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; } .auth-art { padding: 32px; }
  .side { width: 210px; } .review-panel, .outline, .player-nav { position: static; max-height: none; }
}

/* Training calendar */
.month-nav { display: flex; align-items: center; gap: 8px; margin-inline-end: 8px; }
.month-nav b { min-width: 140px; text-align: center; font-size: 16px; }
.cal-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.cal-layout > .card + .card { margin-top: 0; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; color: var(--ink-2); align-items: center; }
.cal-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.cal-legend .clash-key { background: var(--danger-soft); border: 2px solid var(--danger); }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-wd { padding: 8px 10px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 118px; border-inline-end: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cal-day:nth-child(7n) { border-inline-end: 0; }
.cal-day.blank { background: var(--surface-2); }
.cal-day.past { background: #FAFBFA; }
.cal-day.past .cal-chip { opacity: .7; }
.cal-day.today .cal-date { background: var(--brand); color: #fff; }
.cal-date { font-size: 13px; font-weight: 700; color: var(--ink-2); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal-chip { display: block; width: 100%; text-align: start; border: 1px solid var(--line); border-inline-start: 4px solid var(--blue); background: var(--surface); border-radius: 6px; padding: 3px 6px; font: inherit; font-size: 12.5px; line-height: 1.3; cursor: pointer; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-chip small { display: block; color: var(--muted); font-size: 11.5px; }
.cal-chip:hover { background: var(--soft); }
.cal-chip.clash { background: var(--danger-soft); border-color: #E3B4AA; }
.clash-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--danger); margin-inline-end: 4px; }
.cal-more { font-size: 12px; color: var(--muted); padding-inline-start: 4px; }
.clash-panel { position: sticky; top: 16px; }
.clash-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.clash-list li { border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.clash-types { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.clash-t { display: flex; gap: 8px; padding: 5px 0; color: var(--ink); font-size: 14px; }
.clash-t:hover { text-decoration: none; background: var(--soft); border-radius: 6px; }
.clash-t i { width: 4px; border-radius: 2px; flex: none; }
.clash-warning { background: #FDF3EC; border: 1px solid #F0CDB3; border-radius: 10px; padding: 12px 14px; margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.clash-row { display: flex; flex-direction: column; gap: 3px; font-size: 14px; border-top: 1px solid #F0CDB3; padding-top: 8px; }
.clash-row > div:first-child { display: flex; gap: 6px; flex-wrap: wrap; }
.clash-ok { background: var(--ok-soft); color: var(--ok); border-radius: 10px; padding: 10px 14px; margin-top: 14px; font-weight: 500; }
.foot-note { margin-inline-end: auto; align-self: center; color: var(--accent-ink); }
@media (max-width: 1300px) { .cal-layout { grid-template-columns: minmax(0, 1fr); } .clash-panel { position: static; } }

/* Right-to-left: keep English sentences and numbers in their natural order, aligned right */
[dir="rtl"] :is(p, li, h1, h2, h3, td, th, dd, dt, .alert a > span, .split-legend span, .legend span, .stat-label, .stat-sub, .stat-value, .bar-label, .bar-value, .label, .hint, .cal-chip) { unicode-bidi: plaintext; text-align: right; }
[dir="rtl"] .table .num { text-align: left; }

/* Inline media viewer */
.viewer { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.viewer img { display: block; max-width: 100%; max-height: 520px; margin: 0 auto; background: var(--surface); }
.viewer video { display: block; width: 100%; max-height: 540px; background: #000; }
.viewer.compact img, .viewer.compact video { max-height: 300px; }
.viewer figcaption { display: flex; gap: 14px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 13.5px; background: var(--surface); flex-wrap: wrap; }
.viewer-name { color: var(--ink-2); font-weight: 600; margin-inline-end: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.viewer-fallback { padding: 28px; text-align: center; color: var(--ink-2); background: var(--surface); }

.pdfv-bar { display: flex; justify-content: space-between; align-items: center; padding: 6px 12px; background: #3C4043; color: #E8EAED; font-size: 13px; }
.pdfv-zoom { display: inline-flex; gap: 4px; }
.pdfv-zoom button { background: #5F6368; color: #fff; border: 0; border-radius: 6px; min-width: 32px; padding: 3px 8px; cursor: pointer; font: inherit; }
.pdfv-zoom button:hover { background: #80868B; }
.pdfv-pages { height: 72vh; min-height: 480px; overflow: auto; background: #525659; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pdfv-pages.compact { height: 420px; min-height: 0; }
.pdfv-page { background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); flex: none; }

/* ---------- top-bar icons: notifications and in-app training ---------- */
.top-icons { display: flex; gap: 6px; align-items: center; }
.pop-wrap { position: relative; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover, .icon-btn.on { background: var(--soft); border-color: var(--brand-2); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .count { position: absolute; top: -6px; inset-inline-end: -6px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }
.icon-btn .count.soft { background: var(--blue); }
.popover { position: absolute; top: calc(100% + 8px); inset-inline-end: 0; width: 400px; max-width: calc(100vw - 24px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(14,59,67,.18); z-index: 60; overflow: hidden; display: flex; flex-direction: column; max-height: min(620px, calc(100vh - 80px)); }
.pop-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.pop-body { overflow-y: auto; }
.pop-section { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 16px 4px; }
.pop-section.act { color: var(--danger); }
.pop-foot { border: 0; border-top: 1px solid var(--line-2); background: var(--surface-2); padding: 11px 16px; font: inherit; font-weight: 600; color: var(--brand-2); cursor: pointer; text-align: center; }
.pop-foot:hover { background: var(--soft); }
.pad { padding: 8px 16px 14px; }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-size: 13px; color: var(--brand-2); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.notes { list-style: none; margin: 0; padding: 0; }
.note { display: flex; align-items: flex-start; gap: 4px; border-bottom: 1px solid var(--line-2); position: relative; }
.note:last-child { border-bottom: 0; }
.note.unread { background: #F3F8F9; }
.note-main { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: flex-start; text-align: start; border: 0; background: none; font: inherit; color: inherit; padding: 11px 6px 11px 16px; cursor: pointer; }
.note-main:hover b { text-decoration: underline; }
.note-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.note-text b { font-size: 14px; }
.note.unread .note-text b { color: var(--ink); }
.note:not(.unread) .note-text b { font-weight: 600; color: var(--ink-2); }
.note-body { font-size: 13px; color: var(--ink-2); overflow-wrap: anywhere; }
.note-meta { font-size: 12px; color: var(--muted); }
.note-meta em { color: var(--danger); font-style: normal; font-weight: 600; }
.note-icon { flex: none; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--soft); color: var(--brand-2); }
.note-icon svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.note-icon.act, .note-clash .note-icon { background: var(--danger-soft); color: var(--danger); }
.note-icon.note-certificate, .note-icon.note-course_published { background: var(--ok-soft); color: var(--ok); }
.note-icon.note-course_returned { background: var(--warn-soft); color: var(--warn); }
.note-icon.act { background: var(--danger-soft); color: var(--danger); }
.note-dot { flex: none; width: 26px; height: 26px; margin: 12px 10px 0 0; border-radius: 50%; border: 0; background: none; cursor: pointer; position: relative; }
.note-dot::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; border: 2px solid var(--line); }
.note.unread .note-dot::after { background: var(--blue); border-color: var(--blue); }
.note-dot:hover { background: var(--soft); }
.notes-page .note { align-items: center; padding-inline-start: 16px; gap: 10px; }
.notes-page .note > input { flex: none; }
.notes-page .note-main { padding-inline-start: 4px; }
.notes-page .note > .btn { margin-inline-end: 14px; flex: none; }
.note-tags { display: flex; gap: 6px; flex: none; }
.bulk-bar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.bulk-bar .check { margin-inline-end: auto; font-size: 14px; }
.notes-page + .pager { padding: 12px 16px; }

/* in-app training menu and page */
.train-pop { width: 380px; }
.tut-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.tut-list li { border-bottom: 1px solid var(--line-2); }
.tut-list button { display: flex; gap: 12px; width: 100%; text-align: start; border: 0; background: none; font: inherit; color: inherit; padding: 12px 16px; cursor: pointer; }
.tut-list button:hover { background: var(--soft); }
.tut-state { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; }
.tut-state.done { background: var(--ok-soft); color: var(--ok); font-size: 15px; font-weight: 700; }
.tut-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin-bottom: 18px; }
.tut-card .card-body { display: flex; flex-direction: column; gap: 8px; height: 100%; }
.tut-card h3 { margin: 4px 0 0; font-size: 18px; }
.tut-card p { margin: 0; }
.tut-top { display: flex; justify-content: space-between; align-items: center; }
.tut-ico { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.tut-ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.tut-steps { margin: 4px 0; padding-inline-start: 20px; font-size: 13.5px; color: var(--ink-2); display: grid; gap: 2px; }
.tut-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 8px; }

/* guided tour: blurred shade with a hole around the target */
.tour { position: fixed; inset: 0; z-index: 1000; pointer-events: none; }
.tour-shade { position: fixed; background: rgba(12, 30, 35, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); pointer-events: auto; }
.tour-ring { position: fixed; border-radius: 10px; box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(224,122,47,.35); pointer-events: none; transition: top .12s, left .12s, width .12s, height .12s; }
.tour-ring.pulse { animation: tour-pulse 1.4s ease-in-out infinite; }
@keyframes tour-pulse { 0%, 100% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 7px rgba(224,122,47,.35); } 50% { box-shadow: 0 0 0 3px var(--accent), 0 0 0 14px rgba(224,122,47,.12); } }
@media (prefers-reduced-motion: reduce) { .tour-ring.pulse { animation: none; } .tour-ring { transition: none; } }
.tour-tip { position: fixed; width: 360px; max-width: calc(100vw - 24px); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 14px 16px 12px; box-shadow: 0 18px 50px rgba(0,0,0,.3); pointer-events: auto; font-size: 14.5px; }
.tour-tip.finish { width: 400px; text-align: center; }
.tour-tip h4 { margin: 6px 0 4px; font-size: 17px; font-family: var(--serif); }
.tour-text { line-height: 1.5; }
.tour-text b { color: var(--brand); }
.tour-count { font-size: 12px; color: var(--muted); font-weight: 600; }
.tour-bar { height: 4px; border-radius: 4px; background: var(--line-2); margin-top: 6px; overflow: hidden; }
.tour-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.tour-arrow { position: absolute; width: 14px; height: 14px; background: var(--surface); transform: rotate(45deg); }
.side-below .tour-arrow { top: -7px; margin-left: -7px; }
.side-above .tour-arrow { bottom: -7px; margin-left: -7px; }
.side-right .tour-arrow { left: -7px; margin-top: -7px; }
.side-left .tour-arrow { right: -7px; margin-top: -7px; }
.tour-suggest { display: flex; gap: 10px; align-items: center; justify-content: space-between; background: var(--accent-soft); border-radius: 9px; padding: 8px 10px; margin-top: 10px; font-size: 13.5px; }
.tour-suggest b { color: var(--accent-ink); }
.tour-hint { margin: 10px 0 0; font-size: 13px; color: var(--accent-ink); font-weight: 600; }
.tour-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.tour-tip.finish .tour-actions { justify-content: center; }
.tour-done { width: 54px; height: 54px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 10px auto 4px; }
.tour-done svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.toasts { z-index: 1100; }
@media (max-width: 700px) { .topbar { padding: 10px 12px 0; flex-wrap: wrap; } .demo-flag { display: none; } .popover { position: fixed; top: 60px; inset-inline: 12px; width: auto; } }
