:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #002b60;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #002b60;
  --accent-ink: #ffffff;
  --accent-soft: #e3ebf6;
  --warn: #475569;
  --warn-soft: #e2e8f0;
  --danger: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: .2em 0 .4em; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .8em; }
code { background: #eef0f4; padding: .1em .35em; border-radius: 5px; font-size: .92em; }
code.pw { font-size: 1.05em; letter-spacing: .03em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* layout */
.wrap { max-width: 880px; margin: 0 auto; padding: 28px 20px 80px; }
.wrap.wide { max-width: 1200px; }
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; text-decoration: none; color: var(--ink); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 800; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: .95rem; }
.topbar nav a:hover { background: var(--bg); color: var(--ink); }
.topbar nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.who { display: flex; align-items: center; gap: 14px; font-size: .92rem; }
.who a { color: var(--ink); text-decoration: none; font-weight: 500; }
.who form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.linkbtn:hover { color: var(--ink); text-decoration: underline; }

/* components */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card.narrow { max-width: 460px; }
.card.center { margin: 40px auto; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: inherit; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #c9ced6; background: #fafbfc; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #001d42; border-color: #001d42; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: .85rem; }
.btn.wide { width: 100%; }
.tag { display: inline-block; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #e9ecf1; color: var(--muted); margin-right: 4px; font-weight: 500; }
.tag.ok { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; background: var(--accent-soft); border: 1px solid #bcd0ea; }
.flash.error { background: #fdecea; border-color: #f4c7c3; color: #7d1a14; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }

/* forms */
label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 14px; }
input:not([type=checkbox]):not([type=file]), textarea, select {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; font: inherit; font-weight: 400;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=file] { display: block; margin-top: 6px; font: inherit; font-weight: 400; }
textarea { resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; line-height: 1.5; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check.inline { display: inline-flex; margin: 0 0 0 10px; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; font-size: .92rem; }
.row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 180px; }
.row.between { justify-content: space-between; align-items: center; }
.help pre { background: #eef0f4; padding: 12px; border-radius: 8px; margin: 8px 0 16px; white-space: pre-wrap; }
.help summary { cursor: pointer; color: var(--muted); margin-bottom: 14px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-page { background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 18px; }
.login-card h1 { font-size: 1.5rem; margin-bottom: 4px; }
.login-card form { margin-top: 20px; }

/* dashboard */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 24px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); margin-bottom: 24px; }
.hero p { margin: 0 0 16px; }
.ring {
  --p: 0; flex: none; width: 116px; height: 116px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, var(--card) 78%, transparent 79% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), #e2e6ec 0);
}
.ring span { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.ring small { color: var(--muted); font-size: .75rem; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.lesson-list a {
  display: flex; align-items: center; gap: 16px; padding: 16px 18px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s;
}
.lesson-list a:hover { border-color: var(--accent); transform: translateY(-1px); }
.lesson-list .num { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #e9ecf1; font-weight: 600; color: var(--muted); }
.lesson-list li.done .num { background: var(--accent); color: var(--accent-ink); }
.lesson-list .info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.lesson-list .info .muted { font-size: .9rem; }
.lesson-list .tags { flex: none; }

/* lesson page */
.lesson .lead { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; margin: 20px 0 28px; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.prose { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; font-size: 1.04rem; }
.prose h2, .prose h3, .prose h4 { margin: 1.3em 0 .5em; }
.prose > :first-child { margin-top: 0; }
.prose li { margin: .25em 0; }
.complete-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 24px 0; padding: 18px 22px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--warn);
}
.complete-bar.is-done { border-left-color: var(--accent); background: var(--accent-soft); }
.complete-bar .actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.complete-bar form { margin: 0; }
.pager { display: flex; justify-content: space-between; gap: 16px; font-size: .92rem; }
.pager a { color: var(--muted); text-decoration: none; }
.pager a:hover { color: var(--accent); }

/* tables */
table { width: 100%; border-collapse: collapse; background: var(--card); }
table.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: visible; box-shadow: var(--shadow); }
table.list th, table.list td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #f8f9fb; }
tr.inactive td { opacity: .55; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions form { display: inline; }
.row-actions details { display: inline-block; position: relative; text-align: left; }
.row-actions summary { list-style: none; }
.row-actions summary::-webkit-details-marker { display: none; }
.row-actions .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; width: 260px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.12); display: grid; gap: 10px; }
.row-actions .menu form { display: grid; gap: 6px; }
.row-actions .menu input { margin: 0; padding: 7px 10px; font-size: .88rem; }
.order { white-space: nowrap; }
.order form { display: inline; }
.icon { border: 1px solid var(--line); background: var(--card); border-radius: 6px; cursor: pointer; font-size: .7rem; padding: 3px 6px; color: var(--muted); }
.icon:disabled { opacity: .3; cursor: default; }
.order span { display: inline-block; width: 22px; text-align: center; font-weight: 600; }

.created { border-color: #bcd0ea; background: var(--accent-soft); }
.cred { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.cred div { display: flex; flex-direction: column; gap: 4px; }
.cred code { font-size: 1.1rem; background: #fff; padding: 6px 10px; }

/* progress grid */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); background: var(--card); }
table.grid th, table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.grid thead th { font-size: .8rem; color: var(--muted); font-weight: 600; vertical-align: bottom; background: #f8f9fb; }
table.grid th.rot { height: 150px; padding: 8px 4px; width: 40px; }
table.grid th.rot span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 140px; overflow: hidden; text-overflow: ellipsis; }
table.grid td.cell { text-align: center; width: 40px; color: var(--accent); font-weight: 700; border-left: 1px solid #eceff4; }
table.grid td.cell.yes { background: var(--accent-soft); }
.sticky { position: sticky; left: 0; background: var(--card); z-index: 1; }
thead .sticky { background: #f8f9fb; }
.overall { min-width: 140px; width: 180px; }
table.grid td:last-child, table.grid th:last-child { width: 100%; }
.bar { height: 8px; background: #e9ecf1; border-radius: 99px; overflow: hidden; margin-bottom: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar nav { order: 3; width: 100%; }
  .who { margin-left: auto; }
  .hero { flex-direction: column-reverse; align-items: flex-start; }
  .lesson-list .tags { display: none; }
  table.list thead { display: none; }
  table.list tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.list td { display: block; border: 0; padding: 4px 14px; }
  .row-actions { text-align: left; }
  .prose { padding: 18px; }
}

/* login: company logo instead of the "!" mark */
.login-logo { display: block; width: 190px; max-width: 70%; height: auto; margin: 0 auto 8px; }
.login-brand { justify-content: center; margin-bottom: 14px; font-weight: 600; color: var(--muted); font-size: .95rem; }

/* elements with the hidden attribute must stay hidden even if a class sets display */
[hidden] { display: none !important; }

/* search and page links (users list) */
.att-search { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.att-search input { flex: 1; min-width: 200px; max-width: 420px; }
.att-search .btn { padding: 9px 16px; }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; flex-wrap: wrap; margin: 18px 0; color: var(--muted); font-size: .88rem; }
.pager .btn { padding: 8px 16px; }

/* language selector */
.langsel { position: absolute; top: 8px; left: 12px; z-index: 30; font-size: .82rem; }
.langsel summary { list-style: none; cursor: pointer; color: var(--muted); padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; background: #fff; user-select: none; }
.langsel summary::-webkit-details-marker { display: none; }
.langsel summary:hover { color: var(--ink); border-color: #c9ced6; }
.langmenu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 130px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 43, 96, .14); padding: 6px; display: grid; }
.langmenu a { color: var(--ink); text-decoration: none; padding: 8px 12px; border-radius: 8px; }
.langmenu a:hover { background: #f4f5f7; }
.langmenu a.on { font-weight: 700; background: #eef2f8; }

.topbar .langsel { position: static; }
.topbar .langmenu { left: auto; right: 0; }
