:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #17202e;
  --muted: #5d6b7e;
  --line: #d9dfe8;
  --brand: #0b3d91;
  --brand-2: #1c64d1;
  --ok: #1b7f4b;
  --warn: #b26a00;
  --bad: #b3261e;
  --soft: #eaf1fc;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--brand-2); }
.top {
  background: var(--brand);
  color: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; flex-direction: column; }
.brand span { font-size: 12.5px; opacity: .85; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav a {
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
}
nav a.on, nav a:hover { background: rgba(255, 255, 255, .18); }
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px 16px 24px; }
h1 { font-size: 21px; margin: 4px 0 12px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 14px 0 6px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grow { flex: 1 1 240px; }
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
th { background: #eef2f8; font-weight: 600; white-space: nowrap; }
td.c, th.c { text-align: center; }
tr.now td { background: #fff8e1; }
tr.done td:first-child { box-shadow: inset 4px 0 0 var(--ok); }
button, .btn {
  font: inherit;
  border: 1px solid var(--brand-2);
  background: var(--brand-2);
  color: #fff;
  border-radius: 7px;
  padding: 7px 13px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.ghost, .btn.ghost { background: #fff; color: var(--brand-2); }
button.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=url], input[type=number], select, textarea {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  background: #fff;
  color: var(--ink);
}
textarea { min-height: 62px; resize: vertical; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 3px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px 14px; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 9px; font-size: 12.5px; background: var(--soft); color: var(--brand); white-space: nowrap; }
.pill.ok { background: #e3f4ea; color: var(--ok); }
.pill.warn { background: #fff1d6; color: var(--warn); }
.pill.bad { background: #fde8e6; color: var(--bad); }

/* Thanh diem va dong ho */
.bar {
  position: sticky;
  top: 52px;
  z-index: 15;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .06);
}
.bar .row { justify-content: space-between; }
.timer { font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 700; min-width: 96px; }
.timer.late { color: var(--warn); }
.timer.over { color: var(--bad); }
.phase { flex: 1 1 320px; }
.phase b { display: block; }
.say { background: var(--soft); border-left: 4px solid var(--brand-2); border-radius: 6px; padding: 7px 10px; margin-top: 6px; }
.scores { display: flex; gap: 6px; flex-wrap: wrap; }
.sc { border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; text-align: center; min-width: 58px; }
.sc small { display: block; font-size: 11.5px; color: var(--muted); }
.sc b { font-size: 18px; }
.sc.total { background: var(--brand); color: #fff; border-color: var(--brand); }
.sc.total small { color: #dbe6fb; }

.crit { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.crit:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.crit-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.crit-head .desc { color: var(--muted); font-size: 13px; }
.ind { display: flex; gap: 9px; align-items: flex-start; padding: 6px 8px; border-radius: 7px; cursor: pointer; }
.ind:hover { background: #f3f6fb; }
.ind input { margin-top: 4px; width: 17px; height: 17px; flex: 0 0 auto; }
.ind.on { background: #e8f5ee; }
.pick { display: flex; gap: 4px; align-items: center; }
.pick button { padding: 3px 10px; background: #fff; color: var(--ink); border-color: var(--line); }
.pick button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pick .auto { font-size: 12.5px; color: var(--muted); margin-right: 4px; }
.q { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.q:last-child { border-bottom: 0; }
.q .listen { color: var(--muted); font-size: 13px; }
details > summary { cursor: pointer; font-weight: 600; }
.check { display: flex; gap: 8px; align-items: flex-start; padding: 3px 0; }
.check input { margin-top: 4px; }
.note { background: #fff8e1; border: 1px solid #f1dfa6; border-radius: 8px; padding: 8px 11px; margin-bottom: 10px; }
.guide h2 { margin-top: 6px; }
.guide li { margin-bottom: 3px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #17202e; color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; font-size: 14px; }

@media (max-width: 640px) {
  .bar { top: 96px; }
  .timer { font-size: 24px; }
}
@media print {
  .top, .foot, .noprint, nav { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; }
  th, td { font-size: 11.5px; padding: 4px 6px; }
}

.ind b, .check b { font-weight: 600; }
small.d { display: block; color: var(--muted); font-size: 13px; font-weight: 400; margin-top: 1px; }
.check input { width: 17px; height: 17px; flex: 0 0 auto; }
.qa { display: flex; gap: 6px; margin-top: 5px; }
.qa button { padding: 3px 10px; font-size: 13px; }

table.sign { margin-top: 18px; border: 0; }
table.sign td { border: 0; width: 50%; text-align: center; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  .sheet h1 { font-size: 16px; }
}
.sheet table { font-size: 12.5px; }
.sheet th { white-space: normal; padding: 5px 4px; }
.sheet td { padding: 5px 6px; }
.sheet td:nth-child(11) { min-width: 250px; }

.upnext { border-left: 5px solid var(--brand-2); }
@keyframes flashbar { 0% { background: #ffe9a8; } 100% { background: var(--card); } }
.bar.flash { animation: flashbar 1.6s ease-out 1; }
