/* Tasks: rows, groups, drawer, board, calendar, timeline, matrix, insights, quick add, pickers. */

/* --- Task rows --------------------------------------------------------------------------- */
.task-list { display: flex; flex-direction: column; gap: 18px; padding-top: 4px; }
.task-group-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px 6px 0; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.task-group-head h3 { font-size: 14px; }
.task-group-head.tone-bad h3 { color: var(--bad); }
.task-group-head.drop-into { background: var(--accent-soft); border-radius: var(--r); }
.collapse-btn { margin-left: -6px; }
.task-group-list { list-style: none; margin: 0; padding: 0; }
.task-group-list.drop-into { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: var(--r); min-height: 36px; }

.task-row {
  position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 9px 8px 9px 6px; border-bottom: 1px solid var(--border);
  cursor: pointer; border-radius: var(--r-sm); transition: background .1s;
}
.task-row:hover { background: var(--surface-2); }
.task-row.focused { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--accent); }
.task-row.selected { background: var(--accent-soft); }
.task-row.is-saving .task-title::after { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-left: 8px; vertical-align: middle; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.task-row.dragging { opacity: .35; }
.task-row.drop-before::before, .task-row.drop-after::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); border-radius: 2px; }
.task-row.drop-before::before { top: -1px; }
.task-row.drop-after::after { bottom: -1px; }
.drag-handle { color: var(--muted); opacity: 0; cursor: grab; margin: 2px -6px 0 -2px; flex: none; }
.task-row:hover .drag-handle, .cl-item:hover .drag-handle { opacity: .8; }

.task-check {
  width: 20px; height: 20px; min-width: 20px; padding: 0; border-radius: 50%; border: 1.75px solid var(--border-strong); background: transparent;
  display: grid; place-items: center; color: transparent; margin-top: 1px; transition: background .15s, border-color .15s, color .15s, transform .15s;
}
.task-check .icon { width: 12px; height: 12px; stroke-width: 3; }
.task-check:hover { color: var(--muted); background: var(--surface-3); }
.task-check.p-urgent { border-color: var(--p-urgent); background: color-mix(in srgb, var(--p-urgent) 10%, transparent); }
.task-check.p-high { border-color: var(--p-high); background: color-mix(in srgb, var(--p-high) 10%, transparent); }
.task-check.p-medium { border-color: var(--p-medium); background: color-mix(in srgb, var(--p-medium) 10%, transparent); }
.task-check.p-low { border-color: var(--p-low); }
.task-check.done { background: var(--ok); border-color: var(--ok); color: #fff; animation: pop .25s var(--ease); }
.task-check.big { width: 24px; height: 24px; min-width: 24px; margin-top: 6px; }
.task-check.ghosted { border-style: dashed; pointer-events: none; }
@keyframes pop { 40% { transform: scale(1.18); } }
.task-main { flex: 1; min-width: 0; }
.task-title { overflow-wrap: anywhere; line-height: 1.4; }
.task-row.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.task-snippet { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; font-size: 12px; color: var(--text-2); }
.task-meta .icon { width: 12px; height: 12px; }
.meta-i { display: inline-flex; align-items: center; gap: 3px; }
.meta-i.ok { color: var(--ok); }
.meta-i.warn { color: var(--warn); }
.due { display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.due.tone-overdue { color: var(--bad); }
.due.tone-today { color: var(--ok); }
.due.tone-tomorrow { color: var(--warn); }
.due.tone-soon { color: var(--c-violet); }
.due.tone-later, .due.tone-done { color: var(--text-2); }
.label-chip { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  color: var(--lc, var(--c-gray)); background: color-mix(in srgb, var(--lc, var(--c-gray)) 13%, transparent); text-decoration: none !important; }
.label-chip::before { content: "@"; opacity: .6; }
.label-chip .chip-x { height: 16px; width: 16px; padding: 0; border: 0; background: transparent; color: inherit; margin-right: -4px; }
.label-chip[data-color="red"] { --lc: var(--c-red); } .label-chip[data-color="orange"] { --lc: var(--c-orange); } .label-chip[data-color="amber"] { --lc: var(--c-amber); }
.label-chip[data-color="green"] { --lc: var(--c-green); } .label-chip[data-color="teal"] { --lc: var(--c-teal); } .label-chip[data-color="cyan"] { --lc: var(--c-cyan); }
.label-chip[data-color="blue"] { --lc: var(--c-blue); } .label-chip[data-color="indigo"] { --lc: var(--c-indigo); } .label-chip[data-color="violet"] { --lc: var(--c-violet); }
.label-chip[data-color="pink"] { --lc: var(--c-pink); } .label-chip[data-color="brown"] { --lc: var(--c-brown); } .label-chip[data-color="gray"] { --lc: var(--c-gray); }
.proj-chip { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.proj-chip:hover { color: var(--text); text-decoration: none; }
.proj-dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }
.proj-dot.lg { width: 14px; height: 14px; border-radius: 4px; }
.task-actions { display: flex; gap: 0; opacity: 0; transition: opacity .1s; margin: -3px -4px -3px 0; }
.task-row:hover .task-actions, .task-row.focused .task-actions, .task-row:focus-within .task-actions { opacity: 1; }
.add-task-btn { border: 0; background: transparent; color: var(--muted); justify-content: flex-start; height: 34px; padding: 0 6px; width: 100%; font-weight: 400; }
.add-task-btn:hover { color: var(--accent-text); background: transparent; }
.add-task-btn .icon { color: var(--accent); }
.task-composer { padding: 8px 6px; border: 1px solid var(--border-strong); border-radius: var(--r-lg); margin-top: 6px; background: var(--surface); box-shadow: var(--shadow-1); }
.task-composer input { border: 0; height: 28px; padding: 0; }
.task-composer input:focus { box-shadow: none; }
.qa-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.task-composer .qa-chips:not(:empty) { margin: 6px 0 0 30px; }
.show-done { align-self: flex-start; color: var(--muted); }
.add-section { margin-top: 18px; color: var(--muted); }
.section-title { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); margin: 22px 0 10px; text-transform: none; }
.project-desc { margin: 0 0 12px; }

/* Bulk bar */
.bulk-bar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 10px 8px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-3); animation: toast-in .2s var(--ease);
  max-width: calc(100vw - 24px);
}
.bulk-bar strong { margin-right: 6px; font-size: 13px; }

