/* NextTask - giao diện */
:root {
  --bg: #f5f6f8; --surface: #fff; --surface-2: #f9fafb; --border: #e5e7eb;
  --text: #1f2937; --muted: #6b7280; --primary: #2563eb; --primary-ink: #fff; --primary-soft: #eff6ff;
  --danger: #dc2626; --good: #16a34a; --warn: #d97706;
  --radius: 10px; --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 6px rgba(0,0,0,.04);
  --sidebar: 248px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1d2129; --border: #2a2f3a;
    --text: #e5e7eb; --muted: #9ca3af; --primary: #3b82f6; --primary-soft: #172036;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .6em; line-height: 1.25; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.center { text-align: center; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.prewrap { white-space: pre-wrap; }
.inline { display: inline; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Bố cục */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex-shrink: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.page-title { font-size: 1.15rem; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { padding: 24px; max-width: 1100px; width: 100%; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; padding: 4px 8px 14px; }
.menu-btn { display: none; }
.backdrop { display: none; }

/* Menu bên */
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.nav-section { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 10px 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; margin-right: 6px; }
.dot.big { width: 14px; height: 14px; }

.ws-switch { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.ws-switch summary { list-style: none; cursor: pointer; padding: 8px 10px; display: flex; flex-direction: column; }
.ws-switch summary::-webkit-details-marker { display: none; }
.ws-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-name::after { content: " ▾"; color: var(--muted); font-weight: 400; }
.ws-menu { border-top: 1px solid var(--border); padding: 4px; }
.ws-item { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 6px; color: var(--text); font: inherit; cursor: pointer; }
.ws-item:hover { background: var(--surface-2); text-decoration: none; }
.ws-item.current { font-weight: 600; color: var(--primary); }

/* Menu người dùng */
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.dropdown { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 180px; padding: 6px; z-index: 20; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; background: none; border: 0; color: var(--text); font: inherit; cursor: pointer; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); text-decoration: none; }
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-block; }
.avatar-text { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; }

/* Khối nội dung */
.panel, .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel.narrow { max-width: 640px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 14px; flex-wrap: wrap; }
.section-head h3 { margin: 0; }
.welcome { margin-bottom: 18px; }
.empty { text-align: center; padding: 40px 20px; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; color: var(--text); box-shadow: var(--shadow); }
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat.soon { opacity: .6; }
.stat-num { font-size: 1.6rem; font-weight: 700; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.project-card { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius); padding: 14px 16px; color: var(--text); box-shadow: var(--shadow); min-height: 104px; }
.project-card:hover { text-decoration: none; border-color: var(--c); }
.project-name { font-weight: 600; display: flex; align-items: center; }
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.project-title { font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* Bảng */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table.compact td, .table.compact th { padding: 6px 8px; }
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; }
.person { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Nhãn */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.badge.good { color: var(--good); border-color: currentColor; }
.badge.bad { color: var(--danger); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.role-owner { color: #7c3aed; border-color: currentColor; }
.role-admin { color: var(--primary); border-color: currentColor; }
.role-member { color: var(--good); border-color: currentColor; }

/* Form */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .label { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
input[type=file] { padding: 6px; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; margin: 0; }
legend { font-weight: 600; padding: 0 6px; }
.inline-form { flex-direction: row; align-items: center; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 200px; width: auto; }
.grid-form { display: grid; grid-template-columns: 2fr 2fr 1fr auto; align-items: end; gap: 12px; }
.grid-form select { height: 41px; }
.grid-form .btn { height: 41px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.copy-row { display: flex; gap: 8px; margin-top: 8px; }
.auto-submit select { width: auto; padding: 5px 8px; }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { position: relative; cursor: pointer; }
.swatch input[type=radio] { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.swatch.custom input[type=color] { width: 36px; height: 36px; padding: 2px; border-radius: 50%; cursor: pointer; }
.swatch.custom:has(input:checked) input[type=color] { outline: 2px solid var(--text); }

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500; padding: 8px 14px; border-radius: 8px; 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(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-danger-outline { color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn { background: none; border: 0; font-size: 1.3rem; cursor: pointer; color: var(--text); padding: 4px 8px; }

.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.tab { padding: 6px 12px; border-radius: 6px; color: var(--text); }
.tab.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tab:hover { text-decoration: none; }

/* Thông báo */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: color-mix(in srgb, var(--good) 10%, var(--surface)); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.alert-error { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert-info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, transparent); }

/* Trang đăng nhập */
.auth-body { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 48px 16px; }
.auth-wrap { width: 100%; max-width: 400px; }
.auth-wrap.wide { max-width: 620px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.5rem; font-weight: 700; margin-bottom: 18px; }
.auth-wrap .card { padding: 26px; }

/* Điện thoại */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 24px rgba(0,0,0,.2); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 25; }
  .menu-btn { display: inline-block; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px; }
  .grid-form { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
}

/* ===== Giai đoạn 2: công việc ===== */
.stat-red .stat-num { color: #dc2626; }
.stat-orange .stat-num { color: #ea580c; }

.quick-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 14px; }
.quick-add .qa-title { flex: 1 1 260px; width: auto; }
.quick-add .qa-due { width: auto; flex: 0 0 200px; }
.quick-add .qa-prio { width: auto; }
.qa-me { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); white-space: nowrap; }
.qa-me input { width: auto; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters select { width: auto; padding: 6px 8px; font-size: .875rem; }
.filters .f-search { flex: 1 1 200px; width: auto; padding: 6px 10px; font-size: .9rem; }

.task-list { list-style: none; margin: 0 0 8px; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--surface-2); }
.task-main { flex: 1; min-width: 0; }
.task-title { color: var(--text); font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; }
.task-row.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: .78rem; margin-top: 3px; align-items: center; }
.task-meta:empty { display: none; }
.task-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.proj-chip { display: inline-flex; align-items: center; color: var(--muted); }
.status-chip { color: var(--primary); font-weight: 600; }
.avatars { display: inline-flex; }
.avatars > span { margin-left: -6px; border: 2px solid var(--surface); border-radius: 50%; display: inline-flex; }
.avatars > span:first-child { margin-left: 0; }
.avatars .more { width: 26px; height: 26px; background: var(--surface-2); font-size: .72rem; align-items: center; justify-content: center; color: var(--muted); }

.check { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted); background: none; cursor: pointer; padding: 0; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.check:hover { border-color: var(--good); }
.check.checked { background: var(--good); border-color: var(--good); }
.check.checked::after { content: "✓"; color: #fff; font-size: 12px; font-weight: 700; }
.check.big { width: 26px; height: 26px; }
.check.sm { width: 18px; height: 18px; border-radius: 5px; }
.check.disabled { cursor: default; opacity: .6; }

.tag { display: inline-block; font-size: .74rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); }

.prio { font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.prio-urgent { background: #fee2e2; color: #b91c1c; }
.prio-high { background: #ffedd5; color: #c2410c; }
.prio-medium { background: #dbeafe; color: #1d4ed8; }
.prio-low { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* Cảnh báo deadline 4 màu */
.deadline { font-size: .76rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; border: 1px solid; }
.dl-green { background: #dcfce7; color: #15803d; border-color: #86efac; }
.dl-yellow { background: #fef9c3; color: #a16207; border-color: #fde047; }
.dl-orange { background: #ffedd5; color: #c2410c; border-color: #fdba74; }
.dl-red { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.dl-done { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.dl-hint { font-weight: 400; }
@media (prefers-color-scheme: dark) {
  .prio-urgent, .dl-red { background: #3b1212; color: #fca5a5; border-color: #7f1d1d; }
  .prio-high, .dl-orange { background: #3a1d0b; color: #fdba74; border-color: #7c2d12; }
  .prio-medium { background: #172554; color: #93c5fd; }
  .dl-yellow { background: #332b07; color: #fde047; border-color: #713f12; }
  .dl-green { background: #0f2e1a; color: #86efac; border-color: #14532d; }
}

/* Chi tiết công việc */
.crumbs { font-size: .875rem; margin-bottom: 12px; color: var(--muted); }
.crumbs a { display: inline-flex; align-items: center; }
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.title-row { display: flex; align-items: center; gap: 10px; }
.title-input { font-size: 1.2rem; font-weight: 600; border-color: transparent; padding: 6px 8px; }
.title-input:hover:not([disabled]) { border-color: var(--border); }
.task-aside { position: sticky; top: 76px; }
.task-aside .form { gap: 10px; }
.pick-list { display: flex; flex-direction: column; gap: 2px; max-height: 190px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.pick { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick input { width: auto; }
.tag-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-option { cursor: pointer; }
.tag-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.tag-option span { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px dashed var(--border); color: var(--muted); }
.tag-option input:checked + span { color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid var(--c); }
.delete-task { margin-top: 12px; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-bottom: 10px; border: 1px solid var(--border); }
.progress span { display: block; height: 100%; background: var(--good); }
.checklist { list-style: none; padding: 0; margin: 0 0 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.checklist li.is-done .ck-text { text-decoration: line-through; color: var(--muted); }
.ck-text { flex: 1; }
.icon-btn.sm { font-size: 1.1rem; padding: 0 6px; color: var(--muted); }
.task-body .panel .quick-add { border: 0; padding: 0; margin-bottom: 10px; }
.task-body .task-list { border-radius: 8px; }

.color-input { width: 44px !important; min-width: 44px !important; flex: 0 0 44px !important; height: 38px; padding: 3px; }
.tag-admin { list-style: none; padding: 0; margin: 0; }
.tag-admin li { display: flex; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.tag-admin li .inline-form { flex: 1; }

@media (max-width: 860px) {
  .task-layout { grid-template-columns: 1fr; }
  .task-aside { position: static; }
  .task-row { flex-wrap: wrap; }
  .task-side { width: 100%; padding-left: 32px; flex-wrap: wrap; }
  .dl-hint { display: none; }
  .quick-add .qa-due { flex: 1 1 160px; }
}

/* ===== Bản 1.2 ===== */
a.brand, a.auth-brand { color: var(--text); text-decoration: none; }
.top-search { flex: 0 1 320px; }
.top-search input { padding: 7px 12px; font-size: .9rem; border-radius: 999px; background: var(--surface-2); }
.search-btn { display: none; }
.search-big { display: flex; gap: 8px; margin-bottom: 18px; max-width: 640px; }
.live-banner { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 50; font-size: .9rem; display: flex; gap: 10px; align-items: center; }
.live-banner button { background: var(--primary); color: #fff; border: 0; border-radius: 6px; padding: 5px 10px; cursor: pointer; font: inherit; }
@media (max-width: 860px) {
  .top-search { display: none; }
  .search-btn { display: inline-block; }
}

/* ===== Dòng thời gian ===== */
.tl-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 8px 0 0 8px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 8px 8px 0; }
.tl-filters { margin: 0; }
.tl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.tl { --label: 240px; min-width: 980px; position: relative; }
.tl-head, .tl-row { display: grid; grid-template-columns: var(--label) 1fr; }
.tl-head { position: sticky; top: 0; background: var(--surface); z-index: 3; border-bottom: 1px solid var(--border); }
.tl-label { padding: 6px 10px; border-right: 1px solid var(--border); display: flex; align-items: center; gap: 6px; min-width: 0; background: var(--surface); position: sticky; left: 0; z-index: 2; }
.tl-label-h { font-size: .8rem; font-weight: 600; color: var(--muted); }
.tl-days { display: flex; }
.tl-day { flex: 0 0 calc(100% / var(--days)); text-align: center; font-size: .7rem; line-height: 1.2; padding: 4px 0; color: var(--muted); border-left: 1px solid transparent; overflow: visible; white-space: nowrap; }
.tl-day.wkend { background: var(--surface-2); }
.tl-day.today { color: #fff; background: var(--primary); border-radius: 6px; }
.tl-m { display: block; height: 1.2em; font-weight: 600; color: var(--text); }
.tl-day.today .tl-m { color: #fff; }
.tl-d { display: block; font-weight: 600; font-size: .78rem; }
.tl-d.wk { text-align: left; padding-left: 2px; }
.tl-w { display: block; }
.tl-body { position: relative; }
.tl-bg { position: absolute; top: 0; bottom: 0; left: var(--label); right: 0; display: flex; pointer-events: none; }
.tl-col { flex: 0 0 calc(100% / var(--days)); border-left: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.tl-col.wkend { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .7; }
.tl-row { border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); min-height: 34px; }
.tl-row:last-child { border-bottom: 0; }
.tl-track { position: relative; }
.tl-project { background: color-mix(in srgb, var(--c) 6%, transparent); border-top: 1px solid var(--border); }
.tl-project .tl-label { flex-direction: column; align-items: flex-start; gap: 0; background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.tl-pname { font-weight: 600; color: var(--text); display: flex; align-items: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.tl-pbar { position: absolute; top: 50%; height: 14px; transform: translateY(-50%); background: color-mix(in srgb, var(--c) 25%, transparent); border: 1px solid var(--c); border-radius: 7px; overflow: hidden; z-index: 1; }
.tl-pfill { display: block; height: 100%; background: var(--c); }
.tl-task a { color: var(--text); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tl-task a.done { text-decoration: line-through; color: var(--muted); }
.tl-task.sub1 { padding-left: 24px; }
.tl-task.sub2 { padding-left: 38px; }
.tl-task .avatars > span { margin-left: -4px; }
.tl-bar { position: absolute; top: 6px; bottom: 6px; border-radius: 6px; border: 1px solid; font-size: .72rem; font-weight: 600; display: flex; align-items: center; padding: 0 6px; overflow: hidden; white-space: nowrap; z-index: 1; min-width: 8px; text-decoration: none !important; }
.tl-bar span { overflow: hidden; text-overflow: ellipsis; }
.tl-bar:not([class*="dl-"]) { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.cut-l { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left-style: dashed; }
.cut-r { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-style: dashed; }
.tl-empty { min-height: 26px; }
@media (max-width: 860px) {
  .tl { --label: 150px; min-width: 760px; }
}
.view-tabs { display: inline-flex; margin-bottom: 12px; }
.tl-out { position: absolute; top: 50%; transform: translateY(-50%); font-size: .74rem; color: var(--muted); white-space: nowrap; z-index: 1; pointer-events: none; }

/* Dòng thời gian dạng cây (bản 1.2.1) */
.tl-project { min-height: 52px; }
.tl-pbar { height: 30px; border-radius: 8px; border-width: 2px; }
.tl-pfill { opacity: .85; }
.tl-ptext { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 10px; font-size: .78rem; font-weight: 700; color: var(--text); white-space: nowrap; text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface); }
.tl-pmeta { display: flex; align-items: center; gap: 6px; font-size: .75rem; margin-top: 3px; width: 100%; }
.tl-mini { flex: 1; max-width: 90px; height: 6px; background: color-mix(in srgb, var(--c) 20%, transparent); border-radius: 99px; overflow: hidden; }
.tl-mini span { display: block; height: 100%; background: var(--c); }
.tl-task { --step: 22px; position: sticky; padding-left: calc(10px + var(--dep) * var(--step)); }
.tl-toggle { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; border: 1.5px solid var(--primary); background: var(--surface); color: var(--primary); font-size: 14px; line-height: 1; font-weight: 700; cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; position: relative; z-index: 2; }
.tl-toggle:hover { background: var(--primary); color: #fff; }
.tl-toggle.open { background: var(--primary); color: #fff; }
.tl-leaf { width: 18px; height: 18px; flex: 0 0 18px; position: relative; z-index: 2; }
.tl-leaf::after { content: ""; position: absolute; left: 6px; top: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: .5; }
.tl-tname { color: var(--text); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tl-tname.done { text-decoration: line-through; color: var(--muted); }
/* Vạch nối cây: x của cấp k = 10px + k*22px + 9px (tâm nút tròn) */
.tl-guide, .tl-branch { position: absolute; top: 0; bottom: 0; left: calc(10px + var(--lv) * var(--step) + 8px); width: 0; border-left: 1.5px solid color-mix(in srgb, var(--primary) 45%, var(--border)); pointer-events: none; }
.tl-branch.last { bottom: 50%; }
.tl-branch.last::after { top: 100%; }
.tl-branch::after { content: ""; position: absolute; top: 50%; left: 0; width: calc(var(--step) - 8px); border-top: 1.5px solid color-mix(in srgb, var(--primary) 45%, var(--border)); }
.tl-row[hidden] { display: none; }
.tl-nobar { position: absolute; top: 50%; left: 8px; transform: translateY(-50%); font-size: .72rem; color: var(--muted); font-style: italic; }

/* ===== Giai đoạn 3 ===== */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--good); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2); font-size: .9rem; }
.toast.bad { background: var(--danger); }
.drag-ghost { position: fixed !important; left: 0; top: 0; pointer-events: none; z-index: 100; opacity: .92; box-shadow: 0 12px 30px rgba(0,0,0,.25) !important; margin: 0 !important; }
.dragging { display: none !important; }
.drag-ph { border: 2px dashed var(--primary); border-radius: 8px; background: var(--primary-soft); min-height: 24px; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.drop-over { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Kanban */
.board-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.board-tools > form.inline select { width: auto; padding: 6px 8px; font-size: .875rem; margin-bottom: 12px; }
.board-tools .filters { flex: 1; }
.board { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.board-col { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; }
.board-col header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; padding: 2px 4px 10px; }
.board-col header::before { content: ""; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--muted); }
.col-doing header::before { background: var(--primary); }
.col-done header::before { background: var(--good); }
.board-col header span:first-child { flex: 1; }
.board-col .count { font-size: .78rem; background: var(--surface); border: 1px solid var(--border); border-radius: 99px; padding: 0 8px; color: var(--muted); }
.board-cards { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 80px; border-radius: 8px; }
.board-empty { text-align: center; padding: 10px; border: 1px dashed var(--border); border-radius: 8px; display: none; }
.board-cards:not(:has(.kcard)) .board-empty { display: block; }
.board-more { padding: 8px 4px 0; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: 8px; padding: 9px 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 5px; touch-action: pan-y; }
.board[data-can-edit="1"] .kcard { cursor: grab; }
.kcard:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.kcard-title { color: var(--text); font-weight: 600; font-size: .9rem; }
.kcard.is-done .kcard-title { text-decoration: line-through; color: var(--muted); }
.kcard-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.kcard-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kcard-foot .avatars { margin-left: auto; }
.kcard .dl-hint { display: none; }

/* Lịch */
.cal-label { margin: 0 6px; font-size: 1.15rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-wd { text-align: center; font-size: .78rem; font-weight: 700; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day { min-height: 118px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-week .cal-day { min-height: 340px; }
.cal-day.wkend { background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { opacity: .45; }
.cal-dhead { display: flex; align-items: center; justify-content: space-between; }
.cal-num { font-size: .8rem; font-weight: 600; padding: 1px 6px; border-radius: 99px; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-add { border: 0; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; border-radius: 6px; width: 22px; height: 22px; line-height: 1; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; }
.cal-add:hover { background: var(--primary-soft); color: var(--primary); }
.cal-items { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-chip { display: block; font-size: .74rem; padding: 2px 6px; border-radius: 5px; border: 1px solid; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none !important; touch-action: pan-y; }
.cal[data-can-edit="1"] .cal-chip { cursor: grab; }
.cal-chip .dot { width: 7px; height: 7px; margin-right: 3px; }
.cal-chip.extra { display: none; }
.cal-items.show-all .cal-chip.extra { display: block; }
.cal-more { border: 0; background: none; color: var(--primary); font-size: .74rem; text-align: left; cursor: pointer; padding: 2px 4px; }
.cal-week .cal-chip { white-space: normal; padding: 4px 6px; }
.dialog { border: 1px solid var(--border); border-radius: 12px; padding: 20px; width: min(420px, 92vw); background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(0,0,0,.35); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Tệp đính kèm */
.file-list { list-style: none; padding: 0; margin: 0 0 12px; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.file-icon { font-size: 1.6rem; width: 44px; text-align: center; }
.file-thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); display: block; }
.file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border: 2px dashed var(--border); border-radius: 10px; text-align: center; cursor: pointer; }
.file-drop.drop-over { border-color: var(--primary); background: var(--primary-soft); outline: 0; }
.file-drop.sending { opacity: .6; pointer-events: none; }
.file-drop.sending label::after { content: " · đang tải lên..."; }
.file-drop input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop label { cursor: pointer; color: var(--primary); }

@media (max-width: 860px) {
  .board { grid-template-columns: repeat(3, 82vw); scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
  .cal-month .cal-day { min-height: 74px; }
  .cal-month .cal-chip b, .cal-month .cal-chip .dot { display: none; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-week .cal-wd { display: none; }
  .cal-week .cal-day { min-height: 0; border-right: 0; }
  .cal-add { opacity: 1; }
}
[hidden] { display: none !important; }

/* ===== Bản 1.4 ===== */
.kcard { cursor: default; user-select: none; }
.board[data-can-edit="1"] .kcard, .board[data-can-edit="1"] .kcard * { cursor: grab; }
.board[data-can-edit="1"] .kcard a.kcard-title { cursor: pointer; }
.kcard-head { line-height: 1.35; }
.kcard-title { display: inline; }
.kcard-title:hover { color: var(--primary); text-decoration: underline; }
.board a, .board img, .cal a, .cal img { -webkit-user-drag: none; user-drag: none; }
.cal-chip { user-select: none; }
.cal[data-can-edit="1"] .cal-chip { cursor: grab; }
.cal[data-can-edit="1"] .cal-chip:hover { filter: brightness(.96); outline: 1px solid currentColor; }
.cal-chip { padding: 3px 6px; }
.back-btn { display: inline-flex; align-items: center; padding: 3px 10px; margin-right: 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 500; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-btn:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

/* Ô thêm việc mở rộng */
.quick-add { flex-direction: column; align-items: stretch; }
.qa-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.qa-more summary { cursor: pointer; font-size: .85rem; color: var(--primary); padding: 2px 2px; user-select: none; }
.qa-more[open] summary { margin-bottom: 8px; }
.qa-more textarea { margin-bottom: 8px; }
.qa-more .label { font-size: .85rem; font-weight: 500; margin-bottom: 4px; }
.chip-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-opt { cursor: pointer; display: inline-flex !important; }
.chip-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-opt span { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; border: 1px solid var(--border); font-size: .82rem; font-weight: 400; background: var(--surface); }
.chip-opt input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chip-opt input:disabled + span { opacity: .7; cursor: default; }
.group-quick { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.group-btn { cursor: pointer; font: inherit; font-size: .76rem; font-weight: 600; }
.group-btn.on { background: var(--c); color: #fff; }
.task-aside .chip-pick { max-height: 200px; overflow-y: auto; }

/* Nhóm thành viên */
.group-item { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin-bottom: 8px; }
.group-item summary { cursor: pointer; display: flex; gap: 10px; align-items: center; }
.group-item[open] summary { margin-bottom: 10px; }
.group-form { margin-bottom: 8px; }
.group-form .inline-form select { width: auto; }

/* Thông báo */
.notif-menu { position: relative; }
.notif-menu summary { list-style: none; position: relative; font-size: 1.25rem; }
.notif-menu summary::-webkit-details-marker { display: none; }
.notif-badge { position: absolute; top: -2px; right: -2px; background: var(--danger); color: #fff; font-size: .66rem; font-weight: 700; min-width: 17px; height: 17px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; padding: 0 4px; border: 2px solid var(--surface); }
.notif-drop { width: min(380px, 92vw); max-height: 70vh; overflow-y: auto; padding: 0; right: -50px; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.link-btn { background: none !important; border: 0; color: var(--primary) !important; cursor: pointer; font: inherit; font-size: .82rem; padding: 0 !important; width: auto !important; }
.notif-item { display: flex !important; gap: 10px; padding: 10px 12px !important; border-bottom: 1px solid var(--border); color: var(--text); border-radius: 0 !important; text-decoration: none !important; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--primary-soft); }
.notif-ico { font-size: 1.1rem; }
.notif-body { display: flex; flex-direction: column; gap: 2px; font-size: .86rem; min-width: 0; }
.notif-detail { font-size: .8rem; font-weight: 600; color: var(--warn); }
.notif-path { font-size: .76rem; color: var(--muted); }
.notif-all { display: block !important; text-align: center; padding: 10px !important; font-size: .85rem; color: var(--primary) !important; }
.notif-empty { padding: 14px; margin: 0; }
.notif-page { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.group-form .inline-form { display: flex; flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.group-form .inline-form input[name=name] { flex: 1 1 220px; }
.group-form label.qa-me { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }


/* Ô chọn người (bản 1.4.1) */
.assignee-picker.enhanced .chip-opt input:checked + span { padding-right: 6px; }
.chip-x { display: none; font-style: normal; font-weight: 700; margin-left: 2px; width: 16px; height: 16px; border-radius: 50%; align-items: center; justify-content: center; font-size: .9rem; line-height: 1; color: var(--muted); }
.assignee-picker.enhanced:not(.readonly) .chip-opt input:checked + span .chip-x { display: inline-flex; }
.assignee-picker.enhanced .chip-opt:hover .chip-x { background: var(--danger); color: #fff; }
.assignee-picker.readonly .chip-opt { cursor: default; }
.assignee-picker.readonly .chip-opt input:disabled + span { opacity: 1; }
.pick-add { margin-top: 6px; font-size: .85rem; padding: 6px 8px; color: var(--primary); border-style: dashed; }
.assignee-picker .group-quick { display: none; }
.task-aside .chip-pick { max-height: none; }

/* Bộ lọc: ô đang lọc tô màu + nút × */
.f-item { position: relative; display: inline-flex; align-items: center; }
.f-item.on select, .f-item.on input { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; padding-right: 26px; }
.f-item.on select { padding-right: 46px; }
.f-x { position: absolute; right: 22px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff !important; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; text-decoration: none !important; line-height: 1; z-index: 1; }
.f-item.on input + .f-x { right: 6px; }
.f-x:hover { background: var(--danger); }
.filters .f-item:has(.f-search) { flex: 1 1 200px; }
.filters .f-item .f-search { width: 100%; }
.f-reset { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.task-path { display: inline-flex; align-items: center; flex-wrap: wrap; color: var(--muted); }
.task-path .sep { margin: 0 5px; opacity: .6; }
.meta-count { color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; }
.chip-opt[hidden], .pick-add[hidden], .pick-empty[hidden] { display: none !important; }

/* Danh sách xếp theo cây */
.task-group-head { padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 700; font-size: .88rem; }
.task-group-head a { color: var(--text); display: inline-flex; align-items: center; }
.tree-row { --step: 28px; position: relative; padding-left: calc(14px + var(--dep) * var(--step)); }
.tree-row.ctx { background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--border) 35%, transparent) 6px 7px); }
.tree-row.ctx .task-main, .tree-row.ctx .task-side, .tree-row.ctx .check { opacity: .55; }
.tr-guide, .tr-branch { position: absolute; top: 0; bottom: 0; left: calc(14px + var(--lv) * var(--step) + 9px); border-left: 1.5px solid color-mix(in srgb, var(--primary) 40%, var(--border)); pointer-events: none; }
.tr-branch.last { bottom: 50%; }
.tr-branch::after { content: ""; position: absolute; top: 50%; left: 0; width: calc(var(--step) - 12px); border-top: 1.5px solid color-mix(in srgb, var(--primary) 40%, var(--border)); }
.tr-branch.last::after { top: 100%; }
@media (max-width: 860px) { .tree-row { --step: 18px; } .tree-row .task-side { padding-left: 0; } }

/* ===== Giai đoạn 4 ===== */
.nr-intro { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid #a16207; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-size: .9rem; }
.nr-intro p { margin: 0; }
.nr-chip { color: #92400e; background: #fef3c7; border: 1px solid #fde68a; border-radius: 5px; padding: 0 6px; }
.nr-win { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.nr-win input { width: 130px; }
.nr-now { border-color: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 15%, transparent); }
.nr-box { border: 1px dashed #fbbf24; border-radius: 8px; padding: 8px 10px; background: color-mix(in srgb, #fef3c7 35%, var(--surface)); display: flex; flex-direction: column; gap: 6px; }
.nr-times { display: flex; flex-direction: column; gap: 4px; }
.ntd-add summary { cursor: pointer; }
.ntd-add[open] summary { margin-bottom: 12px; }
.ntd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.ntd-card { margin: 0; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--border); }
.ntd-card.kept { border-top-color: var(--good); }
.ntd-card.slipped { border-top-color: var(--danger); }
.ntd-card.pending { border-top-color: var(--warn); }
.ntd-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ntd-head h3 { margin: 0; }
.ntd-harm { margin: 0; font-size: .88rem; color: var(--muted); white-space: pre-wrap; }
.ntd-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; }
.ntd-history { display: flex; gap: 4px; }
.ntd-history .hd { width: 16px; height: 16px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.ntd-history .hd.ok { background: var(--good); border-color: var(--good); }
.ntd-history .hd.no { background: var(--danger); border-color: var(--danger); }
.ntd-review { display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); border-radius: 8px; padding: 10px; }
.ntd-review .actions { justify-content: flex-start; }
.ntd-ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, var(--border)); }
.ntd-no { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--border)); }
.ok-t { color: var(--good); } .no-t { color: var(--danger); }
.ntd-more summary { cursor: pointer; }
.ntd-more .form { margin: 8px 0; }
.setting-row { font-size: .92rem !important; color: var(--text) !important; }
.nr-banner { display: block; color: var(--text); text-decoration: none !important; } .nr-banner:hover { border-color: #a16207; }

/* Thành viên dự án */
.vis-pick { display: flex; flex-direction: column; gap: 8px; }
.vis-opt { display: flex !important; flex-direction: row !important; gap: 10px !important; align-items: flex-start; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-weight: 400 !important; }
.vis-opt input { width: auto; margin-top: 3px; }
.vis-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.lock { font-size: .75em; }
.mt { margin-top: 18px; }
.kcard.locked, .cal-chip.locked { cursor: default !important; }

/* Bản 1.7: trưởng nhóm nổi bật nhẹ */
.tag.leader { background: color-mix(in srgb, var(--c) 26%, transparent); border-color: var(--c); border-width: 1.5px; font-weight: 700; color: color-mix(in srgb, var(--c) 80%, #000); }
@media (prefers-color-scheme: dark) { .tag.leader { color: color-mix(in srgb, var(--c) 70%, #fff); } }
.star { color: #f59e0b; text-shadow: 0 0 1px rgba(0,0,0,.25); }
.group-form .label { font-size: .85rem; color: var(--muted); }

/* Mẫu dự án */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.tpl-card { cursor: pointer; display: block !important; }
.tpl-card input { position: absolute; opacity: 0; width: 0; height: 0; }
.tpl-card > span { display: flex; flex-direction: column; gap: 3px; height: 100%; border: 1px solid var(--border); border-left: 4px solid var(--c, var(--border)); border-radius: 8px; padding: 9px 11px; font-weight: 400; background: var(--surface); }
.tpl-card b { display: flex; align-items: center; font-size: .9rem; }
.tpl-card small { font-size: .76rem; line-height: 1.35; }
.tpl-count { color: var(--primary); font-weight: 600; }
.tpl-card input:checked + span { border-color: var(--primary); border-left-color: var(--c, var(--primary)); background: var(--primary-soft); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.assign-all { border-color: var(--primary); }
.tpl-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.tpl-row .tpl-main { flex: 1; min-width: 0; }
.tpl-row details > summary { cursor: pointer; list-style: none; }
.tpl-row details > summary::-webkit-details-marker { display: none; }
.tpl-row .tpl-title { font-weight: 600; }
.tpl-row .tpl-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .78rem; color: var(--muted); margin-top: 2px; }
.tpl-row form.form { margin: 10px 0 4px; }
.tpl-day-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 860px) { .tpl-day-grid { grid-template-columns: 1fr 1fr; } }

/* ===== Dòng thời gian: dạng thẻ trên điện thoại ===== */
.tl-extra { display: contents; }
.tl-span-sel, .tl-filter-btn, .tl-mode-btn, .tl-cards { display: none; }
@media (max-width: 860px) {
  .tl-toolbar { gap: 6px; flex-wrap: wrap; }
  .tl-span-sel { display: inline-block; width: auto; padding: 5px 8px; font-size: .85rem; }
  .tl-filter-btn, .tl-mode-btn { display: inline-flex; }
  .tl-span-tabs { display: none; }
  .tl-extra { display: none; width: 100%; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
  .tl-extra.open { display: flex; }
  .tl-extra .filters { margin: 0; }
  body:not(.tl-chart-mode) .tl-wrap { display: none; }
  body:not(.tl-chart-mode) .tl-cards { display: block; }
}
.tlc-project { background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.tlc-phead { list-style: none; cursor: pointer; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.tlc-phead::-webkit-details-marker { display: none; }
.tlc-pname { font-weight: 700; display: flex; align-items: center; }
.tlc-pname::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .15s; }
.tlc-project:not([open]) .tlc-pname::after { transform: rotate(-90deg); }
.tlc-pmeta { display: flex; align-items: center; gap: 6px; font-size: .8rem; }
.tlc-pmeta .tl-mini { max-width: 120px; }
.tlc-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px 10px calc(12px + var(--dep) * 18px); border-top: 1px solid var(--border); position: relative; }
.tlc-row[hidden] { display: none; }
.tlc-row[style*="--dep:1"]::before, .tlc-row[style*="--dep:2"]::before { content: ""; position: absolute; top: 0; bottom: 0; left: calc(12px + (var(--dep) - 1) * 18px + 8px); border-left: 1.5px solid color-mix(in srgb, var(--primary) 40%, var(--border)); }
.tlc-row .tl-toggle, .tlc-row .tl-leaf { margin-top: 2px; }
.tlc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tlc-top { display: flex; gap: 8px; align-items: flex-start; }
.tlc-title { flex: 1; color: var(--text); font-weight: 500; line-height: 1.35; word-break: break-word; }
.tlc-title.done { text-decoration: line-through; color: var(--muted); }
.tlc-time { display: flex; align-items: center; gap: 6px; font-size: .74rem; background: none !important; border: 0 !important; padding: 0 !important; }
.tlc-d { color: var(--muted); font-variant-numeric: tabular-nums; }
.tlc-bar { position: relative; flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; border: 1px solid var(--border); overflow: visible; }
.tlc-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: currentColor; opacity: .55; }
.tlc-now { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); transform: translate(-50%, -50%); }
.tlc-hint { font-weight: 600; white-space: nowrap; }
.tlc-empty { padding: 10px 12px; margin: 0; border-top: 1px solid var(--border); }
.table .person { flex-wrap: nowrap; }
