/* Task Management (assets/js/tasks.js) */
.tm { max-width: 1480px; margin: 0 auto; width: 100%; position: relative; }
.tm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.tm-head h1 { margin: 0 0 3px; font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.tm-sub { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.tm-sp { flex: 1; }
.tm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-primary); font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; white-space: nowrap; }
.tm-btn:hover { background: var(--bg-hover); }
.tm-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.tm-btn.primary:hover { background: var(--brand-hover); }
.tm-btn.sm { height: 32px; padding: 0 12px; }
.tm-btn.ghost { border-color: transparent; background: transparent; color: var(--brand-hover); }
.tm-btn.done { background: #dcfce7; border-color: #86efac; color: #15803d; }
.tm-btn:disabled { opacity: .55; cursor: not-allowed; }
.tm-ico { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; border-radius: 8px; color: var(--text-secondary); cursor: pointer; }
.tm-ico:hover { background: var(--bg-hover); color: var(--text-primary); }
.tm-ico.sm { width: 24px; height: 24px; }

.tm-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tm-tabs > button[data-tab] { border: none; background: none; padding: 10px 14px; font: 600 13.5px/1 inherit; font-family: inherit; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 7px; align-items: center; }
.tm-tabs > button[data-tab]:hover { color: var(--text-primary); }
.tm-tabs > button[data-tab].on { color: var(--brand-hover); border-bottom-color: var(--brand); }
.tm-n { min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--bg-active); color: var(--text-secondary); font-size: 11px; text-align: center; }
.tm-n:empty { display: none; }
.tm-tabs > button.on .tm-n { background: var(--brand-soft); color: var(--brand-hover); }
.tm-seg { display: inline-flex; background: var(--bg-active); padding: 3px; border-radius: 9px; gap: 2px; margin: 0 0 6px 8px; }
.tm-seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 7px; font: 600 12px/1 inherit; font-family: inherit; color: var(--text-secondary); cursor: pointer; }
.tm-seg button.on { background: #fff; color: var(--brand-hover); box-shadow: var(--shadow-sm); }

.tm-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.tm-in { height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; font: 400 13px/1.2 inherit; font-family: inherit; color: var(--text-primary); outline: none; min-width: 0; }
textarea.tm-in { height: auto; padding: 8px 10px; resize: vertical; width: 100%; }
.tm-in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.tm-in.sm { height: 34px; }
.tm-filters .tm-in[type=search] { width: 260px; }
.tm-filters [hidden], .tm-quick[hidden] { display: none !important; }

.tm-quick { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 6px 10px; margin-bottom: 12px; }
.tm-quick:focus-within { border-style: solid; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.tm-quick-ic { color: var(--brand); display: inline-flex; }
.tm-quick-in { flex: 1; min-width: 120px; border: none; outline: none; background: transparent; font: 500 14px/1.2 inherit; font-family: inherit; height: 32px; }
.tm-quick .tm-in { border-color: var(--border); }

/* list */
.tm-body { background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tm-body:has(.tm-board) { background: transparent; border: none; overflow: visible; }
.tm-lh, .tm-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 110px 100px 150px 140px; align-items: center; gap: 10px; padding: 0 14px; }
.tm-lh { height: 34px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); background: #f8fafc; border-bottom: 1px solid var(--border); }
.tm-row { min-height: 52px; padding-top: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; outline: none; }
.tm-row:hover, .tm-row:focus-visible { background: #f8fafc; }
.tm-row.done .tm-title { text-decoration: line-through; color: var(--text-muted); }
.tm-main { min-width: 0; }
.tm-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; font-size: 11.5px; color: var(--text-muted); }
.tm-m { display: inline-flex; align-items: center; gap: 3px; }
.tm-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-hover); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-cell { min-width: 0; font-size: 12.5px; }
.tm-cell.who { display: flex; align-items: center; gap: 7px; }
.tm-cell.who span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-chk { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #cbd5e1; background: #fff; color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; flex-shrink: 0; }
.tm-chk:hover { border-color: var(--brand); }
.tm-chk.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.tm-chk.sm { width: 17px; height: 17px; }
.tm-av { width: 24px; height: 24px; border-radius: 50%; background: hsl(var(--h, 170) 55% 88%); color: hsl(var(--h, 170) 60% 28%); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.tm-st { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: #f1f5f9; color: #475569; white-space: nowrap; }
.tm-st.st-doing { background: #dbeafe; color: #1d4ed8; } .tm-st.st-review { background: #fef3c7; color: #b45309; } .tm-st.st-done { background: #dcfce7; color: #15803d; }
.tm-pr { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--c); }
.tm-pr i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tm-due { font-size: 12px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.tm-due.late { color: #dc2626; } .tm-due.today { color: #b45309; }
.tm-label { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: hsl(var(--h, 170) 70% 92%); color: hsl(var(--h, 170) 65% 28%); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-label.fol { background: #f1f5f9; color: var(--text-secondary); max-width: none; padding: 2px 8px 2px 3px; }
.tm-label button, .tm-linkchip button { border: none; background: none; cursor: pointer; color: inherit; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.tm-sec-h { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 14px; border: none; border-bottom: 1px solid var(--border-subtle); background: #fff; cursor: pointer; font: 700 13px/1 inherit; font-family: inherit; color: var(--text-primary); text-align: left; position: sticky; top: 0; }
.tm-sec-h i { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--text-muted); transition: transform .15s; }
.tm-sec.closed .tm-sec-h i { transform: rotate(-90deg); }
.tm-sec.closed .tm-sec-b { display: none; }
.tm-sec-h span { font-weight: 600; color: var(--text-muted); font-size: 12px; }
.tm-sec-h.overdue b { color: #dc2626; } .tm-sec-h.today b { color: #b45309; }
.tm-empty { padding: 48px 20px; text-align: center; color: var(--text-muted); }
.tm-empty h3 { margin: 8px 0 4px; font-size: 15px; color: var(--text-primary); }
.tm-empty p { margin: 0; font-size: 13px; }
.tm-empty-ic { width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-hover); font-size: 22px; display: inline-flex; align-items: center; justify-content: center; }

/* board */
.tm-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; padding-bottom: 8px; }
.tm-col { background: #f1f5f9; border-radius: 12px; padding: 10px; min-height: 160px; transition: background .12s; }
.tm-col.over { background: #dbeafe; outline: 2px dashed #60a5fa; }
.tm-col-h { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; font-size: 13px; }
.tm-col-h span { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.tm-col-h.st-todo b { color: #475569; } .tm-col-h.st-doing b { color: #1d4ed8; } .tm-col-h.st-review b { color: #b45309; } .tm-col-h.st-done b { color: #15803d; }
.tm-col-b { display: flex; flex-direction: column; gap: 8px; }
.tm-col-empty { text-align: center; font-size: 12px; color: var(--text-muted); padding: 22px 8px; border: 1px dashed var(--border-strong); border-radius: 8px; }
.tm-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow-sm); outline: none; }
.tm-card:hover, .tm-card:focus-visible { border-color: var(--brand); }
.tm-card.drag { opacity: .45; }
.tm-card-t { font-size: 13.5px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tm-card-f { display: flex; align-items: center; gap: 8px; margin-top: 9px; font-size: 11.5px; color: var(--text-muted); flex-wrap: wrap; }

/* the task panel */
.tm-ov { position: fixed; inset: 0; background: rgba(15,23,42,.28); z-index: 1800; }
.tm-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 600px; max-width: 100vw; background: #fff; box-shadow: -12px 0 40px rgba(15,23,42,.2); z-index: 1801; display: flex; flex-direction: column; animation: tm-in .16s ease-out; }
@keyframes tm-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.tm-dr-h { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tm-dr-scroll { flex: 1; overflow-y: auto; padding: 16px 20px 28px; }
.tm-dr-title { width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; margin: -6px -8px 12px; font: 700 20px/1.3 inherit; font-family: inherit; resize: none; overflow: hidden; color: var(--text-primary); background: transparent; outline: none; }
.tm-dr-title:hover { border-color: var(--border); } .tm-dr-title:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.tm-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 14px; }
.tm-fields label, .tm-form label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.tm-fields .tm-in, .tm-form .tm-in { text-transform: none; letter-spacing: 0; font-weight: 400; width: 100%; }
.tm-block { margin-top: 16px; }
.tm-bh { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 7px; display: flex; gap: 8px; align-items: baseline; }
.tm-bh small { font-weight: 500; text-transform: none; letter-spacing: 0; }
.tm-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tm-chip-in { height: 26px; border: 1px dashed var(--border-strong); border-radius: 999px; padding: 0 10px; font: 500 12px/1 inherit; font-family: inherit; background: #fff; max-width: 170px; outline: none; }
.tm-chip-in:focus { border-style: solid; border-color: var(--brand); }
.tm-linkchip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-hover); font-size: 13px; cursor: pointer; max-width: 100%; }
.tm-linkchip small { color: var(--text-muted); } .tm-muted { color: var(--text-muted); font-size: 13px; }
.tm-bar { height: 6px; background: #eef2f6; border-radius: 6px; overflow: hidden; margin-bottom: 8px; } .tm-bar i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .2s; }
.tm-subs { list-style: none; margin: 0 0 8px; padding: 0; }
.tm-subs li { display: flex; align-items: center; gap: 9px; padding: 6px 2px; border-bottom: 1px solid var(--border-subtle); font-size: 13.5px; }
.tm-subs li span { flex: 1; min-width: 0; overflow-wrap: anywhere; } .tm-subs li.done span { text-decoration: line-through; color: var(--text-muted); }
.tm-subs li .tm-ico { opacity: 0; } .tm-subs li:hover .tm-ico { opacity: 1; }
.tm-feed { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.tm-feed .cm { display: flex; gap: 10px; align-items: flex-start; }
.tm-feed .cm > div { flex: 1; min-width: 0; background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.tm-feed .who { display: flex; gap: 8px; align-items: baseline; font-size: 13px; } .tm-feed .who small { color: var(--text-muted); font-size: 11.5px; }
.tm-feed .txt { margin-top: 3px; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.tm-feed .ev { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--text-secondary); }
.tm-feed .ev i { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; margin: 6px 10px 0 10px; flex-shrink: 0; }
.tm-feed .ev small { color: var(--text-muted); margin-left: 4px; }
.tm-link-btn { margin-left: auto; border: none; background: none; color: var(--text-muted); font-size: 11.5px; cursor: pointer; } .tm-link-btn:hover { color: #dc2626; }
.tm-cmbox { display: flex; gap: 10px; align-items: flex-start; } .tm-cmbox textarea { flex: 1; }
.tm-foot { margin-top: 18px; font-size: 11.5px; color: var(--text-muted); }
.tm-form { display: flex; flex-direction: column; gap: 12px; } .tm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 1100px) { .tm-lh, .tm-row { grid-template-columns: 34px minmax(0, 1fr) 100px 120px; } .tm-lh span:nth-child(3), .tm-lh span:nth-child(4), .tm-row .st, .tm-row .pr { display: none; } }
@media (max-width: 700px) { .tm-lh { display: none; } .tm-row { grid-template-columns: 34px minmax(0, 1fr); } .tm-row .who, .tm-row .due { display: none; } .tm-fields, .tm-form-row { grid-template-columns: 1fr; } .tm-filters .tm-in[type=search] { width: 100%; } }
