/* Project Hub: giao diện tối giản, hiện đại (tham khảo cách bố trí của monday.com).
   Chủ đề: data-theme="light" (mặc định) | "dark" | "auto" (theo máy). */
:root {
  color-scheme: light;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23676f82' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev-ink: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232b2f42' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23ffffff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --chev-todo: var(--chev-ink);
  --bg: #f6f7fb; --surface: #ffffff; --surface2: #f1f2f6; --hover: #f7f8fc;
  --text: #1f2330; --muted: #676f82; --border: #e5e7ef; --border-strong: #d3d6e2;
  --accent: #0073ea; --accent-hover: #0060c4; --accent-bg: #e8f2fd; --accent-text: #0059b8;
  --danger: #c8324a; --danger-bg: #fdecef; --warn: #9a5b00; --warn-bg: #fff2d9;
  --ok: #007a48; --ok-bg: #e2f6ec; --info: #0b6e86; --info-bg: #e3f4f8;
  /* màu ô trạng thái (chữ đi kèm bảo đảm đủ tương phản) */
  --st-todo: #c9ccd8; --st-todo-t: #22263a; --st-doing: #fdbc64; --st-doing-t: #3a2500;
  --st-waiting: #8b52cc; --st-waiting-t: #ffffff; --st-done: #00854f; --st-done-t: #ffffff;
  --pr-low: #cfe2fd; --pr-low-t: #123c74; --pr-high: #5b3fb3; --pr-high-t: #ffffff; --pr-urgent: #c8324a; --pr-urgent-t: #ffffff;
  --radius: 10px; --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(24, 28, 48, .06);
  --shadow-lg: 0 12px 32px rgba(24, 28, 48, .16);
  --side-w: 232px; --top-h: 56px;
  font-family: Figtree, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239ba1b4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); --chev-todo: var(--chev-white);
  --bg: #15171f; --surface: #1c1f2a; --surface2: #262a37; --hover: #232735;
  --text: #e8e9f0; --muted: #9ba1b4; --border: #2f3342; --border-strong: #41465a;
  --accent: #4aa3ff; --accent-hover: #74b9ff; --accent-bg: #16304d; --accent-text: #a9d2ff;
  --danger: #ff8a9a; --danger-bg: #3d1b23; --warn: #ffc96b; --warn-bg: #3a2b10;
  --ok: #55d39a; --ok-bg: #12332a; --info: #6fd0e6; --info-bg: #11313a;
  --st-todo: #4a4f63; --st-todo-t: #f1f2f8; --pr-low: #1e3a5f; --pr-low-t: #cfe2fd;
  --shadow: none; --shadow-lg: 0 14px 36px rgba(0, 0, 0, .5);
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239ba1b4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); --chev-todo: var(--chev-white);
    --bg: #15171f; --surface: #1c1f2a; --surface2: #262a37; --hover: #232735;
    --text: #e8e9f0; --muted: #9ba1b4; --border: #2f3342; --border-strong: #41465a;
    --accent: #4aa3ff; --accent-hover: #74b9ff; --accent-bg: #16304d; --accent-text: #a9d2ff;
    --danger: #ff8a9a; --danger-bg: #3d1b23; --warn: #ffc96b; --warn-bg: #3a2b10;
    --ok: #55d39a; --ok-bg: #12332a; --info: #6fd0e6; --info-bg: #11313a;
    --st-todo: #4a4f63; --st-todo-t: #f1f2f8; --pr-low: #1e3a5f; --pr-low-t: #cfe2fd;
    --shadow: none; --shadow-lg: 0 14px 36px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1 { font-size: 24px; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { margin: 0; font-size: 16px; font-weight: 600; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.muted, .sub, .hint { color: var(--muted); }
.sub { font-size: 12px; }
.hint { font-size: 13px; margin: 0 0 12px; }
.strong { font-weight: 500; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.warn-text { color: var(--warn); }
.i { display: inline-flex; flex: none; line-height: 0; }
.i svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- khung ứng dụng ---------- */
#app { min-height: 100vh; display: flex; }
.side { width: var(--side-w); flex: none; background: var(--surface); border-right: 1px solid var(--border); padding: 12px 10px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; transition: width .15s ease; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px 10px; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; white-space: nowrap; overflow: hidden; min-width: 0; }
.brand-full img { width: 150px; height: auto; }
.brand-mark img { width: 32px; height: 32px; }
.brand .brand-mark { display: none; }
.ow-light { display: block; } .ow-dark { display: none; }
:root[data-theme="dark"] .ow-light { display: none; } :root[data-theme="dark"] .ow-dark { display: block; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] .ow-light { display: none; } :root[data-theme="auto"] .ow-dark { display: block; } }
.top-logo { display: none; flex: none; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-sec { font-size: 11px; font-weight: 600; color: var(--muted); padding: 14px 10px 4px; white-space: nowrap; overflow: hidden; }
.nav-sec:first-child { padding-top: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); white-space: nowrap; }
.nav a:hover { background: var(--surface2); color: var(--text); }
.nav a.on { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.nav a .i { color: var(--muted); }
.nav a.on .i { color: var(--accent-text); }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; line-height: 17px; font-weight: 600; }
:root[data-theme="dark"] .nav-badge { color: #2a0a10; }
.side.collapsed { width: 62px; }
.side.collapsed .brand-full, .side.collapsed .nav a span:not(.i):not(.nav-badge), .side.collapsed .nav-sec { display: none; }
.side.collapsed .side-top { flex-direction: column; }
.side.collapsed .brand .brand-mark { display: block; }
.side.collapsed .nav a { justify-content: center; position: relative; }
.side.collapsed .nav-badge { position: absolute; top: 0; right: 2px; line-height: 14px; font-size: 10px; padding: 0 4px; }
.side.collapsed .nav-sec + a { margin-top: 10px; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.top-search { position: relative; flex: 1; max-width: 460px; }
.top-search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.top-search input { padding-left: 36px; background: var(--surface2); border-color: transparent; border-radius: 999px; }
.top-search input:focus { background: var(--surface); }
.top-sp { flex: 1; }
.top-btn { position: relative; width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.top-btn:hover { background: var(--surface2); color: var(--text); }
.top-btn .nav-badge { position: absolute; top: 2px; right: 0; margin: 0; line-height: 15px; font-size: 10px; padding: 0 4px; }
.user-btn { display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--text); font: inherit; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; }
.user-btn:hover { background: var(--surface2); }
.user-btn .uname { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
main { flex: 1; min-width: 0; width: 100%; max-width: 1440px; padding: 24px 28px 70px; }

.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 26px 0 10px; }
.section-head h2 { margin: 0; }
.view > h2 { margin: 26px 0 10px; }
.back { font-size: 13px; display: block; margin-bottom: 4px; color: var(--muted); }

/* ---------- điều khiển ---------- */
.btn { font: inherit; font-weight: 500; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: var(--radius-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #08233f; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 3px 10px; font-size: 12px; }
.btn.wide { width: 100%; justify-content: center; }
.btn.left { margin-right: auto; }
.icon-btn { border: 0; background: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--surface2); color: var(--text); }
.icon-btn.small { font-size: 12px; padding: 0 6px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* ô chọn: tự vẽ mũi tên để cách viền đều ở mọi trình duyệt */
select { -webkit-appearance: none; appearance: none; }
:root select:not([multiple]):not([size]) { padding-right: 36px; background-image: var(--chev); background-repeat: no-repeat; background-position: right 13px center; background-size: 11px 7px; text-overflow: ellipsis; cursor: pointer; }
:root select:is(.st-waiting-bg, .st-done-bg, .pr-high-bg, .pr-urgent-bg) { --chev: var(--chev-white); }
:root select.st-doing-bg { --chev: var(--chev-ink); }
:root select:is(.st-todo-bg, .pr-low-bg) { --chev: var(--chev-todo); }
input[list]::-webkit-calendar-picker-indicator { display: none !important; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=search], .toolbar input[type=month] { width: 170px; }
.toolbar select { width: auto; max-width: 210px; }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.seg { display: inline-flex; background: var(--surface2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-weight: 500; border: 0; background: transparent; color: var(--muted); padding: 4px 14px; cursor: pointer; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- thẻ, số liệu ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 650; margin-top: 4px; letter-spacing: -.01em; }
.stat.danger .stat-value { color: var(--danger); } .stat.warn .stat-value { color: var(--warn); } .stat.good .stat-value { color: var(--ok); }
.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.dash-grid .card:first-child { grid-row: span 2; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 20px; }
.kv span { display: block; font-size: 12px; color: var(--muted); } .kv b { font-weight: 500; word-break: break-word; }
.notes { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); white-space: pre-wrap; }

/* ---------- bảng chung ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; } .tbl tbody tr:hover { background: var(--hover); }
.tbl tr.done td { color: var(--muted); } .tbl tr.done .strong { text-decoration: line-through; }
.tbl td.act { text-align: right; white-space: nowrap; }
.tbl.compact td, .tbl.compact th { padding: 6px 12px; font-size: 13px; } .tbl.compact tbody tr { cursor: default; }
.tbl tr.sel td { background: var(--accent-bg); }
.tbl tr.total td { font-weight: 600; border-top: 1px solid var(--border-strong); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); border-bottom: 0; }
.empty { padding: 32px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty.small { padding: 14px; }

/* ---------- bảng việc kiểu monday ---------- */
.board { display: flex; flex-direction: column; gap: 22px; }
.grp-block { --grp: var(--accent); }
.grp-head { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; font: inherit; cursor: pointer; padding: 2px 0 8px; color: var(--text); }
.grp-head .i { color: var(--grp); transition: transform .12s; }
.grp-head b { color: var(--grp); font-size: 16px; font-weight: 650; filter: saturate(1.1) brightness(.88); }
:root[data-theme="dark"] .grp-head b { filter: brightness(1.15); }
.grp-block.closed .grp-head .i { transform: rotate(-90deg); }
.grp-block.closed .board-scroll { display: none; }
.board-scroll { overflow-x: auto; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
.bt { width: 100%; min-width: 960px; border-collapse: collapse; table-layout: fixed; }
.bt col.c-title { width: auto; } .bt col.c-who { width: 128px; } .bt col.c-status { width: 124px; } .bt col.c-prio { width: 100px; } .bt col.c-due { width: 146px; } .bt col.c-client { width: 186px; }
.bt th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: center; padding: 8px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); }
.bt th:first-child { text-align: left; padding-left: 16px; border-left: 5px solid var(--grp); }
.bt td { height: 40px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0; vertical-align: middle; }
.bt th:last-child, .bt td:last-child { border-right: 0; }
.bt tbody tr:last-child td { border-bottom: 0; }
.bt tbody tr.row:hover td:not(.fill) { background: var(--hover); }
.bt td.t-cell { border-left: 5px solid var(--grp); padding: 4px 8px 4px 10px; cursor: pointer; }
.t-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
.t-check { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--border-strong); background: transparent; cursor: pointer; display: grid; place-items: center; color: transparent; padding: 0; }
.t-check:hover:not(:disabled) { border-color: var(--st-done); color: var(--st-done); }
.t-check.on { background: var(--st-done); border-color: var(--st-done); color: var(--st-done-t); }
.t-check:disabled { cursor: default; opacity: .6; }
.t-main { flex: 1; min-width: 0; }
.t-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.t-meta { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.t-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.t-meta .blocked { color: var(--warn); overflow: hidden; text-overflow: ellipsis; display: inline-block; max-width: 280px; }
.row.is-done .t-title { text-decoration: line-through; color: var(--muted); }
.t-open { visibility: hidden; color: var(--accent); }
.row:hover .t-open, .t-open:focus-visible { visibility: visible; }
.cell-btn { width: 100%; height: 100%; min-height: 40px; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px; white-space: nowrap; overflow: hidden; }
.cell-btn:disabled { cursor: default; }
.cell-btn:not(:disabled):hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.cell-btn.who-btn { justify-content: flex-start; padding-left: 10px; }
.cell-btn.who-btn span:last-child { overflow: hidden; text-overflow: ellipsis; }
.fill .cell-btn { font-weight: 500; font-size: 13px; }
.fill .cell-btn:not(:disabled):hover { filter: brightness(1.06); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55); }
:root .st-todo-bg.st-todo-bg { background: var(--st-todo); color: var(--st-todo-t); }
:root .st-doing-bg.st-doing-bg { background: var(--st-doing); color: var(--st-doing-t); }
:root .st-waiting-bg.st-waiting-bg { background: var(--st-waiting); color: var(--st-waiting-t); }
:root .st-done-bg.st-done-bg { background: var(--st-done); color: var(--st-done-t); }
:root .pr-low-bg.pr-low-bg { background: var(--pr-low); color: var(--pr-low-t); }
:root .pr-normal-bg.pr-normal-bg { background: transparent; color: var(--muted); }
:root .pr-high-bg.pr-high-bg { background: var(--pr-high); color: var(--pr-high-t); }
:root .pr-urgent-bg.pr-urgent-bg { background: var(--pr-urgent); color: var(--pr-urgent-t); }
.client-cell { padding: 0 12px !important; cursor: pointer; }
.client-tag { display: flex; align-items: center; gap: 8px; min-width: 0; }
.client-tag .cdot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.client-tag span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt tr.add-row td { border-left: 5px solid var(--grp); height: 36px; border-right: 0; }
.add-input { border: 0; background: transparent; border-radius: 0; height: 36px; padding-left: 40px; }
.add-input:focus { outline: none; background: var(--accent-bg); }
.bt tfoot td { border: 0; height: 30px; padding: 0 8px; }
.sum-bar { display: flex; height: 16px; border-radius: 4px; overflow: hidden; }
.sum-bar i { display: block; height: 100%; }
.sum-n { font-size: 12px; color: var(--muted); padding-left: 16px !important; }

/* menu nổi chọn trạng thái, người làm… */
.pop { position: fixed; z-index: 70; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; min-width: 190px; max-height: 320px; overflow-y: auto; }
.pop-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; white-space: nowrap; }
.pop-item:hover { background: var(--surface2); }
.pop-item.fill-item { justify-content: center; margin-bottom: 4px; font-weight: 500; }
.pop-item.fill-item:hover { filter: brightness(1.06); }
.pop-item.pr-normal-bg { border: 1px solid var(--border-strong); color: var(--text); }
.pop-item.on:not(.fill-item) { background: var(--accent-bg); color: var(--accent-text); }
.pop-item.fill-item.on { box-shadow: inset 0 0 0 2px var(--text); }
.pop-sep { height: 1px; background: var(--border); margin: 6px 2px; }
.pop-title { font-size: 11px; color: var(--muted); padding: 4px 10px; font-weight: 600; }
.pop input[type=date] { margin-bottom: 4px; }

/* ---------- nhãn ---------- */
.badge, .chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface2); color: var(--text); white-space: nowrap; }
.badge.who { background: var(--accent-bg); color: var(--accent-text); }
.badge.st-todo { background: var(--st-todo); color: var(--st-todo-t); } .badge.st-doing { background: var(--st-doing); color: var(--st-doing-t); }
.badge.st-waiting { background: var(--st-waiting); color: var(--st-waiting-t); } .badge.st-done { background: var(--st-done); color: var(--st-done-t); }
.badge.prio-low { background: var(--pr-low); color: var(--pr-low-t); } .badge.prio-high { background: var(--pr-high); color: var(--pr-high-t); } .badge.prio-urgent { background: var(--pr-urgent); color: var(--pr-urgent-t); }
.badge.ps-active { background: var(--accent-bg); color: var(--accent-text); }
.badge.pay-paid, .badge.ps-done, .badge.rs-renewed, .badge.cs-active { background: var(--ok-bg); color: var(--ok); }
.badge.pay-pending, .badge.ps-waiting, .badge.cs-paused, .badge.ct-inhouse { background: var(--warn-bg); color: var(--warn); }
.badge.cs-prospect { background: var(--accent-bg); color: var(--accent-text); }
.badge.ct-internal { background: var(--surface2); color: var(--muted); }
.badge.kind-adhoc, .badge.sk-seo, .badge.sk-website { background: var(--info-bg); color: var(--info); }
.badge.sk-facebook, .badge.sk-instagram, .badge.sk-tiktok, .badge.sk-youtube, .badge.sk-social { background: var(--accent-bg); color: var(--accent-text); }
.badge.sk-gbp, .badge.sk-hosting, .badge.sk-maintenance { background: var(--ok-bg); color: var(--ok); }
.badge.sk-design { background: var(--warn-bg); color: var(--warn); }
.chip.lvl-overdue { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.chip.lvl-today, .chip.lvl-d1 { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.chip.lvl-d3, .chip.lvl-d7 { background: var(--info-bg); color: var(--info); }
.chip.lvl-later { background: var(--surface2); color: var(--muted); }
.chip-wait { background: var(--warn-bg); color: var(--warn); margin-top: 3px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sub.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 460px; }

/* ---------- ảnh đại diện chữ ---------- */
.avatar { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--av, var(--accent)); color: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.person { display: inline-flex; align-items: center; gap: 8px; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.none { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--muted); }

/* ---------- tổng quan ---------- */
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alert { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); border-left: 4px solid var(--border-strong); background: var(--surface); color: var(--text); }
.alert:hover { background: var(--hover); color: var(--text); }
.alert.lvl-overdue { border-left-color: var(--danger); }
.alert.lvl-today, .alert.lvl-d1 { border-left-color: var(--st-doing); }
.alert.lvl-d3, .alert.lvl-d7 { border-left-color: var(--accent); }
.alert-ico { width: 20px; text-align: center; font-weight: 600; color: var(--muted); }
.alert-main { flex: 1; min-width: 0; } .alert-main .sub { display: block; }
.alert-when { font-size: 12px; font-weight: 600; white-space: nowrap; }
.alert.lvl-overdue .alert-when { color: var(--danger); }
.alert.lvl-today .alert-when, .alert.lvl-d1 .alert-when { color: var(--warn); }
.mini-list { display: flex; flex-direction: column; }
.mini { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); color: var(--text); flex-wrap: wrap; }
.mini:last-child { border: 0; } .mini-t { font-weight: 500; flex: 1; min-width: 120px; }
.workload { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.wl-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.wl-row { display: grid; grid-template-columns: minmax(150px, 200px) 1fr 56px; gap: 10px; align-items: center; cursor: pointer; }
.wl-bar { background: var(--surface2); border-radius: 999px; height: 8px; position: relative; overflow: hidden; }
.wl-bar i { display: block; position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; }
.wl-bar i.late { background: var(--danger); }
.wl-n { text-align: right; font-variant-numeric: tabular-nums; } .late-n { color: var(--danger); font-weight: 600; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 14px; overflow-x: auto; align-items: start; padding-bottom: 6px; }
.kcol { background: var(--surface2); border-radius: var(--radius); padding: 0 8px 10px; min-height: 180px; display: flex; flex-direction: column; gap: 8px; }
.kcol.over { outline: 2px dashed var(--accent); }
.kcol-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin: 0 -8px 2px; padding: 8px 12px; border-radius: var(--radius) var(--radius) 0 0; }
.kcol-head .count { font-weight: 500; opacity: .85; }
.count { color: inherit; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: grab; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); transition: box-shadow .12s, transform .12s; }
.kcard:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kcard-title { font-weight: 500; line-height: 1.4; }
.kcard-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--muted); }
.kcard-foot { display: flex; align-items: center; gap: 8px; } .kcard-foot .sp { flex: 1; }
.kcard-foot .t-meta { gap: 8px; }
.kempty { color: var(--muted); text-align: center; padding: 10px; }

