/* app.css — AI Office · Phân hệ Nhiệm vụ
   Hiện thực token §1 đặc tả dự án (Ant + CMC TS theme), Direction A — Government Classic.
   Token có tên cho mọi giá trị thị giác (R-012/R-047). */

:root {
  /* brand / primary */
  --c-primary: #2599dc; --c-primary-hover: #1987c7; --c-primary-active: #1a73c4;
  --c-primary-bg: rgba(37,153,220,.10); --c-primary-bg-h: rgba(37,153,220,.16);
  --navy: #002060;

  /* text */
  --text: #333; --text-heading: #2f3d4c; --text-secondary: #5f6b78; --text-tertiary: #8a929d; --text-disabled: #aab1ba;
  /* surfaces */
  --bg: #ffffff; --bg-container: #ffffff; --bg-elevated: #fcfcfd; --bg-layout: #f5f7f9; --bg-spotlight: #eef1f4;
  --border: #e9edf1; --border-secondary: #eef1f4; --border-strong: #dce1e7;

  /* status (classic — AA-safe text) */
  --st-neutral: #5b6472; --st-info: #0e7f90; --st-primary: #1a73c4; --st-warning: #9c5d00;
  --st-success: #4f7d13; --st-muted: #6b7280; --st-error: #c0392b; --st-softred: #b03a57;

  /* priority */
  --prio-low: #8a93a0; --prio-normal: #2f6fb0; --prio-high: #b15c12; --prio-urgent: #c0392b;

  /* spacing / radius / shadow / motion */
  --r-sm: 4px; --r-md: 6px; --r-lg: 8px; --r-xl: 12px;
  --sh-1: 0 1px 2px rgba(20,30,45,.05); --sh-2: 0 2px 8px rgba(20,30,45,.08);
  --sh-3: 0 4px 16px rgba(20,30,45,.10); --sh-4: 0 12px 32px rgba(15,25,40,.16);
  --ease: cubic-bezier(.4,0,.2,1); --ease-out: cubic-bezier(0,0,.2,1);
  --font: 'Roboto','Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
  --font-heading: 'Roboto', sans-serif;

  /* density (comfortable default) */
  --row-py: 14px; --row-gap: 8px; --side-py: 8px;
}
:root[data-density="compact"] { --row-py: 9px; --row-gap: 5px; --side-py: 6px; }

:root[data-palette="vivid"] {
  --st-neutral: #475569; --st-info: #0891b2; --st-primary: #2599dc; --st-warning: #d97706;
  --st-success: #65a30d; --st-muted: #64748b; --st-error: #dc2626; --st-softred: #db5a78;
  --prio-high: #ea580c; --prio-urgent: #dc2626; --prio-normal: #2563eb;
}

:root[data-theme="dark"] {
  --c-primary: #44a2d7; --c-primary-hover: #5ab2e0; --c-primary-active: #6bbce6;
  --c-primary-bg: rgba(68,162,215,.16); --c-primary-bg-h: rgba(68,162,215,.24);
  --navy: #16244a;
  --text: #e6e8eb; --text-heading: #f0f2f5; --text-secondary: #9ba3b0; --text-tertiary: #7a8290; --text-disabled: #5a6473;
  --bg: #131825; --bg-container: #1b2130; --bg-elevated: #222a3b; --bg-layout: #0f1420; --bg-spotlight: #283146;
  --border: #2a3344; --border-secondary: #232b3a; --border-strong: #364154;
  --st-neutral: #9ba3b0; --st-info: #3bc0d6; --st-primary: #5ab2e0; --st-warning: #ffb84d;
  --st-success: #95d33a; --st-muted: #8b94a3; --st-error: #e57373; --st-softred: #e88aa0;
  --prio-low: #8b94a3; --prio-normal: #5a9be0; --prio-high: #f59e4b; --prio-urgent: #e57373;
  --sh-2: 0 2px 8px rgba(0,0,0,.32); --sh-3: 0 4px 16px rgba(0,0,0,.40); --sh-4: 0 14px 34px rgba(0,0,0,.5);
}
:root[data-theme="dark"][data-palette="vivid"] {
  --st-info: #22d3ee; --st-success: #a3e635; --st-warning: #fbbf24; --st-error: #f87171; --st-primary: #44a2d7;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg-layout); -webkit-font-smoothing: antialiased;
}
#root { height: 100%; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--c-primary-bg-h); }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-tertiary) 35%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-tertiary) 55%, transparent); background-clip: padding-box; }

h1,h2,h3,h4 { font-family: var(--font-heading); color: var(--text-heading); margin: 0; }

/* ===================== SHELL ===================== */
.shell { display: grid; grid-template-columns: 240px 1fr; height: 100vh; overflow: hidden; }
.shell.nav-collapsed { grid-template-columns: 70px 1fr; }
/* [TẠM 2026-07-22] Ẩn sidebar shell mockup (cờ SHOW_SHELL_CHROME=false — Chrome.tsx). */
.shell.no-nav { grid-template-columns: 1fr; }

