/* ==========================================================================
   Orblivion: "Watch a live agent" on the agents page (web/showcase.js), around web/agent-dashboard.css.
   The page's own tokens (/docs/docs.css) and controls (hosted-page.css: .btn, .btn-link): nothing new to theme.
   ========================================================================== */

.sc[hidden] { display: none; }
.sc {
  margin: 0 0 22px; padding: 18px 20px 20px; min-width: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--live) 6%, transparent), 0 18px 48px -32px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* the head: what this is on the left, its facts and freshness on the right */
.sc-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 24px; margin: 0 0 10px; }
.sc-title { min-width: 0; }
.sc-eyebrow {
  display: flex; align-items: center; gap: 8px; margin: 0 0 4px;
  font: 500 11px var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--live);
}
.sc-pulse { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.sc-pulse.on { background: var(--up); }
.sc-pulse.on::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--up); opacity: 0;
  animation: sc-ping 2.4s ease-out infinite;
}
@keyframes sc-ping { 0% { transform: scale(0.6); opacity: 0.7; } 80%, 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sc-pulse.on::after { animation: none; } }
.sc-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.sc h2.sc-name { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.005em; line-height: 1.3; }
.sc .db-top { display: none; }          /* its name and status are in the panel's head */
/* and so are its status and countdown: the side card keeps where its funds are */
.sc .db-side .db-kv dt:has(+ dd > .db-st), .sc .db-side .db-kv dd:has(> .db-st),
.sc .db-side .db-kv dt:has(+ dd > .db-next), .sc .db-side .db-kv dd:has(> .db-next) { display: none; }
.sc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; min-width: 0; }
.sc-facts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin: 0; padding: 0; list-style: none; }
.sc-fact {
  padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 999px; white-space: nowrap;
  font: 600 10.5px/1.7 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2);
}
.sc-fact-live { color: var(--up); border-color: color-mix(in srgb, var(--up) 45%, transparent); background: var(--up-soft); }
.sc-tools { display: flex; align-items: center; gap: 14px; }
.sc-fresh { display: flex; align-items: center; gap: 6px; margin: 0; font: 12px var(--mono); color: var(--text-3); }
.sc-fresh .sc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); }
.sc-fresh.stale { color: var(--amber); }
.sc-fresh.stale .sc-dot { background: var(--amber); }

.sc-lead { margin: 0 0 14px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }
.sc-lead strong { color: var(--text); font-weight: 600; }
.sc-addr { font: 13px var(--mono); }
.sc a { color: var(--accent-bright); }
/* its call to action: the page's buttons, whatever colour the panel's (and the dashboard's) links take */
.sc a.btn { color: var(--text); }
.sc a.btn-primary, .sc a.btn-primary:hover { color: var(--btn-primary-ink); }

/* the dashboard: three columns on a wide panel (portfolio, activity, and its funds, strategy and what to do next), so it
   fits one screen; the dashboard's own two- and one-column layouts below that */
.sc-body { container-type: inline-size; min-width: 0; }
.sc-strat { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sc .db-side .sc-strat h3 { margin-bottom: 10px; }
.sc-fact-ai { color: var(--accent-bright); border-color: var(--accent-line); }
/* an AI agent's instructions: folded, as plain text with its line breaks */
.sc-instr { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.sc-instr summary { padding: 8px 10px; cursor: pointer; font: 600 13px var(--font); color: var(--text); }
.sc-instr summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sc-instr-note { margin: 0; padding: 0 10px 8px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.sc-instr-text {
  margin: 0; padding: 8px 10px 10px; max-height: 320px; overflow: auto; border-top: 1px solid var(--line);
  font: 12px/1.55 var(--mono); color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere;
}
.sc .sc-cta-side { display: none; }
@container (min-width: 1040px) {
  .sc .db-grid { grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr) 280px; grid-template-areas: "port feed side"; gap: 14px; }
  .sc .db-side { position: static; }
  .sc .db-list { max-height: 452px; }
  .sc .db-big { font-size: 26px; }
  .sc .db-fig { margin-bottom: 8px; }
  /* holdings and allocation side by side, the allocation small: two tokens read at a glance */
  .sc .db-hold { grid-template-columns: minmax(0, 1fr) 112px; gap: 12px; }
  .sc .db-donut { flex-direction: column; align-items: flex-start; gap: 8px; }
  .sc .db-donut-svg { width: 64px; height: 64px; }
  .sc .db-tbl th:nth-child(5), .sc .db-tbl td:nth-child(5) { display: none; }
  .sc .sc-cta-side { display: block; }
  .sc .sc-cta-bottom { display: none; }
}
@container (min-width: 821px) and (max-width: 1039px) {
  .sc .db-list { max-height: 420px; }
}
@container (max-width: 820px) {
  .sc .db-list { max-height: 380px; }
}

/* what to do next: under the dashboard, or in its side column when that is beside it */
.sc-cta {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  margin-top: 16px; padding: 14px 16px; border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.sc-cta-text { flex: 1 1 420px; min-width: 0; }
.sc-cta-h { margin: 0 0 2px; font-size: 15px; font-weight: 600; color: var(--text); }
.sc-cta p { margin: 0; font-size: 14px; color: var(--text-2); }
.sc-cta p.sc-cta-h { color: var(--text); }
.sc-cta-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.sc .db-side .sc-cta-side { margin-top: 14px; padding: 12px; }
.sc .db-side .sc-cta-side .sc-cta-text { flex-basis: auto; }
.sc .db-side .sc-cta-side h3.sc-cta-h {
  margin: 0 0 4px; font: 600 14.5px var(--font); letter-spacing: 0; text-transform: none; color: var(--text);
}
.sc .db-side .sc-cta-side p { font-size: 13px; line-height: 1.5; }
.sc .db-side .sc-cta-side .sc-cta-btns { width: 100%; margin-top: 10px; }
.sc .db-side .sc-cta-side .btn { flex: 1 1 0; }

@media (max-width: 760px) {
  .sc-side { align-items: flex-start; width: 100%; }
  .sc-facts { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .sc { padding: 14px 12px 16px; }
  .sc h2.sc-name { font-size: 18px; }
  .sc-lead { font-size: 14px; }
  .sc-cta { padding: 12px; }
  .sc-cta-btns { width: 100%; }
  .sc-cta-btns .btn { flex: 1 1 140px; }
}