/* ---------- lịch ---------- */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; } .cal-nav strong { min-width: 130px; text-align: center; }
.cal-title { min-width: 120px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--border); gap: 1px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { padding: 8px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; background: var(--surface); }
.cal-cell { min-height: 104px; padding: 6px; cursor: pointer; overflow: hidden; background: var(--surface); }
.cal-cell:hover { background: var(--hover); } .cal-cell.other { background: var(--bg); color: var(--muted); }
.cal-day { font-size: 12px; color: var(--muted); margin-bottom: 4px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-day { background: var(--accent); color: #fff; font-weight: 700; }
.cal-item { font-size: 12px; padding: 2px 7px; margin-bottom: 3px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-item.st-todo { background: var(--st-todo); color: var(--st-todo-t); } .cal-item.st-doing { background: var(--st-doing); color: var(--st-doing-t); }
.cal-item.st-waiting { background: var(--st-waiting); color: var(--st-waiting-t); } .cal-item.st-done { background: var(--st-done); color: var(--st-done-t); text-decoration: line-through; }
.cal-item.late { box-shadow: inset 3px 0 0 var(--danger); }
.cal-more { font-size: 11px; color: var(--muted); }

/* ---------- hộp thoại, biểu mẫu ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(20, 22, 36, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 12px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); } .modal.wide { max-width: 720px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px 20px; }
.form-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 100%; } .field.half { flex: 1 1 calc(50% - 6px); min-width: 150px; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field[hidden] { display: none; }
.form-section { flex: 1 1 100%; font-weight: 600; padding-bottom: 6px; border-bottom: 1px solid var(--border); margin-top: 6px; }
.form-section:first-child { margin-top: 0; }
.tbl tbody tr.static { cursor: default; }
.check-field { justify-content: flex-end; } .check-field input { align-self: flex-start; }
.form-err { color: var(--danger); font-size: 13px; min-height: 0; margin-top: 8px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1f2330; color: #fff; padding: 10px 18px; border-radius: 999px; z-index: 99; box-shadow: var(--shadow-lg); }
.toast.err { background: #b3263e; }
.qr-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.secret { display: block; word-break: break-all; user-select: all; background: var(--surface2); padding: 6px 8px; border-radius: 6px; max-width: 260px; }

/* ---------- đăng nhập ---------- */
.login-wrap { flex: 1; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 15% 0%, var(--accent-bg), transparent 60%); }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; width: 100%; max-width: 390px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow-lg); }
.login-card .brand { align-items: center; gap: 8px; padding-bottom: 4px; }
.login-card .brand-full img { width: 240px; }
.login-card h2 { font-size: 20px; margin: 6px 0 0; }

