/* Site Nghiên cứu khoa học: bổ sung cho app.css và site.css (dùng chung biến màu). Không dùng style viết thẳng (CSP). */
.nk-row { display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.nk-between { justify-content: space-between; }
.nk-h { font-size: 1.05rem; margin: 0; }
.grow { flex: 1 1 14rem; min-width: 0; }
.dh-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); align-items: end; }
.nk-stitle { margin: .2rem 0 .4rem; font-size: 1.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Thẻ (tab) */
.ev-tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 2px solid var(--line); }
.ev-tab { font: inherit; background: none; border: 0; border-bottom: 3px solid transparent; padding: .55rem 1rem; margin-bottom: -2px; cursor: pointer; color: var(--muted); font-weight: 600; text-decoration: none; }
.ev-tab.on { color: var(--accent); border-bottom-color: var(--accent); }

/* Danh sách khảo sát */
.nk-cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.nk-card { display: flex; gap: .75rem; justify-content: space-between; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.nk-card h3 { margin: 0; font-size: 1.02rem; }
.nk-card h3 a { color: inherit; text-decoration: none; }
.nk-card h3 a:hover { color: var(--accent); }
.nk-card p { margin: 0; }
.nk-card-actions { flex: none; }

/* Trạng thái lưu của trình soạn */
.nk-status { position: sticky; top: 0; z-index: 5; padding: .45rem .8rem; border-radius: 8px; font-size: .88rem; background: var(--ok-soft); color: var(--ok); }
.nk-status.busy { background: var(--bg); color: var(--muted); }
.nk-status.warn { background: var(--warn-soft); color: var(--warn); }
.nk-status.bad { background: var(--bad-soft); color: var(--bad); }

/* Trình soạn phiếu */
.nk-survey-title { font-size: 1.4rem; font-weight: 600; border: 0; border-bottom: 2px solid var(--line); background: transparent; padding: .3rem 0; }
.nk-survey-title:focus { outline: none; border-bottom-color: var(--accent); }
.nk-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 14px 16px; display: grid; gap: .6rem; }
.nk-item.nk-section { border-left-color: var(--gold); background: color-mix(in srgb, var(--gold-soft) 35%, var(--surface)); }
.nk-item-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.nk-qno { font-weight: 700; color: var(--accent); min-width: 3.5rem; }
.nk-tools { margin-left: auto; display: inline-flex; gap: .25rem; }
.nk-varbox { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; color: var(--muted); }
.nk-var { font-family: var(--font-mono); width: 8.5rem; text-transform: none; }
.nk-title { font-size: 1rem; font-weight: 500; resize: vertical; min-height: 2.4rem; }
.nk-help { font-size: .9rem; }
.nk-inline { display: inline-flex; align-items: center; gap: .4rem; font-size: .92rem; }
.nk-item-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: .5rem; }
.nk-opts { display: grid; gap: .35rem; }
.nk-opt { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem minmax(8rem, 13rem) auto; gap: .4rem; align-items: center; }
.nk-opt:not(:has(select)) { grid-template-columns: minmax(0, 1fr) 5.5rem auto; }
.nk-opt-head { font-size: .78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.nk-opt-head:not(:has(select)) { grid-template-columns: minmax(0, 1fr) 5.5rem auto; }
.nk-opt.nk-opt-head.nk-choice-head { grid-template-columns: minmax(0, 1fr) 5.5rem minmax(8rem, 13rem) auto; }
.nk-other { font-style: italic; }
.nk-code { width: 5.5rem; font-family: var(--font-mono); }
.nk-mrow { display: grid; grid-template-columns: minmax(0, 1fr) 8.5rem 6rem auto; gap: .4rem; align-items: center; }
.nk-rev { font-size: .85rem; }
.nk-scale { display: grid; gap: .45rem; padding: .6rem; border: 1px dashed var(--line); border-radius: 10px; }
.nk-scale-labels { display: grid; gap: .35rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.nk-sl { display: flex; align-items: center; gap: .4rem; }
.nk-sl .mono { min-width: 1.5rem; text-align: right; font-weight: 600; }
.nk-addbar { display: flex; flex-wrap: wrap; gap: .3rem; padding: .25rem 0 .25rem .5rem; opacity: .45; transition: opacity .15s; }
.nk-addbar:hover, .nk-addbar:focus-within, .nk-addbar:last-of-type { opacity: 1; }
.nk-addbar .btn { font-size: .78rem; min-height: 28px; padding: .15rem .55rem; }
.nk-cons { display: grid; gap: .35rem; }
.nk-con { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr) auto auto; gap: .4rem; align-items: center; }
@media (max-width: 700px) {
  .nk-opt, .nk-opt:not(:has(select)), .nk-mrow { grid-template-columns: minmax(0, 1fr) 5rem auto; }
  .nk-opt select { grid-column: 1 / -1; }
  .nk-mrow .nk-rev { grid-column: 1 / 2; }
  .nk-var { width: 6.5rem; }
}

/* Chia sẻ */
.nk-share { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.nk-qr { width: 160px; flex: none; background: #fff; border-radius: 8px; padding: 4px; }
.nk-qr svg { display: block; width: 100%; height: auto; }
.nk-codebook td { vertical-align: top; }
.nk-codebook td:nth-child(5) { min-width: 16rem; }

/* ================= Trang trả lời ================= */
.nk-fill-body { background: var(--bg); }
.nk-fill { max-width: 760px; margin: 0 auto; padding: 24px 14px 60px; display: grid; gap: 14px; }
.nk-head { border-top: 8px solid var(--accent); }
.nk-head h1 { margin: 0; font-size: 1.6rem; }
.nk-desc { white-space: pre-line; margin: 0; }
.nk-sec { border-left: 6px solid var(--gold); }
.nk-sec h2 { margin: 0; font-size: 1.2rem; }
.nk-msg h1 { margin: 0; }
.nk-q { display: grid; gap: .65rem; }
.nk-q.bad { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.nk-qhead { display: flex; gap: .3rem; align-items: flex-start; }
.nk-qtitle { font-weight: 600; white-space: pre-line; }
.nk-req { color: var(--bad); font-weight: 700; }
.nk-qhelp { margin: 0; font-size: .88rem; color: var(--muted); white-space: pre-line; }
.nk-err { margin: 0; color: var(--bad); font-size: .88rem; font-weight: 600; }
.nk-choices { display: grid; gap: .25rem; }
.nk-choice { display: flex; align-items: center; gap: .55rem; padding: .45rem .5rem; border-radius: 8px; cursor: pointer; }
.nk-choice:hover { background: var(--accent-soft); }
.nk-choice input[type="radio"], .nk-choice input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--accent); flex: none; }
.nk-choice input[type="text"] { flex: 1 1 10rem; }
.nk-dd-other { margin-top: .4rem; }
.nk-num { max-width: 12rem; }
.nk-likert { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: .3rem; }
.nk-pt { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; padding: .45rem .2rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: .8rem; }
.nk-pt:hover { background: var(--accent-soft); }
.nk-pt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.nk-pt input { width: 19px; height: 19px; accent-color: var(--accent); margin: 0; }
.nk-ptn { font-weight: 700; font-family: var(--font-mono); }
.nk-ptl { color: var(--muted); line-height: 1.2; }
.nk-legend { margin: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; color: var(--muted); }
.nk-mx { display: grid; gap: 0; }
.nk-mx-row { display: grid; grid-template-columns: minmax(0, 1fr) repeat(var(--n, 5), 3rem); align-items: center; border-bottom: 1px solid var(--line); padding: .35rem 0; }
.nk-mx-head { font-weight: 700; font-family: var(--font-mono); text-align: center; border-bottom-width: 2px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.nk-mx-label { padding-right: .5rem; }
.nk-mx-cell { display: flex; justify-content: center; align-items: center; cursor: pointer; padding: .3rem 0; border-radius: 8px; }
.nk-mx-cell:hover { background: var(--accent-soft); }
.nk-mx-cell input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; }
.nk-mx-cell .nk-ptn { display: none; }
@media (max-width: 640px) {
  .nk-likert { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(4.5rem, 1fr)); }
  .nk-mx-head { display: none; }
  .nk-mx-row { grid-template-columns: repeat(var(--n, 5), minmax(0, 1fr)); gap: .25rem; padding: .6rem 0; }
  .nk-mx-label { grid-column: 1 / -1; font-weight: 500; padding-bottom: .25rem; }
  .nk-mx-cell { flex-direction: column; gap: .1rem; border: 1px solid var(--line); }
  .nk-mx-cell .nk-ptn { display: block; font-size: .8rem; }
  .nk-mx-cell:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
}
.nk-progress { display: flex; align-items: center; gap: .6rem; }
.nk-progress::before { content: ''; flex: 1; height: 8px; border-radius: 99px; background: var(--line); grid-area: 1 / 1; }
.nk-progress { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.nk-bar { grid-area: 1 / 1; height: 8px; border-radius: 99px; background: var(--accent); width: 0; transition: width .25s; }
.nk-nav { display: flex; justify-content: space-between; gap: 1rem; }
.nk-nav .btn { min-width: 8rem; }
.nk-clear { text-align: center; margin: 0; }
.nk-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Ô chọn trong trình soạn không chiếm cả dòng */
.nk-item-head select, .nk-inline select, .nk-scale select, .nk-opt select { width: auto; max-width: 100%; }
.nk-item-head > select { flex: 0 1 16rem; }
.nk-scale label, .nk-inline { display: inline-flex; align-items: center; gap: .35rem; }
.nk-scale-labels .nk-sl { display: flex; }
