/* TradingAgents web: clean white, rounded, pill buttons, one aligned column (Rustin's app UI preference). */
:root {
  color-scheme: light;
  --ink: #111827; --muted: #6b7280; --hair: #e5e7eb; --canvas: #ffffff; --soft: #f6f7f9;
  --accent: #111827; --accent-ink: #ffffff; --focus: #2563eb;
  --ok: #047857; --ok-bg: #ecfdf5; --warn: #92400e; --warn-bg: #fffbeb; --err: #b91c1c; --err-bg: #fef2f2;
  --info: #1d4ed8; --info-bg: #eff6ff;
  --r: 16px; --r-sm: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { scrollbar-gutter: stable; background: var(--canvas); } /* no layout shift when a modal or page change hides the scrollbar */
body { font: 400 15px/1.55 var(--font); color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 10px; font-weight: 650; }
h2.sub { margin-top: 18px; }
h3 { font-size: 15px; margin: 18px 0 8px; font-weight: 600; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center-text { text-align: center; margin: 16px 0 0; }

/* One column */
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px 64px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; text-decoration: none; white-space: nowrap; flex: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: var(--ink); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: 6px; height: 7px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: skewX(-20deg); opacity: .9; }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-form { margin: 0; }
.nav-link { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; border: 0;
  background: none; font: 500 14px/1 var(--font); color: var(--muted); text-decoration: none; cursor: pointer; white-space: nowrap; }
.nav-link:hover { color: var(--ink); }
.nav-link { position: relative; isolation: isolate; }
.nav-link.on { color: var(--ink); }
.nav-text { position: relative; z-index: 1; white-space: nowrap; }
.nav-pill { position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-radius: 999px; background: var(--soft); z-index: -1;
  pointer-events: none; view-transition-name: nav-pill; }
/* In-app navigation (app.js taNav): while the pill glides between tabs it sits in the nav itself, under every label. */
.nav { position: relative; isolation: isolate; }
@media (max-width: 640px) { .nav { margin-left: -12px; } }
main { display: flex; flex-direction: column; gap: 16px; }

/* Cards */
.card { background: var(--canvas); border: 1px solid var(--hair); border-radius: var(--r); padding: 24px; }
.card.narrow { max-width: 420px; width: 100%; margin: 24px auto 0; }
@media (max-width: 480px) { .card { padding: 20px 16px; } h1 { font-size: 23px; } }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
label, .label, legend { font-weight: 600; font-size: 14px; }
fieldset.bare { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.group { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.group legend { padding: 0; margin-bottom: 8px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; }
.input { width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--hair); border-radius: var(--r-sm); background: var(--canvas);
  font: inherit; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: #9ca3af; }
.input:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.input[aria-invalid="true"] { border-color: var(--err); }
.input:disabled { background: var(--soft); color: var(--muted); cursor: not-allowed; }
.input-ticker { text-transform: uppercase; font-family: var(--mono); letter-spacing: .04em; }
.input-ticker::placeholder { text-transform: uppercase; }
.unit-input { position: relative; }
.unit-input .unit { position: absolute; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 14px; }
.unit-input .unit-pre { left: 14px; }
.unit-input .unit-post { right: 14px; }
.unit-usd .input { padding-left: 28px; }
.unit-calls .input { padding-right: 56px; }
.cap-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.input-secret { font-family: var(--mono); letter-spacing: .02em; }
.input-secret::placeholder { font-family: var(--font); letter-spacing: 0; }
.input-secret.has-saved::placeholder { font-family: var(--mono); letter-spacing: .04em; color: var(--muted); }
.input-secret.has-saved:focus::placeholder { color: transparent; }
.key-field { position: relative; }
.key-field .input-secret.has-saved { padding-right: 46px; }
.key-trash { position: absolute; right: 5px; top: 50%; margin-top: -17px; }
.key-trash:hover { color: var(--err); background: var(--err-bg); }
/* Delete confirmation */
.btn-danger { background: var(--err); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.modal { width: min(400px, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--r); background: var(--canvas); color: var(--ink);
  box-shadow: 0 20px 50px rgba(17, 24, 39, .18); }
.modal::backdrop { background: rgba(17, 24, 39, .35); }
.modal-box { padding: 22px; margin: 0; }
.modal-box h2 { margin: 0 0 6px; }
.modal-box p { margin: 0 0 18px; font-size: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.keys { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.keys-head h1 { margin: 0 0 2px; }
.keys-head p { margin: 0; font-size: 14px; }
.card.key-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; }
.key-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.key-icon { flex: none; color: var(--ink); }
.key-name { min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt { flex: none; font-size: 12px; color: var(--muted); white-space: nowrap; }
.key-head .pill { margin-left: auto; }
.tag-required { flex: none; height: 20px; display: inline-flex; align-items: center; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--err); background: var(--err-bg); white-space: nowrap; }
@media (max-width: 480px) { .card.key-card { padding: 14px 16px; } .key-head { gap: 6px; } }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; text-overflow: ellipsis; cursor: pointer;
  background: var(--canvas) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center/12px no-repeat; }
@media (max-width: 480px) { .model-row { grid-template-columns: minmax(0, 1fr); } }
.cap-label { font-weight: 500; font-size: 13px; color: var(--muted); }
.cap-row .field { gap: 4px; }
.used { margin: 0; font-size: 13px; color: var(--muted); }
.used.warn-text { color: var(--warn); }
.key-foot { display: flex; justify-content: flex-end; }
.key-msg { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.field-error { margin: 0; font-size: 13px; color: var(--err); }
.warn-text { color: var(--warn); }
.err-text { color: var(--err); }

.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 1px solid var(--hair); border-radius: var(--r-sm);
  font-weight: 500; cursor: pointer; min-width: 0; }
.check-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check, .seg { transition: border-color .18s ease-out, background-color .18s ease-out; }
.check:has(input:checked) { border-color: var(--ink); background: var(--soft); }
.check:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
.cb { position: relative; flex: none; width: 18px; height: 18px; display: inline-flex; }
.checkbox { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border: 1.5px solid #9ca3af; border-radius: 6px;
  background: var(--canvas); cursor: pointer; transition: background-color .18s ease-out, border-color .18s ease-out; }
.checkbox:checked { background-color: var(--ink); border-color: var(--ink); }
.cb-mark { position: absolute; left: 3px; top: 3px; pointer-events: none; }
.cb-mark path { stroke-dasharray: 11; stroke-dashoffset: 11; transition: stroke-dashoffset .18s ease-out; }
.checkbox:checked + .cb-mark path { stroke-dashoffset: 0; }
.checkbox:disabled, fieldset:disabled .check { cursor: not-allowed; opacity: .6; }

.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.seg { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 8px 6px;
  border: 1px solid var(--hair); border-radius: var(--r-sm); cursor: pointer; text-align: center; min-width: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg-label { font-weight: 600; font-size: 14px; white-space: nowrap; }
.seg-hint { font-size: 12px; color: var(--muted); white-space: nowrap; }
.seg:has(input:checked) { border-color: var(--ink); background: var(--soft); }
.seg:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(37, 99, 235, .25); }
fieldset:disabled .seg { cursor: not-allowed; opacity: .6; }
/* Sliding selection indicator (app.js slideIndicator): one shared element glides to the selected option. */
.has-ind { position: relative; }
.has-ind > :not(.seg-ind) { position: relative; z-index: 1; }
.seg-ind { position: absolute; left: 0; top: 0; z-index: 0; pointer-events: none; box-sizing: border-box; }
.segmented.has-ind .seg:has(input:checked) { background: transparent; border-color: transparent; }
.segmented .seg-ind { border: 1px solid var(--ink); background: var(--soft); border-radius: var(--r-sm); }
@media (max-width: 400px) { .seg-hint { font-size: 11px; } }

/* Buttons: pills */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 22px; border-radius: 999px;
  border: 1px solid transparent; font: 600 15px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; flex: none; }
.btn:focus-visible, .nav-link:focus-visible, a:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #1f2937; }
.btn-primary:disabled { background: #d1d5db; color: #6b7280; cursor: not-allowed; }
.btn-ghost { background: var(--canvas); color: var(--ink); border-color: var(--hair); }
.btn-ghost:hover { background: var(--soft); }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }

/* Alerts */
.alert { border-radius: var(--r-sm); padding: 12px 14px; font-size: 14px; margin: 0 0 16px; }
.alert a { font-weight: 600; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-error { background: var(--err-bg); color: var(--err); }
.alert-info { background: var(--info-bg); color: var(--info); }
.card.notice { background: var(--info-bg); color: var(--ink); border-color: #dbeafe; padding: 16px 20px; font-size: 14px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon title btn" "icon list btn";
  column-gap: 14px; row-gap: 6px; align-items: center; }
.notice-tile { grid-area: icon; align-self: start; width: 38px; height: 38px; border-radius: 11px; background: var(--canvas);
  display: inline-flex; align-items: center; justify-content: center; color: var(--info); box-shadow: 0 0 0 1px #dbeafe; }
.notice-title { grid-area: title; margin: 0; font-weight: 650; font-size: 15px; }
.notice-list { grid-area: list; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.notice-list li { display: flex; align-items: flex-start; gap: 8px; }
.notice-check { flex: none; margin-top: 2px; color: var(--info); }
.notice-btn { grid-area: btn; }
@media (max-width: 560px) {
  .card.notice { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon title" "list list" "btn btn"; row-gap: 10px; }
  .notice-tile { align-self: center; }
  .notice-btn { width: 100%; }
}
.stack-lg > .alert { margin: 0; }

/* Pills */
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap; flex: none; background: var(--soft); color: var(--muted); }
.pill-queued { background: #f3f4f6; color: #4b5563; }
.pill-running { background: var(--info-bg); color: var(--info); }
.pill-done { background: var(--ok-bg); color: var(--ok); }
.pill-failed { background: var(--err-bg); color: var(--err); }
.pill-stopped { background: var(--warn-bg); color: var(--warn); }
.pill-none { background: #f3f4f6; color: var(--muted); }

/* Runs list */
.empty { text-align: center; padding: 24px 8px 8px; }
.empty-title { font-weight: 600; margin-bottom: 4px; }
.empty .muted { margin: 0 auto; max-width: 380px; }
.runs { list-style: none; margin: 0; padding: 0; }
.run { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--hair); }
.run:first-child { border-top: 0; padding-top: 4px; }
.run-main { flex: 1 1 auto; min-width: 0; }
.run-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.run-ticker { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.run-sub { margin: 4px 0 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-sub-wrap { white-space: normal; }
.run-meta { margin: 2px 0 0; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) {
  .run { flex-wrap: wrap; }
  .run .btn { width: 100%; }
}

/* Run page */
.run-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.run-head h1 { font-family: var(--mono); margin: 0; }
.card > .run-meta { white-space: normal; margin: 6px 0 0; }
.card > .alert:last-child { margin: 16px 0 0; }
.decision { margin-top: 18px; padding: 18px; border-radius: var(--r-sm); background: var(--soft); }
.decision-label { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.decision-value { margin: 2px 0 12px; font-size: 28px; font-weight: 700; letter-spacing: -.01em; }
.tiers { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tier { height: 28px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--muted); background: var(--canvas); border: 1px solid var(--hair); white-space: nowrap; flex: none; }
.tier.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.steps { list-style: none; margin: 0; padding: 0; }
.step { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.step:first-child { border-top: 0; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: #d1d5db; flex: none; }
.step-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-state { font-size: 13px; color: var(--muted); white-space: nowrap; flex: none; }
.step-done .step-dot { background: var(--ok); }
.step-now .step-dot { background: var(--info); box-shadow: 0 0 0 4px var(--info-bg); }
.step-now .step-name, .step-now .step-state { color: var(--info); font-weight: 600; }
.step-failed .step-dot { background: var(--err); }
.step-failed .step-state { color: var(--err); font-weight: 600; }
.step-stopped .step-dot { background: #d97706; }
.step-stopped .step-state { color: var(--warn); font-weight: 600; }
.step-wait .step-name { color: var(--muted); }
/* A card title with an icon action on its right (Report + download). The row keeps the title's own height; the 34px
   icon button overhangs it evenly, so the card below lays out exactly as with a bare title. */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 23px; margin: 0 0 10px; }
.card-head h2 { margin: 0; }
.card-head .icon-btn { margin: -6px -8px -6px 0; }
.icon-btn.skel { display: inline-block; width: 34px; height: 34px; border-radius: 999px; }
.report-sec { padding: 14px 0 0; border-top: 1px solid var(--hair); margin-top: 14px; }
.report-sec h3 { margin: 0 0 6px; }
.report-sec p { margin: 0; }
/* Upstream's complete_report.html: full card width, as tall as its own page (app.js), never a scroller of its own. */
.report-frame { display: block; width: 100%; min-height: 480px; overflow: hidden; margin-top: 14px; border: 1px solid var(--hair); border-radius: var(--r-sm); background: #fff; }

/* Account */

/* Connect */
.connect h1 { margin-bottom: 2px; }
.connect-lead { margin: 0 0 16px; font-size: 14px; }
.kv { margin: 0; border: 1px solid var(--hair); border-radius: var(--r-sm); }
.kv-row { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px; min-height: 48px; }
.kv-row + .kv-row { border-top: 1px solid var(--hair); }
.kv dt { flex: none; width: 52px; font-size: 13px; font-weight: 600; color: var(--muted); }
.kv dd { flex: 1 1 auto; min-width: 0; margin: 0; display: flex; align-items: center; gap: 2px; }
.kv-val { flex: 1 1 auto; min-width: 0; font: 13px/1.45 var(--mono); overflow-wrap: break-word; }
span.kv-val { font-family: var(--font); }
.inline-form { margin: 0; display: inline-flex; }
.icon-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 999px;
  border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; }
.icon-btn:hover { background: var(--soft); color: var(--ink); }
.icon-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 1px; }
.icon-btn .i-done, .icon-btn .i-eye-off { display: none; }
.icon-btn.copied .i-copy { display: none; }
.icon-btn.copied .i-done { display: block; color: var(--ok); }
.icon-btn[aria-pressed="true"] .i-eye { display: none; }
.icon-btn[aria-pressed="true"] .i-eye-off { display: block; }
.connect-note { margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.tabs { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.seg-tabs { display: inline-flex; align-self: flex-start; padding: 3px; gap: 2px; border-radius: 999px; background: var(--soft); }
.seg-tab { height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: none; font: 500 13px/1 var(--font); color: var(--muted);
  cursor: pointer; white-space: nowrap; }
.seg-tab[aria-selected="true"] { background: var(--canvas); color: var(--ink); box-shadow: 0 1px 2px rgba(17, 24, 39, .08); }
.seg-tabs.has-ind .seg-tab[aria-selected="true"] { background: transparent; box-shadow: none; }
.seg-tabs .seg-ind { background: var(--canvas); border-radius: 999px; box-shadow: 0 1px 2px rgba(17, 24, 39, .08); }
.seg-tab:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 1px; }
.code-box { display: flex; align-items: flex-start; gap: 4px; padding: 10px 6px 10px 14px; border-radius: var(--r-sm); background: var(--soft); }
.code-text { flex: 1 1 auto; min-width: 0; font: 13px/1.55 var(--mono); overflow-wrap: break-word; padding-top: 6px; }
.code-text .nw { white-space: nowrap; }
.steps-mini { margin: 0; padding-left: 20px; font-size: 14px; }
.steps-mini li { margin: 0 0 4px; }
.steps-mini code { font: 13px var(--mono); }

/* Motion: page cross-fades (View Transitions, no JS), gentle button press and hover, colour changes on status pills.
   Entrance motion is in app.js. Reduced motion turns all of it off. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation: none; }
/* The header (logo, nav, Sign out) is its own layer and never animates: the new page's header shows from the first
   frame and the old one is dropped, so the top stays still while the page below cross-fades. In the root cross-fade
   it would fade with the page, and fade in from white whenever the old page's snapshot comes up empty. The nav pill
   and labels inside it are their own layers above it (below). */
.top { view-transition-name: site-header; }
::view-transition-group(site-header), ::view-transition-new(site-header) { animation: none; }
::view-transition-old(site-header) { display: none; }
/* The nav pill glides (position and width) from the old page's active item to the new one. */
::view-transition-group(nav-pill) { animation-duration: 200ms; animation-timing-function: cubic-bezier(.22, 1, .36, 1); }
::view-transition-old(nav-pill), ::view-transition-new(nav-pill) { animation: none; width: 100%; height: 100%; }
::view-transition-old(nav-pill) { display: none; }
/* Each nav label is its own transition layer, stacked above the pill (z-index on the groups), and it does not animate:
   the label shows at its new colour from the first frame while the pill glides underneath. */
.nav-label-analysis { view-transition-name: nav-label-analysis; }
.nav-label-keys { view-transition-name: nav-label-keys; }
.nav-label-connect { view-transition-name: nav-label-connect; }
.nav-label-signout { view-transition-name: nav-label-signout; }
::view-transition-group(nav-pill) { z-index: 1; }
::view-transition-group(nav-label-analysis), ::view-transition-group(nav-label-keys),
::view-transition-group(nav-label-connect), ::view-transition-group(nav-label-signout) { z-index: 2; animation: none; }
::view-transition-old(nav-label-analysis), ::view-transition-old(nav-label-keys),
::view-transition-old(nav-label-connect), ::view-transition-old(nav-label-signout) { display: none; }
::view-transition-new(nav-label-analysis), ::view-transition-new(nav-label-keys),
::view-transition-new(nav-label-connect), ::view-transition-new(nav-label-signout) { animation: none; }
.btn, .nav-link, .icon-btn, .seg-tab, .select { transition: background-color .18s ease-out, border-color .18s ease-out, color .18s ease-out, box-shadow .18s ease-out, opacity .18s ease-out; }
.pill { transition: background-color .2s ease-out, color .2s ease-out; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-old(root), ::view-transition-new(root), ::view-transition-group(nav-pill) { animation: none; }
  .btn, .nav-link, .icon-btn, .seg-tab, .select, .pill, .check, .seg, .checkbox, .cb-mark path { transition: none; }
}

/* Loading skeletons: rounded gray bars with a soft shimmer, in the real component's own markup so sizes match.
   .skel-wrap stays invisible for the first 150ms, so a fast load never flashes a skeleton. Reduced motion: static. */
:root { --skel-1: #eef0f3; --skel-2: #f7f8fa; }
.skel { display: inline-block; height: .85em; max-width: 100%; vertical-align: middle; border-radius: 6px;
  background: linear-gradient(90deg, var(--skel-1) 25%, var(--skel-2) 37%, var(--skel-1) 63%) 0 0 / 400% 100%;
  animation: skel-shimmer 1.2s ease-in-out infinite; }
.pill.skel, .btn.skel { display: inline-flex; height: auto; border: 0; }
.pill.skel { height: 24px; border-radius: 999px; }
.btn.skel { height: 34px; border-radius: 999px; }
.skel-input { display: block; border-color: transparent; }
.skel-input.skel { display: block; height: 44px; border-radius: var(--r-sm); }
.skel-btn { width: 112px; }
.skel-line { display: flex; align-items: center; height: 1lh; }
.skel-line .skel { height: .8em; }
.empty .skel-line { justify-content: center; }
.skel-m { display: none; }
@media (max-width: 480px) { .skel-m { display: flex; } .skel-d { display: none; } }
.skel-wrap { opacity: 0; animation: skel-show 0s linear 150ms forwards; }
.skel.skel-wrap { animation: skel-shimmer 1.2s ease-in-out infinite, skel-show 0s linear 150ms forwards; }
@keyframes skel-show { to { opacity: 1; } }
@keyframes skel-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .skel.skel-wrap { animation: skel-show 0s linear 150ms forwards; }
}

/* Skeleton layers during the per-block crossfade (taReveal.layer): absolute over their host, laid out with the
   host's own classes, already visible (no 150ms delay again), transparent so the real content shows through. */
.load-box { position: relative; }
.card.key-card, .connect { position: relative; }
.skel-layer { position: absolute !important; inset: 0; margin: 0; pointer-events: none; }
.skel-layer.card { inset: -1px; background: transparent; box-shadow: none; }
.skel-layer .card { background: transparent; }
.skel-layer .skel-wrap, .skel-layer.skel-wrap { animation: none; opacity: 1; }
.skel-layer .skel.skel-wrap { animation: skel-shimmer 1.2s ease-in-out infinite; opacity: 1; }
@media (prefers-reduced-motion: reduce) { .skel-layer .skel.skel-wrap { animation: none; } }

/* Page shells (_shells.html, app.js taNav): shown at once when a tab's page is slow to arrive, then each block
   crossfades in place to the real one. The shell's blocks keep the real page's last measured heights. */
main { position: relative; }
.shell-layer { display: flex; flex-direction: column; gap: 16px; }
.shell-form { margin-top: 20px; }
.shell-chart { display: block; height: 168px; margin-top: 16px; border-radius: 12px; }
.shell-tabs { display: block; height: 40px; margin: 16px 0; border-radius: 999px; }
main[data-shell] > *, .shell-layer > * { overflow: hidden; }

/* Working states animate (Rustin 2026-10-30: "always animate the stuff thats working"): the running step's dot and
   the Running pill's dot send out a soft ring that grows and fades, on a 1.4s loop. Queued, Done, Failed and Stopped
   stay still. Transform and opacity only, on a pseudo-element, so nothing moves. app.js (taPulse) keeps every dot on
   one clock when a polled list is swapped in. Reduced motion: the dot stays, the ring does not. */
.pulse-dot { position: relative; flex: none; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.pulse-dot::after, .step-now .step-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: currentColor; opacity: 0; animation: ta-pulse 1.4s cubic-bezier(.22, 1, .36, 1) infinite; pointer-events: none; }
.step-now .step-dot { position: relative; color: var(--info); }
@keyframes ta-pulse { 0% { transform: scale(1); opacity: .45; } 100% { transform: scale(2.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .pulse-dot::after, .step-now .step-dot::after { animation: none; display: none; } }

/* A submit in flight (Keys card Save or Delete, Start analysis): the form stays exactly where it is, its fields and
   buttons gray out and lock (disabled, set after 150ms so a fast reply never flashes), and the submit button shows a
   small spinner. No skeleton, no fade, no size change. */
.select:disabled { background: var(--soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right 12px center/12px no-repeat; }
.icon-btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn:disabled:hover { background: transparent; color: inherit; }
.spin { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: ta-spin .7s linear infinite; }
@keyframes ta-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; border-right-color: currentColor; opacity: .6; } }