/* ---------- khung chi tiết việc ---------- */
.drawer-back { position: fixed; inset: 0; background: rgba(20, 22, 36, .32); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(680px, 100%); background: var(--surface); height: 100%; overflow-y: auto; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slidein .16s ease-out; }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } .kcard, .side { transition: none; } }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.pane-head .sp { flex: 1; }
.pane-body { padding: 18px 24px 48px; display: flex; flex-direction: column; gap: 12px; }
.pane-body h4 { margin: 12px 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.pane-title { flex: none; font-size: 21px; font-weight: 650; border: 1px solid transparent; background: transparent; padding: 4px 8px; margin: 0 -8px; width: calc(100% + 16px); resize: none; line-height: 1.35; overflow: hidden; }
.pane-title:hover { border-color: var(--border-strong); }
.pane-title.ro { padding: 4px 0; margin: 0; }
.props { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.prop { display: grid; grid-template-columns: 140px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--border); padding: 3px 0; }
.prop-l { font-size: 12px; color: var(--muted); font-weight: 500; }
.prop-v { min-width: 0; word-break: break-word; }
.prop-v input, .prop-v select { padding: 5px 8px; border-color: transparent; background: transparent; max-width: 320px; }
.prop-v input:hover, .prop-v select:hover:not([class*="-bg"]) { border-color: var(--border-strong); }
:root .prop-v select[class*="-bg"]:not([size]) { border: 0; font-weight: 600; max-width: 200px; text-align: center; text-align-last: center; padding-left: 36px; }
.prop-v select[class*="-bg"] option { background: var(--surface); color: var(--text); }
.prop-v select.pr-normal-bg { border: 1px solid var(--border-strong); color: var(--text); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-top: 8px; }
.tabs button { white-space: nowrap; font: inherit; font-weight: 500; border: 0; background: none; color: var(--muted); padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--accent-text); border-bottom-color: var(--accent); }
.tab-panel { display: flex; flex-direction: column; gap: 10px; }
.pane-desc { width: 100%; resize: vertical; } .pane-desc.ro { white-space: pre-wrap; padding: 6px 0; }
.subtasks { display: flex; flex-direction: column; }
.sub-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); } .sub-row.done .sub-t { text-decoration: line-through; color: var(--muted); } .sub-t { flex: 1; }
.sub-add { border-style: dashed; }
.sub-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.sub-form .sub-add { flex: 1 1 100%; }
.sub-form .btn { margin-left: auto; }
.sub-form .sub-who { width: auto; max-width: 220px; }
.sub-form .sub-due { width: 150px; }
.child-note { flex: 1 1 100%; } .sub-form [hidden] { display: none; }
.sub-row.child > .i { color: var(--muted); margin-right: 1px; }
.sub-row.child .sub-t { min-width: 140px; }
.sub-row.child { flex-wrap: wrap; row-gap: 4px; }
.sub-row.child > .icon-btn { margin-left: auto; }
.child-who { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.links { display: flex; flex-direction: column; }
.link-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.link-row > .i { color: var(--accent-text); }
.link-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.link-main a, .link-main > span:first-child { font-weight: 500; overflow-wrap: anywhere; }
.link-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.link-form .link-url { flex: 2 1 240px; width: auto; }
.link-form .link-label { flex: 1 1 150px; width: auto; }
.link-form .btn { margin-left: auto; }
.link-group { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: 14px; padding-bottom: 2px; }
.link-note { margin: 12px 0 0; }
.parent-link { font-size: 13px; color: var(--muted); background: var(--surface2); border-radius: var(--radius-sm); padding: 6px 10px; }
.lock-note { display: inline-block; margin-left: 10px; }
.t-meta .child-of { display: inline-block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; color: var(--accent-text); }
.kcard .t-meta { flex-wrap: wrap; row-gap: 2px; } .kcard .t-meta .child-of, .kcard .t-meta .blocked { max-width: 100%; }
.comments { display: flex; flex-direction: column; gap: 14px; }
.cm { display: flex; gap: 10px; } .cm-main { flex: 1; min-width: 0; background: var(--surface2); border-radius: 4px 12px 12px 12px; padding: 8px 12px; } .cm-head { display: flex; align-items: center; gap: 4px; }
.cm-head .icon-btn { margin-left: auto; }
.cm-body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.mention { color: var(--accent-text); font-weight: 600; background: var(--accent-bg); border-radius: 4px; padding: 0 3px; }
.composer { display: flex; gap: 10px; margin-top: 4px; } .composer-main { flex: 1; position: relative; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.mention-list { display: none; position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-lg); z-index: 5; overflow: hidden; }
.mention-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; text-align: left; } .mention-item:hover { background: var(--surface2); }
.followers { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.followers .prop-l { margin-right: 4px; }
.btn.done-btn { background: var(--st-done); border-color: var(--st-done); color: var(--st-done-t); }
.btn.done-btn:hover { background: var(--st-done); color: var(--st-done-t); filter: brightness(1.08); }
.ev { padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--border); }