/* Today */
.today-hero { display: flex; align-items: center; gap: 20px; padding: 14px 0 18px; }
.today-hero .hello { font-size: 24px; margin-bottom: 2px; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.today-page { max-width: 1240px; }
.today-rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.rail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px 12px 10px; }
.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.rail-head h3 { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-item { min-width: 0; width: 100%; justify-content: flex-start; border: 0; background: transparent; height: 32px; padding: 0 6px; font-weight: 400; gap: 8px; border-radius: var(--r-sm); }
.mini-item:hover { background: var(--surface-2); }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; }
.mini-dot.p-urgent { border-color: var(--p-urgent); } .mini-dot.p-high { border-color: var(--p-high); } .mini-dot.p-medium { border-color: var(--p-medium); }
.mini-notes { display: grid; gap: 8px; }
.mini-note { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: 8px 10px; text-align: left; font-weight: 400; background: var(--n-c, var(--surface-2)); border-color: var(--n-cb, var(--border)); white-space: normal; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ring { position: relative; width: 72px; height: 72px; flex: none; }
.ring-svg svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 3.4; }
.ring-fg { fill: none; stroke: var(--ok); stroke-width: 3.4; stroke-linecap: round; transition: stroke-dasharray .5s var(--ease); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.ring-label small { font-size: 10px; color: var(--muted); }
@media (max-width: 1100px) { .today-grid { grid-template-columns: minmax(0, 1fr); } .today-rail { position: static; } }
.today-main, .today-rail, .rail-card { min-width: 0; }

/* --- Task drawer --------------------------------------------------------------------------- */
.td-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px 14px; border-bottom: 1px solid var(--border); }
.td-crumb { max-width: 70%; justify-content: flex-start; }
.td-body { flex: 1; overflow: auto; padding: 14px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.td-title-row { display: flex; gap: 12px; align-items: flex-start; }
.td-check-slot { flex: none; display: flex; width: 24px; }
.td-title { font: 600 19px/1.35 var(--font-display); resize: none; overflow: hidden; padding: 4px 0; min-height: 34px; }
.td-title.done { text-decoration: line-through; color: var(--muted); }
.td-props { display: grid; gap: 2px; }
.td-prop { display: grid; grid-template-columns: 110px 1fr; align-items: center; min-height: 34px; }
.td-prop-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.td-prop-value { justify-content: flex-start; border-color: transparent; background: transparent; font-weight: 400; height: auto; min-height: 30px; padding: 4px 8px; white-space: normal; text-align: left; }
.td-prop-value:hover { background: var(--surface-2); border-color: var(--border); }
.td-prop-value.empty { color: var(--muted); }
.td-section-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.td-section-head h3 { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.td-notes { min-height: 120px; }
.td-md { cursor: text; padding: 8px 10px; border-radius: var(--r); border: 1px solid transparent; }
.td-md:hover { border-color: var(--border); }
.td-foot { padding: 8px 20px 12px; border-top: 1px solid var(--border); }
.heard summary { cursor: pointer; display: inline-flex; gap: 6px; align-items: center; color: var(--text-2); font-size: 13px; }
.heard-text { margin-top: 8px; padding: 10px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--r) var(--r) 0; font-style: italic; white-space: pre-wrap; }
.conflict-banner { background: var(--warn-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--r-lg); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.cl-list { list-style: none; margin: 0; padding: 0; }
.cl-item { display: flex; align-items: center; gap: 8px; padding: 2px 0; border-radius: var(--r-sm); position: relative; }
.cl-item.done .cl-text { color: var(--muted); text-decoration: line-through; }
.cl-item .icon-btn { opacity: 0; }
.cl-item:hover .icon-btn, .cl-item:focus-within .icon-btn { opacity: 1; }
.cl-item.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.cl-text { height: 28px; }
.cl-add { color: var(--muted); padding-left: 22px; }
.cl-add input { height: 30px; }
.progress + .cl-list { margin-top: 6px; }

/* --- Quick add dialog ---------------------------------------------------------------------- */
dialog.quickadd { width: min(620px, calc(100vw - 24px)); margin-top: 14vh; }
.qa-form { padding: 16px 18px 0; display: flex; flex-direction: column; gap: 10px; }
.qa-top { display: flex; gap: 10px; align-items: center; }
.qa-input { font-size: 17px; height: 32px; }
.qa-details { resize: none; font-size: 13.5px; }
.chip-btn { height: 28px; border-radius: var(--r); font-weight: 400; color: var(--text-2); border-color: var(--border); gap: 5px; }
.chip-btn.sm { height: 26px; font-size: 12.5px; padding: 0 9px; }
.chip-btn.set { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.qa-foot { padding: 12px 0 16px; border-top: 1px solid var(--border); margin-top: 4px; }
.qa-foot p { max-width: 300px; }

/* --- Date picker --------------------------------------------------------------------------- */
.dp-pop { width: 280px; }
.dp-head { display: flex; align-items: center; gap: 2px; padding: 4px 4px 6px 8px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 0 4px; }
.dp-wd { font-size: 11px; color: var(--muted); text-align: center; padding: 2px 0; }
.dp-day { height: 32px; padding: 0; border: 0; background: transparent; font-weight: 400; border-radius: 50%; font-variant-numeric: tabular-nums; }
.dp-day.out { color: var(--muted); }
.dp-day.past { opacity: .6; }
.dp-day.today { color: var(--accent-text); font-weight: 700; }
.dp-day.sel { background: var(--accent); color: var(--accent-fg); opacity: 1; }
.dp-time { padding: 8px 6px 4px; }
.dp-time input { height: 30px; }

/* --- Board ------------------------------------------------------------------------------------ */
.project-host.view-board, .project-host.view-calendar, .project-host.view-timeline { height: 100%; }
.board { display: flex; gap: 14px; align-items: flex-start; height: 100%; overflow-x: auto; padding: 8px 24px 24px; }
.board-col { flex: 0 0 290px; max-height: 100%; display: flex; flex-direction: column; background: var(--surface-2); border-radius: var(--r-lg); padding: 8px; border: 1px solid transparent; }
.board-col.drop-col { border-color: var(--accent); background: var(--accent-soft); }
.board-col-head { display: flex; align-items: center; gap: 6px; padding: 2px 4px 8px 6px; }
.board-col-head h3 { font-size: 13.5px; }
.board-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 30px; padding: 2px; }
.board-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 10px; box-shadow: var(--shadow-1); cursor: grab; display: flex; flex-direction: column; gap: 6px; border-left: 3px solid transparent; transition: box-shadow .12s, transform .12s; }
.board-card:hover { box-shadow: var(--shadow-2); }
.board-card.p-urgent { border-left-color: var(--p-urgent); } .board-card.p-high { border-left-color: var(--p-high); } .board-card.p-medium { border-left-color: var(--p-medium); }
.board-card.is-done .board-title { color: var(--muted); text-decoration: line-through; }
.board-card.dragging { opacity: .4; }
.board-card.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.board-card .card-more { opacity: 0; margin: -4px -4px 0 0; }
.board-card:hover .card-more { opacity: 1; }
.board-title { line-height: 1.35; overflow-wrap: anywhere; }
.board-snippet { font-size: 12.5px; color: var(--text-2); }
.board-card .task-meta { margin-top: 0; }
.board-composer { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r); padding: 6px; margin-top: 8px; }
.board-input { border: 0; resize: none; padding: 4px; }
.board-input:focus { box-shadow: none; }
.add-col { background: transparent; border: 1px dashed var(--border-strong); gap: 6px; align-items: stretch; }

