:root {
  --ap-navy: #0b2545;
  --ap-blue: #1d6fb8;
  --ap-blue-dark: #155a96;
  --ap-teal: #2a9d8f;
  --ap-bg: #f4f6f9;
  --ap-card: #ffffff;
  --ap-text: #1a2433;
  --ap-muted: #5b6776;
  --ap-border: #e1e6ed;
  --ap-green: #2e7d32;
  --ap-green-bg: #e6f4ea;
  --ap-red: #c62828;
  --ap-red-bg: #fdecea;
  --ap-amber: #b8860b;
  --ap-amber-bg: #fff4d6;
  --ap-shadow: 0 1px 3px rgba(11,37,69,.08), 0 8px 24px rgba(11,37,69,.06);
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--ap-bg);
  color: var(--ap-text);
  line-height: 1.55;
}

.topbar {
  background: var(--ap-navy);
  color: #fff;
  padding: 14px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.topbar .logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--ap-blue), var(--ap-teal));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: #fff;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .sub { font-size: 12px; opacity: .8; margin-top: 1px; }
.topbar .spacer { flex: 1; }
.topbar a { color: #cfe2f5; font-size: 13px; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

.wrap { max-width: 820px; margin: 28px auto; padding: 0 18px; }
.wrap.wide { max-width: 1180px; }

.card {
  background: var(--ap-card);
  border: 1px solid var(--ap-border);
  border-radius: var(--radius);
  box-shadow: var(--ap-shadow);
  padding: 28px 30px;
  margin-bottom: 20px;
}

h2 { font-size: 22px; margin: 0 0 6px; color: var(--ap-navy); }
h3 { font-size: 17px; margin: 22px 0 8px; color: var(--ap-navy); }
p { margin: 10px 0; }
.muted { color: var(--ap-muted); font-size: 14px; }
.lede { font-size: 16px; color: var(--ap-muted); margin-top: 2px; }

.pill {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px; background: #eef3f9; color: var(--ap-blue-dark);
}

label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 5px; }
input[type=text], input[type=email], select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--ap-border);
  border-radius: 9px; font-size: 15px; background: #fff; color: var(--ap-text);
}
input:focus, select:focus { outline: 2px solid var(--ap-blue); border-color: var(--ap-blue); }