/* ---------- hộp thư, tìm kiếm ---------- */
.nt-list { padding: 0; overflow: hidden; } .nt { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; } .nt:last-child { border-bottom: 0; } .nt:hover { background: var(--hover); }
.nt.unread { background: var(--accent-bg); } .nt-main { flex: 1; } .nt-s { color: var(--muted); font-size: 13px; }
.nt .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 10px; }
.sr { padding: 10px 4px; border-bottom: 1px solid var(--border); cursor: pointer; } .sr:last-child { border-bottom: 0; } .sr:hover { background: var(--hover); } .sr-t { font-weight: 500; }

/* ---------- khác ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.h3gap { font-size: 14px; margin: 8px 0; font-weight: 600; }
.report { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.rep-head { margin-bottom: 16px; } .rep-sec { margin-top: 20px; }

/* ---------- màn hình nhỏ ---------- */
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .side, .side.collapsed { width: 100%; height: auto; position: static; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .side-top { display: none; }
  .top-logo { display: block; } .top-logo img { width: 30px; height: 30px; }
  .nav { flex-direction: row; overflow-x: auto; flex: none; } .nav a { padding: 6px 10px; }
  .nav-sec { display: none; }
  .side.collapsed .nav a span:not(.i):not(.nav-badge) { display: inline; }
  .topbar { padding: 0 12px; gap: 6px; } .user-btn .uname, .top-new span:last-child { display: none; }
  main { padding: 16px 12px 70px; }
  .dash-grid, .two-col { grid-template-columns: 1fr; } .dash-grid .card:first-child { grid-row: auto; }
  .cal-cell { min-height: 68px; padding: 3px; } .cal-item { font-size: 10px; padding: 1px 3px; }
  .toolbar input[type=search], .toolbar input[type=month] { width: 100%; }
  .prop { grid-template-columns: 110px minmax(0, 1fr); }
}

