/* Moldova Training LMS — design system */
:root {
  /* Moldova Store brand: navy from the logo, yellow from the store's buttons */
  --brand: #FACC15;
  --brand-600: #EAB308;
  --brand-50: #FEF9C3;
  --brand-ink: #111A6B;
  --logo-yellow: #FDE404;
  --logo-red: #BD0000;
  --navy: #111A6B;
  --navy-700: #1D2A8F;
  --navy-900: #0B1150;
  --navy-50: #EEF0FA;
  --blue: #29A7DE;
  /* Success stays green so "completed / passed" reads as success, not as a warning */
  --success: #16A34A;
  --success-600: #15803D;
  --success-50: #ECFDF3;
  --success-ink: #166534;
  --success-border: #BBF7D0;
  --amber: #f5a524;
  --red: #e5484d;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #141a2e;
  --text-2: #3d4560;
  --muted: #6b7390;
  --border: #e3e7f0;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 64, .06);
  --shadow: 0 1px 2px rgba(16, 24, 64, .05), 0 8px 24px rgba(16, 24, 64, .07);
  --shadow-lg: 0 20px 50px rgba(17, 26, 107, .16);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --topbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(1.6rem, 2.5vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.08rem; font-weight: 700; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
code { background: var(--navy-50); padding: .1em .35em; border-radius: 5px; font-size: .9em; }
.icon { width: 1.15em; height: 1.15em; flex-shrink: 0; vertical-align: -.2em; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 860px; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid rgba(17, 26, 107, .5); outline-offset: 2px; }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.show-md { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.2; cursor: pointer; text-decoration: none !important; transition: background .15s, box-shadow .15s, transform .05s, border-color .15s; white-space: nowrap; color: var(--text); background: var(--surface); border-color: var(--border); }
.btn:hover { border-color: #c9cfdd; background: #fafbfe; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); color: var(--brand-ink); }
.btn-navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-700); border-color: var(--navy-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(17, 26, 107, .06); border-color: transparent; }
.btn-danger { background: #fff; border-color: #f3c3c5; color: var(--red); }
.btn-danger:hover { background: #fff3f3; border-color: var(--red); }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--text-2); }
.help { font-size: .82rem; color: var(--muted); margin-top: 5px; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 4px rgba(250, 204, 21, .35); }
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7390' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--navy); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 38px; }
.pw-toggle { position: relative; }
.pw-toggle button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; }

/* ---------- Alerts, badges ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin: 16px 0; font-weight: 500; border: 1px solid; }
.alert-success { background: var(--success-50); border-color: var(--success-border); color: var(--success-ink); }
.alert-error { background: #fff1f1; border-color: #f7c6c8; color: #9b1c21; }
.alert-info { background: #eaf6fc; border-color: #bfe3f4; color: #0d5677; }
.alert-warning { background: #fff8eb; border-color: #f8dca8; color: #8a5300; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; letter-spacing: .01em; background: #eef0f5; color: var(--text-2); white-space: nowrap; }
.badge-success { background: var(--success-50); color: var(--success-600); }
.badge-info { background: #e5f4fb; color: #0d6b95; }
.badge-warning { background: #fff4de; color: #9a5d00; }
.badge-danger { background: #ffecec; color: #b42026; }
.badge-navy { background: var(--navy-50); color: var(--navy); }
.badge-ghost { background: transparent; color: var(--muted); border: 1px dashed var(--border); }
.count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-body { padding: 22px; }
.card-head { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-courses { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
.grid-split { grid-template-columns: minmax(0, var(--split, 1.3fr)) minmax(0, 1fr); align-items: start; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .icon { width: 42px; height: 42px; color: #c3c9da; margin-bottom: 8px; }

.stat { padding: 18px 20px; display: flex; gap: 14px; align-items: center; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy); }
.stat-icon.green { background: var(--success-50); color: var(--success-600); }
.stat-icon.blue { background: #e5f4fb; color: #0f7cad; }
.stat-icon.amber { background: #fff4de; color: #b06d00; }
.stat-value { font-size: 1.55rem; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .84rem; font-weight: 600; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: #e8ecf4; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-600), var(--brand)); border-radius: 99px; transition: width .4s; }
.progress.thin { height: 5px; }
.ring { display: block; }
.ring-bg { fill: none; stroke: #e8ecf4; stroke-width: 3.2; }
.ring-fg { fill: none; stroke: var(--brand); stroke-width: 3.2; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { font-size: 8.5px; font-weight: 800; fill: var(--text); }

/* ---------- Avatar & dropdown ---------- */
.avatar { --hue: 200; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: hsl(var(--hue) 70% 92%); color: hsl(var(--hue) 55% 30%); font-weight: 800; font-size: .85rem; flex-shrink: 0; }
.avatar.sm { width: 32px; height: 32px; font-size: .75rem; }
.avatar.lg { width: 84px; height: 84px; font-size: 1.7rem; }
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.dropdown-menu a, .dropdown-menu .linklike { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); font-weight: 500; text-decoration: none; }
.dropdown-menu a:hover, .dropdown-menu .linklike:hover { background: var(--bg); }
.dropdown-head { padding: 10px 12px 8px; display: grid; }
.dropdown-head small { color: var(--muted); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }
.locale-switch { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.locale-switch select { width: auto; border: 0; background-color: transparent; padding: 6px 28px 6px 2px; font-weight: 600; color: var(--text-2); }
.locale-switch.in-menu { padding: 4px 12px; }

/* ---------- Top bar & navigation ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.topbar-inner { height: var(--topbar-h); display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); text-decoration: none !important; flex-shrink: 0; }
.brand-logo { height: 30px; width: auto; display: block; }
.brand-sub { padding-left: 12px; border-left: 2px solid var(--brand); font-weight: 800; font-size: .95rem; letter-spacing: -.01em; line-height: 1.1; }
.brand.on-dark { color: #fff; }
.mainnav { display: flex; gap: 4px; }
.mainnav a { position: relative; display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; color: var(--text-2); font-weight: 600; text-decoration: none; }
.mainnav a:hover { background: var(--bg); }
.mainnav a.active { background: var(--navy-50); color: var(--navy); }
.mainnav .count { margin-left: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tabbar { display: none; }
.page { min-height: calc(100vh - var(--topbar-h) - 70px); padding-bottom: 48px; }
.footer { border-top: 1px solid var(--border); background: #fff; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; padding: 20px; color: var(--muted); font-size: .86rem; }

/* ---------- Landing ---------- */
.hero { position: relative; overflow: hidden; background: radial-gradient(1100px 500px at 85% -10%, rgba(88, 110, 240, .55), transparent 60%), radial-gradient(800px 500px at -10% 110%, rgba(61, 80, 200, .55), transparent 60%), var(--navy); color: #fff; }
.hero-inner { padding: 96px 20px 110px; display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -.03em; }
.hero p { font-size: 1.15rem; color: rgba(255, 255, 255, .82); max-width: 560px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .12); font-weight: 700; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 18px; }
.hero-card { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .16); border-radius: 22px; padding: 24px; backdrop-filter: blur(6px); }
.hero-card .row { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; background: rgba(255, 255, 255, .07); margin-bottom: 10px; }
.hero-card .row:last-child { margin-bottom: 0; }
.hero-card .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--brand); color: var(--navy); }
.hero-card small { color: rgba(255, 255, 255, .7); display: block; }
.features { padding: 64px 0; }
.feature { padding: 26px; }
.feature .stat-icon { margin-bottom: 14px; }

