/* work.js: the #/work/<venture> page as the manager app's Goals scoreboard
 * — the head (venture name and status chip, Updated and Reload), the count
 * tiles, then List: the rows (workrow.css), or Cards: the goal cards
 * (workrow.css). The filter bar is workfilter.css; the detail a row or card
 * opens (the story and the milestone and task rows) is workstory.css.
 * Pills, faces, chat chips and the KPI bar: plandetail.css, trackcard.css
 * and track.css. Tokens only. */

.transcript:has(> .work-page) { --reading: 76rem; }

/* ---- the head ---- */
.work-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sv-space-2) var(--sv-space-4); }
.work-head > .plan-back { flex: 0 0 100%; justify-content: flex-start; margin-left: 0; }
.work-titles { display: grid; gap: 6px; min-width: 0; }
.work-name { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sv-space-2); margin: 0; font-size: var(--sv-text-h3); font-weight: 600; line-height: 1.2; }
.work-name.work-bone { width: 16rem; height: 1.5rem; background: var(--sv-surface-sunken); border-radius: 4px; animation: sv-breathe var(--pulse) ease-in-out infinite; }
.work-status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; background: var(--sv-surface-sunken); color: var(--sv-ink-secondary); font-size: var(--ui-meta); font-weight: 500; }
.work-status-chip[data-tone="good"] { background: color-mix(in srgb, var(--ws-working) 14%, transparent); color: var(--ws-working-ink); }
.work-status-chip[data-tone="bad"] { background: color-mix(in srgb, var(--sv-danger) 12%, transparent); color: var(--sv-danger); }
.work-status-chip[data-tone="review"] { background: color-mix(in srgb, var(--sv-attention) 14%, transparent); color: var(--sv-attention); }
.work-venture { justify-self: start; max-width: 100%; min-height: 40px; padding: 0 var(--sv-space-3); font-size: var(--sv-text-h4); font-weight: 600; }
.work-sync { display: flex; align-items: center; gap: var(--sv-space-2); color: var(--sv-ink-tertiary); font-size: var(--ui-meta); }
.work-reload { min-height: 32px; padding: 0 var(--sv-space-3); }
.work-graph-link { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sv-space-3); }
.work-page.busy .work-updated { animation: sv-breathe var(--pulse) ease-in-out infinite; }
.work-page.busy .work-reload .icon { animation: work-turn 1s linear infinite; }
@keyframes work-turn { to { transform: rotate(360deg); } }

/* ---- the count tiles ---- */
.work-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--sv-space-2); margin: var(--sv-space-3) 0 0; }
.work-tile { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--sv-space-2) var(--sv-space-3); border: var(--sv-hairline-w) solid var(--sv-hairline); border-radius: var(--sv-radius); background: var(--sv-surface-raised); }
.work-tile-label { color: var(--sv-ink-tertiary); font-size: var(--ui-meta); font-weight: 500; letter-spacing: var(--sv-tracking-caps); text-transform: uppercase; }
.work-tile-value { font-size: var(--sv-text-h4); font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.work-tile-sub { color: var(--sv-ink-tertiary); font-size: var(--ui-meta); overflow-wrap: anywhere; }

/* ---- loading, and a failed read ---- */
.work-reading { display: grid; gap: var(--sv-space-3); margin-top: var(--sv-space-3); }
.work-ghost { display: grid; gap: 10px; padding: var(--sv-space-4); border: var(--sv-hairline-w) solid var(--sv-hairline); border-radius: calc(var(--sv-radius) * 1.5); background: var(--sv-surface-raised); }
.work-failed { display: grid; justify-items: start; gap: var(--sv-space-2); margin-top: var(--sv-space-3); }
.work-failed > p { margin: 0; max-width: 60ch; overflow-wrap: anywhere; }
.work-retry { min-height: 44px; padding: 0 var(--sv-space-3); }

/* ---- phone ---- */
@media (max-width: 640px) {
  .work-venture, .work-reload, .work-graph-link { min-height: 44px; }
  .work-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Loading and deep-link notices for the central Work dashboard. */
.plan-bone { display: block; height: 0.75rem; border-radius: 4px; background: var(--sv-surface-sunken); animation: sv-breathe var(--pulse) ease-in-out infinite; }
.plan-bone.short { width: 30%; }
.plan-bone.half { width: 55%; }
.plan-notice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sv-space-2); margin: 0; padding: var(--sv-space-2) var(--sv-space-3); border-radius: var(--sv-radius); background: var(--sv-surface-sunken); color: var(--sv-ink-secondary); font-size: var(--ui-meta); }
.plan-notice[hidden] { display: none; }

.plan-back[hidden] { display: none; }
.plan-back { display: inline-flex; justify-self: start; align-self: flex-start; margin-left: calc(-1 * var(--sv-space-2)); align-items: center; gap: 6px; min-height: 32px; padding: 0 var(--sv-space-2); color: var(--sv-ink-secondary); font-size: var(--ui-meta); text-decoration: none; }
.plan-back .icon { width: 14px; height: 14px; }
@media (max-width: 760px) { .plan-back { min-width: 44px; min-height: 44px; } .plan-chat { min-height: 32px; max-width: 100%; } }
