/* Hệ thống khảo sát hài lòng — giao diện phẳng, nền ngà, điểm nhấn xanh xô thơm */
:root {
  --bg: #FBF6EE;
  --card: #FFFFFF;
  --ink: #2B2A27;
  --muted: #6B675F;
  --line: #EFE8DC;
  --soft: #F5EFE4;
  --accent: #6F8F5E;
  --accent-ink: #FFFFFF;
  --accent-soft: #E7EEE2;
  --warn: #B7791F;
  --warn-soft: #FBF0DC;
  --bad: #B5523B;
  --bad-soft: #F8E5DF;
  --good: #4F7A45;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(60, 50, 30, .05), 0 4px 16px rgba(60, 50, 30, .06);
  --font: "Inter", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: "Nunito", var(--font); line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
a { color: var(--accent); }
[v-cloak] { display: none; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* Bố cục */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-family: "Nunito", var(--font); font-weight: 800; font-size: 17px; padding: 4px 10px 16px; }
.brand small { display: block; font-weight: 600; color: var(--muted); font-size: 12px; }
.nav button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 12px; font: inherit; color: var(--ink); cursor: pointer; min-height: 44px; }
.nav button:hover { background: var(--soft); }
.nav button.on { background: var(--accent-soft); color: var(--good); font-weight: 600; }
.side .who { margin-top: 20px; padding: 12px; font-size: 13px; color: var(--muted); }
main.content { padding: 24px 28px 48px; max-width: 1360px; width: 100%; }
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; justify-content: space-between; margin-bottom: 18px; }

/* Thẻ */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi .label { font-size: 13px; color: var(--muted); }
.kpi .value { font-size: 30px; font-weight: 700; font-family: "Nunito", var(--font); font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: var(--soft); border-radius: 6px; overflow: hidden; margin-top: 8px; position: relative; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }
.bar .t85, .bar .t90 { position: absolute; top: -2px; width: 2px; height: 10px; background: var(--muted); opacity: .5; }
.section { margin-top: 16px; }
.chart-box { position: relative; height: 280px; }

/* Nút và trường nhập */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.96); }
.btn.ghost { background: var(--soft); color: var(--ink); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: var(--soft); border: 1px solid transparent; border-radius: 12px; padding: 10px 12px; min-height: 44px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: #fff; }
textarea { min-height: 96px; resize: vertical; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.filters label { min-width: 130px; }
.filters label span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 22px; height: 22px; min-height: 22px; margin-top: 2px; flex: none; accent-color: var(--accent); }

/* Bảng */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 8px 10px; background: var(--soft); white-space: nowrap; }
table.t th:first-child { border-radius: 10px 0 0 10px; } table.t th:last-child { border-radius: 0 10px 10px 0; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t td.r, table.t th.r { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #FDFAF4; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--accent-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.note { background: var(--warn-soft); color: #6B4A12; border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.note.info { background: var(--accent-soft); color: #2F4A27; }
.err { background: var(--bad-soft); color: var(--bad); border-radius: 12px; padding: 10px 14px; }
.ok { background: var(--accent-soft); color: var(--good); border-radius: 12px; padding: 10px 14px; }
.progress { min-width: 90px; }
.links-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.qr { width: 160px; height: 160px; display: block; margin: 8px auto; image-rendering: pixelated; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

/* Đăng nhập */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }

/* Phiếu khảo sát */
.survey { max-width: 760px; margin: 0 auto; padding: 16px; }
.survey .head { padding: 20px; }
.survey .group { margin-top: 16px; }
.survey .group h3 { color: var(--good); }
.q { padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-of-type { border-top: 0; }
.q .text { margin-bottom: 10px; }
.q .code { font-weight: 700; color: var(--muted); margin-right: 6px; }
.likert { display: grid; grid-template-columns: repeat(5, 1fr) 1.2fr; gap: 6px; }
.likert button { min-height: 52px; border-radius: 12px; border: 0; background: var(--soft); font: inherit; font-size: 12px; line-height: 1.2; color: var(--ink); cursor: pointer; padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.likert button b { font-size: 17px; }
.likert button.on { background: var(--accent); color: #fff; }
.likert button.na.on { background: #8C877D; }
.q.missing .text { color: var(--bad); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choices button { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--soft); font: inherit; cursor: pointer; color: var(--ink); }
.choices button.on { background: var(--accent); color: #fff; }
.sticky-submit { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.scale-legend { display: grid; grid-template-columns: repeat(5, 1fr) 1.2fr; gap: 6px; font-size: 11px; color: var(--muted); text-align: center; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; padding: 12px 16px 0; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav button { white-space: nowrap; width: auto; }
  .side .who { display: none; }
  main.content { padding: 16px; }
  .g2, .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .likert, .scale-legend { grid-template-columns: repeat(3, 1fr); }
  .likert button { min-height: 48px; }
  .kpi .value { font-size: 26px; }
}
@media print {
  .side, .filters, .btn { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
