/* Task Manager (OpenTodo port): sidebar + content, quick add, task rows, board, editor, focus. */

.tm-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.tm-content { min-width: 0; max-width: 980px; }

/* ------------------------------------------------------------ sidebar */
.tm-sidebar { position: sticky; top: .75rem; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 90px); overflow-y: auto; padding-right: .25rem; }
.tm-add-btn { color: #c92a2a; font-weight: 600; text-align: left; background: transparent; border: 0; padding: .4rem .6rem; }
.tm-add-btn:hover { background: #fff0f0; color: #c92a2a; }
.tm-nav { display: flex; align-items: center; gap: .6rem; padding: .35rem .6rem; border-radius: 8px; color: #23324a; text-decoration: none; font-size: .9rem; min-width: 0; }
.tm-nav:hover { background: #f1f3f5; color: #23324a; }
.tm-nav.active { background: #ffe3e3; color: #a51d1d; font-weight: 600; }
.tm-nav i { width: 1.1rem; text-align: center; flex: 0 0 auto; }
.tm-nav-muted { color: #6b778c; }
.tm-count { margin-left: auto; font-size: .75rem; color: #6b778c; min-width: 1.2rem; text-align: right; }
.tm-count + .tm-count { margin-left: .35rem; }
.tm-count-danger { color: #e03131; font-weight: 700; }
.tm-group-head .tm-count { margin-left: .5rem; }
.tm-side-title { display: flex; align-items: center; margin: 1rem .6rem .25rem; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #6b778c; }
.tm-side-empty { font-size: .8rem; color: #8a94a6; padding: .25rem .6rem; }
.tm-fav { color: #f59f00; font-size: .7rem; }
.tm-running { display: flex; align-items: center; gap: .5rem; margin: .5rem .3rem 0; padding: .4rem .6rem; border-radius: 8px; background: #fff0f6; color: #a61e4d; text-decoration: none; font-size: .82rem; font-weight: 600; min-width: 0; }
.tm-running-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #e64980; animation: tm-pulse 1.2s infinite; flex: 0 0 auto; }
@keyframes tm-pulse { 50% { opacity: .3; } }

/* ------------------------------------------------------------ page */
.tm-page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tm-title { font-size: 1.5rem; font-weight: 700; margin: 0; color: #1f2937; }
.tm-sub { color: #6b778c; font-size: .85rem; margin-top: .15rem; }
.tm-stats { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: #495057; }
.tm-stats i { margin-right: .3rem; }
.tm-status { padding: .45rem .75rem; border-radius: 8px; font-size: .85rem; margin-bottom: .75rem; }
.tm-status.ok { background: #ebfbee; color: #2b8a3e; }
.tm-status.error { background: #fff5f5; color: #c92a2a; }
.tm-panel { border: 1px solid #e9ecef; border-radius: 12px; padding: 1rem; background: #fff; }
.tm-empty { text-align: center; padding: 2rem 1rem; color: #6b778c; }
.tm-empty > i { font-size: 2rem; display: block; margin-bottom: .5rem; color: #adb5bd; }

.tm-group { margin-bottom: 1.25rem; }
.tm-group-head { display: flex; align-items: center; gap: .25rem; font-size: .88rem; font-weight: 700; color: #343a40; padding: .4rem .25rem; border-bottom: 1px solid #e9ecef; margin-bottom: .25rem; min-height: 2.2rem; }
.tm-section-actions { opacity: 0; transition: opacity .15s; }
.tm-group-head:hover .tm-section-actions { opacity: 1; }
.tm-add-section { margin: .5rem 0 2rem; }

/* ------------------------------------------------------------ quick add */
.tm-quickadd { border: 1px solid #dee2e6; border-radius: 10px; padding: .45rem .6rem; margin-bottom: 1rem; background: #fff; transition: border-color .15s, box-shadow .15s; }
.tm-quickadd.focused { border-color: #ff8787; box-shadow: 0 0 0 3px rgba(255, 135, 135, .15); }
.tm-group .tm-quickadd, .tm-editor-section .tm-quickadd { border-style: dashed; margin: .35rem 0 0; }
.tm-quickadd-icon { color: #e03131; }
.tm-quickadd-input { border: 0; box-shadow: none !important; padding-left: 0; }
.tm-quickadd-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .35rem; }
.tm-quickadd-help { font-size: .78rem; color: #6b778c; margin-top: .35rem; }
.tm-quickadd-help code { background: #f1f3f5; color: #495057; padding: 0 .3rem; border-radius: 4px; }
.tm-chip { display: inline-flex; align-items: center; font-size: .75rem; padding: .1rem .5rem; border-radius: 999px; background: #f1f3f5; color: #495057; }
.tm-chip-title { background: transparent; color: #1f2937; font-weight: 600; padding-left: 0; }
.tm-chip-project { background: #e7f5ff; color: #1864ab; }
.tm-chip-label { background: #f3f0ff; color: #5f3dc4; }
.tm-chip-priority { background: #fff5f5; color: #c92a2a; }
.tm-chip-date, .tm-chip-time { background: #ebfbee; color: #2b8a3e; }
.tm-chip-repeat { background: #e6fcf5; color: #087f5b; }
.tm-chip-deadline { background: #fff4e6; color: #d9480f; }
.tm-chip-estimate { background: #f8f0fc; color: #862e9c; }

/* ------------------------------------------------------------ rows */
.tm-row { display: flex; align-items: flex-start; gap: .65rem; padding: .55rem .25rem; border-bottom: 1px solid #f1f3f5; position: relative; }
.tm-row:hover { background: #fafbfc; }
.tm-row.done .tm-row-title { text-decoration: line-through; color: #868e96; }
.tm-check { flex: 0 0 auto; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--tm-p, #adb5bd); background: color-mix(in srgb, var(--tm-p, #adb5bd) 10%, white); display: grid; place-items: center; padding: 0; color: transparent; font-size: .75rem; cursor: pointer; transition: all .12s; }
.tm-check:hover { color: var(--tm-p, #adb5bd); }
.tm-row.done .tm-check { background: var(--tm-p, #adb5bd); color: #fff; }
.tm-check-static { border-color: #ced4da; color: #adb5bd; cursor: default; }
.tm-row-main { flex: 1 1 auto; min-width: 0; cursor: pointer; }
.tm-row-title { font-size: .93rem; color: #1f2937; overflow-wrap: anywhere; }
.tm-row-desc { font-size: .8rem; color: #6b778c; margin-top: .1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .7rem; margin-top: .2rem; font-size: .76rem; color: #6b778c; }
.tm-meta { display: inline-flex; align-items: center; gap: .25rem; white-space: nowrap; }
.tm-overdue { color: #e03131; font-weight: 600; }
.tm-today { color: #2b8a3e; font-weight: 600; }
.tm-tomorrow { color: #e67700; }
.tm-week { color: #7048e8; }
.tm-label { display: inline-flex; align-items: center; gap: .2rem; color: var(--tm-l); font-size: .76rem; white-space: nowrap; }
.tm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.tm-row-actions { display: flex; gap: .15rem; opacity: 0; transition: opacity .12s; }
.tm-row:hover .tm-row-actions { opacity: 1; }
.tm-row-actions .btn { padding: .1rem .35rem; }

/* ------------------------------------------------------------ upcoming */
.tm-days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: .25rem; margin-bottom: 1rem; }
.tm-day { display: flex; flex-direction: column; align-items: center; padding: .35rem 0; border-radius: 8px; text-decoration: none; color: #343a40; border: 1px solid #f1f3f5; }
.tm-day:hover { background: #f8f9fa; }
.tm-day.today { border-color: #ff8787; color: #c92a2a; }
.tm-day.weekend { background: #fafafa; }
.tm-day-name { font-size: .68rem; text-transform: uppercase; color: #868e96; }
.tm-day-num { font-weight: 700; }
.tm-day-count { font-size: .68rem; color: #e03131; min-height: 1em; }

/* ------------------------------------------------------------ board */
.tm-board .e-kanban .e-card { border-radius: 10px; }
.tm-card { padding: .5rem .6rem; }
.tm-card-flag { flex: 0 0 auto; width: 4px; border-radius: 2px; background: var(--tm-p); align-self: stretch; }
.tm-card-title { font-weight: 600; font-size: .88rem; color: #1f2937; }

/* ------------------------------------------------------------ editor */
.tm-editor .e-dlg-content { padding-top: .5rem; }
.tm-editor-crumb { font-size: .85rem; color: #495057; }
.tm-editor-body { display: block; }
.tm-editor-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem .9rem; margin: .5rem 0 .75rem; padding: .75rem; background: #f8f9fa; border-radius: 10px; }
.tm-field { min-width: 0; }
.tm-field-wide { grid-column: span 2; }
.tm-field-full { grid-column: 1 / -1; }
.tm-field .form-label, .tm-editor-label { font-size: .72rem; font-weight: 700; color: #6b778c; text-transform: uppercase; letter-spacing: .03em; margin: 0 0 .15rem; }
.tm-new-label { width: 180px; display: inline-block; }
.tm-editor-title { font-weight: 600; border: 0; padding-left: 0; box-shadow: none !important; }
.tm-editor-section { margin-top: 1rem; }
.tm-editor-section-title { font-size: .82rem; font-weight: 700; color: #495057; margin-bottom: .25rem; }
.tm-priorities { display: grid; grid-template-columns: repeat(4, 1fr); gap: .2rem; }
.tm-priority { border: 1px solid #dee2e6; background: #fff; border-radius: 6px; font-size: .72rem; padding: .2rem 0; color: var(--tm-p); }
.tm-priority.selected { background: var(--tm-p); color: #fff; border-color: var(--tm-p); }
.tm-quickdates { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .25rem; }
.tm-quickdates button { font-size: .72rem; border: 1px solid #dee2e6; background: #fff; border-radius: 999px; padding: .05rem .5rem; color: #495057; }
.tm-quickdates button:hover { border-color: #ff8787; color: #c92a2a; }
.tm-label-picks { display: flex; flex-wrap: wrap; gap: .25rem; }
.tm-label-pick { border: 1px solid color-mix(in srgb, var(--tm-l) 40%, white); background: #fff; border-radius: 999px; padding: .05rem .5rem; }
.tm-label-pick.on { background: color-mix(in srgb, var(--tm-l) 15%, white); font-weight: 600; }
.tm-comment { border-left: 3px solid #e9ecef; padding: .2rem .6rem; margin-bottom: .4rem; }
.tm-comment-meta { font-size: .72rem; color: #868e96; }
.tm-comment-body { font-size: .88rem; white-space: pre-wrap; }
.tm-time { display: flex; gap: .75rem; font-size: .8rem; padding: .15rem 0; border-bottom: 1px dashed #f1f3f5; }

/* ------------------------------------------------------------ projects, labels */
.tm-project-list { display: flex; flex-direction: column; }
.tm-project-row { display: flex; align-items: center; gap: .6rem; padding: .5rem .25rem; border-bottom: 1px solid #f1f3f5; flex-wrap: wrap; }
.tm-project-row.archived { opacity: .6; }
.tm-colors { display: flex; flex-wrap: wrap; gap: .35rem; }
.tm-color { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #dee2e6; padding: 0; }
.tm-color.on { box-shadow: 0 0 0 2px #1f2937; }
.tm-color-sm { width: 16px; height: 16px; }

/* ------------------------------------------------------------ completed chart */
.tm-bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: .3rem; height: 110px; align-items: end; }
.tm-bar { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.tm-bar-fill { background: linear-gradient(180deg, #51cf66, #2f9e44); border-radius: 4px 4px 0 0; min-height: 2px; }
.tm-bar-label { font-size: .65rem; color: #868e96; text-align: center; margin-top: .2rem; }

/* ------------------------------------------------------------ focus */
.tm-pick { display: flex; align-items: center; gap: .5rem; padding: .6rem .5rem; border-bottom: 1px solid #f1f3f5; text-decoration: none; color: #1f2937; }
.tm-pick:hover { background: #fafbfc; }
.tm-focus { text-align: center; padding: 1.5rem 0; }
.tm-focus-task { color: #6b778c; font-size: .85rem; margin-bottom: 1rem; }
.tm-focus-title { font-size: 1.6rem; font-weight: 700; color: #1f2937; margin: .35rem 0; }
.tm-focus-clock { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; width: 260px; height: 260px; border-radius: 50%; border: 10px solid #ffe3e3; background: #fff; }
.tm-focus-clock.break { border-color: #d3f9d8; }
.tm-focus-phase { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: #868e96; }
.tm-focus-time { font-size: 3.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: #1f2937; }
.tm-focus-dots { display: flex; gap: .35rem; margin-top: .25rem; }
.tm-focus-dots span { width: 10px; height: 10px; border-radius: 50%; background: #e9ecef; }
.tm-focus-dots span.on { background: #e03131; }

@media (max-width: 991px) {
    .tm-shell { grid-template-columns: 1fr; }
    .tm-sidebar { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; gap: .25rem; }
    .tm-sidebar .tm-side-title, .tm-sidebar .tm-side-empty { width: 100%; }
    .tm-nav { padding: .3rem .5rem; }
    .tm-editor-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tm-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
    .tm-row-actions { opacity: 1; }
}