/* ===== Navy main nav (collapsible) — Direction A ===== */
.navbar { min-width: 0; overflow: hidden; background: linear-gradient(180deg, #0c1c3f 0%, #0a1730 100%);
  display: flex; flex-direction: column; color: #aeb9d0; position: relative; z-index: 30; }
:root[data-theme="dark"] .navbar { background: linear-gradient(180deg, #0a1322 0%, #080f1c 100%); border-right: 1px solid var(--border); }
.nav-brand { display: flex; align-items: center; gap: 11px; padding: 15px 16px; border-bottom: 1px solid rgba(255,255,255,.07); position: relative; }
.nav-logo { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #2599dc, #1a73c4); color: #fff;
  font-weight: 700; font-size: 13.5px; display: grid; place-items: center; flex-shrink: 0; letter-spacing: .5px; box-shadow: 0 3px 10px rgba(37,153,220,.35); }
.nav-brand-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.nav-brand-name { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; }
.nav-brand-sub { font-size: 11.5px; color: #8593b0; white-space: nowrap; }
.nav-collapse-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; margin-top: 8px; border: 0; background: transparent;
  color: #8593b0; border-radius: 8px; font-size: 13px; font-weight: 500; text-align: left; transition: background .13s, color .13s; }
.nav-collapse-btn:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-collapse-btn svg { flex-shrink: 0; }

.nav-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 8px; }
.nav-scroll::-webkit-scrollbar { width: 6px; }
.nav-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); }
.nav-section { margin-bottom: 16px; }
.nav-section-label { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #5e6e92; padding: 6px 12px 5px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border: 0; background: transparent;
  color: #aeb9d0; border-radius: 8px; font-size: 13.5px; text-align: left; transition: background .13s, color .13s; position: relative; margin-bottom: 4px; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(37,153,220,.18); color: #fff; font-weight: 500; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: #2599dc; }
.nav-item-ic { display: grid; place-items: center; flex-shrink: 0; color: #93a2c2; }
.nav-item:hover .nav-item-ic, .nav-item.active .nav-item-ic { color: #5bb3e8; }
.nav-item-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { font-size: 11px; font-weight: 700; color: #fff; background: #e2683f; border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; line-height: 1.5; }

.nav-foot { border-top: 1px solid rgba(255,255,255,.07); padding: 10px 12px 12px; }
.nav-stats { display: flex; flex-direction: column; gap: 7px; padding: 6px 8px 12px; }
.nav-stat { display: flex; align-items: center; justify-content: space-between; font-size: 12px; }
.nav-stat-label { color: #8593b0; white-space: nowrap; }
.nav-stat-val { font-weight: 600; color: #cdd6e6; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nav-stat-val.tone-error { color: #ef8a7a; }
.nav-stat-val.tone-success { color: #9ad34a; }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 9px; text-decoration: none; cursor: pointer; }
.nav-user:hover { background: rgba(255,255,255,.06); }
.nav-user-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.nav-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-user-role { font-size: 11px; color: #8593b0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* collapsed — width driven by .shell grid track; these handle inner reflow only */
.nav-collapsed .navbar { min-width: 0; }
.nav-collapsed .nav-brand { justify-content: center; padding: 15px 0; }
.nav-collapsed .nav-brand-txt { display: none; }
.nav-collapsed .nav-section-label { display: none; }
.nav-collapsed .nav-section { margin-bottom: 6px; padding-bottom: 6px; }
.nav-collapsed .nav-section:not(:last-child) { border-bottom: 1px solid rgba(255,255,255,.05); }
.nav-collapsed .nav-item { justify-content: center; padding: 11px 0; gap: 0; }
.nav-collapsed .nav-item-label, .nav-collapsed .nav-badge { display: none; }
.nav-collapsed .nav-stats { display: none; }
.nav-collapsed .nav-user { justify-content: center; padding: 9px 0; }
.nav-collapsed .nav-user-txt { display: none; }
.nav-collapsed .nav-collapse-btn { justify-content: center; padding: 11px 0; gap: 0; }
.nav-collapsed .nav-collapse-btn .nav-item-label { display: none; }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }

/* top strip */
.topstrip { height: 56px; flex-shrink: 0; background: var(--bg-container); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 16px; z-index: 20; }
.crumb { display: flex; align-items: center; gap: 7px; font-size: 13px; min-width: 0; }
.crumb-tenant { font-weight: 600; color: var(--navy); white-space: nowrap; }
:root[data-theme="dark"] .crumb-tenant { color: var(--c-primary); }
.crumb-sep { color: var(--text-disabled); flex-shrink: 0; }
.crumb-mod { color: var(--text-secondary); white-space: nowrap; }
.crumb-cur { color: var(--text-heading); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topstrip-right { display: flex; align-items: center; gap: 6px; }
.search-box { display: flex; align-items: center; gap: 7px; background: var(--bg-layout); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0 9px; height: 36px; width: 270px; transition: border-color .15s; }
.search-box:focus-within { border-color: var(--c-primary); background: var(--bg-container); }
.search-ic { color: var(--text-tertiary); }
.search-input { flex: 1; border: 0; background: transparent; outline: none; color: var(--text); font-size: 13px; min-width: 0; }
.search-input::placeholder { color: var(--text-tertiary); }
.kbd { font-size: 11px; color: var(--text-tertiary); border: 1px solid var(--border-strong); border-radius: 4px; padding: 1px 5px; }
.me-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 4px; border-radius: 999px; margin-left: 4px; }
.me-chip:hover { background: var(--bg-layout); }
.me-info { display: flex; flex-direction: column; line-height: 1.2; }
.me-name { font-size: 12.5px; font-weight: 600; color: var(--text-heading); white-space: nowrap; }
.me-role { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; }
.me-chip { flex-shrink: 0; }
.bell { position: relative; }
.bell-dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--st-error); border: 1.5px solid var(--bg-container); }

.work { flex: 1; display: flex; overflow: hidden; min-height: 0; }

/* ===================== SIDEBAR ===================== */
.side { width: 288px; flex-shrink: 0; background: var(--bg-container); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 10px 9px 24px; }
.side-section { margin-bottom: 20px; }
.side-h { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-tertiary);
  padding: 5px 10px; }
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.side-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px 9px; border: 0; background: transparent;
  border-radius: var(--r-md); color: var(--text-secondary); font-size: 13px; font-weight: 500; text-align: left; transition: all .12s var(--ease); }
.side-item:hover { background: var(--bg-layout); color: var(--text-heading); }
.side-item.active { background: var(--c-primary-bg); color: var(--c-primary-active); font-weight: 600; }
.side-item.active .side-ic { color: var(--c-primary); }
.side-ic { color: var(--text-tertiary); flex-shrink: 0; }
.side-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-count { font-size: 11.5px; color: var(--text-tertiary); background: var(--bg-spotlight); border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center; font-weight: 600; }
.side-item.active .side-count { background: color-mix(in srgb, var(--c-primary) 18%, transparent); color: var(--c-primary-active); }

.side-tree { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.side-tree li { list-style: none; }
.tree-node { display: flex; align-items: center; gap: 2px; border-radius: var(--r-md); }
.tree-node.active, .tree-node.child.active { background: var(--c-primary-bg); }
.tree-caret { border: 0; background: transparent; color: var(--text-tertiary); padding: 6px 2px 6px 6px; display: grid; place-items: center; border-radius: 4px; }
.tree-caret:hover { color: var(--text-heading); }
.tree-label-btn, .tree-node.child { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: transparent;
  color: var(--text-secondary); font-size: 12.5px; font-weight: 500; text-align: left; border-radius: var(--r-md); transition: all .12s; min-width: 0; }
.tree-label-btn:hover { color: var(--text-heading); }
.tree-node.active .tree-label-btn, .tree-node.child.active { color: var(--c-primary-active); font-weight: 600; }
.tree-ic { color: var(--text-tertiary); flex-shrink: 0; }
.tree-node.active .tree-ic { color: var(--c-primary); }
.tree-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-children { list-style: none; margin: 2px 0 3px; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 3px; }
.tree-node.child { width: 100%; padding-left: 10px; padding-right: 0; }
.tree-node.child:hover { background: var(--bg-layout); }

/* ===================== CONTENT ===================== */
.content { flex: 1; overflow-y: auto; padding: 22px 22px 60px; min-width: 0; min-height: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head-l { flex: 1; min-width: 0; }
.page-title { font-size: 22px; font-weight: 600; line-height: 1.25; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-top: 3px; display: inline-block; white-space: nowrap; }
.page-head-r { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.seg { display: flex; background: var(--bg-spotlight); border-radius: var(--r-md); padding: 2px; gap: 2px; }
.seg-btn { border: 0; background: transparent; color: var(--text-tertiary); padding: 6px 9px; border-radius: 4px; display: grid; place-items: center; transition: all .13s; }
.seg-btn:hover { color: var(--text-heading); }
.seg-btn.on { background: var(--bg-container); color: var(--c-primary); box-shadow: var(--sh-1); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border-strong); background: var(--bg-container); color: var(--text-secondary); font-size: 12.5px;
  padding: 5px 12px; border-radius: 999px; transition: all .13s; font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--c-primary); color: var(--c-primary-active); }
.chip.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

/* ===================== BUTTONS / TAGS ===================== */
.btn { display: inline-flex; align-items: center; gap: 7px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 500;
  padding: 8px 15px; border: 1px solid transparent; transition: all .15s var(--ease); white-space: nowrap; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--c-primary); color: #fff; box-shadow: var(--sh-1); }
.btn-primary:hover { background: var(--c-primary-hover); }
.btn-default { background: var(--bg-container); color: var(--text-heading); border-color: var(--border-strong); }
.btn-default:hover { border-color: var(--c-primary); color: var(--c-primary-active); }
.btn-text { background: transparent; color: var(--text-secondary); }
.btn-text:hover { background: var(--bg-layout); color: var(--text-heading); }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover, .btn.is-disabled:hover { background: var(--c-primary); border-color: transparent; }
.btn-default:disabled:hover { background: var(--bg-container); border-color: var(--border-strong); color: var(--text-heading); }
.icon-btn { width: 36px; height: 36px; border: 0; background: transparent; color: var(--text-secondary); border-radius: var(--r-md);
  display: grid; place-items: center; transition: all .13s; }
.icon-btn:hover { background: var(--bg-layout); color: var(--text-heading); }

.tag { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; white-space: nowrap; line-height: 1.3; }
.prio-badge { display: inline-grid; place-items: center; }
.src-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary);
  background: var(--bg-layout); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 600; flex-shrink: 0; line-height: 1; }
.avatar.more { background: var(--bg-spotlight); color: var(--text-secondary); }
.avatar-stack { display: inline-flex; align-items: center; }

.progress-wrap { display: inline-flex; align-items: center; gap: 8px; }
.progress-track { flex: 1; background: var(--bg-spotlight); border-radius: 999px; overflow: hidden; }
.progress-fill { display: block; height: 100%; border-radius: 999px; transition: width .5s var(--ease); }
.progress-label { font-size: 12px; font-weight: 600; min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }

/* tone helpers */
.tone-error { color: var(--st-error); } .tone-warning { color: var(--st-warning); }
.tone-success { color: var(--st-success); } .tone-muted { color: var(--text-tertiary); }
.tone-primary { color: var(--st-primary); } .tone-neutral { color: var(--text-secondary); }

/* ===================== TASK LIST ===================== */
.list-head { display: grid; grid-template-columns: 1fr 128px 168px 116px 116px 34px; gap: 10px; align-items: center;
  padding: 4px 14px 6px; }
.lh-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; padding: 4px 0;
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); transition: color .12s; }
.lh-btn:hover { color: var(--text-secondary); }
.lh-btn.sorted { color: var(--c-primary-active); }
.lh-arrow { opacity: 0; color: var(--text-disabled); transition: opacity .12s; }
.lh-btn:hover .lh-arrow { opacity: .6; }
.lh-arrow.on { opacity: 1; color: var(--c-primary); }

/* unread / read */
.task-row.unread .tr-title { font-weight: 700; color: var(--text-heading); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-primary); flex-shrink: 0; }

/* filter panel */
.filter-panel { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; box-shadow: var(--sh-1); }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.ffield { display: flex; flex-direction: column; gap: 5px; }
.ffield-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.ffield .input { width: 100%; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a929d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; padding-right: 30px; cursor: pointer; }
.filter-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-secondary); }
.filter-result { font-size: 12.5px; color: var(--text-secondary); margin-right: auto; }
.filter-count { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin-left: 2px; font-size: 10.5px; font-weight: 700; color: #fff; background: var(--c-primary); border-radius: 999px; }
.btn.on-filter { border-color: var(--c-primary); color: var(--c-primary-active); }

/* pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pg-info { font-size: 12.5px; color: var(--text-secondary); }
.pg-info b { color: var(--text-heading); font-variant-numeric: tabular-nums; }
.pg-controls { display: flex; align-items: center; gap: 5px; }
.pg-size { height: 34px; padding: 0 28px 0 10px; font-size: 12.5px; }
.pg-btn { min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid var(--border-strong); background: var(--bg-container); color: var(--text-secondary);
  border-radius: var(--r-md); font-size: 13px; font-weight: 600; display: grid; place-items: center; transition: all .12s; font-variant-numeric: tabular-nums; }
.pg-btn:hover:not(:disabled) { border-color: var(--c-primary); color: var(--c-primary-active); }
.pg-btn.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-ellipsis { color: var(--text-tertiary); padding: 0 2px; }

/* crumb link */
.crumb-link { color: var(--text-secondary); text-decoration: none; }
.crumb-link:hover { color: var(--c-primary-active); }

/* ===================== DETAIL PAGE (bản tách riêng) ===================== */
.detail-page { max-width: none; }
.dp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 6px; }
.dp-head-main { min-width: 0; flex: 1; }
.dp-badges { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 11px; }
.dp-title { font-size: 23px; font-weight: 600; line-height: 1.3; color: var(--text-heading); text-wrap: pretty; }
.dp-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.dp-tabs { padding: 0; margin: 16px 0 0; border-bottom: 1px solid var(--border); }
.dp-grid { display: grid; grid-template-columns: 1fr 280px; gap: 26px; padding: 22px 0; }
.dp-col-main { min-width: 0; }
.dp-col-meta { display: flex; flex-direction: column; gap: 15px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; height: fit-content; box-shadow: var(--sh-1); }
.dp-pad { padding: 22px 0; max-width: 760px; }
.dp-stub { margin-top: 18px; padding: 20px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--bg-layout);
  color: var(--text-tertiary); font-size: 13px; font-style: italic; text-align: center; }
