/* =========================================================
 * UNETI 70 năm – giao diện
 * Màu theo biểu trưng 70 năm: xanh #1B4FA0, cam #F8A120, đỏ #C82026; xanh than #0B2A6B
 * ========================================================= */
:root {
  --navy: #0b2a6b;
  --navy-2: #12357f;
  --primary: #1b4fa0;
  --primary-ink: #ffffff;
  --primary-soft: #e8f0fd;
  --orange: #f8a120;
  --orange-soft: #fff4dc;
  --orange-ink: #7a4300;
  --red: #b42b33;
  --green: #2e8540;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --line: #dbe2ec;
  --line-2: #c7d1df;
  --text: #13213d;
  --muted: #56657e;
  --track: #e2e7ef;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(11, 42, 107, 0.06), 0 2px 8px rgba(11, 42, 107, 0.05);
  --seat: 14px;
  --focus: 0 0 0 3px rgba(248, 161, 32, 0.85);
  font-family: 'Be Vietnam Pro', 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.3; margin: 0; }
h2 { font-size: 1.08rem; }
h3 { font-size: 0.98rem; }
small { font-size: 0.82rem; }
code { font-family: Consolas, monospace; font-size: 0.85em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--navy); color: #fff; padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.spacer { flex: 1; }
.ok-text { color: var(--green); }
.bad-text { color: var(--red); }
.warn-text { color: #8a5a00; }
.danger-text { color: var(--red) !important; }
.missing { color: var(--red); font-style: normal; font-size: 0.86rem; }

/* ---------------- Nút ---------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; text-decoration: none; white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--surface-2); border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--navy-2); }
.btn.ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.ghost:hover { background: var(--primary-soft); }
.btn.sm { padding: 3px 10px; min-height: 30px; font-size: 0.86rem; }
.btn.block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 1.15rem; width: 40px; height: 40px; border-radius: 8px; position: relative; color: inherit; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.file-btn { cursor: pointer; }

/* ---------------- Nhãn ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.badge small { font-weight: 400; }
.tone-ok { background: #e6f4ea; color: #1e5e2e; }
.tone-bad { background: #fbeaea; color: #8e1f26; }
.tone-warn { background: #fff4d6; color: #6e4b00; }
.tone-info { background: #e8f0fd; color: #1e4fa8; }
.tone-muted { background: #eef1f5; color: #46536a; }
.tone-alert { background: #f5e9fa; color: #6e2a84; }
.tone-lock { background: #e3e8f4; color: var(--navy); border-color: #b8c4dd; }
.badge.rsvp { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot-none { background: var(--track) !important; border: 1px solid var(--line-2); }
.sample-mark { font-size: 0.65rem; color: #8a5a00; background: var(--orange-soft); border-radius: 4px; padding: 0 3px; margin-left: 3px; font-weight: 600; }
.sample-tag { font-size: 0.66rem; letter-spacing: 0.04em; font-weight: 700; color: var(--orange-ink); background: var(--orange-soft); border: 1px solid #f3cf8a; border-radius: 4px; padding: 0 5px; vertical-align: middle; }
.role-tag { font-size: 0.72rem; background: var(--primary-soft); color: var(--primary); border-radius: 4px; padding: 0 5px; font-weight: 600; }
.prio { font-size: 0.74rem; font-weight: 600; border-radius: 4px; padding: 0 6px; border: 1px solid; }
.prio-high { color: #8e1f26; border-color: #e7a7ab; background: #fdf3f3; }
.prio-medium { color: #6e4b00; border-color: #ecd08d; background: #fffaf0; }
.prio-low { color: #46536a; border-color: var(--line-2); }
.chip { display: inline-block; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; margin: 2px; font-size: 0.86rem; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 10px; background: var(--orange); color: var(--navy); font-size: 0.72rem; font-weight: 700; font-style: normal; padding: 0 5px; }
.count.bad { background: var(--red); color: #fff; }

/* ---------------- Khung ứng dụng ---------------- */
#app.shell { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: auto auto auto 1fr; grid-template-areas: 'side top' 'side b1' 'side b2' 'side main'; min-height: 100vh; }
.side { grid-area: side; background: var(--navy); color: #dfe7f7; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px 16px 14px; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.brand img { background: #fff; border-radius: 8px; padding: 3px 4px; width: 46px; height: auto; flex: none; }
.brand b { display: block; font-size: 1.12rem; letter-spacing: 0.01em; }
.brand small { color: #b9c7e6; }
.side nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #dfe7f7; text-decoration: none; font-weight: 500; }
.side nav a i { width: 20px; text-align: center; font-style: normal; opacity: 0.9; }
.side nav a:hover { background: rgba(255, 255, 255, 0.08); }
.side nav a.active { background: #fff; color: var(--navy); box-shadow: inset 4px 0 0 var(--orange); }
.side nav a .count { margin-left: auto; }
.side-foot { margin-top: auto; padding: 14px 16px; font-size: 0.8rem; color: #b9c7e6; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.top { grid-area: top; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 20px; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 60px; }
.top h1 { font-size: 1.15rem; color: var(--navy); }
.top .icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.lock-chip { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; background: var(--orange-soft); color: var(--orange-ink); border: 1px solid #f3cf8a; white-space: nowrap; }
.lock-chip.locked { background: #e3e8f4; color: var(--navy); border-color: #b8c4dd; font-weight: 600; }
.bell .count { position: absolute; top: 2px; right: 0; }
.user-chip { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px 3px 3px; cursor: pointer; max-width: 300px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.user-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; overflow: hidden; }
.user-text b { font-size: 0.86rem; white-space: nowrap; }
.user-text small { color: var(--muted); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.popover { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(11, 42, 107, 0.18); padding: 12px; min-width: 260px; z-index: 50; }
.popover ul { list-style: none; padding: 0; margin: 8px 0; font-size: 0.86rem; }
.pop-head small { display: block; color: var(--muted); }
.popover .btn { margin-top: 6px; }
.banner { padding: 7px 20px; font-size: 0.84rem; border-bottom: 1px solid var(--line); }
.banner.sample { background: var(--orange-soft); color: #5a3800; grid-area: b2; }
.banner.temp { background: var(--primary-soft); color: #173f86; grid-area: b2; }
.banner.warn { background: #fde7e8; color: #7d1a20; grid-area: b1; }
main { grid-area: main; padding: 18px 20px 40px; min-width: 0; outline: none; }
.side-scrim { display: none; }

/* ---------------- Thẻ, lưới ---------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head .link { margin-left: auto; font-size: 0.86rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.span-2 { grid-column: 1 / -1; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.scope-note { color: var(--muted); margin: 0 0 12px; font-size: 0.86rem; }
h3.sub { margin: 14px 0 6px; font-size: 0.9rem; color: var(--navy); }
.note-box { background: var(--primary-soft); border: 1px solid #c7d8f6; border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; }
.error-card { border-color: #e7a7ab; }

/* ---------------- Số liệu ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpis.compact { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 10px 0 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); border-top: 3px solid var(--line-2); display: block; }
a.kpi:hover { border-color: var(--primary); }
.kpi-ok { border-top-color: var(--green); }
.kpi-bad { border-top-color: var(--red); }
.kpi-warn { border-top-color: #e0a10b; }
.kpi-info { border-top-color: var(--primary); }
.kpi-label { font-size: 0.8rem; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpis.compact .kpi-value { font-size: 1.3rem; }
.kpi-sub { font-size: 0.76rem; color: var(--muted); }
.meter { height: 10px; background: var(--track); border-radius: 5px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 0 4px 4px 0; }
.meter-ok span { background: var(--green); }
.meter.over span { background: var(--red); }
.meter-row { margin-bottom: 10px; font-size: 0.9rem; }
.meter-row .meter { margin-top: 4px; }
.stack { display: flex; height: 16px; border-radius: 4px; overflow: hidden; background: var(--track); gap: 2px; }
.stack .seg { height: 100%; min-width: 3px; }
.stack .seg-none { background: var(--track); }
.overall .stack { height: 22px; margin-bottom: 14px; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 10px; font-size: 0.84rem; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend b { font-variant-numeric: tabular-nums; }
table.bars { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.bars th, table.bars td { padding: 5px 8px 5px 0; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--surface-2); }
table.bars thead th { font-size: 0.76rem; color: var(--muted); font-weight: 500; }
table.bars tbody th { font-weight: 500; width: 34%; }
table.bars .w-bar { width: 46%; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mini-stats { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 6px 0; }
.mini-stats a { text-decoration: none; color: inherit; }
.task-mini { list-style: none; padding: 0; margin: 0; }
.task-mini li { padding: 6px 0; border-bottom: 1px solid var(--surface-2); }
.task-mini small { display: block; color: var(--muted); }
.cap-table { width: 100%; font-size: 0.86rem; border-collapse: collapse; }
.cap-table th { text-align: left; font-weight: 500; padding: 4px 8px 4px 0; width: 52%; }
.cap-table td { padding: 4px 0; }
.cap-table td.num { width: 70px; }
.warn-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.warn-list li { border-radius: 8px; padding: 8px 12px; border-left: 4px solid; }
.warn-list a { color: inherit; text-decoration: none; display: block; }
.warn-list a:hover { text-decoration: underline; }
.warn-list .tone-bad { border-color: var(--red); }
.warn-list .tone-warn { border-color: #e0a10b; }
.warn-list .tone-alert { border-color: #9b3fb5; }
.warn-list .tone-info { border-color: var(--primary); }
.seg-ctl { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg-ctl button { border: 0; background: var(--surface); padding: 5px 12px; cursor: pointer; font-size: 0.86rem; }
.seg-ctl button.on { background: var(--navy); color: #fff; }
.inline-select { font-size: 0.86rem; display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
.tip { position: fixed; z-index: 200; background: var(--navy); color: #fff; padding: 5px 9px; border-radius: 6px; font-size: 0.8rem; pointer-events: none; display: none; max-width: 340px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2); }

/* ---------------- Công cụ, lọc, bảng ---------------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filters input[type='search'] { min-width: 240px; flex: 1 1 240px; max-width: 420px; }
input, select, textarea { border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 10px; background: var(--surface); min-height: 38px; max-width: 100%; }
select { padding-right: 26px; }
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
.summary-line { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 0.88rem; color: var(--muted); margin-bottom: 10px; }
.summary-line b { color: var(--text); }
.bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--navy); color: #fff; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; position: sticky; top: 64px; z-index: 5; }
.bulkbar select { min-height: 32px; padding: 3px 8px; color: var(--text); }
.bulkbar .btn.ghost { color: #fff; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.data th, table.data td { padding: 8px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
table.data thead th { background: var(--surface-2); font-size: 0.78rem; color: var(--muted); font-weight: 600; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
table.data tbody tr:hover { background: #fafcff; }
table.data .chk { width: 34px; }
table.data .row-act { text-align: right; white-space: nowrap; }
table.data tr.total th, table.data tr.total td { font-weight: 700; background: var(--surface-2); }
table.data tr.row-bad { background: #fff5f5; }
table.data tr.row-muted { opacity: 0.6; }
table.data tr.row-warn { background: #fffaf0; }
table.data.edit input, table.data.edit select { width: 100%; min-height: 32px; padding: 3px 6px; }
table.data.matrix td, table.data.matrix th { font-size: 0.8rem; }
.who { display: flex; flex-direction: column; }
.who small { color: var(--muted); }
.special { color: #6e2a84; }
.comp { margin-left: 4px; color: var(--muted); font-weight: 600; }
.rsvp-edit { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.rsvp-edit select { min-height: 32px; padding: 3px 20px 3px 6px; font-size: 0.84rem; width: 142px; }
table.data.guests td:nth-child(2) { min-width: 210px; }
table.data.guests td:nth-child(3) { min-width: 160px; }
table.data.guests td:nth-child(4) { min-width: 130px; }
select.attend { min-height: 32px; padding: 3px 24px 3px 6px; font-size: 0.84rem; }
select.attend.att-yes { border-color: var(--green); }
select.attend.att-no { border-color: var(--red); }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 12px 0; font-size: 0.86rem; color: var(--muted); }
.lock-note { font-size: 0.84rem; color: var(--navy); background: #e3e8f4; padding: 3px 10px; border-radius: 6px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-ico { font-size: 2rem; color: var(--line-2); }
.empty h3 { color: var(--text); margin: 6px 0; }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 30px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; background: transparent; padding: 9px 14px; cursor: pointer; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--orange); }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* ---------------- Biểu mẫu & hộp thoại ---------------- */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.field > span { font-weight: 500; color: var(--text); }
.field input, .field select, .field textarea { width: 100%; }
.hint { color: var(--muted); font-size: 0.8rem; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.9rem; cursor: pointer; padding: 3px 0; }
.check input { min-height: auto; margin-top: 3px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.form-grid.three { grid-template-columns: 2fr 1fr 1fr; }
.form-grid > .check { align-self: end; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 0 12px; min-width: 0; }
fieldset.form-grid { border: 0; padding: 0; }
legend { font-weight: 600; font-size: 0.88rem; color: var(--navy); padding: 0 4px; }
fieldset[disabled] { opacity: 0.85; }
.rsvp-box { background: var(--surface-2); }
.form-error { background: #fbeaea; color: #8e1f26; border: 1px solid #e7a7ab; border-radius: 8px; padding: 8px 12px; margin-top: 10px; font-size: 0.9rem; }
#modal-root .modal-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 28, 60, 0.45); }
.modal { position: relative; background: var(--surface); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); width: 100%; display: flex; flex-direction: column; max-height: 92vh; }
.modal-sm { max-width: 460px; }
.modal-md { max-width: 620px; }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1120px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.05rem; color: var(--navy); flex: 1; }
.modal-head .icon-btn:hover { background: var(--surface-2); }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; border-top: 1px solid var(--line); padding-top: 12px; }
.info-grid p { margin: 4px 0; font-size: 0.88rem; }
.history { list-style: none; padding: 0; margin: 0; font-size: 0.86rem; max-height: 220px; overflow-y: auto; }
.history li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.history small { color: var(--muted); display: block; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 10px 0; font-size: 0.9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.files { list-style: none; padding: 0; margin: 4px 0; font-size: 0.86rem; }
.task-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note-add { display: flex; gap: 8px; margin-top: 10px; }
.note-add input { flex: 1; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 12px; counter-reset: s; font-size: 0.84rem; }
.steps li { counter-increment: s; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.steps li::before { content: counter(s) '. '; }
.steps li.on { background: var(--navy); color: #fff; }
.dropzone { display: block; border: 2px dashed var(--line-2); border-radius: 10px; padding: 26px; text-align: center; cursor: pointer; background: var(--surface-2); }
.dropzone:hover { border-color: var(--primary); }
.dropzone span { display: block; color: var(--muted); margin-top: 6px; }
.issues { margin: 0; padding-left: 16px; font-size: 0.8rem; }
.issues .lv-error { color: var(--red); }
.issues .lv-warn { color: #8a5a00; }
.issues .lv-info { color: var(--muted); }
.preview { max-height: 46vh; overflow: auto; }
.mode { margin-top: 12px; }
.notes { list-style: none; padding: 0; margin: 0; }
.notes li { display: flex; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.notes li.unread { background: var(--primary-soft); border-radius: 6px; }
.notes li i { font-style: normal; width: 22px; text-align: center; }
.notes small { display: block; color: var(--muted); }
.toast-box { position: fixed; bottom: 18px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); border-left: 5px solid var(--green); transition: opacity 0.35s, transform 0.35s; font-size: 0.9rem; }
.toast.tone-bad { border-left-color: #ff6b73; background: #5a1418; color: #fff; }
.toast.tone-warn { border-left-color: var(--orange); background: var(--navy); color: #fff; }
.toast.tone-ok { background: var(--navy); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); }

/* ---------------- Nhiệm vụ ---------------- */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.col { background: #eaeff7; border-radius: var(--radius); padding: 10px; min-height: 120px; }
.col header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.col header h2 { font-size: 0.9rem; color: var(--navy); }
.col-overdue { background: #fbecec; }
.col-empty { text-align: center; }
.task-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); }
.task-card:hover { border-color: var(--primary); }
.task-card.is-over { border-left: 4px solid var(--red); }
.task-card h3 { font-size: 0.9rem; margin: 4px 0; }
.tc-top, .tc-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tc-top small { color: var(--muted); margin-left: auto; }
.tc-who, .tc-due { margin: 2px 0; font-size: 0.8rem; color: var(--muted); }
.my-tasks { list-style: none; padding: 0; margin: 0; }
.my-tasks li { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.my-tasks li.is-over { border-left: 4px solid var(--red); padding-left: 8px; }
.my-tasks .row-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }

.auto-tag { font-size: 0.68rem; font-weight: 700; color: #1e4fa8; background: var(--primary-soft); border: 1px solid #c7d8f6; border-radius: 4px; padding: 0 5px; }
.tc-prog { margin: 6px 0 2px; }
.tc-prog .meter { height: 6px; }
.tc-prog small { color: var(--muted); font-size: 0.76rem; }
.auto-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.invite-card { border-top: 4px solid var(--primary); }
.invite-card .card-head .btn { margin-left: auto; }

/* ---------------- Bố trí chỗ ---------------- */
.plan-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.stage { background: var(--navy); color: #fff; text-align: center; border-radius: 30px 30px 6px 6px; padding: 8px; font-weight: 700; letter-spacing: 0.3em; margin: 6px auto 14px; max-width: 520px; }
.zone { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; overflow-x: auto; }
.zone header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.zone header small { color: var(--muted); }
.seat-grid { display: grid; gap: 2px; width: max-content; margin: 0 auto; }
.seat { width: var(--seat); height: var(--seat); border-radius: 3px; border: 0; padding: 0; background: var(--track); cursor: pointer; position: relative; }
.seat.taken { cursor: pointer; }
.seat.leader::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #fff; }
.seat.manual { box-shadow: inset 0 0 0 2px rgba(11, 42, 107, 0.55); }
.seat.hit { outline: 3px solid var(--navy); outline-offset: 1px; z-index: 1; }
.seat:hover { transform: scale(1.35); z-index: 2; }
.seat-leader-dot { position: relative; }
.seat-leader-dot::after { content: ''; position: absolute; inset: 3px; background: #fff; border-radius: 50%; }
.hall { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 12px; }
.hall header { display: flex; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 10px; }
.table { position: relative; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--line-2); background: var(--surface); cursor: pointer; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; }
.table .tfill { position: absolute; left: 0; right: 0; bottom: 0; background: #d5e3fa; z-index: 0; }
.table.full .tfill { background: #b9d3f7; }
.table .tno, .table .tcount { position: relative; z-index: 1; }
.table .tno { font-weight: 700; color: var(--navy); }
.table .tcount { font-size: 0.74rem; color: var(--text); }
.table.vip { border-color: var(--orange); border-width: 3px; }
.table.over { border-color: var(--red); border-width: 3px; }
.table.hit { box-shadow: 0 0 0 4px var(--navy); }
.table:hover { border-color: var(--primary); }
.checklist.is-locked { border-color: #b8c4dd; }
.unplaced { list-style: none; padding: 0; margin: 0; max-height: 420px; overflow-y: auto; }
.unplaced li { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 0.86rem; }
.unplaced small { display: block; color: var(--muted); }
.table-people { padding-left: 20px; }
.table-people li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.table-people small { display: block; color: var(--muted); }
.table-caps { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin: 8px 0; font-size: 0.8rem; }
.table-caps input { width: 70px; min-height: 30px; padding: 2px 6px; margin-left: 4px; }
.rules { padding-left: 22px; }
.rules li { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); gap: 8px; }

/* ---------------- Đón tiếp & cá nhân ---------------- */
.rec-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface-2); }
.rec-card ul { margin: 6px 0; padding-left: 18px; font-size: 0.9rem; }
.me-card { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; border-top: 4px solid var(--orange); }
.me-card h2 { font-size: 1.3rem; color: var(--navy); }
.me-card p { margin: 2px 0; }
.arrive { display: flex; flex-direction: column; align-items: center; background: var(--navy); color: #fff; border-radius: 10px; padding: 10px 18px; text-align: center; }
.arrive b { font-size: 1.6rem; line-height: 1.1; }
.arrive small { color: #c6d3ef; }
.attend-pick { display: flex; gap: 8px; margin: 8px 0 12px; flex-wrap: wrap; }
.pos-box { border: 2px dashed var(--line-2); border-radius: 10px; padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 2px; min-height: 76px; justify-content: center; }
.pos-box b { font-size: 1.25rem; color: var(--navy); }
.pos-box small { color: var(--muted); }
.programme { padding-left: 20px; font-size: 0.9rem; }
.programme li { padding: 2px 0; }
h2.inline { display: inline; }
details summary { cursor: pointer; }
.pick-list { list-style: none; padding: 0; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; }
.pick-list li { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-bottom: 1px solid var(--line); gap: 8px; }
.export-list { list-style: none; padding: 0; margin: 0; }
.export-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.export-list small { display: block; color: var(--muted); }
.export-list span { display: flex; gap: 6px; }
.snap-list { list-style: none; padding: 0; margin: 0; font-size: 0.86rem; }
.snap-list li { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line); gap: 8px; }

/* ---------------- Trang công khai ---------------- */
body:has(> #app.public) { background: #0b2a6b; }
#app.public { min-height: 100vh; background: linear-gradient(160deg, #0b2a6b 0%, #12357f 45%, #1b4fa0 100%); padding: 24px 12px; }
.auth-wrap { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: flex-start; }
.auth-card { background: var(--surface); border-radius: 16px; padding: 24px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25); }
.auth-card.wide { max-width: 760px; margin: 0 auto; }
.auth-card.demo { max-width: 420px; }
.auth-card h2 { color: var(--navy); margin: 14px 0 10px; font-size: 1.15rem; }
.hero { display: flex; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.hero img { width: 104px; height: auto; flex: none; }
.hero .org { margin: 0; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); line-height: 1.4; }
.hero h1 { color: var(--navy); font-size: 1.6rem; margin: 2px 0; }
.hero .ev { margin: 0; font-weight: 500; font-size: 0.9rem; }
.hero .when { margin: 2px 0 0; font-size: 0.82rem; color: var(--muted); }
.stack-form { display: flex; flex-direction: column; gap: 12px; }
.stack-form input { font-size: 1.1rem; letter-spacing: 0.03em; }
.demo-box { background: var(--orange-soft); border: 1px solid #f3cf8a; border-radius: 8px; padding: 8px 12px; font-size: 0.88rem; color: #5a3800; }
.demo-box code { font-size: 1.15rem; font-weight: 700; background: #fff; letter-spacing: 0.15em; }
.auth-links { margin-top: 14px; font-size: 0.9rem; text-align: center; }
.demo-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.demo-acc { width: 100%; display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 0 8px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.demo-acc:hover { border-color: var(--primary); background: var(--primary-soft); }
.demo-acc b { color: var(--navy); }
.demo-acc span { grid-column: 1; font-size: 0.84rem; color: var(--muted); }
.demo-acc code { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.choice { text-align: left; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.choice:hover, .choice:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.choice b { color: var(--navy); }
.choice span { font-size: 0.86rem; color: var(--muted); }
.lookup-result { margin-top: 16px; border-top: 3px solid var(--orange); padding-top: 12px; }
.lookup-result h3 { font-size: 1.15rem; color: var(--navy); }
.lookup-result h3 small { color: var(--muted); font-weight: 400; }
.lookup-result dl { margin: 10px 0; }
.lookup-result dt { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-top: 10px; }
.lookup-result dd { margin: 2px 0 0; font-size: 1rem; }
.lookup-result dd b { font-size: 1.15rem; color: var(--navy); }
details.programme { margin-top: 14px; font-size: 0.9rem; }
details.programme ol { padding-left: 20px; }

/* ---------------- Cài ứng dụng, cập nhật, tai thỏ điện thoại ---------------- */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 250; display: flex; gap: 12px; align-items: center; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); font-size: 0.9rem; max-width: calc(100vw - 24px); }
.install-steps { padding-left: 20px; margin: 0; }
.install-steps li { margin-bottom: 8px; }
.side-install { width: 100%; justify-content: center; margin-bottom: 10px; background: rgba(255, 255, 255, 0.1); color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.side-install:hover { background: rgba(255, 255, 255, 0.2); }
.auth-install { margin-top: 10px; }
.top { padding-top: calc(8px + env(safe-area-inset-top)); }
.side { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
#app.public { padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
body.is-offline .top { box-shadow: inset 0 -3px 0 #e0a10b; }
@media (display-mode: standalone) {
  body { overscroll-behavior-y: contain; }
}

/* ---------------- Màn hình nhỏ ---------------- */
@media (max-width: 1100px) {
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  #app.shell { grid-template-columns: 1fr; grid-template-areas: 'top' 'b1' 'b2' 'main'; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 60; transform: translateX(-100%); transition: transform 0.2s; }
  body.nav-open .side { transform: none; }
  body.nav-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 55; }
  .menu-btn { display: inline-block; }
  .top { padding: 8px 10px; }
  .top h1 { font-size: 1rem; }
  .user-text, .lock-chip b { display: none; }
  .lock-chip { font-size: 0.72rem; max-width: 150px; white-space: normal; line-height: 1.2; }
  .user-btn { padding: 3px; }
  main { padding: 12px 10px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .bulkbar { top: 60px; }
}
@media (max-width: 720px) {
  .form-grid, .info-grid, .choice-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 1.35rem; }
  .filters input[type='search'] { min-width: 0; max-width: none; flex-basis: 100%; }
  .filters select { flex: 1 1 45%; }
  /* bảng thành thẻ */
  .table-wrap { border: 0; background: transparent; }
  table.data:not(.edit):not(.pivot):not(.matrix) thead { display: none; }
  table.data:not(.edit):not(.pivot):not(.matrix) tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 6px 10px; }
  table.data:not(.edit):not(.pivot):not(.matrix) td { display: flex; gap: 10px; border: 0; padding: 4px 0; }
  table.data:not(.edit):not(.pivot):not(.matrix) td[data-label]::before { content: attr(data-label); flex: 0 0 92px; color: var(--muted); font-size: 0.78rem; padding-top: 2px; }
  table.data td.chk { display: inline-block !important; }
  table.data .row-act { justify-content: flex-end; }
  .kv { grid-template-columns: 1fr; }
  .hero img { width: 84px; }
  .hero h1 { font-size: 1.35rem; }
  .modal-body { padding: 12px; }
  #modal-root .modal-wrap { padding: 0; }
  .modal { border-radius: 0; max-height: 100vh; min-height: 100vh; }
  table.bars tbody th { width: 40%; }
  .bulkbar { position: static; }
}

/* ---------------- In ---------------- */
@media print {
  .side, .top, .banner, .toolbar, .filters, .bulkbar, .pager, .row-act, .btn, .tabs { display: none !important; }
  #app.shell { display: block; }
  main { padding: 0; }
  .card, .table-wrap { box-shadow: none; border-color: #999; }
  body { background: #fff; }
}

/* Giảm chuyển động */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* Chế độ tương phản cưỡng bức */
@media (forced-colors: active) {
  .seat, .stack .seg, .dot { forced-color-adjust: none; }
}
