/* ═══ Team Tasks (team-tasks.js) — bảng việc kiểu Trello, giao diện Apple ═══ */
.tt-page { --tt-ink: #1d1d1f; --tt-sub: #6e6e73; --tt-faint: #86868b; --tt-line: #e8e8ed; --tt-card: #fff; --tt-fill: #f5f5f7; --tt-blue: #0071e3;
  max-width: 1500px; display: grid; gap: 14px; color: var(--tt-ink); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", sans-serif; }
.tt-empty { padding: 40px; color: var(--tt-sub); text-align: center; }
.tt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tt-head h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.tt-head p { margin: 4px 0 0; max-width: 760px; color: var(--tt-sub); font-size: 13.5px; line-height: 1.45; }
.tt-head-acts { display: flex; gap: 8px; }
.tt-head-acts button { height: 36px !important; min-height: 0 !important; padding: 0 16px !important; border-radius: 980px !important; font-size: 13.5px !important; font-weight: 600 !important; cursor: pointer; }
.tt-refresh { border: 1px solid var(--tt-line) !important; background: #fff !important; color: var(--tt-ink) !important; }
.tt-new { border: 0 !important; background: var(--tt-blue) !important; color: #fff !important; }
.tt-stats { display: flex; flex-wrap: wrap; gap: 18px; color: var(--tt-sub); font-size: 13px; }
.tt-stats b { margin-right: 3px; color: var(--tt-ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.tt-stats .bad b { color: #d70015; }
.tt-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tt-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #ececf0; }
.tt-seg button { display: inline-flex; align-items: center; gap: 6px; height: 30px !important; min-height: 0 !important; padding: 0 12px !important; border: 0 !important; border-radius: 8px !important; background: transparent !important; color: var(--tt-ink) !important; font-size: 13px !important; font-weight: 500 !important; box-shadow: none !important; cursor: pointer; }
.tt-seg button em { color: var(--tt-faint); font-size: 12px; font-style: normal; font-variant-numeric: tabular-nums; }
.tt-seg button.on { background: #fff !important; font-weight: 600 !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .12) !important; }
.tt-tools select, .tt-tools input { height: 36px !important; min-height: 0 !important; padding: 0 12px !important; border: 1px solid var(--tt-line) !important; border-radius: 10px !important; background: #fff !important; font-size: 13px !important; }
.tt-tools input { min-width: 200px; }

/* ── Bảng kiểu Trello: 4 cột, kéo thả ── */
.tt-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.tt-col { display: flex; flex-direction: column; gap: 8px; min-height: 140px; padding: 10px; border-radius: 16px; background: #ececf0; transition: background .15s, box-shadow .15s; }
.tt-col.tt-over { background: #e3ecfa; box-shadow: inset 0 0 0 2px rgba(0, 113, 227, .35); }
.tt-col h4 { display: flex; align-items: center; gap: 8px; margin: 2px 4px; color: var(--tt-ink); font-size: 13.5px; font-weight: 700; }
.tt-col h4 em { margin-left: auto; padding: 1px 8px; border-radius: 980px; background: rgba(0, 0, 0, .07); color: var(--tt-sub); font-size: 11.5px; font-style: normal; font-weight: 600; }
.tt-dot { width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; }
.tt-doing .tt-dot { background: #0a84ff; }
.tt-review .tt-dot { background: #ff9f0a; }
.tt-done .tt-dot { background: #34c759; }
.tt-list { display: flex; flex-direction: column; gap: 8px; min-height: 36px; }
.tt-none { margin: 6px 4px; padding: 14px 8px; border: 1.5px dashed rgba(0, 0, 0, .12); border-radius: 10px; color: var(--tt-faint); font-size: 12.5px; text-align: center; }
.tt-add { height: 34px !important; min-height: 0 !important; padding: 0 10px !important; border: 0 !important; border-radius: 10px !important; background: transparent !important; color: var(--tt-sub) !important; font-size: 13px !important; font-weight: 500 !important; text-align: left; cursor: pointer; }
.tt-add:hover { background: rgba(0, 0, 0, .06) !important; color: var(--tt-ink) !important; }
.tt-compose { display: grid; gap: 6px; }
.tt-compose textarea { width: 100%; min-height: 58px; padding: 9px 11px !important; border: 0 !important; border-radius: 10px !important; background: #fff !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 2px rgba(0, 113, 227, .45) !important; font: 14px/1.4 inherit !important; resize: none; }
.tt-compose div { display: flex; align-items: center; gap: 6px; }
.tt-compose button[type=submit] { height: 32px !important; min-height: 0 !important; padding: 0 14px !important; border: 0 !important; border-radius: 8px !important; background: var(--tt-blue) !important; color: #fff !important; font-size: 13px !important; font-weight: 600 !important; cursor: pointer; }
.tt-compose-x { width: 32px; height: 32px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 8px !important; background: transparent !important; color: var(--tt-sub) !important; font-size: 20px !important; cursor: pointer; }

/* ── Thẻ ── */
.tt-card { position: relative; display: grid; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--tt-card); box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .06); cursor: grab; user-select: none; transition: box-shadow .15s; }
.tt-card:hover, .tt-card:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(0, 113, 227, .4), 0 4px 12px rgba(0, 0, 0, .08); }
.tt-card.pr-high { box-shadow: inset 3px 0 0 #ff3b30, 0 1px 3px rgba(0, 0, 0, .06); }
.tt-card.is-done { opacity: .66; }
.tt-card.is-done .tt-title { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, .3); }
.tt-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.tt-labels span { padding: 2px 8px; border-radius: 5px; background: var(--lc); color: #fff; font-size: 10.5px; font-weight: 700; letter-spacing: .01em; }
.tt-title { font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tt-note { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--tt-sub); font-size: 12px; line-height: 1.4; }
.tt-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--tt-sub); font-size: 11.5px; }
.tt-badges > span { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 6px; background: #f2f2f5; font-variant-numeric: tabular-nums; }
.tt-badges .tt-ico { padding: 0 2px; background: transparent; }
.tt-cat { color: #3a3a3c; }
.tt-badges .tt-auto { background: #eaf2fe; color: #0071e3; font-weight: 600; }
.tt-badges .tt-due.today { background: #fff4e5; color: #b45309; font-weight: 600; }
.tt-badges .tt-due.late { background: #ff3b30; color: #fff; font-weight: 600; }
.tt-badges .tt-due.ok, .tt-badges .tt-cl.full { background: #34c759; color: #fff; }
.tt-badges .tt-who { margin-left: auto; padding: 0; background: transparent; }
.tt-who i { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #0a84ff, #5e5ce6); color: #fff; font-size: 10px; font-style: normal; font-weight: 700; }
.tt-who.none i { background: #c7c7cc; }
.tt-link { height: 20px !important; min-height: 0 !important; padding: 0 4px !important; border: 0 !important; border-radius: 6px !important; background: transparent !important; color: var(--tt-blue) !important; font-size: 11.5px !important; font-weight: 600 !important; box-shadow: none !important; cursor: pointer; }
.tt-move { display: none; justify-self: start; height: 26px !important; min-height: 0 !important; padding: 0 10px !important; border: 1px solid var(--tt-line) !important; border-radius: 980px !important; background: #fff !important; color: var(--tt-ink) !important; font-size: 11.5px !important; font-weight: 600 !important; }

/* Kéo thả */
.tt-card.tt-dragging { display: none; }
.tt-ph { flex: none; border-radius: 10px; background: rgba(0, 0, 0, .08); }
.tt-ghost { position: fixed; top: 0; left: 0; z-index: 9999; margin: 0; pointer-events: none; box-shadow: 0 14px 34px rgba(0, 0, 0, .22) !important; opacity: .96; }
body.tt-is-dragging, body.tt-is-dragging * { cursor: grabbing !important; user-select: none !important; }

/* ── Chi tiết thẻ ── */
dialog.tt-dialog { width: min(860px, calc(100vw - 24px)) !important; max-width: none !important; }
.tt-detail header { display: flex; align-items: center; gap: 10px; }
.tt-detail .tt-d-title { flex: 1; height: 42px !important; border-color: transparent !important; background: transparent !important; font-size: 19px !important; font-weight: 700 !important; letter-spacing: -.01em; }
.tt-detail .tt-d-title:hover, .tt-detail .tt-d-title:focus { border-color: #d2d2d7 !important; background: #fff !important; }
.tt-d-body { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 22px; max-height: min(66vh, 680px); overflow: auto; padding: 4px 2px 10px; }
.tt-d-main { display: grid; gap: 8px; align-content: start; min-width: 0; }
.tt-d-main h5 { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; color: #1d1d1f; font-size: 13.5px; font-weight: 700; }
.tt-d-main h5 small { color: #86868b; font-weight: 500; }
.tt-d-sys { margin: 0; padding: 8px 10px; border-radius: 10px; background: #f5f5f7; color: #3a3a3c; font-size: 13px; line-height: 1.45; }
.tt-d-main textarea { width: 100%; min-height: 84px !important; padding: 9px 12px !important; font: 13.5px/1.5 inherit !important; resize: vertical; }
.tt-cl-bar { height: 6px; border-radius: 3px; background: #ececf0; overflow: hidden; }
.tt-cl-bar[hidden] { display: none; }
.tt-cl-bar i { display: block; height: 100%; border-radius: 3px; background: #34c759; transition: width .2s; }
.tt-cl-list { display: grid; gap: 2px; }
.tt-cl-list label { display: flex !important; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; color: #1d1d1f !important; font-size: 13.5px !important; cursor: pointer; }
.tt-cl-list label:hover { background: #f5f5f7; }
.tt-cl-list label.done span { color: #86868b; text-decoration: line-through; }
.tt-cl-list input { width: 17px; height: 17px; min-height: 0 !important; accent-color: #34c759; }
.tt-cl-list span { flex: 1; }
.tt-cl-list button { width: 24px; height: 24px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; color: #aeaeb2 !important; font-size: 17px !important; cursor: pointer; opacity: 0; }
.tt-cl-list label:hover button { opacity: 1; }
.tt-cl-add, .tt-cm-add { display: flex; gap: 8px; align-items: flex-start; }
.tt-cl-add input { flex: 1; }
.tt-cl-add button, .tt-cm-add button { height: 38px !important; min-height: 0 !important; padding: 0 14px !important; border: 0 !important; border-radius: 9px !important; background: #f2f2f5 !important; color: #1d1d1f !important; font-size: 13px !important; font-weight: 600 !important; cursor: pointer; }
.tt-cm-add button { background: #0071e3 !important; color: #fff !important; }
.tt-cm-add textarea { flex: 1; min-height: 40px !important; }
.tt-cm-list { display: grid; gap: 10px; margin: 4px 0 0; padding: 0; list-style: none; }
.tt-cm-list li { display: flex; gap: 10px; }
.tt-cm-list li > i { display: inline-grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #0a84ff, #5e5ce6); color: #fff; font-size: 10.5px; font-style: normal; font-weight: 700; }
.tt-cm-list b { font-size: 13px; }
.tt-cm-list small { margin-left: 6px; color: #86868b; font-size: 11.5px; }
.tt-cm-list p { margin: 4px 0 0; padding: 8px 11px; border-radius: 10px; background: #f5f5f7; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.tt-cm-list li.sys small { margin: 0; }
.tt-d-side { display: grid; gap: 10px; align-content: start; }
.tt-d-side > label { display: grid !important; gap: 4px; color: #6e6e73 !important; font-size: 12px !important; font-weight: 600; }
.tt-d-labels { display: grid; gap: 5px; margin: 0; padding: 0; border: 0; }
.tt-d-labels legend { margin-bottom: 4px; padding: 0; color: #6e6e73; font-size: 12px; font-weight: 600; }
.tt-d-labels label { position: relative; display: flex !important; align-items: center; gap: 8px; cursor: pointer; }
.tt-d-labels input { position: absolute; opacity: 0; pointer-events: none; }
.tt-d-labels span { flex: 1; padding: 6px 10px; border-radius: 7px; background: var(--lc); color: #fff; font-size: 12.5px; font-weight: 700; opacity: .35; transition: opacity .15s; }
.tt-d-labels input:checked + span { opacity: 1; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .18); }
.tt-d-labels input:checked + span::after { content: " ✓"; }
.tt-d-labels input:focus-visible + span { outline: 2px solid #0071e3; outline-offset: 2px; }
dialog.dialog menu .tt-del { margin-right: auto; border-color: transparent !important; color: #d70015 !important; }

@media (max-width: 1100px) { .tt-board { grid-template-columns: repeat(4, 260px); } }
@media (max-width: 760px) {
  .tt-head h2 { font-size: 22px; } .tt-head-acts { width: 100%; } .tt-head-acts button { flex: 1; }
  .tt-tools input { flex: 1; min-width: 0; } .tt-seg { width: 100%; } .tt-seg button { flex: 1; justify-content: center; }
  .tt-board { grid-template-columns: repeat(4, 82vw); scroll-snap-type: x mandatory; } .tt-col { scroll-snap-align: start; }
  .tt-card { cursor: pointer; } .tt-move { display: inline-flex; align-items: center; }
  .tt-d-body { grid-template-columns: 1fr; max-height: 70vh; }
}

/* Thắng các quy tắc nút chung của #workspace */
#workspace .tt-page .tt-card .tt-move { display: none !important; }
#workspace .tt-page .tt-badges .tt-link, #workspace .tt-page .tt-d-sys .tt-link { border: 0 !important; background: transparent !important; box-shadow: none !important; }
@media (max-width: 760px) { #workspace .tt-page .tt-card .tt-move { display: inline-flex !important; } }

/* ═══ Công việc — giao diện Apple (Reminders) · thêm cho team-tasks.js bản 3 ═══ */
.tk-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tk-head small { color: #86868b; font-size: 13px; font-weight: 600; text-transform: capitalize; }
.tk-head h2 { margin: 2px 0 0; font-size: 30px; font-weight: 700; letter-spacing: -.025em; }
.tk-acts { display: flex; gap: 8px; }
#workspace .tt-page .tk-btn { height: 36px !important; min-height: 0 !important; padding: 0 16px !important; border: 1px solid #e5e5ea !important; border-radius: 980px !important; background: #fff !important; color: #1d1d1f !important; font-size: 13.5px !important; font-weight: 600 !important; box-shadow: none !important; cursor: pointer; }
#workspace .tt-page .tk-btn.icon { width: 36px; padding: 0 !important; font-size: 16px !important; }
#workspace .tt-page .tk-btn.primary { border-color: #0071e3 !important; background: #0071e3 !important; color: #fff !important; }
#workspace .tt-page .tk-btn:hover { filter: brightness(.97); }

/* Ô tổng quan (bấm để lọc) */
.tk-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
#workspace .tt-page .tk-tile { display: grid !important; grid-template-columns: 1fr auto; align-items: center; gap: 4px; height: auto !important; min-height: 0 !important; padding: 14px 16px !important; border: 0 !important; border-radius: 14px !important; background: #fff !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04) !important; color: #1d1d1f !important; text-align: left; cursor: pointer; transition: box-shadow .15s; }
#workspace .tt-page .tk-tile span { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; }
#workspace .tt-page .tk-tile span::before { content: ""; width: 26px; height: 26px; border-radius: 50%; background-color: var(--tc); background-position: center; background-size: 14px; background-repeat: no-repeat; }
#workspace .tt-page .tk-tile b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
#workspace .tt-page .tk-tile.on { box-shadow: 0 0 0 2px var(--tc), 0 4px 14px rgba(0, 0, 0, .06) !important; }
.tk-tile.t-late { --tc: #ff3b30; } .tk-tile.t-today { --tc: #ff9500; } .tk-tile.t-week { --tc: #0a84ff; } .tk-tile.t-review { --tc: #af52de; }
#workspace .tt-page .tk-tile.t-late span::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M12 7v6M12 17h.01'/%3E%3C/svg%3E"); }
#workspace .tt-page .tk-tile.t-today span::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='7'/%3E%3Cpath d='M12 8v4l2.5 2'/%3E%3C/svg%3E"); }
#workspace .tt-page .tk-tile.t-week span::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='6' width='14' height='13' rx='2'/%3E%3Cpath d='M5 10h14M9 4v4M15 4v4'/%3E%3C/svg%3E"); }
#workspace .tt-page .tk-tile.t-review span::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-6 10-6 10 6 10 6-3.5 6-10 6S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='2.5'/%3E%3C/svg%3E"); }

/* Thanh lọc */
.tk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tk-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: #e9e9ee; }
#workspace .tt-page .tk-seg button { display: inline-flex; align-items: center; gap: 6px; height: 28px !important; min-height: 0 !important; padding: 0 11px !important; border: 0 !important; border-radius: 8px !important; background: transparent !important; color: #1d1d1f !important; font-size: 12.5px !important; font-weight: 500 !important; box-shadow: none !important; cursor: pointer; white-space: nowrap; }
#workspace .tt-page .tk-seg button em { color: #86868b; font-size: 11.5px; font-style: normal; font-variant-numeric: tabular-nums; }
#workspace .tt-page .tk-seg button.on { background: #fff !important; font-weight: 600 !important; box-shadow: 0 1px 3px rgba(0, 0, 0, .12) !important; }
.tk-bar select, .tk-bar input { height: 34px !important; min-height: 0 !important; padding: 0 12px !important; border: 1px solid #e5e5ea !important; border-radius: 10px !important; background: #fff !important; font-size: 13px !important; }
.tk-bar select.on { border-color: #0071e3 !important; color: #0071e3; }
.tk-bar input { flex: 1; min-width: 160px; max-width: 260px; }
.tk-bar .tk-seg:last-child { margin-left: auto; }
.tk-focus { margin: 0; color: #6e6e73; font-size: 13px; }
#workspace .tt-page .tk-focus button { height: auto !important; min-height: 0 !important; margin-left: 6px; padding: 2px 8px !important; border: 0 !important; border-radius: 980px !important; background: #eef5ff !important; color: #0071e3 !important; font-size: 12px !important; font-weight: 600 !important; cursor: pointer; }

/* Danh sách kiểu Reminders */
.tk-list { display: grid; gap: 16px; }
.tk-group { overflow: hidden; border-radius: 14px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 14px rgba(0, 0, 0, .04); }
.tk-group h4 { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px 16px 8px; color: var(--gc, #1d1d1f); font-size: 15px; font-weight: 700; }
.tk-group h4 em { color: #86868b; font-size: 13px; font-style: normal; font-weight: 600; }
.g-late { --gc: #d70015; } .g-today { --gc: #c93400; } .g-week { --gc: #0071e3; } .g-review { --gc: #8944ab; } .g-nodate, .g-later { --gc: #1d1d1f; }
.tk-group ul { margin: 0; padding: 0; list-style: none; }
.tk-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 11px 16px; border-top: 1px solid #f0f0f3; cursor: pointer; transition: background .12s; }
.tk-row:hover, .tk-row:focus-visible { outline: none; background: #f8f8fa; }
#workspace .tt-page .tk-check { width: 22px; height: 22px !important; min-height: 0 !important; margin-top: 1px; padding: 0 !important; border: 1.6px solid #c7c7cc !important; border-radius: 50% !important; background: #fff !important; box-shadow: none !important; cursor: pointer; transition: border-color .15s, background .15s; }
#workspace .tt-page .tk-check:hover { border-color: #0071e3 !important; }
#workspace .tt-page .tk-row.is-done .tk-check { border-color: #0071e3 !important; background: #0071e3 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E") center / 14px no-repeat !important; }
.tk-row.is-done .tk-title { color: #86868b; text-decoration: line-through; }
.tk-main { display: grid; gap: 4px; min-width: 0; }
.tk-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tk-title { font-size: 14.5px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tk-hi { margin-right: 4px; color: #ff3b30; font-style: normal; font-weight: 800; }
.tk-note { overflow: hidden; color: #6e6e73; font-size: 12.5px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.tk-labels { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tk-labels b { padding: 1px 7px; border-radius: 5px; background: var(--lc); color: #fff; font-size: 10.5px; font-weight: 700; }
.tk-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: #86868b; font-size: 12px; }
.tk-src { padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.tk-src.auto { background: #eaf2fe; color: #0062c4; }
.tk-src.manual { background: #f2f2f5; color: #3a3a3c; }
.tk-cl.full { color: #1a8f3c; font-weight: 600; }
#workspace .tt-page .tk-order { height: auto !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; color: #0071e3 !important; font-size: 12px !important; font-weight: 600 !important; cursor: pointer; }
.tk-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; max-width: 320px; }
.tk-due { padding: 2px 8px; border-radius: 6px; background: #f2f2f5; color: #3a3a3c; font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tk-due.late { background: #ffeceb; color: #d70015; }
.tk-due.today { background: #fff4e5; color: #c93400; }
.tk-due.soon { background: #eef5ff; color: #0062c4; }
.tk-due.ok { background: #e8f8ee; color: #1a8f3c; }
.tk-st { padding: 2px 8px; border-radius: 980px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tk-st.doing { background: #eef5ff; color: #0062c4; }
.tk-st.review { background: #f6effa; color: #8944ab; }
.tk-who { display: inline-flex; align-items: center; gap: 6px; color: #3a3a3c; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tk-av { display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #0a84ff, #5e5ce6); color: #fff; font-size: 9.5px; font-style: normal; font-weight: 700; }
.tk-av.none { background: #c7c7cc; }
#workspace .tt-page .tk-take { height: 26px !important; min-height: 0 !important; padding: 0 11px !important; border: 1px solid #0071e3 !important; border-radius: 980px !important; background: #fff !important; color: #0071e3 !important; font-size: 12px !important; font-weight: 600 !important; box-shadow: none !important; cursor: pointer; white-space: nowrap; }
#workspace .tt-page .tk-take:hover { background: #0071e3 !important; color: #fff !important; }
#workspace .tt-page .tk-done-toggle { display: flex !important; align-items: center; justify-content: flex-start !important; gap: 8px; width: 100%; height: auto !important; min-height: 0 !important; padding: 12px 16px !important; border: 0 !important; background: transparent !important; box-shadow: none !important; color: #6e6e73 !important; font-size: 14px !important; font-weight: 600 !important; text-align: left; cursor: pointer; }
.tk-done-toggle em { color: #86868b; font-style: normal; }
.tk-empty { display: grid; justify-items: center; gap: 4px; padding: 48px 16px; border-radius: 14px; background: #fff; color: #6e6e73; text-align: center; }
.tk-empty div { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 50%; background: #e8f8ee; color: #1a8f3c; font-size: 24px; font-weight: 700; }
.tk-empty b { color: #1d1d1f; font-size: 16px; }

/* Thẻ trên Bảng: chân thẻ */
.tt-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tt-card .tk-meta { font-size: 11.5px; }

/* Chi tiết việc */
.tk-d-src { margin: 0; padding: 10px 12px; border-radius: 10px; background: #f5f5f7; color: #3a3a3c; font-size: 13px; line-height: 1.5; }
.tt-d-side .tk-assign { padding: 10px; border-radius: 12px; background: #eef5ff; color: #0062c4 !important; }
.tt-d-side .tk-assign select { border-color: #b8d4f5 !important; font-weight: 600 !important; }

/* Giao việc tự động */
dialog.tk-rules-dialog { width: min(620px, calc(100vw - 24px)) !important; }
.tk-rules-intro { margin: 0 0 12px; color: #6e6e73; font-size: 13px; line-height: 1.5; }
.tk-rules-list { display: grid; gap: 2px; overflow: hidden; border-radius: 12px; background: #f5f5f7; }
.tk-rules-list label { display: grid !important; grid-template-columns: minmax(0, 1fr) 240px; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; }
.tk-rules-list span { display: grid; gap: 2px; }
.tk-rules-list b { color: #1d1d1f; font-size: 14px; }
.tk-rules-list small { color: #86868b; font-size: 12px; }

@media (max-width: 900px) { .tk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tk-bar .tk-seg:last-child { margin-left: 0; } }
@media (max-width: 760px) {
  .tk-head h2 { font-size: 26px; } .tk-acts { width: 100%; } .tk-acts .tk-btn.primary { flex: 1; }
  .tk-bar { gap: 6px; } .tk-bar input { max-width: none; } .tk-bar .tk-seg { overflow-x: auto; max-width: 100%; }
  .tk-row { grid-template-columns: 24px minmax(0, 1fr); } .tk-side { grid-column: 2; justify-content: flex-start; max-width: none; }
  .tk-rules-list label { grid-template-columns: 1fr; }
}

/* ═══ Công việc trên điện thoại — kiểu ứng dụng Lời nhắc (Reminders) của iPhone ═══ */
@media (max-width: 760px) {
  .tt-page { gap: 12px; padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  /* Đầu trang: tiêu đề lớn, nút phụ chỉ còn biểu tượng */
  .tk-head { flex-wrap: nowrap; align-items: center; }
  .tk-head h2 { font-size: 32px; }
  .tk-acts { width: auto; gap: 6px; }
  #workspace .tt-page #ttRules { width: 36px; padding: 0 !important; font-size: 0 !important; }
  #workspace .tt-page #ttRules::before { content: "⚙"; font-size: 16px; }
  /* Nút "Giao việc" nổi ở góc dưới, phía trên thanh tab */
  #workspace .tt-page #ttNew { position: fixed; left: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; height: 46px !important; padding: 0 20px !important; border-radius: 23px !important; box-shadow: 0 8px 22px rgba(0, 113, 227, .35) !important; font-size: 15px !important; }
  /* 4 ô tổng quan: lưới 2×2 như "Hôm nay / Đã lên lịch / Tất cả" */
  .tk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  #workspace .tt-page .tk-tile { grid-template-columns: 1fr auto; grid-template-areas: "ic num" "lb lb"; row-gap: 8px; padding: 12px 14px !important; border-radius: 12px !important; }
  #workspace .tt-page .tk-tile span { display: contents; font-size: 14.5px; color: #6e6e73; }
  #workspace .tt-page .tk-tile span::before { grid-area: ic; width: 30px; height: 30px; background-size: 16px; }
  #workspace .tt-page .tk-tile b { grid-area: num; font-size: 26px; }
  /* Thanh lọc: 1 hàng cuộn ngang, ô tìm rộng hết */
  .tk-bar { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tk-bar::-webkit-scrollbar { display: none; }
  .tk-bar > * { flex: none; }
  .tk-bar .tk-seg:last-child { display: none; }
  .tk-bar input { order: -1; flex: 0 0 calc(100vw - 32px); max-width: none; height: 38px !important; border: 0 !important; background: #e9e9ee !important; }
  .tk-bar { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
  .tk-bar .tk-seg, .tk-bar select { flex: none; }
  /* Danh sách */
  .tk-group { border-radius: 12px; }
  .tk-group h4 { padding: 12px 14px 6px; font-size: 17px; }
  .tk-row { grid-template-columns: 24px minmax(0, 1fr); gap: 10px; padding: 11px 14px; }
  .tk-title { font-size: 15.5px; font-weight: 500; }
  .tk-note { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tk-side { grid-column: 2; justify-content: flex-start; gap: 6px; }
  #workspace .tt-page .tk-check { width: 24px; height: 24px !important; }
  #workspace .tt-page .tk-take { height: 30px !important; padding: 0 14px !important; font-size: 13px !important; }
  /* Chi tiết việc: tấm trượt toàn màn hình */
  dialog.tt-dialog, dialog.tk-rules-dialog { width: 100vw !important; max-width: 100vw !important; height: 100dvh; max-height: 100dvh !important; margin: 0 !important; border-radius: 0 !important; padding: 0 !important; }
  dialog.tt-dialog .tt-detail, dialog.tk-rules-dialog .tk-rules { display: flex; flex-direction: column; height: 100%; }
  dialog.tt-dialog header, dialog.tk-rules-dialog header { position: sticky; top: 0; z-index: 2; padding: calc(10px + env(safe-area-inset-top)) 14px 10px !important; border-bottom: 1px solid #f0f0f3; background: rgba(255, 255, 255, .96); }
  dialog.tt-dialog .tt-d-body { flex: 1; max-height: none; padding: 14px 16px; }
  dialog.tt-dialog .tt-d-side { order: -1; grid-template-columns: 1fr 1fr; }
  dialog.tt-dialog .tt-d-side .tk-assign, dialog.tt-dialog .tt-d-labels { grid-column: 1 / -1; }
  dialog.tt-dialog .tt-d-labels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  dialog.tt-dialog menu, dialog.tk-rules-dialog menu { position: sticky; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)) !important; background: #fff; }
  dialog.tt-dialog menu .primary, dialog.tk-rules-dialog menu .primary { flex: 1; }
  dialog.tk-rules-dialog .tk-rules-list { margin: 0 14px; }
  dialog.tk-rules-dialog .tk-rules-intro { margin: 12px 14px; }
  dialog.tt-dialog input, dialog.tt-dialog select, dialog.tt-dialog textarea { font-size: 16px !important; } /* tránh iPhone tự phóng to khi gõ */
}
/* Vá trên điện thoại: thắng quy tắc nút chung */
#workspace .tt-page .tk-row .tk-check { border-radius: 50% !important; }
@media (max-width: 760px) {
  #workspace .tt-page .tk-acts #ttNew { background: #0071e3 !important; border-color: #0071e3 !important; color: #fff !important; }
  #workspace .tt-page .tk-tile span::before { background-size: 16px; }
}
#workspace .tt-page .tk-group .tk-row .tk-check, #workspace .tt-page .tk-group .tk-row button.tk-check { border-radius: 50% !important; }
@media (max-width: 760px) {
  dialog.tt-dialog .tt-d-body { grid-template-columns: minmax(0, 1fr) !important; overflow-x: hidden; }
  dialog.tt-dialog .tt-d-main, dialog.tt-dialog .tt-d-side, dialog.tt-dialog .tt-d-side > label { min-width: 0; }
  dialog.tt-dialog .tt-d-side :is(select, input) { width: 100% !important; min-width: 0 !important; }
  dialog.tt-dialog .tt-d-labels span { overflow: hidden; padding: 6px 8px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
}
/* Thắng quy tắc nút chung của apple-ui.css (nạp sau, có nhiều :not() nên rất mạnh) */
#workspace#workspace.ws-apple .tt-page button.tk-check { border-radius: 50% !important; }