@media (max-width: 1100px) { .dp-grid { grid-template-columns: 1fr; } }
.task-list { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1); }
.task-list.flush { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.task-list.card { background: var(--bg-container); }
.task-row { display: grid; grid-template-columns: 1fr 128px 168px 116px 116px 34px; gap: 10px; align-items: center;
  padding: var(--row-py) 14px; border-bottom: 1px solid var(--border-secondary); transition: background .12s; cursor: pointer; }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--bg-elevated); }
.task-list.flush .task-row { background: var(--bg-container); border-bottom: 1px solid var(--border-secondary); }
.tr-main { min-width: 0; }
.tr-titleline { display: flex; align-items: center; gap: 7px; }
.tr-title { font-size: 13.8px; font-weight: 500; color: var(--text-heading); line-height: 1.35; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.tr-meta { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.tr-code { font-size: 11.5px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tr-doc { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--st-primary);
  background: var(--c-primary-bg); border-radius: 4px; padding: 1px 7px; white-space: nowrap; }
.tr-assignee { display: flex; align-items: center; gap: 9px; min-width: 0; }
.tr-unit { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tr-unit-name { font-size: 12.5px; color: var(--text-heading); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-unit-sub { font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-due { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; }
.tr-kebab { width: 30px; height: 30px; }
.tr-progress { display: flex; }

/* ===================== KANBAN ===================== */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: 280px; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kan-col { background: var(--bg-layout); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: 100%; }
.kan-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.kan-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.kan-title { font-size: 13px; font-weight: 600; color: var(--text-heading); flex: 1; }
.kan-count { font-size: 11.5px; font-weight: 700; color: var(--text-tertiary); background: var(--bg-spotlight); border-radius: 999px; padding: 1px 8px; }
.kan-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; overflow-y: auto; }
.kan-card { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px; box-shadow: var(--sh-1); cursor: pointer; transition: box-shadow .15s, transform .1s; }
.kan-card:hover { box-shadow: var(--sh-2); transform: translateY(-1px); }
.kan-card-top { display: flex; align-items: center; justify-content: space-between; min-height: 18px; }
.kan-overdue { color: var(--st-error); }
.kan-card-title { font-size: 13px; font-weight: 500; color: var(--text-heading); line-height: 1.4; margin: 6px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kan-card-doc { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--st-primary); margin-bottom: 9px; white-space: nowrap; overflow: hidden; }
.kan-card-doc span, .kan-card-doc { text-overflow: ellipsis; }
.kan-card-foot { display: flex; align-items: center; gap: 8px; }
.kan-card-due { font-size: 11px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; margin-left: auto; }
.kan-empty { text-align: center; color: var(--text-disabled); padding: 14px; font-size: 13px; }

/* ===================== EMPTY / SKELETON ===================== */
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 56px 20px; gap: 10px;
  background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); }
.empty-icon { width: 60px; height: 60px; border-radius: 50%; background: var(--bg-layout); color: var(--text-tertiary); display: grid; place-items: center; margin-bottom: 4px; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-heading); }
.empty-desc { font-size: 13px; color: var(--text-secondary); max-width: 380px; line-height: 1.55; }
.empty-state .btn { margin-top: 6px; }
.skel-list { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.skel-row { display: flex; align-items: center; gap: 14px; padding: 16px 14px; border-bottom: 1px solid var(--border-secondary); }
.skel { background: linear-gradient(90deg, var(--bg-spotlight) 25%, var(--bg-elevated) 37%, var(--bg-spotlight) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; }
.skel-dot { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; }
.skel-line { height: 13px; flex: 1; }
.skel-pill { height: 22px; width: 100px; border-radius: 999px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ===================== DOC LIST ===================== */
.doc-list { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1); }
.doc-list-head { display: grid; grid-template-columns: 1fr 150px 200px 120px 90px; gap: 14px; padding: 9px 16px; background: var(--bg-layout);
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); border-bottom: 1px solid var(--border); }
.doc-row { display: grid; grid-template-columns: 1fr 150px 200px 120px 90px; gap: 14px; align-items: center; padding: 14px 16px;
  border-bottom: 1px solid var(--border-secondary); cursor: pointer; transition: background .12s; }
.doc-row:last-child { border-bottom: 0; }
.doc-row:hover { background: var(--bg-elevated); }
.doc-row-title { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.doc-type-chip { font-size: 11px; font-weight: 700; color: var(--navy); background: color-mix(in srgb, var(--navy) 9%, transparent); border-radius: 4px; padding: 2px 8px; white-space: nowrap; }
:root[data-theme="dark"] .doc-type-chip { color: var(--c-primary); background: var(--c-primary-bg); }
.doc-type-chip.lg { font-size: 12.5px; padding: 3px 11px; }
.doc-code { font-size: 13px; font-weight: 700; color: var(--text-heading); font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc-code.lg { font-size: 15px; }
.doc-row-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dl-col-level { display: flex; flex-direction: column; gap: 3px; }
.doc-level { font-size: 12.5px; color: var(--text-heading); font-weight: 500; }
.doc-date { font-size: 11.5px; color: var(--text-tertiary); }
.dl-col-prog { display: flex; flex-direction: column; gap: 6px; }
.doc-agg-status { display: flex; }
.dl-col-deadline { font-size: 12.5px; font-weight: 600; }
.dl-col-count { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.doc-count-num { font-weight: 700; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.doc-count-overdue { display: inline-flex; align-items: center; gap: 3px; color: var(--st-error); font-weight: 600; font-size: 12px; }

/* ===================== DOC DETAIL ===================== */
.doc-detail { max-width: 1080px; }
.doc-detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--text-secondary);
  font-size: 13px; padding: 4px 0; margin-bottom: 12px; font-weight: 500; white-space: nowrap; }
.back-link:hover { color: var(--c-primary-active); }
.doc-hero { display: flex; gap: 24px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-xl);
  padding: 22px 24px; box-shadow: var(--sh-1); }
:root[data-theme="dark"] .doc-hero { background: linear-gradient(180deg, var(--bg-elevated), var(--bg-container)); }
.doc-hero-main { flex: 1; min-width: 0; }
.doc-hero-badges { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 11px; }
.doc-level-chip { font-size: 11.5px; font-weight: 600; color: var(--st-warning); background: color-mix(in srgb, var(--st-warning) 13%, transparent); border-radius: 999px; padding: 2px 10px; }
.qlvb-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--st-info); background: color-mix(in srgb, var(--st-info) 13%, transparent); border-radius: 999px; padding: 2px 9px; }
.doc-hero-title { font-size: 21px; font-weight: 600; line-height: 1.35; color: var(--text-heading); margin-bottom: 14px; text-wrap: pretty; }
.doc-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.doc-hero-meta span { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.doc-hero-meta span svg { color: var(--text-tertiary); }
.doc-hero-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.doc-file { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--c-primary-active); background: var(--c-primary-bg);
  border: 1px solid transparent; border-radius: var(--r-md); padding: 7px 12px; font-weight: 500; }
.doc-file:hover { border-color: var(--c-primary); }
.doc-hero-side { flex-shrink: 0; display: flex; align-items: center; }
.doc-agg-ring { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ring { position: relative; display: grid; place-items: center; }
.ring-num { position: absolute; font-size: 22px; font-weight: 700; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.ring-pct { font-size: 12px; font-weight: 600; color: var(--text-tertiary); }
.doc-agg-caption { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; }

.doc-stats { display: flex; align-items: center; gap: 10px; margin: 16px 0; flex-wrap: wrap; }
.stat { display: flex; align-items: center; gap: 10px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 11px 16px 11px 13px; flex: 1; min-width: 150px; }
.stat-ic { width: 34px; height: 34px; border-radius: var(--r-md); display: grid; place-items: center; }
.stat-ic.tone-neutral { color: var(--text-secondary); background: var(--bg-spotlight); }
.stat-ic.tone-success { color: var(--st-success); background: color-mix(in srgb, var(--st-success) 13%, transparent); }
.stat-ic.tone-primary { color: var(--st-primary); background: color-mix(in srgb, var(--st-primary) 13%, transparent); }
.stat-ic.tone-error { color: var(--st-error); background: color-mix(in srgb, var(--st-error) 13%, transparent); }
.stat-body { display: flex; flex-direction: column; line-height: 1.1; }
.stat-value { font-size: 20px; font-weight: 700; color: var(--text-heading); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; }
.doc-stats-spacer { flex: 1; min-width: 0; }
.doc-deadline-box { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 9px 16px; }
.ddl-label { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 3px; }
.ddl-value { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ddl-rel { font-size: 12px; font-weight: 500; }

.doc-tasks-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 12px; }
.doc-tasks-h { font-size: 16px; font-weight: 600; white-space: nowrap; }
.doc-tasks-actions { display: flex; gap: 8px; }

/* sections */
.sections { display: flex; flex-direction: column; gap: 12px; }
.sec-group { background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--sh-1); }
.sec-head { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; transition: background .12s; }
.sec-head:hover { background: var(--bg-elevated); }
.sec-caret { border: 0; background: transparent; color: var(--text-tertiary); display: grid; place-items: center; padding: 0; }
.sec-num { font-size: 14px; font-weight: 700; color: var(--c-primary-active); min-width: 26px; }
.sec-title { font-size: 14.5px; font-weight: 600; color: var(--text-heading); }
.sec-spacer { flex: 1; }
.sec-count { font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.sec-content { border-top: 1px solid var(--border-secondary); }
.subsec { border-top: 1px solid var(--border-secondary); }
.subsec:first-child { border-top: 0; }
.subsec-head { display: flex; align-items: center; gap: 9px; padding: 9px 16px 9px 30px; background: var(--bg-layout); }
.subsec-num { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); min-width: 30px; }
.subsec-title { font-size: 13px; font-weight: 600; color: var(--text-heading); }
.subsec-count { font-size: 11.5px; color: var(--text-tertiary); }
.sec-empty { padding: 14px 16px; font-size: 12.5px; color: var(--text-tertiary); font-style: italic; }
.sec-content .task-row { padding-left: 30px; }
.subsec .task-row { padding-left: 30px; }

/* toolbar hint khi mở bộ lọc */
.toolbar-hint { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary); }
.toolbar-hint svg { color: var(--c-primary); }

/* hàng nhiệm vụ trong văn bản — expand báo cáo + nhiệm vụ con */
.doctask { border-bottom: 1px solid var(--border-secondary); }
.doctask:last-child { border-bottom: 0; }
.doctask-row { border-bottom: 0 !important; }
.doctask.open .doctask-row { background: var(--bg-elevated); }
.dt-caret { border: 0; background: transparent; color: var(--text-tertiary); display: grid; place-items: center; padding: 0; width: 18px; height: 18px; margin-left: -2px; border-radius: 4px; flex-shrink: 0; }
.dt-caret:hover { color: var(--c-primary); background: var(--c-primary-bg); }
.dt-caret-spacer { width: 16px; flex-shrink: 0; }
.dt-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-secondary); background: var(--bg-spotlight); border-radius: 4px; padding: 1px 7px; }
.dt-tag.report { color: var(--st-info); background: color-mix(in srgb, var(--st-info) 12%, transparent); }
.tr-kebab2 { width: 34px; }
.doctask-exp { padding: 4px 16px 16px 48px; background: var(--bg-elevated); display: flex; flex-direction: column; gap: 14px; }
.dt-report { background: var(--bg-container); border: 1px solid var(--border); border-left: 3px solid var(--st-info); border-radius: var(--r-md); padding: 11px 14px; }
.dt-report-h { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--st-info); margin-bottom: 6px; }
.dt-report-text { font-size: 13px; line-height: 1.6; color: var(--text); margin: 0; }
.dt-report-file { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12.5px; font-weight: 500; color: var(--c-primary-active);
  background: var(--c-primary-bg); border: 1px solid transparent; border-radius: var(--r-md); padding: 6px 11px; }