/* --- Calendar --------------------------------------------------------------------------------- */
.calendar { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 24px 10px; flex-wrap: wrap; }
.cal-title { font-size: 17px; margin-left: 6px; }
.cal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr; gap: 14px; padding: 0 24px 16px; }
.cal-body.with-tray { grid-template-columns: 1fr 250px; }
.cal-month-wrap { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.cal-head-row { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-wd { font-size: 12px; color: var(--muted); padding: 6px 8px; font-weight: 600; }
.cal-month { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(104px, 1fr); overflow: auto; }
.cal-cell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: cell; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.weekend { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.cal-cell.out .cal-num { color: var(--muted); }
.cal-cell.drop-into, .cal-slot.drop-into, .cal-allday-cell.drop-into { background: var(--accent-soft); }
.cal-date { display: flex; justify-content: space-between; align-items: center; padding: 0 2px; }
.cal-num { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-cell.today .cal-num, .cal-week-day.today .cal-num { background: var(--accent); color: var(--accent-fg); }
.cal-cell-items { display: flex; flex-direction: column; gap: 2px; min-height: 0; flex: 1; }
.cal-chip {
  display: flex; align-items: center; gap: 5px; height: 22px; padding: 0 6px; border: 0; border-radius: 5px; font-size: 12px; font-weight: 500; width: 100%;
  background: color-mix(in srgb, var(--pc, var(--accent)) 14%, var(--surface)); color: var(--text); justify-content: flex-start; cursor: grab; min-width: 0;
}
.cal-chip:hover { background: color-mix(in srgb, var(--pc, var(--accent)) 24%, var(--surface)); }
.cal-chip.p-urgent { --pc: var(--p-urgent); } .cal-chip.p-high { --pc: var(--p-high); } .cal-chip.p-medium { --pc: var(--p-medium); } .cal-chip.p-low, .cal-chip.p-none { --pc: var(--c-gray); }
.cal-chip.done { opacity: .55; text-decoration: line-through; }
.cal-chip.note { --pc: var(--c-amber); cursor: pointer; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--pc, var(--accent)); flex: none; }
.cal-time { color: var(--text-2); font-variant-numeric: tabular-nums; flex: none; }
.cal-more { border: 0; background: transparent; height: 20px; font-size: 11.5px; color: var(--text-2); justify-content: flex-start; padding: 0 6px; }
.cal-tray { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.cal-tray h3 { font-size: 13px; }
.cal-tray-list { overflow: auto; display: flex; flex-direction: column; gap: 4px; }
.cal-week { display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.cal-week-head, .cal-allday { display: grid; grid-template-columns: 56px repeat(7, 1fr); border-bottom: 1px solid var(--border); }
.cal-week-day { display: flex; flex-direction: column; align-items: center; padding: 6px 0; }
.cal-gutter { padding: 4px; }
.cal-allday-cell { border-left: 1px solid var(--border); padding: 3px; display: flex; flex-direction: column; gap: 2px; min-height: 30px; }
.cal-week-scroll { flex: 1; overflow: auto; min-height: 0; }
.cal-week-body { display: grid; grid-template-columns: 56px repeat(7, 1fr); position: relative; }
.cal-hour-label { height: 48px; font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.cal-day-col { position: relative; border-left: 1px solid var(--border); }
.cal-day-col.today { background: color-mix(in srgb, var(--accent-soft) 35%, transparent); }
.cal-slot { height: 24px; border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent); cursor: cell; }
.cal-slot.half { border-bottom-color: var(--border); }
.cal-event { position: absolute; left: 3px; right: 3px; height: auto; align-items: flex-start; padding-top: 3px; overflow: hidden; z-index: 1; box-shadow: var(--shadow-1); }
.cal-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
@media (max-width: 900px) { .cal-body.with-tray { grid-template-columns: 1fr; } .cal-month { grid-auto-rows: minmax(76px, 1fr); } }

/* --- Timeline ------------------------------------------------------------------------------ */
.timeline { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.tl-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px 1fr; margin: 0 24px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); }
.tl-labels { overflow: hidden; border-right: 1px solid var(--border); }
.tl-labels-head { height: 52px; display: flex; align-items: flex-end; padding: 0 12px 8px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); font-size: 12.5px; }
.tl-group { display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface-2); font-size: 12.5px; }
.tl-label { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; border-radius: 0; background: transparent; justify-content: flex-start; font-weight: 400; padding: 0 12px 0 20px; }
.tl-label:hover { background: var(--surface-2); }
.tl-label.done { color: var(--muted); text-decoration: line-through; }
.tl-scroll { overflow: auto; position: relative; }
.tl-head { position: sticky; top: 0; z-index: 3; background: var(--surface); border-bottom: 1px solid var(--border); }
.tl-months { position: relative; height: 26px; }
/* overflow: clip (not hidden) so the segment doesn't become the sticky label's scroll container */
.tl-month { position: absolute; top: 0; bottom: 0; box-sizing: border-box; padding-top: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; border-left: 1px solid var(--border); overflow: clip; }
.tl-month-text { position: sticky; left: 0; display: inline-block; max-width: 100%; box-sizing: border-box; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.tl-ticks { position: relative; height: 26px; }
.tl-tick { position: absolute; top: 0; height: 26px; font-size: 11px; color: var(--muted); display: grid; place-items: center; border-left: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
.tl-tick.today { color: var(--accent-fg); background: var(--accent); border-radius: 4px; font-weight: 700; }
.tl-canvas { position: relative; }
.tl-weekend { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); opacity: .7; z-index: 1; }
.tl-group-band { position: absolute; left: 0; right: 0; background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
.tl-bar {
  position: absolute; border-radius: 6px; background: color-mix(in srgb, var(--pc, var(--accent)) 22%, var(--surface)); border: 1px solid color-mix(in srgb, var(--pc, var(--accent)) 55%, transparent);
  cursor: grab; overflow: hidden; display: flex; align-items: center; z-index: 2; touch-action: none; user-select: none;
}
.tl-bar.p-urgent { --pc: var(--p-urgent); } .tl-bar.p-high { --pc: var(--p-high); } .tl-bar.p-medium { --pc: var(--p-medium); } .tl-bar.p-low, .tl-bar.p-none { --pc: var(--accent); }
.tl-bar.done { opacity: .5; }
.tl-bar.late { border-style: dashed; border-color: var(--bad); }
.tl-bar.dragging { box-shadow: var(--shadow-2); cursor: grabbing; z-index: 4; }
.tl-bar.milestone { border-radius: 50px; }
.tl-fill { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--pc, var(--accent)) 30%, transparent); }
.tl-bar-text { position: relative; font-size: 12px; padding: 0 8px; font-weight: 500; }
.tl-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; }
.tl-handle.left { left: 0; } .tl-handle.right { right: 0; }
.tl-links { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 1; }
.tl-link { fill: none; stroke: var(--text-2); stroke-width: 1.4; opacity: .7; }
.tl-arrow { fill: none; stroke: var(--text-2); stroke-width: 1.4; opacity: .7; }
.tl-link.bad, .tl-arrow.bad { stroke: var(--bad); opacity: 1; }

/* --- Matrix -------------------------------------------------------------------------------- */
.matrix { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding-top: 8px; }
.quad { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; min-height: 240px; border-top: 3px solid var(--qc); }
.quad header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; color: var(--qc); }
.quad header h3 { color: var(--text); }
.quad-do { --qc: var(--p-urgent); } .quad-plan { --qc: var(--p-medium); } .quad-quick { --qc: var(--p-high); } .quad-later { --qc: var(--c-gray); }
.quad.drop-into { background: var(--accent-soft); }
.quad-empty { padding: 30px 0; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--r); }
@media (max-width: 900px) { .matrix { grid-template-columns: 1fr; } }