/* điện thoại: thu cột để thấy ngay tên việc, người làm và trạng thái */
@media (max-width: 560px) {
  .top-sp { display: none; }
  .top-search { max-width: none; min-width: 0; }
  .top-new, .top-btn { flex: none; } .top-new { padding: 7px 10px; }
  .user-btn { flex: none; padding: 2px; } .user-btn > .i { display: none; }
  .bt { width: 744px; min-width: 100%; }
  .bt col.c-title { width: 190px; } .bt col.c-who { width: 48px; } .bt col.c-status { width: 102px; } .bt col.c-due { width: 140px; } .bt col.c-prio { width: 90px; } .bt col.c-client { width: 174px; }
  .bt th:nth-child(2) { font-size: 0; padding: 0; }
  .bt .cell-btn.who-btn { justify-content: center; padding: 0; } .bt .cell-btn.who-btn > span:nth-child(2) { display: none; }
  .bt td.t-cell { padding-left: 6px; padding-right: 4px; } .bt th:first-child { padding-left: 10px; }
  .t-wrap { gap: 8px; } .t-open { display: none; }
  .t-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; }
}

@media print {
  :root, :root[data-theme="dark"], :root[data-theme="auto"] { color-scheme: light; --bg: #fff; --surface: #fff; --surface2: #f1f2f6; --text: #000; --muted: #555; --border: #ddd; }
  .side, .topbar, .no-print, .toast, .modal-back, .drawer-back { display: none !important; }
  body { background: #fff; color: #000; } main { padding: 0; max-width: none; }
  .report { border: 0; padding: 0; box-shadow: none; } .stat, .table-wrap { break-inside: avoid; }
  .rep-sec { break-inside: avoid-page; }
}

/* ---------- biểu đồ báo cáo ---------- */
:root { --ch-done:#00854f; --ch-doing:#e59a2f; --ch-waiting:#8b52cc; --ch-late:#c8324a; --ch-todo:#9aa0b4; --chart-bar:#2a78d6; --chart-rest:#9aa0b4;
  --hm1:#e6f1fb; --hm1t:#0c447c; --hm2:#b5d4f4; --hm2t:#042c53; --hm3:#85b7eb; --hm3t:#042c53; --hm4:#185fa5; --hm4t:#ffffff; }
:root[data-theme="dark"] { --ch-done:#00854f; --ch-doing:#c47d12; --ch-waiting:#8b52cc; --ch-late:#e0566a; --ch-todo:#5b6178; --chart-bar:#3987e5; --chart-rest:#5b6178;
  --hm1:#17304f; --hm1t:#cfe2fd; --hm2:#1f4a7a; --hm2t:#e6f0ff; --hm3:#2a6cb0; --hm3t:#ffffff; --hm4:#63adff; --hm4t:#06203c; }
@media (prefers-color-scheme: dark) { :root[data-theme="auto"] { --ch-done:#00854f; --ch-doing:#c47d12; --ch-waiting:#8b52cc; --ch-late:#e0566a; --ch-todo:#5b6178; --chart-bar:#3987e5; --chart-rest:#5b6178;
  --hm1:#17304f; --hm1t:#cfe2fd; --hm2:#1f4a7a; --hm2t:#e6f0ff; --hm3:#2a6cb0; --hm3t:#ffffff; --hm4:#63adff; --hm4t:#06203c; } }
.charts button { font: inherit; cursor: pointer; }
.stat.kpi { display: flex; flex-direction: column; align-items: flex-start; text-align: left; color: var(--text); }
button.stat.kpi:hover { border-color: var(--accent); }
.ch-bar { display: flex; gap: 2px; height: 22px; }
.ch-seg { flex-basis: 0; min-width: 8px; border: 0; padding: 0; }
.ch-seg:first-child { border-radius: 4px 0 0 4px; } .ch-seg:last-child { border-radius: 0 4px 4px 0; } .ch-seg:only-child { border-radius: 4px; }
button.ch-seg:hover { filter: brightness(1.12); }
.ch-done { background: var(--ch-done); } .ch-doing { background: var(--ch-doing); } .ch-waiting { background: var(--ch-waiting); } .ch-late { background: var(--ch-late); } .ch-todo { background: var(--ch-todo); }
.ch-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.ch-legend span { display: inline-flex; align-items: center; gap: 6px; } .ch-legend .zero { opacity: .65; }
.ch-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart .section-head { margin: 0 0 4px; } .chart .hint { margin: 8px 0; }
.hm-wrap, .rep-scroll { overflow-x: auto; }
table.hm { width: 100%; min-width: 640px; border-collapse: separate; border-spacing: 2px; table-layout: fixed; font-size: 13px; }
.hm thead th { font-size: 11px; font-weight: 500; color: var(--muted); padding: 2px; text-align: center; }
.hm thead th:first-child { width: 150px; text-align: left; }
.hm tbody th { text-align: left; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }
.hm td { padding: 0; }
.hm-cell { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 32px; border: 0; border-radius: 4px; padding: 0 2px; font-variant-numeric: tabular-nums; }
button.hm-cell:hover { box-shadow: inset 0 0 0 2px var(--text); }
.hm0 { background: var(--surface2); color: var(--muted); }
.hm1 { background: var(--hm1); color: var(--hm1t); } .hm2 { background: var(--hm2); color: var(--hm2t); } .hm3 { background: var(--hm3); color: var(--hm3t); } .hm4 { background: var(--hm4); color: var(--hm4t); }
.hm-late { background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.hm-plain { background: transparent; color: var(--muted); } .hm-total { background: transparent; color: var(--text); font-weight: 600; }
table.hbar { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.hbar th { width: 200px; text-align: left; font-weight: 400; padding: 3px 10px 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar td { padding: 3px 0; } .hbar td.num { width: 44px; }
.hbar-track { display: block; width: 100%; height: 20px; padding: 4px 0; border: 0; background: transparent; text-align: left; }
.hbar-fill { display: block; height: 12px; min-width: 3px; background: var(--chart-bar); border-radius: 0 4px 4px 0; }
.hbar-fill.rest { background: var(--chart-rest); }
button.hbar-track:hover .hbar-fill { filter: brightness(1.15); }
.drill-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: var(--accent-bg); color: var(--accent-text); border-radius: var(--radius); padding: 8px 14px; margin-bottom: 12px; }
.drill-bar > span { margin-right: auto; }
.toolbar.drilling select, .toolbar.drilling .check { display: none; }
@media (max-width: 560px) { .hbar th { width: 128px; } .report { padding: 14px 12px; } .hm thead th:first-child { width: 96px; } .hm tbody th .sub { display: none; } table.hm { min-width: 600px; } }
@media print {
  :root, :root[data-theme="dark"], :root[data-theme="auto"] { --ch-done:#00854f; --ch-doing:#e59a2f; --ch-waiting:#8b52cc; --ch-late:#c8324a; --ch-todo:#9aa0b4; --chart-bar:#2a78d6; --chart-rest:#9aa0b4;
  --hm1:#e6f1fb; --hm1t:#0c447c; --hm2:#b5d4f4; --hm2t:#042c53; --hm3:#85b7eb; --hm3t:#042c53; --hm4:#185fa5; --hm4t:#ffffff; --st-todo:#c9ccd8; --ok:#007a48; --ok-bg:#e2f6ec; --danger:#c8324a; --danger-bg:#fdecef; --warn:#9a5b00; --warn-bg:#fff2d9; --info:#0b6e86; --info-bg:#e3f4f8; --accent-bg:#e8f2fd; --accent-text:#0059b8; }
  .rep-scroll { overflow: visible; }
  .charts, .charts * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .hm-wrap { overflow: visible; } table.hm { min-width: 0; }
  .charts button { box-shadow: none; }
}

/* ---------- Ticket ---------- */
.tk-code { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tk-table td.tk-title { min-width: 260px; }
.tk-table td.tk-title a { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.badge.tk-s-new { background: var(--accent-bg); color: var(--accent-text); }
.badge.tk-s-assigned { background: var(--info-bg); color: var(--info); }
.badge.tk-s-doing { background: var(--st-doing); color: var(--st-doing-t); }
.badge.tk-s-waiting { background: var(--st-waiting); color: var(--st-waiting-t); }
.badge.tk-s-resolved { background: var(--st-done); color: var(--st-done-t); }
.badge.tk-s-closed { background: var(--surface2); color: var(--muted); }
.badge.tk-scope-in { background: var(--ok-bg); color: var(--ok); }
.badge.tk-scope-out { background: var(--warn-bg); color: var(--warn); }
.badge.tk-scope-unset { color: var(--muted); }
.tk-warn { background: var(--warn-bg); color: var(--warn); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; margin: 8px 0; }
.tk-warn.bad { background: var(--danger-bg); color: var(--danger); }
.tk-warn[hidden], .tk-form .field[hidden] { display: none; }
.tk-warn .check { margin-top: 6px; color: var(--text); }
.tk-form .field { margin-bottom: 12px; }
.tk-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.tk-detail { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.tk-side .field { margin-bottom: 10px; }
.tk-side .card h2 { margin-bottom: 8px; }
.tk-thread { min-width: 0; }
.tk-msg { position: relative; padding-right: 40px !important; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 10px; }
.tk-msg-reply { background: var(--accent-bg); border-color: transparent; }
.tk-msg-note { background: var(--warn-bg); border: 1px dashed var(--warn); }
.tk-msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.tk-del { position: absolute; top: 6px; right: 8px; }
.tk-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.tk-tag { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 6px; background: var(--surface2); color: var(--text); }
.tk-tag-reply { background: var(--accent); color: #fff; }
.tk-tag-note { background: var(--surface); color: var(--warn); border: 1px solid var(--warn); }
.tk-sys { text-align: center; font-size: 12px; color: var(--muted); margin: 0 0 10px; overflow-wrap: anywhere; }
.tk-composer { background: var(--surface); border: 2px solid var(--border-strong); border-radius: var(--radius); padding: 12px; margin-top: 14px; }
.tk-composer.tk-mode-note { background: var(--warn-bg); border-color: var(--warn); }
.tk-composer.tk-mode-reply { border-color: var(--accent); }
.tk-modes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tk-mode-btn { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 14px; }
.tk-mode-btn.note.on { background: var(--warn); border-color: var(--warn); color: var(--surface); }
.tk-mode-btn.reply.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tk-mode-btn.customer.on { background: var(--text); border-color: var(--text); color: var(--surface); }
.tk-banner { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.tk-mode-note .tk-banner { color: var(--warn); }
.tk-mode-reply .tk-banner { color: var(--accent-text); }
.tk-wait { margin-top: 8px; }
.tk-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tk-task { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; overflow-wrap: anywhere; }
.tk-task.done a, .tk-task.done > div > span { text-decoration: line-through; color: var(--muted); }
.tk-addtask { margin-top: 8px; }
.tk-addtask summary { cursor: pointer; font-weight: 600; font-size: 13px; margin-bottom: 8px; }
@media (max-width: 980px) { .tk-detail { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .tk-two { grid-template-columns: minmax(0, 1fr); } }