.dt-report-file:hover { border-color: var(--c-primary); }
.dt-report-size { color: var(--text-tertiary); font-weight: 400; }
.dt-subs { display: flex; flex-direction: column; gap: 2px; }
.dt-subs-h { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.dt-sub { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-container); border: 1px solid var(--border-secondary); border-radius: var(--r-md); margin-bottom: 5px; }
.dt-sub-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dt-sub-title { font-size: 13px; color: var(--text-heading); font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-sub-spacer { flex: 1; }
.dt-sub-due { font-size: 12px; font-weight: 500; white-space: nowrap; min-width: 78px; text-align: right; }

/* ===================== DRAWER ===================== */
.drawer-scrim { position: fixed; inset: 0; background: rgba(15,23,38,.42); z-index: 60; display: flex; justify-content: flex-end;
  animation: scrim-in .2s var(--ease); }
.drawer-scrim.closing { animation: scrim-out .2s var(--ease) forwards; }
@keyframes scrim-in { from { opacity: 0; } } @keyframes scrim-out { to { opacity: 0; } }
.drawer { width: min(620px, 64vw); background: var(--bg); height: 100%; display: flex; flex-direction: column; box-shadow: var(--sh-4);
  animation: drawer-in .25s var(--ease); }
.drawer.closing { animation: drawer-out .2s var(--ease) forwards; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: .4; } } @keyframes drawer-out { to { transform: translateX(40px); opacity: 0; } }
.drawer-head { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.drawer-head-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.drawer-head-actions { display: flex; gap: 2px; }
.drawer-title { font-size: 18px; font-weight: 600; line-height: 1.4; color: var(--text-heading); margin-bottom: 12px; text-wrap: pretty; }
.drawer-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--border); }
.drawer-tab { border: 0; background: transparent; color: var(--text-secondary); font-size: 13.5px; font-weight: 500; padding: 11px 10px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .13s; }
.drawer-tab:hover { color: var(--text-heading); }
.drawer-tab.active { color: var(--c-primary-active); border-bottom-color: var(--c-primary); font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; }
.drawer-grid { display: grid; grid-template-columns: 1fr 240px; }
.drawer-col-main { padding: 18px 22px; border-right: 1px solid var(--border); min-width: 0; }
.drawer-col-meta { padding: 18px 18px; display: flex; flex-direction: column; gap: 15px; background: var(--bg-elevated); }
.d-block { margin-bottom: 22px; } .d-block:last-child { margin-bottom: 0; }
.d-h { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 9px; display: flex; align-items: center; gap: 8px; }
.d-h-sub { font-size: 11.5px; color: var(--text-tertiary); background: var(--bg-spotlight); border-radius: 999px; padding: 1px 8px; letter-spacing: 0; text-transform: none; }
.d-desc { font-size: 13.8px; line-height: 1.65; color: var(--text); }
.d-muted { font-size: 13px; color: var(--text-tertiary); font-style: italic; }
.d-pad { padding: 20px 22px; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checklist li { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text); }
.checklist li.done .ck-text { color: var(--text-tertiary); text-decoration: line-through; }
.ck-box { width: 18px; height: 18px; border: 1.5px solid var(--border-strong); border-radius: 5px; flex-shrink: 0; margin-top: 1px; display: grid; place-items: center; color: #fff; }
button.ck-box { background: var(--bg-container); cursor: pointer; padding: 0; transition: border-color .12s; }
button.ck-box:hover:not(:disabled) { border-color: var(--c-primary); }
button.ck-box:disabled { cursor: default; }
.ck-del { display: grid; place-items: center; width: 22px; height: 22px; margin-left: auto; flex-shrink: 0; border: none; background: transparent; border-radius: var(--r-sm); color: var(--text-tertiary); cursor: pointer; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.checklist li:hover .ck-del, .ck-del:focus-visible { opacity: 1; }
.ck-del:hover { color: var(--st-error); background: var(--st-error-bg, rgba(195,67,67,.1)); }
.ck-add { display: flex; gap: 8px; margin-top: 12px; }
.ck-add .input { flex: 1; }
.dt-report-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border); }
.meta-units { display: flex; flex-direction: column; gap: 3px; }
.ck-text { line-height: 1.45; }
.attach-list { display: flex; flex-direction: column; gap: 7px; }
.attach { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--bg-layout); border: 1px solid var(--border); border-radius: var(--r-md); }
.attach-ic { color: var(--text-tertiary); }
.attach-name { flex: 1; font-size: 13px; color: var(--text-heading); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-size { font-size: 11.5px; color: var(--text-tertiary); }
.meta-item { display: flex; flex-direction: column; gap: 5px; }
.meta-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-tertiary); font-weight: 600; }
.meta-value { font-size: 13px; color: var(--text-heading); padding-left: 20px; }
.meta-user { display: inline-flex; align-items: center; gap: 7px; }
.ext-card { margin-left: 20px; background: color-mix(in srgb, var(--st-warning) 8%, transparent); border: 1px solid color-mix(in srgb, var(--st-warning) 28%, transparent); border-radius: var(--r-md); padding: 8px 10px; }
.ext-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-heading); }
.ext-status { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--st-warning); }
.ext-reason { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.prog-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.prog-summary-label { font-size: 12.5px; color: var(--text-secondary); }
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 30px; bottom: 0; width: 2px; background: var(--border); }
.timeline.compact .tl-item:not(:last-child)::before { left: 5px; top: 14px; }
.tl-marker { flex-shrink: 0; z-index: 1; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; z-index: 1; }
.tl-body { flex: 1; min-width: 0; }
.tl-head { font-size: 13.5px; color: var(--text); }
.tl-pct { font-weight: 700; color: var(--c-primary-active); }
.tl-note { font-size: 13px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.tl-time { font-size: 11.5px; color: var(--text-tertiary); margin-top: 4px; font-variant-numeric: tabular-nums; }
.comment-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.cmt { display: flex; gap: 11px; }
.cmt-body { flex: 1; }
.cmt-head { display: flex; align-items: baseline; gap: 9px; }
.cmt-head b { font-size: 13.5px; color: var(--text-heading); }
.cmt-time { font-size: 11.5px; color: var(--text-tertiary); }
.cmt-text { font-size: 13.5px; color: var(--text); line-height: 1.55; margin-top: 3px; }
.cmt-compose { display: flex; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.input { flex: 1; border: 1px solid var(--border-strong); border-radius: var(--r-md); padding: 9px 12px; font-size: 13px; background: var(--bg-container); color: var(--text); outline: none; }
.input:focus { border-color: var(--c-primary); }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; padding: 13px 22px; border-top: 1px solid var(--border); background: var(--bg-container); }
.drawer-foot-right { display: flex; gap: 9px; }

/* ===================== TOAST ===================== */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; align-items: center; gap: 10px;
  background: var(--text-heading); color: var(--bg-container); padding: 11px 18px; border-radius: var(--r-lg); box-shadow: var(--sh-4); font-size: 13.5px; font-weight: 500;
  animation: toast-in .25s var(--ease); }
