/* Agentic tool system UI: the live "in flight" line, the step timeline, the approval card and the inspector sheet.
   Liquid Glass + Sage + Newsreader for words, Doto for technical labels. Motion rides the app spring (--lg-spring-ease / --lg-spring-dur, js/motion.js).
   Every colour comes from the Studio tokens (no raw colours); reduced motion turns the movement off. */
:root { --ag-sage: var(--sv-accent); --ag-sage-bright: color-mix(in srgb, var(--sv-accent) 78%, #fff); --ag-ease: var(--lg-spring-ease, cubic-bezier(.22, 1, .36, 1)); --ag-dur: var(--lg-spring-dur, 300ms); }

/* ------------------------------------------------------------------ <LiveFlightStatus /> */
.lf-status { position: absolute; left: 6px; bottom: calc(100% + 10px); z-index: 3; display: inline-flex; align-items: center; gap: 8px; max-width: calc(100% - 12px); margin: 0; padding: 4px 2px; border: 0; background: transparent; box-shadow: none; cursor: pointer; text-align: left;
  font-family: var(--font-doto, ui-monospace, monospace); font-size: var(--sv-type-tool-description-size); font-weight: 500; line-height: 1.2; letter-spacing: .06em; text-transform: uppercase; color: var(--ag-sage); -webkit-tap-highlight-color: transparent; opacity: 0; transform: translateY(6px); pointer-events: none; }
.lf-status[hidden] { display: none; }
.lf-status.lf-in { opacity: 1; transform: none; pointer-events: auto; transition: opacity var(--ag-dur) var(--ag-ease), transform var(--ag-dur) var(--ag-ease); }
.lf-status.lf-out { opacity: 0; transform: translateY(6px); pointer-events: none; transition: opacity var(--ag-dur) var(--ag-ease), transform var(--ag-dur) var(--ag-ease); }
.lf-status:active { transform: scale(.98); }
.lf-status:focus-visible { outline: 2px solid var(--ag-sage); outline-offset: 4px; border-radius: 6px; }
.lf-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--ag-sage); animation: lf-breathe 1.6s ease-in-out infinite; }
@keyframes lf-breathe { 0%, 100% { opacity: .45; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
.lf-verb { color: var(--ag-sage-bright); background: linear-gradient(100deg, var(--ag-sage-bright) 30%, color-mix(in srgb, var(--ag-sage-bright) 55%, #fff) 50%, var(--ag-sage-bright) 70%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: lf-shimmer 2.4s linear infinite; }
@keyframes lf-shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.lf-sep { opacity: .7; } .lf-count { color: var(--ag-sage); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ <ToolExecutionTimeline /> */
.ag-timeline-host { margin: 0 0 8px; } .ag-cards { display: grid; gap: 10px; margin: 0 0 10px; } .ag-cards:empty { display: none; }
.tl { margin: 0 0 6px; } .tl[hidden] { display: none; }
.tl-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px 0 14px; border-radius: 9999px; cursor: pointer; font-family: var(--font-newsreader); font-size: .95rem; color: var(--sv-text-secondary);
  background: color-mix(in srgb, #fff 6%, transparent); border: 1px solid color-mix(in srgb, #fff 12%, transparent); box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent); -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%); transition: transform var(--ag-dur) var(--ag-ease), background var(--ag-dur) var(--ag-ease); }
.tl-pill:active { transform: scale(.96); } .tl-pill:focus-visible { outline: 2px solid var(--ag-sage); outline-offset: 2px; }
.tl-live { width: 6px; height: 6px; border-radius: 50%; background: var(--ag-sage); animation: lf-breathe 1.6s ease-in-out infinite; } .tl-live[hidden] { display: none; }
.tl-chev { display: inline-grid; width: 18px; height: 18px; place-items: center; transition: transform var(--ag-dur) var(--ag-ease); } .tl-chev svg { width: 16px; height: 16px; }
.tl-open .tl-chev { transform: rotate(90deg); }
.tl-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--ag-dur) var(--ag-ease); } .tl-open .tl-body { grid-template-rows: 1fr; } .tl-inner { overflow: hidden; min-height: 0; }
.tl-list { list-style: none; margin: 8px 0 0 10px; padding: 0 0 0 0; position: relative; }
.tl-item { position: relative; padding-left: 22px; }
.tl-item::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 1px; background: color-mix(in srgb, #fff 16%, transparent); }   /* the vertical connecting line */
.tl-item:first-child::before { top: 50%; } .tl-item:last-child::before { bottom: 50%; }
.tl-node { position: absolute; left: 0; top: 50%; width: 9px; height: 9px; margin-top: -4.5px; border-radius: 50%; background: var(--sv-chat-bg, #000); border: 1.5px solid color-mix(in srgb, #fff 34%, transparent); z-index: 1; }
.tl-item[data-status="running"] .tl-node { border-color: var(--ag-sage); background: var(--ag-sage); animation: lf-breathe 1.6s ease-in-out infinite; }
.tl-item[data-status="completed"] .tl-node { border-color: var(--ag-sage); } .tl-item[data-status="failed"] .tl-node { border-color: var(--sv-error); } .tl-item[data-status="denied"] .tl-node, .tl-item[data-status="interrupted"] .tl-node { opacity: .55; }
.tl-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px 6px 4px; border: 0; background: transparent; color: var(--sv-text); text-align: left; cursor: pointer; border-radius: 10px; transition: background var(--ag-dur) var(--ag-ease), transform var(--ag-dur) var(--ag-ease); }
.tl-row:hover { background: color-mix(in srgb, #fff 5%, transparent); } .tl-row:active { transform: scale(.98); } .tl-row:focus-visible { outline: 2px solid var(--ag-sage); outline-offset: -2px; }
.tl-verb { flex: none; min-width: 5.2ch; font-size: var(--sv-type-tool-description-size); font-weight: 700; letter-spacing: .07em; color: var(--ag-sage-bright); }
.tl-target { flex: 1 1 auto; min-width: 0; font-size: var(--sv-type-tool-description-size); color: var(--sv-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-end { flex: none; display: inline-flex; gap: 8px; font-size: var(--sv-type-metadata-size); letter-spacing: .06em; color: var(--sv-text-secondary); }
.tl-item[data-status="failed"] .tl-state { color: var(--sv-error); }

/* ------------------------------------------------------------------ <ToolApprovalCard /> */
.ap { padding: 14px 14px 12px; border-radius: 22px; background: color-mix(in srgb, #fff 6%, transparent); border: 1.2px solid color-mix(in srgb, #fff 20%, transparent); box-shadow: inset 0 2px 2px color-mix(in srgb, #fff 24%, transparent), inset 0 -2px 3px rgba(var(--sv-accent-rgb), .18), 0 16px 36px rgba(0, 0, 0, .5);
  -webkit-backdrop-filter: blur(22px) saturate(190%) contrast(112%); backdrop-filter: blur(22px) saturate(190%) contrast(112%); animation: ap-in var(--ag-dur) var(--ag-ease) both; }
@keyframes ap-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
.ap-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; } .ap-title { font-family: var(--font-newsreader); font-size: 1.05rem; color: var(--sv-text); }
.ap-risk { font-size: var(--sv-type-metadata-size); letter-spacing: .07em; padding: 3px 8px; border-radius: 9999px; color: var(--ag-sage-bright); background: rgba(var(--sv-accent-rgb), .16); }
.ap[data-risk="high"] .ap-risk, .ap[data-risk="critical"] .ap-risk { color: var(--sv-text); background: color-mix(in srgb, var(--sv-error) 28%, transparent); }
.ap-reason { margin: 0 0 10px; color: var(--sv-text-secondary); font-size: .95rem; line-height: 1.45; }
.ap-what { display: flex; gap: 10px; align-items: baseline; width: 100%; margin: 0 0 12px; padding: 10px 12px; border: 0; border-radius: 14px; text-align: left; cursor: pointer; background: rgba(0, 0, 0, .28); color: var(--sv-text); font-size: var(--sv-type-tool-description-size); line-height: 1.5; overflow: hidden; }
.ap-verb { flex: none; font-weight: 700; letter-spacing: .07em; color: var(--ag-sage-bright); } .ap-target { min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; max-height: 7.5em; overflow: hidden; }
.ap-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.ap-pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 9999px; border: 0; cursor: pointer; font-family: var(--font-newsreader); font-size: var(--sv-type-body-secondary-size); transition: transform var(--ag-dur) var(--ag-ease), opacity var(--ag-dur) var(--ag-ease); }
.ap-pill svg { width: 18px; height: 18px; } .ap-pill:active { transform: scale(.96); } .ap-pill:disabled { opacity: .5; cursor: default; }
.ap-approve { background: var(--ag-sage); color: rgb(var(--sv-chat-bg-rgb)); font-weight: 600; box-shadow: 0 6px 18px rgba(var(--sv-accent-rgb), .35); }
.ap-deny { background: color-mix(in srgb, #fff 8%, transparent); color: var(--sv-text); border: 1px solid color-mix(in srgb, #fff 18%, transparent); }
.ap-note { margin: 8px 0 0; font-size: .9rem; color: var(--sv-text-secondary); min-height: 0; } .ap-note:empty { display: none; } .ap.ap-done { opacity: .8; } .ap.ap-settled { display: none; }

/* ------------------------------------------------------------------ <ToolInspectorSheet /> */
.ag-sheet-backdrop { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0); transition: background var(--ag-dur) var(--ag-ease); }
.ag-sheet-backdrop.open { background: rgba(0, 0, 0, .46); } .ag-sheet-backdrop.closing { background: rgba(0, 0, 0, 0); }
.in-sheet { display: flex; flex-direction: column; width: min(100%, 640px); max-height: min(86dvh, 760px); border-radius: 28px 28px 0 0; outline: none; transform: translateY(100%); transition: transform var(--ag-dur) var(--ag-ease);
  background: color-mix(in srgb, var(--sv-sheet, var(--sv-card)) 82%, transparent); border: 1.2px solid color-mix(in srgb, #fff 18%, transparent); border-bottom: 0; box-shadow: inset 0 2px 2px color-mix(in srgb, #fff 22%, transparent), 0 -16px 36px rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(24px) saturate(190%) contrast(112%); backdrop-filter: blur(24px) saturate(190%) contrast(112%); padding-bottom: env(safe-area-inset-bottom, 0px); }
.ag-sheet-backdrop.open .in-sheet { transform: none; } .ag-sheet-backdrop.closing .in-sheet { transform: translateY(100%); }
@media (min-width: 900px) { .ag-sheet-backdrop { align-items: center; } .in-sheet { border-radius: 28px; border-bottom: 1.2px solid color-mix(in srgb, #fff 18%, transparent); transform: translateY(24px) scale(.98); opacity: 0; transition: transform var(--ag-dur) var(--ag-ease), opacity var(--ag-dur) var(--ag-ease); } .ag-sheet-backdrop.open .in-sheet { transform: none; opacity: 1; } .ag-sheet-backdrop.closing .in-sheet { transform: translateY(24px) scale(.98); opacity: 0; } }
.in-grab { align-self: center; width: 40px; height: 4px; margin: 8px 0 2px; border-radius: 9999px; background: color-mix(in srgb, #fff 26%, transparent); }
.in-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px 18px; } .in-heading { flex: 1; min-width: 0; } .in-title { margin: 0; font-size: var(--sv-type-subtitle-size); font-weight: 700; letter-spacing: .07em; color: var(--sv-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .in-sub { margin: 2px 0 0; font-size: var(--sv-type-metadata-size); letter-spacing: .06em; color: var(--ag-sage); }
.in-close, .in-back { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid color-mix(in srgb, #fff 14%, transparent); background: color-mix(in srgb, #fff 7%, transparent); color: var(--sv-text); cursor: pointer; } .in-close:active, .in-back:active { transform: scale(.96); } .in-back[hidden] { display: none; }
.in-content { overflow: auto; padding: 4px 18px 18px; display: grid; gap: 14px; overscroll-behavior: contain; }
.in-sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; } .in-sec-title { margin: 0; font-size: var(--sv-type-metadata-size); font-weight: 700; letter-spacing: .07em; color: var(--sv-text-secondary); }
.in-copy { display: inline-grid; place-items: center; width: 44px; height: 44px; margin: -8px -8px -8px 0; border: 0; border-radius: 50%; background: transparent; color: var(--sv-text-secondary); cursor: pointer; } .in-copy svg { width: 18px; height: 18px; } .in-copy.done { color: var(--ag-sage); }
.in-text { margin: 0; color: var(--sv-text); line-height: 1.52; }
.in-pre { margin: 0; padding: 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, .34); color: var(--sv-text); font-size: var(--sv-type-tool-description-size); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; } .in-out { max-height: 38dvh; overflow: auto; }
.in-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; border-radius: 14px; background: color-mix(in srgb, #fff 6%, transparent); color: var(--sv-text); cursor: pointer; text-align: left; margin-bottom: 8px; } .in-item svg { width: 16px; height: 16px; flex: none; color: var(--sv-text-secondary); }
.in-item-verb { font-size: var(--sv-type-tool-description-size); font-weight: 700; letter-spacing: .07em; color: var(--ag-sage-bright); } .in-item-target { flex: 1; min-width: 0; font-size: var(--sv-type-tool-description-size); color: var(--sv-text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .in-empty { margin: 0; color: var(--sv-text-secondary); }

/* the composer's Tools toggle reads as on when active */
.composer-agent.active { color: var(--ag-sage-bright); }

@media (prefers-reduced-motion: reduce) { .lf-dot, .tl-live, .lf-verb, .tl-item[data-status="running"] .tl-node { animation: none; } .lf-status, .lf-status.lf-in, .lf-status.lf-out, .tl-body, .tl-chev, .ap, .in-sheet, .ag-sheet-backdrop { transition: none; animation: none; } .lf-status { transform: none; } }

/* ------------------------------------------------------------------ screenshots a step took (preview_and_verify) */
.tl-shots { display: flex; gap: 10px; padding: 2px 0 10px 4px; overflow-x: auto; scrollbar-width: none; }
.tl-shots::-webkit-scrollbar { display: none; }
.tl-shot { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; color: var(--sv-text-secondary); min-height: 44px; }
.tl-shot-img { display: block; height: 96px; width: auto; max-width: 168px; object-fit: cover; object-position: top; border-radius: 12px; border: 1.2px solid color-mix(in srgb, #fff 20%, transparent); box-shadow: inset 0 1px 1px color-mix(in srgb, #fff 24%, transparent); background: rgba(0, 0, 0, .34); transition: transform var(--ag-dur) var(--ag-ease); }
.tl-shot:active .tl-shot-img { transform: scale(.97); } .tl-shot:focus-visible { outline: 2px solid var(--ag-sage); outline-offset: 2px; border-radius: 12px; }
.tl-shot-cap { font-size: 10px; letter-spacing: .07em; }
.in-shots { display: flex; flex-direction: column; gap: 14px; }
.in-shot { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.in-shot-img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; object-position: top; border-radius: 14px; border: 1.2px solid color-mix(in srgb, #fff 20%, transparent); background: rgba(0, 0, 0, .34); }
.in-shot-cap { font-size: var(--sv-type-metadata-size); letter-spacing: .07em; color: var(--sv-text-secondary); }
@media (prefers-reduced-motion: reduce) { .tl-shot-img { transition: none; } }
