:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #18212f;
  --ink-2: #4a5568;
  --ink-3: #8a94a6;
  --line: #e3e8ef;
  --line-2: #eef1f6;
  --brand: #1f4fd1;
  --brand-ink: #ffffff;
  --brand-soft: #e8eefc;
  --side: #121a2b;
  --side-ink: #c8d0df;
  --side-active: #1f2a42;
  --ok: #12805c;
  --ok-soft: #e3f5ee;
  --warn: #a35b00;
  --warn-soft: #fff1dc;
  --bad: #c42b2b;
  --bad-soft: #fde8e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 20px 50px rgba(16, 24, 40, .25);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: Consolas, "Cascadia Mono", monospace; }
.hidden { display: none !important; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }

/* ---------- Buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: #f7f9fc; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #1a43b4; }
.btn.danger { color: var(--bad); border-color: #f2c4c4; }
.btn.danger:hover { background: var(--bad-soft); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }

label.field { display: grid; gap: 6px; font-weight: 550; color: var(--ink-2); font-size: 13px; }
label.field .hint { font-weight: 400; color: var(--ink-3); font-size: 12px; }
input[type=text], input[type=password], input[type=email], input[type=tel], input[type=date], input[type=search], select, textarea {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font: inherit; color: var(--ink); width: 100%;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .chip-toggle:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.check:hover { border-color: #c9d3e3; }
.check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--brand); }
.check.on { border-color: var(--brand); background: var(--brand-soft); }
.check .t { font-weight: 600; }
.check .d { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.radio-row { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-row label { display: flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 500; color: var(--ink); }

/* ---------- Login ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #dfe7fb 0, transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 32px 28px; display: grid; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; flex: none; }
.logo svg { width: 24px; height: 24px; }
.auth-brand .name { font-weight: 700; font-size: 17px; }
.auth-brand .sub { color: var(--ink-3); font-size: 12.5px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; height: 30px; border: 0; background: transparent; color: var(--brand); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0 10px; border-radius: 6px; }
.pw-wrap button:hover { background: var(--brand-soft); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 14px; color: #fff; }
.side .brand .name { font-weight: 700; }
.side .brand .sub { font-size: 12px; color: #8c97ad; }
.nav-group { padding: 8px 10px; }
.nav-group .label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #6f7b93; padding: 8px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--side-ink); font-size: 13.5px; }
.nav-item:hover { background: var(--side-active); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 #5b84ff; }
.nav-item .ico { width: 18px; text-align: center; opacity: .85; }
.nav-item .soon { margin-left: auto; font-size: 10.5px; background: #26324d; color: #9fb0d4; border-radius: 99px; padding: 1px 7px; }
.side .me { margin-top: auto; padding: 12px; border-top: 1px solid #1f2940; }
.me-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 8px; color: #fff; }
.me-card:hover { background: var(--side-active); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #3654b5; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.me-card .n { font-weight: 600; font-size: 13px; }
.me-card .u { font-size: 12px; color: #8c97ad; }
.side .logout { width: 100%; margin-top: 6px; background: transparent; border: 1px solid #2a3550; color: var(--side-ink); }
.side .logout:hover { background: var(--side-active); }

.topbar { display: none; }
.main { padding: 24px 28px 48px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-3); font-size: 13px; margin-bottom: 8px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.card-head .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 18px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2 > .card + .card { margin-top: 0; }

/* ---------- Toolbar & table ---------- */
.toolbar { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.toolbar input[type=search] { max-width: 320px; }
.toolbar select, .toolbar input[type=date] { width: auto; min-width: 150px; }
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .03em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #f8faff; }
.tbl .who { display: flex; gap: 10px; align-items: center; }
.tbl .who .n { font-weight: 600; }
.tbl .who .u { color: var(--ink-3); font-size: 12.5px; }
.empty { padding: 36px; text-align: center; color: var(--ink-3); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: 13px; gap: 10px; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 6px; background: var(--brand-soft); color: #1b3a99; font-size: 12.5px; font-weight: 550; }
.chip.admin { background: #1b2540; color: #fff; }

/* ---------- Stats / dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat { padding: 16px 18px; }
.stat .k { color: var(--ink-3); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.mod-tile { display: flex; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.mod-tile:hover { border-color: #b9c7e6; text-decoration: none; background: #fbfcff; }
.mod-tile .ico { width: 38px; height: 38px; border-radius: 9px; background: var(--brand-soft); display: grid; place-items: center; font-size: 18px; flex: none; }
.mod-tile .t { font-weight: 600; }

/* ---------- Detail ---------- */
.profile { display: flex; gap: 14px; align-items: center; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px 14px; font-size: 13.5px; }
.kv .k { color: var(--ink-3); }
.kv .v { overflow-wrap: anywhere; }
.role-list { display: grid; gap: 8px; }
.notice { display: block; padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); color: #6d3d00; font-size: 13px; }
.notice.info { background: var(--brand-soft); color: #1b3a99; }
.notice.bad { background: var(--bad-soft); color: #8a1f1f; }

/* ---------- Permission matrix ---------- */
.perm-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); padding: 10px 18px; border-bottom: 1px solid var(--line-2); background: #fafbfd; }
.perm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.perm-group { border-bottom: 1px solid var(--line-2); }
.perm-group:last-child { border-bottom: 0; }
.perm-group-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; background: #f7f9fc; flex-wrap: wrap; }
.perm-group-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); }
.perm-group-head .tools { display: flex; gap: 6px; flex-wrap: wrap; }
.perm-row { display: grid; grid-template-columns: 200px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 18px; border-top: 1px solid var(--line-2); }
.perm-row .mod { font-weight: 600; }
.perm-row .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; user-select: none;
}
.chip-toggle .mark { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid #b5c0d3; display: grid; place-items: center; font-size: 10px; line-height: 1; color: #fff; flex: none; }
.chip-toggle.on { border-color: #9fb6ef; background: var(--brand-soft); color: #173595; }
.chip-toggle.on .mark { background: var(--brand); border-color: var(--brand); }
.chip-toggle.on .mark::after { content: "✓"; }
.chip-toggle:disabled { cursor: default; }
.chip-toggle.ro { cursor: default; }
/* Chế độ quyền riêng của người dùng */
.chip-toggle.inherit.on { border-style: dashed; background: #f3f6fd; }
.chip-toggle.allow { border-color: #8fd1b6; background: var(--ok-soft); color: #0c5c41; }
.chip-toggle.allow .mark { background: var(--ok); border-color: var(--ok); }
.chip-toggle.allow .mark::after { content: "+"; font-weight: 800; }
.chip-toggle.deny { border-color: #f0b3b3; background: var(--bad-soft); color: #8a1f1f; text-decoration: line-through; }
.chip-toggle.deny .mark { background: var(--bad); border-color: var(--bad); }
.chip-toggle.deny .mark::after { content: "×"; font-weight: 800; }
.perm-row .row-tools { display: flex; gap: 4px; }

/* ---------- Modal / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 22, 38, .45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.modal-body { padding: 18px 20px; overflow-y: auto; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line-2); }
.secret { display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 10px; background: #0f172a; color: #fff; }
.secret .mono { font-size: 20px; letter-spacing: .08em; flex: 1; overflow-wrap: anywhere; }
#toast-root { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: #111827; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-lg); max-width: 380px; font-size: 13.5px; }
.toast.bad { background: #9b1c1c; }
.toast.ok { background: #0f6b4c; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .shell.nav-open .scrim { position: fixed; inset: 0; background: rgba(15, 22, 38, .4); z-index: 30; display: block; }
  .scrim { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .topbar .t { font-weight: 650; }
  .main { padding: 16px 16px 40px; }
  .perm-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 110px minmax(0, 1fr); }
  .toolbar input[type=search], .toolbar select, .toolbar input[type=date] { max-width: none; flex: 1 1 140px; }
  .tbl .hide-m { display: none; }
}
@media (min-width: 861px) { .scrim { display: none; } }
.modal-body > form { display: grid; gap: 14px; }

/* ---------- Nhà cung cấp ---------- */
.stars { color: #e0a000; letter-spacing: 1px; white-space: nowrap; }
.stars .off { color: #d5dbe6; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form { display: grid; gap: 10px; border-bottom: 1px solid var(--line-2); }
.timeline { padding: 4px 0; }
.tl-item { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.tl-item:last-child { border-bottom: 0; }
.tl-meta { color: var(--ink-3); font-size: 12.5px; margin-bottom: 4px; }
.page-head .sub .badge { vertical-align: middle; }

/* ---------- Nhật ký ---------- */
.nowrap { white-space: nowrap; }
pre.raw { background: #0f172a; color: #e2e8f0; padding: 12px; border-radius: 8px; font-size: 12px; overflow-x: auto; max-height: 320px; margin: 8px 0 0; }
details summary { cursor: pointer; }
#a-target-note .notice { margin: 10px 14px 0; }

/* Ô số liệu trong lưới không bị đẩy lệch bởi quy tắc .card + .card */
.stats > .card, .grid-2 > .card { margin-top: 0; }
.stats .stat .pbar { margin-top: 10px; }
.grid-2 + .card, .card + .grid-2, .grid-2 + .grid-2, .card + .stats { margin-top: 16px; }
.nav-item .soon { white-space: nowrap; flex: none; }
.stat { display: block; color: var(--ink); }
a.stat:hover { text-decoration: none; border-color: #b9c7e6; }

/* ---------- Kế hoạch & Báo cáo ---------- */
.tabs { display: flex; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tab { padding: 10px 16px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 8px 8px 0 0; }
.tab:hover { text-decoration: none; color: var(--ink); background: var(--line-2); }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.mt { margin-top: 14px; }
.legend { align-self: center; }
.toolbar > .btn { height: 38px; }
.pbar { position: relative; height: 8px; background: var(--line-2); border-radius: 99px; min-width: 80px; margin-top: 8px; }
.pfill { height: 100%; width: 0; background: var(--brand); border-radius: 99px; transition: width .3s; }
.pfill.full { background: var(--ok); }
.pmark { position: absolute; top: -3px; width: 2px; height: 14px; background: #f59e0b; border-radius: 2px; margin-left: -1px; }
.big-pct { font-size: 38px; font-weight: 750; line-height: 1; margin-bottom: 6px; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); }
.card > .task:first-of-type, .card-head + .task { border-top: 0; }
.task-main { flex: 1; min-width: 0; }
.task-main .muted.small { margin-top: 2px; }
.task-title { font-weight: 600; color: var(--ink); }
.task.is-done .task-title { color: var(--ink-3); text-decoration: line-through; }
.task-check { width: 18px; height: 18px; accent-color: var(--ok); flex: none; }
.task-pct { min-width: 40px; font-weight: 700; color: var(--ink-2); font-size: 13px; text-align: center; }
.task-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.quick-add { display: flex; gap: 8px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.quick-add input[type=text] { flex: 2 1 260px; }
.quick-add select { flex: 1 1 180px; width: auto; }
.lvl { display: inline-grid; place-items: center; min-width: 28px; height: 22px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 700; color: #fff; flex: none; vertical-align: middle; }
.lvl-strategy { background: #6d28d9; } .lvl-year { background: #1d4ed8; } .lvl-quarter { background: #0e7490; }
.lvl-month { background: #047857; } .lvl-week { background: #b45309; } .lvl-day { background: #64748b; }
.tree { padding: 4px 0; }
.trow { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line-2); }
.tree > .tnode:first-child > .trow { border-top: 0; }
.trow.depth-1 { padding-left: 40px; } .trow.depth-2 { padding-left: 64px; } .trow.depth-3 { padding-left: 88px; }
.trow.depth-4 { padding-left: 112px; } .trow.depth-5 { padding-left: 136px; }
.tcaret { width: 26px; height: 26px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); border-radius: 6px; flex: none; font-size: 16px; line-height: 1; }
.tcaret:hover { background: var(--line-2); }
.tcaret.leaf { cursor: default; color: var(--ink-3); }
.tmain { flex: 1; min-width: 0; }
.tmain .muted.small { margin-top: 2px; }
.ttitle { font-weight: 600; color: var(--ink); }
.tprog { width: 160px; flex: none; display: flex; align-items: center; gap: 10px; }
.tprog .pbar { flex: 1; margin-top: 0; }
.tside { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; min-width: 120px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 10px; line-height: 1.6; }
.sub-head { padding: 14px 18px 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; }
.card > .empty { padding: 28px 18px; }
.rblock { padding: 12px 0; border-top: 1px dashed var(--line); }
.rblock:first-child { border-top: 0; padding-top: 0; }
.rblock:last-child { padding-bottom: 0; }
.rhead { margin-bottom: 6px; line-height: 1.6; }
.rhead .badge { margin-left: 4px; }
.rlist { margin: 6px 0 0; padding-left: 20px; line-height: 1.55; }
.rlist li { margin: 4px 0; }
.rsec { margin-bottom: 18px; }
.rsec:last-child { margin-bottom: 0; }
.rsec-k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 650; margin-bottom: 6px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 4px; }
.rq { padding: 14px 18px; border-top: 1px solid var(--line-2); }
.card-head + .rq { border-top: 0; }
.rq-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; margin-bottom: 10px; flex-wrap: wrap; }
.chip.wait { background: var(--warn-soft); color: var(--warn); }
.chip.late { background: var(--bad-soft); color: var(--bad); }
.act-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 160px auto; gap: 8px; margin: 8px 0; align-items: center; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.org .okids { margin-left: 22px; padding-left: 16px; border-left: 2px solid var(--line); }
.orow { display: flex; align-items: center; gap: 12px; padding: 10px 0; flex-wrap: wrap; }
.omain { flex: 1; min-width: 160px; }
.orow select { width: auto; height: 34px; margin-left: 6px; }
.report-body { font-size: 14.5px; line-height: 1.6; }
.report-body .kv { margin-bottom: 18px; }
.card-body.muted.small { padding-top: 10px; padding-bottom: 14px; }
.print-head h2 { margin-bottom: 4px; }
@media (max-width: 860px) {
  .trow { flex-wrap: wrap; row-gap: 6px; }
  .tmain { flex: 1 1 180px; }
  .tprog { flex: 1 1 140px; width: auto; margin-left: 66px; }
  .tside { min-width: 0; }
  .task-main { flex: 1 1 180px; }
  .task .tprog { margin-left: 0; }
  .trow.depth-1, .trow.depth-2, .trow.depth-3, .trow.depth-4, .trow.depth-5 { padding-left: 16px; }
  .act-row { grid-template-columns: minmax(0, 1fr); }
  .task { flex-wrap: wrap; }
  .tab { padding: 9px 12px; }
}
@media print {
  .side, .topbar, .no-print, #toast-root { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Chỉ tiêu (KPI) ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.grid-3 > .card { margin-top: 0; }
.grid-3 + .card { margin-top: 16px; }
.kpi-tbl td { vertical-align: middle; }
.kpi-pct { min-width: 150px; }
.kpi-pct .pbar { display: inline-block; width: 90px; vertical-align: middle; margin: 0 8px 0 0; }
.excl-box { border: 1px dashed var(--line); border-radius: 10px; padding: 12px; display: grid; gap: 12px; }
.badge.excl { background: #ede9fe; color: #5b21b6; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }

.check-inline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; color: var(--ink); }
.check-inline input { width: 16px; height: 16px; accent-color: var(--brand); }
.toolbar .check-inline { align-self: center; }
.kpi-tbl td:first-child { min-width: 260px; }
.kpi-tbl td:nth-child(5) { min-width: 120px; }
.kpi-tbl { table-layout: fixed; min-width: 880px; }
.kpi-tbl th:nth-child(1) { width: 32%; } .kpi-tbl th:nth-child(2) { width: 11%; } .kpi-tbl th:nth-child(3) { width: 12%; }
.kpi-tbl th:nth-child(4) { width: 17%; } .kpi-tbl th:nth-child(5) { width: 13%; } .kpi-tbl th:nth-child(6) { width: 15%; }
.kpi-tbl td:first-child { min-width: 0; }

/* ---------- Tệp đính kèm ---------- */
.att-pick { cursor: pointer; }
.att-pick input { display: none; }
.card-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.att-tag { width: auto; height: 36px; }
.att-drop { margin: 14px 18px 0; padding: 16px; border: 2px dashed var(--line); border-radius: 10px; text-align: center; color: var(--ink-3); font-size: 13px; }
.att-drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.att-status { margin: 10px 18px 0; padding: 8px 12px; border-radius: 8px; background: var(--brand-soft); color: #1b3a99; font-size: 13px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; padding: 14px 18px; }
.att-img { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.att-thumb { display: block; width: 100%; aspect-ratio: 4 / 3; padding: 0; border: 0; background: var(--line-2); cursor: zoom-in; }
.att-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-img figcaption { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 6px; padding: 8px 8px 8px 10px; align-items: center; }
.att-img figcaption .muted { grid-column: 1; }
.att-img figcaption .btn { grid-column: 2; grid-row: 1 / span 2; }
.att-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-ico { font-size: 22px; width: 28px; text-align: center; flex: none; }
.att-file .task-title { overflow-wrap: anywhere; }
.lightbox-img { max-width: 100%; max-height: 70vh; display: block; margin: 0 auto; border-radius: 8px; }
.att-title { line-height: 1.5; }
.att-title .badge { margin-left: 4px; vertical-align: middle; }
.att-note { margin-top: 3px; color: var(--ink-2); }
.att-actions { gap: 8px; }
.att-ask { padding: 12px 0; border-top: 1px dashed var(--line); }
.att-ask:first-child { border-top: 0; padding-top: 0; }
.modal-foot .spacer { flex: 1; }
.att-img figcaption { grid-template-columns: minmax(0, 1fr); }
.att-img figcaption .muted .badge { margin-right: 4px; }

/* ---------- Kho tài liệu & bộ lọc tệp ---------- */
.chip-filters, .att-filter { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chip-filters { margin-bottom: 14px; }
.att-filter { padding: 12px 18px 0; }
.att-filter .att-q { flex: 1 1 200px; max-width: 320px; height: 34px; margin-left: auto; }
.fchip { height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); font: inherit; font-size: 13px; cursor: pointer; }
.fchip b { margin-left: 4px; color: var(--ink); }
.fchip:hover { border-color: #b9c7e6; }
.fchip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.fchip.on b { color: #fff; }
.lib-row .att-title { margin-bottom: 2px; }
.lib-thumb { width: 56px; height: 42px; border-radius: 6px; overflow: hidden; flex: none; background: var(--line-2); }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Yêu cầu NCC & chuông thông báo ---------- */
.bell { position: relative; margin-left: auto; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; font-size: 18px; display: grid; place-items: center; flex: none; }
.side .bell:hover { background: var(--side-active); }
.topbar .bell:hover { background: var(--line-2); }
.bell-n { position: absolute; top: -2px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.bell.has-danger .bell-n { background: var(--bad); }
.bell-list { display: grid; gap: 4px; margin: -6px -8px; }
.bell-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 8px; border-radius: 8px; color: var(--ink); }
.bell-item:hover { background: var(--line-2); text-decoration: none; }
.req-row { cursor: pointer; }
.req-row:hover { background: #f8faff; }
.req-row .task-title { font-weight: 600; color: var(--ink); }
.req-row .task-side { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.req-last { margin-top: 4px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 640px; }
.req-more { padding: 8px 18px; border-top: 1px solid var(--line-2); }
.req-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.req-title { font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.req-status { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.req-reply { display: grid; gap: 10px; }
.req-reply textarea { min-height: 84px; }
.req-reply .seg { display: flex; gap: 18px; flex-wrap: wrap; }
.req-reply .seg label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-weight: 550; }
.req-reply .seg input { width: auto; }
.req-reply-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.req-reply-foot select { width: auto; min-width: 190px; margin-left: 6px; }
.req-tl { border: 1px solid var(--line-2); border-radius: 8px; }
.req-tl .empty { padding: 16px; }
.req-tl .tl-item.is-resp { background: #f3f7ff; }
.modal h3 { font-size: 14px; margin: 18px 0 8px; }
.tab .badge.plain { height: 18px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
@media (max-width: 860px) { .req-row { flex-wrap: wrap; } .req-row .task-side { justify-content: flex-start; } }

/* ---------- Hàng hóa ---------- */
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats.stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat .v.ok-t { color: var(--ok); }
.stat .v.bad-t { color: var(--bad); }
table.tbl td.num, table.tbl th.num { text-align: right; white-space: nowrap; }
tr.is-off td { opacity: .6; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.modal .seg { display: flex; gap: 18px; flex-wrap: wrap; }
.modal .seg input { width: auto; }
@media (max-width: 860px) { .stats.stats-3, .stats.stats-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.im-tpl { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.form-sep { font-weight: 650; color: var(--ink-2); border-top: 1px solid var(--line-2); padding-top: 10px; margin-top: 4px; }
.input-pair { display: flex; gap: 8px; }
.input-pair select { width: 96px; flex: none; }
.sup-tbl td:first-child { min-width: 220px; }
