/* KR (tasks) UI, ported from stage assets/css/vt.css onto this app's tokens.
   Stage mapping: --bg2 → --surface, --bg3 → --surface-2, --border → --line,
   --text-muted → --muted. Tints use color-mix so they work in both themes. */

.vt-muted { color: var(--muted); }
.vt-small { font-size: 12.5px; }
.vt-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.vt-link { color: var(--text); text-decoration: none; }
.vt-link:hover { color: var(--accent); text-decoration: underline; }
.vt-err { color: var(--red); font-size: 13px; margin-top: 8px; }
.vt-back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; text-decoration: none; }
.vt-back:hover { color: var(--accent); }
.vt-caption { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.vt-empty { border: 1px dashed var(--line); border-radius: 10px; padding: 14px 16px; font-size: 13px; color: var(--muted); background: var(--surface-2); max-width: 660px; }
.vt-empty.pad { margin: 16px 20px; }

/* Filters row of the KR list */
.vt-filters { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 0 0 12px; border-bottom: 1px solid var(--line); }
.vt-filters label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.vt-filters select, .vt-filters input { width: auto; min-width: 160px; }
.vt-filters__push { margin-left: auto; }
.vt-arch { display: inline-flex !important; align-items: center; gap: 6px; font-size: 13px !important; color: var(--muted); margin: 0 0 8px !important; cursor: pointer; }
.vt-arch input { min-width: 0 !important; }

/* Dense tables */
.vt-dense-table th, .vt-dense-table td { padding: 8px 10px; }
.vt-krcell { min-width: 280px; }
.vt-indent { display: inline-block; }

/* Status and priority chips */
.vt-status { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.vt-krst--open      { background: color-mix(in srgb, var(--violet) 15%, transparent); color: var(--violet); }
.vt-krst--doing     { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.vt-krst--done      { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.vt-krst--cancelled { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.vt-pri { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.vt-pri--1 { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.vt-pri--2 { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.vt-pri--3 { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.vt-pri--4 { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.vt-pri--5 { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.vt-chipsel { position: relative; cursor: pointer; display: inline-block; }
.vt-chipsel:hover { filter: brightness(1.1); }
.vt-chipsel select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0; min-width: 0; }
.vt-chipsel:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Deadline chip */
.vt-due { font-size: 11px; padding: 2px 7px; border-radius: 6px; display: inline-block; white-space: nowrap; }
.vt-due--wait { background: var(--surface-2); color: var(--muted); }
.vt-due--soon { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); font-weight: 600; }
.vt-due--over { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); font-weight: 600; }
.vt-due--none { background: var(--surface-2); color: var(--muted); border: 1px dashed var(--line); }
.vt-due--edit { position: relative; cursor: pointer; font-size: 12px; font-weight: 600; padding: 4px 9px; }
.vt-due--edit:hover { filter: brightness(1.08); }
.vt-due--edit:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Tree: caret button and level badge, like Jira */
.vt-krbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 20px; padding: 0 6px; border-radius: 6px; margin-right: 8px;
  vertical-align: middle; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.vt-krbadge--0 { background: color-mix(in srgb, var(--violet) 18%, transparent); color: var(--violet); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--violet) 35%, transparent); }
.vt-krbadge--1 { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.vt-krbadge--2 { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--muted) 30%, transparent); }
.vt-krlegend { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; flex-wrap: wrap; }
.vt-krlegend .vt-krbadge { margin: 0 2px 0 8px; }

/* Progress bars and pace chips */

/* ── KR card: panels ───────────────────────────────────────────────── */
.vt-krcard { display: flex; flex-direction: column; gap: 16px; max-width: 1180px; margin-top: 12px; }
.vt-krcard > .vt-section { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px 20px; }
.vt-section__title { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 14px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vt-section__title .vt-muted { font-weight: 400; }
.vt-section__note { text-transform: none; letter-spacing: 0; }
.vt-section__title .vt-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; font-weight: 400; text-transform: none; letter-spacing: 0; }
.vt-crumb { margin-bottom: 8px; }
.vt-head { display: flex; gap: 16px; }
.vt-head__main { min-width: 0; flex: 1; }
.vt-krtitle { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 22px; font-weight: 600; margin-bottom: 12px; }
input.vt-inline-edit { flex: 1; min-width: 260px; font: inherit; color: inherit; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 2px 8px; }
input.vt-inline-edit:hover { border-color: var(--line); }
input.vt-inline-edit:focus { background: var(--surface-2); }
.vt-head__meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.vt-head__meta > span:not(.vt-meta-sep) { background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; display: inline-flex; align-items: center; gap: 6px; }
.vt-head__meta b { color: var(--text); font-weight: 600; }
.vt-meta-sep { width: 1px; height: 18px; background: var(--line); }
.vt-meta-select { width: auto; padding: 1px 6px; font-size: 12.5px; border-radius: 6px; }
.vt-statusbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.vt-statusbar__label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.vt-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.vt-seg button { padding: 8px 15px; font-size: 13px; font-weight: 500; min-height: 34px; color: var(--muted); background: transparent; border: 0; border-right: 1px solid var(--line); cursor: pointer; font-family: inherit; }
.vt-seg button:last-child { border-right: 0; }
.vt-seg button:hover:not(.is-active):not(:disabled) { background: var(--surface-2); color: var(--text); }
.vt-seg button.is-active { color: #fff; font-weight: 700; }
.vt-seg button[data-status="open"].is-active { background: #7c3aed; }
.vt-seg button[data-status="doing"].is-active { background: var(--accent); color: var(--accent-ink); }
.vt-seg button[data-status="done"].is-active { background: var(--green); color: #fff; }
.vt-seg button[data-status="cancelled"].is-active { background: #59637a; }
.vt-seg.is-busy { opacity: .6; pointer-events: none; }

/* Description: text, click to edit; editor like Jira */
.vt-krdescr { margin-top: 14px; max-width: 820px; font-size: 13.5px; line-height: 1.6; overflow-wrap: anywhere; cursor: text;
  border: 1px solid transparent; border-radius: 9px; padding: 8px 10px; margin-left: -10px; }
.vt-krdescr:hover { background: var(--surface-2); border-color: var(--line); }
.vt-krdescr.is-empty { color: var(--muted); }
.vt-krdescr:has(.vt-rich) { background: transparent; border-color: transparent; cursor: default; padding: 0; margin-left: 0; }
.vt-krdescr ol, .vt-krdescr ul, .vt-rich__area ol, .vt-rich__area ul { margin: 4px 0 4px 20px; padding: 0; }
.vt-krdescr p { margin: 0 0 6px; }
.vt-krdescr code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; }
.vt-rich { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); overflow: hidden; max-width: 820px; }
.vt-rich__bar { display: flex; gap: 2px; flex-wrap: wrap; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface); }
.vt-rich__btn { min-width: 30px; height: 28px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.vt-rich__btn:hover { background: var(--surface-2); color: var(--text); }
.vt-rich__btn.is-b { font-weight: 800; } .vt-rich__btn.is-i { font-style: italic; } .vt-rich__btn.is-s { text-decoration: line-through; }
.vt-rich__btn svg { width: 16px; height: 16px; }
.vt-rich__area { min-height: 96px; max-height: 340px; overflow: auto; padding: 10px 12px; font-size: 13.5px; line-height: 1.6; outline: none; }
.vt-rich__foot { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }

/* Progress block and the checklist */
.vt-subtitle { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vt-subtitle__hint { font-size: 12px; font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .8; }
.vt-icobtn { border: 0; background: transparent; padding: 0; font: inherit; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 9px; color: var(--muted); opacity: .7; text-decoration: none !important; }
.vt-icobtn svg { width: 16px; height: 16px; }
.vt-icobtn:hover { color: var(--accent); background: var(--accent-soft); }
.vt-icobtn--danger:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.vt-icobtn:focus-visible { opacity: 1; }

/* Money summary, sub-KR flags, pickers, log */
.vt-summary { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.vt-summary .stat { box-shadow: none; border: 1px solid var(--line); background: var(--surface-2); }
.vt-pickrow { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.vt-pickrow input { max-width: 320px; }
.vt-tests-pick { max-height: 240px; max-width: 560px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; background: var(--surface); }
.vt-tests-pick div { padding: 7px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px solid var(--line); }
.vt-tests-pick div:hover { background: var(--accent-soft); }
.vt-tests-pick small { color: var(--muted); }
.vt-tests-pick .vt-pick-empty { cursor: default; }
.vt-log > div + div { margin-top: 3px; }
.vt-dangerrow { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }

/* Comments */
.vt-comments { max-width: none; }
.vt-comment { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.vt-comment--reply { margin-left: 38px; }
.vt-comment__main { flex: 1; min-width: 0; }
.vt-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.vt-comment__head { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vt-comment__head b { color: var(--text); }
.vt-comment__body { font-size: 13.5px; white-space: pre-wrap; margin-top: 3px; word-break: break-word; }
.vt-mention { color: var(--accent); font-weight: 600; }
.vt-comment__actions { font-size: 11.5px; margin-top: 4px; display: flex; gap: 10px; }
.vt-comment__actions a { color: var(--muted); cursor: pointer; }
.vt-comment__actions a:hover { color: var(--accent); }
.vt-comment-form { margin-top: 10px; }
.vt-comment-form textarea { min-height: 64px; }
.vt-comment-form .row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.vt-reply-note { margin-bottom: 4px; }
.vt-reply-note .vt-cancel-reply { color: var(--accent); }
.vt-mention-pop { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); z-index: 50; min-width: 240px; }
.vt-mention-pop div { padding: 6px 10px; font-size: 12.5px; cursor: pointer; }
.vt-mention-pop div:hover, .vt-mention-pop div.is-active { background: var(--accent-soft); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(10, 14, 24, .5); display: none; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { width: 100%; max-width: 520px; background: var(--surface); border-radius: 12px; border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); padding: 20px; }
.modal__title { font-size: 17px; font-weight: 600; margin-bottom: 14px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.vt-modal-form label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); margin: 12px 0 5px; }
.vt-modal-form label:first-child { margin-top: 0; }
.vt-modal-row { display: flex; gap: 10px; }
.vt-modal-row > div { flex: 1; min-width: 0; }
.vt-modal-row > .grow { flex: 1.4; }

/* Toast */
.vt-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 12px); z-index: 210; display: flex; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); opacity: 0; transition: opacity .2s, transform .2s; }
.vt-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.vt-toast__ok { color: var(--green); font-weight: 800; }
.vt-toast.is-error { border-color: color-mix(in srgb, var(--red) 55%, var(--line)); }
.vt-toast.is-error .vt-toast__ok { color: var(--red); }
.vt-ask__text { white-space: pre-line; margin: 0 0 10px; color: var(--text); font-size: 14px; line-height: 1.5; }
.vt-toast__x { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.vt-toast__act { height: 28px; padding: 0 11px; border: 0; border-radius: 8px; background: var(--text); color: var(--surface); font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.vt-toast__act:hover { opacity: .88; }

/* Calendar (z above the modal) */
.vt-cal { position: fixed; z-index: 300; width: 268px; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0, 0, 0, .22); }
.vt-cal__top { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.vt-cal__nav { width: 26px; height: 26px; flex: none; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); cursor: pointer; }
.vt-cal__nav:hover { border-color: var(--accent); color: var(--accent); }
.vt-cal__sel { flex: 1; min-width: 0; padding: 4px 6px; font-size: 12px; border-radius: 7px; }
.vt-cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.vt-cal__dow { text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); padding: 4px 0; }
.vt-cal__day { height: 32px; border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.vt-cal__day:hover { background: var(--accent-soft); }
.vt-cal__day.is-out { color: var(--muted); opacity: .45; }
.vt-cal__day.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.vt-cal__day.is-sel { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.vt-cal__foot { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.vt-cal__q { flex: 1 1 auto; padding: 5px 8px; font-size: 11px; border-radius: 7px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-family: inherit; }
.vt-cal__q:hover { color: var(--accent); border-color: var(--accent); }
.vt-cal__q--clear { flex-basis: 100%; color: var(--red); }
.vt-calbtn { min-height: 36px; padding: 7px 11px; border-radius: 7px; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; text-align: left; }
.vt-calbtn:hover { border-color: var(--accent); }
.vt-calbtn.is-empty { color: var(--muted); }
.vt-calbtn--wide { width: 100%; }
.vt-calbtn--sm { min-height: 30px; padding: 4px 9px; font-size: 12.5px; }

@media (max-width: 700px) {
  .vt-krtitle { font-size: 18px; }
  input.vt-inline-edit { min-width: 0; width: 100%; }
  .vt-filters__push { margin-left: 0; }
  .vt-modal-row { flex-direction: column; }
}

/* Period picker: presets + one calendar */
.daterange__btn { gap: 8px; font-weight: 500; }
.daterange__btn svg { width: 16px; height: 16px; color: var(--muted); }
.daterange__btn .chev { width: 14px; height: 14px; }
.vt-range { position: fixed; z-index: 300; display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .22); overflow: hidden; max-width: calc(100vw - 16px); }
.vt-range__presets { display: flex; flex-direction: column; padding: 8px; border-right: 1px solid var(--line); min-width: 170px; }
.vt-range__presets button { text-align: left; padding: 7px 10px 7px 26px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13.5px; position: relative; }
.vt-range__presets button:hover { background: var(--surface-2); }
.vt-range__presets button.is-on { font-weight: 600; }
.vt-range__presets button.is-on::before { content: "✓"; position: absolute; left: 9px; font-weight: 700; color: var(--accent); }
.vt-range__cal { padding: 10px 12px; width: 280px; }
.vt-range__month { flex: 1; text-align: center; font-size: 13.5px; }
.vt-cal__day.is-range { background: var(--accent-soft); border-radius: 0; }
.vt-cal__day.is-sel { background: var(--accent); color: var(--accent-ink); border-radius: 8px; font-weight: 700; }
.vt-range__foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.vt-range__label { flex: 1; font-size: 12.5px; color: var(--muted); }
@media (max-width: 560px) {
  .vt-range { flex-direction: column; left: 8px !important; right: 8px; }
  .vt-range__presets { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); min-width: 0; }
  .vt-range__cal { width: auto; }
}

/* Searchable picker */
.vt-picker { position: fixed; z-index: 320; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(0, 0, 0, .22); padding: 6px; }
input.vt-picker__q { width: 100%; padding: 7px 9px; border-radius: 6px; margin-bottom: 4px; }
.vt-picker__list { max-height: 248px; overflow-y: auto; }
.vt-picker__item { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.vt-picker__item small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.vt-picker__item.is-active { background: var(--surface-2); }
.vt-picker__item.is-sel span::before { content: "✓ "; color: var(--accent); font-weight: 700; }
.vt-picker__empty { padding: 10px; color: var(--muted); font-size: 13px; }
.vt-picker__item .board-dot { width: 10px; height: 10px; margin-right: 8px; vertical-align: -1px; }
.vt-picker__item--create { color: var(--accent); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; }