.btn {
  appearance: none; border: none; cursor: pointer;
  background: var(--ap-blue); color: #fff; font-size: 15px; font-weight: 600;
  padding: 12px 22px; border-radius: 9px; transition: background .15s;
}
.btn:hover { background: var(--ap-blue-dark); }
.btn:disabled { background: #b8c4d2; cursor: not-allowed; }
.btn.secondary { background: #eef3f9; color: var(--ap-blue-dark); }
.btn.secondary:hover { background: #e0eaf5; }
.btn.ghost { background: transparent; color: var(--ap-blue-dark); border: 1px solid var(--ap-border); }
.btn.small { padding: 7px 13px; font-size: 13px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* progress */
.progress { height: 8px; background: #e9eef4; border-radius: 999px; overflow: hidden; margin: 4px 0 18px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--ap-blue), var(--ap-teal)); width: 0; transition: width .3s; }

/* module callouts */
.callout { border-left: 4px solid var(--ap-blue); background: #f3f8fc; padding: 12px 16px; border-radius: 0 9px 9px 0; margin: 14px 0; font-size: 14.5px; }
.callout.warn { border-color: var(--ap-amber); background: var(--ap-amber-bg); }
.callout.bad { border-color: var(--ap-red); background: var(--ap-red-bg); }
.callout.good { border-color: var(--ap-green); background: var(--ap-green-bg); }
.callout b { color: var(--ap-navy); }

.do-dont { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0; }
.do-dont .col { border: 1px solid var(--ap-border); border-radius: 10px; padding: 14px 16px; }
.do-dont .col h4 { margin: 0 0 8px; font-size: 14px; }
.do-dont .do h4 { color: var(--ap-green); }
.do-dont .dont h4 { color: var(--ap-red); }
.do-dont ul { margin: 0; padding-left: 18px; font-size: 14px; }
.do-dont li { margin: 5px 0; }
@media (max-width: 640px){ .do-dont { grid-template-columns: 1fr; } }

/* quiz */
.q { border: 1px solid var(--ap-border); border-radius: 10px; padding: 16px 18px; margin: 14px 0; }
.q .qtext { font-weight: 600; margin-bottom: 10px; }
.q .opt { display: block; padding: 10px 12px; border: 1px solid var(--ap-border); border-radius: 8px; margin: 7px 0; cursor: pointer; font-size: 14.5px; }
.q .opt:hover { border-color: var(--ap-blue); background: #f7fafd; }
.q .opt input { margin-right: 9px; }
.q .opt.correct { border-color: var(--ap-green); background: var(--ap-green-bg); }
.q .opt.wrong { border-color: var(--ap-red); background: var(--ap-red-bg); }
.q .explain { font-size: 13.5px; color: var(--ap-muted); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--ap-border); display: none; }
.q.answered .explain { display: block; }

.hidden { display: none !important; }
.center { text-align: center; }

.result-badge { font-size: 48px; line-height: 1; }
.score-big { font-size: 40px; font-weight: 800; color: var(--ap-navy); }

/* table */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ap-border); }
th { background: #f7f9fc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ap-muted); cursor: pointer; user-select: none; }
tr:hover td { background: #fafcfe; }
.status-tag { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.status-complete { background: var(--ap-green-bg); color: var(--ap-green); }
.status-incomplete { background: var(--ap-red-bg); color: var(--ap-red); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--ap-card); border: 1px solid var(--ap-border); border-radius: 10px; padding: 16px; }
.stat .n { font-size: 30px; font-weight: 800; color: var(--ap-navy); }
.stat .l { font-size: 12.5px; color: var(--ap-muted); text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 720px){ .stat-grid { grid-template-columns: repeat(2,1fr); } }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select { width: auto; flex: 0 0 auto; }
.toolbar .search { flex: 1 1 220px; }
.footnote { font-size: 12px; color: var(--ap-muted); margin-top: 8px; }
code { background: #eef2f7; padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ---- platform additions ---- */
.topbar nav { display: flex; gap: 16px; }
.topbar nav a { color: #cfe2f5; font-weight: 500; }
.topbar nav a.active { color: #fff; border-bottom: 2px solid var(--ap-teal); padding-bottom: 2px; }
.userchip { font-size: 12.5px; opacity: .9; display: flex; align-items: center; gap: 8px; }
.userchip .role { background: rgba(255,255,255,.15); padding: 2px 8px; border-radius: 999px; font-size: 11px; }

.login-card { max-width: 420px; margin: 8vh auto; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ap-muted); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--ap-border); }
.btn.block { width: 100%; justify-content: center; display: flex; }
.btn.entra { background: #2f2f6f; }
.btn.entra:hover { background: #25255a; }

.course-card { border: 1px solid var(--ap-border); border-radius: 10px; padding: 16px 18px; margin: 12px 0; display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.course-card .meta { font-size: 13px; color: var(--ap-muted); margin-top: 3px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.tag.done { background: var(--ap-green-bg); color: var(--ap-green); }
.tag.todo { background: var(--ap-amber-bg); color: var(--ap-amber); }
.tag.recert { background: var(--ap-red-bg); color: var(--ap-red); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--ap-border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 10px 16px; font-size: 14px; font-weight: 600; color: var(--ap-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--ap-blue-dark); border-bottom-color: var(--ap-blue); }
.tabpane { display: none; }
.tabpane.active { display: block; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field-row > div { flex: 1 1 180px; }
.banner { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin: 10px 0; }
.banner.ok { background: var(--ap-green-bg); color: var(--ap-green); }
.banner.err { background: var(--ap-red-bg); color: var(--ap-red); }
