* { box-sizing: border-box; }
:root { --brand: #1f4e79; --bg: #f4f6f9; --card: #fff; --text: #1c2733; --muted: #64748b; --line: #e2e8f0; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.topnav { background: var(--brand); color: #fff; }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; flex-wrap: wrap; min-height: 54px; }
.brand { color: #fff; font-weight: 700; font-size: 18px; margin-right: 24px; display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 36px; width: auto; display: block; background: #fff; border-radius: 4px; padding: 2px; }
.brand-text span { font-weight: 300; opacity: .8; }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 18px; flex: 1; flex-wrap: wrap; }
.nav-links a { color: #e6eef7; font-size: 14px; padding: 6px 0; }
.nav-links a:hover { color: #fff; text-decoration: none; }
.nav-user { margin-left: auto; font-size: 13px; opacity: .85; }
.nav-toggle { display: none; background: none; border: none; color: #fff; font-size: 22px; margin-left: auto; cursor: pointer; }

.container { max-width: 1200px; margin: 24px auto; padding: 0 16px; }
h1 { font-size: 24px; margin: 0 0 16px; }
h2 { font-size: 18px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 16px 0 8px; }
.muted { color: var(--muted); font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat { text-align: center; padding: 20px 10px; }
.stat .num { font-size: 30px; font-weight: 700; color: var(--brand); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }

.btn { display: inline-block; background: var(--brand); color: #fff; border: none; border-radius: 7px; padding: 9px 16px; font-size: 14px; cursor: pointer; }
.btn:hover { opacity: .92; text-decoration: none; }
.btn-outline:hover { color: var(--brand); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-outline { background: #fff; color: var(--brand); border: 1px solid var(--brand); }
.btn-danger { background: var(--bad); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 14px; background: #fff; color: var(--text);
}
textarea { min-height: 70px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > div { flex: 1; min-width: 160px; }
form.inline { display: inline; }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.flash-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.flash-message, .flash-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: #ecfdf5; color: var(--ok); }
.badge-warn { background: #fffbeb; color: var(--warn); }
.badge-bad { background: #fef2f2; color: var(--bad); }
.badge-neutral { background: #f1f5f9; color: var(--muted); }
.badge-brand { background: #e8f0f9; color: var(--brand); }

.progressbar { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progressbar > div { height: 100%; background: var(--ok); border-radius: 999px; transition: width .3s; }
.progressbar.low > div { background: var(--warn); }

.course-card { display: flex; flex-direction: column; }
.course-card .grow { flex: 1; }
.thumb { width: 100%; border-radius: 8px; background: #0f172a; aspect-ratio: 16/9; object-fit: cover; }

video { width: 100%; max-height: 62vh; background: #000; border-radius: 10px; }
.pdf-frame { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 10px; }

.quiz-q { border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: #fff; }
.quiz-q .qtext { font-weight: 600; margin-bottom: 10px; }
.quiz-q label.opt { display: flex; align-items: center; gap: 9px; font-weight: 400; margin: 7px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.quiz-q label.opt:hover { background: #f8fafc; }
.result-correct { border-left: 4px solid var(--ok); }
.result-wrong { border-left: 4px solid var(--bad); }

.login-wrap { max-width: 400px; margin: 8vh auto; }
.login-wrap .brand-big { text-align: center; font-size: 26px; font-weight: 700; color: var(--brand); margin-bottom: 18px; }

.level-dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.level-dots i { width: 9px; height: 9px; border-radius: 50%; background: #e2e8f0; }
.level-dots i.on { background: var(--brand); }

.pagination { display: flex; gap: 8px; margin-top: 14px; }

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: flex-start; padding-bottom: 12px; }
  .nav-links.open { display: flex; }
  .nav-user { margin-left: 0; }
  th, td { font-size: 13px; padding: 7px 8px; }
}