.toast svg { color: var(--st-success); }
@keyframes toast-in { from { transform: translate(-50%, 14px); opacity: 0; } }

/* focus visible (R-026) */
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 1180px) { .drawer-grid { grid-template-columns: 1fr; } .drawer-col-main { border-right: 0; } .list-head .lh-assignee, .tr-assignee .tr-unit { display: none; } }

/* ===================== MODAL (dùng chung) ===================== */
.modal-scrim { position: fixed; inset: 0; background: rgba(15,23,38,.46); z-index: 70; display: flex; align-items: center; justify-content: center;
  padding: 30px; animation: scrim-in .2s var(--ease); }
.modal-scrim.closing { animation: scrim-out .18s var(--ease) forwards; }
.modal { background: var(--bg-layout); border-radius: var(--r-xl); box-shadow: var(--sh-4); display: flex; flex-direction: column;
  max-height: calc(100vh - 60px); width: min(620px, 95vw); overflow: hidden; animation: modal-in .24s var(--ease); }
.modal.closing { animation: modal-out .18s var(--ease) forwards; }
.modal.lg { width: min(1180px, 96vw); }
.modal.md { width: min(640px, 95vw); }
.modal.sm { width: min(468px, 94vw); }
@keyframes modal-in { from { transform: translateY(14px) scale(.985); opacity: 0; } }
@keyframes modal-out { to { transform: translateY(8px) scale(.99); opacity: 0; } }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 17px 22px; background: var(--bg-container); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-head-l { min-width: 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head-ic { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--c-primary-bg); color: var(--c-primary-active); display: grid; place-items: center; flex-shrink: 0; }
.modal-head-txt { min-width: 0; }
.modal-title { font-size: 17px; font-weight: 600; color: var(--text-heading); line-height: 1.3; }
.modal-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.4; }
.modal-body { flex: 1; overflow-y: auto; min-height: 0; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 13px 22px; background: var(--bg-container); border-top: 1px solid var(--border); flex-shrink: 0; }
.modal-foot-l { margin-right: auto; font-size: 12.5px; color: var(--text-tertiary); display: flex; align-items: center; gap: 7px; }

/* form primitives */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.span2 { grid-column: 1 / -1; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; }
.req-star { color: var(--st-error); font-weight: 700; }
.field-hint { font-size: 11.5px; color: var(--text-tertiary); line-height: 1.45; }
.field-opt { font-weight: 400; color: var(--text-tertiary); font-size: 11.5px; }
textarea.input { resize: vertical; min-height: 88px; font-family: inherit; line-height: 1.55; width: 100%; }
.input::placeholder, textarea.input::placeholder { color: var(--text-tertiary); }
.form-section-h { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary);
  margin: 22px 0 13px; padding-bottom: 7px; border-bottom: 1px solid var(--border-secondary); display: flex; align-items: center; gap: 8px; }
.form-section-h:first-child { margin-top: 0; }

/* tag / chip input (nhãn) */
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--r-md);
  background: var(--bg-container); padding: 5px 7px; min-height: 38px; transition: border-color .15s; }
.tag-input:focus-within { border-color: var(--c-primary); }
.tag-input input { flex: 1; min-width: 90px; border: 0; outline: none; background: transparent; font-size: 13px; color: var(--text); padding: 3px 2px; }
.tag-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; color: var(--c-primary-active);
  background: var(--c-primary-bg); border-radius: var(--r-sm); padding: 3px 4px 3px 9px; }
