:root {
  /* Bảng màu AMS TQM – Trắng & Xanh lá */
  --brand: #008A4B;        /* Xanh lá chủ đạo: button, biểu đồ, icon */
  --brand-2: #006B3C;      /* Xanh lá đậm: logo, tiêu đề menu, hover */
  --brand-soft: #E8F7EF;   /* Xanh lá nhạt: nền menu chọn, nền trạng thái */
  --brand-ink: #006B3C;    /* chữ/link màu xanh */
  --accent: #F59E0B;       /* Cam cảnh báo */
  --accent-soft: #FEF3C7;
  --bg: #F5F8FC;           /* Xám nhạt: nền hệ thống */
  --surface: #FFFFFF;      /* Trắng: nền chính, card */
  --surface-2: #F8FAFC;
  --border: #E2E8F0;
  --text: #0F172A;         /* Đen xanh: chữ */
  --text-2: #475569;
  --muted: #64748B;
  --danger: #EF4444;       /* Đỏ: lỗi */
  --warn: #F59E0B;         /* Cam: cảnh báo */
  --ok: #008A4B;
  --info: #1677FF;         /* Xanh dương: trạng thái */
  --sidebar-bg: #FFFFFF;
  --sidebar-text: #334155;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.06);
  --radius: 8px;
  --sidebar: 236px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #1fbf86; --brand-2: #5fd9a8; --brand-soft: #123528; --brand-ink: #5fd9a8; --accent: #ff7a42; --accent-soft: #3a2218;
  --bg: #0f1522; --surface: #0F172A; --surface-2: #1c273b; --border: #2a364d; --text: #e6ebf3; --text-2: #b6c0d0; --muted: #8a96aa;
  --danger: #f87171; --warn: #ff7a42; --ok: #1fbf86; --info: #6aa8ef; --sidebar-bg: #0F172A; --sidebar-text: #c7d0de;
  --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: 12.5px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .error { color: var(--danger); }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.empty { padding: 60px 20px; text-align: center; }
.pad { padding: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Layout ---------- */
#app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--sidebar-bg); color: var(--sidebar-text); border-right: 1px solid var(--border); flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px; color: var(--brand-2); border-bottom: 1px solid var(--border); }
.brand:hover { text-decoration: none; }
.brand small, .brand-lg small { display: block; font-size: 11px; opacity: .75; }
.logo { background: var(--brand-2); color: #fff; font-weight: 800; border-radius: 6px; padding: 6px 7px; font-size: 13px; letter-spacing: .5px; }
.nav-group { padding: 10px 8px 2px; }
.nav-title { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--brand-2); font-weight: 700; opacity: .85; padding: 0 10px 4px; }
.nav-link { display: flex; align-items: center; gap: 10px; color: var(--sidebar-text); padding: 7px 10px; border-radius: 6px; }
.nav-link:hover { background: var(--surface-2); color: var(--brand-ink); text-decoration: none; }
.nav-link.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.nav-link .ic { width: 18px; text-align: center; color: var(--brand); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
#project-switch { max-width: 260px; }
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box input { width: 100%; }
.search-results { position: absolute; top: 110%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 380px; overflow: auto; z-index: 30; }
.search-results a { display: block; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:hover { background: var(--surface-2); text-decoration: none; }
.tag { display: inline-block; font-size: 11px; background: var(--brand-soft); color: var(--brand-ink); border-radius: 4px; padding: 0 6px; margin-right: 6px; }
#view { padding: 20px 24px 40px; outline: none; }
.menu-btn { display: none; }
.bell { position: relative; margin-left: auto; font-size: 17px; }
.bell .count { position: absolute; top: -4px; right: -6px; background: var(--accent); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 5px; font-weight: 700; }
.notif-panel { position: absolute; right: 70px; top: 52px; width: 380px; max-height: 480px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 40; }
.np-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.np-item { display: block; padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.np-item small { display: block; color: var(--muted); }
.np-item.unread { background: var(--brand-soft); }
.np-item.unread span::before { content: "● "; color: var(--accent); }
.np-all { display: block; text-align: center; padding: 8px; }
.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; background: none; border: 0; cursor: pointer; color: var(--text); font: inherit; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.dropdown { position: absolute; right: 0; top: 120%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 220px; z-index: 40; overflow: hidden; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 9px 14px; background: none; border: 0; font: inherit; color: var(--text); cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.dd-head { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.dd-head small { display: block; color: var(--muted); }

/* ---------- Login ---------- */
body.login-page #app { align-items: center; justify-content: center; background: linear-gradient(135deg, #006B3C, #008A4B 70%, #E8F7EF 160%); padding: 16px; }
.login-card { background: var(--surface); padding: 32px; border-radius: 12px; width: 400px; max-width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.brand-lg { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.brand-lg b { font-size: 17px; }
.demo-accounts { margin-top: 18px; font-size: 13px; }
.demo-accounts summary { cursor: pointer; color: var(--muted); }

/* ---------- Controls ---------- */
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; min-width: 0; }
textarea { resize: vertical; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid color-mix(in srgb, var(--brand) 25%, transparent); outline-offset: 0; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 500; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(1.05); background: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; margin-top: 8px; padding: 10px; }
.icon-btn { background: none; border: 0; cursor: pointer; color: var(--text-2); padding: 4px 6px; border-radius: 4px; font: inherit; }
.icon-btn:hover { background: var(--surface-2); }

/* ---------- Page ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card > h3:first-child { display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 12px; }
.filters select, .filters input { max-width: 190px; }
.filters .saved { display: flex; gap: 6px; margin-left: auto; align-items: center; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 3px 10px; font-size: 12.5px; }
.chip b { margin-left: 4px; }

/* ---------- Table ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); background: var(--surface-2); white-space: nowrap; font-weight: 600; }
.tbl th[data-sort] { cursor: pointer; }
.tbl th[data-sort]:hover { color: var(--text); }
.tbl tr:hover td { background: var(--surface-2); }
.tbl td.code { white-space: nowrap; font-weight: 600; }
.tbl tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.tbl.small th, .tbl.small td { padding: 5px 8px; font-size: 12.5px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px; }
.pager .muted { margin-right: auto; }
.overdue-text { color: var(--danger); font-weight: 600; }

/* ---------- Badges (luôn kèm chữ) ---------- */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.st-done, .st-closed, .st-released, .st-approved, .st-completed, .res-pass, .st-active { background: #E8F7EF; color: #006B3C; border-color: #a9e6cc; }
.st-in-progress, .st-retest, .st-testing, .st-ready-for-qa, .st-triaged { background: #e5eefb; color: #1f4f8f; border-color: #c2d5f2; }
.st-code-review, .st-ready-for-test, .st-fixed, .st-assigned { background: #efe8fb; color: #5b3596; border-color: #d8c8f2; }
.st-blocked, .st-reopened, .res-fail, .st-rolled-back { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.st-new, .st-to-do, .st-draft, .st-open, .st-planned { background: #fff4e0; color: #8a5300; border-color: #f2d9a6; }
.st-duplicate, .st-rejected, .st-deferred, .st-cannot-reproduce, .res-skipped, .res-not-run, .st-backlog, .st-on-hold { background: var(--surface-2); color: var(--muted); }
.res-blocked { background: #fff4e0; color: #8a5300; border-color: #f2d9a6; }
.sev-blocker { background: #b91c1c; color: #fff; } .sev-critical { background: #F59E0B; color: #fff; border-color: #F59E0B; }
.sev-major { background: #fff4e0; color: #8a5300; border-color: #f2d9a6; } .sev-minor { background: #e5eefb; color: #1f4f8f; border-color: #c2d5f2; }
.sev-trivial { color: var(--muted); }
.pr-critical, .pr-p0 { background: #fee2e2; color: #b91c1c; border-color: #fecaca; } .pr-high, .pr-p1 { background: #fff4e0; color: #8a5300; border-color: #f2d9a6; }
.pr-medium, .pr-p2 { background: #e5eefb; color: #1f4f8f; border-color: #c2d5f2; } .pr-low, .pr-p3 { color: var(--muted); }
:root[data-theme="dark"] .badge { filter: none; }
:root[data-theme="dark"] .badge:not(.sev-blocker) { background: var(--surface-2); color: var(--text); }

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full, .form-grid .full { grid-column: 1 / -1; }
.field label { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field input, .field select, .field textarea { width: 100%; }
.req { color: var(--danger); }
.help { color: var(--muted); font-size: 12px; }
.form-error { grid-column: 1 / -1; background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; border-radius: 6px; padding: 8px 10px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400 !important; cursor: pointer; }
.checklist { display: flex; flex-wrap: wrap; gap: 6px 14px; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.list-editor, .steps-editor { display: flex; flex-direction: column; gap: 6px; }
.list-row { display: flex; gap: 6px; } .list-row input { flex: 1; }
.steps-editor { counter-reset: step; }
.step-row { display: grid; grid-template-columns: 26px 2fr 1.2fr 2fr auto; gap: 6px; align-items: center; }
.step-no::before { counter-increment: step; content: counter(step) "."; font-weight: 700; color: var(--muted); }
.step-tools { display: flex; }
.list-editor > .btn, .steps-editor > .btn { align-self: flex-start; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow: hidden; overscroll-behavior: contain; touch-action: none; }
.modal { background: var(--surface); border-radius: 12px; width: 560px; max-width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
html.modal-open, html.modal-open body { overflow: hidden; }
html.modal-open body { padding-right: var(--scrollbar-w, 0px); }
html.modal-open .sidebar, html.modal-open #view { overflow: hidden; }
.modal.wide { width: 900px; }
.modal-head { flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 18px; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- Toast ---------- */
#toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { padding: 10px 16px; border-radius: 8px; background: #0F172A; color: #fff; box-shadow: var(--shadow); max-width: 420px; animation: pop .2s; }
.toast-err { background: #dc2626; } .toast-warn { background: #c2410c; } .toast-ok { background: #006B3C; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* ---------- Detail ---------- */
.props { display: grid; grid-template-columns: 120px 1fr; gap: 8px 10px; font-size: 13.5px; }
.props dt { color: var(--muted); }
.props dd { margin: 0; word-break: break-word; }
.title-row { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.title-row h1 { flex: 1; min-width: 240px; }
.code-label { font-weight: 700; color: var(--muted); font-size: 13px; }
.md p { margin: 0 0 .6em; } .md ul, .md ol { margin: 0 0 .6em; padding-left: 22px; }
.mention { color: var(--accent); font-weight: 600; }
.ac-list { list-style: none; padding: 0; margin: 0; }
.ac-list li { padding: 6px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 8px; align-items: flex-start; }
.ac-list li.done span { text-decoration: line-through; color: var(--muted); }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { display: flex; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.link-list li:last-child { border-bottom: 0; }
.link-list .grow { flex: 1; min-width: 0; }
.transitions { display: flex; flex-wrap: wrap; gap: 6px; }
.warn-box { background: var(--accent-soft); border: 1px solid #f6c3ab; color: #8a3410; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.ok-box { background: #E8F7EF; border: 1px solid #a9e6cc; color: #006B3C; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.note { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-left: 3px solid var(--accent); padding: 3px 8px; margin-top: 3px; }

/* ---------- Tabs, comments, timeline, files ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tab { background: none; border: 0; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--brand-ink); border-bottom-color: var(--brand); font-weight: 600; }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.comment .meta { font-size: 13px; margin-bottom: 2px; }
.comment-form { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; margin-top: 10px; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline li { padding: 4px 0 10px 14px; position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 9px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid var(--surface); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.chg { display: inline-block; margin-right: 8px; font-size: 12.5px; }
.chg s { color: var(--muted); }
.files { list-style: none; padding: 0; margin: 0 0 12px; }
.files li { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.files li > div { flex: 1; min-width: 0; word-break: break-all; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; border: 1px solid var(--border); }
.file-ic { width: 56px; text-align: center; font-size: 22px; }
.upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Kanban ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); width: 262px; flex-shrink: 0; display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.col-head { padding: 10px 12px; font-weight: 600; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }
.col-body { padding: 8px; overflow-y: auto; min-height: 80px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col.drop-ok { outline: 2px dashed var(--brand); }
.col.drop-no { opacity: .45; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; cursor: grab; box-shadow: 0 1px 1px rgba(0,0,0,.03); }
.kcard:hover { border-color: var(--brand); }
.kcard.dragging { opacity: .5; }
.kcard .kc-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.kcard .kc-title { margin: 4px 0 6px; font-weight: 500; color: var(--text); display: block; }
.kcard .kc-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.kcard .avatar { width: 22px; height: 22px; font-size: 10px; margin-left: auto; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .k-label { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.kpi .k-value { font-size: 26px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12px; color: var(--text-2); }
.kpi.alert .k-value { color: var(--danger); }
.def { cursor: help; color: var(--muted); border: 1px solid var(--border); border-radius: 50%; width: 16px; height: 16px; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 46px; gap: 8px; align-items: center; padding: 3px 4px; border-radius: 4px; color: var(--text); font-size: 13px; }
a.bar-row:hover { background: var(--surface-2); text-decoration: none; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.bar-track { height: 14px; background: transparent; border-radius: 0 4px 4px 0; position: relative; border-left: 1px solid var(--border); }
.bar-fill { display: block; height: 100%; background: var(--brand); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-fill.tone-alert { background: var(--accent); }
.bar-fill.tone-danger { background: var(--danger); } .bar-fill.tone-warn { background: var(--warn); } .bar-fill.tone-muted { background: var(--muted); }
.bar-val { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; display: flex; gap: 2px; border: 1px solid var(--border); }
.progress span { display: block; height: 100%; }
.p-pass { background: var(--ok); } .p-fail { background: var(--danger); } .p-blocked { background: var(--warn); } .p-skipped { background: var(--muted); }
.gate { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: flex-start; }
.gate .gi { font-weight: 700; width: 64px; flex-shrink: 0; font-size: 12px; }
.gate .gi.pass { color: var(--ok); } .gate .gi.fail { color: var(--danger); } .gate .gi.off { color: var(--muted); }

/* ---------- Test execution ---------- */
.run-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.case-list { max-height: calc(100vh - 260px); overflow: auto; }
.case-item { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); cursor: pointer; }
.case-item:hover { background: var(--surface-2); }
.case-item.active { background: var(--brand-soft); box-shadow: inset 3px 0 0 var(--brand); }
.case-item .grow { flex: 1; min-width: 0; }
.case-item .grow div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.result-btns label { border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.result-btns input { margin-right: 4px; }
.steps-table td:first-child { width: 36px; font-weight: 700; color: var(--muted); }

/* ---------- Giao diện Trắng & Xanh lá (icon, KPI, sidebar) ---------- */
.i { width: 18px; height: 18px; flex-shrink: 0; vertical-align: -3px; }
.sidebar { display: flex; flex-direction: column; }
.sidebar nav { flex: 1; padding-bottom: 8px; }
.brand { background: linear-gradient(135deg, #006B3C, #008a5d); color: #fff; border-bottom: 0; border-bottom-right-radius: 14px; padding: 14px 16px; }
.brand b { font-size: 17px; letter-spacing: .3px; }
.brand small { opacity: .85; }
.logo { background: var(--accent); box-shadow: 0 2px 6px rgba(240,90,26,.35); padding: 7px 9px; font-size: 14px; border-radius: 8px; }
.nav-title { margin-top: 4px; }
.nav-link { padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.nav-group { padding: 6px 8px 0; }
.sidebar { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.bar-fill[style^="width:0%"] { min-width: 0; }
.nav-link .ic { width: 20px; display: inline-flex; justify-content: center; }
.nav-link.active { box-shadow: none; }
.nav-link.active .ic { color: var(--brand-2); }
.collapse-btn { align-self: flex-end; margin: 8px 12px 12px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); }
#app.nav-collapsed { --sidebar: 68px; }
#app.nav-collapsed .brand > span:not(.logo), #app.nav-collapsed .nav-title, #app.nav-collapsed .nav-link .nl { display: none; }
#app.nav-collapsed .brand { justify-content: center; padding: 14px 8px; }
#app.nav-collapsed .nav-link { justify-content: center; padding: 9px 0; }
#app.nav-collapsed .nav-group { padding: 4px 8px; }
#app.nav-collapsed .collapse-btn { align-self: center; transform: rotate(180deg); }
.topbar { gap: 16px; }
.topbar select, .search-box input { border-radius: 8px; }
.search-box .search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; pointer-events: none; }
.search-box input { padding-left: 34px; background: var(--surface-2); }
.bell { display: inline-flex; align-items: center; color: var(--text); }
.bell .i { width: 21px; height: 21px; }
.user-btn .chev { width: 16px; height: 16px; color: var(--muted); }
.avatar { background: var(--brand-2); }
.btn { border-radius: 8px; display: inline-flex; align-items: center; gap: 6px; }
.btn .i { width: 16px; height: 16px; }
.page-head h1.h-ic { display: flex; align-items: center; gap: 10px; font-size: 24px; }
.page-head h1.h-ic .i { width: 26px; height: 26px; color: var(--brand); stroke-width: 2.6; }
.card { border-radius: 12px; border-color: var(--border); box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.card > h3:first-child { font-size: 16px; margin-bottom: 14px; }
.card > h3:first-child .i { color: var(--brand); width: 20px; height: 20px; }
.note-ic { display: flex; align-items: center; gap: 6px; margin-top: 14px; }
.note-ic .i { width: 15px; height: 15px; }
.filters { border-radius: 12px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.kpi { position: relative; overflow: hidden; border-radius: 12px; border-color: var(--border); box-shadow: 0 1px 3px rgba(15,23,42,.05); background: linear-gradient(160deg, var(--surface) 55%, color-mix(in srgb, var(--brand-soft) 75%, var(--surface))); }
.kpi.alert { background: linear-gradient(160deg, var(--surface) 55%, color-mix(in srgb, var(--danger) 12%, var(--surface))); }
.kpi .k-label { justify-content: flex-start; align-items: center; color: var(--text); font-weight: 600; font-size: 12.5px; }
.kpi .k-name { flex: 1; }
.kpi .k-ic { display: inline-flex; color: var(--brand); }
.kpi .k-ic .i { width: 22px; height: 22px; }
.kpi.alert .k-ic { color: var(--danger); }
.kpi .k-value { font-size: 28px; margin: 6px 0 2px; }
.kpi .k-value a { color: inherit; }
.kpi:not(.alert) .k-value a { color: var(--brand); }
.bars { gap: 6px; }
.bar-row { grid-template-columns: 130px 1fr 40px; gap: 14px; }
.bar-track { height: 10px; background: #edf0f4; border-left: 0; border-radius: 6px; overflow: hidden; }
.bar-fill { border-radius: 6px; }
:root[data-theme="dark"] .bar-track { background: var(--surface-2); }

/* ---------- Sidebar kiểu mới: logo lá, mục chọn nền xanh đặc, sóng trang trí ---------- */
:root { --c-blue: #1677FF; --c-orange: #F59E0B; --track: #edf0f4; }
:root[data-theme="dark"] { --track: #26324a; }
.brand { background: none; color: var(--brand-2); border-bottom: 0; border-radius: 0; padding: 18px 16px 10px 22px; }
.brand b { font-size: 26px; font-weight: 800; letter-spacing: .5px; color: var(--brand-2); line-height: 1; }
.brand small { color: var(--text); opacity: 1; font-weight: 600; font-size: 11.5px; margin-top: 2px; }
.leaf-logo { width: 46px; height: 40px; flex-shrink: 0; }
.nav-title { color: var(--brand-2); font-weight: 800; font-size: 12px; opacity: 1; }
.nav-link { color: var(--text); }
.nav-link .ic { color: var(--brand-2); }
.nav-link.active { background: var(--brand); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--brand) 35%, transparent); }
.nav-link.active .ic { color: #fff; }
.nav-link.active:hover { background: var(--brand-2); color: #fff; }
.sidebar::after { content: ""; display: block; flex-shrink: 0; height: 46px; margin-top: auto;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 46' preserveAspectRatio='none'%3E%3Cpath d='M0 22C50 4 95 8 140 22s75 14 100 2V46H0z' fill='%23E8F7EF'/%3E%3Cpath d='M0 34c55-14 100-10 150 2s70 6 90-2V46H0z' fill='%2393DDBB' opacity='.7'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat; }
#app.nav-collapsed .leaf-logo { width: 36px; }

/* ---------- Card có thanh tiêu đề nền xanh nhạt ---------- */
.mw-card { padding: 0; overflow: hidden; }
.mw-card > :not(.mw-head) { margin-left: 18px; margin-right: 18px; }
.mw-card > :last-child { margin-bottom: 16px; }
.mw-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 18px; margin-bottom: 12px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand-soft) 70%, var(--surface)), var(--surface)); }
.mw-head h3 { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 17px; }
.mw-head h3 .i { width: 24px; height: 24px; color: var(--brand-2); }
.see-all { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13.5px; color: var(--brand-ink); white-space: nowrap; }
.see-all .i { width: 16px; height: 16px; }
.mw-empty { text-align: center; padding: 10px 0 8px; color: var(--text-2); }
.mw-empty .i { width: 56px; height: 56px; color: var(--brand); stroke-width: 1.4; }
.mw-empty p { margin: 6px 0 0; }

/* ---------- 4 ô thống kê ---------- */
.mw-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.mw-tile { display: flex; align-items: center; gap: 16px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(15,23,42,.05); transition: border-color .15s, box-shadow .15s; }
.mw-tile:hover { border-color: var(--brand); }
.mw-tile.on { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.mw-tile b { display: block; font-size: 15.5px; }
.mw-tile strong { display: block; font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mw-ic { width: 58px; height: 52px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mw-ic .i { width: 30px; height: 30px; stroke-width: 1.8; }
.mw-ic.tone-red { background: #fde4e4; color: var(--danger); }
.mw-ic.tone-blue { background: #E6F0FF; color: #1677FF; }
.mw-ic.tone-green { background: var(--brand-soft); color: var(--brand-2); }
.v-red { color: var(--danger); } .v-blue { color: #1677FF; } .v-green { color: var(--brand-2); }

/* ---------- Biểu đồ ---------- */
.mw-grid-2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr); gap: 16px; }
.mw-grid-2b { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
.mw-donut-wrap { display: flex; align-items: center; gap: 22px; padding: 4px 0 4px 8px; }
.mw-donut { width: 170px; height: 170px; flex-shrink: 0; }
.mw-donut .d-num { font-size: 30px; font-weight: 800; fill: var(--text); }
.mw-donut .d-lbl { font-size: 15px; font-weight: 600; fill: var(--text); }
.mw-donut circle { transition: opacity .15s; } .mw-donut circle:hover { opacity: .85; }
.mw-legend { list-style: none; margin: 0; padding: 4px 14px; flex: 1; border: 1px solid var(--border); border-radius: 10px; }
.mw-legend li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.mw-legend li:last-child { border-bottom: 0; }
.mw-legend i { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.mw-legend span:first-of-type { flex: 1; white-space: nowrap; }
.mw-legend b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.mw-cols { width: 100%; height: auto; display: block; }
.mw-cols .g { stroke: var(--border); stroke-width: 1; }
.mw-cols .g0 { stroke: var(--text-2); stroke-width: 1; }
.mw-cols .ax { font-size: 11px; fill: var(--muted); }
.mw-cols .ax-x { font-size: 12px; font-weight: 600; fill: var(--text); }
.mw-cols .val { font-size: 13px; font-weight: 700; fill: var(--text); }
.mw-cols .col:hover path { opacity: .85; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Dòng task trong card ---------- */
.mw-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 130px 100px 170px 120px; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.mw-row:last-child { border-bottom: 0; }
.mw-row .code { font-weight: 700; }
.mw-title a { font-weight: 600; color: var(--brand-ink); }
.mw-title small { display: block; color: var(--muted); }
.mw-meta { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-size: 13.5px; }
.mw-meta .i { width: 17px; height: 17px; color: var(--text-2); }
a.plain { color: var(--text); }
.mw-card > .tbl { width: calc(100% - 36px); margin-bottom: 12px; }
.mw-card > .tbl td:nth-child(2) { min-width: 140px; }

@media (max-width: 1100px) {
  .mw-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mw-grid-2, .mw-grid-2b { grid-template-columns: 1fr; }
  .mw-row { grid-template-columns: 110px minmax(0, 1fr) auto auto; }
  .mw-row .mw-meta { display: none; }
}
@media (max-width: 600px) {
  .mw-tiles { grid-template-columns: 1fr; }
  .mw-donut-wrap { flex-direction: column; padding-left: 0; }
  .mw-legend { width: 100%; }
  .mw-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Thành phần chung cho Dashboard / Danh sách Task / Dự án ---------- */
.nowrap { white-space: nowrap; } .block { display: block; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.page-head .muted { font-size: 14px; }
.mw-head-r { display: flex; align-items: center; gap: 12px; }
.mw-head-r input[type=search] { width: 200px; padding: 5px 10px; border-radius: 8px; }

/* Ô KPI */
.tiles { display: grid; gap: 14px; margin-bottom: 16px; }
.tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tiles-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat-tile { display: flex; align-items: center; gap: 14px; text-align: left; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(15,23,42,.05); min-width: 0; }
button.stat-tile { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
button.stat-tile:hover { border-color: var(--brand); }
button.stat-tile[aria-pressed="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 30%, transparent); }
.st-ic { width: 56px; height: 56px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.st-ic .i { width: 30px; height: 30px; stroke-width: 1.8; }
.st-body { min-width: 0; }
.st-body b { display: block; font-size: 15px; }
.st-body strong { display: block; font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.st-body strong a { color: inherit; }
.st-body small { display: block; color: var(--text-2); font-size: 12.5px; }
.tone-green { background: var(--brand-soft); color: var(--brand-2); }
.tone-blue { background: #E6F0FF; color: #1677FF; }
.tone-red { background: #fde4e4; color: var(--danger); }
.tone-orange { background: #fff1dc; color: #ea7a0c; }
.tone-purple { background: #efe7fe; color: #7c3aed; }
.st-ic.tone-green, .mw-ic.tone-green { color: var(--brand-2); }
.v-orange { color: #ea7a0c; } .v-purple { color: #7c3aed; }

/* Hàng chỉ số phụ */
.metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.metric { display: inline-flex; align-items: baseline; gap: 8px; padding: 6px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: 13px; }
.metric b { color: var(--text); font-variant-numeric: tabular-nums; }
a.metric[href]:hover { border-color: var(--brand); text-decoration: none; }
.metric.alert b { color: var(--danger); }

/* Thanh lọc ngang có nhãn + icon */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }
.ff { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; }
.ff .i { width: 18px; height: 18px; color: var(--brand-2); }
.ff select, .ff input { min-width: 170px; border-radius: 8px; font-weight: 400; }
.ff-dates { display: inline-flex; align-items: center; gap: 6px; }
.ff-dates[hidden] { display: none; }
.ff-push { margin-left: auto; }
.filter-card { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; margin-bottom: 16px; }
.fc { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13.5px; flex: 1 1 150px; min-width: 150px; }
.fc select { border-radius: 8px; font-weight: 400; width: 100%; }
.fc-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.fc-actions .saved { display: flex; gap: 6px; align-items: center; }
.fc-actions .saved select { border-radius: 8px; }

/* Bố cục */
.dash-row { display: grid; gap: 16px; }
.dash-row.r-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.dash-row.r-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.05fr); }
.list-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.side-col { display: flex; flex-direction: column; }
.table-wrap.flat { position: relative; border: 0; border-radius: 0; box-shadow: none; background: transparent; overflow-x: auto; }
.mw-card > .table-wrap.flat { margin-left: 8px; margin-right: 8px; }
.mw-donut-wrap.stack { flex-direction: column; padding-left: 0; gap: 14px; }
.mw-donut-wrap.stack .mw-legend { width: 100%; }
.mw-legend a { display: flex; align-items: center; gap: 10px; flex: 1; color: inherit; }
.mw-legend a:hover { text-decoration: none; color: var(--brand-ink); }
.mw-legend li { padding: 8px 0; }

/* Test Run gần đây */
.tbl-fixed { table-layout: fixed; }
.tbl-fixed .ellipsis { max-width: none; }
.mini-stats span { white-space: nowrap; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-stats > div { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; }
.mini-stats span { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); }
.mini-stats span .i { width: 16px; height: 16px; color: #1677FF; }
.mini-stats span.ok .i { color: var(--brand); } .mini-stats span.bad .i { color: var(--danger); } .mini-stats span.warn .i { color: #ea7a0c; }
.mini-stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.sb-cap { margin: 12px 0 6px; }
.stack-bar { display: flex; gap: 2px; height: 20px; border-radius: 6px; overflow: hidden; background: var(--track); }
.stack-bar span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11.5px; font-weight: 700; min-width: 3px; }
.stack-bar.empty { align-items: center; justify-content: center; background: var(--surface-2); }

/* Release readiness */
.rel-box { display: grid; grid-template-columns: auto auto; justify-content: center; gap: 14px 28px; align-items: center; }
.rel-box .gate-list { grid-column: 1 / -1; border-top: 1px solid var(--border); padding-top: 8px; }
.rel-ver { display: flex; flex-direction: column; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--brand-2); }
.rel-ver b { font-size: 22px; } .rel-ver small { color: var(--text-2); }
.rel-ver:hover { text-decoration: none; border-color: var(--brand); }
.ring { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; }
.ring svg { width: 92px; height: 92px; }
.ring text { font-size: 20px; font-weight: 800; fill: var(--text); }
.gate-list { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.gate-list li { display: flex; align-items: flex-start; gap: 6px; padding: 4px 0; }
.gate-list li span { flex: 1; } .gate-list li b { white-space: nowrap; font-weight: 600; }
.gate-list .i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.gate-list .ok .i { color: var(--brand); } .gate-list .bad .i { color: var(--danger); } .gate-list .pending .i { color: #ea7a0c; } .gate-list .info .i { color: #1677FF; }

/* Hoạt động gần đây */
.act-list { list-style: none; margin: 0; padding: 0; }
.act { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.act:last-child { border-bottom: 0; }
.act-ic { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: inline-flex; align-items: center; justify-content: center; }
.act-ic .i { width: 18px; height: 18px; }
.act-body small { color: var(--muted); }
.act time { white-space: nowrap; }

/* Phân bổ theo nhân sự */
.people-bars { display: flex; flex-direction: column; gap: 6px; }
.pb-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 36px; gap: 14px; align-items: center; padding: 5px 4px; border-radius: 6px; color: var(--text); }
.pb-row:hover { background: var(--surface-2); text-decoration: none; }
.pb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-track { height: 12px; background: var(--track); border-radius: 6px; overflow: hidden; }
.pb-track span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), #2fc28e); }
.pb-row b { text-align: right; font-variant-numeric: tabular-nums; }

/* Avatar, người, tiến độ nhỏ */
.av { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 700; flex-shrink: 0; }
.av-sm { width: 28px; height: 28px; font-size: 11px; }
.av-more { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.av-stack { display: inline-flex; } .av-stack .av { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); } .av-stack .av:first-child { margin-left: 0; }
.person { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.mini-prog { display: inline-flex; align-items: center; gap: 8px; }
.mp-track { width: 64px; height: 7px; background: var(--track); border-radius: 4px; overflow: hidden; }
.mp-track span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.mp-val { font-size: 12.5px; font-variant-numeric: tabular-nums; min-width: 34px; }
.t-title { min-width: 200px; }
.pl-name { min-width: 190px; }
.list-layout .tbl th { white-space: nowrap; }
.t-title small { display: block; color: var(--muted); }

/* Menu hành động ⋯ */
.rmenu { position: relative; }
.rmenu summary { list-style: none; cursor: pointer; width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 18px; color: var(--text-2); }
.rmenu summary::-webkit-details-marker { display: none; }
.rmenu summary:hover, .rmenu[open] summary { background: var(--surface-2); }
.rmenu-list { position: absolute; right: 0; top: 100%; z-index: 30; min-width: 170px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.rmenu-list a, .rmenu-list button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; color: var(--text); background: none; border: 0; font: inherit; cursor: pointer; }
.rmenu-list a:hover, .rmenu-list button:hover { background: var(--brand-soft); text-decoration: none; }

/* Phân trang số */
.num-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px 0; flex-wrap: wrap; }
.np-btns { display: flex; gap: 6px; align-items: center; }
.pg { min-width: 34px; height: 34px; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; cursor: pointer; font: inherit; color: var(--text); }
.pg:hover:not(:disabled) { border-color: var(--brand); }
.pg.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; font-weight: 700; }
.pg:disabled { opacity: .45; cursor: default; }
.pg-gap { color: var(--muted); }

/* Danh sách hạn & mốc */
.due-list, .ms-list { list-style: none; margin: 0; padding: 0; }
.due-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.due-list li:last-child, .ms-list li:last-child { border-bottom: 0; }
.due-list .code { font-weight: 700; }
.due-list .ellipsis { max-width: none; }
.due-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.due-pill .i { width: 14px; height: 14px; }
.due-pill.hot { background: #fde4e4; border-color: #fecaca; color: #b91c1c; }
.ms-list li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.ms-ic .i { width: 22px; height: 22px; color: var(--brand-2); }
.ms-list b { display: block; font-size: 13.5px; } .ms-list small { color: var(--muted); }

/* Thẻ dự án */
.proj-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 16px; }
.proj-card { display: flex; flex-direction: column; gap: 9px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; color: var(--text); box-shadow: 0 1px 3px rgba(15,23,42,.05); transition: border-color .15s, transform .15s; }
.proj-card:hover { border-color: var(--brand); text-decoration: none; transform: translateY(-1px); }
.pc-top { display: flex; align-items: flex-start; gap: 10px; }
.pc-ic { width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pc-ic .i { width: 26px; height: 26px; }
.pc-name { flex: 1; min-width: 0; }
.pc-name small { display: block; color: var(--text-2); font-weight: 600; font-size: 12px; }
.pc-name b { display: block; font-size: 16.5px; line-height: 1.25; }
.pc-pm { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.pc-pm .i { width: 16px; height: 16px; color: var(--brand-2); }
.pc-prog { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: -4px; }
.pc-bar { height: 8px; background: var(--track); border-radius: 5px; overflow: hidden; }
.pc-bar span { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.pc-stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 6px; padding-top: 4px; }
.pc-stats > div { display: flex; gap: 5px; align-items: flex-start; font-size: 12.5px; }
.pc-stats .i { width: 17px; height: 17px; color: var(--brand-2); flex-shrink: 0; margin-top: 2px; }
.pc-stats .bad .i { color: var(--danger); }
.pc-stats small { display: block; color: var(--muted); font-size: 11.5px; }
.pc-stats b { font-size: 16px; }
.pc-members { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 9px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.ps-active { background: var(--brand-soft); color: var(--brand-2); }
.ps-hold { background: #fff1dc; color: #b45309; }
.ps-done { background: #E6F0FF; color: #0958D9; }

@media (max-width: 1300px) {
  .tiles-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash-row.r-3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dash-row.r-3 > :last-child { grid-column: 1 / -1; }
  .list-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1100px) {
  .tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-row.r-2, .dash-row.r-3, .list-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .tiles-4, .tiles-5, .proj-cards { grid-template-columns: 1fr; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ff { flex-wrap: wrap; } .ff select, .ff input { min-width: 0; width: 100%; }
  .pb-row { grid-template-columns: 110px minmax(0, 1fr) 30px; }
}

/* ---------- Đợt 2: Danh sách Task, Kanban, Sprint/Backlog, Test Case ---------- */
.crumb { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.crumb a { color: var(--muted); } .crumb a:hover { color: var(--brand-ink); }
.toolbar-card { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; }
.tb-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.tab-pills { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; min-width: 0; flex: 1 1 auto; scrollbar-width: thin; }
.toolbar-card > .tab-pills + .tb-actions, .toolbar-card > #tabs + .tb-actions { flex-wrap: nowrap; }
#tabs { flex: 1 1 0; min-width: 240px; display: flex; }
.tp { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; flex-shrink: 0; border-radius: 9px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.tp:hover { border-color: var(--brand); text-decoration: none; }
.tp.on { background: var(--brand-2); color: #fff; }
.tp .i { width: 17px; height: 17px; }
.fcount { background: var(--brand); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; font-weight: 700; }
.filter-card[hidden], .bulk-bar[hidden] { display: none; }
.filter-card input[type=search] { border-radius: 8px; width: 100%; }
.fc-note { flex-basis: 100%; margin: 0; }
.bulk-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.bulk-bar b { margin-right: 6px; color: var(--brand-2); }
.table-card { padding: 0; overflow: hidden; border-radius: 12px; }
.table-card .table-wrap.flat { margin: 0; }
.tbl-lg th { background: color-mix(in srgb, var(--brand-soft) 65%, var(--surface)); color: var(--text); text-transform: none; font-size: 13.5px; font-weight: 700; letter-spacing: 0; padding-top: 12px; padding-bottom: 12px; white-space: nowrap; }
.tbl-lg td { padding-top: 11px; padding-bottom: 11px; vertical-align: middle; }
.tbl-lg th, .tbl-lg td { padding-left: 8px; padding-right: 8px; }
.tbl-lg .chk { width: 34px; }
.tbl-lg .mp-val { min-width: 30px; } .tbl-lg .date-cell { gap: 4px; } .tbl-lg .mini-prog { gap: 6px; }
.tbl-lg .person span:last-child { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
.tbl-lg .t-title { min-width: 140px; }
.tbl-lg .mp-track { width: 48px; }
.tbl-lg td .small.nowrap { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tbl-lg td.code a { font-weight: 700; }
.chk { width: 40px; text-align: center; }
.chk input { width: 17px; height: 17px; accent-color: var(--brand); }
.date-cell { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.date-cell .i { width: 16px; height: 16px; color: var(--text-2); }
.date-cell.overdue-text .i { color: var(--danger); }
.tfoot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.tf-size { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); }
.tf-size select { width: auto; border-radius: 8px; padding: 4px 8px; }
.num { text-align: right; }

/* Nhãn trạng thái / ưu tiên / kết quả / loại */
.spill, .ppill, .rpill, .tpill, .tagpill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.spill { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.sp-in-progress, .sp-reopened { background: #E6F0FF; color: #0958D9; border-color: #BAD4FF; }
.sp-code-review { background: #efe7fe; color: #6d28d9; border-color: #ddd0fb; }
.sp-ready-for-test, .sp-testing { background: #e0f4fe; color: #0369a1; border-color: #c4e8fc; }
.sp-done { background: var(--brand-soft); color: var(--brand-2); border-color: #b7ead3; }
.sp-blocked { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.ppill .i, .rpill .i, .tpill .i { width: 14px; height: 14px; stroke-width: 2.4; }
.pp-critical { background: #fee2e2; color: #b91c1c; }
.pp-high { background: #ffe9e6; color: #dc2626; }
.pp-medium { background: #fff4d6; color: #b45309; }
.pp-low { background: var(--brand-soft); color: var(--brand-2); }
.rp-pass { background: var(--brand-soft); color: var(--brand-2); }
.rp-fail { background: #fee2e2; color: #b91c1c; }
.rp-blocked { background: #fff1dc; color: #b45309; }
.rp-skipped, .rp-not-run { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.tpill { background: #f1f5f9; color: #334155; font-weight: 500; }
.tp-feature { background: var(--brand-soft); color: var(--brand-2); }
.tp-improvement { background: #e0f4fe; color: #0369a1; }
.tp-bug-fix { background: #fee2e2; color: #b91c1c; }
.tp-research { background: #efe7fe; color: #6d28d9; }
.tagpill { background: #f1f5f9; color: #475569; font-weight: 500; }

/* Kanban */
.proj-pick { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; border: 1px solid var(--border); border-radius: 10px; padding: 4px 6px 4px 12px; }
.proj-pick .i { width: 18px; height: 18px; color: var(--brand-2); }
.proj-pick select { border: 0; font-weight: 700; padding: 4px 6px; min-width: 200px; background: transparent; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg-b { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; background: var(--surface); color: var(--text); border: 0; font: inherit; font-weight: 600; cursor: pointer; }
.seg-b.on { background: var(--brand-2); color: #fff; }
.seg-b:hover { text-decoration: none; }
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board .col { flex: 0 0 300px; background: color-mix(in srgb, var(--kc) 7%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--kc) 18%, var(--border)); border-radius: 14px; padding: 0; min-height: 200px; }
.board .col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px 16px; border-radius: 14px 14px 0 0; background: color-mix(in srgb, var(--kc) 12%, var(--surface)); }
.board .col-head h3 { margin: 0; font-size: 16px; }
.col-n { background: color-mix(in srgb, var(--kc) 22%, var(--surface)); color: color-mix(in srgb, var(--kc) 70%, #000); font-weight: 700; font-size: 12.5px; border-radius: 10px; padding: 1px 9px; }
.col-tools { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; }
.col-tools .icon-btn .i { width: 18px; height: 18px; }
.board .col-body { padding: 10px; display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.col-empty { text-align: center; color: var(--muted); font-size: 12.5px; border: 1px dashed var(--border); border-radius: 10px; padding: 18px 8px; margin: 0; }
.board .col.collapsed { flex: 0 0 56px; min-height: 360px; }
.board .col.collapsed .col-head { flex-direction: column; height: 100%; padding: 12px 6px; background: transparent; }
.board .col.collapsed .col-head h3 { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 14px; cursor: pointer; white-space: nowrap; }
.board .col.collapsed .col-tools { margin: 0; order: -1; }
.board .col.collapsed .col-body { display: none; }
.board .kcard { position: relative; display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--kc); border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(15,23,42,.06); cursor: grab; }
.board .kcard:hover { box-shadow: 0 4px 12px rgba(15,23,42,.1); border-color: color-mix(in srgb, var(--kc) 45%, var(--border)); border-left-color: var(--kc); }
.kc-code { font-weight: 800; color: var(--brand-2); font-size: 13.5px; }
.board .kc-title { color: var(--text); font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.kc-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.board .kc-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.kc-prog { display: flex; align-items: center; gap: 8px; }
.kc-prog .mp-track { flex: 1; width: auto; height: 7px; }
.kc-prog b { font-size: 12px; min-width: 34px; text-align: right; }
.board .col.drop-ok { outline: 2px dashed var(--brand); outline-offset: -2px; }
.board .col.drop-no { opacity: .55; }

/* Sprint / Backlog */
.sb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.big-tabs { display: inline-flex; gap: 8px; }
.bt { display: inline-flex; align-items: center; gap: 8px; padding: 10px 26px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--text); }
.bt.on { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.bt .i { width: 20px; height: 20px; }
.sprint-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.sprint-list { position: sticky; top: 70px; }
.sprint-list > :not(.mw-head) { margin-left: 12px; margin-right: 12px; }
.sl-item { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 12px 30px 12px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; color: var(--text); }
.sl-item > div { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.sl-item .i { width: 15px; height: 15px; vertical-align: -2px; }
.sl-item:hover { border-color: var(--brand); text-decoration: none; }
.sl-item.on { background: var(--brand-soft); border-color: var(--brand); }
.sl-arrow { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 20px; color: var(--muted); }
.sprint-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sprint-head h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 22px; }
.sh-dates { margin-left: 14px; white-space: nowrap; color: var(--text); }
.sh-dates .i, .sprint-head .small .i { width: 16px; height: 16px; vertical-align: -3px; }
.sh-actions { display: flex; gap: 8px; align-items: center; }
.sprint-cards { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; }
@media (max-width: 1700px) { .sprint-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .sprint-cards > :last-child { grid-column: 1 / -1; } .burndown { max-height: 210px; } }
.sp-leg { flex: 1; min-width: 0; }
.sp-leg .mw-legend { border: 0; padding: 0; }
.sp-total { display: flex; justify-content: space-between; background: var(--surface-2); border-radius: 8px; padding: 8px 12px; margin-top: 6px; }
.sp-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-kpis > div { display: grid; grid-template-columns: 46px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.sp-kpis .st-ic { width: 46px; height: 46px; grid-row: 1 / 3; }
.sp-kpis .st-ic .i { width: 24px; height: 24px; }
.sp-kpis b { font-size: 24px; line-height: 1.1; } .sp-kpis small { color: var(--text-2); }
.bd-legend { display: flex; gap: 16px; justify-content: flex-end; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.bd-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bd-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.bd-legend .dash { width: 18px; border-top: 2px dashed #64748b; display: inline-block; }
.burndown { width: 100%; height: auto; display: block; }
.burndown .g { stroke: var(--border); } .burndown .g0 { stroke: var(--text-2); }
.burndown .ax { font-size: 10px; fill: var(--muted); }
.burndown .plan { stroke: #64748b; stroke-width: 1.6; stroke-dasharray: 5 4; }
.st-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 18px 0; margin: 0 0 12px !important; }
.st-bar select { width: auto; border-radius: 8px; }
.sprint-tabs { padding-bottom: 0; }
.sprint-tabs > .table-wrap.flat { margin: 0 !important; }
.sprint-tabs > .tfoot { margin: 0 !important; }
.add-menu summary.btn { list-style: none; width: auto; height: auto; font-size: 14px; color: #fff; }
.add-menu summary.btn:hover, .add-menu[open] summary.btn { background: var(--brand-2); }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.report-grid h4 { margin: 0 0 8px; }
.pick-list { max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; }
.pick-row { display: grid; grid-template-columns: 22px 110px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.pick-row:last-child { border-bottom: 0; }
.pick-row:hover { background: var(--surface-2); }

@media (max-width: 1300px) {
  .sprint-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sprint-cards > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1100px) {
  .sprint-layout { grid-template-columns: 1fr; }
  .sprint-list { position: static; }
  .sprint-cards, .report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .board .col { flex-basis: 85vw; }
  .tb-actions { margin-left: 0; }
  .pick-row { grid-template-columns: 22px 1fr; }
}

/* ---------- Đợt 3: master–detail (Suite, Plan, Run, Bug, Release) + Chi tiết Bug ---------- */
.tiles-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tiles-6 .st-ic { width: 48px; height: 48px; } .tiles-6 .st-ic .i { width: 26px; height: 26px; }
.tiles-6 .st-body strong { font-size: 26px; }
.lsel { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 3px 4px 3px 12px; background: var(--surface); font-size: 13.5px; color: var(--text-2); }
.lsel select { border: 0; background: transparent; font-weight: 700; color: var(--text); padding: 6px 4px; max-width: 230px; }
.lsel select:focus { outline: none; } .lsel:focus-within { border-color: var(--brand); }
.lsel select:disabled { color: var(--muted); font-weight: 500; }
.opt-sub { display: none; }
@media (max-width: 1650px) { .bug-side .info-2 { grid-template-columns: 1fr; } .bug-main .repro { grid-template-columns: 1fr; } .bug-main .repro > div + div { border-left: 0; padding-left: 0; } .md-table .col-opt { display: none; } .md-table .person > span:last-child { display: none; } .md-table .t-title { min-width: 130px; } .md-table .vpill { padding: 2px 8px; font-size: 12px; } .md-table th, .md-table td { padding-left: 7px; padding-right: 7px; } .md-layout { grid-template-columns: minmax(0, 1fr) 360px; } .md-table .opt-sub { display: inline; } .md-table small.opt-sub, .md-table .t-title .opt-sub { display: block; } }
.md-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); gap: 16px; align-items: start; }
.md-table tbody tr[data-row] { cursor: pointer; }
.md-table tbody tr[data-row]:hover td { background: var(--surface-2); }
.md-table tbody tr.sel td { background: var(--brand-soft); }
.md-table tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
.md-detail { position: sticky; top: 70px; padding: 16px 18px; border-radius: 12px; max-height: calc(100vh - 90px); overflow: auto; }
.dp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.dp-head h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; line-height: 1.3; }
.dp-head h3 .i { width: 24px; height: 24px; color: var(--brand-2); flex-shrink: 0; }
.dp-head h3 a { color: var(--text); }
.dp-title { font-weight: 600; margin: 4px 0 10px; }
.dp-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.dp-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px; font: inherit; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.dp-tab.on { color: var(--brand-2); border-bottom-color: var(--brand); }
.dp-tab:hover { color: var(--brand-2); }
.dp-body { min-height: 120px; }
.dp-body .tbl { margin: 0; }
.dp-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 14px; }
.dp-actions .btn { flex: 1 1 auto; justify-content: center; }
.info-rows { display: grid; grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); gap: 9px 14px; margin: 0; font-size: 13.5px; align-items: center; }
.info-rows dt { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.info-rows dt .i { width: 17px; height: 17px; color: var(--muted); }
.info-rows dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; white-space: pre-wrap; }
.note-box p { margin: 0 0 4px; }
.vpill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.vpill .i { width: 14px; height: 14px; stroke-width: 2.4; }
.vp-green { background: var(--brand-soft); color: var(--brand-2); }
.vp-blue { background: #E6F0FF; color: #0958D9; }
.vp-orange { background: #FEF3C7; color: #B45309; }
.vp-red { background: #FEE2E2; color: #B91C1C; }
.vp-purple { background: #EFE7FE; color: #6D28D9; }
.vp-gray { background: #F1F5F9; color: #475569; }
.vpill.ver { padding: 2px 10px; }
.btn-danger-soft { background: #FEF2F2; border-color: #FECACA; color: #DC2626; }
.btn-danger-soft:hover { background: #FEE2E2; }
.btn-success-soft { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 40%, transparent); color: var(--brand-2); }
.num-c { text-align: center; }
.mini-prog.wide .mp-track { width: 160px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--brand-soft); }
.tl li { position: relative; padding: 6px 0 8px 10px; font-size: 13px; }
.tl li::before { content: ""; position: absolute; left: -22px; top: 11px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--surface); }
.steps-num { list-style: none; counter-reset: s; padding: 0; margin: 0 0 10px; }
.steps-num li { counter-increment: s; position: relative; padding: 4px 0 6px 36px; font-size: 13.5px; }
.steps-num li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 50%; background: var(--brand-2); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.exp-act { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ea { border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.ea b { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ea b .i { width: 16px; height: 16px; }
.ea p { margin: 0; }
.ea.ok { background: var(--brand-soft); } .ea.ok b { color: var(--brand-2); }
.ea.bad { background: #FEF2F2; } .ea.bad b { color: #DC2626; }
.run-ov { display: grid; grid-template-columns: 1fr; gap: 14px; }
.run-ring { display: grid; grid-template-columns: 150px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; column-gap: 14px; }
.run-ring svg { grid-row: 1 / 3; }
.run-ring .mw-legend { border: 0; padding: 0; width: 100%; }
.run-ring .mw-legend li { padding: 4px 0; font-size: 13px; }
.rel-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(150px, 1fr); gap: 16px; }
.rel-stats { display: grid; grid-template-columns: 1fr auto; gap: 9px 10px; margin: 0; font-size: 13.5px; border-left: 1px solid var(--border); padding-left: 14px; align-content: start; }
.rel-stats dt { display: flex; align-items: center; gap: 6px; color: var(--text-2); }
.rel-stats dt .i { width: 16px; height: 16px; color: var(--brand-2); }
.rel-stats dd { margin: 0; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.gate-h { display: flex; align-items: center; gap: 8px; margin: 16px 0 6px; font-size: 14.5px; }
.gate-h .i { width: 18px; height: 18px; color: var(--brand-2); }
.md-notes { font-size: 13.5px; }
.back { font-size: 22px; color: var(--text); text-decoration: none; padding: 0 6px; }
.back:hover { color: var(--brand-2); text-decoration: none; }

/* Chi tiết Bug */
.bug-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); gap: 16px; align-items: start; }
.bug-main { padding: 18px 22px; border-radius: 12px; }
.bug-main section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.bug-main section h3, .side-h { display: flex; align-items: center; gap: 8px; font-size: 15.5px; margin: 0 0 10px; }
.bug-main section h3 .i { width: 18px; height: 18px; color: var(--brand-2); }
.bm-head { display: flex; align-items: center; gap: 10px; font-size: 20px; }
.bm-head > .i { width: 26px; height: 26px; color: #DC2626; }
.bm-title { font-size: 22px; margin: 6px 0 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.chip2 { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; font-size: 13px; color: var(--text-2); background: var(--surface); }
.chip2 .i { width: 15px; height: 15px; color: var(--brand-2); }
.chip2 b { color: var(--text); } .chip2 a b { color: var(--brand-ink); }
.repro { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; }
.repro > div + div { border-left: 1px solid var(--border); padding-left: 18px; }
.repro .exp-act { grid-template-columns: 1fr 1fr; }
.ftiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.ftile { position: relative; display: flex; flex-direction: column; gap: 6px; }
.fprev { height: 96px; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); }
.fprev img { width: 100%; height: 100%; object-fit: cover; }
.fdoc { flex-direction: column; gap: 4px; font-weight: 700; font-size: 12px; }
.fdoc .i { width: 30px; height: 30px; }
.fname { font-size: 12.5px; text-align: center; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fdel { position: absolute; top: 4px; right: 4px; background: var(--surface); border-radius: 6px; padding: 2px; }
.fdel .i { width: 14px; height: 14px; }
.fup { height: 96px; border: 2px dashed var(--border); border-radius: 10px; align-items: center; justify-content: center; cursor: pointer; color: var(--brand-2); text-align: center; }
.fup .i { width: 24px; height: 24px; transform: rotate(180deg); }
.fup small { color: var(--muted); font-size: 11.5px; }
.fup:hover { border-color: var(--brand); background: var(--brand-soft); }
.cmts { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.cmt { display: flex; gap: 10px; font-size: 13.5px; }
.cmt p { margin: 2px 0 0; }
.cmt-form { display: flex; gap: 8px; }
.cmt-form input { flex: 1; border-radius: 10px; }
.cmt-form .btn .i { width: 18px; height: 18px; }
.bug-side { display: flex; flex-direction: column; }
.bug-side .card { border-radius: 12px; padding: 16px 18px; }
.bug-side h4 { margin: 14px 0 8px; font-size: 13.5px; color: var(--text-2); }
.stepper { display: flex; list-style: none; padding: 0; margin: 4px 0 12px; }
.stepper li { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; font-size: 12.5px; }
.stepper li::before { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: var(--border); z-index: 0; }
.stepper li:first-child::before { display: none; }
.stepper li.done::before, .stepper li.cur::before { background: var(--brand); }
.stepper .sn { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.stepper .sn .i { width: 16px; height: 16px; stroke-width: 3; }
.stepper .done .sn { background: var(--brand); border-color: var(--brand); color: #fff; }
.stepper .cur .sn { background: var(--brand-2); border-color: var(--brand-2); color: #fff; box-shadow: 0 0 0 4px var(--brand-soft); }
.stepper small { color: var(--muted); min-height: 1em; }
.info-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.info-2 .info-rows { grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); }
.lk { list-style: none; margin: 0; padding: 0; }
.lk li { display: grid; grid-template-columns: 20px 110px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.lk li:last-child { border-bottom: 0; }
.lk .i { width: 16px; height: 16px; color: var(--brand-2); }
.lk li > span { color: var(--text-2); }
.lk a { border: 1px solid var(--border); border-radius: 8px; padding: 5px 10px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk a:hover { border-color: var(--brand); text-decoration: none; }

@media (max-width: 1500px) { .tiles-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1400px) {
  .md-layout { grid-template-columns: minmax(0, 1fr) 380px; }
  .info-2 { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  .md-layout, .bug-layout { grid-template-columns: 1fr; }
  .md-detail { position: static; max-height: none; }
  .repro { grid-template-columns: 1fr; } .repro > div + div { border-left: 0; padding-left: 0; }
}
@media (max-width: 640px) {
  .tiles-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .run-ov, .rel-grid, .exp-act, .repro .exp-act { grid-template-columns: 1fr; }
  .rel-stats { border-left: 0; padding-left: 0; }
  .lk li { grid-template-columns: 20px 1fr; } .lk li > a { grid-column: 1 / -1; }
}

/* ---------- Đặc tả v2: giao việc – nhận việc – nghiệm thu ---------- */
/* Nhãn trạng thái Task (màu cố định theo trạng thái) */
.sp-unassigned { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }
.sp-pending { background: #FEF3C7; color: #B45309; border-color: #FDE68A; }
.sp-accepted { background: #E0F2FE; color: #0369A1; border-color: #BAE6FD; }
.sp-in-progress { background: #E6F0FF; color: #0958D9; border-color: #BAD4FF; }
.sp-in-review { background: #EFE7FE; color: #6D28D9; border-color: #DDD0FB; }
.sp-done { background: var(--brand-soft); color: var(--brand-2); border-color: #B7EAD3; }
.sp-declined { background: #FFEDD5; color: #C2410C; border-color: #FED7AA; }
.sp-on-hold { background: #E2E8F0; color: #334155; border-color: #CBD5E1; }
.sp-rework { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }
.sp-cancelled { background: #F8FAFC; color: #94A3B8; border-color: #E2E8F0; text-decoration: line-through; }
.block { display: block; }
.tab-pad { padding: 4px 18px 18px; }
.tab-pad section { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 14px; }
.tab-pad section:first-child { border-top: 0; margin-top: 0; }
.tab-pad section h3 { display: flex; align-items: center; gap: 8px; font-size: 15.5px; margin: 0 0 10px; }
.tab-pad section h3 .i { width: 18px; height: 18px; color: var(--brand-2); }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.sec-head h3 { margin: 0 !important; }
.plain-list { margin: 0; padding-left: 18px; }

/* Chi tiết Task */
.task-hero { padding: 18px 22px; border-radius: 12px; }
.th-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.th-code { font-weight: 800; color: var(--brand-2); font-size: 16px; }
.th-title { font-size: 22px; margin: 8px 0 10px; }
.th-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13.5px; color: var(--text-2); align-items: center; }
.th-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.th-meta .i { width: 16px; height: 16px; color: var(--brand-2); }
.th-meta b { color: var(--text); }
.task-hero .warn-box, .task-hero .ok-box { margin: 12px 0 0; display: flex; gap: 6px; align-items: flex-start; }
.task-hero .warn-box .i, .task-hero .ok-box .i { width: 17px; height: 17px; flex-shrink: 0; margin-top: 2px; }
.th-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin-top: 16px; }
.task-tabs { padding: 0; }
.task-tabs .dp-tabs { padding: 0 14px; margin-bottom: 4px; }
.task-side { padding: 16px 18px; border-radius: 12px; position: sticky; top: 70px; }
.crit-list { list-style: none; margin: 0; padding: 0; }
.crit-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.crit-list li:last-child { border-bottom: 0; }
.crit-res { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; }
.crit-res .btn .i { width: 14px; height: 14px; }
.prog-edit { display: flex; align-items: center; gap: 12px; }
.prog-edit input[type=range] { flex: 1; accent-color: var(--brand); max-width: 360px; }
.acc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.acc { border: 1px solid var(--border); border-left: 4px solid #8B5CF6; border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.acc.approved { border-left-color: var(--brand); } .acc.rework { border-left-color: var(--danger); }
.acc-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.acc-r { margin-top: 4px; color: var(--text-2); }
.acc-crit { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; }
.review-tbl td:last-child { width: 1%; }
.bug-view h4 { margin: 14px 0 8px; }
.bug-view .info-rows { margin-bottom: 10px; }

/* Công việc của tôi */
.mw-row2 { display: flex; justify-content: space-between; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.mw-row2:last-child { border-bottom: 0; }
.mw-row2.is-overdue { box-shadow: inset 3px 0 0 var(--danger); }
.w-main { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.w-main .code { font-weight: 800; }
.w-title { flex-basis: 100%; font-weight: 600; color: var(--text); font-size: 14.5px; }
.w-main small { flex-basis: 100%; }
.w-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.w-acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.w-acts .btn .i { width: 15px; height: 15px; }
.mw-card > .mw-row2 { margin: 0 !important; }
.mw-sub { margin: 10px 0 0 !important; border-top: 1px dashed var(--border); }
.mw-sub .mw-head { background: none; }

/* Giao việc */
.assign-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.quick-form { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; position: sticky; top: 70px; }
.quick-form > .fc, .quick-form > .qf-2, .quick-form > .qf-actions, .quick-form > .form-error { margin-left: 18px; margin-right: 18px; }
.quick-form .fc input, .quick-form .fc textarea, .quick-form .fc select { width: 100%; border-radius: 8px; font-weight: 400; }
.qf-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qf-2 .fc { min-width: 0; }
.qf-actions { display: flex; justify-content: space-between; gap: 8px; }
#given .tab-pills { padding: 0 18px 10px; flex-wrap: wrap; }
.given-tbl td { vertical-align: middle; }

/* Dashboard / Dự án */
.proj-progress { display: flex; flex-direction: column; }
.pp-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(140px, 1fr) auto; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--border); color: var(--text); }
.pp-row:last-child { border-bottom: 0; }
.pp-row:hover { background: var(--surface-2); text-decoration: none; }
.pp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-bar .mp-track { width: 100%; max-width: 160px; }
.pp-meta { display: flex; gap: 4px; }
.proj-hero { display: grid; grid-template-columns: auto minmax(0, 1fr) 220px; gap: 16px; align-items: center; padding: 16px 20px; border-radius: 12px; }
.ph-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.ph-prog { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 13px; }
.ph-prog .pc-bar { grid-column: 1 / -1; }
.big-tabs2 { margin: 16px 0 14px; }

@media (max-width: 1200px) {
  .task-layout, .assign-layout { grid-template-columns: 1fr; }
  .task-side, .quick-form { position: static; }
  .proj-hero { grid-template-columns: auto 1fr; } .ph-prog { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .mw-row2 { flex-direction: column; } .w-side { align-items: flex-start; } .w-acts { justify-content: flex-start; }
  .qf-2 { grid-template-columns: 1fr; }
  .pp-row { grid-template-columns: 1fr; }
}

/* Nhật ký thao tác */
.audit-tbl td { vertical-align: top; font-size: 13px; }
.audit-tbl .tag { margin-right: 4px; }
.audit-chg { min-width: 260px; max-width: 520px; }
.audit-chg .chg { display: inline-block; margin: 0 8px 2px 0; }
.raw summary { cursor: pointer; color: var(--brand-ink); font-size: 12px; margin-top: 4px; }
.raw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.raw-grid pre { margin: 2px 0 0; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 11.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .detail-layout, .run-layout { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .menu-btn { display: inline-block; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: 1fr; }
  #view { padding: 16px; }
  .user-name { display: none; }
  .topbar { padding: 8px 16px; gap: 8px; flex-wrap: wrap; }
  #project-switch { max-width: 150px; }
  .notif-panel { right: 16px; left: 16px; width: auto; }
  .step-row { grid-template-columns: 22px 1fr; }
  .step-row input[data-k=input], .step-row input[data-k=expected] { grid-column: 2; }
  .step-tools { grid-column: 2; }
}
@media print { .sidebar, .topbar, .actions, .filters { display: none !important; } }

/* Giao việc: form tạo nhanh không kế thừa flex-basis của thanh lọc; cột tiêu đề đủ rộng */
.quick-form > .fc, .qf-2 > .fc { flex: none; min-width: 0; }
.given-tbl td:nth-child(2) { min-width: 220px; }
.given-tbl td:last-child .btn { white-space: nowrap; }

/* Khung tải tệp: kéo thả / dán ảnh (Ctrl+V) / xem trước */
.dropzone { border: 2px dashed var(--border); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus-visible, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.dz-hint { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; color: var(--text-2); font-size: 13px; }
.dz-hint b { color: var(--brand-2); }
.dz-hint kbd { border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; font-size: 11px; background: var(--surface); }
.dropzone.has-files .dz-hint { flex-direction: row; justify-content: center; gap: 8px; font-size: 12px; }
.dz-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dropzone.has-files .dz-list { margin-top: 10px; }
.dz-item { position: relative; width: 96px; display: flex; flex-direction: column; gap: 2px; cursor: default; }
.dz-item img, .dz-file { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.dz-file { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text-2); font-size: 12px; }
.dz-item small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.dz-rm { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(15,23,42,.65); color: #fff; font-size: 11px; cursor: pointer; line-height: 1; }
/* Ảnh mô tả trong Task */
.desc-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 10px; }
.desc-gallery img, .desc-gallery video { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); display: block; background: var(--surface-2); }
.desc-gallery a:hover img { border-color: var(--brand); }
.add-img { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border: 1px dashed var(--brand); border-radius: 8px; color: var(--brand-ink); font-weight: 600; font-size: 13px; cursor: pointer; }
.add-img .i { width: 15px; height: 15px; }
.add-img:hover { background: var(--brand-soft); }

/* Kanban 4 cột: các cột chia đều chiều ngang */
.board.board4 .col { flex: 1 1 0; min-width: 260px; }
.kc-top2 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kc-top2 .spill { font-size: 11px; padding: 1px 8px; }
/* Ảnh minh họa kèm lý do trong lịch sử */
.log-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.log-imgs img { width: 110px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.log-imgs a:hover img { border-color: var(--brand); }

/* Kanban: kéo thả mượt bằng con trỏ */
.board4 .kcard { cursor: grab; user-select: none; -webkit-user-select: none; transition: box-shadow .15s, transform .15s, opacity .15s; }
.board4 .kcard:active { cursor: grabbing; }
.board4 .kcard:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.kc-right { display: inline-flex; align-items: center; gap: 4px; }
.kc-right .rmenu summary { width: 24px; height: 22px; font-size: 16px; }
.kghost { position: fixed; z-index: 1000; pointer-events: none; margin: 0; box-shadow: 0 18px 40px rgba(15,23,42,.25), 0 2px 6px rgba(15,23,42,.12) !important; opacity: .97; will-change: transform; }
.kplaceholder { background: color-mix(in srgb, var(--kc) 8%, var(--surface-2)) !important; border: 2px dashed color-mix(in srgb, var(--kc) 55%, var(--border)) !important; box-shadow: none !important; }
.kplaceholder > * { visibility: hidden; }
body.kdragging, body.kdragging * { cursor: grabbing !important; user-select: none !important; }
.board4 .col { transition: background-color .15s, border-color .15s, box-shadow .15s, opacity .15s; }
.board4 .col.drop-no { opacity: .45; }
.board4 .col.drop-ok { outline: 0; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--kc) 35%, transparent); }
.board4 .col.drop-ok.over { box-shadow: inset 0 0 0 3px var(--kc); background: color-mix(in srgb, var(--kc) 14%, var(--surface-2)); }
.board4 .col.x.over { box-shadow: inset 0 0 0 2px var(--border); }
.kpending { opacity: .6; pointer-events: none; }
.kdropped { animation: kdrop .45s ease-out; }
.kreturn { animation: kreturn .35s ease-out; }
@keyframes kdrop { 0% { transform: scale(.96); box-shadow: 0 0 0 3px color-mix(in srgb, var(--kc) 50%, transparent); } 100% { transform: none; } }
@keyframes kreturn { 0%, 100% { transform: none; } 30% { transform: translateX(-6px); } 60% { transform: translateX(5px); } }
@media (prefers-reduced-motion: reduce) { .kdropped, .kreturn { animation: none; } .board4 .kcard, .board4 .col { transition: none; } }

/* Task quá hạn / sắp đến hạn: nổi bật */
.due-badge { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.due-badge .i { width: 13px; height: 13px; stroke-width: 2.5; }
.due-badge.over { background: var(--danger); color: #fff; }
.due-badge.soon { background: #FEF3C7; color: #B45309; border: 1px solid #FDE68A; }
td .due-badge { display: flex; width: max-content; margin-top: 4px; }
.board .kcard.is-overdue { border-left-color: var(--danger) !important; background: linear-gradient(0deg, #FEF2F2, #FEF2F2), var(--surface); border-color: #FECACA; box-shadow: 0 0 0 1px #FECACA, 0 2px 6px rgba(239,68,68,.12); }
.board .kcard.is-overdue .kc-title { color: #991B1B; }
.board .kcard.is-soon { border-left-color: #F59E0B !important; }
.tbl tr.overdue td { background: #FEF2F2; }
.tbl tr.overdue td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.tbl tr.overdue:hover td { background: #FEE2E2; }
.tbl tr.due-soon td:first-child { box-shadow: inset 4px 0 0 #F59E0B; }
.due-chips { display: flex; gap: 6px; }
.due-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; }
.due-chip .i { width: 16px; height: 16px; }
.due-chip.over { background: #FEF2F2; color: #B91C1C; border: 1px solid #FECACA; }
.due-chip.over.on { background: var(--danger); color: #fff; border-color: var(--danger); }
.due-chip.soon { background: #FFFBEB; color: #B45309; border: 1px solid #FDE68A; }
.due-chip.soon.on { background: #F59E0B; color: #fff; border-color: #F59E0B; }
.due-chip b { font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .tbl tr.overdue td { background: rgba(239,68,68,.12); }
:root[data-theme="dark"] .board .kcard.is-overdue { background: rgba(239,68,68,.12); }

/* Thời gian thực hiện Task */
.tm-cell { min-width: 120px; line-height: 1.35; }
.tm-total { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-2); font-size: 13px; margin-top: 2px; }
.tm-total .i, .tm-run .i { width: 13px; height: 13px; }
.tm-run { display: inline-flex; align-items: center; gap: 4px; color: #0958D9; font-size: 12.5px; font-weight: 600; }
