/* Products round (docs/PRODUCTS.md): styles owned by WEB-AGENTS — agent sandboxes and snapshots, the Model API,
 * CI runners and their shared pieces (js/agents-common.js). Class prefix: ag-. No inline styles (CSP). */

/* ------------------------------------------------------------------------------- shared */
.ag-page .wl-panel > .panel-content { gap: 14px; }
.ag-plan-line { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: #45536a; margin: 0; line-height: 1.5; }
.ag-plan-line .icon { color: var(--brand); margin-top: 1px; }
.ag-plan-line > span { min-width: 0; }
.ag-plan-line.full { color: var(--warn-text); }
.ag-plan-line.full .icon { color: #b8860b; }
.ag-toolbar { align-items: center; }
.ag-filters { align-items: center; }
.ag-label-filter { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ag-label-filter .field { width: 190px; max-width: 100%; }
.ag-copy-id { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.ag-copy-id code { font-size: 11px; overflow-wrap: anywhere; }
.ag-copy-id .btn { padding: 3px 5px; min-height: 24px; }
.data-table td .ag-copy-id { display: flex; margin-top: 2px; }
.ag-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.ag-label { font-family: var(--mono); font-weight: 600; font-size: 10.5px; max-width: 220px; }
.ag-label-v { color: #7b8698; font-weight: 500; }
.ag-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 4px; }
.ag-head { align-items: flex-start; gap: 12px 18px; }
.ag-head-main { min-width: 0; flex: 1 1 320px; }
.ag-head .rental-actions { margin-top: 0; justify-content: flex-end; }
.ag-dd-sub { display: block; font: 500 11px/1.4 "DM Sans", sans-serif; letter-spacing: 0; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.ag-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 4px 0 0; }
.ag-section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-width: 0; }
.ag-section .sub-title, .ag-sub-head .sub-title { margin: 0; }
.ag-sub-head { gap: 10px; }
.ag-details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px 26px; }
.ag-details-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ag-details-grid > section { min-width: 0; }
.ag-details-grid .sub-title { margin-top: 0; }
.ag-tight-note { margin-top: -6px; }
.ag-form-head { display: grid; gap: 6px; }
.ag-form-head .wl-h2 .icon { color: var(--brand); }
.ag-quickstart { display: grid; gap: 8px; }
.ag-quickstart .sub-title { margin: 6px 0 0; }
.ag-waiting { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: #3f4b5c; background: #f5f8fb; border: 1px dashed #d4dde7; border-radius: 10px; padding: 12px 14px; }
.ag-waiting .spin { width: 14px; height: 14px; flex: none; }

/* details/summary used for "Options" and "More options" */
.ag-more { border: 1px solid var(--border); border-radius: 10px; background: #fbfcfd; }
.ag-more > summary { cursor: pointer; padding: 9px 12px; font-size: 12.5px; font-weight: 800; color: #45536a; list-style: none; display: flex; align-items: center; gap: 6px; }
.ag-more > summary::-webkit-details-marker { display: none; }
.ag-more > summary::before { content: "▸"; font-size: 11px; color: #7b8698; transition: transform 0.15s ease; }
.ag-more[open] > summary::before { transform: rotate(90deg); }
.ag-more > summary:focus-visible { outline-offset: -2px; border-radius: 10px; }
.ag-more-body { padding: 4px 12px 12px; display: grid; gap: 12px; }

/* tabbed code samples */
.ag-snippets { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-width: 0; } /* long code lines scroll inside, never widen the page */
.ag-snippet-tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.ag-snippet-tab { border: 1px solid transparent; border-bottom: 0; background: transparent; color: #5b6779; font-size: 12px; font-weight: 800; padding: 7px 11px; border-radius: 8px 8px 0 0; }
.ag-snippet-tab:hover { color: var(--ink); background: #f2f5f8; }
.ag-snippet-tab.active { background: #0f1a29; color: #e3eaf2; }
.ag-snippet-panel .code-block { margin-top: 0; border-top-left-radius: 0; }
.ag-snippet-panel .note { margin-top: 4px; }
/* "From code" boxes on product pages (codeDetails) */
.code-details { margin-top: 14px; min-width: 0; }
.code-details .ag-snippets { margin-top: 2px; }

/* tables that become cards on phones (cells carry data-label) */
.ag-table td .table-btns { justify-content: flex-end; flex-wrap: nowrap; }
.ag-table td code { overflow-wrap: anywhere; }
.ag-op-summary { display: block; margin-top: 2px; max-width: 460px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
.ag-actions-cell { white-space: nowrap; }

/* ---------------------------------------------------------------------- sandbox page */
.ag-detail-tabs { padding: 0; margin: 2px 0 0; }
.ag-tab-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; min-width: 0; }
.ag-tab-panel > .dash-note { margin-bottom: 0; }
.ag-page .dash-note { margin-bottom: 0; }

.ag-console-form { display: grid; gap: 8px; }
.ag-console-label { font-size: 11.5px; color: #45536a; font-weight: 800; }
.ag-cmd-row { display: flex; align-items: stretch; gap: 8px; }
.ag-cmd-row .field { flex: 1 1 auto; min-width: 0; font-size: 13px !important; }
.ag-prompt { display: grid; place-items: center; padding: 0 10px; border-radius: 8px; background: #0f1a29; color: var(--lime); font: 700 14px var(--mono); }
.ag-console-form .note { margin: 0; }
.ag-output { display: grid; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fbfcfd; min-width: 0; }
.ag-output-empty { display: flex; align-items: center; gap: 6px; margin: 0; }
.ag-output-head { gap: 8px; }
.ag-output-title { min-width: 0; flex: 1 1 260px; }
.ag-cmd { background: transparent; padding: 0; font-size: 13px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.ag-output-facts { margin: 0; }
.ag-output .dash-note { margin: 0; }
.ag-panes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ag-pane { min-width: 0; }
.ag-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font: 800 10.5px/1.4 "DM Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.09em; color: #45536a; margin-bottom: 4px; min-height: 26px; }
.ag-pane.err .ag-pane-head { color: #8f302c; }
.ag-out { min-height: 48px; max-height: 380px; }
.ag-pane.err .ag-out { box-shadow: inset 3px 0 0 #c4524c; }
.ag-empty-out { color: #7d8ba0; font-style: italic; }
.ag-ops { display: grid; gap: 8px; }

.ag-files-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.ag-crumbs { margin: 0; min-width: 0; }
.ag-crumbs .crumb { border: 0; background: transparent; font: inherit; font-weight: 700; font-family: var(--mono); font-size: 12.5px; cursor: pointer; }
.ag-crumbs .crumb[aria-current] { color: var(--ink); background: #eef2f6; }
.ag-files-actions { justify-content: flex-end; }
.ag-goto { display: flex; gap: 6px; }
.ag-goto .field { flex: 1 1 auto; min-width: 0; max-width: 520px; }
.ag-file-name { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; text-align: left; }
.ag-file-name .icon { color: #7fa85b; }
button.ag-file-name { text-decoration: none; }
button.ag-file-name:hover { text-decoration: underline; }
.ag-file-view { max-height: 70vh; }
.ag-connect-card { max-width: 620px; }
.ag-snap-kv { margin-top: 4px; }

/* ------------------------------------------------------------------------ Model API */
.ag-base { margin: 0; }
.ag-playground { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.ag-chat-col { display: grid; gap: 10px; min-width: 0; }
.ag-chat { display: grid; gap: 10px; align-content: start; min-height: 240px; max-height: 62vh; overflow-y: auto; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #fbfcfd; }
.ag-chat-empty { display: flex; align-items: center; gap: 6px; margin: auto 0; }
.ag-msg { max-width: 88%; border-radius: 12px; padding: 9px 12px; display: grid; gap: 4px; min-width: 0; }
.ag-msg.user { justify-self: end; background: #e9f1fb; color: #1d3550; }
.ag-msg.assistant { justify-self: start; background: #fff; border: 1px solid #e3e9ef; }
.ag-msg.pending { border-style: dashed; background: transparent; padding: 0; border: 0; max-width: 100%; }
.ag-msg-role { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #6a7587; }
.ag-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
.ag-turn-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 11px; color: var(--muted); margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.ag-chat-error { margin: 0; }
.ag-chat-form { display: grid; gap: 8px; }
.ag-chat-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ag-chat-side { display: grid; gap: 12px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; min-width: 0; }
.ag-chat-side .sub-title { margin: 4px 0 0; }
.ag-chat-side .note { margin: 0; }
.ag-session > div { grid-template-columns: 80px minmax(0, 1fr); }
.ag-usage-cards { margin-bottom: 4px; }
.ag-day-bar { width: 90px; }

/* ------------------------------------------------------------------------- CI runners */
.ag-wizard { gap: 0; }
.ag-step { display: grid; gap: 12px; padding: 16px 0; border-top: 1px solid #eef1f5; }
.ag-step:first-of-type { border-top: 0; padding-top: 4px; }
.ag-step-title { display: flex; align-items: center; gap: 10px; font-size: 16px; letter-spacing: -0.02em; }
.ag-step-num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--navy); color: var(--lime); font: 700 13px "Space Grotesk", sans-serif; flex: none; }
.ag-wizard > .dash-note, .ag-wizard > .form-actions, .ag-wizard > .note { margin-top: 12px; }
.ag-steps { padding-left: 20px; display: grid; gap: 7px; font-size: 12.5px; color: #3f4b5c; line-height: 1.6; }
.ag-steps li::marker { font-weight: 800; color: var(--brand); }
.ag-secret { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; vertical-align: middle; max-width: 100%; }
.ag-secret code { font-size: 12px; background: #f0f3f6; }
.ag-secret-panel { display: grid; gap: 10px; border: 1px solid var(--warn-border); background: #fffdf6; border-radius: 12px; padding: 16px 18px; }
.ag-secret-panel .sub-title { margin: 0; display: flex; align-items: center; gap: 6px; }
.ag-secret-panel .form-actions { margin-top: 4px; }
.ag-public-risk { display: grid; gap: 8px; border-radius: 12px; }
.ag-public-risk.attention { outline: 2px solid var(--danger); outline-offset: 4px; }
.ag-warnings ul { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 4px; }

/* ------------------------------------------------- rentals page: product rentals (rentals.js) */
.product-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.product-line .icon { color: #2f5ea8; }
.workers-toggle { padding: 0; white-space: nowrap; }

/* ------------------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .ag-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .ag-playground { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .ag-details-grid.two { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 630px) {
  .ag-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-head .rental-actions { justify-content: flex-start; }
  .ag-head .rental-actions .btn { flex: 1 1 auto; justify-content: center; }
  .ag-label-filter { width: 100%; }
  .ag-label-filter .field { flex: 1 1 auto; width: auto; }
  .ag-files-actions { justify-content: flex-start; }
  .ag-cmd-row .btn { padding-left: 12px; padding-right: 12px; }
  .ag-chat { max-height: 55vh; }
  .ag-msg { max-width: 96%; }
  .ag-secret-panel { padding: 14px; }

  /* tables → one card per row; each cell shows its column name */
  .ag-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .ag-table, .ag-table tbody, .ag-table tr, .ag-table td { display: block; width: 100%; }
  .ag-table tr { border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; margin-bottom: 10px; background: #fff; }
  .ag-table tr.current-row { border-color: #a9cd90; }
  .ag-table tr:hover td { background: transparent; }
  .data-table.ag-table td { border-top: 0; padding: 5px 0 5px 104px; position: relative; text-align: left !important; white-space: normal; min-height: 28px; }
  .ag-table td[data-label]::before { content: attr(data-label); position: absolute; left: 0; top: 7px; width: 96px; font: 800 9.5px/1.4 "DM Sans", sans-serif; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
  .data-table.ag-table td.ag-actions-cell, .data-table.ag-table td:not([data-label]) { padding-left: 0; padding-top: 8px; }
  .ag-table td .table-btns { justify-content: flex-start; flex-wrap: wrap; }
  .ag-op-summary { max-width: 100%; white-space: normal; }
  .table-wrap:has(> .ag-table) { overflow: visible; }
}