.tag-pill button { border: 0; background: transparent; color: var(--c-primary-active); display: grid; place-items: center; padding: 1px; border-radius: 3px; opacity: .7; }
.tag-pill button:hover { opacity: 1; background: var(--c-primary-bg-h); }

/* user / unit pickers */
.picker-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.user-chip { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-container); border: 1px solid var(--border-strong);
  border-radius: 999px; padding: 3px 8px 3px 4px; font-size: 12.5px; color: var(--text-heading); font-weight: 500; }
.user-chip button { border: 0; background: transparent; color: var(--text-tertiary); display: grid; place-items: center; padding: 2px; border-radius: 50%; }
.user-chip button:hover { color: var(--st-error); background: color-mix(in srgb, var(--st-error) 12%, transparent); }
.picker-empty { font-size: 12.5px; color: var(--text-tertiary); font-style: italic; padding: 3px 0; }

/* combobox dropdown (chọn người dùng) */
.combo { position: relative; }
.combo-pop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 5; background: var(--bg-container); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--sh-3); max-height: 248px; overflow-y: auto; padding: 5px; }
.combo-opt { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; text-align: left; padding: 7px 8px; border-radius: var(--r-sm); transition: background .1s; }
.combo-opt:hover, .combo-opt.active { background: var(--bg-layout); }
.combo-opt-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.combo-opt-name { font-size: 13px; font-weight: 500; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-opt-sub { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combo-opt-check { margin-left: auto; color: var(--c-primary); }
.combo-none { padding: 10px; text-align: center; font-size: 12.5px; color: var(--text-tertiary); }

/* ===== Task modal: 2-panel grid ===== */
.ct-grid { display: grid; grid-template-columns: 1fr 472px; overflow: hidden; min-height: 0; height: min(72vh, 720px); }
.ct-form { padding: 20px 22px 26px; overflow-y: auto; min-width: 0; }
.ct-source { border-left: 1px solid var(--border); background: var(--bg-elevated); display: flex; flex-direction: column; min-width: 0; }
.ct-source-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ct-source-h { font-size: 12.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--text-tertiary); display: flex; align-items: center; gap: 7px; }
.ct-source-modes { padding: 11px 16px 0; flex-shrink: 0; }
.ct-source-body { flex: 1; overflow-y: auto; min-height: 0; display: flex; flex-direction: column; }

/* document meta card (in source panel) */
.srcdoc-card { margin: 13px 16px 0; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px 14px; flex-shrink: 0; }
.srcdoc-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.srcdoc-title { font-size: 13.5px; font-weight: 600; color: var(--text-heading); line-height: 1.45; text-wrap: pretty; }
.srcdoc-meta { display: flex; flex-wrap: wrap; gap: 5px 16px; margin-top: 9px; }
.srcdoc-meta span { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); }
.srcdoc-meta span svg { color: var(--text-tertiary); }

