/* Client overview: the latest report as a large, scrollable document, with the
   review history in a side panel. Loaded only on the overview area. */

.client-overview-head { align-items: center; }
.client-overview-head h1 { margin: 0; }
.client-overview-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.client-overview-meta b { color: var(--ink); font-weight: 500; }
.client-overview-meta a { color: var(--text-2); border-bottom: 1px solid var(--line); }
.client-overview-meta a:hover { color: var(--ink); border-color: var(--ink); }
.client-overview-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.client-overview-actions .subtle-count { margin-left: 2px; }

/* ---------- Report viewer ---------------------------------------------- */
.client-report { --client-report-top: 0px; margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.client-report-bar {
  position: sticky; top: var(--client-report-top); z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: 16px 22px; background: var(--surface); border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}
.client-report.is-earlier .client-report-bar { box-shadow: inset 0 3px 0 var(--warn); }
.client-report-heading { min-width: 0; }
.client-report-title { margin-top: 4px; font-size: 22px; letter-spacing: -.5px; }
.client-report-title a { color: var(--ink); }
.client-report-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.client-report-title span { margin-left: 4px; font-weight: 400; color: var(--muted); }
.client-report-meta { margin-top: 2px; font-size: 12.5px; }
.client-report-meta .ws-pill { margin-left: 6px; }
.client-report-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.client-report-count { margin-right: 6px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.client-report-count[hidden] { display: none; }

.client-report-note { padding: 11px 22px; font-size: 13px; color: var(--ink); border-bottom: 1px solid var(--line); background: var(--warn-bg); }
.client-report-note a { margin-left: 4px; color: var(--warn); font-weight: 500; }
.client-report-note a:hover { text-decoration: underline; text-underline-offset: 3px; }

.client-report-pages {
  display: flex; flex-direction: column; align-items: center; gap: 22px;
  min-height: 320px; padding: 28px 24px 36px; background: var(--bg-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.client-report-page {
  position: relative; width: min(100%, 900px); background: #fff;
  box-shadow: 0 1px 2px rgba(10, 26, 29, .08), 0 18px 40px -22px rgba(10, 26, 29, .45);
}
.client-report-page canvas { display: block; width: 100%; height: 100%; }
.client-report-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.client-report-status { margin: auto 0; padding: 40px 12px; text-align: center; font-size: 14px; color: var(--muted); }
.client-report-status[hidden] { display: none; }
.client-report-status a { color: var(--ink); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.client-report-empty { padding: 34px; }
.client-report-empty h2 { margin-top: 8px; }
.client-report-empty p:last-child { margin-top: 8px; }

/* ---------- History panel ---------------------------------------------- */
.client-history {
  margin: 0 0 0 auto; width: min(440px, 100vw); height: 100vh; max-height: 100vh; max-width: 100vw;
  padding: 0; border: 0; border-left: 1px solid var(--line);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
.client-history::backdrop { background: rgba(10, 26, 29, .3); }
.client-history[open] { display: flex; flex-direction: column; animation: client-history-in .2s ease-out; }
@keyframes client-history-in { from { transform: translateX(24px); opacity: 0; } }
.client-history-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 26px 26px 18px; border-bottom: 1px solid var(--line); }
.client-history-head h2 { margin-top: 4px; font-size: 22px; }
.client-history-close { flex: none; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); font-size: 20px; line-height: 1; }
.client-history-close:hover { border-color: var(--ink); }
.client-history-list { flex: 1; overflow-y: auto; margin: 0; padding: 8px 14px; list-style: none; }
.client-history-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 12px; font-size: 13px; }
.client-history-item + .client-history-item { border-top: 1px solid var(--line); }
.client-history-item.is-current { background: var(--surface-2); border-radius: 8px; }
.client-history-body time, .client-history-body > span:first-child { display: block; font-size: 11.5px; color: var(--muted); }
.client-history-title { display: inline-block; margin-top: 2px; font-weight: 500; color: var(--ink); }
.client-history-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.client-history-latest { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: var(--ink); color: var(--surface); font-size: 10.5px; font-weight: 500; vertical-align: 1px; }
.client-history-body small { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
.client-history-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-history-dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 1.5px solid var(--border-strong); }
.client-history-item.is-ready .client-history-dot { background: var(--ink); border-color: var(--ink); }
.client-history-item.is-queued .client-history-dot, .client-history-item.is-running .client-history-dot, .client-history-item.is-waiting_provider .client-history-dot { border-color: var(--ink); border-top-color: transparent; animation: client-history-spin 1.1s linear infinite; }
.client-history-item.is-failed .client-history-dot, .client-history-item.is-cancelled .client-history-dot { border-color: var(--warn); }
@keyframes client-history-spin { to { transform: rotate(360deg); } }
.client-history-actions { display: flex; align-items: center; gap: 14px; padding-top: 14px; font-size: 13px; }
.client-history-actions a { font-weight: 500; color: var(--ink); }
.client-history-actions a:hover { text-decoration: underline; text-underline-offset: 3px; }
.client-history-foot { padding: 16px 26px 22px; border-top: 1px solid var(--line); font-size: 13px; }
.client-history-foot a { font-weight: 500; color: var(--text-2); }
.client-history-foot a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .client-history[open] { animation: none; }
  .client-history-item .client-history-dot { animation: none !important; }
}

/* The workspace top bar becomes sticky at this width; the report bar sits under it. */
@media (max-width: 800px) {
  .client-report { --client-report-top: 62px; }
  .client-report-count { display: none; }
}
@media (max-width: 640px) {
  .client-overview-actions { width: 100%; }
  .client-overview-actions > * { flex: 1; }
  .client-report-bar { padding: 14px 16px; }
  .client-report-tools { width: 100%; }
  .client-report-tools .button { flex: 1 1 auto; padding-left: 12px; padding-right: 12px; }
  .client-report-pages { padding: 14px 10px 20px; gap: 12px; }
  .client-report-note { padding: 11px 16px; }
}
