/* Orblivion: a hosted agent's live dashboard (web/agent-dashboard.js), on the agents page and in the trading wallet.
   Only the pages' own theme tokens: --surface(-2, -3), --line(-strong), --text(-2, -3), --accent(-soft, -line), --up,
   --down, --amber, --focus, --font, --mono. Measured on itself (a container), so it fits a wide page or a step panel. */

.db { container-type: inline-size; min-width: 0; }
.db-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
.db-name { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.db-back { min-height: 34px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent;
  color: var(--text); font: 500 13px var(--font); cursor: pointer; }
.db-back:hover { border-color: var(--accent-line); }
.db-back:focus-visible, .db-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.db-chip { padding: 1px 8px; border-radius: 999px; font: 600 10.5px/1.75 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2); background: var(--surface-3); }
.db-chip.live { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.db-st { font-weight: 600; }
.db-st.ok { color: var(--up); }
.db-st.warn { color: var(--amber); }
.db-st.off { color: var(--text-3); }
.db-sub { color: var(--text-2); font: 500 13px var(--mono); }
.db-mono { font-family: var(--mono); }
.db-src { display: block; color: var(--text-3); font-size: 11.5px; }
.db-warn { color: var(--amber); }

/* the grid: portfolio over the feed, the funds beside them; one column when narrow */
.db-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "port side" "feed side"; gap: 16px; align-items: start; }
.db-port { grid-area: port; }
.db-feed { grid-area: feed; }
.db-side { grid-area: side; position: sticky; top: 84px; }
@container (max-width: 820px) {
  .db-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "side" "port" "feed"; }
  .db-side { position: static; }
}
.db-card { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); min-width: 0; }
.db-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 0 0 10px; }
.db-head h3, .db-side h3 { margin: 0; font: 600 11px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-2); }
.db-side h3 { margin-bottom: 10px; }
.db-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.db-tab { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent;
  color: var(--text-2); font: 500 12.5px var(--font); cursor: pointer; }
