/* ═══════════════════════════════════════════════════════════════
   AgencyOS — queue-approvals-v5.css
   V5 Blue: Build Queue (#viewQueue) and Approvals (#viewApprovals).
   Values copied from the reference v4.css (.pageHead, .metrics.apvMetrics,
   .panel.apvPanel, .apvRow, .qjHeader/.qjRow, .bfBadge, .apvState, .btn).
   Tokens (--st-*) are the shared V5 palette from settings-v5.css.
   ═══════════════════════════════════════════════════════════════ */
#viewQueue, #viewApprovals { background: var(--st-bg); color: var(--st-ink); font-family: var(--app-font, Inter, 'Outfit', system-ui, sans-serif); font-size: 16px; line-height: 1.55; overflow: auto; }
#viewQueue *, #viewQueue *::before, #viewQueue *::after,
#viewApprovals *, #viewApprovals *::before, #viewApprovals *::after { box-sizing: border-box; }
#viewQueue svg, #viewApprovals svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

.qa5 { width: 100%; padding: 24px; }
.qa5 h1, .qa5 h2, .qa5 p { margin: 0; }

/* page head (reference .pageHead) */
.qa5-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.qa5-eyebrow { display: inline; color: var(--st-primary); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.qa5-head h1 { margin: 0; font-size: 36px; font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
.qa5-head p { margin: 0; color: var(--st-muted); font-size: 16px; }

/* buttons (reference .btn) */
.qa5-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 14px; border: 1px solid var(--st-line); border-radius: 9px; background: var(--st-surface); color: var(--st-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; transition: border-color .15s ease, color .15s ease; }
.qa5-btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--st-primary) 50%, var(--st-line)); color: var(--st-primary); }
.qa5-btn:disabled { opacity: .55; cursor: default; }
.qa5-btn.primary { border-color: transparent; background: linear-gradient(135deg, var(--st-primary), var(--st-primary-2)); color: #fff; box-shadow: 0 10px 22px color-mix(in srgb, var(--st-primary) 26%, transparent); }
:root:not([data-theme="light"]) .qa5-btn.primary { color: #061014; }
.qa5-btn.primary:hover:not(:disabled) { color: #fff; filter: brightness(1.06); }
:root:not([data-theme="light"]) .qa5-btn.primary:hover:not(:disabled) { color: #061014; }
.qa5-btn:focus-visible { outline: 2px solid var(--st-primary); outline-offset: 2px; }

/* metric cards (reference .metrics.apvMetrics) */
.qa5-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.qa5-metrics > div { position: relative; display: grid; gap: 6px; padding: 18px 20px 18px 22px; border: 1px solid var(--st-line); border-radius: 14px; background: var(--st-surface); overflow: hidden; }
.qa5-metrics > div::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--st-primary); }
.qa5-metrics > div:nth-child(2)::before { background: var(--st-teal); }
.qa5-metrics > div:nth-child(3)::before { background: #d99a1f; }
.qa5-metrics > div:nth-child(4)::before { background: #d64545; }
.qa5-metrics span { color: var(--st-muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.qa5-metrics strong { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; letter-spacing: -.01em; }

/* panels (reference .panel.apvPanel) */
.qa5-panel { padding: 18px 20px; margin-bottom: 18px; border: 1px solid var(--st-line); border-radius: 14px; background: var(--st-surface); box-shadow: var(--st-shadow); }
.qa5-panel-head { position: relative; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.qa5-panel-head h2 { font-size: 16px; font-weight: 700; line-height: 1.2; }
.qa5-badge { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border: 1px solid var(--st-line); border-radius: 999px; background: var(--st-surface-2); color: var(--st-muted); font-size: 11px; font-weight: 700; }
.gp-summary.gp-summary { margin-left: auto; color: var(--st-muted); font-size: 12.5px; font-weight: 600; outline: 0; }

/* shared row atoms */
.qa5-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: color-mix(in srgb, var(--st-primary) 10%, var(--st-surface)); color: var(--st-primary); }
.qa5-icon.done { background: color-mix(in srgb, var(--st-teal) 12%, var(--st-surface)); color: var(--st-teal); }
.qa5-tag { justify-self: start; padding: 3px 10px; border: 1px solid var(--st-line); border-radius: 7px; background: var(--st-surface-2); color: var(--st-ink); font-size: 11.5px; font-weight: 700; line-height: normal; white-space: nowrap; }
.qa5-empty { padding: 40px; text-align: center; color: var(--st-muted); }
.qa5 .gp-empty-title { color: var(--st-ink); font-size: 15px; font-weight: 700; }
.qa5 .gp-empty-sub { margin-top: 4px; font-size: 13.5px; }
.qa5-more { padding: 12px 8px 0; color: var(--st-muted); font-size: 12.5px; }
.qa5-state { padding: 18px 20px; margin-bottom: 18px; border: 1px solid var(--st-line); border-radius: 14px; background: var(--st-surface); color: var(--st-muted); }
.qa5-error { border-color: rgba(214, 69, 69, .4); background: rgba(214, 69, 69, .06); color: #d64545; }
.qa5-error .qa5-btn { margin-left: 8px; color: var(--st-ink); }
.qa5-error details { margin-top: 8px; color: var(--st-muted); font-size: 13px; }

/* approvals rows (reference .apvRow) */
.qa5-apv-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 84px 108px 168px 92px; align-items: center; column-gap: 14px; padding: 12px 8px; border-top: 1px solid var(--st-line); }
.qa5-apv-row:hover, .qa5-qj-row:hover { background: color-mix(in srgb, var(--st-surface-2) 55%, transparent); border-radius: 10px; }
.qa5-apv-body { display: grid; gap: 2px; min-width: 0; }
.qa5-apv-body strong { font-size: 14px; }
.qa5-apv-body small { color: var(--st-muted); font-size: 12.5px; }
.qa5-version { color: var(--st-muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; text-align: left; }
.qa5-state-pill { justify-self: start; padding: 3px 10px; border: 1px solid rgba(217, 154, 31, .35); border-radius: 999px; background: rgba(217, 154, 31, .12); color: #8a5a00; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
:root:not([data-theme="light"]) .qa5-state-pill { color: #f0b84a; }
.qa5-state-pill.done { border-color: color-mix(in srgb, var(--st-teal) 32%, var(--st-line)); background: color-mix(in srgb, var(--st-teal) 12%, var(--st-surface)); color: var(--st-teal); }
.qa5-apv-row .qa5-btn, .qa5-qj-row .qa5-btn { width: 100%; min-width: 0; min-height: 36px; padding: 0 10px; font-size: 13px; }

/* queue rows (reference .qjHeader/.qjRow) */
.qa5-qj-header, .qa5-qj-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 100px 130px 92px; align-items: center; column-gap: 14px; padding: 12px 8px; }
.qa5-qj-header { padding-top: 4px; padding-bottom: 10px; margin-bottom: 2px; border-bottom: 1px solid var(--st-line); color: var(--st-muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.qa5-qj-row { border-top: 1px solid var(--st-line); }
.qa5-qj-name { display: flex; align-items: center; gap: 12px; min-width: 0; }
.qa5-qj-name strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa5-qj-project { color: var(--st-muted); font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa5-qj-state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; }
.qa5-qj-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--st-muted); }
.qa5-qj-state.running { color: var(--st-primary); }
.qa5-qj-state.running i { background: var(--st-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--st-primary) 18%, transparent); animation: qa5Pulse 1.4s ease-in-out infinite; }
.qa5-qj-state.queued { color: #8a5a00; }
.qa5-qj-state.queued i { background: #d99a1f; }
:root:not([data-theme="light"]) .qa5-qj-state.queued { color: #f0b84a; }
.qa5-qj-state.completed { color: var(--st-teal); }
.qa5-qj-state.completed i { background: var(--st-teal); }
.qa5-qj-state.failed { color: #d64545; }
.qa5-qj-state.failed i { background: #d64545; }
@keyframes qa5Pulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--st-primary) 0%, transparent); } }
@media (prefers-reduced-motion: reduce) { .qa5-qj-state.running i { animation: none; } }

@media (max-width: 1000px) {
  .qa5-apv-row { grid-template-columns: 40px minmax(0, 1fr) 92px; }
  .qa5-apv-row > .qa5-tag, .qa5-apv-row > .qa5-version, .qa5-apv-row > .qa5-state-pill { display: none; }
  .qa5-qj-header { display: none; }
  .qa5-qj-row { grid-template-columns: minmax(0, 1fr) 100px 92px; }
  .qa5-qj-project, .qa5-qj-row > .qa5-tag { display: none; }
}
@media (max-width: 640px) {
  .qa5 { padding: 16px; }
  .qa5-head { flex-direction: column; gap: 14px; }
  .qa5-head h1 { font-size: 30px; }
  .qa5-panel-head { flex-wrap: wrap; }
  .gp-summary.gp-summary { margin-left: 0; flex-basis: 100%; }
}

/* refresh control lives in the panel head (reference pageHead carries no actions); the summary is screen-reader only */
.qa5-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.qa5-panel-head .qa5-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 92px; min-height: 36px; margin: 0; padding: 0 10px; font-size: 13px; }
.qa5-empty-actions { display: flex; justify-content: center; padding-bottom: 24px; }
.qa5-panel-head h2 { letter-spacing: -.015em; }

/* Build Queue loading shell: the real page layout with shimmer in place of data (see renderQueue) */
.qa5-loading { display: block; }
.qa5-loading .sk { max-width: 100%; }
.qa5-loading .qa5-panel-head .qa5-btn { margin-left: auto; }
.qa5-qj-skel .sk { justify-self: start; }
.qa5-qj-skel .qa5-qj-name .sk:last-child { flex: 1 1 auto; }
