/* Mobile-first từ 360px, chữ ≥ 16px (FR-06). Dùng chung cho trang công khai, đăng nhập và /quan-ly. */
:root {
  --bg: #f6f4ef; --card: #fff; --text: #1d1b16; --muted: #5d5a52; --line: #d8d3c7;
  --primary: #1f6f50; --primary-text: #fff; --note: #fff6dc; --error: #b3261e;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* .card dùng display:grid, phải để hidden thắng */
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { max-width: 640px; margin: 0 auto; padding: 16px; }
.wrap.wide { max-width: 1100px; }
h1 { font-size: 1.4rem; margin: 8px 0; }
h2 { font-size: 1.15rem; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
.step { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: var(--primary-text); font-size: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 16px 0; display: grid; gap: 12px; }
label { display: grid; gap: 6px; font-size: 1rem; }
textarea, input[type=text], input:not([type]), input[type=password], select {
  width: 100%; font: inherit; font-size: 1rem; padding: 12px; border: 1px solid #8a8578; border-radius: 10px; background: #fff; color: var(--text);
}
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
button { font: inherit; font-size: 1rem; min-height: 48px; padding: 10px 16px; border-radius: 10px; cursor: pointer; border: 1px solid var(--primary); }
button.primary { background: var(--primary); color: var(--primary-text); }
button.secondary { background: #fff; color: var(--primary); }
button.link { background: none; border: 0; color: var(--primary); text-decoration: underline; }
button.danger { background: var(--error); border-color: var(--error); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
button[data-busy="1"] { pointer-events: none; opacity: .6; }
.muted, .hint { color: var(--muted); }
.hint { margin: 0; font-size: 1rem; }
.note { background: var(--note); border-radius: 10px; padding: 12px; margin: 0; }
.error { color: var(--error); font-weight: 600; }
.msg { color: var(--error); margin: 0; }
.summary { font-size: 1.1rem; margin: 0; }
fieldset.question { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 0 0 12px; display: grid; gap: 8px; }
legend { font-weight: 600; padding: 0 4px; }
.hint.small { margin: -4px 0 0; font-size: 1rem; }
/* Wizard: thanh tiến độ, chip lựa chọn, chờ AI */
.progress { margin: 8px 0 0; }
.progress-text { margin: 0 0 6px; font-weight: 600; color: var(--primary); }
.progress-bar { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; padding: 0; }
.progress-bar li { height: 8px; border-radius: 4px; background: var(--line); }
.progress-bar li.done { background: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.chip span { display: flex; align-items: center; min-height: 48px; padding: 10px 16px; border: 1.5px solid #8a8578; border-radius: 24px; background: #fff; cursor: pointer; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.chip input:focus-visible + span { outline: 3px solid #e0a800; outline-offset: 2px; }
.nav-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.waiting { display: flex; gap: 10px; align-items: center; margin: 0; color: var(--muted); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Trang quản lý */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.toolbar label { min-width: 150px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.row { cursor: pointer; }
tr.row:hover { background: #f0ede4; }
.dialog { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; }
.dialog .card { max-width: 420px; width: 100%; }
pre.history { white-space: pre-wrap; font-size: 1rem; background: #faf8f3; padding: 8px; border-radius: 8px; }