.db-tab:hover { border-color: var(--accent-line); }
.db-tab.on { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.db-empty { margin: 8px 0; color: var(--text-3); font-size: 13.5px; }

/* portfolio */
.db-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.db-big { font-size: 28px; font-weight: 600; letter-spacing: -0.01em; }
.db-chg { font-size: 14px; color: var(--text-2); }
.db-chg.up { color: var(--up); }
.db-chg.down { color: var(--down); }
.db-note { margin: 2px 0 8px; color: var(--text-3); font-size: 12.5px; }
.db-pnl { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.db-big.db-wait { font-size: 18px; color: var(--text-2); letter-spacing: 0; }
.db-fig { margin: 4px 0 12px; }
.db-chart { display: block; width: 100%; height: auto; }
.db-cap { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font: 11.5px var(--mono); color: var(--text-3); }
.db-cap-mid { text-align: center; }
@container (max-width: 480px) { .db-cap { flex-wrap: wrap; } .db-cap-mid { order: 3; flex-basis: 100%; } }
.db-chart-empty { padding: 28px 0; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.db-gl { stroke: var(--line); stroke-width: 1; }
.db-axis { fill: var(--text-3); font: 11px var(--mono); }
.db-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.db-area { fill: var(--accent-soft); stroke: none; }
.db-buy { fill: var(--up); stroke: var(--surface); stroke-width: 1; }
.db-sell { fill: var(--down); stroke: var(--surface); stroke-width: 1; }
.db-hold { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 16px; align-items: start; }
@container (max-width: 560px) { .db-hold { grid-template-columns: minmax(0, 1fr); } }
/* a phone: the share column goes (the allocation beside it shows the same) */
@container (max-width: 480px) { .db-tbl th:nth-child(5), .db-tbl td:nth-child(5) { display: none; } .db-tbl { font-size: 13px; } }
.db-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.db-tbl th { padding: 0 0 6px; text-align: left; font: 500 10.5px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.db-tbl td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: top; }
.db-tbl .num { text-align: right; padding-left: 10px; }
.db-donut { display: flex; align-items: center; gap: 12px; margin: 0; }
.db-donut-svg { width: 96px; height: 96px; flex: none; }
.db-ring { fill: none; stroke: var(--surface-3); stroke-width: 16; }
.db-seg { fill: none; stroke-width: 16; }
.db-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 12.5px; min-width: 0; }
.db-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.db-sw { width: 10px; height: 10px; border-radius: 3px; }
.db-c0 { stroke: var(--accent); background: var(--accent); }
.db-c1 { stroke: var(--up); background: var(--up); }
.db-c2 { stroke: var(--amber); background: var(--amber); }
.db-c3 { stroke: var(--down); background: var(--down); }
.db-c4 { stroke: var(--text-2); background: var(--text-2); }
.db-c5 { stroke: var(--text-3); background: var(--text-3); }

/* the feed: newest first, scrolling inside its card */
.db-list { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 8px; max-height: min(70vh, 720px); overflow: auto; }
.db-row { padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.db-row.k-trade { border-left-color: var(--up); }
.db-row.k-problem { border-left-color: var(--amber); }
.db-row.k-decision { border-left-color: var(--accent-line); }
.db-row p { margin: 4px 0 0; }
.db-row-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.db-t { font: 12px var(--mono); color: var(--text-3); }
.db-kind { padding: 0 7px; border-radius: 999px; font: 600 10px/1.8 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-2); background: var(--surface-3); }
.db-kind.k-trade { color: var(--up); background: color-mix(in srgb, var(--up) 14%, transparent); }
.db-kind.k-problem { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.db-mode { font: 11px var(--mono); color: var(--text-3); }
.db-dec { color: var(--text); overflow-wrap: anywhere; }
.db-px, .db-ai { color: var(--text-2); font: 12px var(--mono); overflow-wrap: anywhere; white-space: pre-wrap; }
/* a model's own words (a visitor's view of an AI agent the team opted in): set apart and labelled */
.db-aiw { margin: 6px 0 2px; padding: 8px 10px; border-left: 3px solid var(--accent-line); border-radius: 0 var(--radius-sm, 6px) var(--radius-sm, 6px) 0;
  background: var(--surface-2); }
.db-aiw-label { margin: 0 0 4px; font: 600 10.5px/1.6 var(--mono); letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.db-aiw-text { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-line; }
.db-aiw-orders { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.db-prob { overflow-wrap: anywhere; }
.db-prob code, .db-failed code { font: 12px var(--mono); color: var(--amber); }
.db-failed { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; }
.db-ev { color: var(--text-2); }
.db-pipe { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.db-pipe li { display: grid; grid-template-columns: 12px 92px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.db-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); transform: translateY(-1px); }
.db-pipe li.ok .db-dot { background: var(--up); }
.db-pipe li.wait .db-dot { background: var(--amber); }
.db-step { font-weight: 600; font-size: 12.5px; }
.db-sd { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.db a { color: var(--accent); }

/* where its funds are */
.db-kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 12px; margin: 0; font-size: 13.5px; }
.db-kv dt { color: var(--text-3); }
.db-kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* its session's budget, when it runs low or is used up: a sentence and the owner's button */
.db-budget { margin: 12px 0 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent); border-radius: 10px;
  background: color-mix(in srgb, var(--amber) 9%, transparent); }
.db-budget-t { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--text); }
.db-topup { min-height: 36px; padding: 0 16px; border: 1px solid var(--accent); border-radius: 999px; background: var(--surface);
  color: var(--text); font: 600 13px var(--font); cursor: pointer; }
.db-topup:hover { background: var(--surface-2); }
.db-topup:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.db-topup[disabled] { opacity: 0.6; cursor: progress; }
@container (max-width: 380px) {
  .db-pipe li { grid-template-columns: 12px minmax(0, 1fr); }
  .db-pipe .db-sd { grid-column: 2; }
  .db-big { font-size: 24px; }
}
