:root {
  color-scheme: light;
  --navy: #123c7a;
  --navy-deep: #0b2a58;
  --navy-soft: #e3ebf7;
  --red: #c8102e;
  --bg: #f2f5f9;
  --surface: #ffffff;
  --ink: #16213a;
  --ink-2: #4a5872;
  --ink-3: #7d889c;
  --line: #d7dee8;
  --ok: #1e7a4c;
  --ok-soft: #e2f3ea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(18, 60, 122, .06), 0 10px 30px rgba(18, 60, 122, .08);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
a { color: var(--navy); }
.muted { color: var(--ink-3); font-size: .9rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

/* ---- Masthead ---- */
.masthead { background: linear-gradient(135deg, var(--navy-deep), var(--navy) 60%, #1c57a8); color: #fff; padding-top: env(safe-area-inset-top, 0px); }
.masthead-inner { max-width: 880px; margin: 0 auto; padding: 22px 16px; display: flex; align-items: center; gap: 16px; }
.masthead img { width: 68px; height: 68px; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.masthead .org { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.masthead .org small { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; opacity: .85; font-weight: 600; }
.masthead .org strong { font-size: 1.05rem; font-weight: 700; }
.masthead .org span { font-size: .85rem; opacity: .85; }
.band { height: 5px; background: linear-gradient(90deg, var(--red) 0 33%, #f4c20d 33% 66%, var(--navy) 66%); }

/* ---- Page ---- */
.page { max-width: 880px; margin: 0 auto; padding: 28px 16px 56px; display: flex; flex-direction: column; gap: 18px; }
.hero { display: flex; flex-direction: column; gap: 10px; }
.hero h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 700; color: var(--navy-deep); }
.hero p { color: var(--ink-2); max-width: 68ch; }
.hero .meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-3); }
.hero .meta span::before { content: "•"; margin-right: 6px; color: var(--red); }
.hero .meta span:first-child::before { content: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 600px) { .section { padding: 18px 16px; } }
.section-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.section-no { width: 32px; height: 32px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.section-head h2 { font-size: 1.1rem; color: var(--navy-deep); }
.section-head p { font-size: .85rem; color: var(--ink-3); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } .span-2 { grid-column: span 1; } }
.field { display: flex; flex-direction: column; gap: 6px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; }
.field > span, .q { font-weight: 600; font-size: .92rem; color: var(--ink); }
.q small { display: block; font-weight: 400; color: var(--ink-3); font-size: .82rem; margin-top: 2px; }
.req { color: var(--red); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px var(--navy-soft); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #a3adbf; }

/* ---- Thang điểm ---- */
.scale { display: flex; gap: 8px; flex-wrap: wrap; }
.scale label { flex: 1 1 0; min-width: 56px; position: relative; display: flex; }
.scale input { position: absolute; opacity: 0; width: 0; height: 0; }
.scale span { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 6px; cursor: pointer; font-weight: 700; font-size: 1.05rem; color: var(--ink-2); background: #fff; transition: background .12s, border-color .12s; }
.scale span small { font-size: .7rem; font-weight: 500; color: var(--ink-3); text-align: center; line-height: 1.2; }
.scale input:checked + span { background: var(--navy); border-color: var(--navy); color: #fff; }
.scale input:checked + span small { color: rgba(255,255,255,.85); }
.scale input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }

/* ---- Lựa chọn ---- */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices label { position: relative; }
.choices input { position: absolute; opacity: 0; width: 0; height: 0; }
.choices span { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: .92rem; background: #fff; color: var(--ink); }
.choices span::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.choices.multi span::before { border-radius: 4px; }
.choices input:checked + span { border-color: var(--navy); background: var(--navy-soft); color: var(--navy-deep); font-weight: 600; }
.choices input:checked + span::before { background: var(--navy); border-color: var(--navy); box-shadow: inset 0 0 0 3px #fff; }
.choices.multi input:checked + span::before { box-shadow: none; background: var(--navy) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-6' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat; }
.choices input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }
.choices.stack { flex-direction: column; }
.choices.stack span { border-radius: 8px; width: 100%; }

/* ---- Nút ---- */
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn { font: inherit; font-weight: 700; border-radius: 8px; padding: 12px 24px; border: 1px solid var(--navy); background: var(--navy); color: #fff; cursor: pointer; }
.btn:hover { background: var(--navy-deep); }
.btn[disabled] { opacity: .6; cursor: default; }
.btn-ghost { background: #fff; color: var(--navy); }
.btn-ghost:hover { background: var(--navy-soft); }
.btn-sm { padding: 7px 12px; font-size: .85rem; font-weight: 600; }
.msg { font-size: .9rem; color: var(--ink-2); }
.msg.err { color: var(--red); font-weight: 600; }
.privacy { font-size: .82rem; color: var(--ink-3); }

/* ---- Cảm ơn ---- */
.thanks { text-align: center; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.thanks .tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.thanks h2 { color: var(--navy-deep); font-size: 1.4rem; }
.thanks p { color: var(--ink-2); max-width: 50ch; }

.foot { max-width: 880px; margin: 0 auto; padding: 14px 16px 30px; color: var(--ink-3); font-size: .8rem; text-align: center; }

/* ---- Trang kết quả ---- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--navy); }
.stat .label { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }
.stat .value { font-size: 1.9rem; font-weight: 700; color: var(--navy-deep); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .sub { font-size: .8rem; color: var(--ink-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.bar-row .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--navy-soft); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); }
.bar-num { font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 44px; text-align: right; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .86rem; min-width: 980px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); background: var(--bg); position: sticky; top: 0; }
td.wrap { min-width: 220px; white-space: pre-wrap; }
.quotes { display: flex; flex-direction: column; gap: 10px; }
.quote { border-left: 3px solid var(--navy); padding: 6px 12px; background: var(--bg); border-radius: 0 8px 8px 0; font-size: .92rem; }
.quote small { display: block; color: var(--ink-3); margin-top: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.login { max-width: 420px; margin: 40px auto; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