/* ---------- Dashboard ---------- */
.welcome { background: linear-gradient(120deg, var(--navy-900) 0%, var(--navy) 55%, #2A3AB0 100%); color: #fff; border-radius: 20px; padding: 30px; margin: 28px 0 24px; display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; position: relative; overflow: hidden; }
.welcome::after { content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(110, 130, 255, .55), transparent 70%); }
.welcome h1 { margin-bottom: 6px; }
.welcome p { color: rgba(255, 255, 255, .8); margin: 0; }
.welcome .btn { position: relative; z-index: 1; }
.continue-card { display: grid; grid-template-columns: 220px 1fr; overflow: hidden; }
.continue-card .cover { height: 100%; min-height: 160px; border-radius: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 36px 0 14px; }
.section-title h2 { margin: 0; }

/* ---------- Course cards ---------- */
.cover { position: relative; aspect-ratio: 16 / 8; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--navy) 0%, #2A3AB0 100%); }
.cover::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 82% 18%, rgba(110, 130, 255, .55), transparent 45%), repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 12px, transparent 12px 24px); }
.cover::after { content: ""; position: absolute; right: 14px; bottom: 12px; width: 44px; height: 44px; background: url("../img/favicon.svg") center / contain no-repeat; opacity: .95; }
.cover:has(img)::after { display: none; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lang-chip { position: absolute; left: 12px; top: 12px; background: rgba(255, 255, 255, .92); color: var(--navy); font-weight: 800; font-size: .72rem; padding: 4px 8px; border-radius: 7px; letter-spacing: .05em; }
.course-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.course-card .cover { border-radius: 0; }
.course-card .card-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-card h3 { margin: 0; }
.course-card h3 a { color: var(--text); }
.course-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: .84rem; font-weight: 500; }
.course-meta span { display: inline-flex; align-items: center; gap: 5px; }
.course-card .foot { margin-top: auto; display: flex; align-items: center; gap: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 20px 0; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text-2); font-weight: 600; font-size: .86rem; text-decoration: none !important; }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Course page ---------- */
.course-hero { background: #fff; border-bottom: 1px solid var(--border); }
.course-hero-inner { display: grid; grid-template-columns: 1fr 360px; gap: 36px; padding: 36px 20px; align-items: start; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 12px; display: flex; gap: 6px; align-items: center; }
.course-hero .lead { font-size: 1.05rem; color: var(--text-2); }
.course-side { position: sticky; top: calc(var(--topbar-h) + 16px); overflow: hidden; }
.course-side .cover { border-radius: 0; }
.curriculum { margin-top: 28px; }
.module { margin-bottom: 14px; overflow: hidden; }
.module-head { display: flex; align-items: center; gap: 14px; padding: 16px 20px; cursor: pointer; list-style: none; }
.module-head::-webkit-details-marker { display: none; }
.module-num { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--navy-50); color: var(--navy); font-weight: 800; flex-shrink: 0; }
.module.done .module-num { background: var(--success-50); color: var(--success-600); }
.module-head .chev { margin-left: auto; transition: transform .2s; color: var(--muted); }
.module[open] .chev { transform: rotate(180deg); }
.unit-list { list-style: none; margin: 0; padding: 0 12px 12px; }
.unit-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none !important; }
a.unit-row:hover { background: var(--bg); }
.unit-row .type { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: #f0f2f8; color: var(--text-2); flex-shrink: 0; }
.unit-row .meta { margin-left: auto; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.unit-row.locked { color: var(--muted); cursor: not-allowed; }
.unit-row.done .type { background: var(--success-50); color: var(--success-600); }
.state { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #d5dae6; display: grid; place-items: center; flex-shrink: 0; }
.state.done { background: var(--success); border-color: var(--success); color: #fff; }
.state.done .icon { width: 13px; height: 13px; stroke-width: 3.2; }
.state.locked { border: 0; color: #aab1c4; }

/* ---------- Player ---------- */
body.player { background: #fff; }
.player-shell { display: grid; grid-template-columns: 340px 1fr; min-height: calc(100vh - var(--topbar-h)); }
.player-side { border-right: 1px solid var(--border); background: #fbfcfe; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; }
.player-side-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fbfcfe; z-index: 1; }
.player-side-head a { font-size: .85rem; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
.player-side-head h2 { font-size: 1rem; margin: 10px 0; }
.player-side .sec-title { padding: 14px 18px 6px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.player-side .unit-row { margin: 0 8px; padding: 9px 10px; font-size: .9rem; }
.player-side .unit-row.current { background: var(--navy-50); color: var(--navy); font-weight: 700; }
.player-main { min-width: 0; display: flex; flex-direction: column; }
.player-content { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 32px 28px 40px; }
.unit-kicker { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.player-bar { position: sticky; bottom: 0; background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px); border-top: 1px solid var(--border); padding: 12px 24px; display: flex; align-items: center; gap: 16px; }
.player-bar .status { flex: 1; text-align: center; color: var(--muted); font-size: .88rem; font-weight: 600; }
.video-wrap { position: relative; aspect-ratio: 16 / 9; background: #0b1020; border-radius: 16px; overflow: hidden; box-shadow: var(--shadow); }
.video-wrap iframe, .video-wrap video, .video-wrap > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-progress { display: flex; align-items: center; gap: 12px; margin-top: 14px; font-size: .86rem; color: var(--muted); font-weight: 600; }
.video-progress .progress { flex: 1; }
.prose { font-size: 1.02rem; line-height: 1.7; color: var(--text-2); }
.prose h2, .prose h3 { color: var(--text); margin-top: 1.4em; }
.prose img { border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose blockquote { margin: 1em 0; padding: 12px 18px; border-left: 4px solid var(--brand); background: var(--brand-50); border-radius: 0 10px 10px 0; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; }
.locked-panel { text-align: center; padding: 60px 20px; }
.locked-panel .icon { width: 48px; height: 48px; color: #aab1c4; }

/* ---------- Quiz ---------- */
.quiz-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 24px; }
.question { padding: 22px; margin-bottom: 16px; }
.question-num { font-size: .78rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.question h3 { margin: 6px 0 14px; font-size: 1.05rem; white-space: pre-line; }
.option { display: flex; align-items: center; gap: 12px; padding: 13px 15px; border: 1.5px solid var(--border); border-radius: 12px; margin-bottom: 9px; cursor: pointer; font-weight: 500; transition: border-color .12s, background .12s; }
.option:hover { border-color: #c5ccdd; background: #fafbfe; }
.option input { width: 18px; height: 18px; accent-color: var(--navy); flex-shrink: 0; }
.option:has(input:checked) { border-color: var(--navy); background: var(--navy-50); }
.option.is-correct { border-color: var(--success); background: var(--success-50); }
.option.is-wrong { border-color: var(--red); background: #fff3f3; }
.option .tag { margin-left: auto; font-size: .76rem; font-weight: 700; }
.question.correct { border-left: 4px solid var(--success); }
.question.wrong { border-left: 4px solid var(--red); }
.explain { margin-top: 10px; padding: 10px 14px; background: #f5f7fb; border-radius: 10px; font-size: .9rem; color: var(--text-2); }
.result { text-align: center; padding: 32px 24px; margin-bottom: 24px; }
.result .ring { margin: 0 auto 12px; }
.result.pass { background: linear-gradient(180deg, var(--success-50), #fff); border-color: var(--success-border); }
.result.fail { background: linear-gradient(180deg, #fff4f4, #fff); border-color: #f7c6c8; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 12px 14px; border-bottom: 1px solid var(--border); background: #fafbfd; white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfe; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.user-cell strong { display: block; color: var(--text); }
.user-cell small { color: var(--muted); }
.pagination { display: flex; gap: 6px; justify-content: center; margin: 20px 0 6px; }
.pagination a, .pagination span { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); background: #fff; font-weight: 600; color: var(--text-2); text-decoration: none; padding: 0 8px; }
.pagination .current { background: var(--navy); color: #fff; border-color: var(--navy); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar input, .toolbar select { width: auto; min-width: 160px; padding: 8px 12px; }
.toolbar .grow input { width: 100%; }
.toolbar .grow { min-width: 220px; }

/* ---------- Matrix ---------- */
.matrix th.course-col { min-width: 130px; white-space: normal; text-transform: none; letter-spacing: 0; font-size: .8rem; color: var(--text-2); }
.cell { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.cell.completed { background: var(--success-50); color: var(--success-600); }
.cell.in_progress { background: #e5f4fb; color: #0d6b95; }
.cell.not_started { background: #f1f2f6; color: var(--muted); }
.cell.not_enrolled { color: #b5bbcb; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - var(--topbar-h) - 120px); min-height: 480px; margin-top: 24px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; }
.inbox-list a { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; align-items: center; }
.inbox-list a:hover { background: var(--bg); }
.inbox-list a.active { background: var(--navy-50); }
.inbox-list .preview { color: var(--muted); font-size: .84rem; }
.inbox-list .unread strong::after { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); margin-left: 6px; vertical-align: middle; }
.thread { display: flex; flex-direction: column; min-height: 0; }
.thread-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.thread-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; background: #fafbfd; }
.bubble { max-width: 72%; padding: 10px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--border); white-space: pre-wrap; word-wrap: break-word; }
.bubble.mine { margin-left: auto; background: var(--navy); color: #fff; border-color: var(--navy); border-bottom-right-radius: 4px; }
.bubble:not(.mine) { border-bottom-left-radius: 4px; }
.bubble time { display: block; font-size: .72rem; opacity: .65; margin-top: 4px; }
.thread-form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); }
.thread-form textarea { min-height: 46px; height: 46px; }
.notif { display: flex; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.notif.unread { background: #f6fbff; }
.notif .stat-icon { width: 38px; height: 38px; }

/* ---------- Profile ---------- */
.profile-head { display: flex; gap: 22px; align-items: center; margin: 28px 0; }
.achievement { display: flex; gap: 14px; align-items: center; padding: 16px; }
.achievement .medal { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, #ffd66b, #f5a524); color: #fff; flex-shrink: 0; }

/* ---------- Auth ---------- */
body.auth { background: #fff; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: radial-gradient(900px 400px at 100% 0%, rgba(88, 110, 240, .5), transparent 60%), radial-gradient(700px 500px at 0% 100%, rgba(61, 80, 200, .5), transparent 60%), var(--navy); color: #fff; display: flex; align-items: center; padding: 48px; }
.auth-side-inner { max-width: 460px; margin: 0 auto; }
.auth-side .brand { color: #fff; margin-bottom: 48px; }
.auth-side .brand-logo { height: 36px; }
.auth-side h1 { font-size: clamp(2rem, 3.5vw, 2.8rem); letter-spacing: -.03em; }
.auth-side p { color: rgba(255, 255, 255, .8); font-size: 1.05rem; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; font-weight: 600; }
.auth-points .icon { width: 38px; height: 38px; padding: 9px; border-radius: 11px; background: rgba(255, 255, 255, .12); color: var(--brand); }
.auth-main { display: flex; flex-direction: column; padding: 24px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.auth-top .locale-switch { margin-left: auto; }
.auth-mobile-brand { display: none; }
/* Sign-in form, matching the Moldova Store B2B login: centered heading, pill inputs with floating labels, pill button */
.auth-card { width: 100%; max-width: 400px; margin: auto; padding: 24px 0; }
.auth-card h2 { font-size: 1.75rem; font-weight: 800; text-align: center; letter-spacing: -.02em; margin-bottom: 10px; }
.auth-card .sub { color: var(--muted); margin: 0 0 30px; text-align: center; font-size: .98rem; line-height: 1.5; }
.auth-card .alert { border-radius: 14px; }
.auth-card input:not([type=checkbox]):not([type=radio]):not([type=hidden]) { height: 52px; padding: 0 18px; border-radius: 999px; border-color: #D1D5DB; font-size: 1rem; }
.auth-card input:focus { border-color: var(--navy); box-shadow: none; caret-color: var(--navy); }
.auth-card .btn-lg { height: 52px; border-radius: 999px; font-size: 1rem; font-weight: 700; }
.auth-form { display: grid; gap: 18px; }
.auth-form .btn { margin-top: 4px; }
.float-field { position: relative; display: block; margin: 0; }
.float-field input { width: 100%; }
.float-field .float-label { position: absolute; top: 50%; left: 18px; z-index: 1; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--muted); font-size: 1rem; line-height: 1.2; pointer-events: none; transform: translateY(-50%); transition: top .16s, font-size .16s, color .16s; }
.float-field input:focus + .float-label,
.float-field input:not(:placeholder-shown) + .float-label,
.float-field input:autofill + .float-label,
.float-field input:-webkit-autofill + .float-label { top: 0; font-size: .74rem; font-weight: 600; line-height: 1; color: var(--text); }
.float-field input:focus + .float-label { color: var(--navy); }
.float-field.has-toggle input { padding-right: 52px; }
.float-field .pw-btn { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.float-field .pw-btn:hover { background: var(--bg); color: var(--text); }
.float-field .pw-btn .icon { width: 18px; height: 18px; }
.float-field .pw-btn .i-eye-off, .float-field .pw-btn.is-visible .i-eye { display: none; }
.float-field .pw-btn.is-visible .i-eye-off { display: block; }
.auth-help { margin: 2px 0 0; padding: 0 18px; font-size: .82rem; color: var(--muted); }
.auth-links { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; color: var(--muted); font-size: .9rem; }
.auth-links a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.auth-links a:hover { color: var(--navy); }
.auth-note { margin-top: 18px; text-align: center; font-size: .86rem; color: var(--muted); }

/* ---------- Admin ---------- */
body.admin { background: var(--bg); }
.admin-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.admin-side { background: var(--navy); color: #c9d3f5; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-brand { padding: 20px 18px 16px; }
.admin-brand .brand { color: #fff; gap: 10px; }
.admin-brand .brand-logo { height: 26px; }
.admin-brand .brand-sub { font-size: .88rem; padding-left: 10px; }
.admin-role { display: inline-block; margin-top: 10px; padding: 3px 10px; border-radius: 999px; background: rgba(250, 204, 21, .16); color: #FDE68A; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.admin-side nav { display: grid; gap: 2px; padding: 8px 12px; }
.admin-side nav a, .admin-side-foot a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: #c9d3f5; font-weight: 600; font-size: .92rem; text-decoration: none; }
.admin-side nav a:hover, .admin-side-foot a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.admin-side nav a.active { background: rgba(250, 204, 21, .14); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.admin-side-foot { margin-top: auto; padding: 12px; border-top: 1px solid rgba(255, 255, 255, .08); }
.admin-main { min-width: 0; }
.admin-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: rgba(244, 246, 251, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.admin-top h1 { font-size: 1.35rem; margin: 0; flex: 1 1 auto; min-width: 0; }
.admin-actions { display: flex; gap: 10px; align-items: center; }
.admin-content { padding: 24px 28px 60px; max-width: 1400px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; font-size: .86rem; }
.kv dd { margin: 0; font-weight: 500; }
.builder-section { margin-bottom: 14px; }
.builder-section .card-head { background: #fafbfd; border-radius: var(--radius) var(--radius) 0 0; }
.builder-unit { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.builder-unit:last-child { border-bottom: 0; }
.builder-unit .type { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: #f0f2f8; color: var(--text-2); }
.order-btns { display: inline-flex; gap: 2px; }
.order-btns button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 3px; color: var(--muted); cursor: pointer; }
.order-btns button:hover { border-color: var(--border); background: #fff; color: var(--text); }
.inline-form { display: inline; }
.q-edit { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; background: #fff; }
.opt-edit { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.copy-box { display: flex; gap: 8px; }
.copy-box input { font-family: ui-monospace, Consolas, monospace; font-size: .82rem; }
.bar-chart { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 180px 1fr 60px; gap: 12px; align-items: center; font-size: .88rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .course-hero-inner { grid-template-columns: 1fr; }
  .course-side { position: static; order: -1; }
  .player-shell { grid-template-columns: 290px 1fr; }
}
@media (max-width: 900px) {
  .show-md { display: inline-flex !important; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .admin-side.open { transform: none; box-shadow: var(--shadow-lg); }
  .admin-top { padding: 12px 16px; }
  .admin-content { padding: 18px 16px 60px; }
  .hero-inner { grid-template-columns: 1fr; padding: 64px 20px 72px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-mobile-brand .brand-logo { height: 26px; }
  .auth-main { padding: 18px 16px; }
  .player-shell { grid-template-columns: 1fr; }
  .player-side { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: 86%; max-width: 340px; z-index: 45; transform: translateX(-100%); transition: transform .2s; height: auto; border-right: 0; }
  .player-side.open { transform: none; box-shadow: var(--shadow-lg); }
  /* Dim the page behind an open slide-out menu (tap it to close). */
  body.drawer-open::after { content: ''; position: fixed; inset: 0; background: rgba(10, 15, 45, .45); z-index: 44; }
  .inbox { grid-template-columns: 1fr; height: auto; }
  .inbox.has-thread .inbox-list { display: none; }
  .inbox:not(.has-thread) .thread { display: none; }
  .thread-body { min-height: 50vh; }
}
@media (max-width: 720px) {
  .auth-top .locale-switch .icon { display: none; }
  .auth-top .locale-switch select { padding-left: 0; }
  .auth-mobile-brand .brand { gap: 8px; }
  .auth-mobile-brand .brand-logo { height: 22px; }
  .auth-mobile-brand .brand-sub { padding-left: 8px; font-size: .85rem; }
  body.app { padding-bottom: 68px; }
  .mainnav, .hide-sm { display: none !important; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 40; background: #fff; border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; font-weight: 700; color: var(--muted); padding: 6px 0; text-decoration: none; }
  .tabbar a.active { color: var(--navy); }
  .tabbar .icon { width: 22px; height: 22px; }
  .tabbar .count { position: absolute; top: 0; left: 55%; }
  body.player .tabbar { display: none; }
  body.player { padding-bottom: 0; }
  .grid-2, .grid-3, .grid-4, .grid-split { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .grid-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome { grid-template-columns: 1fr; padding: 24px; }
  .continue-card { grid-template-columns: 1fr; }
  .continue-card .cover { min-height: 120px; }
  .player-content { padding: 20px 16px 32px; }
  .player-bar { padding: 10px 12px; }
  .player-bar .status { display: none; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .bubble { max-width: 88%; }
  .bar-row { grid-template-columns: 110px 1fr 46px; }
  .footer-inner { flex-direction: column; }

  /* Top bar */
  .topbar-inner { gap: 10px; }
  .brand { gap: 8px; }
  .brand-logo { height: 24px; }
  .brand-sub { padding-left: 8px; font-size: .84rem; }
  .topbar-right { gap: 6px; }
  .topbar .locale-switch .icon { display: none; }
  .topbar .locale-switch select { padding: 6px 20px 6px 0; background-position: right 2px center; font-size: .85rem; }
  .topbar .btn-sm { padding: 8px 12px; }
  .tabbar a { font-size: .74rem; }

  /* Bigger touch targets; 16px inputs stop iPhones zooming in on focus */
  input:not([type]), input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search], input[type=date], select, textarea { font-size: 16px; }
  .btn { padding: 11px 16px; }
  .btn-sm { padding: 9px 12px; font-size: .86rem; }
  .btn-icon { padding: 10px; }
  .order-btns { gap: 4px; }
  .order-btns button { padding: 8px; border-color: var(--border); background: #fff; }
  .check input { width: 20px; height: 20px; margin-top: 1px; }

  /* Cards and toolbars */
  .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; flex-wrap: wrap; }
  .toolbar { padding: 12px; gap: 8px; }
  .toolbar > * { flex: 1 1 140px; min-width: 0; }
  .toolbar .grow { flex-basis: 100%; min-width: 0; }
  .toolbar input, .toolbar select { min-width: 0; width: 100%; }
  .toolbar > .btn, .toolbar > a.btn, .toolbar > strong, .toolbar > span { flex: 0 0 auto; }

  /* Admin: title + account on the first row, page buttons on the second */
  .admin-top { flex-wrap: wrap; gap: 8px 10px; padding: 10px 12px; }
  .admin-top h1 { flex: 1 1 0; font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-actions { order: 3; flex: 1 1 100%; flex-wrap: wrap; gap: 8px; }
  .admin-actions .btn { flex: 1 1 auto; }
  .admin-content { padding: 14px 12px 60px; }
  .builder-unit { flex-wrap: wrap; padding: 10px 12px; }
  .builder-unit .grow { flex: 1 1 calc(100% - 50px); min-width: 0; }
  .builder-unit .order-btns, .builder-section .card-head .order-btns { margin-left: auto; }
  .builder-section .card-head form.grow { flex: 1 1 100%; min-width: 0; }
  .builder-section .card-head form.grow input { min-width: 0; }
  .bar-row { grid-template-columns: minmax(0, 1fr) 46px; gap: 4px 12px; }
  .bar-row > :first-child { grid-column: 1 / -1; }
  .q-edit { padding: 12px; }
  .opt-edit { grid-template-columns: auto minmax(0, 1fr) auto; }
  .copy-box { flex-wrap: wrap; }
  .copy-box input { flex: 1 1 100%; }

  /* Lists become cards: each cell shows its column name (labels added by app.js) */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody { display: block; width: 100%; }
  .table.responsive tr { display: flex; flex-wrap: wrap; align-items: center; column-gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .table.responsive tr:last-child { border-bottom: 0; }
  .table.responsive td { order: 3; flex: 1 1 100%; display: block; padding: 4px 0; border: 0; text-align: right; overflow: hidden; }
  .table.responsive td::before { content: attr(data-label); float: left; max-width: 48%; margin-right: 12px; text-align: left; font-size: .72rem; line-height: 1.9; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .table.responsive td[data-label=""] { text-align: left; }
  .table.responsive td[data-label=""]::before, .table.responsive td.td-primary::before { display: none; }
  .table.responsive td.td-lead { order: 0; flex: 0 0 auto; }
  .table.responsive td.td-primary { order: 1; flex: 1 1 0; min-width: 0; text-align: left; padding-bottom: 6px; }
  .table.responsive td.td-actions { order: 2; flex: 0 0 auto; text-align: right; }
  .table.responsive td.td-actions-row { order: 4; flex: 1 1 100%; text-align: right; margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--border); }
  .table.responsive td[colspan] { flex-basis: 100%; }
  .table.responsive td:empty { display: none; }
  .table.responsive tbody tr:hover td { background: transparent; }
  .table.responsive .user-cell { min-width: 0; }
  .table-wrap:has(> .table.responsive) { overflow: visible; }

  /* Matrix and gradebook stay grids: swipe sideways, names stay pinned on the left */
  .matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 1; background: #fff; box-shadow: 1px 0 0 var(--border); }
  .matrix th:first-child { background: #fafbfd; z-index: 2; }
  .matrix .user-cell { min-width: 130px; }
  .matrix .user-cell .avatar { display: none; }
}
@media (max-width: 400px) {
  .topbar.is-guest .brand-sub { display: none; }
  .grid-stats .stat { padding: 14px; gap: 10px; }
  .grid-stats .stat-icon { width: 38px; height: 38px; }
}
/* Never let a wide child stretch the page sideways */
.grid > *, .form-row > *, .card, .admin-content > *, .stack > * { min-width: 0; }
input, select, textarea { max-width: 100%; }
@media (pointer: coarse) {
  .order-btns button { padding: 8px; }
}
@media print {
  .topbar, .tabbar, .footer, .no-print { display: none !important; }
  body { background: #fff; }
}
