/* Tasks index, show, and form. Tokens mirror project_show.css / feature_workspace.css / agent_runs_index.css. */
[data-pull-refresh-target="scroller"]:has(> .task-workspace) { background: #101722; }

.task-workspace {
  --bg: #101722; --panel: #192331; --panel-2: #18222f; --raise: #202c3d; --edge: #354151; --rule: #2a3545;
  --text: #f3f6fc; --soft: #d0d8e4; --muted: #a9b5c6; --faint: #7d899b; --link: #a2c6ff;
  --green: #9cddbd; --green-wash: #203c34; --blue: #acd2ff; --blue-wash: #233e60;
  --amber: #f6d18f; --amber-wash: #403522; --red: #ffb6bd; --red-wash: #45242b;
  --violet: #d2c2f8; --violet-wash: #302e49; --teal: #b1e2dd;
  --mono: ui-monospace, Menlo, monospace;
  min-height: 100%; color: var(--text); color-scheme: dark;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow-wrap: anywhere;

  [hidden] { display: none !important; }
  > [role="status"], > [role="alert"] { max-width: 1252px; margin: 20px auto 0; width: calc(100% - 2 * clamp(20px, 3vw, 44px)); }
  svg.i { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
  :is(a, button, input, select, textarea, label, summary):focus-visible { outline: 2px solid #93c5fd; outline-offset: 3px; }
  button { cursor: pointer; }
  summary { list-style: none; cursor: pointer; }
  summary::-webkit-details-marker { display: none; }
  .wrap { max-width: 1340px; margin: 0 auto; padding: 28px clamp(20px, 3vw, 44px) 56px; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .pi { flex: none; border-radius: 7px; }
  .pv { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--soft); white-space: nowrap; }
  .pv svg { width: 14px; height: 14px; }

  .pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; background: #2c3544; color: var(--soft); }
  .pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
  .pill.live::before { box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
  .t-green { background: var(--green-wash); color: var(--green); }
  .t-blue { background: var(--blue-wash); color: var(--blue); }
  .t-amber { background: var(--amber-wash); color: var(--amber); }
  .t-red { background: var(--red-wash); color: var(--red); }
  .t-violet { background: var(--violet-wash); color: var(--violet); }
  .t-gray { background: #2c3544; color: var(--soft); }
  .t-yellow { background: #3d3820; color: #f3e08a; }
  .prio { font: 11px/1.4 var(--mono); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--edge); color: var(--muted); white-space: nowrap; }
  .prio.critical { color: #ffb6bd; border-color: #6b3540; background: #2c1c22; }
  .prio.high { color: #fbc78f; border-color: #6a4a2b; background: #2a2119; }
  .mono { font: 12px/1.5 var(--mono); color: var(--muted); }
  .count { padding: 0 6px; border: 1px solid var(--edge); border-radius: 5px; font: 12px/1.5 var(--mono); color: var(--muted); font-weight: 400; letter-spacing: normal; }
  .featchip { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 6px; border-radius: 6px; background: #1d2b45; border: 1px solid #2f4b78; color: #bcd5ff; font-size: 11.5px; font-weight: 550; white-space: nowrap; max-width: 100%; }
  .featchip span { overflow: hidden; text-overflow: ellipsis; }
  .featchip svg { width: 12px; height: 12px; }
  .featchip em { font: 10.5px var(--mono); font-style: normal; color: #8fb0e0; }
  .featchip:hover { border-color: #4f78b8; }
  .recchip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 1px 6px; border-radius: 6px; background: var(--violet-wash); border: 1px solid #4b4570; color: var(--violet); font-size: 11.5px; font-weight: 550; }
  .recchip svg { width: 12px; height: 12px; }

  .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 14px; border: 1px solid var(--edge); border-radius: 8px; background: var(--raise); font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text); }
  .btn:hover { filter: brightness(1.14); }
  .btn-primary { background: #3466cd; border-color: #5081e4; color: #fff; }
  .btn-warn { background: #6b4a12; border-color: #a7772a; color: #ffe3b0; }
  .btn-ghost { background: transparent; }
  .btn-icon { width: 36px; padding: 0; }
  .btn-sm { min-height: 30px; padding: 4px 10px; font-size: 12px; }
  form.button_to { display: contents; }
  .panel { min-width: 0; background: var(--panel); border: 1px solid var(--edge); border-radius: 14px; overflow: hidden; }

  .track { display: flex; gap: 3px; width: 84px; }
  .track span { flex: 1; height: 4px; border-radius: 1px; background: #475566; }
  .track [data-segment="completed"] { background: #78d5aa; }
  .track :is([data-segment="running"], [data-segment="active"]) { background: #80acff; }
  .track :is([data-segment="error"], [data-segment="rejected"]) { background: #ff929c; }
  .track [data-segment="blocked"] { background: #f5c16b; }
  .track [data-segment="waiting"] { background: repeating-linear-gradient(90deg, #80acff 0 3px, #475566 3px 6px); }
  .track [data-segment="skipped"] { background: transparent; border: 1px dashed #748195; }

  .crumb { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
  .crumb a { display: inline-flex; align-items: center; gap: 6px; }
  .crumb a:hover { color: var(--link); }
  .crumb strong { color: #e3e8f0; font-weight: 500; }
  .crumb .sep { color: #56637a; }

  .menu-wrap { position: relative; }
  .menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 252px; padding: 6px; background: #1d2837; border: 1px solid #415066; border-radius: 10px; box-shadow: 0 16px 40px #0009; }
  .menu :is(a, button, [role="menuitem"]) { display: flex; width: 100%; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 6px; font-size: 13px; color: #dde5f0; text-align: left; font-weight: 500; }
  .menu :is(a, button):hover { background: #2a3749; }
  .menu small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
  .menu hr { border: 0; border-top: 1px solid var(--rule); margin: 5px 4px; }
  .menu .danger { color: var(--red); }
  .menu .off { color: #7d899b; cursor: not-allowed; }
  .menu .off:hover { background: none; }

  /* ===== Index ===== */
  .ti-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
  .ti-head p { color: var(--muted); font-size: 13px; }
  .ti-totals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; background: var(--panel); border: 1px solid var(--edge); border-radius: 12px; overflow: hidden; }
  .ti-totals a { padding: 14px 18px; display: block; }
  .ti-totals a + a { border-left: 1px solid var(--edge); }
  .ti-totals a:hover { background: #1f2b3b; }
  .ti-totals dt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #c4cedb; }
  .ti-totals dt::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone, #80acff); }
  .ti-totals dd { margin-top: 2px; font-size: 28px; letter-spacing: -1px; font-weight: 620; font-variant-numeric: tabular-nums; }
  .ti-totals dd small { margin-left: 6px; font-size: 12px; letter-spacing: 0; font-weight: 400; color: var(--muted); }
  .ti-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
  .ti-filters { display: flex; flex-wrap: wrap; gap: 6px; }
  .ti-filters a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 12px; color: #b9c5d4; background: #17202c; border: 1px solid #394657; border-radius: 7px; white-space: nowrap; }
  .ti-filters a:hover { background: #243141; }
  .ti-filters a[aria-current] { background: #233953; border-color: #648dbb; color: #e7efff; }
  .ti-filters a span { font: 11px var(--mono); color: #a5b2c5; }
  .ti-filters a i { width: 7px; height: 7px; border-radius: 50%; background: var(--tone); }
  .ti-projects { margin-left: auto; }
  .ti-proj { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px 5px 6px; border: 1px solid #394657; border-radius: 7px; background: #17202c; font-size: 12px; color: #d5dde8; }
  .ti-proj .stack { display: inline-flex; }
  .ti-proj .stack img { border: 2px solid #17202c; margin-left: -6px; box-sizing: content-box; border-radius: 5px; }
  .ti-proj .stack img:first-child { margin-left: 0; }
  .ti-projects .menu { max-height: 360px; overflow-y: auto; }
  .ti-projects .menu a[aria-current] { background: #233953; color: #fff; }
  .ti-list { overflow: hidden; border: 1px solid #334051; border-radius: 12px; background: var(--panel-2); }
  .ti-cols { display: grid; grid-template-columns: minmax(280px, 1fr) 118px 168px 104px 82px; align-items: start; gap: 14px; padding-inline: 18px; }
  .ti-labels { align-items: center; height: 34px; font-size: 10px; text-transform: uppercase; letter-spacing: .105em; color: #acb9ca; background: #202c3a; font-weight: 650; }
  .ti-labels :last-child, .ti-when { text-align: right; }
  .ti-row { position: relative; padding-block: 14px; border-top: 1px solid #303c4b; }
  .ti-labels + .ti-row { border-top: 0; }
  .ti-row:hover { background: #1f2b3a; }
  .ti-row.attn { box-shadow: inset 3px 0 0 #ff929c; }
  .ti-row.blocked { box-shadow: inset 3px 0 0 #f5c16b; }
  .ti-id { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
  .ti-id > img { margin-top: 2px; width: 32px; height: 32px; border-radius: 7px; }
  .ti-id > div { min-width: 0; }
  .ti-title { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.35; color: #eff3fa; }
  .ti-title::after { content: ""; position: absolute; inset: 0; }
  .ti-title:focus-visible { outline: none; }
  .ti-title:focus-visible::after { outline: 2px solid #93c5fd; outline-offset: -2px; }
  .ti-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; margin-top: 5px; font-size: 12px; color: #aebaca; min-width: 0; }
  .task-created { max-width: 100%; overflow-wrap: anywhere; }
  .ti-tags code { font: 11px var(--mono); color: #8e9bae; }
  .ti-tags .dot { width: 3px; height: 3px; border-radius: 50%; background: #5d6a7c; }
  .ti-tags .alt { display: none; gap: 8px; align-items: center; }
  .ti-tags .featchip, .ti-more, .ti-runlink, .ti-full { position: relative; z-index: 1; }
  .ti-excerpt { margin-top: 6px; font-size: 12.5px; color: #93a0b2; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; max-width: 760px; }
  .ti-more { margin-top: 4px; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--link); }
  .ti-more svg { width: 12px; height: 12px; }
  .ti-more[aria-expanded="true"] svg { transform: rotate(180deg); }
  .ti-full { margin-top: 10px; padding: 12px 14px; max-width: 760px; border: 1px solid var(--rule); border-radius: 10px; background: #141d29; cursor: auto; }
  .ti-full.description-prose { font-size: 13px; line-height: 1.55; }
  .ti-status { padding-top: 1px; min-width: 0; }
  .ti-status small { display: block; margin-top: 5px; font-size: 11.5px; color: var(--muted); }
  .ti-run { min-width: 0; font-size: 12px; padding-top: 1px; }
  .ti-runlink { display: inline-flex; align-items: center; gap: 6px; color: #d5e2f5; font-weight: 550; }
  .ti-runlink code { font: 11px var(--mono); color: #a8c9fe; }
  .ti-runlink:hover { color: #fff; }
  .ti-run .track { margin-top: 7px; }
  .ti-run small { display: block; margin-top: 5px; color: var(--muted); font-size: 11.5px; }
  .ti-run .none { color: var(--faint); }
  .ti-meta { display: grid; gap: 7px; justify-items: start; padding-top: 1px; }
  .ti-when { font-size: 12px; color: #c4cedb; padding-top: 1px; }
  .ti-when time { display: block; margin-top: 3px; font: 10.5px var(--mono); color: #9daabc; }
  .ti-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; border-top: 1px solid #303c4b; font-size: 12px; color: var(--muted); }
  .ti-foot a { color: var(--link); font-weight: 600; }
  .ti-empty { padding: 48px 18px; text-align: center; color: var(--muted); }
  .ti-empty h2 { font-size: 16px; font-weight: 650; color: var(--text); margin-bottom: 4px; }
  .ti-empty a { color: var(--link); font-weight: 600; }

  /* ===== Show ===== */
  .hero { position: relative; overflow: visible; }
  .hero-band { position: relative; height: 92px; border-radius: 13px 13px 0 0; background: linear-gradient(110deg, #1d3a3a 0%, #203743 55%, #262f4a 100%); color: var(--teal); overflow: hidden; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 16px 22px; }
  .hero-band > svg { position: absolute; inset: 0; width: 100%; height: 100%; stroke: currentColor; fill: none; stroke-width: .7; opacity: .36; }
  .hero-proj { position: relative; display: inline-flex; align-items: center; gap: 9px; font-weight: 650; color: #e6fbf7; font-size: 14px; padding: 4px 10px 4px 4px; border-radius: 9px; background: #10201fcc; border: 1px solid #2d5551; min-width: 0; }
  .hero-proj img { border-radius: 5px; }
  .hero-proj:hover { border-color: #5fa59c; }
  .hero-band .pill { position: relative; }
  .hero-body { padding: 18px 24px 0; }
  .hero-body h1 { font-size: clamp(24px, 2.4vw, 32px); line-height: 1.18; letter-spacing: -.022em; font-weight: 680; }
  .hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
  .hero-meta .mono { color: #c2ccda; }
  .hero-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: #5d6a7c; }
  .hero-meta a:not(.featchip):hover { color: var(--link); }

  .life { margin-top: 20px; padding: 16px 24px 18px; border-top: 1px solid var(--edge); border-radius: 0 0 13px 13px; background: var(--panel-2); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px 28px; align-items: center; }
  .sched-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 13px; color: #d8ccff; }
  .steps { display: flex; flex-wrap: wrap; row-gap: 8px; align-items: center; list-style: none; min-width: 0; padding: 0; margin: 0; }
  .steps li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--faint); white-space: nowrap; }
  .steps li + li::before { content: ""; width: clamp(18px, 3vw, 46px); height: 2px; margin: 0 10px; background: #36445a; border-radius: 2px; }
  .steps li.done + li::before { background: #4f8f74; }
  .steps b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #3f4d62; font-size: 11px; color: var(--faint); flex: none; }
  .steps li.done { color: #b5dcc8; }
  .steps li.done b { background: #2b6b52; border-color: #2b6b52; color: #e6fff3; }
  .steps li.now { color: #fff; font-weight: 650; }
  .steps li.now b { border-color: #80acff; background: #233e60; color: #cfe2ff; box-shadow: 0 0 0 4px #80acff2b; }
  .steps li.now.bad b { border-color: #ff929c; background: var(--red-wash); color: var(--red); box-shadow: 0 0 0 4px #ff929c26; }
  .steps li.now.blk b { border-color: #f5c16b; background: var(--amber-wash); color: var(--amber); box-shadow: 0 0 0 4px #f5c16b26; }
  .steps li.now.ok b { border-color: #78d5aa; background: #2b6b52; color: #e6fff3; box-shadow: 0 0 0 4px #78d5aa26; }
  .steps li.now.off b { border-color: #748195; background: #2c3544; color: var(--soft); box-shadow: 0 0 0 4px #74819526; }
  .life-why { grid-column: 1; font-size: 13px; color: #c7d1de; }
  .life-why b { color: #fff; font-weight: 600; }
  .acts { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
  .acts .divider { width: 1px; height: 24px; background: var(--edge); margin: 0 2px; }

  .ts-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 20px; align-items: start; }
  .ts-main, .ts-rail { display: grid; gap: 18px; min-width: 0; }
  .card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 0; }
  .card-h h2 { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
  .card-h a { font-size: 12px; font-weight: 600; color: var(--link); }
  .card-b { padding: 12px 18px 18px; }
  .notes { font-size: 13px; color: var(--soft); white-space: pre-wrap; }

  .liverun { border-color: #355b93; background: linear-gradient(180deg, #1a2840, #192331 70%); }
  .liverun.lr-error { border-color: #7a3943; background: linear-gradient(180deg, #2a1c25, #192331 70%); }
  .liverun.lr-blocked { border-color: #7a5d2b; background: linear-gradient(180deg, #2a241a, #192331 70%); }
  .lr-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
  .lr-top h2 { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 650; }
  .lr-top h2 a { display: inline-flex; gap: 8px; align-items: center; }
  .lr-top h2 a:hover { color: var(--link); }
  .lr-top h2 code { font: 12px var(--mono); color: #a8c9fe; }
  .lr-phases { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; padding: 14px 18px 4px; }
  .lr-phase { display: grid; gap: 7px; font-size: 12px; color: var(--muted); }
  .lr-phase > i { height: 6px; border-radius: 3px; background: #3b4758; overflow: hidden; display: block; }
  .lr-phase[data-segment="completed"] > i { background: #78d5aa; }
  .lr-phase[data-segment="completed"] span { color: #b5dcc8; }
  .lr-phase:is([data-segment="running"], [data-segment="active"]) > i { background: linear-gradient(90deg, #80acff 55%, #3b4758 55%); }
  .lr-phase:is([data-segment="running"], [data-segment="active"]) span { color: #fff; font-weight: 600; }
  .lr-phase:is([data-segment="error"], [data-segment="rejected"]) > i { background: #ff929c; }
  .lr-phase[data-segment="blocked"] > i { background: #f5c16b; }
  .lr-phase[data-segment="waiting"] > i { background: repeating-linear-gradient(90deg, #80acff 0 3px, #3b4758 3px 6px); }
  .lr-phase[data-segment="skipped"] > i { background: transparent; border: 1px dashed #748195; }
  .lr-phase span { display: flex; justify-content: space-between; gap: 6px; }
  .lr-phase em { font-style: normal; font: 11px var(--mono); color: var(--muted); }
  .lr-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 18px 14px; font-size: 12px; color: var(--muted); }
  .lr-foot b { color: #dbe4f0; font-weight: 550; }
  .lr-foot a { color: var(--link); font-weight: 600; }
  .lr-log { margin: 0 18px 16px; padding: 10px 12px; border-radius: 8px; background: #101a27; border: 1px solid #263346; font: 11.5px/1.6 var(--mono); color: #9fb0c6; white-space: pre-wrap; max-height: 160px; overflow: auto; }

  .desc { position: relative; }
  .desc .description-prose, .te-preview .description-prose, .ti-full { max-width: none; font-size: 14px; }
  .description-prose :is(h1, h2, h3, h4, h5, h6) { margin: 16px 0 4px; font-size: 14px; }
  .desc.clamped .description-prose { max-height: 206px; overflow: hidden; }
  .desc.clamped:has(.desc-toggle:not([hidden]))::after { content: ""; position: absolute; left: 0; right: 0; bottom: 30px; height: 64px; background: linear-gradient(180deg, transparent, var(--panel)); pointer-events: none; }
  .desc-toggle { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--link); }
  .desc-toggle svg { width: 13px; height: 13px; }
  .desc-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }

  .atts { display: flex; flex-wrap: wrap; gap: 10px; }
  .att { width: 132px; border-radius: 8px; overflow: hidden; border: 1px solid var(--edge); background: #121b27; font-size: 11px; color: var(--muted); position: relative; }
  .att img { display: block; width: 100%; height: 82px; object-fit: cover; background: #1a2433; }
  .att span { display: block; padding: 6px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .att:hover { border-color: #4f6280; }

  .runs { display: grid; }
  .run { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 96px 132px 74px; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--rule); font-size: 12.5px; }
  .run:hover { background: #1f2b3b; }
  .run b { font-weight: 600; color: #eef3fa; }
  .run a.stretch::after { content: ""; position: absolute; inset: 0; }
  .run small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
  .run .right { text-align: right; color: #c4cedb; }
  .run .right time { display: block; font: 10.5px var(--mono); color: #9daabc; margin-top: 2px; }
  .runs .empty { padding: 4px 18px 18px; font-size: 13px; color: var(--muted); }

  .feat-band { position: relative; padding: 14px 16px; background: #302e49; color: #d2c2f8; overflow: hidden; }
  .feat-band svg.art { position: absolute; right: -14px; top: -22px; width: 190px; height: 140px; stroke: currentColor; fill: none; stroke-width: .8; opacity: .4; }
  .feat-band small { position: relative; display: flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: #c5b6ef; }
  .feat-band a { position: relative; display: block; margin-top: 6px; font-size: 16px; font-weight: 680; color: #fff; letter-spacing: -.02em; line-height: 1.25; }
  .feat-band a:hover { text-decoration: underline; }
  .meter > div:first-child { display: flex; justify-content: space-between; font-size: 12px; color: #c2ccda; }
  .meter b { color: #edf3fc; }
  .meter .bar { height: 5px; margin-top: 7px; border-radius: 5px; background: #384657; overflow: hidden; }
  .meter .bar i { display: block; height: 100%; background: var(--green); }
  .wave { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; margin: 12px -6px 0; padding: 0; }
  .wave h3 { font: 10.5px var(--mono); color: var(--faint); padding: 6px 6px 2px; font-weight: 400; }
  .wave li a { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 6px; font-size: 12.5px; color: #c9d3e0; }
  .wave li a:hover { background: #1f2b3b; }
  .wave li a > span:nth-child(2) { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wave li em { font: normal 10.5px var(--mono); color: var(--faint); }
  .wave li a[aria-current] { background: #233953; color: #fff; font-weight: 600; box-shadow: inset 2px 0 0 #80acff; }
  .wave .st { width: 15px; height: 15px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 9px; border: 2px solid #4a5870; }
  .wave .st.c { background: #2b6b52; border-color: #2b6b52; color: #e6fff3; }
  .wave .st.a { border-color: #80acff; }
  .wave .st.e { border-color: #ff929c; }
  .wave .st.b { border-color: #f5c16b; }
  .feat-foot { padding: 12px 16px; border-top: 1px solid var(--edge); }
  .feat-foot :is(a, span) { width: 100%; }

  .facts { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 12px; padding: 14px 18px 18px; font-size: 12.5px; margin: 0; }
  .facts dt { color: var(--muted); }
  .facts dd { color: #e2e9f3; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 0; margin: 0; }
  .facts dd a { display: inline-flex; align-items: center; gap: 7px; }
  .facts dd a:hover { color: var(--link); }
  .facts dd .link { color: var(--link); }
  .facts hr { grid-column: 1 / -1; border: 0; border-top: 1px solid var(--rule); }

  /* ===== Form ===== */
  .te-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
  .te-head h1 { font-size: 26px; font-weight: 680; letter-spacing: -.04em; }
  .te-head p { margin-top: 4px; font-size: 13px; color: var(--muted); }
  .te-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
  .te-grid.ai { grid-template-columns: minmax(0, 1fr) 420px; }
  .te-name { padding: 18px 20px 14px; border-bottom: 1px solid var(--edge); }
  .lbl { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; color: #9fabbd; margin-bottom: 7px; }
  .lbl > :first-child { white-space: nowrap; }
  .lbl em { text-align: right; font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); font-size: 11.5px; }
  .te-name textarea { display: block; resize: none; field-sizing: content; min-height: 34px; width: 100%; background: transparent; border: 0; border-radius: 6px; font-size: 22px; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; color: #fff; padding: 2px 0; outline: none; }
  .te-name textarea::placeholder { color: #6f7b8d; }
  .te-name textarea:focus-visible { box-shadow: 0 2px 0 #5081e4; outline: none; }
  .te-name.err textarea { box-shadow: 0 2px 0 #ff929c; }
  .fielderr { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--red); }
  .te-desc { padding: 14px 20px 18px; }
  .te-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
  .tabs { display: inline-flex; padding: 2px; border: 1px solid var(--edge); border-radius: 8px; background: #141d29; }
  .tabs button { padding: 4px 11px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
  .tabs button[aria-pressed="true"] { background: #2a3749; color: #fff; }
  .ai-btn { position: relative; margin-left: auto; display: inline-flex; align-items: stretch; border-radius: 9px; border: 1px solid #6a57b8; background: linear-gradient(135deg, #3b2f6e, #2e2a52); color: #ece6ff; font-size: 13px; font-weight: 650; box-shadow: 0 0 0 3px #7a5fd61f; }
  .ai-btn > button { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 8px 0 0 8px; }
  .ai-btn > button svg { width: 16px; height: 16px; color: #cbb8ff; }
  .ai-btn .with { display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 10px; border-left: 1px solid #5a4a9c; border-radius: 0 8px 8px 0; font-size: 12px; font-weight: 550; color: #d8ccff; background: #ffffff08; }
  .ai-btn .with svg { width: 14px; height: 14px; }
  .ai-btn .with svg.chev { width: 11px; height: 11px; }
  .ai-btn .menu { width: 180px; }
  .ai-btn .menu button[aria-checked="true"] { background: #2a3749; }
  .te-area { display: block; width: 100%; min-height: 300px; resize: vertical; padding: 14px 16px; border: 1px solid #3c4a5e; border-radius: 10px; background: #121b27; font: 13px/1.65 var(--mono); color: #dbe3ee; outline: none; white-space: pre-wrap; }
  .te-area:focus { border-color: #5081e4; box-shadow: 0 0 0 3px #3466cd33; }
  .te-area.applied { outline: 2px solid #7a5fd6aa; outline-offset: 2px; }
  .te-preview { min-height: 300px; padding: 14px 16px; border: 1px solid #3c4a5e; border-radius: 10px; background: #121b27; }
  .te-preview .description-prose { max-width: none; font-size: 14px; }
  .te-hint { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; font-size: 11.5px; color: var(--faint); flex-wrap: wrap; }
  .te-hint button { color: var(--link); font-weight: 600; }
  .ai-empty { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 12px; border: 1px dashed #5a4a9c; border-radius: 10px; background: #221f3a; font-size: 12.5px; color: #d8ccff; }
  .drop { position: relative; margin-top: 14px; padding: 12px; border: 1px dashed #435168; border-radius: 10px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .drop.over { border-color: #5081e4; background: #17233a; }
  .drop .att { width: 96px; }
  .drop .att img { height: 62px; }
  .drop .att a { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; background: #000a; display: grid; place-items: center; color: #fff; }
  .drop .att a svg { width: 11px; height: 11px; }
  .drop-cta { position: relative; flex: 1; min-width: 180px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
  .drop-cta b { color: var(--link); font-weight: 600; }
  .drop-cta > svg { width: 22px; height: 22px; color: #7f8da3; }
  .drop-cta small { display: block; font-size: 11.5px; color: var(--faint); }
  .drop-cta input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
  .drop-cta:has(input:focus-visible) { outline: 2px solid #93c5fd; outline-offset: 3px; border-radius: 6px; }

  .te-side { display: grid; }
  .te-side > section { padding: 16px 18px; border-top: 1px solid var(--edge); min-width: 0; }
  .te-side > section:first-child { border-top: 0; }
  .te-side h3, .te-side legend { font-size: 13px; font-weight: 650; margin-bottom: 12px; color: var(--text); padding: 0; }
  .te-side fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
  .te-select { width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid #3c4a5e; border-radius: 8px; background: #141d29; font-size: 13px; color: #e6edf7; }
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; gap: 3px; border: 1px solid #3c4a5e; border-radius: 9px; background: #141d29; }
  .seg label, .seg button { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 4px 6px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; cursor: pointer; }
  .seg input { position: absolute; opacity: 0; pointer-events: none; }
  .seg label:hover, .seg button:hover { color: #fff; background: #1f2b3b; }
  .seg label:has(input:checked), .seg button[aria-pressed="true"] { background: #2c3c54; color: #fff; box-shadow: inset 0 0 0 1px #5a7299; }
  .seg label:has(input:focus-visible) { outline: 2px solid #93c5fd; outline-offset: 2px; }
  .seg.prio-seg label:has(input[value="high"]:checked) { background: #3a2a1a; color: #fbc78f; box-shadow: inset 0 0 0 1px #8a5d30; }
  .seg.prio-seg label:has(input[value="critical"]:checked) { background: #2c1c22; color: #ffb6bd; box-shadow: inset 0 0 0 1px #6b3540; }
  .help { margin-top: 7px; font-size: 11.5px; color: var(--faint); line-height: 1.45; }
  .help a { color: var(--link); }
  .switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
  .switch input { position: absolute; opacity: 0; pointer-events: none; }
  .switch span b { display: block; font-size: 13px; font-weight: 650; }
  .switch span small { display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px; }
  .switch i { position: relative; width: 36px; height: 20px; border-radius: 20px; background: #3b4758; flex: none; transition: background .15s; }
  .switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #dfe6f0; transition: left .15s; }
  .switch:has(input:checked) i { background: #7a5fd6; }
  .switch:has(input:checked) i::after { left: 18px; }
  .switch:has(input:focus-visible) i { outline: 2px solid #93c5fd; outline-offset: 3px; }
  .sched { margin-top: 14px; padding: 12px; border-radius: 10px; border: 1px solid #4b4570; background: #221f3a; display: grid; gap: 12px; }
  .sched .lbl { margin-bottom: 6px; }
  .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
  .days label { position: relative; display: grid; place-items: center; min-height: 30px; border-radius: 6px; border: 1px solid #3c4a5e; background: #141d29; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
  .days input { position: absolute; opacity: 0; pointer-events: none; }
  .days label:has(input:checked) { background: #4a3b8c; border-color: #7a5fd6; color: #fff; }
  .days label:has(input:focus-visible) { outline: 2px solid #93c5fd; outline-offset: 2px; }
  .timein { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
  .timein input { flex: 1; min-width: 110px; min-height: 38px; padding: 6px 10px; border: 1px solid #3c4a5e; border-radius: 8px; background: #141d29; font: 13px var(--mono); color: #e6edf7; }
  .next { font-size: 12px; color: #d8ccff; display: flex; gap: 6px; align-items: center; }
  .next svg { width: 13px; height: 13px; }
  .savebar { position: sticky; bottom: 0; z-index: 4; margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid var(--edge); border-radius: 12px; background: #1b2636f2; box-shadow: 0 -8px 24px #0006; backdrop-filter: blur(6px); }
  .savebar .dirty { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--amber); }
  .savebar .dirty::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .savebar .clean { font-size: 12.5px; color: var(--faint); }
  .savebar > div { display: flex; gap: 8px; }
  .errbanner { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; padding: 10px 14px; border: 1px solid #7a3943; border-radius: 10px; background: #2c1a20; color: #ffd3d8; font-size: 13px; }
  .errbanner svg { color: var(--red); margin-top: 2px; }
  .errbanner b { font-weight: 650; }

  /* AI writer */
  .ai-panel { display: flex; flex-direction: column; border-color: #5a4a9c; background: #1a1830; box-shadow: 0 0 0 4px #7a5fd614, 0 24px 60px #0008; max-height: calc(100vh - 120px); position: sticky; top: 16px; }
  .ai-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #3b3566; }
  .ai-head h3 { font-size: 14px; font-weight: 680; display: flex; align-items: center; gap: 8px; }
  .ai-head h3 svg { width: 16px; height: 16px; color: #cbb8ff; }
  .ai-head .seg { margin-left: auto; width: 168px; }
  .ai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: grid; align-content: start; gap: 12px; }
  .chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .chips button { padding: 5px 10px; border-radius: 20px; border: 1px solid #4b4570; background: #221f3a; color: #d8ccff; font-size: 12px; font-weight: 550; }
  .chips button:hover { border-color: #7a5fd6; }
  .ai-chat { min-width: 0; }
  .ai-chat #messages { display: grid; gap: 4px; }
  .ai-chat .prose { color: #e6e0fb; }
  .ai-status { font-size: 12.5px; color: #8b84ad; }
  .ai-chat:has(#messages .prose) > .ai-status { display: none; }
  .draft { padding: 10px 12px; border-radius: 10px; background: #241f42; border: 1px solid #3b3566; font-size: 12.5px; color: #e4dcff; }
  .draft > p { margin-bottom: 8px; }
  .draft-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .diffbadge { margin-left: auto; font: 11px var(--mono); color: #9cddbd; }
  .ai-input { margin: 0 16px 16px; display: flex; gap: 8px; align-items: flex-end; padding: 6px 6px 6px 12px; border: 1px solid #4b4570; border-radius: 10px; background: #141225; }
  .ai-input textarea { flex: 1; resize: none; field-sizing: content; max-height: 140px; min-height: 30px; background: transparent; border: 0; font-size: 13px; color: #f0ecff; padding: 6px 0; outline: none; }
  .ai-input textarea::placeholder { color: #8b84ad; }
  .ai-input:focus-within { border-color: #7a5fd6; }

  @media (max-width: 1179px) {
    .ti-cols { grid-template-columns: minmax(220px, 1fr) 112px 150px 74px; }
    .ti-cols > .ti-meta, .ti-labels > .l-meta { display: none; }
    .ti-tags .alt { display: inline-flex; }
    .ts-grid, .te-grid, .te-grid.ai { grid-template-columns: minmax(0, 1fr); }
    .ts-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ts-rail > .panel:first-child:not(:only-child) { grid-row: span 2; }
    .te-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .te-side > section { border-top: 1px solid var(--edge); }
    .te-side > section:nth-child(-n+2) { border-top: 0; }
    .te-side > section:nth-child(even) { border-left: 1px solid var(--edge); }
    .te-side > section.full { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--edge); }
    .life { grid-template-columns: minmax(0, 1fr); }
    .acts { grid-column: 1; grid-row: auto; justify-content: flex-start; }
    .te-grid.ai .ai-panel { position: absolute; top: 0; right: 0; width: min(440px, 100%); z-index: 6; max-height: none; }
  }
  @media (max-width: 959px) {
    .ti-labels { display: none; }
    .ti-cols { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; padding-inline: 14px; }
    .ti-row { border-top: 1px solid #303c4b; }
    .ti-id { grid-column: 1 / -1; }
    .ti-status { grid-column: 1; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-left: 44px; }
    .ti-status small { margin-top: 0; }
    .ti-run { grid-column: 1 / -1; grid-row: 3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-left: 44px; }
    .ti-run .track { margin-top: 0; }
    .ti-run small { margin-top: 0; }
    .ti-when { grid-column: 2; grid-row: 2; }
    .ti-when time { display: inline; margin-left: 4px; }
    .ti-excerpt { -webkit-line-clamp: 2; }
  }
  @media (max-width: 767px) {
    .wrap { padding: 18px 14px 40px; }
    .ti-head .btn span { display: none; }
    .ti-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ti-totals a:nth-child(3) { border-left: 0; }
    .ti-totals a:nth-child(n+3) { border-top: 1px solid var(--edge); }
    .ti-totals dd { font-size: 22px; }
    .ti-filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 2px; }
    .ti-projects { margin-left: 0; }
    .hero-body { padding: 16px 16px 0; }
    .hero-band { height: 78px; padding: 12px 14px; }
    .life { padding: 14px 16px 16px; }
    .steps li:not(.now) span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .steps li + li::before { width: 14px; margin: 0 6px; }
    .acts .btn-primary, .acts .btn-warn, .acts form.button_to:first-child > .btn { flex: 1 1 100%; }
    .acts .divider { display: none; }
    .ts-rail, .te-side { grid-template-columns: minmax(0, 1fr); }
    .ts-rail > .panel:first-child:not(:only-child) { grid-row: auto; }
    .te-side > section:nth-child(even) { border-left: 0; }
    .te-side > section:nth-child(2) { border-top: 1px solid var(--edge); }
    .run { grid-template-columns: minmax(0, 1fr) auto; }
    .run .trk { display: none; }
    .run > div:first-child { grid-row: 1 / span 2; }
    .run > div:nth-child(2) { grid-column: 2; grid-row: 1; justify-self: end; }
    .run .right { grid-column: 2; grid-row: 2; }
    .te-name textarea { font-size: 18px; }
    .ai-btn { margin-left: 0; width: 100%; }
    .ai-btn > button { flex: 1; justify-content: center; }
    .te-area { min-height: 240px; font-size: 12.5px; }
    .te-grid.ai .ai-panel { left: 0; width: auto; top: 0; }
    .ai-head .seg { width: 150px; }
    .savebar { margin-inline: -14px; border-radius: 0; border-inline: 0; }
    .savebar .dirty span { display: none; }
  }
  @media (max-width: 420px) {
    .lr-phases { gap: 6px; }
    .lr-phase em { display: none; }
    .ti-filters a span { display: none; }
    .ti-filters a[aria-current] span { display: inline; }
  }
}

.task-workspace {
  .writer-project { margin: 0 16px; padding: 14px 0 12px; border-bottom: 1px solid #3b3566; }
  .writer-project h3 { font-size: 13px; font-weight: 650; margin-bottom: 7px; }
  .writer-project [data-controller=project-select] { display: flex; flex-direction: column; }
  .writer-project [role=listbox] { position: static; }
  .writer-project [role=alert] { order: 1; }
  .writer-project [aria-invalid=true] { outline: 2px solid #93c5fd; outline-offset: 2px; }
  .writer-project [role=alert] { display: block; margin-top: 7px; font-size: 12px; color: var(--red); }
  .ai-panel .chips button:disabled { opacity: .45; }
  .writer-project .help { display: none; }
  .writer-messages { display: grid; gap: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .writer-user { margin-left: 26px; padding: 9px 12px; border: 1px solid #494261; border-radius: 10px 10px 3px 10px; background: #302e49; font-size: 13px; }
  .writer-assistant { font: 12px/1.55 var(--mono); color: #e5dff8; }
  .writer-status { min-height: 32px; display: flex; align-items: center; gap: 7px; font-size: 12px; color: #c9bddf; }
  .writer-status [role=alert] { color: var(--red); }
  .writer-status .pending::before { content: ""; display: inline-block; margin-right: 7px; width: 9px; height: 9px; border: 2px solid #695b91; border-top-color: #d2c2f8; border-radius: 50%; animation: spin 1s linear infinite; }
  .writer-work { height: 204px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
  .writer-work:has(.draft:not([hidden])) { height: auto; min-height: 204px; }
  .writer-work .draft { margin-top: auto; }
  .ai-input .retry-send { width: auto; }
  .ai-input .retry-send svg { display: none; }
  .ai-input button:disabled { opacity: .5; }
  .ai-input textarea, .ai-panel, .te-main { min-width: 0; }
  .ai-head { gap: 6px; flex-wrap: wrap; }
  .ai-head h3 { white-space: nowrap; }
  .ai-head .seg { max-width: 48%; }
  @media (max-width: 1179px) {
    .te-grid.ai .ai-panel { position: relative; grid-row: 1; width: 100%; max-height: none; top: 0; }
    .writer-work { height: 150px; }
  }
  @media (max-width: 767px) {
    .writer-work { height: 140px; }
    .ai-head { padding: 12px; }
  }
  @media (max-width: 370px) {
    .ai-head { display: grid; grid-template-columns: 1fr auto; }
    .ai-head .seg { grid-row: 2; grid-column: 1/-1; width: 100%; max-width: none; }
    .ai-head > .btn { grid-column: 2; grid-row: 1; }
    .lbl { flex-wrap: wrap; }
  }
}
