/* KPI Hugo House — hệ giao diện v3
   Bố cục: điện thoại = thanh điều hướng dưới đáy + một cột; máy tính = thanh trên + một cột rộng tối đa 1080px.
   Mỗi trang theo mẫu: tiêu đề → bối cảnh (tháng/cơ sở) → hành động chính → nội dung. */
:root {
  --bg: #f4f6f3;
  --card: #ffffff;
  --card-2: #f0f3ef;
  --fg: #1b2420;
  --muted: #65716a;
  --line: #dfe5e0;
  --line-strong: #c9d2cb;
  --accent: #1f7a5a;
  --accent-fg: #ffffff;
  --accent-soft: #e2f1ea;
  --accent-ink: #15553f;
  --warn: #9a6a12; --warn-soft: #fbf0d6;
  --bad: #b2362b; --bad-soft: #fae5e2;
  --good: #26734a; --good-soft: #e0f2e6;
  --info: #2a5d8f; --info-soft: #e3edf7;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 8px 24px -16px rgba(20, 30, 25, .25);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r: 12px; --r-sm: 8px;
  --nav-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121714; --card: #1b221e; --card-2: #222a25; --fg: #e9ede9; --muted: #9aa69e; --line: #2b352f; --line-strong: #3a4740;
    --accent: #4fbb90; --accent-fg: #0e1a14; --accent-soft: #1d3a2e; --accent-ink: #9fe0c3;
    --warn: #e4b85f; --warn-soft: #3a3120; --bad: #e6837a; --bad-soft: #3e2521; --good: #74c893; --good-soft: #1f3a2a; --info: #7fb2e6; --info-soft: #1f2f40;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121714; --card: #1b221e; --card-2: #222a25; --fg: #e9ede9; --muted: #9aa69e; --line: #2b352f; --line-strong: #3a4740;
  --accent: #4fbb90; --accent-fg: #0e1a14; --accent-soft: #1d3a2e; --accent-ink: #9fe0c3;
  --warn: #e4b85f; --warn-soft: #3a3120; --bad: #e6837a; --bad-soft: #3e2521; --good: #74c893; --good-soft: #1f3a2a; --info: #7fb2e6; --info-soft: #1f2f40;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-size: 1.4rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0; }
ol, ul { margin: 0; padding-left: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.xs { font-size: .78rem; }
.num { font-variant-numeric: tabular-nums; }
.b { font-weight: 600; }
[hidden] { display: none !important; }

/* ---- Khung ---- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 1rem; padding: 0 16px; height: 52px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--fg); white-space: nowrap; letter-spacing: -.01em; }
.brand span { color: var(--accent); }
.topnav { display: flex; gap: .15rem; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: .35rem .75rem; border-radius: 999px; color: var(--muted); white-space: nowrap; font-weight: 500; }
.topnav a.on { background: var(--accent-soft); color: var(--accent-ink); }
.who { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.who .name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.who button { background: none; border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; cursor: pointer; color: var(--fg); }
.bottomnav { display: none; }
.chi-dt { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: 16px; padding-block: 1rem 3rem; }
@media (max-width: 720px) {
  .chi-dt { display: flex !important; }
  .topnav { display: none; }
  .who .name { display: none; }
  .bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottomnav a { display: grid; justify-items: center; gap: .1rem; padding: .5rem .25rem .4rem; color: var(--muted); font-size: .7rem; font-weight: 500; min-height: var(--nav-h); }
  .bottomnav a svg { width: 24px; height: 24px; }
  .bottomnav a.on { color: var(--accent-ink); }
  .bottomnav a.on svg { color: var(--accent); }
  .wrap { padding-bottom: calc(var(--nav-h) + 2rem + env(safe-area-inset-bottom, 0px)); }
}

/* ---- Khối ---- */
.page { display: grid; gap: 1rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: .9rem; margin-top: .15rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; }
.card.flat { background: var(--card-2); border-color: transparent; }
.card.pad0 { padding: 0; overflow: hidden; }
.stack { display: grid; gap: .75rem; }
.stack.tight { gap: .4rem; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grid2 { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid3 { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .25rem; }
.section-title h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
.loading { color: var(--muted); padding: 3rem 0; text-align: center; }
.skeleton { height: 1em; border-radius: 6px; background: linear-gradient(90deg, var(--card-2), var(--line), var(--card-2)); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---- Nút ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; font-weight: 500; color: var(--fg); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.sm { min-height: 34px; padding: .25rem .7rem; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn:focus-visible, .chip:focus-visible, .tile:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actionbar { position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + .5rem); display: flex; gap: .75rem; align-items: center; justify-content: space-between; padding: .6rem .8rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
@media (max-width: 720px) { .actionbar { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + .5rem); } }

/* ---- Form ---- */
label.f { display: grid; gap: .3rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
label.f > input, label.f > select, label.f > textarea { color: var(--fg); font-weight: 400; }
input, select, textarea { width: 100%; min-height: 44px; padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); font-size: 16px; }
textarea { min-height: 76px; resize: vertical; }
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; min-height: 0; margin: 0; accent-color: var(--accent); }
.hint { font-size: .8rem; color: var(--muted); }
.search { position: relative; }
.search input { padding-left: 2.4rem; }
.search svg { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }

/* Thang điểm */
.crit { display: grid; gap: .45rem; padding: .85rem 0; border-top: 1px solid var(--line); }
.crit:first-child { border-top: 0; padding-top: 0; }
.crit .q { display: flex; gap: .5rem; }
.crit .q .n { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.2rem; }
.scale { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.scale.three { grid-template-columns: repeat(3, 1fr); }
.scale button { display: grid; gap: .05rem; justify-items: center; min-height: 52px; padding: .35rem .2rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; font-weight: 700; line-height: 1.15; }
.scale button small { font-weight: 500; font-size: .68rem; color: var(--muted); }
.scale button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.scale button.on small { color: var(--accent-fg); opacity: .9; }
.check { display: flex; align-items: center; gap: .7rem; min-height: 48px; padding: .4rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.check:first-child { border-top: 0; }
.check.off { color: var(--bad); }

/* Chip, pill, badge */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { min-height: 38px; padding: .35rem .85rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); cursor: pointer; white-space: nowrap; font-weight: 500; }
.chip.on { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.chip.sm { min-height: 32px; padding: .2rem .7rem; font-size: .85rem; }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.xuat_sac { background: var(--good-soft); color: var(--good); }
.pill.tot { background: var(--accent-soft); color: var(--accent-ink); }
.pill.dat { background: var(--warn-soft); color: var(--warn); }
.pill.can_cai_thien, .pill.lan_ranh_do { background: var(--bad-soft); color: var(--bad); }
.pill.neutral { background: var(--card-2); color: var(--muted); }
.pill.info { background: var(--info-soft); color: var(--info); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.off { background: var(--line-strong); }

/* Tiến độ */
.prog { display: flex; gap: .35rem; flex-wrap: wrap; font-size: .78rem; color: var(--muted); }
.prog span { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border-radius: 999px; background: var(--card-2); }
.prog span.done { background: var(--good-soft); color: var(--good); }
.prog span.todo { background: var(--warn-soft); color: var(--warn); }
.bar { height: 8px; border-radius: 999px; background: var(--card-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.bad i { background: var(--bad); } .bar.warn i { background: var(--warn); }

/* Ô chọn lớn */
.tiles { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { display: grid; gap: .25rem; text-align: left; padding: .9rem; min-height: 88px; border-radius: var(--r); border: 1px solid var(--line); background: var(--card); cursor: pointer; }
.tile:hover { border-color: var(--accent); }
.tile b { font-size: .95rem; }
.tile .xs { color: var(--muted); }
.tile .badge { justify-self: start; }

/* Danh sách */
.list { display: grid; }
.item { display: flex; align-items: center; gap: .75rem; padding: .7rem 0; border-top: 1px solid var(--line); min-height: 56px; }
.item:first-child { border-top: 0; }
.item.link { cursor: pointer; color: inherit; }
.item.link:hover { background: linear-gradient(90deg, transparent, var(--accent-soft) 50%, transparent); }
.item .main { flex: 1; min-width: 0; }
.item .main .t { font-weight: 600; }
.item .main .s { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.item .end { text-align: right; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: .85rem; flex: none; }
.pt { font-weight: 700; font-variant-numeric: tabular-nums; }
.pt.neg { color: var(--bad); } .pt.pos { color: var(--good); }
.chev { color: var(--line-strong); }

/* Bảng */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; position: sticky; top: 0; background: var(--card); }
td.r, th.r { text-align: right; }
th.sort { cursor: pointer; } th.sort.on { color: var(--accent-ink); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--accent-soft); }
td:first-child, th:first-child { position: sticky; left: 0; background: var(--card); }
tr.clickable:hover td:first-child { background: var(--accent-soft); }

/* Số to */
.stats { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.stat { padding: .7rem .8rem; border-radius: var(--r); background: var(--card); border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.4rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat span { font-size: .78rem; color: var(--muted); }
.hero { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.hero .big { font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.02em; }
.hero .big small { font-size: 1rem; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.groups { display: grid; gap: .6rem; }
.group { display: grid; grid-template-columns: minmax(130px, 1.2fr) 3fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.group .v { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 4.5rem; text-align: right; }
.group .v small { color: var(--muted); font-weight: 400; }

/* Thông báo */
.note { padding: .7rem .9rem; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; display: flex; gap: .6rem; align-items: flex-start; }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.good { background: var(--good-soft); color: var(--good); }
.note.info { background: var(--info-soft); color: var(--info); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); display: grid; gap: .6rem; justify-items: center; }
.empty svg { width: 40px; height: 40px; color: var(--line-strong); }
.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: .65rem 1rem; border-radius: 10px; max-width: calc(100% - 32px); z-index: 60; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); color: #fff; }
@media (max-width: 720px) { .toast { bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom, 0px)); } }

/* Modal (sheet trên điện thoại) */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 15, .5); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--card); border-radius: 16px 16px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); width: 100%; max-width: 600px; max-height: 92vh; overflow: auto; }
.modal .handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto .75rem; }
@media (min-width: 640px) { .modal-bg { align-items: center; padding: 1rem; } .modal { border-radius: 16px; } .modal .handle { display: none; } }
@media (prefers-reduced-motion: no-preference) { .modal { animation: up .2s ease-out; } @keyframes up { from { transform: translateY(16px); opacity: 0; } } }

/* Đăng nhập */
.login { max-width: 420px; margin: 1.5rem auto; display: grid; gap: 1rem; }
.login .logo { width: 56px; height: 56px; border-radius: 14px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; }
.ol-steps { display: grid; gap: .5rem; counter-reset: s; list-style: none; padding: 0; }
/* Chữ đậm trong bước phải nằm cùng dòng: không dùng flex cho li (flex tách từng thẻ <b> thành cột) */
.ol-steps li { position: relative; padding-left: 2.1rem; line-height: 1.5; min-height: 24px; }
.ol-steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: .05rem; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); font-size: .8rem; font-weight: 700; display: grid; place-items: center; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- v4 ---- */
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.chua_khung { background: var(--card-2); color: var(--muted); }
.pill.tt-da_chot { background: var(--good-soft); color: var(--good); }
.pill.tt-cho_tra_loi { background: var(--bad-soft); color: var(--bad); }
.pill.tt-da_tra_loi, .pill.tt-cho_duyet { background: var(--warn-soft); color: var(--warn); }
.pill.tt-dang_ghi { background: var(--info-soft); color: var(--info); }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; min-height: 120px; padding: 1rem; border: 2px dashed var(--line); border-radius: var(--r, 12px); text-align: center; cursor: pointer; background: var(--card-2); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.check input[type=checkbox]:disabled + span { opacity: .55; }
.check .pill { margin-left: .35rem; vertical-align: middle; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }

/* ---- v5: phiếu theo mẫu ---- */
.scale.wrap { display: flex; flex-wrap: wrap; }
.scale.wrap button { min-height: 40px; }
.scale.wrap button { min-width: 44px; flex: 0 0 auto; padding: .35rem .5rem; }
.scale button.tru.on { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }
.scale button[data-v="0"].on { background: var(--bad-soft); color: var(--bad); border-color: var(--bad); }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; margin-top: .35rem; }
.seg button { border: 0; background: var(--card); padding: .45rem .7rem; font: inherit; font-size: .85rem; color: var(--muted); cursor: pointer; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--good-soft); color: var(--good); font-weight: 600; }
.seg button.on.tot { background: var(--good-soft); color: var(--good); font-weight: 600; }
.seg button.on.chua_tot { background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.seg button.on.khong_lam { background: var(--bad-soft); color: var(--bad); font-weight: 600; }
.luoi { width: 100%; border-collapse: collapse; font-size: .8rem; }
.luoi th, .luoi td { border: 1px solid var(--line); padding: .3rem .35rem; text-align: center; }
.luoi th { background: var(--card-2); font-weight: 600; }
.luoi td.khung { text-align: left; white-space: nowrap; font-weight: 500; }
.luoi td.tot { background: var(--good-soft); color: var(--good); }
.luoi td.chua_tot { background: var(--warn-soft); color: var(--warn); font-weight: 700; }
.luoi td.khong_lam { background: var(--bad-soft); color: var(--bad); font-weight: 700; }
.luoi-wrap { overflow-x: auto; }
.mau-muc { display: grid; grid-template-columns: 56px 1fr 72px 32px 32px; gap: .4rem; align-items: center; padding: .3rem 0; border-top: 1px solid var(--line); }
.mau-muc input[type=text] { min-height: 38px; }
.mau-muc input[type=number] { min-height: 38px; text-align: right; }
.mau-muc .ic { border: 1px solid var(--line); background: var(--card); border-radius: 8px; min-height: 36px; cursor: pointer; font-size: .9rem; }
.mau-muc .ic.on { background: var(--accent-soft); border-color: var(--accent); }

/* Phân quyền */
table.pq td.c, table.pq th.c { text-align: center; white-space: nowrap; }
table.pq th .btn { font-weight: 600; }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
table.pq td:first-child { min-width: 170px; }
.chi-dt-khoi { display: none !important; }
@media (max-width: 720px) {   .chi-dt-khoi { display: grid !important; } .chi-mt { display: none !important; } }

/* Thẻ mẫu phiếu: nút Sửa/Ngừng dùng cố định góc phải, ngang hàng tên */
.mau-dau{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;margin-bottom:4px}
.mau-ten{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0;flex:1 1 auto}
.mau-ten h2{margin:0}
.mau-nut{display:flex;gap:6px;flex-shrink:0}
@media (max-width:600px){.mau-nut .btn.sm{padding:4px 8px;font-size:12px}.mau-dau{gap:6px}}

/* Phân quyền: nút đầu cột rõ ràng, cả cột bấm được */
table.pq .pq-nut{display:inline-flex;flex-direction:column;align-items:center;gap:1px;line-height:1.15;padding:5px 10px}
table.pq .pq-nut .pq-sua{font-size:11px;font-weight:500;color:var(--accent)}
table.pq.sua-duoc td[data-cot]{cursor:pointer}
table.pq .cot-sang{background:var(--accent-soft)}
table.pq th.cot-sang .pq-nut{border-color:var(--accent)}

/* Màn đăng nhập (mẫu A, bản cân đối): đầu màu thương hiệu căn giữa, tấm trắng chứa ô nhập */
:root { --brand: #003b45; --brand-2: #009189; --brand-vang: #ffcf00; }
body.dang-nhap #app.wrap { max-width: none; padding: 0; }
html:has(body.dang-nhap) { background: linear-gradient(var(--brand) 50%, var(--card) 50%); }
body.dang-nhap { background: linear-gradient(var(--brand) 50%, var(--card) 50%); }
.lg-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--card); }
.lg { flex: 1; display: flex; flex-direction: column; width: 100%; }
.lg-dau { background: var(--brand); color: #fff; text-align: center; padding: calc(36px + env(safe-area-inset-top, 0px)) 24px 64px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.lg-logo { width: 88px; height: 88px; border-radius: 22px; background: #fff; overflow: hidden; box-shadow: 0 12px 28px -14px rgba(0,0,0,.55); }
.lg-logo img { width: 100%; height: 100%; display: block; }
.lg-chao h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.lg-chao p { margin: 6px 0 0; font-size: 14px; color: #b9d6d6; }
.lg-than { position: relative; z-index: 1; margin-top: -32px; flex: 1; background: var(--card); border-radius: 28px 28px 0 0; padding: 28px 24px calc(20px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; }
.lg-tieude h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--fg); }
.lg-tieude p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.lg-f { display: flex; flex-direction: column; gap: 6px; }
.lg-f > span, .lg-f label { font-size: 13px; font-weight: 600; color: var(--fg); }
.lg-o { height: 52px; box-sizing: border-box; border: 1.5px solid var(--line-strong); border-radius: 14px; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--card); color: var(--muted); }
.lg-o:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(0,145,137,.15); }
.lg-o svg { width: 20px; height: 20px; flex-shrink: 0; }
.lg-o input { border: 0; outline: none; flex: 1; min-width: 0; height: 100%; font: inherit; font-size: 17px; font-weight: 500; color: var(--fg); background: transparent; padding: 0; }
.lg-pin { position: relative; }
.lg-pin input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; z-index: 1; caret-color: transparent; }
.lg-o6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.lg-o6 span { height: 52px; box-sizing: border-box; border: 1.5px solid var(--line-strong); border-radius: 12px; display: grid; place-items: center; font-size: 22px; color: var(--fg); background: var(--card); }
.lg-o6 span.dang { border: 2px solid var(--brand-2); background: rgba(0,145,137,.07); }
.lg-link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; font-weight: 600; color: var(--brand-2); cursor: pointer; }
.lg .btn.lg-nut { height: 52px; margin-top: 4px; border-radius: 14px; font-size: 16px; font-weight: 700; background: var(--brand); border-color: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.lg .btn.lg-nut svg { width: 18px; height: 18px; }
.lg .btn.lg-nut2 { height: 50px; border-radius: 14px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; }
.lg .btn.lg-nut2 svg { width: 20px; height: 20px; }
.lg-hoac { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.lg-hoac::before, .lg-hoac::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lg-chan { margin: auto 0 0; padding-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }
@media (min-width: 640px) {
  html:has(body.dang-nhap), body.dang-nhap { background: var(--bg); }
  .lg-wrap { background: var(--bg); align-items: center; justify-content: center; padding: 32px 16px; }
  .lg { flex: none; max-width: 400px; border-radius: 28px; overflow: hidden; background: var(--card); box-shadow: 0 24px 60px -24px rgba(0,59,69,.45); }
  .lg-dau { padding-top: 40px; }
  .lg-chan { margin-top: 4px; }
}

/* Dải "Đang xem như" (Quản lý hệ thống) */
.xem-nhu { position: relative; z-index: 60; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; background: #ffcf00; color: #3a2e00; font-size: 14px; }
.xem-nhu .btn { background: #fff; border-color: #e0b800; color: #3a2e00; flex-shrink: 0; }

/* Tự đánh giá: thẻ mời nổi bật khi đang mở mà cô chưa làm */
.card.tdg-moi { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* Mục "Không áp dụng" trong phiếu chấm điểm */
.na-btn { flex: none; align-self: flex-start; border: 1px solid var(--line-strong); background: var(--card); color: var(--muted); border-radius: 999px; font-size: .72rem; padding: .2rem .55rem; min-height: 28px; cursor: pointer; white-space: nowrap; }
.na-btn[aria-pressed="true"] { background: var(--card-2); color: var(--ink, inherit); border-color: var(--muted); font-weight: 600; }
.crit.na .scale { opacity: .35; }
.crit.na .q > span:not(.n) { color: var(--muted); }
.actionbar .btn { white-space: nowrap; flex: none; }
.note > .btn { flex: none; white-space: nowrap; }
/* Bảng chia nhóm theo lớp / bộ phận (Kết quả KPI, Chấm công) */
table.nhom-bang tr.nhom-dau th { position: static; background: var(--card-2); color: var(--ink, inherit); text-transform: none; letter-spacing: 0; font-size: .92rem; padding: .55rem .75rem; text-align: left; border-top: 1px solid var(--line); }
table.nhom-bang tr.nhom-dau th span:first-child { font-weight: 700; }
table.nhom-bang tr.nhom-dau th .muted { font-weight: 400; font-size: .8rem; }
table.nhom-bang td:first-child { min-width: 170px; }
