:root {
  /* Suppress the browser touch overlay; keyboard focus uses :focus-visible. */
  -webkit-tap-highlight-color: transparent;
  color-scheme: dark;
  --bg: #101419; --panel: #171d24; --line: #2b333d;
  --muted: #96a3b2; --text: #e9eef3; --accent: #c4f16b;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button { border: 1px solid #3a4653; background: #232c36; color: var(--text); border-radius: 8px; padding: 10px 15px; }
button:hover { background: #303c48; }
button:disabled, input:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: inherit; text-decoration: none; }
select { background: #11171e; border: 1px solid #394652; color: var(--text); padding: 11px 12px; border-radius: 8px; max-width: 100%; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1 { font-size: clamp(24px,2.1vw,32px); font-weight: 550; letter-spacing: -.8px; line-height: 1.2; margin: 8px 0 0; }
h2 { font-size: 18px; font-weight: 550; margin: 0; letter-spacing: -.3px; }
h3 { font-size: 17px; font-weight: 550; margin: 0; line-height: 1.5; }
h4 { font-size: 14px; font-weight: 550; margin: 0; }
p { line-height: 1.6; }
.primary { background: var(--accent); color: #1b2712; border-color: var(--accent); font-size: 14px; font-weight: 650; }
.primary:hover { background: #d6ff86; border-color: #d6ff86; }
.stop-button, .danger-button { color: #f0b9ad; border-color: #754940; background: #322321; }
.stop-button:hover, .danger-button:hover { background: #4b2c26; }
.eyebrow { font-size: 10px; font-weight: 600; letter-spacing: .13em; color: var(--muted); line-height: 1.5; }
.context-tag, .small-tag { display: inline-flex; align-items: center; flex-shrink: 0; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 11px; color: #bac5cf; line-height: 1.4; }
.field-note, .section-note, .video-note { font-size: 12px; color: var(--muted); line-height: 1.65; margin: 0; }
.field-note:empty, .section-note:empty, .video-note:empty, .sidebar-foot:empty { display: none; }
.notice { background: #20271c; border: 1px solid #3a482e; border-radius: 8px; padding: 12px 16px; color: #c5cfb7; font-size: 13px; line-height: 1.6; margin: 0 0 18px; }
.case-error { background: #30211f; border-color: #714a42; color: #f2bdb1; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-width: 0; }
.panel-header { padding: 20px 22px; display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-header h3 { margin-top: 3px; }
summary { color: #b8c6d3; padding: 14px 20px; font-size: 13px; line-height: 1.5; }
summary::marker { color: #738596; }
details[open] > summary { color: var(--text); }

/* Workspace and case navigation. */
main { max-width: 1680px; margin: auto; padding: 30px 34px 0; }
.case-shell { display: grid; grid-template-columns: 246px minmax(0,1fr); gap: 34px; min-height: calc(100vh - 290px); align-items: start; }
.case-sidebar { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding-right: 22px; border-right: 1px solid var(--line); position: sticky; top: 22px; }
.sidebar-server { display: flex; align-items: center; gap: 12px; padding: 13px; width: 100%; border-color: transparent; background: transparent; text-align: left; font-size: 14px; margin-bottom: 0; }
.sidebar-server > svg { width: 21px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; color: #a3b29e; flex-shrink: 0; }
.sidebar-server > span:last-child { margin-left: auto; color: var(--muted); }
.sidebar-server-note { display: block; color: var(--muted); font-size: 11px; margin-top: 5px; }
.sidebar-server[data-selected=true] { background: #1c2427; border-color: #36443b; }
.sidebar-section { min-width: 0; }
.sidebar-label { display: flex; align-items: center; gap: 8px; padding: 12px 0; color: var(--muted); font-size: 10px; letter-spacing: .1em; list-style: none; }
.sidebar-label::-webkit-details-marker { display: none; }
.sidebar-label::before { content: '›'; font-size: 17px; line-height: 12px; transform: rotate(0); }
.sidebar-section[open] > .sidebar-label::before { transform: rotate(90deg); }
.sidebar-label #case-storage { margin-left: auto; }
.sidebar-section-body { display: grid; gap: 12px; padding: 2px 0 8px; }
.new-case-control { position: relative; min-width: 0; border-radius: 8px; }
.new-case-control:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.new-case-control:has(button:disabled) { cursor: not-allowed; }
.new-case-control button:disabled { pointer-events: none; }
.case-create-tooltip { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; width: 100%; padding: 10px 12px; border: 1px solid #45525d; border-radius: 8px; background: #232c36; box-shadow: 0 6px 20px #0005; color: var(--text); font-size: 12px; line-height: 1.5; visibility: hidden; pointer-events: none; }
.new-case-control:has(button:disabled):is(:hover,:focus-within) .case-create-tooltip:not(:empty) { visibility: visible; }
#case-count { margin-left: 5px; color: #d1dae2; letter-spacing: 0; }
#case-storage { font-size: 10px; letter-spacing: 0; white-space: nowrap; }
.new-case-link { display: block; width: 100%; min-height: 44px; padding: 11px 14px; text-align: left; border: 1px solid #4b6038; border-radius: 8px; background: #1d2a20; color: var(--accent); font-size: 13px; font-weight: 600; }
.new-case-link:hover { background: #293b26; }
.sidebar-foot { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 0; }
.case-list { display: grid; gap: 10px; align-content: start; max-height: 65vh; overflow: auto; scrollbar-width: thin; }
.case-list-item { border: 1px solid var(--line); border-radius: 10px; min-width: 0; background: #151b21; overflow-wrap: anywhere; transition: border-color .15s; }
.case-list-item:hover { border-color: #4b5b69; }
.case-list-item[data-selected=true] { border-color: #799957; background: #1b2520; box-shadow: inset 3px 0 0 var(--accent); }
.case-list-open { display: grid; gap: 4px; width: 100%; min-width: 0; text-align: left; border: 0; background: transparent; padding: 15px 13px 7px; overflow-wrap: anywhere; }
.case-list-open:hover { background: #c4f16b05; }
.case-list-open strong { font-size: 14px; font-weight: 550; line-height: 1.4; }
.case-cost { display: grid; gap: 5px; margin-top: 10px; padding-top: 10px; border-top: 1px solid #ffffff0c; }
.case-cost-amount { color: #d2dce4; font-size: 17px; font-weight: 550; font-variant-numeric: tabular-nums; }
.case-cost[data-active=true] .case-cost-amount { color: var(--accent); }
.case-cost-detail { color: var(--muted); font-size: 10px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.case-list-actions { display: flex; align-items: center; gap: 2px; padding: 0 5px 5px 13px; }
.case-list-status { margin-right: auto; font-size: 10px; color: var(--muted); }
.case-list-item[data-stage=failed] .case-list-status { color: #e4aa9f; }
.case-list-item[data-stage=new-case] .case-list-status { color: #d2ba8c; }
.case-list-action { display: grid; place-items: center; width: 32px; height: 34px; padding: 8px; border: 0; background: transparent; color: var(--muted); flex-shrink: 0; }
.case-list-action[data-action=delete]:hover { color: #efac9c; background: #3a2520; }
.case-list-action:hover { background: #ffffff0b; }
.case-list-action svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.case-workspace { min-width: 0; }
.workspace-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.workspace-lead { color: var(--muted); font-size: 13px; margin: 12px 0 0; max-width: 650px; }
#case-loading { color: var(--muted); font-size: 14px; padding: 36px 0; }

/* Server selection and case definition. */
.server-form { display: grid; grid-template-columns: minmax(0,1fr); max-width: 1120px; gap: 22px; align-items: start; }
.case-form-panel { display: grid; gap: 22px; padding: 26px; }
.form-heading { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 3px; }
.form-heading p { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.server-search-heading { position: relative; display: flex; align-items: center; gap: 10px; min-height: 30px; }
.info-trigger { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; min-height: 24px; padding: 0; border: 1px solid #52606c; border-radius: 50%; background: transparent; color: #adb9c5; font-family: Georgia, serif; font-size: 15px; font-style: italic; }
.info-tooltip { position: absolute; top: calc(100% + 8px); left: 0; z-index: 10; width: min(320px,calc(100vw - 96px)); padding: 12px 14px; border: 1px solid #45525d; border-radius: 8px; background: #232c36; box-shadow: 0 6px 20px #0005; color: var(--text); font-size: 12px; line-height: 1.5; visibility: hidden; }
.server-search-heading:has(.info-trigger:is(:hover,:focus)) .info-tooltip, .info-tooltip:hover { visibility: visible; }
.field-with-info { display: grid; gap: 8px; min-width: 0; }
.field-info-heading { position: relative; display: flex; align-items: center; gap: 8px; }
.field-info > summary { list-style: none; }
.field-info > summary::-webkit-details-marker { display: none; }
.field-info[open] > summary { color: var(--accent); border-color: var(--accent); }
.field-info-help { position: absolute; left: 0; top: calc(100% + 8px); width: min(430px,100%); z-index: 12; padding: 14px 16px; background: #232c36; border: 1px solid #45525d; border-radius: 8px; box-shadow: 0 6px 20px #0005; }
.field-info-help p { font-size: 12px; line-height: 1.6; margin: 0; }
.field-info-help p + p { margin-top: 12px; }
.field-info-help strong { color: var(--accent); }
.section-index { display: grid; place-items: center; min-width: 30px; height: 30px; border: 1px solid #3d4d36; border-radius: 8px; color: #b7cc96; font-size: 11px; margin-top: 1px; }
.case-form-panel label { display: grid; gap: 8px; font-size: 12px; color: #bcc8d2; line-height: 1.5; min-width: 0; }
.case-form-panel input, .case-form-panel textarea, .settings-provider input { width: 100%; min-width: 0; font-size: 14px; background: #10171e; color: var(--text); border: 1px solid #34414e; border-radius: 8px; padding: 12px; }
.case-form-panel input:focus, .case-form-panel textarea:focus, .case-form-panel select:focus { border-color: #8fae66; }
.case-form-panel textarea { resize: vertical; line-height: 1.65; }
.case-form-panel select { width: 100%; min-width: 0; font-size: 13px; min-height: 44px; }
.case-two-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.resource-fields { padding-top: 20px; border-top: 1px solid var(--line); }
.resource-fields input { font-size: 16px; font-variant-numeric: tabular-nums; }
.form-action { display: grid; gap: 12px; padding-top: 2px; }
.form-action .primary { display: flex; justify-content: space-between; padding: 13px 16px; }
.rental-note { margin-top: 16px; display: flex; gap: 12px; padding: 2px 8px; color: var(--muted); }
.rental-note > span { font-size: 20px; color: #6f8361; }
.rental-note p { font-size: 11px; line-height: 1.7; margin: 0; }
.vast-offer { padding: 22px; border-color: #526842; background: #18231d; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
.offer-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; flex-shrink: 0; }
.offer-heading h2 { font-size: 18px; }
.offer-content { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.offer-content > strong { display: block; color: var(--accent); font-size: 30px; font-weight: 550; margin: 0 0 4px; }
.vast-offer p { color: #b3c1b5; font-size: 12px; line-height: 1.5; margin: 8px 0; white-space: pre-line; overflow-wrap: anywhere; }
.offer-details { margin-top: 12px; padding-top: 4px; border-top: 1px solid #364735; }
.vast-offer .offer-note { font-size: 11px; color: var(--muted); }
.offer-footer { flex-shrink: 0; border-top: 1px solid #364735; padding-top: 8px; }
.offer-actions { display: grid; grid-template-columns: minmax(0,1fr); gap: 12px; margin-top: 12px; }
.offer-actions button { min-height: 44px; min-width: 0; padding: 10px; }
.offer-content:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.case-create-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(290px,.85fr); gap: 22px; align-items: start; }
.case-config { display: grid; gap: 20px; min-width: 0; }
.case-submit .primary { width: 100%; min-height: 48px; }
.case-submit p { text-align: center; color: var(--muted); font-size: 11px; line-height: 1.7; padding: 0 14px; margin: 10px 0 0; }
.workflow-empty { padding: 42px 26px; text-align: center; color: var(--muted); }
.workflow-empty h3 { color: var(--text); }
.workflow-empty .new-case-link { display: inline-block; width: auto; margin-top: 16px; }

/* Monitoring and result evidence. */
.mission-strip { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 24px; padding: 24px; margin-bottom: 14px; border-color: #3e4d39; background: #18211d; }
.mission-strip p { font-size: 14px; white-space: pre-wrap; margin: 9px 0 12px; }
.mission-strip summary { padding: 0; font-size: 12px; }
.mission-strip details p { color: var(--muted); font-size: 12px; }
.mission-controls { display: grid; gap: 9px; min-width: 150px; align-content: start; }
.mission-controls button { min-height: 44px; font-size: 13px; }
.live-status-row { display: flex; flex-wrap: wrap; gap: 12px 24px; color: var(--muted); font-size: 11px; padding: 2px 0 20px; font-variant-numeric: tabular-nums; }
.live-status-row strong { font-weight: 500; color: #d5c6a6; }
.live-status-row strong::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; background: currentColor; border-radius: 50%; }
.live-status-row strong[data-live=true] { color: var(--accent); }
.live-perception { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 12px; padding: 16px; }
.live-perception > article { min-width: 0; padding: 13px; background: #11181f; border: 1px solid #2d3843; border-radius: 9px; }
.live-perception h4 { margin: 0 0 16px; line-height: 28px; }
.live-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.live-card-heading h4 { margin: 0; }
.live-card-heading select { font-size: 10px; min-width: 0; max-width: 125px; padding: 6px 8px; }
#live-lidar { display: block; width: 100%; aspect-ratio: 3/2; background: #10171d; margin-bottom: 12px; border-radius: 6px; }
.live-image { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 3/2; background: #0d1319; color: #7e8b98; text-align: center; font-size: 11px; margin-bottom: 12px; border: 1px dashed #2a3742; border-radius: 6px; overflow: hidden; }
.live-image > span { max-width: 165px; padding: 14px; line-height: 1.6; }
.live-image canvas { width: 100%; height: 100%; object-fit: contain; }
.live-body { display: grid; grid-template-columns: 1fr 1.35fr 1fr; border-top: 1px solid var(--line); }
.live-body article { padding: 20px; min-width: 0; }
.live-body article + article { border-left: 1px solid var(--line); }
.live-body h4 { font-size: 12px; margin-bottom: 10px; }
.live-body p { font: 11px/1.8 ui-monospace,monospace; color: var(--muted); margin: 0; white-space: pre-wrap; max-height: 115px; overflow: auto; overflow-wrap: anywhere; }
.live-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.observer-live { aspect-ratio: 16/9; margin: 0; border: 0; border-radius: 0; }
.live-decisions dl { padding: 0 22px 20px; margin: 0; font-size: 13px; line-height: 1.6; }
.live-decisions dt { color: var(--muted); font-size: 11px; margin-top: 18px; }
.live-decisions dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.live-bottom .video-note { padding: 14px 20px; }
.case-repeat { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 20px; }
.case-repeat button { font-size: 13px; }
.case-summary { padding: 24px; margin-bottom: 22px; }
.case-summary h3 { margin: 10px 0; }
.case-summary p { font-size: 13px; line-height: 1.7; white-space: pre-wrap; margin: 8px 0; }
#analysis-run-status { color: #c7d6b4; padding-top: 14px; border-top: 1px solid var(--line); }
#case-run-select { font-size: 12px; max-width: 340px; }
#case-trajectories { display: block; width: 100%; max-height: 350px; background: #10171d; }
#case-alignment { padding: 14px 22px; }
.case-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 22px; gap: 20px; background: #141b21; border-top: 1px solid var(--line); }
.case-metrics span { display: block; font-size: 11px; color: var(--muted); margin-bottom: 9px; line-height: 1.5; }
.case-metrics strong { font-size: 22px; font-weight: 500; font-variant-numeric: tabular-nums; }
#case-report details { border-top: 1px solid var(--line); }
.report-events { color: var(--muted); font: 12px/1.8 ui-monospace,monospace; max-height: 260px; overflow: auto; padding: 0 22px 16px 38px; }
.case-video-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.case-video-grid h3 { font-size: 14px; padding: 16px 20px; }
.case-video-grid video { display: block; width: 100%; aspect-ratio: 16/9; background: #0d1319; }
.artifact-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }
.artifact-links:empty { display: none; }
.artifact-links a { padding: 10px 13px; border: 1px solid var(--line); border-radius: 7px; color: #c6d9b5; font-size: 12px; }
.artifact-links a:hover { border-color: #79945e; background: #1b2520; }
#case-review-form { margin-top: 22px; }
#case-review-form > label { max-width: 320px; }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding-top: 4px; }
#case-review-status { color: var(--muted); font-size: 12px; }
.case-failure { padding: 20px 24px; border-color: #79504a; color: #f2bdb1; margin-bottom: 22px; background: #2a201e; }
.case-failure p { font-size: 13px; margin-bottom: 0; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 28px 0; margin-top: 24px; border-top: 1px solid var(--line); color: #748290; font-size: 10px; letter-spacing: .035em; }

/* Dialogs use the same controls and section rhythm as the workspace. */
dialog { color: var(--text); }
.account-warning { margin: 12px 34px; padding: 12px 16px; border: 1px solid #8f7642; border-radius: 8px; background: #302919; color: #f0d69d; line-height: 1.5; overflow-wrap: anywhere; }
.account-warning[data-tone="error"] { border-color: #b3695c; background: #30201f; color: #f4b6a9; }
dialog .account-warning { margin: 12px 0; }
@media (max-width: 600px) { #vast-account-warning { margin: 12px 14px; } }
[data-startup-blocked] { cursor: not-allowed; }
button[data-startup-blocked], a[data-startup-blocked], summary[data-startup-blocked] { opacity: .5; }
.server-starting .case-create-tooltip { visibility: hidden !important; }
.server-stop-error { margin: 12px 34px; }
@media (max-width: 600px) { .server-stop-error { margin: 12px 14px; } }
#startup-lock-tooltip { position: fixed; z-index: 1000; width: max-content; max-width: min(320px,calc(100vw - 16px)); padding: 10px 12px; box-sizing: border-box; background: #232c36; border: 1px solid #45525d; border-radius: 8px; color: var(--text); font-size: 12px; line-height: 1.5; pointer-events: none; }
dialog::backdrop { background: #05090dcc; backdrop-filter: blur(3px); }
#settings-dialog, #case-delete-dialog { width: min(580px,calc(100% - 32px)); max-height: calc(100vh - 40px); padding: 26px; background: var(--bg); border: 1px solid #3a4652; border-radius: 14px; overflow-y: auto; }
.settings-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.settings-heading h2 { font-size: 23px; }
.settings-heading button { display: grid; place-items: center; min-width: 36px; min-height: 36px; padding: 6px; background: transparent; border: 1px solid var(--line); color: var(--muted); }
.settings-provider { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 20px; background: var(--panel); margin-top: 16px; }
.settings-provider label { font-size: 14px; }
.settings-provider input { min-height: 44px; }
.settings-provider > button { justify-self: start; min-height: 40px; font-size: 12px; }
.settings-status { font-size: 12px; line-height: 1.6; margin: 0; }
.settings-status:empty { display: none; }
#settings-error { color: #f2bdb1; margin-top: 18px; }
.gpu-ranking { list-style: none; padding: 0; margin: 0; display: grid; counter-reset: gpu; }
.gpu-ranking li { display: flex; align-items: center; gap: 8px; counter-increment: gpu; padding: 8px 0; border-bottom: 1px solid var(--line); }
.gpu-ranking li::before { content: counter(gpu); color: var(--muted); font: 11px ui-monospace,monospace; width: 16px; }
.gpu-ranking span { flex: 1; font-size: 12px; min-width: 0; }
.gpu-ranking button { min-width: 34px; min-height: 34px; padding: 4px; }
#case-delete-dialog { border-color: #79504a; }
#case-delete-name { font-weight: 600; }
#case-delete-warning { font-size: 13px; color: #b9c3cd; }
#case-delete-error { color: #f2bdb1; font-size: 13px; }
.delete-dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

@media (max-width: 1200px) {
  .case-shell { grid-template-columns: 220px minmax(0,1fr); gap: 24px; }
  .case-sidebar { padding-right: 18px; }
  .server-form, .case-create-grid { grid-template-columns: minmax(0,1fr); }
  .live-perception { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .live-perception > article:first-child { grid-column: 1/-1; }
  #live-lidar { max-height: 280px; object-fit: contain; }
  .live-body, .live-bottom { grid-template-columns: minmax(0,1fr); }
  .live-body article + article { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 800px) {
  main { padding: 24px 20px 0; }
  .case-shell { display: flex; flex-direction: column; gap: 28px; }
  .case-sidebar { position: static; width: 100%; border: 0; padding: 0 0 22px; border-bottom: 1px solid var(--line); gap: 8px; }
  .case-list { display: flex; max-height: none; padding: 3px 2px; scroll-snap-type: x proximity; }
  .case-list-item { flex: 0 0 220px; scroll-snap-align: start; }
  .case-list-action { width: 44px; height: 44px; }
  .sidebar-label { min-height: 44px; }
  .info-trigger { flex-basis: 44px; width: 44px; height: 44px; }
  .case-workspace { width: 100%; }
  .workspace-heading { margin-bottom: 22px; }
}
@media (max-width: 550px) {
  main { padding: 22px 14px 0; }
  .case-shell { gap: 24px; }
  .workspace-heading { flex-wrap: wrap; gap: 14px; }
  .workspace-heading h1 { font-size: 25px; }
  .workspace-lead { font-size: 12px; }
  .case-form-panel { padding: 20px 17px; gap: 20px; }
  .form-heading h2 { font-size: 17px; }
  .case-two-fields { gap: 12px; }
  .case-form-panel label { font-size: 11px; }
  .case-form-panel input, .case-form-panel textarea, .case-form-panel select { font-size: 16px; }
  .vast-offer { padding: 22px; }
  .mission-strip { grid-template-columns: minmax(0,1fr); padding: 20px; gap: 18px; }
  .mission-controls { grid-template-columns: 1fr 1fr; }
  .panel-header { padding: 18px; flex-wrap: wrap; }
  .panel-header .small-tag { font-size: 9px; }
  .live-perception, .case-video-grid, .review-grid { grid-template-columns: minmax(0,1fr); }
  .live-perception { padding: 12px; }
  .live-perception > article:first-child { grid-column: auto; }
  .live-card-heading select { min-height: 40px; font-size: 12px; }
  .case-metrics { grid-template-columns: 1fr 1fr; padding: 20px; }
  .case-metrics strong { font-size: 19px; }
  #case-run-select { width: 100%; max-width: none; }
  .case-repeat { align-items: flex-start; flex-direction: column; }
  .case-summary { padding: 20px; }
  .settings-provider { padding: 16px; }
  .gpu-ranking button { min-width: 44px; min-height: 44px; }
  .delete-dialog-actions { flex-direction: column-reverse; }
  footer { font-size: 9px; }
}
.brand-emblem { position: relative; display: block; width: 112px; height: 112px; flex-shrink: 0; isolation: isolate; }
.brand-emblem::before { content: ""; position: absolute; z-index: 0; inset: 6% 12% 18%; border-radius: 50%; background: radial-gradient(ellipse at 50% 45%, rgba(168, 255, 85, .32), rgba(118, 233, 42, .09) 52%, transparent 72%); filter: blur(8px); animation: brand-halo 5.2s ease-in-out infinite; }
.brand-mark { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 59%; animation: brand-hover 5.2s ease-in-out infinite; }
.brand-dome-scan { position: absolute; z-index: 2; left: 32%; top: 13%; width: 36%; height: 28%; overflow: hidden; border-radius: 50% 50% 40% 40%; pointer-events: none; transform: rotate(-2deg); }
.brand-dome-scan::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 26%; background: linear-gradient(180deg, transparent, rgba(203, 255, 158, .11) 45%, rgba(233, 255, 209, .38) 73%, transparent); filter: blur(2px); animation: brand-scan 5.2s ease-in-out infinite; }
.brand-optic { position: absolute; z-index: 2; left: 46.5%; top: 51.5%; width: 7%; height: 7%; border-radius: 50%; background: radial-gradient(circle, rgba(236, 255, 195, .8), rgba(167, 255, 65, .2) 42%, transparent 75%); mix-blend-mode: screen; pointer-events: none; animation: brand-optic-pulse 5.2s ease-in-out infinite; }
@keyframes brand-hover { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-3px) rotate(-1deg); } 50% { transform: translateY(0) rotate(0); } 75% { transform: translateY(-3px) rotate(1deg); } }
@keyframes brand-halo { 0%, 100% { opacity: .4; transform: scale(.92); } 50% { opacity: .85; transform: scale(1.1); } }
@keyframes brand-scan { 0%, 8% { transform: translateY(-125%); opacity: 0; } 15% { opacity: 1; } 50% { transform: translateY(370%); opacity: .9; } 58%, 100% { transform: translateY(370%); opacity: 0; } }
@keyframes brand-optic-pulse { 0%, 100% { opacity: .3; transform: scale(.85); } 45% { opacity: .9; transform: scale(1.2); } 58% { opacity: .5; transform: scale(.9); } }
@media (prefers-reduced-motion: reduce) { .brand-emblem::before, .brand-mark { animation: none; } .brand-dome-scan, .brand-optic { display: none; } }

/* Server status bar: lifecycle and actions above persistent resource metrics. */
.serverbar { padding: 12px 34px 0; border-bottom: 1px solid var(--line); background: #13181e; }
.serverbar-main { display: grid; grid-template-columns: 170px minmax(240px,1fr) auto; gap: 24px; align-items: center; min-height: 66px; }
.serverbar-brand { display: flex; align-items: center; gap: 10px; width: fit-content; }
.serverbar .brand-emblem { width: 64px; height: 64px; }
.serverbar-wordmark { font-size: 22px; font-weight: 650; letter-spacing: -.5px; }
.serverbar-wordmark small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .12em; }
.serverbar-state { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.serverbar-state strong { display: block; font-size: 16px; font-weight: 550; line-height: 1.4; }
.serverbar-state #serverbar-detail { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.serverbar-dot { flex: 0 0 7px; height: 7px; border-radius: 50%; margin-top: 7px; background: #83909c; }
.serverbar-state[data-tone=ready] .serverbar-dot { background: var(--accent); box-shadow: 0 0 0 4px #c4f16b12; }
.serverbar-state[data-tone=warning] .serverbar-dot { background: #e5bb72; box-shadow: 0 0 0 4px #e5bb7212; }
.serverbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.serverbar-rental-actions { display: flex; align-items: center; gap: 6px; }
.serverbar-rental-actions:has(button:not([hidden])) { max-width: 100%; }
.serverbar-rental-actions:not(:has(button:not([hidden]))) { display: none; }
.serverbar-action, .serverbar-stop { min-height: 40px; padding: 9px 12px; font-size: 13px; white-space: nowrap; }
.serverbar-action { background: transparent; border-color: var(--line); color: #c4ced8; }
.serverbar-action span { padding-left: 12px; color: var(--muted); }
.serverbar-stop { background: #30201f; border-color: #71423b; color: #f4b6a9; }
.serverbar-stop:hover { background: #472823; border-color: #b3695c; }
.serverbar-stop:disabled { opacity: .55; }
.serverbar-metrics { display: grid; grid-template-columns: 170px minmax(200px,1fr) minmax(235px,1fr) minmax(170px,.8fr); gap: 24px; margin-top: 12px; border-top: 1px solid var(--line); padding: 15px 0 17px; }
.serverbar-metric { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 6px; min-width: 0; }
.serverbar-metric + .serverbar-metric { padding-left: 24px; border-left: 1px solid var(--line); }
.serverbar-caption { color: #929faa; font-size: 11px; line-height: 1.4; }
.serverbar-metric strong { font-size: 15px; font-weight: 550; font-variant-numeric: tabular-nums; line-height: 1.4; }
.serverbar-balance strong { color: var(--accent); font-size: 25px; font-weight: 650; line-height: 1.1; }
.serverbar-note, .serverbar #project-disk-meter { color: var(--muted); font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.serverbar #server-stop-meter { white-space: nowrap; }
#serverbar-lease-empty[data-empty=true], #global-connection[data-empty=true] { display: grid; place-items: center; flex: 1; width: 100%; min-height: 36px; font-size: 32px; line-height: 1; }
.serverbar #project-disk[data-available=false] strong { color: var(--muted); font-weight: 400; }
.disk-usage { width: 100%; max-width: 280px; }
.disk-usage-values { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#project-disk-percent { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.disk-usage-bar { height: 6px; margin-top: 7px; border-radius: 4px; overflow: hidden; background: #313a43; }
.disk-usage-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.disk-usage-bar[data-tone=warning] > span { background: #e5bb72; }
.disk-usage-bar[data-tone=critical] > span { background: #ed9886; }
@media (max-width: 1100px) {
  .serverbar { padding-left: 20px; padding-right: 20px; }
  .serverbar-main { grid-template-columns: 140px minmax(0,1fr); gap: 14px 24px; }
  .serverbar-actions { grid-column: 1 / -1; justify-content: flex-start; padding-bottom: 2px; }
  .serverbar-metrics { grid-template-columns: 140px minmax(0,1fr) minmax(0,1fr); }
  .serverbar-executor { grid-column: 1 / -1; flex-direction: row; gap: 12px; align-items: baseline; }
  .serverbar-metric.serverbar-executor { padding: 0; border: 0; }
}
@media (max-width: 600px) {
  .serverbar { padding: 10px 14px 0; }
  .serverbar-main { grid-template-columns: 100px minmax(0,1fr); gap: 14px; }
  .serverbar .brand-emblem { width: 42px; height: 42px; }
  .serverbar-brand { gap: 5px; }
  .serverbar-wordmark { font-size: 18px; }
  .serverbar-wordmark small { font-size: 8px; }
  .serverbar-state strong { font-size: 14px; }
  .serverbar-state #serverbar-detail { font-size: 11px; }
  .serverbar-actions { gap: 6px; }
  .serverbar-action, .serverbar-stop { min-height: 44px; padding: 9px 10px; font-size: 12px; }
  .serverbar-action span { padding-left: 4px; }
  .serverbar-metrics { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 18px; margin-top: 14px; }
  .serverbar-metric + .serverbar-metric { padding-left: 0; border: 0; }
  .serverbar-executor { grid-column: auto; flex-direction: column; align-items: flex-start; gap: 6px; }
  .serverbar-metric strong { font-size: 13px; }
  .serverbar-balance strong { font-size: 25px; }
  .serverbar-caption { font-size: 10px; }
}

.expense-dialog { width: min(1180px, 96vw); max-width: 96vw; max-height: 88vh; overflow: auto; padding: 24px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 12px; }
.expense-dialog::backdrop { background: #000a; }
.expense-table-wrap { width: 100%; overflow-x: auto; margin: 18px 0; }
.expense-table { width: 100%; min-width: 800px; border-collapse: collapse; font-size: 13px; }
.expense-table th, .expense-table td { padding: 12px 9px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; white-space: pre-line; }
.expense-table th { color: var(--muted); font-weight: 500; }
@media (max-width: 700px) {
  .expense-dialog { padding: 16px; }
}

/* All sessions share the chart scale and one flat interval table. */
.expense-sessions { margin-top: 22px; display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; }
.expense-session { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 20px; background: #141b21; }
@media(max-width:550px) { .expense-session { padding: 14px; } }

/* Wall-time geometry; component costs are summed without extending the axis. */
.expense-timeline { min-width: 0; margin: 14px 0 6px; }
.expense-timeline-period { margin: 0 0 12px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.expense-timeline-scroll { max-width: 100%; overflow-x: auto; padding: 3px 3px 10px; scrollbar-width: thin; }
.expense-timeline-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.expense-timeline-plot { min-width: 720px; }
.expense-timeline-lane-label { font-size: 10px; color: var(--muted); margin: 14px 0 6px; }
.expense-timeline-tube { position: relative; height: 52px; background: repeating-linear-gradient(to right,#ffffff09 0 1px,transparent 1px var(--tick-spacing)); }
.expense-timeline-tube[data-lane=storage] { height: 30px; }
.expense-timeline-segment { position: absolute; top: 0; height: 100%; min-width: 0; padding: 7px 0; border: 0; box-shadow: inset -1px 0 #141b21; border-radius: 3px; overflow: hidden; text-align: left; color: #14201b; --segment-color: #9aa8b5; background: var(--segment-color); }
.expense-timeline-segment[data-type=storage] { --segment-color: #8eafd4; }
.expense-timeline-segment[data-type=migration] { --segment-color: #dbb478; }
.expense-timeline-segment[data-unknown=true] { background: repeating-linear-gradient(135deg,#ffffff44 0 4px,transparent 4px 9px),var(--segment-color); }
.expense-timeline-segment:hover { filter: brightness(1.08); }
.expense-timeline-segment:focus-visible { z-index: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.expense-timeline-segment span, .expense-timeline-segment small { display: block; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.expense-timeline-segment span { font-size: 12px; font-weight: 650; }
.expense-timeline-segment small { margin-top: 4px; font-size: 11px; font-variant-numeric: tabular-nums; }
.expense-timeline-tube[data-lane=storage] .expense-timeline-segment { display: flex; align-items: center; }
.expense-timeline-tube[data-lane=storage] .expense-timeline-segment span { font-size: 10px; font-weight: 500; }
.expense-timeline-tube[data-lane=storage] .expense-timeline-segment small { margin: 0; padding-left: 0; }
.expense-timeline-axis { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: 10px; padding-bottom: 10px; font-size: 10px; color: #8a98a5; font-variant-numeric: tabular-nums; }
.expense-timeline-axis span { position: relative; width: 0; white-space: nowrap; text-align: center; display: flex; justify-content: center; }
.expense-timeline-axis span:first-child { justify-content: flex-start; }
.expense-timeline-axis span:last-child { justify-content: flex-end; }
.expense-timeline-axis span::before { content: ''; position: absolute; width: 1px; height: 5px; background: #465260; bottom: -11px; }

/* Keep dialog controls usable within narrow and short viewports. */
#settings-dialog, #case-delete-dialog { max-height: calc(100dvh - 40px); }
.expense-dialog { max-height: 88dvh; }
@media (max-width: 800px) {
  .settings-heading button { flex: 0 0 44px; min-width: 44px; min-height: 44px; }
  dialog button, .live-card-heading select { min-height: 44px; }
  .expense-timeline-tube[data-lane=storage] { height: 44px; }
  .settings-provider input, .expense-dialog select, .live-card-heading select, #case-run-select { font-size: 16px; }
  .live-card-heading { flex-wrap: wrap; }
  .serverbar #server-stop-meter { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 550px) {
  #settings-dialog, #case-delete-dialog { padding: 16px; }
}

.expense-session > h3 { font-size: 14px; }
.expense-dates { color: var(--muted); }

/* Compact server search: rental options and minimum resources, without visible group headings. */
.server-form .hardware-panel { gap: 14px; padding: 20px; overflow: visible; }
.server-search-groups { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; }
.server-search-group { display: grid; align-content: start; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.server-search-group + .server-search-group { padding-left: 24px; border-left: 1px solid var(--line); }
.minimum-parameters > label { line-height: 24px; }
.auto-stop-controls { display: grid; grid-template-columns: minmax(0,1fr); align-items: end; gap: 12px; min-width: 0; }
.auto-stop-controls:has(#auto-stop-custom-field:not([hidden])) { grid-template-columns: minmax(0,1fr) 112px; }
.server-search-group .resource-fields { border: 0; padding: 0; gap: 12px; }
.server-form .form-action { display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding-top: 16px; }
.server-form .form-action .primary { flex: 0 0 220px; gap: 24px; min-height: 44px; }
.server-form .form-action p { margin: 0; }
#hardware-status { margin: 0; }
#hardware-status:empty, #vast-status:empty { display: none; }
@media (max-width: 900px) {
  .server-search-groups { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .server-search-group + .server-search-group { padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 550px) {
  .server-form .form-action { flex-direction: column; align-items: stretch; gap: 12px; }
  .server-form .form-action .primary { flex-basis: auto; }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .server-form .hardware-panel { padding: 18px; gap: 12px; }
  .server-search-groups { gap: 16px; }
  .server-search-group + .server-search-group { padding-left: 16px; }
  .server-search-group input { padding: 10px; min-height: 44px; }
}

/* Bridge the visual gap so the pointer can move onto the explanation. */
.info-tooltip::before, .field-info-help::before { content: ''; position: absolute; left: 0; right: 0; top: -9px; height: 9px; }

/* Give the offer the viewport on phones and short screens; Back restores navigation. */
@media (max-width: 800px), (max-height: 600px) {
  body:has(#server-view:not([hidden]) #vast-offer:not([hidden])) { overflow: hidden; }
  body:has(#server-view:not([hidden]) #vast-offer:not([hidden])) > .serverbar,
  body:has(#server-view:not([hidden]) #vast-offer:not([hidden])) .case-sidebar,
  body:has(#server-view:not([hidden]) #vast-offer:not([hidden])) footer { display: none; }
  body:has(#server-view:not([hidden]) #vast-offer:not([hidden])) main { padding: 12px; }
  body:has(#server-view:not([hidden]) #vast-offer:not([hidden])) .case-shell { display: block; min-height: 0; }
  .vast-offer { padding: 16px; gap: 12px; }
  .offer-actions { gap: 8px; }
  /* Native retries keep the offer on screen; cancellation must remain reachable. */
  body.server-starting:has(#server-view:not([hidden]) #vast-offer:not([hidden])) { overflow: auto; }
  body.server-starting:has(#server-view:not([hidden]) #vast-offer:not([hidden])) > .serverbar {
    display: block; position: sticky; top: 0; z-index: 20; padding: 8px 12px;
  }
  body.server-starting:has(#vast-offer:not([hidden])) .serverbar-main { display: flex; flex-wrap: wrap; gap: 8px; min-height: 0; }
  body.server-starting:has(#vast-offer:not([hidden])) .serverbar-brand,
  body.server-starting:has(#vast-offer:not([hidden])) .serverbar-metrics { display: none; }
  body.server-starting:has(#vast-offer:not([hidden])) .serverbar-state { flex: 1 1 160px; }
  body.server-starting:has(#vast-offer:not([hidden])) .serverbar-actions { flex: 0 0 auto; padding: 0; }
  body.server-starting:has(#vast-offer:not([hidden])) .vast-offer { max-height: calc(100dvh - 120px); }
}
@media (min-width: 601px) and (max-height: 600px) {
  .offer-content { display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1.15fr); column-gap: 20px; }
  .offer-content > strong, #vast-offer-price, #vast-offer-specs { grid-column: 1; }
  .offer-content .offer-details { grid-column: 2; grid-row: 1 / 4; border-top: 0; border-left: 1px solid #364735; margin: 0; padding: 0 0 0 16px; }
  .offer-content .offer-note { grid-column: 1 / -1; }
  .offer-content p { margin: 4px 0; }
}

#server-open-control[data-hint-dismissed] .case-create-tooltip { visibility: hidden; }
