/* Tasks page views (list / planning / statistics). Namespace: tv- */
.tv-mode { margin-right: 8px; }
.tv-muted { color: var(--text-secondary, #aeb4be); font-size: 13px; margin: 0; }
.tv-hint { color: var(--text-secondary, #aeb4be); font-size: 13px; margin: 0 0 12px; }
.tv-empty { color: var(--text-secondary, #aeb4be); padding: 32px 8px; text-align: center; }
.tv-error { color: var(--state-danger, #d95c5c); font-size: 13px; margin: 0; min-height: 1em; }
.tv-danger { color: var(--state-danger, #d95c5c); }
.tv-icon-btn { border: 0; background: none; color: var(--text-secondary, #aeb4be); cursor: pointer; font-size: 15px; padding: 4px 8px; border-radius: 6px; }
.tv-icon-btn:hover { background: #ffffff14; color: #fff; }
.tv-input { width: 100%; background: var(--bg-1, #111315); color: inherit; border: 1px solid var(--line, #22262d); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 14px; }
.tv-input:focus { outline: 2px solid #6d8cff; outline-offset: -1px; }
.tv-input--wide { flex: 1 1 260px; }

/* ---- list ---- */
.tv-list { display: flex; flex-direction: column; gap: 2px; }
.tv-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2, #141414); border: 1px solid transparent; transition: background .15s, border-color .15s, opacity .15s, transform .15s; }
.tv-row:hover { background: var(--bg-4, #1b1d21); }
.tv-row.is-done .tv-row__title { text-decoration: line-through; opacity: .55; }
.tv-row.drop-before::before, .tv-row.drop-after::after { content: ""; position: absolute; left: 8px; right: 8px; height: 3px; border-radius: 3px; background: #6d8cff; box-shadow: 0 0 10px #6d8cffaa; }
.tv-row.drop-before::before { top: -3px; }
.tv-row.drop-after::after { bottom: -3px; }
.tv-row.is-moved { animation: tv-flash .9s ease-out; }
@keyframes tv-flash { 0% { background: #6d8cff44; transform: translateY(-4px); } 100% { background: var(--bg-2, #141414); transform: none; } }
.tv-row { padding-left: 4px; cursor: default; user-select: none; }
.tv-row__grip { align-self: stretch; width: 48px; flex: none; margin: -12px 0 -12px -4px; border: 0; border-radius: 12px 0 0 12px; background: transparent; color: var(--text-secondary, #aeb4be); font: inherit; font-size: 20px; letter-spacing: -4px; cursor: grab; touch-action: none; display: grid; place-items: center; transition: background .15s, color .15s; }
.tv-row__grip:hover { background: #ffffff10; color: #fff; }
.tv-row.is-dragging { cursor: grabbing; position: relative; z-index: 5; box-shadow: 0 10px 28px #000a; opacity: .95; transition: none; }
.tv-row.is-dragging .tv-row__grip { cursor: grabbing; background: #6d8cff33; color: #fff; }
.tv-row__main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.tv-row__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tv-row__main .priority-badge { flex: none; }
.tv-row__meta { display: flex; gap: 6px; flex-wrap: wrap; }
.tv-row__meta:empty { display: none; }
.tv-row__time { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tv-row__track { display: flex; align-items: center; gap: 8px; min-width: 44px; justify-content: flex-end; }
.tv-row__live { position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: #3fb97f; }
.tv-timer { font-variant-numeric: tabular-nums; color: #3fb97f; font-weight: 600; }
.tv-play { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-strong, #2a2f37); background: var(--bg-5, #20242b); color: #fff; cursor: pointer; display: inline-grid; place-items: center; }
.tv-play:hover { border-color: #6d8cff; }
.tv-play.is-running { background: #3fb97f; border-color: #3fb97f; color: #0a0a0a; }
.tv-check { width: 22px; height: 22px; flex: none; border-radius: 6px; border: 1.5px solid var(--text-secondary, #aeb4be); background: none; color: #0a0a0a; cursor: pointer; display: inline-grid; place-items: center; padding: 0; font-size: 14px; line-height: 1; }
.tv-check.is-on { background: #3fb97f; border-color: #3fb97f; }
.tv-actions { margin-top: 16px; }
.tv-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid var(--line, #22262d); border-radius: 12px; }
.tv-form .tv-input { width: auto; flex: 0 1 auto; }

/* ---- modal ---- */
.tv-modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.tv-modal__scrim { position: absolute; inset: 0; border: 0; background: #000a; cursor: default; }
.tv-modal__card { position: relative; width: 100%; max-width: 420px; background: var(--bg-2, #141414); border: 1px solid var(--line, #22262d); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.tv-modal__card h3 { margin: 0; font-size: 17px; }
.tv-modal__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tv-row2 { display: flex; gap: 8px; }
.tv-field { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary, #aeb4be); }

/* ---- list: scroll horizontally instead of squeezing the row ---- */
.tv-list-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tv-list-scroll .tv-list { min-width: 620px; }
.tv-clickable { cursor: pointer; }

/* ---- time grid (planning + statistics) ---- */
.tv-tgrid-scroll { isolation: isolate; overflow-x: auto; border: 1px solid var(--line, #22262d); border-radius: 12px; background: var(--bg-1, #111315); -webkit-overflow-scrolling: touch; }
.tv-tgrid { position: relative; user-select: none; }
.tv-tgrid__head { display: grid; border-bottom: 1px solid var(--line, #22262d); position: sticky; top: 0; z-index: 6; background: var(--bg-1, #111315); }
.tv-tgrid__day { border: 0; background: none; color: inherit; font: inherit; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer; border-left: 1px solid var(--line, #22262d); }
.tv-tgrid__day span { color: var(--text-secondary, #aeb4be); font-size: 12px; }
.tv-tgrid__day.is-today b { color: #6d8cff; }
.tv-tgrid__day:hover { background: #ffffff0d; }
.tv-tgrid__body { display: grid; grid-template-columns: 56px 1fr; }
.tv-tgrid__hours { position: sticky; left: 0; z-index: 5; background: var(--bg-1, #111315); }
.tv-tgrid__hour { border-top: 1px solid var(--line, #22262d); font-size: 11px; color: var(--text-muted, #717171); padding: 2px 6px; box-sizing: border-box; }
.tv-tgrid__hour:first-child { border-top: 0; }
.tv-tgrid__lanes { position: relative; }
.tv-tgrid__bg { position: absolute; inset: 0; display: grid; }
.tv-tgrid__lane { position: relative; border-left: 1px solid var(--line, #22262d); }
.tv-tgrid__lane.is-today { background: #6d8cff0d; }
.is-edit .tv-tgrid__lane { cursor: cell; }
.tv-tgrid__line { position: absolute; left: 0; right: 0; height: 1px; background: var(--line, #22262d); pointer-events: none; }
.tv-tgrid__blocks { position: absolute; inset: 0; pointer-events: none; }
.tv-tgrid .tv-block { position: absolute; right: auto; box-sizing: border-box; overflow: hidden; border-radius: 8px; padding: 4px 8px; display: flex; flex-direction: column; font-size: 12px; background: #6d8cff33; border: 1px solid #6d8cff88; color: #fff; pointer-events: auto; transition: box-shadow .15s; }
.is-edit .tv-block:hover { box-shadow: 0 0 0 2px #6d8cff66; }
.tv-tgrid .tv-block.is-active { cursor: grabbing; box-shadow: 0 0 0 2px #6d8cff; z-index: 4; opacity: .92; }
.tv-block.is-done .tv-block__title { text-decoration: line-through; opacity: .6; }
.tv-block__title { font-weight: 600; line-height: 1.2; }
.tv-block__time { opacity: .8; }
.tv-block__handle { position: absolute; left: 0; right: 0; height: 10px; cursor: ns-resize; z-index: 2; touch-action: none; }
.tv-block__handle--top { top: 0; }
.tv-block__handle--bottom { bottom: 0; }
.tv-block__handle::after { content: ""; position: absolute; left: 50%; width: 28px; margin-left: -14px; height: 3px; border-radius: 3px; background: #fff; opacity: 0; transition: opacity .15s; }
.tv-block__handle--top::after { top: 2px; }
.tv-block__handle--bottom::after { bottom: 2px; }
.tv-block:hover .tv-block__handle::after { opacity: .6; }
.tv-block__grip { position: absolute; left: 3px; top: 3px; z-index: 3; padding: 3px 6px; font-size: 14px; line-height: 1; letter-spacing: -3px; color: #fff; opacity: .8; cursor: grab; touch-action: none; border-radius: 6px; background: #ffffff14; }
.tv-block__grip:hover { opacity: 1; background: #ffffff33; }
.is-edit .tv-block { padding-left: 30px; }
.is-edit .tv-block { cursor: pointer; }
@media (pointer: coarse) {
  .tv-block__handle { height: 12px; }
  .tv-block__handle::after { opacity: .7; }
  .tv-block__grip { font-size: 18px; padding: 8px 10px; opacity: .85; background: #ffffff1a; }
}
/* statistics: plan pale on the left, facts solid on the right (side by side) */
.tv-block.is-plan { background: #6d8cff22; border-style: dashed; }
.tv-block.is-plan.is-nofact { background: #ffffff0d; border-color: #ffffff44; }
.tv-block--fact { background: #6d8cff !important; border: 1px solid #6d8cff !important; color: #0a0a0a !important; z-index: 2; }
.tv-block--fact.is-live { background: #3fb97f !important; border-color: #3fb97f !important; }
.tv-legend { display: flex; gap: 14px; margin: 0 0 10px; font-size: 12px; color: var(--text-secondary, #aeb4be); }
.tv-legend span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -2px; }
.tv-legend__plan::before { background: #6d8cff33; border: 1px dashed #6d8cff; }
.tv-legend__fact::before { background: #6d8cff; }
.tv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.tv-stat { border: 1px solid var(--line, #22262d); border-radius: 12px; padding: 10px 12px; background: var(--bg-2, #141414); display: flex; flex-direction: column; gap: 2px; }
.tv-stat small { color: var(--text-secondary, #aeb4be); }
.tv-stat b { font-size: 18px; }

/* ---- month: progress rings ---- */
.tv-month { max-width: 560px; margin: 8px auto 0; }
.tv-month__weekdays, .tv-month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px 6px; }
.tv-month__weekdays { margin-bottom: 8px; text-align: center; color: var(--text-muted, #717171); font-size: 12px; }
.tv-day { position: relative; width: 100%; max-width: 64px; aspect-ratio: 1; margin: 0 auto; border: 0; border-radius: 50%; background: none; color: inherit; font: inherit; cursor: pointer; display: grid; place-items: center; transition: transform .15s, background .15s; }
.tv-day:hover { transform: scale(1.06); background: #ffffff0a; }
.tv-day--blank { visibility: hidden; }
.tv-day__ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.tv-day__track { fill: none; stroke: var(--line-strong, #2a2f37); stroke-width: 3; }
.tv-day__fill { fill: none; stroke: #6d8cff; stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.tv-day__fill.is-full { stroke: #3fb97f; }
.tv-day.is-empty .tv-day__track { stroke-dasharray: 1 5; stroke-linecap: round; opacity: .7; }
.tv-day__num { position: relative; font-size: 15px; font-variant-numeric: tabular-nums; }
.tv-day.is-future .tv-day__num { opacity: .5; }
.tv-day.is-today .tv-day__num { font-weight: 700; color: #fff; }
.tv-day.is-today { background: radial-gradient(closest-side, #6d8cff33, transparent 72%); }
.tv-month__legend { margin: 18px 0 0; text-align: center; color: var(--text-muted, #717171); font-size: 12px; }
.tv-month__dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #6d8cff; margin-right: 6px; }
@media (max-width: 800px) { .tv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tv-month__grid { gap: 6px 2px; } }

/* ---- activities page: the day's tasks as a tree with a live «now» line ---- */
.tv-tree, .tv-tree__children { list-style: none; margin: 0; padding: 0; }
.tv-tree__node { margin: 2px 0; }
.tv-tree__row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2, #141414); border: 1px solid transparent; }
.tv-tree__row:hover { background: var(--bg-4, #1b1d21); }
.tv-tree__row.is-running { border-color: #3fb97f66; }
.tv-tree__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tv-tree__main small { color: var(--text-secondary, #aeb4be); }
.tv-tree__children { margin: 2px 0 6px 26px; padding-left: 12px; border-left: 1px dashed var(--line-strong, #2a2f37); }
.tv-tree__act { display: flex; gap: 12px; align-items: baseline; padding: 5px 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.tv-tree__act.is-live { color: #3fb97f; }
.tv-tree__note { color: var(--text-secondary, #aeb4be); overflow-wrap: anywhere; }
.tv-tree__empty { padding: 5px 8px; font-size: 13px; color: var(--text-muted, #717171); }

/* the mode toggle gets its own row in the mobile header grid (main.css puts
   every .segmented-control into the same "tabs" area) */
@media (max-width: 690px) {
  .tasks-header { grid-template-areas: "title date" "mode mode" "tabs tabs"; }
  .tasks-header .tv-mode { grid-area: mode; width: 100%; margin: 0; justify-content: stretch; }
  .tasks-header .tv-mode .segmented-control__item { flex: 1 1 0; text-align: center; padding: 6px 4px; }
}

/* ---- animated segmented control (mode / range / activities panels) ---- */
.segmented-control.tv-seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); padding: 4px; gap: 0; align-items: stretch; }
.tv-seg__thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n)); border-radius: 999px; background: #fff; box-shadow: 0 1px 6px #0006; transition: transform .3s cubic-bezier(.4, .1, .2, 1); pointer-events: none; }
.tv-seg .segmented-control__item { position: relative; z-index: 1; flex: none; text-align: center; background: transparent !important; box-shadow: none !important; padding: 7px 10px; white-space: nowrap; transition: color .25s; }
.tv-seg .segmented-control__item.is-active { color: #111 !important; }
.tasks-header .tv-seg .segmented-control__item { flex: none; padding: 7px 10px; }

.tv-tree__row { position: relative; }
.tv-tree__row.is-current { border-color: #6d8cff88; background: #6d8cff14; }
.tv-tree__act { cursor: pointer; border-radius: 8px; }
.tv-tree__act:hover { background: #ffffff0d; }
.tv-nowline { list-style: none; position: relative; height: 0; margin: 8px 0; border-top: 1px dashed rgba(239, 91, 91, .4); pointer-events: none; }
.tv-nowline > span { position: absolute; left: 6px; top: -8px; background: rgba(239, 91, 91, .16); color: rgba(255, 168, 168, .85); font-size: 10px; font-weight: 500; line-height: 1; padding: 3px 6px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.tv-nowline--inner { position: absolute; left: 0; right: 0; margin: 0; z-index: 2; transition: top 1s linear; }

/* planning: overlapping tasks are not split into columns — the overlap is a danger area */
.tv-overlap-zone { position: absolute; z-index: 6; pointer-events: none; border: 2px solid #ef4444; border-radius: 6px; background: repeating-linear-gradient(135deg, #ef444455 0 6px, #ef444422 6px 12px); box-shadow: 0 0 0 1px #0006 inset; }
.tv-tgrid .tv-block.is-overlap { border-color: #ef4444; box-shadow: 0 0 0 1px #ef4444; }

/* ---- time picker: selects on desktop, scroll wheels on touch screens ---- */
.tv-tp { display: block; }
.tv-tp__selects { display: flex; align-items: center; gap: 6px; }
.tv-tp__selects .tv-input { width: auto; min-width: 64px; }
.tv-tp__wheels { display: none; position: relative; align-items: center; justify-content: center; gap: 4px; background: var(--bg-1, #111315); border: 1px solid var(--line, #22262d); border-radius: 12px; padding: 0 10px; }
.tv-wheel { height: 132px; width: 64px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; touch-action: pan-y; text-align: center; mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.tv-wheel::-webkit-scrollbar { display: none; }
.tv-wheel__pad { height: 44px; }
.tv-wheel__item { height: 44px; line-height: 44px; scroll-snap-align: center; font-size: 20px; font-variant-numeric: tabular-nums; color: var(--text-muted, #717171); transition: color .15s, transform .15s; }
.tv-wheel__item.is-on { color: #fff; font-weight: 600; transform: scale(1.12); }
.tv-tp__wheels b { font-size: 20px; }
.tv-tp__band { position: absolute; left: 6px; right: 6px; top: 44px; height: 44px; border-top: 1px solid #ffffff33; border-bottom: 1px solid #ffffff33; pointer-events: none; border-radius: 8px; background: #ffffff0a; }
@media (pointer: coarse) {
  .tv-tp__selects { display: none; }
  .tv-tp__wheels { display: flex; }
  .tv-row2 { flex-wrap: wrap; }
}

.tv-seg { touch-action: pan-y; }

/* ---- calendar popup: today, selected week, months/years, swipe slide ---- */
.tasks-calendar__day.is-today { box-shadow: inset 0 0 0 1.5px #6d8cff; }
.tasks-calendar__day.is-selected.is-today { box-shadow: inset 0 0 0 1.5px #6d8cff, 0 0 0 2px #0008; }
.tasks-calendar__day.is-in-week { background: #6d8cff2e; border-radius: 0; color: #fff; }
.tasks-calendar__day.is-week-start { border-radius: 10px 0 0 10px; }
.tasks-calendar__day.is-week-end { border-radius: 0 10px 10px 0; }
.tv-cal__swipe { overflow: hidden; touch-action: pan-y; }
.tv-cal__page.is-from-right { animation: tv-cal-from-right .22s ease-out; }
.tv-cal__page.is-from-left { animation: tv-cal-from-left .22s ease-out; }
@keyframes tv-cal-from-right { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes tv-cal-from-left { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
.tv-cal__months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 2px 2px; }
.tv-cal__month { border: 1px solid transparent; background: #ffffff0a; color: inherit; font: inherit; border-radius: 12px; padding: 14px 0; cursor: pointer; text-transform: capitalize; transition: background .15s; }
.tv-cal__month:hover { background: #ffffff18; }
.tv-cal__month.is-today { border-color: #6d8cff; }
.tv-cal__month.is-selected { background: #fff; color: #111; font-weight: 600; }

/* ---- profile chip in the top-right corner ---- */
.planner-content { position: relative; }
.tv-userchip { position: absolute; top: 14px; right: 20px; z-index: 40; }
.tv-userchip__btn { display: flex; align-items: center; gap: 10px; max-width: 320px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line, #22262d); background: var(--bg-2, #141414); color: inherit; font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.tv-userchip__btn:hover, .tv-userchip__btn[aria-expanded="true"] { border-color: #6d8cff88; background: var(--bg-4, #1b1d21); }
.tv-userchip__email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary, #aeb4be); }
.tv-userchip__chev { color: var(--text-muted, #717171); font-size: 11px; }
.tv-userchip__img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.tv-userchip__avatar { width: 32px; height: 32px; flex: none; }
.tv-userchip__scrim { position: fixed; inset: 0; z-index: 41; border: 0; background: transparent; cursor: default; }
.tv-userchip__menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 42; width: 260px; padding: 8px; border-radius: 14px; border: 1px solid var(--line, #22262d); background: var(--bg-2, #141414); box-shadow: 0 16px 40px #000a; display: flex; flex-direction: column; gap: 2px; }
.tv-userchip__head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; border-bottom: 1px solid var(--line, #22262d); margin-bottom: 4px; }
.tv-userchip__who { display: flex; flex-direction: column; min-width: 0; }
.tv-userchip__who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-userchip__who small { color: var(--text-secondary, #aeb4be); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-userchip__item { display: flex; align-items: center; gap: 10px; padding: 10px 10px; border: 0; border-radius: 10px; background: none; color: inherit; font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.tv-userchip__item:hover { background: #ffffff12; }
.tv-userchip__item img { width: 18px; height: 18px; opacity: .8; }
@media (max-width: 690px) {
  .tv-userchip { top: 8px; right: 12px; }
  .tv-userchip__email, .tv-userchip__chev { display: none; }
  .tv-userchip__btn { padding: 3px; }
}