/* --- Insights ------------------------------------------------------------------------------ */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi-label { font-size: 12px; color: var(--text-2); }
.kpi-value { font: 700 24px/1.2 var(--font-display); }
.kpi-sub { font-size: 12px; color: var(--muted); }
.kpi.good .kpi-sub { color: var(--ok); } .kpi.warn .kpi-sub { color: var(--bad); }
.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.insight { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.insight.wide { grid-column: 1 / -1; }
.insight h3 { font-size: 14px; }
.chart .legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.chart .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.bars { display: flex; align-items: stretch; gap: 6px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.bar-stack { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.bar { width: 42%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 1px 1px; transition: height .4s var(--ease); }
.bar-label { font-size: 11px; color: var(--muted); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 10px; font-size: 13px; }
.hbar-label { display: flex; align-items: center; gap: 6px; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 6px; }
.hbar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut svg { width: 130px; height: 130px; transform: rotate(-90deg); display: block; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.heatmap { display: flex; gap: 3px; overflow-x: auto; }
.hm-col { display: flex; flex-direction: column; gap: 3px; }
.hm { display: block; width: 13px; height: 13px; border-radius: 3px; background: var(--surface-3); }
.hm.l-1 { background: transparent; }
.hm.l1 { background: color-mix(in srgb, var(--ok) 30%, var(--surface-3)); } .hm.l2 { background: color-mix(in srgb, var(--ok) 55%, var(--surface-3)); }
.hm.l3 { background: color-mix(in srgb, var(--ok) 78%, var(--surface-3)); } .hm.l4 { background: var(--ok); }
.hm-legend { display: flex; align-items: center; gap: 4px; }
.hm-legend .hm { width: 11px; height: 11px; }
@media (max-width: 900px) { .insight-grid { grid-template-columns: 1fr; } }

/* Shortcut sheet */
dialog.wide-dialog { width: min(860px, calc(100vw - 24px)); }
.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; overflow: auto; max-height: 70vh; }
.shortcuts dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 8px 0 0; font-size: 13px; align-items: center; }
.shortcuts dt { white-space: nowrap; }
.shortcuts dd { margin: 0; color: var(--text-2); }
.shortcuts kbd { margin-right: 2px; }

@media (max-width: 700px) { .hide-narrow { display: none; } .task-actions { opacity: 1; } .drawer { width: 100%; } }