/* PDF viewer */
.pdf-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-container); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.pdf-toolbar .pdf-name { font-size: 12px; font-weight: 600; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.pdf-tool-btn { width: 28px; height: 28px; border: 1px solid var(--border-strong); background: var(--bg-container); border-radius: var(--r-sm); color: var(--text-secondary); display: grid; place-items: center; }
.pdf-tool-btn:hover:not(:disabled) { border-color: var(--c-primary); color: var(--c-primary-active); }
.pdf-tool-btn:disabled { opacity: .4; }
.pdf-zoom { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; min-width: 38px; text-align: center; }
.pdf-stage { flex: 1; overflow: auto; background: var(--bg-spotlight); padding: 18px; display: flex; justify-content: center; align-items: flex-start; min-height: 0; }
.pdf-page { background: #fff; box-shadow: var(--sh-2); width: 100%; max-width: 372px; aspect-ratio: 1 / 1.414; padding: 34px 32px; display: flex; flex-direction: column; gap: 8px;
  color: #1a1a1a; transform-origin: top center; transition: width .15s var(--ease); flex-shrink: 0; }
.pdf-natl { text-align: center; margin-bottom: 6px; }
.pdf-natl-a { font-size: 8.5px; font-weight: 700; color: #1a1a1a; letter-spacing: .01em; }
.pdf-natl-b { font-size: 9px; font-weight: 700; color: #1a1a1a; }
.pdf-natl-line { width: 116px; height: 1px; background: #1a1a1a; margin: 3px auto 0; }
.pdf-org { font-size: 8.5px; font-weight: 700; color: #b91c1c; text-align: left; }
.pdf-code { font-size: 8px; color: #444; text-align: left; margin-top: -3px; }
.pdf-doctype { text-align: center; margin: 12px 0 4px; }
.pdf-doctype-t { font-size: 11px; font-weight: 700; color: #b91c1c; text-transform: uppercase; }
.pdf-doctype-s { font-size: 8.5px; color: #333; margin-top: 2px; line-height: 1.4; }
.pdf-bar { height: 6px; border-radius: 2px; background: repeating-linear-gradient(90deg, #e3e6ea 0 14px, #eef1f4 14px 22px); }
.pdf-bar.short { width: 62%; } .pdf-bar.mid { width: 84%; }
.pdf-para { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.pdf-watermark { margin-top: auto; text-align: center; font-family: 'Roboto Mono', ui-monospace, monospace; font-size: 8px; color: #b8bec6; letter-spacing: .05em; }

/* dropzone */
.dropzone { flex: 1; margin: 14px 16px 16px; border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--bg-container);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 28px 22px; transition: all .15s var(--ease); cursor: pointer; }
.dropzone:hover, .dropzone.drag { border-color: var(--c-primary); background: var(--c-primary-bg); }
.dropzone-ic { width: 52px; height: 52px; border-radius: 50%; background: var(--bg-spotlight); color: var(--c-primary); display: grid; place-items: center; }
.dropzone.drag .dropzone-ic { background: var(--bg-container); }
.dropzone-title { font-size: 13.5px; font-weight: 600; color: var(--text-heading); }
.dropzone-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; max-width: 240px; }
.dropzone-hint { font-size: 11px; color: var(--text-tertiary); }
.src-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; text-align: center; padding: 30px; color: var(--text-tertiary); }
.src-empty-ic { width: 50px; height: 50px; border-radius: 50%; background: var(--bg-spotlight); display: grid; place-items: center; color: var(--text-tertiary); }
.src-empty-t { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.src-empty-d { font-size: 12px; color: var(--text-tertiary); max-width: 230px; line-height: 1.5; }

/* uploaded file row */
.upfile { display: flex; align-items: center; gap: 11px; margin: 13px 16px 0; padding: 11px 13px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md); flex-shrink: 0; }
.upfile-ic { width: 34px; height: 40px; border-radius: 4px; background: color-mix(in srgb, var(--st-error) 12%, transparent); color: var(--st-error); display: grid; place-items: center; flex-shrink: 0; font-size: 8px; font-weight: 700; }
.upfile-txt { min-width: 0; flex: 1; }
.upfile-name { font-size: 12.5px; font-weight: 600; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upfile-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; }

/* segmented toggle (require-approval etc) */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 13px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md); }
.switch-row-txt { min-width: 0; }
.switch-row-t { font-size: 13px; font-weight: 500; color: var(--text-heading); }
.switch-row-d { font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; line-height: 1.4; }
.switch { width: 40px; height: 22px; border-radius: 999px; background: var(--border-strong); border: 0; padding: 2px; flex-shrink: 0; transition: background .18s var(--ease); position: relative; }
.switch.on { background: var(--c-primary); }
.switch-knob { width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: var(--sh-1); display: block; transition: transform .18s var(--ease); }
.switch.on .switch-knob { transform: translateX(18px); }

/* ===== org tree picker (Chủ trì / Phối hợp) ===== */
.orgtree { display: flex; flex-direction: column; }
.orgtree-root { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-tertiary); padding: 3px 6px 8px; }
.orgtree-root svg { color: var(--text-tertiary); }
.orgtree-row { display: flex; align-items: center; gap: 2px; }
.orgtree-caret { border: 0; background: transparent; color: var(--text-tertiary); width: 22px; height: 32px; display: grid; place-items: center; border-radius: 4px; flex-shrink: 0; }
.orgtree-caret:hover { color: var(--text-heading); }
.orgtree-unit-btn { flex: 1; display: flex; align-items: center; gap: 9px; border: 0; background: transparent; text-align: left; padding: 7px 8px; border-radius: var(--r-sm); min-width: 0; }
.orgtree-unit-btn:hover { background: var(--bg-layout); }
.orgtree-unit-btn.sel { background: var(--c-primary-bg); }
.orgtree-ic { color: var(--navy); flex-shrink: 0; }
:root[data-theme="dark"] .orgtree-ic { color: var(--c-primary); }
.orgtree-name { flex: 1; font-size: 13px; font-weight: 500; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orgtree-tag { font-size: 10px; font-weight: 700; color: var(--text-tertiary); background: var(--bg-spotlight); border-radius: 999px; padding: 1px 7px; flex-shrink: 0; }
.orgtree-check { color: var(--c-primary); flex-shrink: 0; }
.orgtree-members { display: flex; flex-direction: column; padding-left: 24px; }
.orgtree-member { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; text-align: left; padding: 6px 8px; border-radius: var(--r-sm); min-width: 0; }
.orgtree-member:hover { background: var(--bg-layout); }
.orgtree-member.sel { background: var(--c-primary-bg); }
.orgtree-mtxt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.orgtree-mname { font-size: 12.5px; font-weight: 500; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orgtree-msub { font-size: 11px; color: var(--text-tertiary); }

/* coop list w/ per-target due */
.coop-list { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.coop-common { display: flex; align-items: center; gap: 11px; padding: 9px 12px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); }
.coop-common-txt { flex: 1; min-width: 0; }
.coop-common-t { font-size: 12.5px; font-weight: 500; color: var(--text-heading); }
.coop-common-d { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.coop-common .input[type="date"] { width: 152px; flex-shrink: 0; }
.coop-row { display: flex; align-items: center; gap: 10px; padding: 8px 11px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md); }
.coop-row-ic { width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; background: color-mix(in srgb, var(--navy) 10%, transparent); color: var(--navy); }
:root[data-theme="dark"] .coop-row-ic { color: var(--c-primary); background: var(--c-primary-bg); }
.coop-row-txt { flex: 1; min-width: 0; }
.coop-row-name { font-size: 13px; font-weight: 500; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coop-row-sub { font-size: 11px; color: var(--text-tertiary); }
.coop-row .input[type="date"] { width: 150px; flex-shrink: 0; padding: 6px 9px; }
.coop-due-tag { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.coop-del { border: 0; background: transparent; color: var(--text-tertiary); width: 28px; height: 28px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.coop-del:hover { background: color-mix(in srgb, var(--st-error) 12%, transparent); color: var(--st-error); }

/* AI extract button */
.ai-btn { display: inline-flex; align-items: center; gap: 7px; border-radius: var(--r-md); font-size: 12.5px; font-weight: 600; padding: 7px 12px;
  border: 1px solid color-mix(in srgb, var(--c-primary) 38%, transparent); background: var(--c-primary-bg); color: var(--c-primary-active); transition: all .15s var(--ease); white-space: nowrap; }
.ai-btn:hover { background: var(--c-primary-bg-h); border-color: var(--c-primary); }
.ai-btn .ai-spark { color: var(--c-primary); }

/* ===== dropdown menu (cây danh mục) ===== */
.menu-pop { position: fixed; z-index: 90; background: var(--bg-container); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--sh-3); padding: 5px; min-width: 196px; animation: modal-in .14s var(--ease); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text); transition: background .1s; }
.menu-item:hover { background: var(--bg-layout); }
.menu-item svg { color: var(--text-tertiary); flex-shrink: 0; }
.menu-item.danger { color: var(--st-error); }
.menu-item.danger svg { color: var(--st-error); }
.menu-item.danger:hover { background: color-mix(in srgb, var(--st-error) 9%, transparent); }
.menu-sep { height: 1px; background: var(--border-secondary); margin: 4px 6px; }
.tree-node { position: relative; }
.tree-more { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); z-index: 2; border: 0; background: transparent; color: var(--text-tertiary); width: 24px; height: 24px; border-radius: 5px; display: grid; place-items: center; opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.tree-node:hover .tree-more, .tree-node.child:hover .tree-more, .tree-more.open { opacity: 1; }
.tree-node:hover .side-count, .tree-node.child:hover .side-count { opacity: 0; }
.tree-more:hover { background: var(--bg-spotlight); color: var(--text-heading); }
.side-h-row { display: flex; align-items: center; justify-content: space-between; }
.side-h-add { border: 0; background: transparent; color: var(--text-tertiary); width: 24px; height: 24px; border-radius: 5px; display: grid; place-items: center; }
.side-h-add:hover { background: var(--bg-layout); color: var(--c-primary-active); }

/* ===== ACL permission editor ===== */
.acl-list { display: flex; flex-direction: column; gap: 8px; }
.acl-row { display: flex; align-items: center; gap: 11px; padding: 9px 11px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md); }
.acl-subject { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 0; }
.acl-subj-ic { width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.acl-subj-ic.unit { background: color-mix(in srgb, var(--navy) 10%, transparent); color: var(--navy); }
:root[data-theme="dark"] .acl-subj-ic.unit { color: var(--c-primary); background: var(--c-primary-bg); }
.acl-subj-txt { min-width: 0; }
.acl-subj-name { font-size: 13px; font-weight: 500; color: var(--text-heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acl-subj-kind { font-size: 11px; color: var(--text-tertiary); }
.acl-level { display: flex; background: var(--bg-spotlight); border-radius: var(--r-sm); padding: 2px; gap: 2px; flex-shrink: 0; }
.acl-level-btn { border: 0; background: transparent; color: var(--text-secondary); font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 4px; display: flex; align-items: center; gap: 5px; }
.acl-level-btn.on { background: var(--bg-container); box-shadow: var(--sh-1); }
.acl-level-btn.on[data-lv="view"] { color: var(--st-info); }
.acl-level-btn.on[data-lv="manage"] { color: var(--c-primary-active); }
.acl-del { border: 0; background: transparent; color: var(--text-tertiary); width: 30px; height: 30px; border-radius: var(--r-sm); display: grid; place-items: center; flex-shrink: 0; }
.acl-del:hover { background: color-mix(in srgb, var(--st-error) 12%, transparent); color: var(--st-error); }
.acl-add { display: flex; gap: 9px; align-items: stretch; margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--border-secondary); }
.acl-inherit { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 11px 13px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-md); }
.acl-empty { text-align: center; padding: 22px; color: var(--text-tertiary); font-size: 12.5px; font-style: italic; border: 1px dashed var(--border-strong); border-radius: var(--r-md); }

/* confirm dialog body */
.confirm-body { padding: 20px 22px; display: flex; gap: 15px; }
.confirm-ic { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }
.confirm-ic.danger { background: color-mix(in srgb, var(--st-error) 12%, transparent); color: var(--st-error); }
.confirm-ic.warn { background: color-mix(in srgb, var(--st-warning) 14%, transparent); color: var(--st-warning); }
.confirm-txt { font-size: 13.5px; color: var(--text); line-height: 1.6; }
.confirm-txt b { color: var(--text-heading); }
.confirm-note { margin-top: 10px; padding: 10px 12px; background: var(--bg-layout); border-radius: var(--r-md); font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; }
.btn-danger { background: var(--st-error); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--st-error) 88%, #000); }

@media (max-width: 920px) { .ct-grid { grid-template-columns: 1fr; height: auto; } .ct-source { border-left: 0; border-top: 1px solid var(--border); } .form-grid { grid-template-columns: 1fr; } }

/* ===================== CHI TIẾT NHIỆM VỤ — bổ sung rà soát SRS ===================== */
/* Header: cho phép xuống dòng gọn, chip nguồn co được */
.dp-head { flex-wrap: wrap; }
.dp-actions { min-width: max-content; }
.src-chip { min-width: 0; max-width: 320px; }
.src-chip-txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbl-chip { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); background: var(--bg-spotlight);
  border: 1px solid var(--border-secondary); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.btn-xs { font-size: 12px; padding: 4px 10px; gap: 5px; }

/* Banner duyệt / tạm dừng */
.approve-banner, .pause-banner { display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-radius: var(--r-lg);
  margin-bottom: 20px; border: 1px solid; }
.approve-banner { background: color-mix(in srgb, var(--st-warning) 8%, transparent); border-color: color-mix(in srgb, var(--st-warning) 30%, transparent); }
.pause-banner { background: color-mix(in srgb, var(--st-muted) 9%, transparent); border-color: color-mix(in srgb, var(--st-muted) 30%, transparent); }
.ab-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; }
.approve-banner .ab-ic { color: var(--st-warning); background: color-mix(in srgb, var(--st-warning) 16%, transparent); }
.pause-banner .ab-ic { color: var(--st-muted); background: color-mix(in srgb, var(--st-muted) 16%, transparent); }
.ab-body { flex: 1; min-width: 0; }
.ab-title { font-size: 13.5px; font-weight: 700; color: var(--text-heading); }
.ab-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.ab-sub b { color: var(--text-heading); }
.ab-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ab-wait { font-size: 12px; color: var(--text-tertiary); font-style: italic; flex-shrink: 0; }

/* Tiêu đề khối có ghi chú + nút thêm */
.d-h { flex-wrap: wrap; }
.d-h-title { white-space: nowrap; }
.d-h-note { flex-basis: 100%; margin-top: 3px; font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text-tertiary); }
.d-h-add { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent;
  color: var(--c-primary-active); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; cursor: pointer; padding: 2px 4px; border-radius: 5px; }
.d-h-add:hover { background: var(--c-primary-bg); }

/* Nguồn nhiệm vụ (đa nguồn) */
.src-list { display: flex; flex-direction: column; gap: 6px; padding-left: 20px; }
.src-row { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); text-decoration: none;
  background: var(--bg-layout); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 10px; }
.src-row.primary { border-color: color-mix(in srgb, var(--st-primary) 35%, transparent); color: var(--st-primary); background: var(--c-primary-bg); }
.src-row:hover { border-color: var(--c-primary); }
.src-row-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row-tag { margin-left: auto; font-size: 10px; font-weight: 700; color: var(--st-primary); }

/* Hành động gia hạn */
.ext-actions { display: flex; gap: 7px; margin-top: 9px; justify-content: flex-end; }

/* Cây giao việc xuyên đơn vị */
.deleg-tree { display: flex; flex-direction: column; gap: 0; }
.dlg-node { display: flex; align-items: center; gap: 9px; padding: 9px 12px; background: var(--bg-container);
  border: 1px solid var(--border); border-radius: var(--r-md); color: var(--text-secondary); }
.dlg-root { border-left: 3px solid var(--st-primary); }
.dlg-unit { font-size: 13px; font-weight: 600; color: var(--text-heading); }
.dlg-sub { font-size: 11.5px; color: var(--text-tertiary); }
.dlg-branch { margin-left: 18px; padding-left: 16px; border-left: 2px solid var(--border); margin-top: 8px;
  display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.dlg-leaf { display: flex; align-items: center; gap: 9px; padding: 7px 11px; background: var(--bg-layout);
  border: 1px solid var(--border-secondary); border-radius: var(--r-md); }
.dlg-leaf.sub { margin-left: 16px; }
.dlg-subunit { display: flex; flex-direction: column; gap: 8px; }
.dlg-name { font-size: 12.5px; font-weight: 500; color: var(--text-heading); }
.dlg-role { font-size: 11px; color: var(--text-tertiary); }
.dlg-leaf .progress-wrap, .dlg-leaf .tag { margin-left: auto; }
.dlg-node .tag { margin-left: auto; }

/* Bình luận: công cụ + trả lời */
.cmt-tools { display: flex; gap: 14px; margin-top: 6px; }
.cmt-tools button { border: 0; background: transparent; color: var(--text-tertiary); font-size: 12px; font-weight: 500; cursor: pointer; padding: 0; }
.cmt-tools button:hover { color: var(--c-primary-active); }
.cmt.reply { margin-left: 41px; }
.cmt-replyto { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-secondary);
  background: var(--bg-layout); border-radius: var(--r-md); padding: 7px 11px; margin-bottom: 10px; }
.cmt-replyto button { margin-left: auto; border: 0; background: transparent; color: var(--text-tertiary); cursor: pointer; display: grid; place-items: center; }
.cmt-replyto button:hover { color: var(--st-error); }

/* Tệp minh chứng trong dòng thời gian */
.tl-evi { margin-top: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--c-primary-active);
  background: var(--c-primary-bg); border: 1px solid transparent; border-radius: var(--r-md); padding: 5px 10px; cursor: pointer; }
.file-chip:hover { border-color: var(--c-primary); }
.file-chip.evi { color: var(--st-success); background: color-mix(in srgb, var(--st-success) 11%, transparent); }
.file-chip-size { color: var(--text-tertiary); font-weight: 400; }

/* Tiến độ: nút cập nhật cạnh thanh */
.prog-summary { display: flex; align-items: center; gap: 14px; }
.prog-update-btn { margin-left: auto; }

/* ===== Chi tiết nhiệm vụ: menu "Khác" (hành động thứ cấp) ===== */
.more-wrap { position: relative; }
.dp-menu { position: absolute; top: calc(100% + 4px); right: 0; left: auto; min-width: 212px; }

/* ===== Tab Nhiệm vụ con — dùng lại lưới danh sách nhiệm vụ ===== */
.dp-subs { padding: 22px 0; }
.subs-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; min-height: 32px; }
.subs-summary { font-size: 12.5px; color: var(--text-secondary); margin-right: auto; }
.subs-summary b { color: var(--text-heading); font-weight: 600; }

/* ===== Thẻ tệp đính kèm (trang chi tiết) ===== */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 9px; }
.file-card { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 9px 12px; cursor: pointer;
  background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md);
  transition: border-color .12s, box-shadow .12s; }
.file-card:hover { border-color: var(--c-primary); box-shadow: var(--sh-1); }
.file-card:hover .file-card-dl { color: var(--c-primary-active); }
.file-card-ic { width: 34px; height: 38px; border-radius: 6px; display: grid; place-items: center; flex-shrink: 0;
  font-size: 9.5px; font-weight: 700; letter-spacing: .04em;
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%); }
.file-card-ic.ft-error   { background: color-mix(in srgb, var(--st-error) 13%, transparent);   color: var(--st-error); }
.file-card-ic.ft-info    { background: color-mix(in srgb, var(--st-info) 13%, transparent);    color: var(--st-info); }
.file-card-ic.ft-success { background: color-mix(in srgb, var(--st-success) 16%, transparent); color: color-mix(in srgb, var(--st-success) 78%, #000); }
.file-card-ic.ft-warning { background: color-mix(in srgb, var(--st-warning) 16%, transparent); color: color-mix(in srgb, var(--st-warning) 72%, #000); }
.file-card-ic.ft-neutral { background: var(--bg-elevated); color: var(--text-secondary); }
.file-card-body { min-width: 0; flex: 1; }
.file-card-name { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card-size { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 1px; font-variant-numeric: tabular-nums; }
.file-card-dl { color: var(--text-tertiary); flex-shrink: 0; transition: color .12s; }

/* ===== Modal nghiệp vụ chi tiết (Chuyển xử lý / Báo cáo / Gia hạn / Đôn đốc) ===== */
.dm-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 15px; }
.dm-person { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--bg-container); border: 1px solid var(--border); border-radius: var(--r-md); }
.dm-person-name { display: block; font-size: 13px; font-weight: 600; color: var(--text-heading); }
.dm-person-sub { display: block; font-size: 11.5px; color: var(--text-tertiary); margin-top: 1px; }
.dm-person-tag { margin-left: auto; font-size: 11px; color: var(--text-tertiary); border: 1px solid var(--border); border-radius: 999px; padding: 2px 8px; }
.dm-check { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text); cursor: pointer; }
.dm-check input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--c-primary); flex-shrink: 0; }
.dm-check.disabled { color: var(--text-disabled); cursor: not-allowed; }
.dm-check-hint { display: block; font-size: 11.5px; color: var(--text-tertiary); margin-top: 2px; font-weight: 400; }
.dm-range { display: flex; align-items: center; gap: 12px; }
.dm-range input[type="range"] { flex: 1; accent-color: var(--c-primary); }
.dm-pct { font-size: 13.5px; font-weight: 600; color: var(--text-heading); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.dm-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dm-file-x { border: 0; background: transparent; color: var(--text-tertiary); cursor: pointer; display: grid; place-items: center; padding: 0; }
.dm-file-x:hover { color: var(--st-error); }
.field-err { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--st-error); margin-top: 4px; }
.dm-note { display: flex; align-items: flex-start; gap: 9px; padding: 10px 12px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--st-info) 9%, transparent); color: var(--text-secondary); font-size: 12.5px; line-height: 1.5; }
.dm-note svg { color: var(--st-info); flex-shrink: 0; margin-top: 2px; }
.dm-note b { color: var(--text-heading); font-weight: 600; }


